diff --git a/CMakeLists.txt b/CMakeLists.txt index b0f4a93..ec2fe1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,6 +133,7 @@ target_sources(xsystem4 PRIVATE src/hll/DALKEDemo.c src/hll/Data.c src/hll/DataFile.c + src/hll/Discord.c src/hll/DrawDungeon.c src/hll/DrawEffect.c src/hll/DrawGraph.c diff --git a/src/ffi.c b/src/ffi.c index 6e72af4..17aad6c 100644 --- a/src/ffi.c +++ b/src/ffi.c @@ -441,6 +441,7 @@ extern struct static_library lib_DALKDemo; extern struct static_library lib_DALKEDemo; extern struct static_library lib_Data; extern struct static_library lib_DataFile; +extern struct static_library lib_Discord; extern struct static_library lib_DrawDungeon; extern struct static_library lib_DrawDungeon2; extern struct static_library lib_DrawDungeon14; @@ -563,6 +564,7 @@ static struct static_library *static_libraries[] = { &lib_DALKEDemo, &lib_Data, &lib_DataFile, + &lib_Discord, &lib_DrawDungeon, &lib_DrawDungeon2, &lib_DrawDungeon14, diff --git a/src/hll/AFAFactory.c b/src/hll/AFAFactory.c index 5e05296..eba8f9f 100644 --- a/src/hll/AFAFactory.c +++ b/src/hll/AFAFactory.c @@ -14,10 +14,31 @@ * along with this program; if not, see . */ +#include "system4/string.h" +#include "asset_manager.h" #include "hll.h" +static enum asset_type get_asset_type(int type) +{ + switch (type) { + case 2: return ASSET_CG; + case 3: return ASSET_FLAT; + default: return -1; + } +} + HLL_WARN_UNIMPLEMENTED(false, bool, AFAFactory, IsExistArchive, struct string *ArchiveName); -//bool AFAFactory_LoadArchive(int Type, struct string *ArchiveName); + +bool AFAFactory_LoadArchive(int type, struct string *archive_name) +{ + enum asset_type t = get_asset_type(type); + if (t < 0) { + WARNING("Unknown asset type: %d", type); + return false; + } + return asset_manager_load_archive(t, archive_name->text); +} + //int AFAFactory_GetCountOfData(int Type); //void AFAFactory_GetTitleByIndex(int Type, int Index, struct string **Name); //int AFAFactory_SearchTitle(int Type, struct string *Name); @@ -28,7 +49,7 @@ HLL_WARN_UNIMPLEMENTED(false, bool, AFAFactory, IsExistArchive, struct string *A HLL_LIBRARY(AFAFactory, HLL_EXPORT(IsExistArchive, AFAFactory_IsExistArchive), - HLL_TODO_EXPORT(LoadArchive, AFAFactory_LoadArchive), + HLL_EXPORT(LoadArchive, AFAFactory_LoadArchive), HLL_TODO_EXPORT(GetCountOfData, AFAFactory_GetCountOfData), HLL_TODO_EXPORT(GetTitleByIndex, AFAFactory_GetTitleByIndex), HLL_TODO_EXPORT(SearchTitle, AFAFactory_SearchTitle), diff --git a/src/hll/Discord.c b/src/hll/Discord.c new file mode 100644 index 0000000..3bb9d87 --- /dev/null +++ b/src/hll/Discord.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2026 Nunuhara Cabbage + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "hll.h" + +static void Discord_Update(void) +{ + +} + +static void Discord_UpdateActivity(struct string **pIText, struct string **pIText2) +{ + +} + +HLL_LIBRARY(Discord, + HLL_EXPORT(Update, Discord_Update), + HLL_EXPORT(UpdateActivity, Discord_UpdateActivity) + ); diff --git a/src/meson.build b/src/meson.build index c2b7e04..67bde35 100644 --- a/src/meson.build +++ b/src/meson.build @@ -94,6 +94,7 @@ xsystem4 = [version_h, 'hll/DALKEDemo.c', 'hll/Data.c', 'hll/DataFile.c', + 'hll/Discord.c', 'hll/DrawDungeon.c', 'hll/DrawEffect.c', 'hll/DrawGraph.c',