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).
This commit is contained in:
Clownacy 2019-08-31 00:22:07 +01:00
parent 2f56effc51
commit d9043a7c49
6 changed files with 187 additions and 4 deletions

View file

@ -274,6 +274,9 @@
<File
RelativePath="..\src\Config.cpp">
</File>
<File
RelativePath="..\src\Dialog.cpp">
</File>
<File
RelativePath="..\src\Draw.cpp">
</File>
@ -507,6 +510,9 @@
<File
RelativePath="..\src\Config.h">
</File>
<File
RelativePath="..\src\Dialog.h">
</File>
<File
RelativePath="..\src\Draw.h">
</File>

View file

@ -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

157
src/Dialog.cpp Normal file
View file

@ -0,0 +1,157 @@
#include "Dialog.h"
#include <stdio.h>
#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;
}

2
src/Dialog.h Normal file
View file

@ -0,0 +1,2 @@
#pragma once

View file

@ -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

View file

@ -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);