-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WinMain+Direct file access from HDD #456
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -254,71 +254,81 @@ void __cdecl free_game() | |
FreeGameMem(); | ||
} | ||
|
||
bool __cdecl diablo_get_not_running() | ||
BOOL __cdecl diablo_get_not_running() | ||
{ | ||
SetLastError(0); | ||
CreateEvent(NULL, FALSE, FALSE, "DiabloEvent"); | ||
return GetLastError() != ERROR_ALREADY_EXISTS; | ||
} | ||
|
||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) | ||
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) | ||
{ | ||
HINSTANCE v4; // esi | ||
char Filename[260]; // [esp+8h] [ebp-10Ch] | ||
char value_name[8]; // [esp+10Ch] [ebp-8h] | ||
HINSTANCE hInst; | ||
int nData; | ||
char szFileName[MAX_PATH]; | ||
|
||
v4 = hInstance; | ||
hInst = hInstance; | ||
#ifndef DEBUGGER | ||
diablo_reload_process(hInstance); | ||
#endif | ||
ghInst = v4; | ||
if (RestrictedTest()) | ||
ghInst = hInst; | ||
|
||
if(RestrictedTest()) | ||
ErrOkDlg(IDD_DIALOG10, 0, "C:\\Src\\Diablo\\Source\\DIABLO.CPP", 877); | ||
if (ReadOnlyTest()) { | ||
if (!GetModuleFileName(ghInst, Filename, 0x104u)) | ||
*Filename = '\0'; | ||
DirErrorDlg(Filename); | ||
if(ReadOnlyTest()) { | ||
if(!GetModuleFileName(ghInst, szFileName, sizeof(szFileName))) | ||
szFileName[0] = '\0'; | ||
DirErrorDlg(szFileName); | ||
} | ||
|
||
ShowCursor(FALSE); | ||
srand(GetTickCount()); | ||
InitHash(); | ||
exception_get_filter(); | ||
if (!diablo_find_window("DIABLO") && diablo_get_not_running()) { | ||
|
||
BOOL bNoEvent = diablo_get_not_running(); | ||
if(!diablo_find_window("DIABLO") && bNoEvent) { | ||
#ifdef _DEBUG | ||
SFileEnableDirectAccess(TRUE); | ||
#endif | ||
diablo_init_screen(); | ||
diablo_parse_flags(lpCmdLine); | ||
init_create_window(nCmdShow); | ||
sound_init(); | ||
UiInitialize(); | ||
|
||
#ifdef _DEBUG | ||
if (showintrodebug) | ||
play_movie("gendata\\logo.smk", 1); | ||
#else | ||
play_movie("gendata\\logo.smk", 1); | ||
if(showintrodebug) | ||
#endif | ||
strcpy(value_name, "Intro"); | ||
if (!SRegLoadValue("Diablo", value_name, 0, (int *)&hInstance)) | ||
hInstance = (HINSTANCE)1; | ||
if (hInstance) | ||
play_movie("gendata\\diablo1.smk", 1); | ||
SRegSaveValue("Diablo", value_name, 0, 0); | ||
play_movie("gendata\\logo.smk", TRUE); | ||
AJenbo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
char szValueName[] = "Intro"; | ||
if(!SRegLoadValue("Diablo", szValueName, 0, &nData)) | ||
nData = 1; | ||
if(nData) | ||
AJenbo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
play_movie("gendata\\diablo1.smk", TRUE); | ||
SRegSaveValue("Diablo", szValueName, 0, 0); | ||
|
||
#ifdef _DEBUG | ||
if (showintrodebug) { | ||
if(showintrodebug) { | ||
#endif | ||
UiTitleDialog(7); | ||
BlackPalette(); | ||
#ifdef _DEBUG | ||
} | ||
#else | ||
UiTitleDialog(7); | ||
BlackPalette(); | ||
#endif | ||
|
||
mainmenu_loop(); | ||
UiDestroy(); | ||
SaveGamma(); | ||
if (ghMainWnd) { | ||
|
||
if(ghMainWnd) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if (ghMainWnd != NULL) { |
||
Sleep(300); | ||
DestroyWindow(ghMainWnd); | ||
} | ||
} | ||
return 0; | ||
|
||
return FALSE; | ||
} | ||
|
||
void __fastcall diablo_parse_flags(char *args) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (GetModuleFileName(...) == 0)
GetModuleFileName returns the length of the returned name, not a boolean value.