1
0
Fork 0

a little cleanup

pull/38/head
Lundar 2018-06-21 02:50:41 -04:00
parent fb10d2e7b2
commit 5236992d8f
8 changed files with 78 additions and 46 deletions

View File

@ -284,9 +284,19 @@ bool __cdecl diablo_get_not_running()
return GetLastError() != ERROR_ALREADY_EXISTS; return GetLastError() != ERROR_ALREADY_EXISTS;
} }
void preMainInit(){
engine_cpp_init_2();
dx_cpp_init_2();
dthread_cpp_init_2();
nthread_cpp_init_2();
log_cpp_init_2();
}
//----- (00408B4A) -------------------------------------------------------- //----- (00408B4A) --------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{ {
preMainInit();
HINSTANCE v4; // esi HINSTANCE v4; // esi
//int v11; // ecx //int v11; // ecx
char Filename[260]; // [esp+8h] [ebp-10Ch] char Filename[260]; // [esp+8h] [ebp-10Ch]

View File

@ -26,14 +26,13 @@ struct dthread_cpp_init_1
// 52A4E0: using guessed type int dthread_cpp_init_value; // 52A4E0: using guessed type int dthread_cpp_init_value;
//----- (004150A8) -------------------------------------------------------- //----- (004150A8) --------------------------------------------------------
struct dthread_cpp_init_2
void __cdecl dthread_cpp_init_2()
{ {
dthread_cpp_init_2()
{
dthread_init_mutex(); dthread_init_mutex();
dthread_cleanup_mutex_atexit(); dthread_cleanup_mutex_atexit();
} }
} _dthread_cpp_init_2;
//----- (004150B2) -------------------------------------------------------- //----- (004150B2) --------------------------------------------------------
void __cdecl dthread_init_mutex() void __cdecl dthread_init_mutex()

View File

@ -29,14 +29,11 @@ struct dx_cpp_init_1
// 52A514: using guessed type int dx_cpp_init_value; // 52A514: using guessed type int dx_cpp_init_value;
//----- (00415372) -------------------------------------------------------- //----- (00415372) --------------------------------------------------------
struct dx_cpp_init_2 void __cdecl dx_cpp_init_2()
{ {
dx_cpp_init_2()
{
dx_init_mutex(); dx_init_mutex();
dx_cleanup_mutex_atexit(); dx_cleanup_mutex_atexit();
} }
} _dx_cpp_init_2;
//----- (0041537C) -------------------------------------------------------- //----- (0041537C) --------------------------------------------------------
void __cdecl dx_init_mutex() void __cdecl dx_init_mutex()

View File

@ -1912,14 +1912,12 @@ int __fastcall random(int idx, int v)
} }
//----- (0041756D) -------------------------------------------------------- //----- (0041756D) --------------------------------------------------------
struct engine_cpp_init_2 void __cdecl engine_cpp_init_2()
{ {
engine_cpp_init_2()
{
mem_init_mutex(); mem_init_mutex();
mem_atexit_mutex(); mem_atexit_mutex();
} }
} _engine_cpp_init_2;
//----- (00417577) -------------------------------------------------------- //----- (00417577) --------------------------------------------------------
void __cdecl mem_init_mutex() void __cdecl mem_init_mutex()

View File

@ -279,15 +279,11 @@ void __cdecl init_archives()
fileinfo.originalarchivefile = diabdat_mpq_path; fileinfo.originalarchivefile = diabdat_mpq_path;
fileinfo.patcharchivefile = patch_rt_mpq_path; fileinfo.patcharchivefile = patch_rt_mpq_path;
init_get_file_info(); init_get_file_info();
#ifdef COPYPROT
while ( 1 )
{
#endif
diabdat_mpq = init_test_access(diabdat_mpq_path, "\\diabdat.mpq", "DiabloCD", 1000, 1); diabdat_mpq = init_test_access(diabdat_mpq_path, "\\diabdat.mpq", "DiabloCD", 1000, 1);
#ifdef COPYPROT #ifdef COPYPROT
if ( diabdat_mpq ) if (! diabdat_mpq ){
break; UiCopyProtError(&v1);
UiCopyProtError((int)&v1);
if ( v1 == COPYPROT_CANCEL ) if ( v1 == COPYPROT_CANCEL )
FileErrDlg("diabdat.mpq"); FileErrDlg("diabdat.mpq");
} }
@ -500,7 +496,7 @@ void __fastcall init_activate_window(HWND hWnd, bool activated)
LONG dwNewLong; // eax LONG dwNewLong; // eax
window_activated = activated; window_activated = activated;
UiAppActivate(activated); //UiAppActivate(activated);
dwNewLong = GetWindowLongA(hWnd, GWL_STYLE); dwNewLong = GetWindowLongA(hWnd, GWL_STYLE);
if ( window_activated && fullscreen ) if ( window_activated && fullscreen )

