Skip to content

Commit

Permalink
add isBSALoaded (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
c6-dev authored May 5, 2024
1 parent dbc6e4a commit c60f7aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions JG/JohnnyGuitarNVSE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ extern "C" {
REG_CMD(SetCameraShakeNoHUDShudder);
REG_CMD(GameGetSecondsPassed);
REG_CMD(SetJohnnyOnKeyboardControllerSelectionChangeEventHandler);
REG_CMD(IsBSALoaded);
g_scriptInterface = (NVSEScriptInterface*)nvse->QueryInterface(kInterface_Script);
g_cmdTableInterface = (NVSECommandTableInterface*)nvse->QueryInterface(kInterface_CommandTable);
s_strArgBuf = (char*)malloc((sizeof(char)) * 1024);
Expand Down
15 changes: 15 additions & 0 deletions JG/functions/fn_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,23 @@ DEFINE_COMMAND_PLUGIN(GetTextureFormat, , 0, 1, kParams_OneString);
DEFINE_COMMAND_PLUGIN(GetTextureMipMapCount, , 0, 1, kParams_OneString);
DEFINE_COMMAND_PLUGIN(PlaySoundFile, , 0, 3, kParams_OneString_TwoOptionalInts);
DEFINE_COMMAND_PLUGIN(StopSoundFile, , 0, 0, NULL);
DEFINE_COMMAND_PLUGIN(IsBSALoaded, , 0, 1, kParams_OneString);
#include <filesystem>

bool Cmd_IsBSALoaded_Execute(COMMAND_ARGS) {
char path[MAX_PATH];
char fixPath[MAX_PATH];
*result = 0;
if (ExtractArgsEx(EXTRACT_ARGS_EX, &path)) {
snprintf(fixPath, MAX_PATH, "DATA\\%s", path);
DWORD* archive = CdeclCall<DWORD*>(0xAF5320, fixPath); // ArchiveManager::GetArchiveByName
if (archive != nullptr) {
*result = 1;
}
}
return true;
}

bool Cmd_StopSoundFile_Execute(COMMAND_ARGS) {
*result = 0;
CdeclCall<void>(0x8304A0);
Expand Down

0 comments on commit c60f7aa

Please sign in to comment.