This commit is contained in:
Nishi 2026-01-12 07:28:24 +09:00
commit bcefd78599
Signed by: nishi
GPG key ID: 27EF69B208EB9343
9 changed files with 102 additions and 4 deletions

View file

@ -4,8 +4,9 @@
#include <GearSrc/Log.h>
#include <GearSrc/Client.h>
#include <GearSrc/Server.h>
#include <GearSrc/GL.h>
#include <GearSrc/Resource.h>
#include <GearSrc/XML.h>
#include <GearSrc/String.h>
#include <stb_ds.h>
@ -20,8 +21,26 @@ void GSInit(void) {
int GSEngineRegisterResource(GSEngine engine, const char* name, const char* path) {
GSResource resource;
if((resource = GSResourceOpen(engine, path)) != NULL) {
GSXML xl;
char* s = GSStringConcat(name, ":/manifest.xml");
int ind;
shput(engine->resource, name, resource);
if((xl = GSXMLOpen(engine, s)) == NULL) {
free(s);
GSResourceClose(resource);
shdel(engine->resource, name);
return 0;
}
free(s);
ind = shgeti(engine->resource, name);
engine->resource[ind].xml = xl;
return 1;
}
@ -76,6 +95,7 @@ GSEngine GSEngineCreate(GSEngineParam* param) {
void GSEngineDestroy(GSEngine engine) {
int i;
for(i = 0; i < shlen(engine->resource); i++) {
GSXMLClose(engine->resource[i].xml);
GSResourceClose(engine->resource[i].value);
}
shfree(engine->resource);