Enable GB colorization hack support in GUI.

This is used by some hacked ROMs like Metroid II DX.

Add a config variable to enable the already existent core support for
this.

This conflicts with using a GB BIOS file, add checks and error dialogs
for this.

Also move including "ConfigManager.h" into "wxvbam.h".

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Squall Leonhart 2021-10-24 14:38:28 +11:00 committed by Rafael Kitover
parent 89028de852
commit 972f151310
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
16 changed files with 363 additions and 305 deletions

File diff suppressed because it is too large Load Diff

View File

@ -164,6 +164,7 @@ int autoSaveLoadCheatList;
int aviRecording;
int captureFormat = 0;
int cheatsEnabled = true;
int colorizerHack = 0;
int cpuDisableSfx = false;
int cpuSaveType = 0;
int enableMMX;
@ -302,6 +303,7 @@ struct option argOptions[] = {
{ "cheat", required_argument, 0, OPT_CHEAT },
{ "cheats-enabled", no_argument, &cheatsEnabled, 1 },
{ "color-option", no_argument, &gbColorOption, 1 },
{ "colorizer-hack", no_argument, &colorizerHack, 1 },
{ "config", required_argument, 0, 'c' },
{ "cpu-disable-sfx", no_argument, &cpuDisableSfx, 1 },
{ "cpu-save-type", required_argument, 0, OPT_CPU_SAVE_TYPE },
@ -492,6 +494,7 @@ void LoadConfig()
biosFileNameGBC = ReadPrefString("biosFileGBC");
captureFormat = ReadPref("captureFormat", 0);
cheatsEnabled = ReadPref("cheatsEnabled", 0);
colorizerHack = ReadPref("colorizerHack", 0);
cpuDisableSfx = ReadPref("disableSfx", 0);
cpuSaveType = ReadPrefHex("saveType");
enableMMX = ReadPref("enableMMX", 1);

View File

@ -53,6 +53,7 @@ extern int autoSaveLoadCheatList;
extern int aviRecording;
extern int captureFormat;
extern int cheatsEnabled;
extern int colorizerHack;
extern int cpuDisableSfx;
extern int cpuSaveType;
extern int dinputKeyFocus;

View File

@ -11,7 +11,6 @@
#include <wx/msgdlg.h>
#include "../common/version_cpp.h"
#include "../common/ConfigManager.h"
#include "../gb/gbPrinter.h"
#include "../gba/agbprint.h"
@ -1875,6 +1874,22 @@ EVT_HANDLER(CheatsEnable, "Enable cheats (toggle)")
update_opts();
}
EVT_HANDLER(ColorizerHack, "Enable Colorizer Hack (toggle)")
{
int val = 0;
GetMenuOptionInt("ColorizerHack", val, 1);
if (val == 1 && useBiosFileGB == 1) {
wxLogError(_("Cannot use Colorizer Hack when GB BIOS File is enabled."));
val = 0;
SetMenuOption("ColorizerHack", 0);
}
colorizerHack = val;
update_opts();
}
// Debug menu
EVT_HANDLER_MASK(VideoLayersBG0, "Video layer BG0 (toggle)", CMDEN_GB | CMDEN_GBA)
{
@ -3079,7 +3094,17 @@ EVT_HANDLER(BootRomEn, "Use the specified BIOS file for GBA")
EVT_HANDLER(BootRomGB, "Use the specified BIOS file for GB")
{
GetMenuOptionInt("BootRomGB", useBiosFileGB, 1);
int val = 0;
GetMenuOptionInt("BootRomGB", val, 1);
if (val == 1 && colorizerHack == 1) {
wxLogError(_("Cannot use GB BIOS when Colorizer Hack is enabled."));
val = 0;
SetMenuOption("BootRomGB", 0);
}
useBiosFileGB = val;
update_opts();
}

View File

@ -10,7 +10,6 @@
// DirectSound8
#define DIRECTSOUND_VERSION 0x0800
#include "../common/ConfigManager.h"
#include <dsound.h>
extern bool soundBufferLow;

View File

@ -5,7 +5,6 @@
#include <stdio.h>
// Interface
#include "../common/ConfigManager.h"
#include "../common/SoundDriver.h"
// FAudio

View File

@ -23,7 +23,6 @@
#include <wx/txtstrm.h>
#include <wx/wfstream.h>
#include "../common/ConfigManager.h"
#include "../gba/CheatSearch.h"
#if defined(__WXGTK__)
@ -3050,6 +3049,7 @@ bool MainFrame::BindControls()
MenuOptionIntMask("VideoLayersOBJWIN", layerSettings, (1 << 15));
MenuOptionBool("CheatsAutoSaveLoad", gopts.autoload_cheats);
MenuOptionIntMask("CheatsEnable", cheatsEnabled, 1);
SetMenuOption("ColorizerHack", colorizerHack ? 1 : 0);
MenuOptionIntMask("KeepSaves", skipSaveGameBattery, 1);
MenuOptionIntMask("KeepCheats", skipSaveGameCheats, 1);
MenuOptionBool("LoadGameAutoLoad", gopts.autoload_state);

View File

@ -8,7 +8,6 @@
#include "wxvbam.h"
// Interface
#include "../common/ConfigManager.h"
#include "../common/SoundDriver.h"
// OpenAL

View File

@ -1,4 +1,3 @@
#include "../common/ConfigManager.h"
#include "wxvbam.h"
#include <vector>
#include <algorithm>
@ -209,6 +208,7 @@ opt_desc opts[] = {
/// GB
STROPT("GB/BiosFile", "", wxTRANSLATE("BIOS file to use for GB, if enabled"), gopts.gb_bios),
INTOPT("GB/ColorOption", "GBColorOption", wxTRANSLATE("GB color enhancement, if enabled"), gbColorOption, 0, 1),
INTOPT("GB/ColorizerHack", "ColorizerHack", wxTRANSLATE("Enable DX Colorization Hacks"), colorizerHack, 0, 1),
BOOLOPT("GB/LCDFilter", "GBLcdFilter", wxTRANSLATE("Apply LCD filter, if enabled"), gbLcdFilter),
STROPT("GB/GBCBiosFile", "", wxTRANSLATE("BIOS file to use for GBC, if enabled"), gopts.gbc_bios),
NOOPT(wxT("GB/Palette0"), "", wxTRANSLATE("The default palette, as 8 comma-separated 4-digit hex integers (rgb555).")),
@ -263,6 +263,7 @@ opt_desc opts[] = {
INTOPT("preferences/borderOn", "", wxTRANSLATE("Always enable border"), gbBorderOn, 0, 1),
INTOPT("preferences/captureFormat", "", wxTRANSLATE("Screen capture file format"), captureFormat, 0, 1),
INTOPT("preferences/cheatsEnabled", "", wxTRANSLATE("Enable cheats"), cheatsEnabled, 0, 1),
#ifdef MMX
INTOPT("preferences/enableMMX", "MMX", wxTRANSLATE("Enable MMX"), enableMMX, 0, 1),
#endif

View File

@ -16,7 +16,6 @@
#include <SDL_joystick.h>
#include "../common/version_cpp.h"
#include "../common/ConfigManager.h"
#include "../common/Patch.h"
#include "../gb/gbPrinter.h"
#include "../gba/RTC.h"
@ -199,7 +198,18 @@ void GameArea::LoadGame(const wxString& name)
soundSetThrottle(throttle);
gbGetHardwareType();
bool use_bios = gbCgbMode ? useBiosFileGBC : useBiosFileGB;
// Disable bios loading when using colorizer hack.
if (useBiosFileGB && colorizerHack) {
wxLogError(_("Cannot use GB BIOS file when Colorizer Hack is enabled, disabling GB BIOS file."));
useBiosFileGB = 0;
update_opts();
}
// Set up the core for the colorizer hack.
setColorizerHack(colorizerHack);
bool use_bios = gbCgbMode ? useBiosFileGBC : useBiosFileGB;
wxCharBuffer fnb(UTF8((gbCgbMode ? gopts.gbc_bios : gopts.gb_bios)));
const char* fn = fnb.data();

View File

@ -1,4 +1,3 @@
#include "../common/ConfigManager.h"
#include "../common/SoundSDL.h"
#include "wxvbam.h"
#include "SDL.h"

View File

@ -1,5 +1,4 @@
#include "viewsupt.h"
#include "../common/ConfigManager.h"
#include "wxvbam.h"
#include "wxutil.h"

View File

@ -26,7 +26,6 @@
#include "builtin-xrc.h"
// The built-in vba-over.ini
#include "../common/ConfigManager.h"
#include "builtin-over.h"
IMPLEMENT_APP(wxvbamApp)

View File

@ -16,11 +16,10 @@
#include "wx/sdljoy.h"
#include "wx/wxmisc.h"
#include "wxhead.h"
#ifndef NO_FFMPEG
#include "../common/ffmpeg.h"
#endif
/* yeah, they aren't needed globally, but I'm too lazy to limit where needed */
#include "../common/ConfigManager.h"
#include "../System.h"
#include "../Util.h"
#include "../gb/gb.h"
@ -32,6 +31,10 @@
#include "../gba/Globals.h"
#include "../gba/Sound.h"
#ifndef NO_FFMPEG
#include "../common/ffmpeg.h"
#endif
#include "wxlogdebug.h"
#include "wxutil.h"

View File

@ -5,7 +5,6 @@
#include <stdio.h>
// Interface
#include "../common/ConfigManager.h"
#include "../common/SoundDriver.h"
// XAudio2

View File

@ -535,6 +535,10 @@
<label>_LCD Filter</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="ColorizerHack">
<label>_GB Colorizer Hack (requires restart)</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="Printer">
<label>_GB printer</label>
<checkable>1</checkable>
@ -549,7 +553,7 @@
</object>
<object class="separator"/>
<object class="wxMenuItem" name="BootRomGB">
<label>_Use GB BIOS file</label>
<label>_Use GB BIOS file (requires restart)</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="BootRomGBC">