Merge branch 'main' into x64
This commit is contained in:
commit
82150d118b
75
src/sound.cc
75
src/sound.cc
|
@ -1,7 +1,6 @@
|
|||
#include "sound.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "memory.h"
|
||||
#include "platform_compat.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -20,26 +19,62 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#define SOUND_FLAG_SOUND_IS_PLAYING (0x02)
|
||||
#define SOUND_FLAG_SOUND_IS_PAUSED (0x08)
|
||||
|
||||
typedef char*(SoundFileNameMangler)(char*);
|
||||
|
||||
typedef struct STRUCT_51D478 {
|
||||
Sound* field_0;
|
||||
int field_4;
|
||||
int field_8;
|
||||
int field_C;
|
||||
int field_10;
|
||||
int field_14;
|
||||
struct STRUCT_51D478* prev;
|
||||
struct STRUCT_51D478* next;
|
||||
} STRUCT_51D478;
|
||||
|
||||
static void* soundMallocProcDefaultImpl(size_t size);
|
||||
static void* soundReallocProcDefaultImpl(void* ptr, size_t size);
|
||||
static void soundFreeProcDefaultImpl(void* ptr);
|
||||
static char* soundFileManglerDefaultImpl(char* fname);
|
||||
static void _refreshSoundBuffers(Sound* sound);
|
||||
static int _preloadBuffers(Sound* sound);
|
||||
static int _soundRewind(Sound* sound);
|
||||
static int _addSoundData(Sound* sound, unsigned char* buf, int size);
|
||||
static int _soundSetData(Sound* sound, unsigned char* buf, int size);
|
||||
static int soundContinue(Sound* sound);
|
||||
static int _soundGetVolume(Sound* sound);
|
||||
static void soundDeleteInternal(Sound* sound);
|
||||
#ifdef HAVE_DSOUND
|
||||
static void CALLBACK _doTimerEvent(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
|
||||
static void _removeTimedEvent(unsigned int* timerId);
|
||||
#endif
|
||||
static void _removeFadeSound(STRUCT_51D478* a1);
|
||||
static void _fadeSounds();
|
||||
static int _internalSoundFade(Sound* sound, int a2, int a3, int a4);
|
||||
|
||||
// 0x51D478
|
||||
STRUCT_51D478* _fadeHead = NULL;
|
||||
static STRUCT_51D478* _fadeHead = NULL;
|
||||
|
||||
// 0x51D47C
|
||||
STRUCT_51D478* _fadeFreeList = NULL;
|
||||
static STRUCT_51D478* _fadeFreeList = NULL;
|
||||
|
||||
// 0x51D480
|
||||
unsigned int _fadeEventHandle = UINT_MAX;
|
||||
static unsigned int _fadeEventHandle = UINT_MAX;
|
||||
|
||||
// 0x51D488
|
||||
MallocProc* gSoundMallocProc = soundMallocProcDefaultImpl;
|
||||
static MallocProc* gSoundMallocProc = soundMallocProcDefaultImpl;
|
||||
|
||||
// 0x51D48C
|
||||
ReallocProc* gSoundReallocProc = soundReallocProcDefaultImpl;
|
||||
static ReallocProc* gSoundReallocProc = soundReallocProcDefaultImpl;
|
||||
|
||||
// 0x51D490
|
||||
FreeProc* gSoundFreeProc = soundFreeProcDefaultImpl;
|
||||
static FreeProc* gSoundFreeProc = soundFreeProcDefaultImpl;
|
||||
|
||||
// 0x51D494
|
||||
SoundFileIO gSoundDefaultFileIO = {
|
||||
static SoundFileIO gSoundDefaultFileIO = {
|
||||
open,
|
||||
close,
|
||||
compat_read,
|
||||
|
@ -51,10 +86,10 @@ SoundFileIO gSoundDefaultFileIO = {
|
|||
};
|
||||
|
||||
// 0x51D4B4
|
||||
SoundFileNameMangler* gSoundFileNameMangler = soundFileManglerDefaultImpl;
|
||||
static SoundFileNameMangler* gSoundFileNameMangler = soundFileManglerDefaultImpl;
|
||||
|
||||
// 0x51D4B8
|
||||
const char* gSoundErrorDescriptions[SOUND_ERR_COUNT] = {
|
||||
static const char* gSoundErrorDescriptions[SOUND_ERR_COUNT] = {
|
||||
"sound.c: No error",
|
||||
"sound.c: SOS driver not loaded",
|
||||
"sound.c: SOS invalid pointer",
|
||||
|
@ -92,38 +127,38 @@ const char* gSoundErrorDescriptions[SOUND_ERR_COUNT] = {
|
|||
};
|
||||
|
||||
// 0x668150
|
||||
int gSoundLastError;
|
||||
static int gSoundLastError;
|
||||
|
||||
// 0x668154
|
||||
int _masterVol;
|
||||
static int _masterVol;
|
||||
|
||||
#ifdef HAVE_DSOUND
|
||||
// 0x668158
|
||||
LPDIRECTSOUNDBUFFER gDirectSoundPrimaryBuffer;
|
||||
static LPDIRECTSOUNDBUFFER gDirectSoundPrimaryBuffer;
|
||||
#endif
|
||||
|
||||
// 0x66815C
|
||||
int _sampleRate;
|
||||
static int _sampleRate;
|
||||
|
||||
// Number of sounds currently playing.
|
||||
//
|
||||
// 0x668160
|
||||
int _numSounds;
|
||||
static int _numSounds;
|
||||
|
||||
// 0x668164
|
||||
int _deviceInit;
|
||||
static int _deviceInit;
|
||||
|
||||
// 0x668168
|
||||
int _dataSize;
|
||||
static int _dataSize;
|
||||
|
||||
// 0x66816C
|
||||
int _numBuffers;
|
||||
static int _numBuffers;
|
||||
|
||||
// 0x668170
|
||||
bool gSoundInitialized;
|
||||
static bool gSoundInitialized;
|
||||
|
||||
// 0x668174
|
||||
Sound* gSoundListHead;
|
||||
static Sound* gSoundListHead;
|
||||
|
||||
#ifdef HAVE_DSOUND
|
||||
// 0x668178
|
||||
|
|
58
src/sound.h
58
src/sound.h
|
@ -4,9 +4,6 @@
|
|||
#include "memory_defs.h"
|
||||
#include "win32.h"
|
||||
|
||||
#define SOUND_FLAG_SOUND_IS_PLAYING (0x02)
|
||||
#define SOUND_FLAG_SOUND_IS_PAUSED (0x08)
|
||||
|
||||
#define VOLUME_MIN (0)
|
||||
#define VOLUME_MAX (0x7FFF)
|
||||
|
||||
|
@ -49,7 +46,6 @@ typedef enum SoundError {
|
|||
SOUND_ERR_COUNT,
|
||||
} SoundError;
|
||||
|
||||
typedef char*(SoundFileNameMangler)(char*);
|
||||
typedef int SoundOpenProc(const char* filePath, int flags, ...);
|
||||
typedef int SoundCloseProc(int fileHandle);
|
||||
typedef int SoundReadProc(int fileHandle, void* buf, unsigned int size);
|
||||
|
@ -110,64 +106,19 @@ typedef struct Sound {
|
|||
struct Sound* prev;
|
||||
} Sound;
|
||||
|
||||
typedef struct STRUCT_51D478 {
|
||||
Sound* field_0;
|
||||
int field_4;
|
||||
int field_8;
|
||||
int field_C;
|
||||
int field_10;
|
||||
int field_14;
|
||||
struct STRUCT_51D478* prev;
|
||||
struct STRUCT_51D478* next;
|
||||
} STRUCT_51D478;
|
||||
|
||||
extern STRUCT_51D478* _fadeHead;
|
||||
extern STRUCT_51D478* _fadeFreeList;
|
||||
|
||||
extern unsigned int _fadeEventHandle;
|
||||
extern MallocProc* gSoundMallocProc;
|
||||
extern ReallocProc* gSoundReallocProc;
|
||||
extern FreeProc* gSoundFreeProc;
|
||||
extern SoundFileIO gSoundDefaultFileIO;
|
||||
extern SoundFileNameMangler* gSoundFileNameMangler;
|
||||
extern const char* gSoundErrorDescriptions[SOUND_ERR_COUNT];
|
||||
|
||||
extern int gSoundLastError;
|
||||
extern int _masterVol;
|
||||
#ifdef HAVE_DSOUND
|
||||
extern LPDIRECTSOUNDBUFFER gDirectSoundPrimaryBuffer;
|
||||
#endif
|
||||
extern int _sampleRate;
|
||||
extern int _numSounds;
|
||||
extern int _deviceInit;
|
||||
extern int _dataSize;
|
||||
extern int _numBuffers;
|
||||
extern bool gSoundInitialized;
|
||||
extern Sound* gSoundListHead;
|
||||
#ifdef HAVE_DSOUND
|
||||
extern LPDIRECTSOUND gDirectSound;
|
||||
#endif
|
||||
|
||||
void* soundMallocProcDefaultImpl(size_t size);
|
||||
void* soundReallocProcDefaultImpl(void* ptr, size_t size);
|
||||
void soundFreeProcDefaultImpl(void* ptr);
|
||||
void soundSetMemoryProcs(MallocProc* mallocProc, ReallocProc* reallocProc, FreeProc* freeProc);
|
||||
|
||||
char* soundFileManglerDefaultImpl(char* fname);
|
||||
const char* soundGetErrorDescription(int err);
|
||||
void _refreshSoundBuffers(Sound* sound);
|
||||
int soundInit(int a1, int a2, int a3, int a4, int rate);
|
||||
void soundExit();
|
||||
Sound* soundAllocate(int a1, int a2);
|
||||
int _preloadBuffers(Sound* sound);
|
||||
int soundLoad(Sound* sound, char* filePath);
|
||||
int _soundRewind(Sound* sound);
|
||||
int _addSoundData(Sound* sound, unsigned char* buf, int size);
|
||||
int _soundSetData(Sound* sound, unsigned char* buf, int size);
|
||||
int soundPlay(Sound* sound);
|
||||
int soundStop(Sound* sound);
|
||||
int soundDelete(Sound* sound);
|
||||
int soundContinue(Sound* sound);
|
||||
bool soundIsPlaying(Sound* sound);
|
||||
bool _soundDone(Sound* sound);
|
||||
bool soundIsPaused(Sound* sound);
|
||||
|
@ -176,24 +127,15 @@ int soundGetDuration(Sound* sound);
|
|||
int soundSetLooping(Sound* sound, int a2);
|
||||
int _soundVolumeHMItoDirectSound(int a1);
|
||||
int soundSetVolume(Sound* sound, int volume);
|
||||
int _soundGetVolume(Sound* sound);
|
||||
int soundSetCallback(Sound* sound, SoundCallback* callback, void* userData);
|
||||
int soundSetChannels(Sound* sound, int channels);
|
||||
int soundSetReadLimit(Sound* sound, int readLimit);
|
||||
int soundPause(Sound* sound);
|
||||
int soundResume(Sound* sound);
|
||||
int soundSetFileIO(Sound* sound, SoundOpenProc* openProc, SoundCloseProc* closeProc, SoundReadProc* readProc, SoundWriteProc* writeProc, SoundSeekProc* seekProc, SoundTellProc* tellProc, SoundFileLengthProc* fileLengthProc);
|
||||
void soundDeleteInternal(Sound* sound);
|
||||
int _soundSetMasterVolume(int value);
|
||||
#ifdef HAVE_DSOUND
|
||||
void CALLBACK _doTimerEvent(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
|
||||
void _removeTimedEvent(unsigned int* timerId);
|
||||
#endif
|
||||
int _soundGetPosition(Sound* sound);
|
||||
int _soundSetPosition(Sound* sound, int a2);
|
||||
void _removeFadeSound(STRUCT_51D478* a1);
|
||||
void _fadeSounds();
|
||||
int _internalSoundFade(Sound* sound, int a2, int a3, int a4);
|
||||
int _soundFade(Sound* sound, int a2, int a3);
|
||||
void soundDeleteAll();
|
||||
void soundContinueAll();
|
||||
|
|
|
@ -4,14 +4,18 @@
|
|||
#include "text_font.h"
|
||||
#include "window.h"
|
||||
|
||||
static void _showRegion(int a1);
|
||||
static int widgetGetTextFlags();
|
||||
static unsigned char widgetGetHighlightColor();
|
||||
|
||||
// 0x50EB1C
|
||||
const float flt_50EB1C = 31.0;
|
||||
static const float flt_50EB1C = 31.0f;
|
||||
|
||||
// 0x50EB20
|
||||
const float flt_50EB20 = 31.0;
|
||||
static const float flt_50EB20 = 31.0f;
|
||||
|
||||
// 0x66E6A0
|
||||
int _updateRegions[32];
|
||||
static int _updateRegions[32];
|
||||
|
||||
// 0x4B5A64
|
||||
void _showRegion(int a1)
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
#ifndef WIDGET_H
|
||||
#define WIDGET_H
|
||||
|
||||
extern const float flt_50EB1C;
|
||||
extern const float flt_50EB20;
|
||||
|
||||
extern int _updateRegions[32];
|
||||
|
||||
void _showRegion(int a1);
|
||||
int _update_widgets();
|
||||
int widgetGetFont();
|
||||
int widgetSetFont(int a1);
|
||||
int widgetGetTextFlags();
|
||||
int widgetSetTextFlags(int a1);
|
||||
unsigned char widgetGetTextColor();
|
||||
unsigned char widgetGetHighlightColor();
|
||||
int widgetSetTextColor(float a1, float a2, float a3);
|
||||
int widgetSetHighlightColor(float a1, float a2, float a3);
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "memory_manager.h"
|
||||
#include "mouse_manager.h"
|
||||
#include "movie.h"
|
||||
#include "platform_compat.h"
|
||||
#include "text_font.h"
|
||||
#include "widget.h"
|
||||
#include "window_manager.h"
|
||||
|
@ -15,20 +14,86 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MANAGED_WINDOW_COUNT (16)
|
||||
|
||||
typedef struct ManagedButton {
|
||||
int btn;
|
||||
int field_4;
|
||||
int field_8;
|
||||
int field_C;
|
||||
int field_10;
|
||||
int flags;
|
||||
int field_18;
|
||||
char name[32];
|
||||
Program* program;
|
||||
void* field_40;
|
||||
void* field_44;
|
||||
void* field_48;
|
||||
void* field_4C;
|
||||
void* field_50;
|
||||
int field_54;
|
||||
int field_58;
|
||||
int field_5C;
|
||||
int field_60;
|
||||
int field_64;
|
||||
int field_68;
|
||||
int field_6C;
|
||||
int field_70;
|
||||
int field_74;
|
||||
int field_78;
|
||||
} ManagedButton;
|
||||
|
||||
typedef struct ManagedWindow {
|
||||
char name[32];
|
||||
int window;
|
||||
int field_24;
|
||||
int field_28;
|
||||
Region** regions;
|
||||
int currentRegionIndex;
|
||||
int regionsLength;
|
||||
int field_38;
|
||||
ManagedButton* buttons;
|
||||
int buttonsLength;
|
||||
int field_44;
|
||||
int field_48;
|
||||
int field_4C;
|
||||
int field_50;
|
||||
float field_54;
|
||||
float field_58;
|
||||
} ManagedWindow;
|
||||
|
||||
typedef int (*INITVIDEOFN)();
|
||||
|
||||
static int _selectWindow(const char* windowName);
|
||||
static unsigned char* _windowGetBuffer();
|
||||
static int _pushWindow(const char* windowName);
|
||||
static int _popWindow();
|
||||
static void _windowWrapLineWithSpacing(int win, char* string, int width, int height, int x, int y, int flags, int textAlignment, int a9);
|
||||
static int _windowGetXres();
|
||||
static void _removeProgramReferences_3(Program* program);
|
||||
static bool _windowAddButtonRightProc(const char* buttonName, Program* program, int a3, int a4);
|
||||
static void _windowEndRegion();
|
||||
static bool _windowStartRegion(int initialCapacity);
|
||||
static bool _windowAddRegionPoint(int x, int y, bool a3);
|
||||
static bool _windowAddRegionName(const char* regionName);
|
||||
static int _windowMoviePlaying();
|
||||
static bool _windowPlayMovie(char* filePath);
|
||||
static bool _windowPlayMovieRect(char* filePath, int a2, int a3, int a4, int a5);
|
||||
|
||||
// 0x51DCAC
|
||||
int _holdTime = 250;
|
||||
static int _holdTime = 250;
|
||||
|
||||
// 0x51DCB0
|
||||
int _checkRegionEnable = 1;
|
||||
static int _checkRegionEnable = 1;
|
||||
|
||||
// 0x51DCB4
|
||||
int _winTOS = -1;
|
||||
static int _winTOS = -1;
|
||||
|
||||
// 051DCB8
|
||||
int gCurrentManagedWindowIndex = -1;
|
||||
static int gCurrentManagedWindowIndex = -1;
|
||||
|
||||
// 0x51DCBC
|
||||
INITVIDEOFN _gfx_init[12] = {
|
||||
static INITVIDEOFN _gfx_init[12] = {
|
||||
_init_mode_320_200,
|
||||
_init_mode_640_480,
|
||||
_init_mode_640_480_16,
|
||||
|
@ -44,7 +109,7 @@ INITVIDEOFN _gfx_init[12] = {
|
|||
};
|
||||
|
||||
// 0x51DD1C
|
||||
Size _sizes_x[12] = {
|
||||
static Size _sizes_x[12] = {
|
||||
{ 320, 200 },
|
||||
{ 640, 480 },
|
||||
{ 640, 240 },
|
||||
|
@ -60,33 +125,33 @@ Size _sizes_x[12] = {
|
|||
};
|
||||
|
||||
// 0x51DD7C
|
||||
int _numInputFunc = 0;
|
||||
static int _numInputFunc = 0;
|
||||
|
||||
// 0x51DD80
|
||||
int _lastWin = -1;
|
||||
static int _lastWin = -1;
|
||||
|
||||
// 0x51DD84
|
||||
int _said_quit = 1;
|
||||
static int _said_quit = 1;
|
||||
|
||||
// 0x66E770
|
||||
int _winStack[MANAGED_WINDOW_COUNT];
|
||||
static int _winStack[MANAGED_WINDOW_COUNT];
|
||||
|
||||
// 0x66E7B0
|
||||
char _alphaBlendTable[64 * 256];
|
||||
static char _alphaBlendTable[64 * 256];
|
||||
|
||||
// 0x6727B0
|
||||
ManagedWindow gManagedWindows[MANAGED_WINDOW_COUNT];
|
||||
static ManagedWindow gManagedWindows[MANAGED_WINDOW_COUNT];
|
||||
|
||||
// NOTE: This value is never set.
|
||||
//
|
||||
// 0x672D78
|
||||
void (*_selectWindowFunc)(int, ManagedWindow*);
|
||||
static void (*_selectWindowFunc)(int, ManagedWindow*);
|
||||
|
||||
// 0x672D7C
|
||||
int _xres;
|
||||
static int _xres;
|
||||
|
||||
// 0x672D88
|
||||
int _yres;
|
||||
static int _yres;
|
||||
|
||||
// Highlight color (maybe r).
|
||||
//
|
||||
|
|
81
src/window.h
81
src/window.h
|
@ -1,12 +1,8 @@
|
|||
#ifndef WINDOW_H
|
||||
#define WINDOW_H
|
||||
|
||||
#include "geometry.h"
|
||||
#include "interpreter.h"
|
||||
#include "region.h"
|
||||
|
||||
#define MANAGED_WINDOW_COUNT (16)
|
||||
|
||||
typedef void (*WINDOWDRAWINGPROC)(unsigned char* src, int src_pitch, int a3, int src_x, int src_y, int src_width, int src_height, int dest_x, int dest_y);
|
||||
typedef void WindowDrawingProc2(unsigned char* buf, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, unsigned char a10);
|
||||
|
||||
|
@ -16,68 +12,6 @@ typedef enum TextAlignment {
|
|||
TEXT_ALIGNMENT_CENTER,
|
||||
} TextAlignment;
|
||||
|
||||
typedef struct ManagedButton {
|
||||
int btn;
|
||||
int field_4;
|
||||
int field_8;
|
||||
int field_C;
|
||||
int field_10;
|
||||
int flags;
|
||||
int field_18;
|
||||
char name[32];
|
||||
Program* program;
|
||||
void* field_40;
|
||||
void* field_44;
|
||||
void* field_48;
|
||||
void* field_4C;
|
||||
void* field_50;
|
||||
int field_54;
|
||||
int field_58;
|
||||
int field_5C;
|
||||
int field_60;
|
||||
int field_64;
|
||||
int field_68;
|
||||
int field_6C;
|
||||
int field_70;
|
||||
int field_74;
|
||||
int field_78;
|
||||
} ManagedButton;
|
||||
|
||||
typedef struct ManagedWindow {
|
||||
char name[32];
|
||||
int window;
|
||||
int field_24;
|
||||
int field_28;
|
||||
Region** regions;
|
||||
int currentRegionIndex;
|
||||
int regionsLength;
|
||||
int field_38;
|
||||
ManagedButton* buttons;
|
||||
int buttonsLength;
|
||||
int field_44;
|
||||
int field_48;
|
||||
int field_4C;
|
||||
int field_50;
|
||||
float field_54;
|
||||
float field_58;
|
||||
} ManagedWindow;
|
||||
|
||||
typedef int (*INITVIDEOFN)();
|
||||
|
||||
extern int _holdTime;
|
||||
extern int _checkRegionEnable;
|
||||
extern int _winTOS;
|
||||
extern int gCurrentManagedWindowIndex;
|
||||
extern INITVIDEOFN _gfx_init[12];
|
||||
extern Size _sizes_x[12];
|
||||
|
||||
extern int _winStack[MANAGED_WINDOW_COUNT];
|
||||
extern char _alphaBlendTable[64 * 256];
|
||||
extern ManagedWindow gManagedWindows[MANAGED_WINDOW_COUNT];
|
||||
|
||||
extern void(*_selectWindowFunc)(int, ManagedWindow*);
|
||||
extern int _xres;
|
||||
extern int _yres;
|
||||
extern int _currentHighlightColorR;
|
||||
extern int gWidgetFont;
|
||||
extern int _currentTextColorG;
|
||||
|
@ -89,40 +23,25 @@ extern int _currentHighlightColorB;
|
|||
|
||||
bool _windowDraw();
|
||||
bool _selectWindowID(int index);
|
||||
int _selectWindow(const char* windowName);
|
||||
unsigned char* _windowGetBuffer();
|
||||
int _pushWindow(const char* windowName);
|
||||
int _popWindow();
|
||||
void _windowPrintBuf(int win, char* string, int stringLength, int width, int maxY, int x, int y, int flags, int textAlignment);
|
||||
char** _windowWordWrap(char* string, int maxLength, int a3, int* substringListLengthPtr);
|
||||
void _windowFreeWordList(char** substringList, int substringListLength);
|
||||
void _windowWrapLineWithSpacing(int win, char* string, int width, int height, int x, int y, int flags, int textAlignment, int a9);
|
||||
void _windowWrapLine(int win, char* string, int width, int height, int x, int y, int flags, int textAlignment);
|
||||
bool _windowPrintRect(char* string, int a2, int textAlignment);
|
||||
bool _windowFormatMessage(char* string, int x, int y, int width, int height, int textAlignment);
|
||||
int _windowGetXres();
|
||||
int _windowGetYres();
|
||||
void _removeProgramReferences_3(Program* program);
|
||||
void _initWindow(int resolution, int a2);
|
||||
void _windowClose();
|
||||
bool _windowDeleteButton(const char* buttonName);
|
||||
bool _windowSetButtonFlag(const char* buttonName, int value);
|
||||
bool _windowAddButtonProc(const char* buttonName, Program* program, int a3, int a4, int a5, int a6);
|
||||
bool _windowAddButtonRightProc(const char* buttonName, Program* program, int a3, int a4);
|
||||
void _windowEndRegion();
|
||||
bool _windowCheckRegionExists(const char* regionName);
|
||||
bool _windowStartRegion(int initialCapacity);
|
||||
bool _windowAddRegionPoint(int x, int y, bool a3);
|
||||
bool _windowAddRegionProc(const char* regionName, Program* program, int a3, int a4, int a5, int a6);
|
||||
bool _windowAddRegionRightProc(const char* regionName, Program* program, int a3, int a4);
|
||||
bool _windowSetRegionFlag(const char* regionName, int value);
|
||||
bool _windowAddRegionName(const char* regionName);
|
||||
bool _windowDeleteRegion(const char* regionName);
|
||||
void _updateWindows();
|
||||
int _windowMoviePlaying();
|
||||
bool _windowSetMovieFlags(int flags);
|
||||
bool _windowPlayMovie(char* filePath);
|
||||
bool _windowPlayMovieRect(char* filePath, int a2, int a3, int a4, int a5);
|
||||
void _windowStopMovie();
|
||||
|
||||
#endif /* WINDOW_H */
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "color.h"
|
||||
#include "core.h"
|
||||
#include "db.h"
|
||||
#include "debug.h"
|
||||
#include "draw.h"
|
||||
#include "memory.h"
|
||||
|
@ -17,22 +16,50 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#define MAX_WINDOW_COUNT (50)
|
||||
|
||||
// The maximum number of radio groups.
|
||||
#define RADIO_GROUP_LIST_CAPACITY (64)
|
||||
|
||||
static void windowFree(int win);
|
||||
static void _win_buffering(bool a1);
|
||||
static void _win_move(int win_index, int x, int y);
|
||||
static void _GNW_win_refresh(Window* window, Rect* rect, unsigned char* a3);
|
||||
static void _win_clip(Window* window, RectListNode** rect, unsigned char* a3);
|
||||
static void _win_drag(int win);
|
||||
static void _refresh_all(Rect* rect, unsigned char* a2);
|
||||
static Button* buttonGetButton(int btn, Window** out_win);
|
||||
static void _win_text(int win, char** fileNameList, int fileNameListLength, int maxWidth, int x, int y, int flags);
|
||||
static int paletteOpenFileImpl(const char* path, int flags);
|
||||
static int paletteReadFileImpl(int fd, void* buf, size_t count);
|
||||
static int paletteCloseFileImpl(int fd);
|
||||
static int _win_register_button_image(int btn, unsigned char* up, unsigned char* down, unsigned char* hover, int a5);
|
||||
static Button* buttonCreateInternal(int win, int x, int y, int width, int height, int mouseEnterEventCode, int mouseExitEventCode, int mouseDownEventCode, int mouseUpEventCode, int flags, unsigned char* up, unsigned char* dn, unsigned char* hover);
|
||||
static int _GNW_check_buttons(Window* window, int* out_a2);
|
||||
static bool _button_under_mouse(Button* button, Rect* rect);
|
||||
static int _win_last_button_winID();
|
||||
static void buttonFree(Button* ptr);
|
||||
static int _win_group_check_buttons(int a1, int* a2, int a3, void (*a4)(int));
|
||||
static int _button_check_group(Button* button);
|
||||
static void _button_draw(Button* button, Window* window, unsigned char* data, int a4, Rect* a5, int a6);
|
||||
static void _GNW_button_refresh(Window* window, Rect* rect);
|
||||
|
||||
// 0x50FA30
|
||||
char _path_patches[] = "";
|
||||
static char _path_patches[] = "";
|
||||
|
||||
// 0x51E3D8
|
||||
bool _GNW95_already_running = false;
|
||||
static bool _GNW95_already_running = false;
|
||||
|
||||
#ifdef _WIN32
|
||||
// 0x51E3DC
|
||||
HANDLE _GNW95_title_mutex = INVALID_HANDLE_VALUE;
|
||||
static HANDLE _GNW95_title_mutex = INVALID_HANDLE_VALUE;
|
||||
#endif
|
||||
|
||||
// 0x51E3E0
|
||||
bool gWindowSystemInitialized = false;
|
||||
|
||||
// 0x51E3E4
|
||||
int _GNW_wcolor[6] = {
|
||||
static int _GNW_wcolor[6] = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
@ -42,46 +69,46 @@ int _GNW_wcolor[6] = {
|
|||
};
|
||||
|
||||
// 0x51E3FC
|
||||
unsigned char* _screen_buffer = NULL;
|
||||
static unsigned char* _screen_buffer = NULL;
|
||||
|
||||
// 0x51E400
|
||||
bool _insideWinExit = false;
|
||||
static bool _insideWinExit = false;
|
||||
|
||||
// 0x51E404
|
||||
int _last_button_winID = -1;
|
||||
static int _last_button_winID = -1;
|
||||
|
||||
// 0x6ADD90
|
||||
int gOrderedWindowIds[MAX_WINDOW_COUNT];
|
||||
static int gOrderedWindowIds[MAX_WINDOW_COUNT];
|
||||
|
||||
// 0x6ADE58
|
||||
Window* gWindows[MAX_WINDOW_COUNT];
|
||||
static Window* gWindows[MAX_WINDOW_COUNT];
|
||||
|
||||
// 0x6ADF20
|
||||
VideoSystemExitProc* gVideoSystemExitProc;
|
||||
static VideoSystemExitProc* gVideoSystemExitProc;
|
||||
|
||||
// 0x6ADF24
|
||||
int gWindowsLength;
|
||||
static int gWindowsLength;
|
||||
|
||||
// 0x6ADF28
|
||||
int _window_flags;
|
||||
static int _window_flags;
|
||||
|
||||
// 0x6ADF2C
|
||||
bool _buffering;
|
||||
static bool _buffering;
|
||||
|
||||
// 0x6ADF30
|
||||
int _bk_color;
|
||||
static int _bk_color;
|
||||
|
||||
// 0x6ADF34
|
||||
VideoSystemInitProc* gVideoSystemInitProc;
|
||||
static VideoSystemInitProc* gVideoSystemInitProc;
|
||||
|
||||
// 0x6ADF38
|
||||
int _doing_refresh_all;
|
||||
static int _doing_refresh_all;
|
||||
|
||||
// 0x6ADF3C
|
||||
void* _GNW_texture;
|
||||
static void* _GNW_texture;
|
||||
|
||||
// 0x6ADF40
|
||||
RadioGroup gRadioGroups[RADIO_GROUP_LIST_CAPACITY];
|
||||
static RadioGroup gRadioGroups[RADIO_GROUP_LIST_CAPACITY];
|
||||
|
||||
// 0x4D5C30
|
||||
int windowManagerInit(VideoSystemInitProc* videoSystemInitProc, VideoSystemExitProc* videoSystemExitProc, int a3)
|
||||
|
|
|
@ -11,11 +11,6 @@
|
|||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#define MAX_WINDOW_COUNT (50)
|
||||
|
||||
// The maximum number of radio groups.
|
||||
#define RADIO_GROUP_LIST_CAPACITY (64)
|
||||
|
||||
// The maximum number of buttons in one radio group.
|
||||
#define RADIO_GROUP_BUTTON_LIST_CAPACITY (64)
|
||||
|
||||
|
@ -155,36 +150,12 @@ typedef struct RadioGroup {
|
|||
typedef int(VideoSystemInitProc)();
|
||||
typedef void(VideoSystemExitProc)();
|
||||
|
||||
extern char _path_patches[];
|
||||
|
||||
extern bool _GNW95_already_running;
|
||||
#ifdef _WIN32
|
||||
extern HANDLE _GNW95_title_mutex;
|
||||
#endif
|
||||
extern bool gWindowSystemInitialized;
|
||||
extern int _GNW_wcolor[6];
|
||||
extern unsigned char* _screen_buffer;
|
||||
extern bool _insideWinExit;
|
||||
extern int _last_button_winID;
|
||||
|
||||
extern int gOrderedWindowIds[MAX_WINDOW_COUNT];
|
||||
extern Window* gWindows[MAX_WINDOW_COUNT];
|
||||
extern VideoSystemExitProc* gVideoSystemExitProc;
|
||||
extern int gWindowsLength;
|
||||
extern int _window_flags;
|
||||
extern bool _buffering;
|
||||
extern int _bk_color;
|
||||
extern VideoSystemInitProc* gVideoSystemInitProc;
|
||||
extern int _doing_refresh_all;
|
||||
extern void* _GNW_texture;
|
||||
extern RadioGroup gRadioGroups[RADIO_GROUP_LIST_CAPACITY];
|
||||
|
||||
int windowManagerInit(VideoSystemInitProc* videoSystemInitProc, VideoSystemExitProc* videoSystemExitProc, int a3);
|
||||
void windowManagerExit(void);
|
||||
int windowCreate(int x, int y, int width, int height, int a4, int flags);
|
||||
void windowDestroy(int win);
|
||||
void windowFree(int win);
|
||||
void _win_buffering(bool a1);
|
||||
void windowDrawBorder(int win);
|
||||
void windowDrawText(int win, char* str, int a3, int x, int y, int a6);
|
||||
void windowDrawLine(int win, int left, int top, int right, int bottom, int color);
|
||||
|
@ -192,15 +163,10 @@ void windowDrawRect(int win, int left, int top, int right, int bottom, int color
|
|||
void windowFill(int win, int x, int y, int width, int height, int a6);
|
||||
void windowUnhide(int win);
|
||||
void windowHide(int win);
|
||||
void _win_move(int win_index, int x, int y);
|
||||
void windowRefresh(int win);
|
||||
void windowRefreshRect(int win, const Rect* rect);
|
||||
void _GNW_win_refresh(Window* window, Rect* rect, unsigned char* a3);
|
||||
void windowRefreshAll(Rect* rect);
|
||||
void _win_clip(Window* window, RectListNode** rect, unsigned char* a3);
|
||||
void _win_drag(int win);
|
||||
void _win_get_mouse_buf(unsigned char* a1);
|
||||
void _refresh_all(Rect* rect, unsigned char* a2);
|
||||
Window* windowGetWindow(int win);
|
||||
unsigned char* windowGetBuffer(int win);
|
||||
int windowGetAtPoint(int x, int y);
|
||||
|
@ -208,37 +174,22 @@ int windowGetWidth(int win);
|
|||
int windowGetHeight(int win);
|
||||
int windowGetRect(int win, Rect* rect);
|
||||
int _win_check_all_buttons();
|
||||
Button* buttonGetButton(int btn, Window** out_win);
|
||||
int _GNW_check_menu_bars(int a1);
|
||||
void _win_text(int win, char** fileNameList, int fileNameListLength, int maxWidth, int x, int y, int flags);
|
||||
void programWindowSetTitle(const char* title);
|
||||
int paletteOpenFileImpl(const char* path, int flags);
|
||||
int paletteReadFileImpl(int fd, void* buf, size_t count);
|
||||
int paletteCloseFileImpl(int fd);
|
||||
bool showMesageBox(const char* str);
|
||||
int buttonCreate(int win, int x, int y, int width, int height, int mouseEnterEventCode, int mouseExitEventCode, int mouseDownEventCode, int mouseUpEventCode, unsigned char* up, unsigned char* dn, unsigned char* hover, int flags);
|
||||
int _win_register_button_disable(int btn, unsigned char* up, unsigned char* down, unsigned char* hover);
|
||||
int _win_register_button_image(int btn, unsigned char* up, unsigned char* down, unsigned char* hover, int a5);
|
||||
int buttonSetMouseCallbacks(int btn, ButtonCallback* mouseEnterProc, ButtonCallback* mouseExitProc, ButtonCallback* mouseDownProc, ButtonCallback* mouseUpProc);
|
||||
int buttonSetRightMouseCallbacks(int btn, int rightMouseDownEventCode, int rightMouseUpEventCode, ButtonCallback* rightMouseDownProc, ButtonCallback* rightMouseUpProc);
|
||||
int buttonSetCallbacks(int btn, ButtonCallback* onPressed, ButtonCallback* onUnpressed);
|
||||
int buttonSetMask(int btn, unsigned char* mask);
|
||||
Button* buttonCreateInternal(int win, int x, int y, int width, int height, int mouseEnterEventCode, int mouseExitEventCode, int mouseDownEventCode, int mouseUpEventCode, int flags, unsigned char* up, unsigned char* dn, unsigned char* hover);
|
||||
bool _win_button_down(int btn);
|
||||
int _GNW_check_buttons(Window* window, int* out_a2);
|
||||
bool _button_under_mouse(Button* button, Rect* rect);
|
||||
int buttonGetWindowId(int btn);
|
||||
int _win_last_button_winID();
|
||||
int buttonDestroy(int btn);
|
||||
void buttonFree(Button* ptr);
|
||||
int buttonEnable(int btn);
|
||||
int buttonDisable(int btn);
|
||||
int _win_set_button_rest_state(int btn, bool a2, int a3);
|
||||
int _win_group_check_buttons(int a1, int* a2, int a3, void (*a4)(int));
|
||||
int _win_group_radio_buttons(int a1, int* a2);
|
||||
int _button_check_group(Button* button);
|
||||
void _button_draw(Button* button, Window* window, unsigned char* data, int a4, Rect* a5, int a6);
|
||||
void _GNW_button_refresh(Window* window, Rect* rect);
|
||||
int _win_button_press_and_release(int btn);
|
||||
|
||||
#endif /* WINDOW_MANAGER_H */
|
||||
|
|
|
@ -10,51 +10,74 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
typedef struct STRUCT_6B2340 {
|
||||
int field_0;
|
||||
int field_4;
|
||||
} STRUCT_6B2340;
|
||||
|
||||
typedef struct STRUCT_6B2370 {
|
||||
int field_0;
|
||||
// win
|
||||
int field_4;
|
||||
int field_8;
|
||||
} STRUCT_6B2370;
|
||||
|
||||
static void _win_debug_delete();
|
||||
static int _win_register_menu_bar(int win, int x, int y, int width, int height, int a6, int a7);
|
||||
static int _win_register_menu_pulldown(int win, int x, char* str, int a4);
|
||||
static int _win_width_needed(char** fileNameList, int fileNameListLength);
|
||||
static int _calc_max_field_chars_wcursor(int a1, int a2);
|
||||
static void _tm_watch_msgs();
|
||||
static void _tm_kill_msg();
|
||||
static void _tm_kill_out_of_order(int a1);
|
||||
static void _tm_click_response(int btn);
|
||||
static int _tm_index_active(int a1);
|
||||
|
||||
// 0x51E414
|
||||
int _wd = -1;
|
||||
static int _wd = -1;
|
||||
|
||||
// 0x51E418
|
||||
int _curr_menu = 0;
|
||||
static int _curr_menu = 0;
|
||||
|
||||
// 0x51E41C
|
||||
bool _tm_watch_active = false;
|
||||
static bool _tm_watch_active = false;
|
||||
|
||||
// 0x6B2340
|
||||
STRUCT_6B2340 _tm_location[5];
|
||||
static STRUCT_6B2340 _tm_location[5];
|
||||
|
||||
// 0x6B2368
|
||||
int _tm_text_x;
|
||||
static int _tm_text_x;
|
||||
|
||||
// 0x6B236C
|
||||
int _tm_h;
|
||||
static int _tm_h;
|
||||
|
||||
// 0x6B2370
|
||||
STRUCT_6B2370 _tm_queue[5];
|
||||
static STRUCT_6B2370 _tm_queue[5];
|
||||
|
||||
// 0x6B23AC
|
||||
int _tm_persistence;
|
||||
static int _tm_persistence;
|
||||
|
||||
// 0x6B23B0
|
||||
int _scr_center_x;
|
||||
static int _scr_center_x;
|
||||
|
||||
// 0x6B23B4
|
||||
int _tm_text_y;
|
||||
static int _tm_text_y;
|
||||
|
||||
// 0x6B23B8
|
||||
int _tm_kill;
|
||||
static int _tm_kill;
|
||||
|
||||
// 0x6B23BC
|
||||
int _tm_add;
|
||||
static int _tm_add;
|
||||
|
||||
// x
|
||||
//
|
||||
// 0x6B23C0
|
||||
int _curry;
|
||||
static int _curry;
|
||||
|
||||
// y
|
||||
//
|
||||
// 0x6B23C4
|
||||
int _currx;
|
||||
static int _currx;
|
||||
|
||||
// 0x6B23D0
|
||||
char gProgramWindowTitle[256];
|
||||
|
|
|
@ -3,48 +3,11 @@
|
|||
|
||||
typedef struct struc_177 struc_177;
|
||||
|
||||
typedef struct STRUCT_6B2340 {
|
||||
int field_0;
|
||||
int field_4;
|
||||
} STRUCT_6B2340;
|
||||
|
||||
typedef struct STRUCT_6B2370 {
|
||||
int field_0;
|
||||
// win
|
||||
int field_4;
|
||||
int field_8;
|
||||
} STRUCT_6B2370;
|
||||
|
||||
extern int _wd;
|
||||
extern int _curr_menu;
|
||||
extern bool _tm_watch_active;
|
||||
|
||||
extern STRUCT_6B2340 _tm_location[5];
|
||||
extern int _tm_text_x;
|
||||
extern int _tm_h;
|
||||
extern STRUCT_6B2370 _tm_queue[5];
|
||||
extern int _tm_persistence;
|
||||
extern int _scr_center_x;
|
||||
extern int _tm_text_y;
|
||||
extern int _tm_kill;
|
||||
extern int _tm_add;
|
||||
extern int _curry;
|
||||
extern int _currx;
|
||||
extern char gProgramWindowTitle[256];
|
||||
|
||||
int _win_debug(char* a1);
|
||||
void _win_debug_delete();
|
||||
int _win_register_menu_bar(int win, int x, int y, int width, int height, int a6, int a7);
|
||||
int _win_register_menu_pulldown(int win, int x, char* str, int a4);
|
||||
int _win_width_needed(char** fileNameList, int fileNameListLength);
|
||||
int _GNW_process_menu(struc_177* ptr, int i);
|
||||
int _calc_max_field_chars_wcursor(int a1, int a2);
|
||||
void _GNW_intr_init();
|
||||
void _GNW_intr_exit();
|
||||
void _tm_watch_msgs();
|
||||
void _tm_kill_msg();
|
||||
void _tm_kill_out_of_order(int a1);
|
||||
void _tm_click_response(int btn);
|
||||
int _tm_index_active(int a1);
|
||||
|
||||
#endif /* WINDOW_MANAGER_PRIVATE_H */
|
||||
|
|
Loading…
Reference in New Issue