Merge pull request #313 from kichikuou/CGManager

Implement CGManager functions for Rance 9
This commit is contained in:
Nunuhara Cabbage
2026-03-31 21:36:04 -07:00
committed by GitHub
+23
View File
@@ -14,6 +14,7 @@
* along with this program; if not, see <http://gnu.org/licenses/>.
*/
#include "system4/cg.h"
#include "system4/string.h"
#include "asset_manager.h"
#include "xsystem4.h"
@@ -32,6 +33,26 @@ static bool CGManager_LoadArchive(struct string *archive_name)
return r;
}
static bool CGManager_IsExist(struct string *cg_name)
{
if (!cg_name)
return false;
return asset_exists_by_name(ASSET_CG, cg_name->text, NULL);
}
static bool CGManager_GetInfo(struct string *cg_name, int *width, int *height, int *bpp, bool *exist_pixel, bool *exist_alpha)
{
struct cg_metrics metrics;
if (!cg_name || !asset_cg_get_metrics_by_name(cg_name->text, &metrics))
return false;
*width = metrics.w;
*height = metrics.h;
*bpp = metrics.bpp;
*exist_pixel = metrics.has_pixel;
*exist_alpha = metrics.has_alpha;
return true;
}
//static int CGManager_GetCountOfDataFromArchive(void);
//static void CGManager_GetTitleByIndexFromArchive(int index, struct string **cg_name);
//static int CGManager_SearchTitleFromArchive(struct string *cg_name);
@@ -43,6 +64,8 @@ static bool CGManager_LoadArchive(struct string *archive_name)
HLL_LIBRARY(CGManager,
HLL_EXPORT(Init, CGManager_Init),
HLL_EXPORT(LoadArchive, CGManager_LoadArchive),
HLL_EXPORT(IsExist, CGManager_IsExist),
HLL_EXPORT(GetInfo, CGManager_GetInfo),
HLL_TODO_EXPORT(GetCountOfDataFromArchive, CGManager_GetCountOfDataFromArchive),
HLL_TODO_EXPORT(GetTitleByIndexFromArchive, CGManager_GetTitleByIndexFromArchive),
HLL_TODO_EXPORT(SearchTitleFromArchive, CGManager_SearchTitleFromArchive),