View File

@ -28,14 +28,11 @@ struct log_cpp_init_1
// 646A30: using guessed type int log_cpp_init_value; // 646A30: using guessed type int log_cpp_init_value;
//----- (00427A02) -------------------------------------------------------- //----- (00427A02) --------------------------------------------------------
struct log_cpp_init_2 void __cdecl log_cpp_init_2()
{ {
log_cpp_init_2()
{
log_init_mutex(); log_init_mutex();
j_log_cleanup_mutex(); j_log_cleanup_mutex();
} }
} _log_cpp_init_2;
//----- (00427A0C) -------------------------------------------------------- //----- (00427A0C) --------------------------------------------------------
void __cdecl log_init_mutex() void __cdecl log_init_mutex()

View File

@ -113,7 +113,7 @@ LABEL_6:
//----- (00427F76) -------------------------------------------------------- //----- (00427F76) --------------------------------------------------------
void __fastcall mainmenu_action(int option) void __fastcall mainmenu_action(int option)
{ {
int v1; // eax /* int v1; // eax
int a2; // [esp+0h] [ebp-4h] int a2; // [esp+0h] [ebp-4h]
a2 = option; a2 = option;
@ -152,6 +152,44 @@ LABEL_15:
} }
while ( v1 ); while ( v1 );
LABEL_16: LABEL_16:
music_stop();*/
int quit; // eax
int a2; // [esp+0h] [ebp-4h]
//a2 = option;// development history seems to be showing here
mainmenu_refresh_music();
do{
quit = 1;
a2 = 0;
if ( !UiMainMenuDialog("Diablo v1.09", &a2, effects_play_sound, 30) ){
TermMsg("Unable to display mainmenu");
//old code would go directly to single player here...
break;//new code will quit.
}
switch ( a2 )
{
case MAINMENU_SINGLE_PLAYER:
quit = mainmenu_single_player();
break;
case MAINMENU_MULTIPLAYER:
quit = mainmenu_multi_player();
break;
case MAINMENU_SHOW_CREDITS:
UiCreditsDialog(16);
break;
case MAINMENU_EXIT_DIABLO:
quit = 0;
break;
case MAINMENU_REPLAY_INTRO:
case MAINMENU_ATTRACT_MODE:
if ( window_activated )
mainmenu_play_intro();
break;
}
}while ( quit );
music_stop(); music_stop();
} }
// 634980: using guessed type int window_activated; // 634980: using guessed type int window_activated;

View File

@ -37,14 +37,11 @@ struct nthread_cpp_init_1
// 679700: using guessed type int nthread_cpp_init_value; // 679700: using guessed type int nthread_cpp_init_value;
//----- (00440DBE) -------------------------------------------------------- //----- (00440DBE) --------------------------------------------------------
struct nthread_cpp_init_2 void __cdecl nthread_cpp_init_2()
{ {
nthread_cpp_init_2()
{
nthread_init_mutex(); nthread_init_mutex();
nthread_cleanup_mutex_atexit(); nthread_cleanup_mutex_atexit();
} }
} _nthread_cpp_init_2;
//----- (00440DC8) -------------------------------------------------------- //----- (00440DC8) --------------------------------------------------------
void __cdecl nthread_init_mutex() void __cdecl nthread_init_mutex()