From d9043a7c49406054b0a6b3468ea282ba75810507 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Sat, 31 Aug 2019 00:22:07 +0100 Subject: [PATCH] Added Dialog.cpp The filename is a total guess, but Microsoft's own word for these menus is 'dialog', and these functions appear before the Draw.cpp functions (the source files are linked alphabetically). --- msvc2003/CSE2.vcproj | 6 + msvc2003/devilution/comparer-config.toml | 16 +++ src/Dialog.cpp | 157 +++++++++++++++++++++++ src/Dialog.h | 2 + src/Organya.cpp | 4 - src/Organya.h | 6 + 6 files changed, 187 insertions(+), 4 deletions(-) create mode 100644 src/Dialog.cpp create mode 100644 src/Dialog.h diff --git a/msvc2003/CSE2.vcproj b/msvc2003/CSE2.vcproj index 0b9ac194..8f77b4f5 100644 --- a/msvc2003/CSE2.vcproj +++ b/msvc2003/CSE2.vcproj @@ -274,6 +274,9 @@ + + @@ -507,6 +510,9 @@ + + diff --git a/msvc2003/devilution/comparer-config.toml b/msvc2003/devilution/comparer-config.toml index 3beb7e34..ec70358c 100644 --- a/msvc2003/devilution/comparer-config.toml +++ b/msvc2003/devilution/comparer-config.toml @@ -355,6 +355,22 @@ addr = 0x40AD60 name = "DefaultConfigData" addr = 0x40AE30 +[[func]] +name = "VersionDialog" +addr = 0x40AEC0 + +[[func]] +name = "DebugMuteDialog" +addr = 0x40AFC0 + +[[func]] +name = "DebugSaveDialog" +addr = 0x40B1D0 + +[[func]] +name = "QuitDialog" +addr = 0x40B290 + [[func]] name = "ActionStripper" addr = 0x40CF90 diff --git a/src/Dialog.cpp b/src/Dialog.cpp new file mode 100644 index 00000000..7cb211a9 --- /dev/null +++ b/src/Dialog.cpp @@ -0,0 +1,157 @@ +#include "Dialog.h" + +#include + +#include "WindowsWrapper.h" + +#include "Generic.h" +#include "Organya.h" +#include "Profile.h" + +// All of the original names for the functions/variables in this file are unknown + +static const char *version_string = + "version.%d.%d.%d.%d\r\n" + "2004/12/20 - %04d/%02d/%02d\r\n" + "Studio Pixel" + ; + +// TODO - Inaccurate stack frame +BOOL __stdcall VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + char string_buffer[104]; + + int year; + int month; + int day; + + int version1; + int version2; + int version3; + int version4; + + switch (Msg) + { + case WM_INITDIALOG: + GetCompileDate(&year, &month, &day); + GetCompileVersion(&version1, &version2, &version3, &version4); + sprintf(string_buffer, version_string, version1, version2, version3, version4, year, month, day); + SetDlgItemTextA(hWnd, 1011, string_buffer); + + CenterWindow(hWnd); + + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case 1: + EndDialog(hWnd, 1); + break; + } + + break; + } + + return FALSE; +} + +BOOL __stdcall DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + switch (Msg) + { + case WM_INITDIALOG: + CenterWindow(hWnd); + CheckDlgButton(hWnd, 1010, g_mute[0] != 0); + CheckDlgButton(hWnd, 1018, g_mute[1] != 0); + CheckDlgButton(hWnd, 1019, g_mute[2] != 0); + CheckDlgButton(hWnd, 1020, g_mute[3] != 0); + CheckDlgButton(hWnd, 1021, g_mute[4] != 0); + CheckDlgButton(hWnd, 1022, g_mute[5] != 0); + CheckDlgButton(hWnd, 1023, g_mute[6] != 0); + CheckDlgButton(hWnd, 1024, g_mute[7] != 0); + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case 2: + EndDialog(hWnd, 0); + break; + + case 1: + g_mute[0] = IsDlgButtonChecked(hWnd, 1010); + g_mute[1] = IsDlgButtonChecked(hWnd, 1018); + g_mute[2] = IsDlgButtonChecked(hWnd, 1019); + g_mute[3] = IsDlgButtonChecked(hWnd, 1020); + g_mute[4] = IsDlgButtonChecked(hWnd, 1021); + g_mute[5] = IsDlgButtonChecked(hWnd, 1022); + g_mute[6] = IsDlgButtonChecked(hWnd, 1023); + g_mute[7] = IsDlgButtonChecked(hWnd, 1024); + EndDialog(hWnd, 1); + break; + } + + break; + } + + return FALSE; +} + +BOOL __stdcall DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + char string[100]; + + switch (Msg) + { + case WM_INITDIALOG: + SetDlgItemTextA(hWnd, 1008, "000.dat"); + CenterWindow(hWnd); + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case 2: + EndDialog(hWnd, 0); + break; + + case 1: + GetDlgItemTextA(hWnd, 1008, string, sizeof(string)); + SaveProfile(string); + EndDialog(hWnd, 1); + break; + } + + break; + } + + return FALSE; +} + +BOOL __stdcall QuitDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + switch (Msg) + { + case WM_INITDIALOG: + SetDlgItemTextA(hWnd, 1009, (LPCSTR)lParam); + CenterWindow(hWnd); + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case 2: + EndDialog(hWnd, 2); + break; + + case 1: + EndDialog(hWnd, 1); + break; + } + + break; + } + + return FALSE; +} diff --git a/src/Dialog.h b/src/Dialog.h new file mode 100644 index 00000000..3f59c932 --- /dev/null +++ b/src/Dialog.h @@ -0,0 +1,2 @@ +#pragma once + diff --git a/src/Organya.cpp b/src/Organya.cpp index 8c721ec3..243a09c8 100644 --- a/src/Organya.cpp +++ b/src/Organya.cpp @@ -22,10 +22,6 @@ #define VOLDUMMY 0xFF #define KEYDUMMY 0xFF -#define MAXTRACK 16 -#define MAXMELODY 8 -#define MAXDRAM 8 - #define ALLOCNOTE 4096 #define DEFVOLUME 200//255はVOLDUMMY。MAXは254 diff --git a/src/Organya.h b/src/Organya.h index ca31c853..53bdb5b9 100644 --- a/src/Organya.h +++ b/src/Organya.h @@ -4,6 +4,12 @@ #include "WindowsWrapper.h" +#define MAXTRACK 16 +#define MAXMELODY 8 +#define MAXDRAM 8 + +extern BOOL g_mute[MAXTRACK]; // Used by the debug Mute menu + BOOL MakeOrganyaWave(signed char track, signed char wave_no, signed char pipi); void OrganyaPlayData(); void SetPlayPointer(long x);