This commit is contained in:
Guus Waals 2024-09-26 03:12:43 +08:00
parent 7fab525f42
commit 4b26993891
31 changed files with 1525 additions and 153 deletions

View File

@ -13,7 +13,23 @@ add_executable(game_re
target_compile_features(game_re PUBLIC cxx_std_20)
target_include_directories(game_re PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/third_party/bink
)
if(WIN32)
target_link_directories(game_re PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/bink)
target_include_directories(game_re PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/bink)
target_link_libraries(game_re PRIVATE binkw32)
# Copy to output dir
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/binkw32.dll
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/third_party/bink/binkw32.dll ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_target(copy_binkw32 ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/binkw32.dll)
add_dependencies(game_re copy_binkw32)
endif()
target_compile_definitions(game_re PRIVATE
R3_GAME_DATA_DIR=\"${GAME_DATA_DIR}\"

1
game_re/_gh_fix Symbolic link
View File

@ -0,0 +1 @@
gh_fix

View File

@ -0,0 +1,53 @@
// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!!
#include <r3/binders/auto.h>
#include <gh_global.h>
#include <spdlog/spdlog.h>
extern "C" {
void r3_noop(void *p_cTxt1, void *p_cTxt2); // 00401100 // r3_noop
tdstLastErrorInfo *Erm_fn_p_stFindstMyLastErrorInfo(
ulong ulChannelId); // 0043e2b0 // Erm_fn_p_stFindstMyLastErrorInfo
// 0043e410
/* Check CpaError.h */
void Erm_fn_v_UpdateLastError(ushort uwStartOfWarningsId, byte ucModuleId,
ulong ulChannelId, ushort uwErrNum,
long lDebugData, uchar ucOpenInfoWindow,
uchar ucStopForDebug, char *szPersonalMsg)
{
tdstLastErrorInfo *ptVar2;
ptVar2 = Erm_fn_p_stFindstMyLastErrorInfo(ulChannelId);
if (ptVar2 == (tdstLastErrorInfo *)0x0) {
throw std::runtime_error(
fmt::format("{} {}", s_Error_in_the_Erm__005bd374,
s_There_is_no_more_Channel_error_t_005bd388));
}
if (ptVar2->lastErr != 0) {
throw std::runtime_error(
fmt::format("{}", s_Strange__The_last_error_was_neve_005bd348));
}
ptVar2->lastErr = uwErrNum;
ptVar2->ucLastFailedModuleId = ucModuleId;
ptVar2->ulChannelId = ulChannelId;
if (uwErrNum < uwStartOfWarningsId) {
if (szPersonalMsg == (char *)0x0) {
throw std::runtime_error(fmt::format(
"Unkown fatal error ({}, module: {})", uwErrNum, ucModuleId));
} else {
throw std::runtime_error(
fmt::format("Unkown fatal error ({}, module: {}, {})", uwErrNum,
ucModuleId, szPersonalMsg));
}
}
if (szPersonalMsg == (char *)0x0) {
return;
} else {
SPDLOG_WARN("Erm_Warn: {}, module: {}, {}", uwErrNum, ucModuleId,
szPersonalMsg);
}
}
}

View File

@ -0,0 +1,26 @@
// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!!
#include <r3/binders/auto.h>
#include <gh_global.h>
extern "C" {
// 0043ff60
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
void FUN_0043ff60(float param_1,float param_2,float param_3)
{
longlong lVar1;
longlong lVar2;
longlong lVar3;
lVar1 = r3_ftol(param_1 * 255.0);
lVar2 = r3_ftol(param_2 * 255.0);
lVar3 = r3_ftol(param_3 * 255.0);
DAT_007a2c14 = ((int)lVar1 << 8 | (uint)lVar2) << 8 | (uint)lVar3;
return;
}
}

View File

@ -0,0 +1,16 @@
// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!!
#include <r3/binders/auto.h>
#include <gh_global.h>
#include <bink.h>
extern "C" {
// 00441e40
void binkInit(void) {
BinkSetSoundSystem(&BinkOpenDirectSound, 0);
BinkSetSoundOnOff(0, 0);
BinkSetIOSize(0x80000000);
return;
}
}

View File

@ -6,9 +6,8 @@
#include <gh_global.h>
#include <stdexcept>
// 00442cc0
// r3_module2_init
extern "C" undefined r3_module2_init(void) {
// TODO: Implement this function
throw GHStubException("Function not implemented: r3_module2_init");
// 00445580
// r3_checkCmdlineLevel
extern "C" void r3_checkCmdlineLevel(void) {
// NOOP
}

View File

@ -0,0 +1,24 @@
// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!!
#include <r3/binders/auto.h>
#include <gh_global.h>
extern "C" {
// 0045d2e0
void r3_initUnusedSM(void)
{
WORD_007d9e68 = 1;
/* 0x53 */
sz_S[0] = s_S_005bf008[0];
sz_S[1] = s_S_005bf008[1];
WORD_007d9e6c = 2;
/* 0x4d */
sz_M[0] = s_M_005bf004[0];
sz_M[1] = s_M_005bf004[1];
return;
}
}

View File

@ -0,0 +1,24 @@
// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!!
#include <r3/binders/auto.h>
#include <gh_global.h>
extern "C" {
void Erm_fn_v_UpdateLastError(ushort uwStartOfWarningsId, byte ucModuleId, ulong ulChannelId, ushort uwErrNum, long lDebugData, uchar ucOpenInfoWindow, uchar ucStopForDebug, char * szPersonalMsg); // 0043e410 // Erm_fn_v_UpdateLastError
byte Erm_fn_ucInitErrMsg(void); // 0043e1d0 // Erm_fn_ucInitErrMsg
// 00504ef0
void r3_module10_init(void)
{
/* 0x104ef0 95 IPT_fn_vFirstInitInput */
if (g_errMod10 == 0xff) {
g_errMod10 = Erm_fn_ucInitErrMsg();
return;
}
Erm_fn_v_UpdateLastError(3,g_errMod0,0,4,-1,0xff,0xff,(char *)0x0);
return;
}
}

View File

@ -0,0 +1,29 @@
// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!!
#include <r3/binders/auto.h>
#include <gh_global.h>
extern "C" {
// 00442090
void r3_validateBinkVideoQuality(byte videoBpp, byte wantedVideoQuality)
{
byte bVar1;
bVar1 = wantedVideoQuality;
if (4 < wantedVideoQuality) {
bVar1 = 4;
}
g_bink_realVideoQuality = g_bink_wantedVideoQuality;
if ((g_bink_wantedVideoQuality <= bVar1) &&
(g_bink_realVideoQuality = 4, wantedVideoQuality < 5)) {
g_bink_realVideoQuality = wantedVideoQuality;
}
wantedVideoQuality = (uint)g_bink_realVideoQuality;
g_bink_videoBpp = videoBpp;
g_bink_wantedVideoQualityPlus1 = wantedVideoQuality + 1;
DAT_007a2e0c = -(uint)(wantedVideoQuality != 0) & 0x80000000;
return;
}
}

View File

@ -1,5 +1,7 @@
// AUTO-GENERATED FILE
#include <r3/binders/global.h>
undefined *& PTR__BinkOpenDirectSound_4_0059733c= (undefined *&) GH_MEM(0x0059733c);
undefined& DAT_005a9ed4= (undefined&) GH_MEM(0x005a9ed4);
char(&s__s_not_initialized__005b63e0)[20] = reinterpret_cast<char(&)[20]>(GH_MEM(0x005b63e0));
char(&s_Please_run_the__s_setup__005b63f4)[28] = reinterpret_cast<char(&)[28]>(GH_MEM(0x005b63f4));
char(&s_dashCC)[4] = reinterpret_cast<char(&)[4]>(GH_MEM(0x005b6410));
@ -59,9 +61,22 @@ const char* s_None = "None"; // 005b6904
const char* s_UbiSoft_Ubi_ini = "/UbiSoft/Ubi.ini"; // 005b690c
undefined& s_percent_d= (undefined&) GH_MEM(0x005bad58);
byte& g_errMod0= (byte&) GH_MEM(0x005bd29c);
const char* s_Warning_error__005bd318 = "Warning error: "; // 005bd318
const char* s_Fatale_error__005bd328 = "\nFatale error: "; // 005bd328
const char* s_Fatale_error__005bd338 = "Fatale error: "; // 005bd338
const char* s_Strange__The_last_error_was_neve_005bd348 = "Strange!\nThe last error was never treated"; // 005bd348
const char* s_Error_in_the_Erm__005bd374 = "Error in the Erm:"; // 005bd374
const char* s_There_is_no_more_Channel_error_t_005bd388 = "There is no more Channel error to raise the new error.\nPerhaps the constant C_ucErmNbOfErrorChannel is too low."; // 005bd388
byte& g_errMod1= (byte&) GH_MEM(0x005bd4cc);
byte& g_errModMmg= (byte&) GH_MEM(0x005bd58c);
char& DAT_005bd5f4= (char&) GH_MEM(0x005bd5f4);
const char* s_Video_AutoAdjustQuality_005bd630 = "Video_AutoAdjustQuality"; // 005bd630
const char* s_Video_BPP_005bd648 = "Video_BPP"; // 005bd648
const char* s_Video_RealQuality_005bd654 = "Video_RealQuality"; // 005bd654
const char* s_Rayman_Arena_005bd668 = "Rayman Arena"; // 005bd668
const char* s_Video_WantedQuality_005bd678 = "Video_WantedQuality"; // 005bd678
const char* s_Videos_005bd72c = "Videos"; // 005bd72c
byte& g_errMod2Bink= (byte&) GH_MEM(0x005bd7ac);
const char* s__World_Sound_005bd9e8 = "\\World\\Sound"; // 005bd9e8
const char* s__Options_005bd9f8 = "\\Options"; // 005bd9f8
const char* s__Vignette_005bda04 = "\\Vignette"; // 005bda04
@ -110,8 +125,9 @@ const char* s_fmt_c_colon_s = "%c:%s"; // 005be540
const char* s_r3_program_files = "\\program files\\Ubi Soft\\Rayman3"; // 005be548
undefined *& PTR_DAT_005be568= (undefined *&) GH_MEM(0x005be568);
byte& g_errModFirst= (byte&) GH_MEM(0x005be6f0);
word& DAT_005bf004= (word&) GH_MEM(0x005bf004);
word& DAT_005bf008= (word&) GH_MEM(0x005bf008);
byte& g_errMod5= (byte&) GH_MEM(0x005befbc);
char(&s_M_005bf004)[2] = reinterpret_cast<char(&)[2]>(GH_MEM(0x005bf004));
char(&s_S_005bf008)[2] = reinterpret_cast<char(&)[2]>(GH_MEM(0x005bf008));
const char* s__08X__04X__04X__02X_02X__02X_02X_005bf6d8 = "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X"; // 005bf6d8
dword& r3_textureMemMode= (dword&) GH_MEM(0x005bf740);
const char* s_Agp8_005bf744 = "Agp8"; // 005bf744
@ -123,13 +139,25 @@ const char* s_Vram = "Vram"; // 005bf76c
byte& g_errMod7= (byte&) GH_MEM(0x005c069c);
undefined2& DAT_005c0f20= (undefined2&) GH_MEM(0x005c0f20);
char& DAT_005c0f22= (char&) GH_MEM(0x005c0f22);
byte& g_errMod17= (byte&) GH_MEM(0x005c1400);
byte& g_errMod8= (byte&) GH_MEM(0x005c4b0c);
byte& g_errMod9= (byte&) GH_MEM(0x005c4dcc);
byte& g_errMod7= (byte&) GH_MEM(0x005c506c);
byte& g_errMod10= (byte&) GH_MEM(0x005c51f4);
UINT& g_config_camera_hor_axis= (UINT&) GH_MEM(0x005c67c8);
UINT& g_config_camera_ver_axis= (UINT&) GH_MEM(0x005c67cc);
byte& g_errMod11= (byte&) GH_MEM(0x005caf2c);
byte& g_errMod12= (byte&) GH_MEM(0x005cb16c);
byte& g_errMod14= (byte&) GH_MEM(0x005cf5d4);
byte& g_errMod15= (byte&) GH_MEM(0x005cf814);
byte& g_errMod16= (byte&) GH_MEM(0x005cf874);
HWND& g_gameHWND1= (HWND&) GH_MEM(0x005cf964);
long& lpDefault_005cf96c= (long&) GH_MEM(0x005cf96c);
byte& g_ucErmNbOfModule= (byte&) GH_MEM(0x005d2638);
mod1_ptrs& g_mod1_ptrs= (mod1_ptrs&) GH_MEM(0x005d2644);
undefined4& DAT_005d2660= (undefined4&) GH_MEM(0x005d2660);
undefined& DAT_005d266c= (undefined&) GH_MEM(0x005d266c);
undefined1& DAT_005d266d= (undefined1&) GH_MEM(0x005d266d);
undefined1& DAT_005d26a8= (undefined1&) GH_MEM(0x005d26a8);
undefined& lpVolumeNameBuffer_005d27b0= (undefined&) GH_MEM(0x005d27b0);
r3_main_data& r3_main_data_005d28b6= (r3_main_data&) GH_MEM(0x005d28b6);
@ -165,11 +193,23 @@ char(&s_quitting1)[64] = reinterpret_cast<char(&)[64]>(GH_MEM(0x007825c0));
char(&s_wndStrQuiting)[56] = reinterpret_cast<char(&)[56]>(GH_MEM(0x00782600));
tdstLastErrorInfo(&g_stErmTheLastErrorInfo)[3] = reinterpret_cast<tdstLastErrorInfo(&)[3]>(GH_MEM(0x00782640));
pointer& g_errDat4= (pointer&) GH_MEM(0x00782644);
undefined1& DAT_0078266c= (undefined1&) GH_MEM(0x0078266c);
tdstBlockInfoPriv *(&g_a_p_stMmgModuleBlocksInfo)[255] = reinterpret_cast<tdstBlockInfoPriv *(&)[255]>(GH_MEM(0x0078f6a0));
undefined& g_MmgCriticalSection= (undefined&) GH_MEM(0x0078faa0);
char(&g_a_ucBlocksNbInModule)[255] = reinterpret_cast<char(&)[255]>(GH_MEM(0x0078fac0));
tdstGeneralChannelsInfo_& g_stGeneralChannelInfo= (tdstGeneralChannelsInfo_&) GH_MEM(0x0078fbc0);
tdstCurrentModeInfo *& g_d_stCurrentModeInfo= (tdstCurrentModeInfo *&) GH_MEM(0x0078fbc8);
undefined4& DAT_00794cec= (undefined4&) GH_MEM(0x00794cec);
dword& DWORD_00794d00= (dword&) GH_MEM(0x00794d00);
dword& DWORD_00794d04= (dword&) GH_MEM(0x00794d04);
undefined1& DAT_007a0cd8= (undefined1&) GH_MEM(0x007a0cd8);
uint& DAT_007a2c14= (uint&) GH_MEM(0x007a2c14);
byte& g_bink_videoBpp= (byte&) GH_MEM(0x007a2e00);
byte& g_bink_wantedVideoQuality= (byte&) GH_MEM(0x007a2e02);
byte& g_bink_realVideoQuality= (byte&) GH_MEM(0x007a2e03);
byte& g_bink_autoAdjustQuality= (byte&) GH_MEM(0x007a2e04);
uint& DAT_007a2e0c= (uint&) GH_MEM(0x007a2e0c);
int& g_bink_wantedVideoQualityPlus1= (int&) GH_MEM(0x007a2e10);
undefined& DAT_007d7d84= (undefined&) GH_MEM(0x007d7d84);
GAM_tdstEngineStructure& g_r3_engine= (GAM_tdstEngineStructure&) GH_MEM(0x007d7dc0);
undefined2& DAT_007d7ea8= (undefined2&) GH_MEM(0x007d7ea8);
@ -183,12 +223,13 @@ uint& DAT_007d9cc4= (uint&) GH_MEM(0x007d9cc4);
undefined& g_config_unused0= (undefined&) GH_MEM(0x007d9df0);
undefined& lpSystemTime_007d9e40= (undefined&) GH_MEM(0x007d9e40);
undefined4& DAT_007d9e60= (undefined4&) GH_MEM(0x007d9e60);
undefined2& DAT_007d9e68= (undefined2&) GH_MEM(0x007d9e68);
word& WORD_007d9e6a= (word&) GH_MEM(0x007d9e6a);
word& WORD_007d9e68= (word&) GH_MEM(0x007d9e68);
char(&sz_S)[2] = reinterpret_cast<char(&)[2]>(GH_MEM(0x007d9e6a));
word& WORD_007d9e6c= (word&) GH_MEM(0x007d9e6c);
word& WORD_007d9e6e= (word&) GH_MEM(0x007d9e6e);
char(&sz_M)[2] = reinterpret_cast<char(&)[2]>(GH_MEM(0x007d9e6e));
undefined& lpRootPathName_007d9e70= (undefined&) GH_MEM(0x007d9e70);
undefined3& UNK_007d9e71= (undefined3&) GH_MEM(0x007d9e71);
dword& DWORD_007eb200= (dword&) GH_MEM(0x007eb200);
undefined& g_GLI_fullscreen= (undefined&) GH_MEM(0x007edd40);
int& g_GLI_width0= (int&) GH_MEM(0x007edd44);
int& g_GLI_height0= (int&) GH_MEM(0x007edd48);

View File

@ -5,6 +5,8 @@
#include <r3/binders/global.h>
extern undefined *& PTR__BinkOpenDirectSound_4_0059733c; // 0059733c
extern undefined& DAT_005a9ed4; // 005a9ed4
extern char(&s__s_not_initialized__005b63e0)[20]; // 005b63e0
extern char(&s_Please_run_the__s_setup__005b63f4)[28]; // 005b63f4
extern char(&s_dashCC)[4]; // 005b6410
@ -64,9 +66,22 @@ extern const char* s_None; // 005b6904
extern const char* s_UbiSoft_Ubi_ini; // 005b690c
extern undefined& s_percent_d; // 005bad58
extern byte& g_errMod0; // 005bd29c
extern const char* s_Warning_error__005bd318; // 005bd318
extern const char* s_Fatale_error__005bd328; // 005bd328
extern const char* s_Fatale_error__005bd338; // 005bd338
extern const char* s_Strange__The_last_error_was_neve_005bd348; // 005bd348
extern const char* s_Error_in_the_Erm__005bd374; // 005bd374
extern const char* s_There_is_no_more_Channel_error_t_005bd388; // 005bd388
extern byte& g_errMod1; // 005bd4cc
extern byte& g_errModMmg; // 005bd58c
extern char& DAT_005bd5f4; // 005bd5f4
extern const char* s_Video_AutoAdjustQuality_005bd630; // 005bd630
extern const char* s_Video_BPP_005bd648; // 005bd648
extern const char* s_Video_RealQuality_005bd654; // 005bd654
extern const char* s_Rayman_Arena_005bd668; // 005bd668
extern const char* s_Video_WantedQuality_005bd678; // 005bd678
extern const char* s_Videos_005bd72c; // 005bd72c
extern byte& g_errMod2Bink; // 005bd7ac
extern const char* s__World_Sound_005bd9e8; // 005bd9e8
extern const char* s__Options_005bd9f8; // 005bd9f8
extern const char* s__Vignette_005bda04; // 005bda04
@ -115,8 +130,9 @@ extern const char* s_fmt_c_colon_s; // 005be540
extern const char* s_r3_program_files; // 005be548
extern undefined *& PTR_DAT_005be568; // 005be568
extern byte& g_errModFirst; // 005be6f0
extern word& DAT_005bf004; // 005bf004
extern word& DAT_005bf008; // 005bf008
extern byte& g_errMod5; // 005befbc
extern char(&s_M_005bf004)[2]; // 005bf004
extern char(&s_S_005bf008)[2]; // 005bf008
extern const char* s__08X__04X__04X__02X_02X__02X_02X_005bf6d8; // 005bf6d8
extern dword& r3_textureMemMode; // 005bf740
extern const char* s_Agp8_005bf744; // 005bf744
@ -128,13 +144,25 @@ extern const char* s_Vram; // 005bf76c
extern byte& g_errMod7; // 005c069c
extern undefined2& DAT_005c0f20; // 005c0f20
extern char& DAT_005c0f22; // 005c0f22
extern byte& g_errMod17; // 005c1400
extern byte& g_errMod8; // 005c4b0c
extern byte& g_errMod9; // 005c4dcc
extern byte& g_errMod7; // 005c506c
extern byte& g_errMod10; // 005c51f4
extern UINT& g_config_camera_hor_axis; // 005c67c8
extern UINT& g_config_camera_ver_axis; // 005c67cc
extern byte& g_errMod11; // 005caf2c
extern byte& g_errMod12; // 005cb16c
extern byte& g_errMod14; // 005cf5d4
extern byte& g_errMod15; // 005cf814
extern byte& g_errMod16; // 005cf874
extern HWND& g_gameHWND1; // 005cf964
extern long& lpDefault_005cf96c; // 005cf96c
extern byte& g_ucErmNbOfModule; // 005d2638
extern mod1_ptrs& g_mod1_ptrs; // 005d2644
extern undefined4& DAT_005d2660; // 005d2660
extern undefined& DAT_005d266c; // 005d266c
extern undefined1& DAT_005d266d; // 005d266d
extern undefined1& DAT_005d26a8; // 005d26a8
extern undefined& lpVolumeNameBuffer_005d27b0; // 005d27b0
extern r3_main_data& r3_main_data_005d28b6; // 005d28b6
@ -170,11 +198,23 @@ extern char(&s_quitting1)[64]; // 007825c0
extern char(&s_wndStrQuiting)[56]; // 00782600
extern tdstLastErrorInfo(&g_stErmTheLastErrorInfo)[3]; // 00782640
extern pointer& g_errDat4; // 00782644
extern undefined1& DAT_0078266c; // 0078266c
extern tdstBlockInfoPriv *(&g_a_p_stMmgModuleBlocksInfo)[255]; // 0078f6a0
extern undefined& g_MmgCriticalSection; // 0078faa0
extern char(&g_a_ucBlocksNbInModule)[255]; // 0078fac0
extern tdstGeneralChannelsInfo_& g_stGeneralChannelInfo; // 0078fbc0
extern tdstCurrentModeInfo *& g_d_stCurrentModeInfo; // 0078fbc8
extern undefined4& DAT_00794cec; // 00794cec
extern dword& DWORD_00794d00; // 00794d00
extern dword& DWORD_00794d04; // 00794d04
extern undefined1& DAT_007a0cd8; // 007a0cd8
extern uint& DAT_007a2c14; // 007a2c14
extern byte& g_bink_videoBpp; // 007a2e00
extern byte& g_bink_wantedVideoQuality; // 007a2e02
extern byte& g_bink_realVideoQuality; // 007a2e03
extern byte& g_bink_autoAdjustQuality; // 007a2e04
extern uint& DAT_007a2e0c; // 007a2e0c
extern int& g_bink_wantedVideoQualityPlus1; // 007a2e10
extern undefined& DAT_007d7d84; // 007d7d84
extern GAM_tdstEngineStructure& g_r3_engine; // 007d7dc0
extern undefined2& DAT_007d7ea8; // 007d7ea8
@ -188,12 +228,13 @@ extern uint& DAT_007d9cc4; // 007d9cc4
extern undefined& g_config_unused0; // 007d9df0
extern undefined& lpSystemTime_007d9e40; // 007d9e40
extern undefined4& DAT_007d9e60; // 007d9e60
extern undefined2& DAT_007d9e68; // 007d9e68
extern word& WORD_007d9e6a; // 007d9e6a
extern word& WORD_007d9e68; // 007d9e68
extern char(&sz_S)[2]; // 007d9e6a
extern word& WORD_007d9e6c; // 007d9e6c
extern word& WORD_007d9e6e; // 007d9e6e
extern char(&sz_M)[2]; // 007d9e6e
extern undefined& lpRootPathName_007d9e70; // 007d9e70
extern undefined3& UNK_007d9e71; // 007d9e71
extern dword& DWORD_007eb200; // 007eb200
extern undefined& g_GLI_fullscreen; // 007edd40
extern int& g_GLI_width0; // 007edd44
extern int& g_GLI_height0; // 007edd48

View File

@ -1,14 +0,0 @@
// AUTO-GENERATED FILE!!!!
// This function has yet to be decompiled using 'Dump Current Function' in ghidra
// with possible manualy fixes
#include <r3/binders/auto.h>
#include <gh_global.h>
#include <stdexcept>
// 00504ef0
// r3_module10input_init
extern "C" undefined r3_module10input_init(void) {
// TODO: Implement this function
throw GHStubException("Function not implemented: r3_module10input_init");
}

View File

@ -1,14 +0,0 @@
// AUTO-GENERATED FILE!!!!
// This function has yet to be decompiled using 'Dump Current Function' in ghidra
// with possible manualy fixes
#include <r3/binders/auto.h>
#include <gh_global.h>
#include <stdexcept>
// 00554fc0
// r3_module11_init
extern "C" undefined r3_module11_init(void) {
// TODO: Implement this function
throw GHStubException("Function not implemented: r3_module11_init");
}

View File

@ -1,14 +0,0 @@
// AUTO-GENERATED FILE!!!!
// This function has yet to be decompiled using 'Dump Current Function' in ghidra
// with possible manualy fixes
#include <r3/binders/auto.h>
#include <gh_global.h>
#include <stdexcept>
// 0055ab30
// r3_module12_init
extern "C" undefined r3_module12_init(void) {
// TODO: Implement this function
throw GHStubException("Function not implemented: r3_module12_init");
}

View File

@ -1,14 +0,0 @@
// AUTO-GENERATED FILE!!!!
// This function has yet to be decompiled using 'Dump Current Function' in ghidra
// with possible manualy fixes
#include <r3/binders/auto.h>
#include <gh_global.h>
#include <stdexcept>
// 00588120
// r3_module14_init
extern "C" undefined r3_module14_init(void) {
// TODO: Implement this function
throw GHStubException("Function not implemented: r3_module14_init");
}

View File

@ -1,14 +0,0 @@
// AUTO-GENERATED FILE!!!!
// This function has yet to be decompiled using 'Dump Current Function' in ghidra
// with possible manualy fixes
#include <r3/binders/auto.h>
#include <gh_global.h>
#include <stdexcept>
// 0058eb70
// r3_module15_init
extern "C" undefined r3_module15_init(void) {
// TODO: Implement this function
throw GHStubException("Function not implemented: r3_module15_init");
}

View File

@ -1,14 +0,0 @@
// AUTO-GENERATED FILE!!!!
// This function has yet to be decompiled using 'Dump Current Function' in ghidra
// with possible manualy fixes
#include <r3/binders/auto.h>
#include <gh_global.h>
#include <stdexcept>
// 0058ee90
// r3_module16_init
extern "C" undefined r3_module16_init(void) {
// TODO: Implement this function
throw GHStubException("Function not implemented: r3_module16_init");
}

View File

@ -1,14 +0,0 @@
// AUTO-GENERATED FILE!!!!
// This function has yet to be decompiled using 'Dump Current Function' in ghidra
// with possible manualy fixes
#include <r3/binders/auto.h>
#include <gh_global.h>
#include <stdexcept>
// 0045d2c0
// r3_module5_init
extern "C" undefined r3_module5_init(void) {
// TODO: Implement this function
throw GHStubException("Function not implemented: r3_module5_init");
}

View File

@ -1,14 +0,0 @@
// AUTO-GENERATED FILE!!!!
// This function has yet to be decompiled using 'Dump Current Function' in ghidra
// with possible manualy fixes
#include <r3/binders/auto.h>
#include <gh_global.h>
#include <stdexcept>
// 004fa430
// r3_module8_init
extern "C" undefined r3_module8_init(void) {
// TODO: Implement this function
throw GHStubException("Function not implemented: r3_module8_init");
}

View File

@ -1,14 +0,0 @@
// AUTO-GENERATED FILE!!!!
// This function has yet to be decompiled using 'Dump Current Function' in ghidra
// with possible manualy fixes
#include <r3/binders/auto.h>
#include <gh_global.h>
#include <stdexcept>
// 00500570
// r3_module9_init
extern "C" undefined r3_module9_init(void) {
// TODO: Implement this function
throw GHStubException("Function not implemented: r3_module9_init");
}

View File

@ -6,9 +6,9 @@
#include <gh_global.h>
#include <stdexcept>
// 00470ef0
// FUN_00470ef0
extern "C" undefined FUN_00470ef0(undefined4 param_1) {
// 00441e70
// r3_readBinkVideoConfig
extern "C" void r3_readBinkVideoConfig(void) {
// TODO: Implement this function
throw GHStubException("Function not implemented: FUN_00470ef0");
throw GHStubException("Function not implemented: r3_readBinkVideoConfig");
}

View File

@ -1,3 +1,5 @@
0059733c || PTR__BinkOpenDirectSound@4_0059733c || / || undefined *
005a9ed4 || DAT_005a9ed4 || / || undefined
005b63e0 || s__s_not_initialized__005b63e0 || / || char[20]
005b63f4 || s_Please_run_the__s_setup__005b63f4 || / || char[28]
005b6410 || s_dashCC || / || char[4]
@ -57,9 +59,22 @@
005b690c || s_UbiSoft_Ubi_ini || / || TerminatedCString
005bad58 || s_percent_d || / || undefined
005bd29c || g_errMod0 || / || byte
005bd318 || s_Warning_error__005bd318 || / || string
005bd328 || s_Fatale_error__005bd328 || / || string
005bd338 || s_Fatale_error__005bd338 || / || string
005bd348 || s_Strange__The_last_error_was_neve_005bd348 || / || string
005bd374 || s_Error_in_the_Erm__005bd374 || / || string
005bd388 || s_There_is_no_more_Channel_error_t_005bd388 || / || string
005bd4cc || g_errMod1 || / || byte
005bd58c || g_errModMmg || / || byte
005bd5f4 || DAT_005bd5f4 || / || char
005bd630 || s_Video_AutoAdjustQuality_005bd630 || / || string
005bd648 || s_Video_BPP_005bd648 || / || string
005bd654 || s_Video_RealQuality_005bd654 || / || string
005bd668 || s_Rayman_Arena_005bd668 || / || string
005bd678 || s_Video_WantedQuality_005bd678 || / || string
005bd72c || s_Videos_005bd72c || / || string
005bd7ac || g_errMod2Bink || / || byte
005bd9e8 || s__World_Sound_005bd9e8 || / || string
005bd9f8 || s__Options_005bd9f8 || / || string
005bda04 || s__Vignette_005bda04 || / || string
@ -108,8 +123,9 @@
005be548 || s_r3_program_files || / || string
005be568 || PTR_DAT_005be568 || / || undefined *
005be6f0 || g_errModFirst || / || byte
005bf004 || DAT_005bf004 || / || word
005bf008 || DAT_005bf008 || / || word
005befbc || g_errMod5 || / || byte
005bf004 || s_M_005bf004 || / || char[2]
005bf008 || s_S_005bf008 || / || char[2]
005bf6d8 || s__08X__04X__04X__02X_02X__02X_02X_005bf6d8 || / || string
005bf740 || r3_textureMemMode || / || dword
005bf744 || s_Agp8_005bf744 || / || TerminatedCString
@ -121,13 +137,25 @@
005c069c || g_errMod7 || / || byte
005c0f20 || DAT_005c0f20 || / || undefined2
005c0f22 || DAT_005c0f22 || / || char
005c1400 || g_errMod17 || / || byte
005c4b0c || g_errMod8 || / || byte
005c4dcc || g_errMod9 || / || byte
005c506c || g_errMod7 || / || byte
005c51f4 || g_errMod10 || / || byte
005c67c8 || g_config_camera_hor_axis || /windef.h || UINT
005c67cc || g_config_camera_ver_axis || /windef.h || UINT
005caf2c || g_errMod11 || / || byte
005cb16c || g_errMod12 || / || byte
005cf5d4 || g_errMod14 || / || byte
005cf814 || g_errMod15 || / || byte
005cf874 || g_errMod16 || / || byte
005cf964 || g_gameHWND1 || /windef.h || HWND
005cf96c || lpDefault_005cf96c || / || long
005d2638 || g_ucErmNbOfModule || / || byte
005d2644 || g_mod1_ptrs || / || mod1_ptrs
005d2660 || DAT_005d2660 || / || undefined4
005d266c || DAT_005d266c || / || undefined
005d266d || DAT_005d266d || / || undefined1
005d26a8 || DAT_005d26a8 || / || undefined1
005d27b0 || lpVolumeNameBuffer_005d27b0 || / || undefined
005d28b6 || r3_main_data_005d28b6 || / || r3_main_data
@ -163,11 +191,23 @@
00782600 || s_wndStrQuiting || / || char[56]
00782640 || g_stErmTheLastErrorInfo || / || tdstLastErrorInfo[3]
00782644 || g_errDat4 || / || pointer
0078266c || DAT_0078266c || / || undefined1
0078f6a0 || g_a_p_stMmgModuleBlocksInfo || /mmg.h || tdstBlockInfoPriv *[255]
0078faa0 || g_MmgCriticalSection || / || undefined
0078fac0 || g_a_ucBlocksNbInModule || / || char[255]
0078fbc0 || g_stGeneralChannelInfo || /mmg.h || tdstGeneralChannelsInfo_
0078fbc8 || g_d_stCurrentModeInfo || /mmg.h || tdstCurrentModeInfo *
00794cec || DAT_00794cec || / || undefined4
00794d00 || DWORD_00794d00 || / || dword
00794d04 || DWORD_00794d04 || / || dword
007a0cd8 || DAT_007a0cd8 || / || undefined1
007a2c14 || DAT_007a2c14 || / || uint
007a2e00 || g_bink_videoBpp || / || byte
007a2e02 || g_bink_wantedVideoQuality || / || byte
007a2e03 || g_bink_realVideoQuality || / || byte
007a2e04 || g_bink_autoAdjustQuality || / || byte
007a2e0c || DAT_007a2e0c || / || uint
007a2e10 || g_bink_wantedVideoQualityPlus1 || / || int
007d7d84 || DAT_007d7d84 || / || undefined
007d7dc0 || g_r3_engine || /engine.h || GAM_tdstEngineStructure
007d7ea8 || DAT_007d7ea8 || / || undefined2
@ -181,12 +221,13 @@
007d9df0 || g_config_unused0 || / || undefined
007d9e40 || lpSystemTime_007d9e40 || / || undefined
007d9e60 || DAT_007d9e60 || / || undefined4
007d9e68 || DAT_007d9e68 || / || undefined2
007d9e6a || WORD_007d9e6a || / || word
007d9e68 || WORD_007d9e68 || / || word
007d9e6a || sz_S || / || char[2]
007d9e6c || WORD_007d9e6c || / || word
007d9e6e || WORD_007d9e6e || / || word
007d9e6e || sz_M || / || char[2]
007d9e70 || lpRootPathName_007d9e70 || / || undefined
007d9e71 || UNK_007d9e71 || / || undefined3
007eb200 || DWORD_007eb200 || / || dword
007edd40 || g_GLI_fullscreen || / || undefined
007edd44 || g_GLI_width0 || / || int
007edd48 || g_GLI_height0 || / || int

View File

@ -87,6 +87,11 @@ inline constexpr cc_type_t CONCAT23(T0 a, T1 b) {
return cc_type_t(a) << 24 | cc_type_t(b);
}
template <typename T0, typename T1>
inline constexpr cc_type_t CONCAT31(T0 a, T1 b) {
return cc_type_t(a) << 8 | cc_type_t(b);
}
template <typename T0> inline constexpr char SUB21(T0 a, size_t b) {
return cc_type_t(a) >> (b * 8);
}
@ -99,6 +104,8 @@ template <typename T0> inline constexpr uint16_t SUB42(T0 a, size_t b) {
return cc_type_t(a) >> (b * 8);
}
inline longlong r3_ftol(float a) { return (longlong)a; }
constexpr byte R3ModId_not_initialized = 0xff;
#include "stubexcept.h"

View File

@ -12,6 +12,7 @@
#include <stdio.h>
#include <string.h>
typedef long long longlong;
typedef uint8_t undefined;
typedef uint32_t undefined4;
typedef uint16_t undefined2;
@ -28,6 +29,9 @@ struct undefined3 {
_2 = (other >> 16) & 0xff;
return *this;
}
operator uint32_t() const {
return _0 | (_1 << 8) | (_2 << 16);
}
};
typedef unsigned char byte;
typedef byte undefined1;

714
game_re/third_party/bink/bink.h vendored Normal file
View File

@ -0,0 +1,714 @@
#ifndef __BINKH__
#define __BINKH__
#define BINKMAJORVERSION 1
#define BINKMINORVERSION 5
#define BINKSUBVERSION 21
#define BINKVERSION "1.5y"
#define BINKDATE "2003-09-23"
#ifndef __RADRES__
#ifndef __RADBASEH__
#include "radbase.h"
#endif
RADDEFSTART
typedef struct BINK PTR4* HBINK;
struct BINKIO;
typedef S32 (RADLINK PTR4* BINKIOOPEN) (struct BINKIO PTR4* Bnkio, const char PTR4 *name, U32 flags);
typedef U32 (RADLINK PTR4* BINKIOREADHEADER) (struct BINKIO PTR4* Bnkio, S32 Offset, void PTR4* Dest,U32 Size);
typedef U32 (RADLINK PTR4* BINKIOREADFRAME) (struct BINKIO PTR4* Bnkio, U32 Framenum,S32 origofs,void PTR4* dest,U32 size);
typedef U32 (RADLINK PTR4* BINKIOGETBUFFERSIZE)(struct BINKIO PTR4* Bnkio, U32 Size);
typedef void (RADLINK PTR4* BINKIOSETINFO) (struct BINKIO PTR4* Bnkio, void PTR4* Buf,U32 Size,U32 FileSize,U32 simulate);
typedef U32 (RADLINK PTR4* BINKIOIDLE) (struct BINKIO PTR4* Bnkio);
typedef void (RADLINK PTR4* BINKIOCLOSE) (struct BINKIO PTR4* Bnkio);
typedef void (RADLINK PTR4* BINKCBSUSPEND) (struct BINKIO PTR4* Bnkio);
typedef S32 (RADLINK PTR4* BINKCBTRYSUSPEND) (struct BINKIO PTR4* Bnkio);
typedef void (RADLINK PTR4* BINKCBRESUME) (struct BINKIO PTR4* Bnkio);
typedef void (RADLINK PTR4* BINKCBIDLE) (struct BINKIO PTR4* Bnkio);
typedef struct BINKIO {
BINKIOREADHEADER ReadHeader;
BINKIOREADFRAME ReadFrame;
BINKIOGETBUFFERSIZE GetBufferSize;
BINKIOSETINFO SetInfo;
BINKIOIDLE Idle;
BINKIOCLOSE Close;
HBINK bink;
volatile U32 ReadError;
volatile U32 DoingARead;
volatile U32 BytesRead;
volatile U32 Working;
volatile U32 TotalTime;
volatile U32 ForegroundTime;
volatile U32 IdleTime;
volatile U32 ThreadTime;
volatile U32 BufSize;
volatile U32 BufHighUsed;
volatile U32 CurBufSize;
volatile U32 CurBufUsed;
volatile U8 iodata[128+32];
// filled in by the caller
BINKCBSUSPEND suspend_callback;
BINKCBTRYSUSPEND try_suspend_callback;
BINKCBRESUME resume_callback;
BINKCBIDLE idle_on_callback;
volatile U32 callback_control[16]; // buffer for background IO callback
} BINKIO;
struct BINKSND;
typedef S32 (RADLINK PTR4* BINKSNDOPEN) (struct BINKSND PTR4* BnkSnd, U32 freq, S32 bits, S32 chans, U32 flags, HBINK bink);
typedef S32 (RADLINK PTR4* BINKSNDREADY) (struct BINKSND PTR4* BnkSnd);
typedef S32 (RADLINK PTR4* BINKSNDLOCK) (struct BINKSND PTR4* BnkSnd, U8 PTR4* PTR4* addr, U32 PTR4* len);
typedef S32 (RADLINK PTR4* BINKSNDUNLOCK) (struct BINKSND PTR4* BnkSnd, U32 filled);
typedef void (RADLINK PTR4* BINKSNDVOLUME) (struct BINKSND PTR4* BnkSnd, S32 volume);
typedef void (RADLINK PTR4* BINKSNDPAN) (struct BINKSND PTR4* BnkSnd, S32 pan);
typedef void (RADLINK PTR4* BINKSNDMIXBINS) (struct BINKSND PTR4* BnkSnd, U32 PTR4* mix_bins, U32 total);
typedef void (RADLINK PTR4* BINKSNDMIXBINVOLS) (struct BINKSND PTR4* BnkSnd, U32 PTR4* vol_mix_bins, S32 PTR4* volumes, U32 total );
typedef S32 (RADLINK PTR4* BINKSNDONOFF) (struct BINKSND PTR4* BnkSnd, S32 status);
typedef S32 (RADLINK PTR4* BINKSNDPAUSE) (struct BINKSND PTR4* BnkSnd, S32 status);
typedef void (RADLINK PTR4* BINKSNDCLOSE) (struct BINKSND PTR4* BnkSnd);
typedef BINKSNDOPEN (RADLINK PTR4* BINKSNDSYSOPEN) (U32 param);
typedef struct BINKSND {
BINKSNDREADY Ready;
BINKSNDLOCK Lock;
BINKSNDUNLOCK Unlock;
BINKSNDVOLUME Volume;
BINKSNDPAN Pan;
BINKSNDPAUSE Pause;
BINKSNDONOFF SetOnOff;
BINKSNDCLOSE Close;
BINKSNDMIXBINS MixBins;
BINKSNDMIXBINVOLS MixBinVols;
U32 sndbufsize; // sound buffer size
U8 PTR4* sndbuf; // sound buffer
U8 PTR4* sndend; // end of the sound buffer
U8 PTR4* sndwritepos; // current write position
U8 PTR4* sndreadpos; // current read position
U32 sndcomp; // sound compression handle
U32 sndamt; // amount of sound currently in the buffer
U32 sndconvert8; // convert back to 8-bit sound at runtime
U32 sndendframe; // frame number that the sound ends on
U32 sndprime; // amount of data to prime the playahead
U32 sndpad; // padded this much audio
U32 BestSizeIn16;
U32 BestSizeMask;
U32 SoundDroppedOut;
S32 NoThreadService;
S32 OnOff;
U32 Latency;
U32 VideoScale;
U32 freq;
S32 bits,chans;
U8 snddata[256];
} BINKSND;
typedef struct BINKRECT {
S32 Left,Top,Width,Height;
} BINKRECT;
#define BINKMAXDIRTYRECTS 8
typedef struct BUNDLEPOINTERS {
void* typeptr;
void* type16ptr;
void* colorptr;
void* bits2ptr;
void* motionXptr;
void* motionYptr;
void* dctptr;
void* mdctptr;
void* patptr;
} BUNDLEPOINTERS;
typedef struct BINK {
U32 Width; // Width (1 based, 640 for example)
U32 Height; // Height (1 based, 480 for example)
U32 Frames; // Number of frames (1 based, 100 = 100 frames)
U32 FrameNum; // Frame to *be* displayed (1 based)
U32 LastFrameNum; // Last frame decompressed or skipped (1 based)
U32 FrameRate; // Frame Rate Numerator
U32 FrameRateDiv; // Frame Rate Divisor (frame rate=numerator/divisor)
U32 ReadError; // Non-zero if a read error has ocurred
U32 OpenFlags; // flags used on open
U32 BinkType; // Bink flags
U32 Size; // size of file
U32 FrameSize; // The current frame's size in bytes
U32 SndSize; // The current frame sound tracks' size in bytes
BINKRECT FrameRects[BINKMAXDIRTYRECTS];// Dirty rects from BinkGetRects
S32 NumRects;
U32 PlaneNum; // which set of planes is current
void PTR4* YPlane[2]; // pointer to the uncompressed Y (Cr and Cr follow)
void PTR4* APlane[2]; // decompressed alpha plane (if present)
U32 YWidth; // widths and heights of the video planes
U32 YHeight;
U32 UVWidth;
U32 UVHeight;
void PTR4* MaskPlane; // pointer to the mask plane (Ywidth/16*Yheight/16)
U32 MaskPitch; // Mask Pitch
U32 MaskLength; // total length of the mask plane
U32 LargestFrameSize; // Largest frame size
U32 InternalFrames; // how many frames were potentially compressed
S32 NumTracks; // how many tracks
U32 Highest1SecRate; // Highest 1 sec data rate
U32 Highest1SecFrame; // Highest 1 sec data rate starting frame
S32 Paused; // is the bink movie paused?
U32 BackgroundThread; // handle to background thread
// everything below is for internal Bink use
void PTR4* compframe; // compressed frame data
void PTR4* preloadptr; // preloaded compressed frame data
U32* frameoffsets; // offsets of each of the frames
BINKIO bio; // IO structure
U8 PTR4* ioptr; // io buffer ptr
U32 iosize; // io buffer size
U32 decompwidth; // width not include scaling
U32 decompheight; // height not include scaling
S32 PTR4* trackindexes; // track indexes
U32 PTR4* tracksizes; // largest single frame of track
U32 PTR4* tracktypes; // type of each sound track
S32 PTR4* trackIDs; // external track numbers
U32 numrects; // number of rects from BinkGetRects
U32 playedframes; // how many frames have we played
U32 firstframetime; // very first frame start
U32 startframetime; // start frame start
U32 startblittime; // start of blit period
U32 startsynctime; // start of synched time
U32 startsyncframe; // frame of startsynctime
U32 twoframestime; // two frames worth of time
U32 entireframetime; // entire frame time
U32 slowestframetime; // slowest frame in ms
U32 slowestframe; // slowest frame number
U32 slowest2frametime; // second slowest frame in ms
U32 slowest2frame; // second slowest frame
U32 soundon; // sound turned on?
U32 videoon; // video turned on?
U32 totalmem; // total memory used
U32 timevdecomp; // total time decompressing video
U32 timeadecomp; // total time decompressing audio
U32 timeblit; // total time blitting
U32 timeopen; // total open time
U32 fileframerate; // frame rate originally in the file
U32 fileframeratediv;
U32 runtimeframes; // max frames for runtime analysis
U32 runtimemoveamt; // bytes to move each frame
U32 PTR4* rtframetimes; // start times for runtime frames
U32 PTR4* rtadecomptimes; // decompress times for runtime frames
U32 PTR4* rtvdecomptimes; // decompress times for runtime frames
U32 PTR4* rtblittimes; // blit times for runtime frames
U32 PTR4* rtreadtimes; // read times for runtime frames
U32 PTR4* rtidlereadtimes; // idle read times for runtime frames
U32 PTR4* rtthreadreadtimes;// thread read times for runtime frames
U32 lastblitflags; // flags used on last blit
U32 lastdecompframe; // last frame number decompressed
U32 lastresynctime; // last loop point that we did a resync on
U32 doresync; // should we do a resync in the next doframe?
U32 playingtracks; // how many tracks are playing
U32 soundskips; // number of sound stops
BINKSND PTR4* bsnd; // SND structures
U32 skippedlastblit; // skipped last frame?
U32 skipped_this_frame; // skipped the current frame?
U32 skippedblits; // how many blits were skipped
BUNDLEPOINTERS bunp; // pointers to internal temporary memory
U32 skipped_in_a_row; // how many frames have we skipped in a row
U32 big_sound_skip_adj; // adjustment for large skips
U32 big_sound_skip_reduce; // amount to reduce large skips by each frame
U32 last_time_almost_empty; // time of last almost empty IO buffer
U32 last_read_count; // counter to keep track of the last bink IO
U32 last_sound_count; // counter to keep track of the last bink sound
U32 snd_callback_buffer[16]; // buffer for background sound callback
} BINK;
typedef struct BINKSUMMARY {
U32 Width; // Width of frames
U32 Height; // Height of frames
U32 TotalTime; // total time (ms)
U32 FileFrameRate; // frame rate
U32 FileFrameRateDiv; // frame rate divisor
U32 FrameRate; // frame rate
U32 FrameRateDiv; // frame rate divisor
U32 TotalOpenTime; // Time to open and prepare for decompression
U32 TotalFrames; // Total Frames
U32 TotalPlayedFrames; // Total Frames played
U32 SkippedFrames; // Total number of skipped frames
U32 SkippedBlits; // Total number of skipped blits
U32 SoundSkips; // Total number of sound skips
U32 TotalBlitTime; // Total time spent blitting
U32 TotalReadTime; // Total time spent reading
U32 TotalVideoDecompTime; // Total time spent decompressing video
U32 TotalAudioDecompTime; // Total time spent decompressing audio
U32 TotalIdleReadTime; // Total time spent reading while idle
U32 TotalBackReadTime; // Total time spent reading in background
U32 TotalReadSpeed; // Total io speed (bytes/second)
U32 SlowestFrameTime; // Slowest single frame time (ms)
U32 Slowest2FrameTime; // Second slowest single frame time (ms)
U32 SlowestFrameNum; // Slowest single frame number
U32 Slowest2FrameNum; // Second slowest single frame number
U32 AverageDataRate; // Average data rate of the movie
U32 AverageFrameSize; // Average size of the frame
U32 HighestMemAmount; // Highest amount of memory allocated
U32 TotalIOMemory; // Total extra memory allocated
U32 HighestIOUsed; // Highest extra memory actually used
U32 Highest1SecRate; // Highest 1 second rate
U32 Highest1SecFrame; // Highest 1 second start frame
} BINKSUMMARY;
typedef struct BINKREALTIME {
U32 FrameNum; // Current frame number
U32 FrameRate; // frame rate
U32 FrameRateDiv; // frame rate divisor
U32 Frames; // frames in this sample period
U32 FramesTime; // time is ms for these frames
U32 FramesVideoDecompTime; // time decompressing these frames
U32 FramesAudioDecompTime; // time decompressing these frames
U32 FramesReadTime; // time reading these frames
U32 FramesIdleReadTime; // time reading these frames at idle
U32 FramesThreadReadTime; // time reading these frames in background
U32 FramesBlitTime; // time blitting these frames
U32 ReadBufferSize; // size of read buffer
U32 ReadBufferUsed; // amount of read buffer currently used
U32 FramesDataRate; // data rate for these frames
} BINKREALTIME;
#define BINKMARKER1 'fKIB'
#define BINKMARKER2 'gKIB' // new Bink files use this tag
#define BINKMARKER3 'hKIB' // newer Bink files use this tag
#define BINKMARKER4 'iKIB' // even newer Bink files use this tag
typedef struct BINKHDR {
U32 Marker; // Bink marker
U32 Size; // size of the file-8
U32 Frames; // Number of frames (1 based, 100 = 100 frames)
U32 LargestFrameSize; // Size in bytes of largest frame
U32 InternalFrames; // Number of internal frames
U32 Width; // Width (1 based, 640 for example)
U32 Height; // Height (1 based, 480 for example)
U32 FrameRate; // frame rate
U32 FrameRateDiv; // frame rate divisor (framerate/frameratediv=fps)
U32 Flags; // height compression options
U32 NumTracks; // number of tracks
} BINKHDR;
//=======================================================================
#define BINKYAINVERT 0x00000800L // Reverse Y and A planes when blitting (for debugging)
#define BINKFRAMERATE 0x00001000L // Override fr (call BinkFrameRate first)
#define BINKPRELOADALL 0x00002000L // Preload the entire animation
#define BINKSNDTRACK 0x00004000L // Set the track number to play
#define BINKOLDFRAMEFORMAT 0x00008000L // using the old Bink frame format (internal use only)
#define BINKRBINVERT 0x00010000L // use reversed R and B planes (internal use only)
#define BINKGRAYSCALE 0x00020000L // Force Bink to use grayscale
#define BINKNOMMX 0x00040000L // Don't use MMX
#define BINKNOSKIP 0x00080000L // Don't skip frames if falling behind
#define BINKALPHA 0x00100000L // Decompress alpha plane (if present)
#define BINKNOFILLIOBUF 0x00200000L // Fill the IO buffer in SmackOpen
#define BINKSIMULATE 0x00400000L // Simulate the speed (call BinkSim first)
#define BINKFILEHANDLE 0x00800000L // Use when passing in a file handle
#define BINKIOSIZE 0x01000000L // Set an io size (call BinkIOSize first)
#define BINKIOPROCESSOR 0x02000000L // Set an io processor (call BinkIO first)
#define BINKFROMMEMORY 0x04000000L // Use when passing in a pointer to the file
#define BINKNOTHREADEDIO 0x08000000L // Don't use a background thread for IO
#define BINKSURFACEFAST 0x00000000L
#define BINKSURFACESLOW 0x08000000L
#define BINKSURFACEDIRECT 0x04000000L
#define BINKCOPYALL 0x80000000L // copy all pixels (not just changed)
#define BINKCOPY2XH 0x10000000L // Force doubling height scaling
#define BINKCOPY2XHI 0x20000000L // Force interleaving height scaling
#define BINKCOPY2XW 0x30000000L // copy the width zoomed by two
#define BINKCOPY2XWH 0x40000000L // copy the width and height zoomed by two
#define BINKCOPY2XWHI 0x50000000L // copy the width and height zoomed by two
#define BINKCOPY1XI 0x60000000L // copy the width and height zoomed by two
#define BINKCOPYNOSCALING 0x70000000L // Force scaling off
//#define BINKALPHA 0x00100000L // Decompress alpha plane (if present)
//#define BINKNOSKIP 0x00080000L // don't skip the blit if behind in sound
//#define BINKNOMMX 0x00040000L // Don't skip frames if falling behind
//#define BINKGRAYSCALE 0x00020000L // force Bink to use grayscale
//#define BINKRBINVERT 0x00010000L // use reversed R and B planes
#define BINKSURFACE8P 0
#define BINKSURFACE24 1
#define BINKSURFACE24R 2
#define BINKSURFACE32 3
#define BINKSURFACE32R 4
#define BINKSURFACE32A 5
#define BINKSURFACE32RA 6
#define BINKSURFACE4444 7
#define BINKSURFACE5551 8
#define BINKSURFACE555 9
#define BINKSURFACE565 10
#define BINKSURFACE655 11
#define BINKSURFACE664 12
#define BINKSURFACEYUY2 13
#define BINKSURFACEUYVY 14
#define BINKSURFACEYV12 15
#define BINKSURFACEMASK 15
#ifdef __RADXBOX__
#define BINKSURFACESALL 32
#define BINKCONVERTERSMONO 64
#define BINKCONVERTERS2X 256
#define BINKCONVERTERSALL (BINKSURFACESALL|BINKCONVERTERSMONO|BINKCONVERTERS2X)
#define BinkLoad() BinkLoadUnload(1)
#define BinkUnload() BinkLoadUnload(0)
#define BinkLoadConverter(val) BinkLoadUnloadConverter(val,1)
#define BinkUnloadConverter(val) BinkLoadUnloadConverter(val,0)
RADEXPFUNC void RADEXPLINK BinkLoadUnload( S32 inout );
RADEXPFUNC void RADEXPLINK BinkLoadUnloadConverter( U32 surfaces, S32 inout );
#endif
#define BINKGOTOQUICK 1
#define BINKGOTOQUICKSOUND 2
#define BINKGETKEYPREVIOUS 0
#define BINKGETKEYNEXT 1
#define BINKGETKEYCLOSEST 2
#define BINKGETKEYNOTEQUAL 128
//=======================================================================
#ifdef __RADMAC__
#pragma export on
RADEXPFUNC HBINK RADEXPLINK BinkMacOpen(void /*FSSpec*/ * fsp,U32 flags);
#endif
RADEXPFUNC void PTR4* RADEXPLINK BinkLogoAddress(void);
RADEXPFUNC void RADEXPLINK BinkSetError(const char PTR4* err);
RADEXPFUNC char PTR4* RADEXPLINK BinkGetError(void);
RADEXPFUNC HBINK RADEXPLINK BinkOpen(const char PTR4* name,U32 flags);
RADEXPFUNC S32 RADEXPLINK BinkDoFrame(HBINK bnk);
RADEXPFUNC void RADEXPLINK BinkNextFrame(HBINK bnk);
RADEXPFUNC S32 RADEXPLINK BinkWait(HBINK bnk);
RADEXPFUNC void RADEXPLINK BinkClose(HBINK bnk);
RADEXPFUNC S32 RADEXPLINK BinkPause(HBINK bnk,S32 pause);
RADEXPFUNC S32 RADEXPLINK BinkCopyToBuffer(HBINK bnk,void* dest,S32 destpitch,U32 destheight,U32 destx,U32 desty,U32 flags);
RADEXPFUNC S32 RADEXPLINK BinkCopyToBufferRect(HBINK bnk,void* dest,S32 destpitch,U32 destheight,U32 destx,U32 desty,U32 srcx, U32 srcy, U32 srcw, U32 srch, U32 flags);
RADEXPFUNC S32 RADEXPLINK BinkGetRects(HBINK bnk,U32 flags);
RADEXPFUNC void RADEXPLINK BinkGoto(HBINK bnk,U32 frame,S32 flags); // use 1 for the first frame
RADEXPFUNC U32 RADEXPLINK BinkGetKeyFrame(HBINK bnk,U32 frame,S32 flags);
RADEXPFUNC S32 RADEXPLINK BinkSetVideoOnOff(HBINK bnk,S32 onoff);
RADEXPFUNC S32 RADEXPLINK BinkSetSoundOnOff(HBINK bnk,S32 onoff);
RADEXPFUNC void RADEXPLINK BinkFreeGlocalMemory( void );
RADEXPFUNC void RADEXPLINK BinkSetVolume(HBINK bnk, U32 trackid, S32 volume);
RADEXPFUNC void RADEXPLINK BinkSetPan(HBINK bnk,U32 trackid, S32 pan);
RADEXPFUNC void RADEXPLINK BinkSetMixBins(HBINK bnk,U32 trackid, U32 PTR4* mix_bins, U32 total);
RADEXPFUNC void RADEXPLINK BinkSetMixBinVolumes(HBINK bnk,U32 trackid, U32 PTR4* vol_mix_bins, S32 PTR4* volumes, U32 total);
RADEXPFUNC void RADEXPLINK BinkService(HBINK bink);
typedef struct BINKTRACK PTR4* HBINKTRACK;
typedef struct BINKTRACK
{
U32 Frequency;
U32 Bits;
U32 Channels;
U32 MaxSize;
HBINK bink;
U32 sndcomp;
S32 trackindex;
} BINKTRACK;
RADEXPFUNC HBINKTRACK RADEXPLINK BinkOpenTrack(HBINK bnk,U32 trackindex);
RADEXPFUNC void RADEXPLINK BinkCloseTrack(HBINKTRACK bnkt);
RADEXPFUNC U32 RADEXPLINK BinkGetTrackData(HBINKTRACK bnkt,void PTR4* dest);
RADEXPFUNC U32 RADEXPLINK BinkGetTrackType(HBINK bnk,U32 trackindex);
RADEXPFUNC U32 RADEXPLINK BinkGetTrackMaxSize(HBINK bnk,U32 trackindex);
RADEXPFUNC U32 RADEXPLINK BinkGetTrackID(HBINK bnk,U32 trackindex);
RADEXPFUNC void RADEXPLINK BinkGetSummary(HBINK bnk,BINKSUMMARY PTR4* sum);
RADEXPFUNC void RADEXPLINK BinkGetRealtime(HBINK bink,BINKREALTIME PTR4* run,U32 frames);
RADEXPFUNC void RADEXPLINK BinkSetSoundTrack(U32 total_tracks, U32 PTR4* tracks);
RADEXPFUNC void RADEXPLINK BinkSetIO(BINKIOOPEN io);
RADEXPFUNC void RADEXPLINK BinkSetFrameRate(U32 forcerate,U32 forceratediv);
RADEXPFUNC void RADEXPLINK BinkSetSimulate(U32 sim);
RADEXPFUNC void RADEXPLINK BinkSetIOSize(U32 iosize);
RADEXPFUNC S32 RADEXPLINK BinkSetSoundSystem(BINKSNDSYSOPEN open, U32 param);
#ifdef __RADWIN__
RADEXPFUNC BINKSNDOPEN RADEXPLINK BinkOpenDirectSound(U32 param); // don't call directly
#define BinkSoundUseDirectSound(lpDS) BinkSetSoundSystem(BinkOpenDirectSound,(U32)lpDS)
RADEXPFUNC BINKSNDOPEN RADEXPLINK BinkOpenWaveOut(U32 param); // don't call directly
#define BinkSoundUseWaveOut() BinkSetSoundSystem(BinkOpenWaveOut,0)
#endif
#ifndef __RADMAC__
RADEXPFUNC BINKSNDOPEN RADEXPLINK BinkOpenMiles(U32 param); // don't call directly
#define BinkSoundUseMiles(hdigdriver) BinkSetSoundSystem(BinkOpenMiles,(U32)hdigdriver)
#endif
#ifdef __RADMAC__
RADEXPFUNC BINKSNDOPEN RADEXPLINK BinkOpenSoundManager(U32 param); // don't call directly
#define BinkSoundUseSoundManager() BinkSetSoundSystem(BinkOpenSoundManager,0)
#endif
#ifdef __RADLINUX__
RADEXPFUNC BINKSNDOPEN RADEXPLINK BinkOpenSDLMixer(U32 param); // don't call directly
#define BinkSoundUseSDLMixer() BinkSetSoundSystem(BinkOpenSDLMixer,0)
#endif
#ifdef __RADNGC__
typedef void PTR4 * (RADLINK PTR4* RADARAMALLOC) ( U32 num_bytes );
typedef void (RADLINK PTR4* RADARAMFREE) ( void PTR4 * ptr );
typedef struct RADARAMCALLBACKS
{
RADARAMALLOC aram_malloc;
RADARAMFREE aram_free;
} RADARAMCALLBACKS;
RADEXPFUNC BINKSNDOPEN RADEXPLINK BinkOpenAX(U32 param); // don't call directly
#define BinkSoundUseAX( functions ) BinkSetSoundSystem(BinkOpenAX,(U32)functions) // takes a pointer to RADARAMCALLBACKS
RADEXPFUNC BINKSNDOPEN RADEXPLINK BinkOpenMusyXSound(U32 param); // don't call directly
#define BinkSoundUseMusyX( ) BinkSetSoundSystem(BinkOpenMusyXSound,0)
#endif
#if defined(__RADXBOX__) || defined(__RADWIN__)
RADEXPFUNC S32 RADEXPLINK BinkDX8SurfaceType(void* lpD3Ds);
#endif
#if defined(__RADWIN__)
RADEXPFUNC S32 RADEXPLINK BinkDX9SurfaceType(void* lpD3Ds);
#endif
// The BinkBuffer API isn't implemented on DOS, Xbox or GameCube
#if !defined(__RADDOS__) && !defined(__RADXBOX__) && !defined(__RADNGC__)
//=========================================================================
typedef struct BINKBUFFER * HBINKBUFFER;
#define BINKBUFFERSTRETCHXINT 0x80000000
#define BINKBUFFERSTRETCHX 0x40000000
#define BINKBUFFERSHRINKXINT 0x20000000
#define BINKBUFFERSHRINKX 0x10000000
#define BINKBUFFERSTRETCHYINT 0x08000000
#define BINKBUFFERSTRETCHY 0x04000000
#define BINKBUFFERSHRINKYINT 0x02000000
#define BINKBUFFERSHRINKY 0x01000000
#define BINKBUFFERSCALES 0xff000000
#define BINKBUFFERRESOLUTION 0x00800000
#ifdef __RADMAC__
//#include <windows.h>
//#include <palettes.h>
//#include <qdoffscreen.h>
typedef struct BINKBUFFER {
U32 Width;
U32 Height;
U32 WindowWidth;
U32 WindowHeight;
U32 SurfaceType;
void* Buffer;
S32 BufferPitch;
U32 ScreenWidth;
U32 ScreenHeight;
U32 ScreenDepth;
U32 ScaleFlags;
S32 destx,desty;
S32 wndx,wndy;
U32 wnd;
S32 noclipping;
U32 type;
S32 issoftcur;
U32 cursorcount;
} BINKBUFFER;
#define BINKBUFFERAUTO 0
#define BINKBUFFERDIRECT 1
#define BINKBUFFERGWORLD 2
#define BINKBUFFERTYPEMASK 31
RADEXPFUNC HBINKBUFFER RADEXPLINK BinkBufferOpen( void* /*WindowPtr*/ wnd, U32 width, U32 height, U32 bufferflags);
RADEXPFUNC S32 RADEXPLINK BinkGDSurfaceType( void* /*GDHandle*/ gd );
RADEXPFUNC S32 RADEXPLINK BinkIsSoftwareCursor(void* /*GDHandle*/ gd);
RADEXPFUNC S32 RADEXPLINK BinkCheckCursor(void* /*WindowPtr*/ wp,S32 x,S32 y,S32 w,S32 h);
#else
typedef struct BINKBUFFER {
U32 Width;
U32 Height;
U32 WindowWidth;
U32 WindowHeight;
U32 SurfaceType;
void* Buffer;
S32 BufferPitch;
S32 ClientOffsetX;
S32 ClientOffsetY;
U32 ScreenWidth;
U32 ScreenHeight;
U32 ScreenDepth;
U32 ExtraWindowWidth;
U32 ExtraWindowHeight;
U32 ScaleFlags;
U32 StretchWidth;
U32 StretchHeight;
S32 surface;
void* ddsurface;
void* ddclipper;
S32 destx,desty;
S32 wndx,wndy;
U32 wnd;
S32 minimized;
S32 ddoverlay;
S32 ddoffscreen;
S32 lastovershow;
S32 issoftcur;
U32 cursorcount;
void* buffertop;
U32 type;
S32 noclipping;
S32 loadeddd;
S32 loadedwin;
void* dibh;
void* dibbuffer;
S32 dibpitch;
void* dibinfo;
U32 dibdc;
U32 diboldbitmap;
} BINKBUFFER;
#define BINKBUFFERAUTO 0
#define BINKBUFFERPRIMARY 1
#define BINKBUFFERDIBSECTION 2
#define BINKBUFFERYV12OVERLAY 3
#define BINKBUFFERYUY2OVERLAY 4
#define BINKBUFFERUYVYOVERLAY 5
#define BINKBUFFERYV12OFFSCREEN 6
#define BINKBUFFERYUY2OFFSCREEN 7
#define BINKBUFFERUYVYOFFSCREEN 8
#define BINKBUFFERRGBOFFSCREENVIDEO 9
#define BINKBUFFERRGBOFFSCREENSYSTEM 10
#define BINKBUFFERLAST 10
#define BINKBUFFERTYPEMASK 31
RADEXPFUNC HBINKBUFFER RADEXPLINK BinkBufferOpen( void* /*HWND*/ wnd, U32 width, U32 height, U32 bufferflags);
RADEXPFUNC S32 RADEXPLINK BinkBufferSetHWND( HBINKBUFFER buf, void* /*HWND*/ newwnd);
RADEXPFUNC S32 RADEXPLINK BinkDDSurfaceType(void PTR4* lpDDS);
RADEXPFUNC S32 RADEXPLINK BinkIsSoftwareCursor(void PTR4* lpDDSP, void* /*HCURSOR*/ cur);
RADEXPFUNC S32 RADEXPLINK BinkCheckCursor(void* /*HWND*/ wnd,S32 x,S32 y,S32 w,S32 h);
RADEXPFUNC S32 RADEXPLINK BinkBufferSetDirectDraw(void PTR4* lpDirectDraw, void PTR4* lpPrimary);
#endif
RADEXPFUNC void RADEXPLINK BinkBufferClose( HBINKBUFFER buf);
RADEXPFUNC S32 RADEXPLINK BinkBufferLock( HBINKBUFFER buf);
RADEXPFUNC S32 RADEXPLINK BinkBufferUnlock( HBINKBUFFER buf);
RADEXPFUNC void RADEXPLINK BinkBufferSetResolution( S32 w, S32 h, S32 bits);
RADEXPFUNC void RADEXPLINK BinkBufferCheckWinPos( HBINKBUFFER buf, S32 PTR4* NewWindowX, S32 PTR4* NewWindowY);
RADEXPFUNC S32 RADEXPLINK BinkBufferSetOffset( HBINKBUFFER buf, S32 destx, S32 desty);
RADEXPFUNC void RADEXPLINK BinkBufferBlit( HBINKBUFFER buf, BINKRECT PTR4* rects, U32 numrects );
RADEXPFUNC S32 RADEXPLINK BinkBufferSetScale( HBINKBUFFER buf, U32 w, U32 h);
RADEXPFUNC char PTR4* RADEXPLINK BinkBufferGetDescription( HBINKBUFFER buf);
RADEXPFUNC char PTR4* RADEXPLINK BinkBufferGetError();
RADEXPFUNC void RADEXPLINK BinkRestoreCursor(S32 checkcount);
RADEXPFUNC S32 RADEXPLINK BinkBufferClear(HBINKBUFFER buf, U32 RGB);
#endif
typedef void PTR4* (RADLINK PTR4* BINKMEMALLOC) (U32 bytes);
typedef void (RADLINK PTR4* BINKMEMFREE) (void PTR4* ptr);
RADEXPFUNC void RADEXPLINK BinkSetMemory(BINKMEMALLOC a,BINKMEMFREE f);
#ifdef __RADMAC__
#pragma export off
#endif
RADDEFEND
#endif
// @cdep pre $set(INCs,$INCs -I$clipfilename($file)) $ignore(TakeCPP)
#endif

BIN
game_re/third_party/bink/binkw32.dll vendored Normal file

Binary file not shown.

BIN
game_re/third_party/bink/binkw32.lib vendored Normal file

Binary file not shown.

389
game_re/third_party/bink/radbase.h vendored Normal file
View File

@ -0,0 +1,389 @@
// __RAD16__ means 16 bit code (Win16)
// __RAD32__ means 32 bit code (DOS, Win386, Win32s, Mac)
// __RADDOS__ means DOS code (16 or 32 bit)
// __RADWIN__ means Windows code (Win16, Win386, Win32s)
// __RADWINEXT__ means Windows 386 extender (Win386)
// __RADNT__ means Win32s code
// __RADMAC__ means Macintosh
// __RADCARBON__ means Carbon
// __RADMACH__ means MachO
// __RADXBOX__ means the XBox console
// __RADNGC__ means the Nintendo GameCube
// __RADNTBUILDLINUX__ means building Linux on NT
// __RADLINUX__ means actually building on Linux (most likely with GCC)
// __RADX86__ means Intel x86
// __RADMMX__ means Intel x86 MMX instructions are allowed
// __RAD68K__ means 68K
// __RADPPC__ means PowerPC
// __RADLITTLEENDIAN__ means processor is little-endian (x86)
// __RADBIGENDIAN__ means processor is big-endian (680x0, PPC)
#ifndef __RADBASEH__
#define __RADBASEH__
#define RADCOPYRIGHT "Copyright (C) 1994-2003, RAD Game Tools, Inc."
#ifndef __RADRES__
#if defined(GEKKO)
#define __RADNGC__
#define __RAD32__
#define __RADPPC__
#define __RADBIGENDIAN__
#define RADINLINE inline
#elif (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || defined(THINK_C) || defined(powerc) || defined(macintosh) || defined(__powerc) || defined(__APPLE__) || defined(__MACH__)
#define __RADMAC__
#if defined(powerc) || defined(__powerc) || defined(__ppc__)
#define __RADPPC__
#else
#define __RAD68K__
#endif
#define __RAD32__
#define __RADBIGENDIAN__
#if defined(__MWERKS__)
#if (defined(__cplusplus) || ! __option(only_std_keywords))
#define RADINLINE inline
#endif
#elif defined(__MRC__)
#if defined(__cplusplus)
#define RADINLINE inline
#endif
#elif defined(__GNUC__) || defined(__GNUG__)
#define RADINLINE inline
#define __RADMACH__
#endif
#ifdef __MACH__
#define __RADMACH__
#endif
#ifdef TARGET_API_MAC_CARBON
#if TARGET_API_MAC_CARBON
#ifndef __RADCARBON__
#define __RADCARBON__
#endif
#endif
#endif
#elif defined(linux)
#define __RADLINUX__
#define __RADX86__
#define __RADMMX__
#define __RAD32__
#define __RADLITTLEENDIAN__
#define RADINLINE inline
#else
#define __RADX86__
#define __RADMMX__
#ifdef __MWERKS__
#define _WIN32
#endif
#ifdef __DOS__
#define __RADDOS__
#endif
#ifdef __386__
#define __RAD32__
#endif
#ifdef _Windows //For Borland
#ifdef __WIN32__
#define WIN32
#else
#define __WINDOWS__
#endif
#endif
#ifdef _WINDOWS //For MS
#ifndef _WIN32
#define __WINDOWS__
#endif
#endif
#ifdef _WIN32
#ifdef _XBOX
#define __RADXBOX__
#else
#define __RADNT__
#endif
#define __RADWIN__
#define __RAD32__
#else
#ifdef __NT__
#ifdef _XBOX
#define __RADXBOX__
#else
#define __RADNT__
#endif
#define __RADWIN__
#define __RAD32__
#else
#ifdef __WINDOWS_386__
#define __RADWIN__
#define __RADWINEXT__
#define __RAD32__
#else
#ifdef __WINDOWS__
#define __RADWIN__
#define __RAD16__
#else
#ifdef WIN32
#ifdef _XBOX
#define __RADXBOX__
#else
#define __RADNT__
#endif
#define __RADWIN__
#define __RAD32__
#endif
#endif
#endif
#endif
#endif
#define __RADLITTLEENDIAN__
#ifdef __WATCOMC__
#define RADINLINE
#else
#define RADINLINE __inline
#endif
#endif
#if (!defined(__RADDOS__) && !defined(__RADWIN__) && !defined(__RADMAC__) && !defined(__RADNGC__) && !defined(__RADXBOX__) && !defined(__RADLINUX__))
#error "RAD.H did not detect your platform. Define __DOS__, __WINDOWS__, WIN32, macintosh, or powerc."
#endif
#ifdef __RADFINAL__
#define RADTODO(str) { char __str[0]=str; }
#else
#define RADTODO(str)
#endif
#ifdef __RADNGC__
#define RADLINK
#define RADEXPLINK
#define RADEXPFUNC RADDEFFUNC
#define RADASMLINK
#define PTR4
#elif defined(__RADLINUX__)
#define RADLINK __attribute__((cdecl))
#define RADEXPLINK __attribute__((cdecl))
#define RADEXPFUNC RADDEFFUNC
#define RADASMLINK
#define PTR4
#elif defined(__RADMAC__)
// this define is for CodeWarrior 11's stupid new libs (even though
// we don't use longlong's).
#define __MSL_LONGLONG_SUPPORT__
#define RADLINK
#define RADEXPLINK
#ifdef __CFM68K__
#ifdef __RADINDLL__
#define RADEXPFUNC RADDEFFUNC __declspec(export)
#else
#define RADEXPFUNC RADDEFFUNC __declspec(import)
#endif
#else
#define RADEXPFUNC RADDEFFUNC
#endif
#define RADASMLINK
#else
#ifdef __RADNT__
#ifndef _WIN32
#define _WIN32
#endif
#ifndef WIN32
#define WIN32
#endif
#endif
#ifdef __RADWIN__
#ifdef __RAD32__
#ifdef __RADXBOX__
#define RADLINK __stdcall
#define RADEXPLINK __stdcall
#define RADEXPFUNC RADDEFFUNC
#elif defined(__RADNTBUILDLINUX__)
#define RADLINK __cdecl
#define RADEXPLINK __cdecl
#define RADEXPFUNC RADDEFFUNC
#else
#ifdef __RADNT__
#define RADLINK __stdcall
#define RADEXPLINK __stdcall
#ifdef __RADINEXE__
#define RADEXPFUNC RADDEFFUNC
#else
#ifndef __RADINDLL__
#define RADEXPFUNC RADDEFFUNC __declspec(dllimport)
#ifdef __BORLANDC__
#if __BORLANDC__<=0x460
#undef RADEXPFUNC
#define RADEXPFUNC RADDEFFUNC
#endif
#endif
#else
#define RADEXPFUNC RADDEFFUNC __declspec(dllexport)
#endif
#endif
#else
#define RADLINK __pascal
#define RADEXPLINK __far __pascal
#define RADEXPFUNC RADDEFFUNC
#endif
#endif
#else
#define RADLINK __pascal
#define RADEXPLINK __far __pascal __export
#define RADEXPFUNC RADDEFFUNC
#endif
#else
#define RADLINK __pascal
#define RADEXPLINK __pascal
#define RADEXPFUNC RADDEFFUNC
#endif
#define RADASMLINK __cdecl
#endif
#ifndef __RADXBOX__
#ifdef __RADWIN__
#ifndef _WINDOWS
#define _WINDOWS
#endif
#endif
#endif
#ifndef RADDEFFUNC
#ifdef __cplusplus
#define RADDEFFUNC extern "C"
#define RADDEFSTART extern "C" {
#define RADDEFEND }
#define RADDEFINEDATA extern "C"
#define RADDECLAREDATA extern "C"
#define RADDEFAULT( val ) =val
#else
#define RADDEFFUNC
#define RADDEFSTART
#define RADDEFEND
#define RADDEFINEDATA
#define RADDECLAREDATA extern
#define RADDEFAULT( val )
#endif
#endif
#ifdef __RADNGC__
#define RAD_ATTRIBUTE_ALIGN(num) __attribute__ ((aligned (num)))
#else
#ifdef __RADX86__
#ifdef __WATCOMC__
#define RAD_ATTRIBUTE_ALIGN(num)
#else
#define RAD_ATTRIBUTE_ALIGN(num) __declspec(align(num))
#endif
#else
#define RAD_ATTRIBUTE_ALIGN(num)
#endif
#endif
#ifdef __RADX86__
#ifdef __WATCOMC__
#define RAD_ALIGN_TYPE double
#define RAD_ALIGN_DEF 0.0
#else
#define RAD_ALIGN_TYPE double __declspec(align(8))
#define RAD_ALIGN_DEF 0.0
#endif
#else
#define RAD_ALIGN_TYPE double
#define RAD_ALIGN_DEF 0.0
#endif
#define RAD_ALIGN_ADD_TYPE(var) RAD_ALIGN_TYPE var##align = RAD_ALIGN_DEF
#define S8 signed char
#define U8 unsigned char
#define U32 unsigned long
#define S32 signed long
#define F32 float
#define F64 double
#if defined(__MWERKS__) || defined(__MRC__) || defined( GEKKO )
#define U64 unsigned long long
#define S64 signed long long
#else
#define U64 unsigned __int64
#define S64 signed __int64
#endif
#ifdef __RAD32__
#define PTR4
#define U16 unsigned short
#define S16 signed short
#else
#define PTR4 __far
#define U16 unsigned int
#define S16 signed int
#endif
#ifndef RAD_NO_LOWERCASE_TYPES
#ifdef __RADNGC__
// Unfortunately dolphin\types.h typedefs the
// same types that we use.
// So we use the typedefs for this platform.
#include <dolphin\types.h>
#else
#define u8 U8
#define s8 S8
#define u16 U16
#define s16 S16
#define u32 U32
#define s32 S32
#define u64 U64
#define s64 S64
#define f32 F32
#define f64 F64
#endif
#endif
#endif
#endif

View File

@ -0,0 +1,71 @@
// Decompile selected function recursively
// @category _Reman3
// @menupath Reman3.Dump Current Function (recursive)
import java.util.ArrayList;
import java.util.List;
import ghidra.app.script.GhidraScript;
import ghidra.program.model.listing.Function;
import re3lib.FunctionDumper;
import re3lib.GlobalDumper;
import re3lib.PCallTracer;
import re3lib.RecompileConfig;
public class DumpCurrentFunctionRecursive extends GhidraScript {
@Override
public void run() throws Exception {
RecompileConfig.INSTANCE = new RecompileConfig(this);
RecompileConfig.INSTANCE.createDirectories();
GlobalDumper globalDumper = new GlobalDumper(this);
globalDumper.loadGlobalManifest();
PCallTracer tracer = new PCallTracer();
tracer.traceCalls(getFunctionContaining(currentAddress));
List<Function> functionsToDump = new ArrayList<>();
List<Function> functionsToDumpNew = new ArrayList<>();
for (Function func : tracer.out) {
if (FunctionDumper.isDumpedFix(func))
continue;
println("Dump: " + func.getName());
functionsToDump.add(func);
if (!FunctionDumper.isDumpedAuto(func))
functionsToDumpNew.add(func);
}
if (!functionsToDump.isEmpty()) {
String newOpt = "Only new (" + functionsToDumpNew.size() + ")";
String okOpt = "Yes (" + functionsToDump.size() + ")";
String choice = askChoice("Confirmation", "About to generate " + functionsToDump.size() + " functions ("
+ functionsToDumpNew.size() + " new), continue?",
new ArrayList<String>() {
{
add(okOpt);
add(newOpt);
add("No");
}
}, okOpt);
if (choice == okOpt) {
} else if (choice == newOpt) {
functionsToDump = functionsToDumpNew;
} else {
return;
}
FunctionDumper functionDumper = new FunctionDumper(this, globalDumper);
for (Function func : functionsToDump) {
functionDumper.dump(func);
}
if (functionDumper.createdFile)
RecompileConfig.INSTANCE.touchCMakeTimestamp();
globalDumper.dumpGlobals();
globalDumper.saveGlobalManifest();
}
}
}

View File

@ -128,6 +128,9 @@ public class GlobalDumper {
String escapeCString(String str) {
str = str.replace("\\", "\\\\");
str = str.replace("\"", "\\\"");
str = str.replace("\n", "\\n");
str = str.replace("\r", "\\r");
str = str.replace("\t", "\\t");
return str;
}

View File

@ -52,7 +52,6 @@ public class PCallTracer {
Address callAddr = target.getAddress();
Function calledFunction = script.getFunctionAt(callAddr);
if (calledFunction == null) {
script.println("PCallTracer, called function not found: " + op.toString() + " - "
+ highFunction.getFunction().getName());
continue;
@ -69,7 +68,7 @@ public class PCallTracer {
if (!visited.contains(function.getEntryPoint())) {
visited.add(function.getEntryPoint());
if (trace) {
// script.println("PCallTracer, visiting " + function.getName() + " (depth:" + depth + ")");
script.println("PCallTracer, visiting " + function.getName() + " (depth:" + depth + ")");
}
DecompileResults decompRes = decomp.getOrInsert(function);
visit(decompRes.getHighFunction(), depth);