Skip to content

Commit

Permalink
Make supporting multiple versions of the same game possible
Browse files Browse the repository at this point in the history
  • Loading branch information
32th-System committed Sep 10, 2024
1 parent 04c3f08 commit 37fcd67
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
10 changes: 9 additions & 1 deletion thprac/src/thprac/thprac_launcher_games.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2253,7 +2253,15 @@ class THGameGui {

ImGui::TextUnformatted(title);
ImGui::Columns(columns);
for (auto& gameRef : gGameDefs) {
for (size_t i = 0; i < elementsof(gGameDefs); i++) {
// In case I need multiple gameDefs for the same game cause I, let's say
// want to support multiple versions of the same game
//
// Yes I'm comparing string pointers and not actual strings. This is OK here.
auto& gameRef = gGameDefs[i];
if (i != 0 && gameRef.idStr == gGameDefs[i - 1].idStr) {
continue;
}
if (gameRef.catagory == catagory) {
auto& game = mGames[gameRef.idStr];
if (!(i % columns)) {
Expand Down
17 changes: 15 additions & 2 deletions thprac/src/thprac/thprac_launcher_games_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ extern void TH165Init();
extern void TH17Init();
extern void TH18Init();
extern void TH185Init();
extern void TH19Init();
extern void TH19_v1_00a_Init();
extern void TH19_v1_10c_Init();

static THKnownGame gKnownGames[] {
{ "th06",
Expand Down Expand Up @@ -516,12 +517,24 @@ static THGameSig gGameDefs[] {
CAT_MAIN,
nullptr,
L"%APPDATA%\\ShanghaiAlice\\th19",
TH19Init,
TH19_v1_00a_Init,
{ 1690598468, 1433600,
{ 0xdfa9, 0x4247, 0xaa43, 0xba3e, 0xbaba,
0x0e2e, 0x1d90, 0xb748, 0x8d5c, 0x1fbb },
{ 0x1ef2d050, 0xbddd8da2,
0x56cedb87, 0xe674cd2c } } },
{ "th19",
L"2400340",
TH19_TITLE,
CAT_MAIN,
nullptr,
L"%APPDATA%\\ShanghaiAlice\\th19",
TH19_v1_10c_Init,
{ 1720429610, 1544704,
{ 0xb3a9, 0x4245, 0xaa43, 0xba3e, 0xbaba,
0x0e2e, 0x1a4a, 0xb748, 0xad5c, 0x1dfb },
{ 0x4951fa2e, 0x63b2d14d,
0x4b3ab26a, 0x3ee8b40d } } },
};

#pragma region Game Roll Def
Expand Down
6 changes: 5 additions & 1 deletion thprac/src/thprac/thprac_th19.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,9 +818,13 @@ namespace TH19 {
}


void TH19Init()
void TH19_v1_00a_Init()
{
ingame_image_base = (uintptr_t)GetModuleHandleW(NULL);
TH19::THInitHook::singleton().EnableAllHooks();
}

void TH19_v1_10c_Init() {
MessageBoxW(NULL, L"TODO: add support for v1.10c", L"", MB_ICONINFORMATION);
}
}

0 comments on commit 37fcd67

Please sign in to comment.