parent
24fdfc065f
commit
0472ac9a22
|
@ -1,16 +1,20 @@
|
||||||
#include "autorun.h"
|
#include "autorun.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
// 0x530010
|
// 0x530010
|
||||||
HANDLE gInterplayGenericAutorunMutex;
|
HANDLE gInterplayGenericAutorunMutex;
|
||||||
|
#endif
|
||||||
|
|
||||||
// 0x4139C0
|
// 0x4139C0
|
||||||
bool autorunMutexCreate()
|
bool autorunMutexCreate()
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
gInterplayGenericAutorunMutex = CreateMutexA(NULL, FALSE, "InterplayGenericAutorunMutex");
|
gInterplayGenericAutorunMutex = CreateMutexA(NULL, FALSE, "InterplayGenericAutorunMutex");
|
||||||
if (GetLastError() == ERROR_ALREADY_EXISTS) {
|
if (GetLastError() == ERROR_ALREADY_EXISTS) {
|
||||||
CloseHandle(gInterplayGenericAutorunMutex);
|
CloseHandle(gInterplayGenericAutorunMutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +22,9 @@ bool autorunMutexCreate()
|
||||||
// 0x413A00
|
// 0x413A00
|
||||||
void autorunMutexClose()
|
void autorunMutexClose()
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
if (gInterplayGenericAutorunMutex != NULL) {
|
if (gInterplayGenericAutorunMutex != NULL) {
|
||||||
CloseHandle(gInterplayGenericAutorunMutex);
|
CloseHandle(gInterplayGenericAutorunMutex);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
#ifndef AUTORUN_H
|
#ifndef AUTORUN_H
|
||||||
#define AUTORUN_H
|
#define AUTORUN_H
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
extern HANDLE gInterplayGenericAutorunMutex;
|
extern HANDLE gInterplayGenericAutorunMutex;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool autorunMutexCreate();
|
bool autorunMutexCreate();
|
||||||
void autorunMutexClose();
|
void autorunMutexClose();
|
||||||
|
|
|
@ -8,8 +8,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// 0x51DEF8
|
// 0x51DEF8
|
||||||
FILE* _fd = NULL;
|
FILE* _fd = NULL;
|
||||||
|
@ -137,7 +139,11 @@ int debugPrint(const char* format, ...)
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
char string[260];
|
char string[260];
|
||||||
vsprintf(string, format, args);
|
vsprintf(string, format, args);
|
||||||
|
#ifdef _WIN32
|
||||||
OutputDebugStringA(string);
|
OutputDebugStringA(string);
|
||||||
|
#else
|
||||||
|
printf(string);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
rc = -1;
|
rc = -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
#include "game_config.h"
|
#include "game_config.h"
|
||||||
#include "platform_compat.h"
|
#include "platform_compat.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// 0x440DD0
|
// 0x440DD0
|
||||||
void runElectronicRegistration()
|
void runElectronicRegistration()
|
||||||
|
@ -12,6 +14,7 @@ void runElectronicRegistration()
|
||||||
int timesRun = 0;
|
int timesRun = 0;
|
||||||
configGetInt(&gGameConfig, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_TIMES_RUN_KEY, ×Run);
|
configGetInt(&gGameConfig, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_TIMES_RUN_KEY, ×Run);
|
||||||
if (timesRun > 0 && timesRun < 5) {
|
if (timesRun > 0 && timesRun < 5) {
|
||||||
|
#ifdef _WIN32
|
||||||
char path[COMPAT_MAX_PATH];
|
char path[COMPAT_MAX_PATH];
|
||||||
if (GetModuleFileNameA(NULL, path, sizeof(path)) != 0) {
|
if (GetModuleFileNameA(NULL, path, sizeof(path)) != 0) {
|
||||||
char* pch = strrchr(path, '\\');
|
char* pch = strrchr(path, '\\');
|
||||||
|
@ -33,6 +36,7 @@ void runElectronicRegistration()
|
||||||
WaitForSingleObject(processInfo.hProcess, INFINITE);
|
WaitForSingleObject(processInfo.hProcess, INFINITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
configSetInt(&gGameConfig, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_TIMES_RUN_KEY, timesRun + 1);
|
configSetInt(&gGameConfig, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_TIMES_RUN_KEY, timesRun + 1);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,10 +5,6 @@
|
||||||
#include "platform_compat.h"
|
#include "platform_compat.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#define NOMINMAX
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
typedef enum WeaponSoundEffect {
|
typedef enum WeaponSoundEffect {
|
||||||
WEAPON_SOUND_EFFECT_READY,
|
WEAPON_SOUND_EFFECT_READY,
|
||||||
WEAPON_SOUND_EFFECT_ATTACK,
|
WEAPON_SOUND_EFFECT_ATTACK,
|
||||||
|
|
|
@ -1532,6 +1532,7 @@ int _soundSetMasterVolume(int volume)
|
||||||
return gSoundLastError;
|
return gSoundLastError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_DSOUND
|
||||||
// 0x4AE5C8
|
// 0x4AE5C8
|
||||||
void CALLBACK _doTimerEvent(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2)
|
void CALLBACK _doTimerEvent(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2)
|
||||||
{
|
{
|
||||||
|
@ -1551,6 +1552,7 @@ void _removeTimedEvent(unsigned int* timerId)
|
||||||
*timerId = -1;
|
*timerId = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// 0x4AE634
|
// 0x4AE634
|
||||||
int _soundGetPosition(Sound* sound)
|
int _soundGetPosition(Sound* sound)
|
||||||
|
|
|
@ -95,7 +95,9 @@ typedef struct Sound {
|
||||||
int field_68;
|
int field_68;
|
||||||
int readLimit;
|
int readLimit;
|
||||||
int field_70;
|
int field_70;
|
||||||
|
#ifdef HAVE_DSOUND
|
||||||
DWORD field_74;
|
DWORD field_74;
|
||||||
|
#endif
|
||||||
int field_78;
|
int field_78;
|
||||||
int field_7C;
|
int field_7C;
|
||||||
int field_80;
|
int field_80;
|
||||||
|
@ -183,8 +185,10 @@ int soundResume(Sound* sound);
|
||||||
int soundSetFileIO(Sound* sound, SoundOpenProc* openProc, SoundCloseProc* closeProc, SoundReadProc* readProc, SoundWriteProc* writeProc, SoundSeekProc* seekProc, SoundTellProc* tellProc, SoundFileLengthProc* fileLengthProc);
|
int soundSetFileIO(Sound* sound, SoundOpenProc* openProc, SoundCloseProc* closeProc, SoundReadProc* readProc, SoundWriteProc* writeProc, SoundSeekProc* seekProc, SoundTellProc* tellProc, SoundFileLengthProc* fileLengthProc);
|
||||||
void soundDeleteInternal(Sound* sound);
|
void soundDeleteInternal(Sound* sound);
|
||||||
int _soundSetMasterVolume(int value);
|
int _soundSetMasterVolume(int value);
|
||||||
|
#ifdef HAVE_DSOUND
|
||||||
void CALLBACK _doTimerEvent(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
|
void CALLBACK _doTimerEvent(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
|
||||||
void _removeTimedEvent(unsigned int* timerId);
|
void _removeTimedEvent(unsigned int* timerId);
|
||||||
|
#endif
|
||||||
int _soundGetPosition(Sound* sound);
|
int _soundGetPosition(Sound* sound);
|
||||||
int _soundSetPosition(Sound* sound, int a2);
|
int _soundSetPosition(Sound* sound, int a2);
|
||||||
void _removeFadeSound(STRUCT_51D478* a1);
|
void _removeFadeSound(STRUCT_51D478* a1);
|
||||||
|
|
11
src/win32.cc
11
src/win32.cc
|
@ -7,6 +7,7 @@
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
#ifdef HAVE_DSOUND
|
#ifdef HAVE_DSOUND
|
||||||
// 0x51E430
|
// 0x51E430
|
||||||
DirectSoundCreateProc* gDirectSoundCreateProc = NULL;
|
DirectSoundCreateProc* gDirectSoundCreateProc = NULL;
|
||||||
|
@ -78,3 +79,13 @@ void _UnloadDirectX(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
bool gProgramIsActive = false;
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
|
gProgramIsActive = true;
|
||||||
|
return falloutMain(argc, argv);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "dsound_compat.h"
|
#include "dsound_compat.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -22,5 +23,8 @@ extern HMODULE gDSoundDLL;
|
||||||
#endif
|
#endif
|
||||||
bool _LoadDirectX();
|
bool _LoadDirectX();
|
||||||
void _UnloadDirectX(void);
|
void _UnloadDirectX(void);
|
||||||
|
#else
|
||||||
|
extern bool gProgramIsActive;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* WIN32_H */
|
#endif /* WIN32_H */
|
||||||
|
|
|
@ -21,8 +21,10 @@ char _path_patches[] = "";
|
||||||
// 0x51E3D8
|
// 0x51E3D8
|
||||||
bool _GNW95_already_running = false;
|
bool _GNW95_already_running = false;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
// 0x51E3DC
|
// 0x51E3DC
|
||||||
HANDLE _GNW95_title_mutex = INVALID_HANDLE_VALUE;
|
HANDLE _GNW95_title_mutex = INVALID_HANDLE_VALUE;
|
||||||
|
#endif
|
||||||
|
|
||||||
// 0x51E3E0
|
// 0x51E3E0
|
||||||
bool gWindowSystemInitialized = false;
|
bool gWindowSystemInitialized = false;
|
||||||
|
@ -82,16 +84,20 @@ RadioGroup gRadioGroups[RADIO_GROUP_LIST_CAPACITY];
|
||||||
// 0x4D5C30
|
// 0x4D5C30
|
||||||
int windowManagerInit(VideoSystemInitProc* videoSystemInitProc, VideoSystemExitProc* videoSystemExitProc, int a3)
|
int windowManagerInit(VideoSystemInitProc* videoSystemInitProc, VideoSystemExitProc* videoSystemExitProc, int a3)
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
CloseHandle(_GNW95_mutex);
|
CloseHandle(_GNW95_mutex);
|
||||||
_GNW95_mutex = INVALID_HANDLE_VALUE;
|
_GNW95_mutex = INVALID_HANDLE_VALUE;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (_GNW95_already_running) {
|
if (_GNW95_already_running) {
|
||||||
return WINDOW_MANAGER_ERR_ALREADY_RUNNING;
|
return WINDOW_MANAGER_ERR_ALREADY_RUNNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
if (_GNW95_title_mutex == INVALID_HANDLE_VALUE) {
|
if (_GNW95_title_mutex == INVALID_HANDLE_VALUE) {
|
||||||
return WINDOW_MANAGER_ERR_TITLE_NOT_SET;
|
return WINDOW_MANAGER_ERR_TITLE_NOT_SET;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (gWindowSystemInitialized) {
|
if (gWindowSystemInitialized) {
|
||||||
return WINDOW_MANAGER_ERR_WINDOW_SYSTEM_ALREADY_INITIALIZED;
|
return WINDOW_MANAGER_ERR_WINDOW_SYSTEM_ALREADY_INITIALIZED;
|
||||||
|
@ -260,8 +266,10 @@ void windowManagerExit(void)
|
||||||
|
|
||||||
gWindowSystemInitialized = false;
|
gWindowSystemInitialized = false;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
CloseHandle(_GNW95_title_mutex);
|
CloseHandle(_GNW95_title_mutex);
|
||||||
_GNW95_title_mutex = INVALID_HANDLE_VALUE;
|
_GNW95_title_mutex = INVALID_HANDLE_VALUE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
_insideWinExit = false;
|
_insideWinExit = false;
|
||||||
}
|
}
|
||||||
|
@ -1232,6 +1240,7 @@ void programWindowSetTitle(const char* title)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
if (_GNW95_title_mutex == INVALID_HANDLE_VALUE) {
|
if (_GNW95_title_mutex == INVALID_HANDLE_VALUE) {
|
||||||
_GNW95_title_mutex = CreateMutexA(NULL, TRUE, title);
|
_GNW95_title_mutex = CreateMutexA(NULL, TRUE, title);
|
||||||
if (GetLastError() != ERROR_SUCCESS) {
|
if (GetLastError() != ERROR_SUCCESS) {
|
||||||
|
@ -1239,6 +1248,7 @@ void programWindowSetTitle(const char* title)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
strncpy(gProgramWindowTitle, title, 256);
|
strncpy(gProgramWindowTitle, title, 256);
|
||||||
gProgramWindowTitle[256 - 1] = '\0';
|
gProgramWindowTitle[256 - 1] = '\0';
|
||||||
|
|
|
@ -5,9 +5,11 @@
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAX_WINDOW_COUNT (50)
|
#define MAX_WINDOW_COUNT (50)
|
||||||
|
|
||||||
|
@ -156,7 +158,9 @@ typedef void(VideoSystemExitProc)();
|
||||||
extern char _path_patches[];
|
extern char _path_patches[];
|
||||||
|
|
||||||
extern bool _GNW95_already_running;
|
extern bool _GNW95_already_running;
|
||||||
|
#ifdef _WIN32
|
||||||
extern HANDLE _GNW95_title_mutex;
|
extern HANDLE _GNW95_title_mutex;
|
||||||
|
#endif
|
||||||
extern bool gWindowSystemInitialized;
|
extern bool gWindowSystemInitialized;
|
||||||
extern int _GNW_wcolor[6];
|
extern int _GNW_wcolor[6];
|
||||||
extern unsigned char* _screen_buffer;
|
extern unsigned char* _screen_buffer;
|
||||||
|
|
Loading…
Reference in New Issue