Minor cleanups.

This commit is contained in:
byuu 2019-09-06 12:30:54 +09:00
parent 1195c46ac0
commit 0788627898
4 changed files with 57 additions and 17 deletions

View File

@ -1,5 +1,5 @@
auto Program::showMessage(string text) -> void { auto Program::showMessage(string text) -> void {
statusTime = chrono::timestamp(); statusTime = chrono::millisecond();
statusMessage = text; statusMessage = text;
} }
@ -9,7 +9,7 @@ auto Program::showFrameRate(string text) -> void {
auto Program::updateStatus() -> void { auto Program::updateStatus() -> void {
string message; string message;
if(chrono::timestamp() - statusTime <= 2) { if(chrono::millisecond() - statusTime <= 2000) {
message = statusMessage; message = statusMessage;
} }
if(message != presentation.statusLeft.text()) { if(message != presentation.statusLeft.text()) {

View File

@ -1,25 +1,12 @@
name := libretro.so name := libretro.so
flags += -std=c++17 -fpermissive -Wno-narrowing -Wno-multichar -fopenmp -g flags += -std=c++17 -fpermissive -Wno-narrowing -Wno-multichar -fopenmp -g -fPIC
#flags += -DSFC_SUPERGAMEBOY
#include fc/GNUmakefile
#include sfc/GNUmakefile
#include ms/GNUmakefile
#include md/GNUmakefile
#include pce/GNUmakefile
#include gb/GNUmakefile
#include gba/GNUmakefile
#include ws/GNUmakefile
#include processor/GNUmakefile
# rules
objects := libretro $(objects) objects := libretro $(objects)
objects := $(patsubst %,obj/%.o,$(objects)) objects := $(patsubst %,obj/%.o,$(objects))
obj/libretro.o: target-libretro/libretro.cpp obj/libretro.o: target-libretro/libretro.cpp
# targets all: $(objects)
build: $(objects)
ifeq ($(platform),linux) ifeq ($(platform),linux)
$(strip $(compiler) -o out/bsnes_libretro.so -shared $(objects) -Wl,--no-undefined -Wl,--version-script=target-libretro/link.T -Wl,-Bdynamic -lpthread -ldl -lgomp) $(strip $(compiler) -o out/bsnes_libretro.so -shared $(objects) -Wl,--no-undefined -Wl,--version-script=target-libretro/link.T -Wl,-Bdynamic -lpthread -ldl -lgomp)
else ifeq ($(platform),windows) else ifeq ($(platform),windows)

View File

@ -25,6 +25,26 @@ static void flush_variables()
emulator->configure("Video/BlurEmulation", false); emulator->configure("Video/BlurEmulation", false);
} }
variable = { "bsnes_hotfixes", nullptr };
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &variable) && variable.value)
{
if (strcmp(variable.value, "ON") == 0)
emulator->configure("Hacks/Hotfixes", true);
else if (strcmp(variable.value, "OFF") == 0)
emulator->configure("Hacks/Hotfixes", false);
}
variable = { "bsnes_entropy", nullptr };
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &variable) && variable.value)
{
if (strcmp(variable.value, "None") == 0)
emulator->configure("Hacks/Entropy", "None");
else if (strcmp(variable.value, "Low") == 0)
emulator->configure("Hacks/Entropy", "Low");
else if (strcmp(variable.value, "High") == 0)
emulator->configure("Hacks/Entropy", "High");
}
variable = { "bsnes_cpu_overclock", nullptr }; variable = { "bsnes_cpu_overclock", nullptr };
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &variable) && variable.value) if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &variable) && variable.value)
{ {
@ -32,6 +52,15 @@ static void flush_variables()
emulator->configure("Hacks/CPU/Overclock", val); emulator->configure("Hacks/CPU/Overclock", val);
} }
variable = { "bsnes_cpu_fastmath", nullptr };
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &variable) && variable.value)
{
if (strcmp(variable.value, "ON") == 0)
emulator->configure("Hacks/CPU/FastMath", true);
else if (strcmp(variable.value, "OFF") == 0)
emulator->configure("Hacks/CPU/FastMath", false);
}
variable = { "bsnes_cpu_sa1_overclock", nullptr }; variable = { "bsnes_cpu_sa1_overclock", nullptr };
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &variable) && variable.value) if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &variable) && variable.value)
{ {
@ -73,6 +102,15 @@ static void flush_variables()
emulator->configure("Hacks/PPU/NoSpriteLimit", false); emulator->configure("Hacks/PPU/NoSpriteLimit", false);
} }
variable = { "bsnes_ppu_no_vram_blocking", nullptr };
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &variable) && variable.value)
{
if (strcmp(variable.value, "ON") == 0)
emulator->configure("Hacks/PPU/NoVRAMBlocking", true);
else if (strcmp(variable.value, "OFF") == 0)
emulator->configure("Hacks/PPU/NoVRAMBlocking", false);
}
variable = { "bsnes_ppu_show_overscan", nullptr }; variable = { "bsnes_ppu_show_overscan", nullptr };
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &variable) && variable.value) if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &variable) && variable.value)
{ {
@ -136,6 +174,15 @@ static void flush_variables()
emulator->configure("Hacks/DSP/Cubic", false); emulator->configure("Hacks/DSP/Cubic", false);
} }
variable = { "bsnes_dsp_echo_shadow", nullptr };
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &variable) && variable.value)
{
if (strcmp(variable.value, "ON") == 0)
emulator->configure("Hacks/DSP/EchoShadow", true);
else if (strcmp(variable.value, "OFF") == 0)
emulator->configure("Hacks/DSP/EchoShadow", false);
}
variable = { "bsnes_coprocessor_delayed_sync", nullptr }; variable = { "bsnes_coprocessor_delayed_sync", nullptr };
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &variable) && variable.value) if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &variable) && variable.value)
{ {
@ -293,12 +340,16 @@ static void set_environment_info(retro_environment_t cb)
static const retro_variable vars[] = { static const retro_variable vars[] = {
{ "bsnes_blur_emulation", "Blur emulation; OFF|ON" }, { "bsnes_blur_emulation", "Blur emulation; OFF|ON" },
{ "bsnes_entropy", "Entropy (randomization); Low|High|None" },
{ "bsnes_hotfixes", "Hotfixes; OFF|ON" },
{ "bsnes_cpu_overclock", "CPU Overclocking; 100|110|120|130|140|150|160|170|180|190|200|210|220|230|240|250|260|270|280|290|300|310|320|330|340|350|360|370|380|390|400|10|20|30|40|50|60|70|80|90" }, { "bsnes_cpu_overclock", "CPU Overclocking; 100|110|120|130|140|150|160|170|180|190|200|210|220|230|240|250|260|270|280|290|300|310|320|330|340|350|360|370|380|390|400|10|20|30|40|50|60|70|80|90" },
{ "bsnes_cpu_fastmath", "CPU Fast Math; OFF|ON" },
{ "bsnes_sa1_overclock", "SA1 Coprocessor Overclocking; 100|110|120|130|140|150|160|170|180|190|200|210|220|230|240|250|260|270|280|290|300|310|320|330|340|350|360|370|380|390|400|10|20|30|40|50|60|70|80|90" }, { "bsnes_sa1_overclock", "SA1 Coprocessor Overclocking; 100|110|120|130|140|150|160|170|180|190|200|210|220|230|240|250|260|270|280|290|300|310|320|330|340|350|360|370|380|390|400|10|20|30|40|50|60|70|80|90" },
{ "bsnes_sfx_overclock", "SuperFX Coprocessor Overclocking; 100|110|120|130|140|150|160|170|180|190|200|210|220|230|240|250|260|270|280|290|300|310|320|330|340|350|360|370|380|390|400|410|420|430|440|450|460|470|480|490|500|510|520|530|540|550|560|570|580|590|600|610|620|630|640|650|660|670|680|690|700|710|720|730|740|750|760|770|780|790|800|10|20|30|40|50|60|70|80|90" }, { "bsnes_sfx_overclock", "SuperFX Coprocessor Overclocking; 100|110|120|130|140|150|160|170|180|190|200|210|220|230|240|250|260|270|280|290|300|310|320|330|340|350|360|370|380|390|400|410|420|430|440|450|460|470|480|490|500|510|520|530|540|550|560|570|580|590|600|610|620|630|640|650|660|670|680|690|700|710|720|730|740|750|760|770|780|790|800|10|20|30|40|50|60|70|80|90" },
{ "bsnes_ppu_fast", "PPU Fast mode; ON|OFF" }, { "bsnes_ppu_fast", "PPU Fast mode; ON|OFF" },
{ "bsnes_ppu_deinterlace", "PPU Deinterlace; ON|OFF" }, { "bsnes_ppu_deinterlace", "PPU Deinterlace; ON|OFF" },
{ "bsnes_ppu_no_sprite_limit", "PPU No sprite limit; OFF|ON" }, { "bsnes_ppu_no_sprite_limit", "PPU No sprite limit; OFF|ON" },
{ "bsnes_ppu_no_vram_blocking", "PPU No VRAM blocking; OFF|ON" },
{ "bsnes_ppu_show_overscan", "Show Overscan; OFF|ON" }, { "bsnes_ppu_show_overscan", "Show Overscan; OFF|ON" },
{ "bsnes_mode7_scale", "HD Mode 7 Scale; 1x|2x|3x|4x|5x|6x|7x|8x" }, { "bsnes_mode7_scale", "HD Mode 7 Scale; 1x|2x|3x|4x|5x|6x|7x|8x" },
{ "bsnes_mode7_perspective", "HD Mode 7 Perspective correction; ON|OFF" }, { "bsnes_mode7_perspective", "HD Mode 7 Perspective correction; ON|OFF" },
@ -306,6 +357,7 @@ static void set_environment_info(retro_environment_t cb)
{ "bsnes_mode7_mosaic", "HD Mode 7 HD->SD Mosaic; ON|OFF" }, { "bsnes_mode7_mosaic", "HD Mode 7 HD->SD Mosaic; ON|OFF" },
{ "bsnes_dsp_fast", "DSP Fast mode; ON|OFF" }, { "bsnes_dsp_fast", "DSP Fast mode; ON|OFF" },
{ "bsnes_dsp_cubic", "DSP Cubic interpolation; ON|OFF" }, { "bsnes_dsp_cubic", "DSP Cubic interpolation; ON|OFF" },
{ "bsnes_dsp_echo_shadow", "DSP Echo shadow RAM; OFF|ON" },
{ "bsnes_coprocessor_delayed_sync", "Coprocessor Delayed Sync; ON|OFF" }, { "bsnes_coprocessor_delayed_sync", "Coprocessor Delayed Sync; ON|OFF" },
{ "bsnes_coprocessor_prefer_hle", "Coprocessor Prefer HLE; ON|OFF" }, { "bsnes_coprocessor_prefer_hle", "Coprocessor Prefer HLE; ON|OFF" },
{ nullptr }, { nullptr },

View File

@ -327,6 +327,7 @@ auto Video::hasMonitors() -> vector<Monitor> {
auto displayID = [screenID unsignedIntValue]; auto displayID = [screenID unsignedIntValue];
auto displayPort = CGDisplayIOServicePort(displayID); auto displayPort = CGDisplayIOServicePort(displayID);
auto dictionary = IODisplayCreateInfoDictionary(displayPort, 0); auto dictionary = IODisplayCreateInfoDictionary(displayPort, 0);
CFRetain(dictionary);
if(auto names = (CFDictionaryRef)CFDictionaryGetValue(dictionary, CFSTR(kDisplayProductName))) { if(auto names = (CFDictionaryRef)CFDictionaryGetValue(dictionary, CFSTR(kDisplayProductName))) {
auto languageKeys = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); auto languageKeys = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
CFDictionaryApplyFunction(names, MonitorKeyArrayCallback, (void*)languageKeys); CFDictionaryApplyFunction(names, MonitorKeyArrayCallback, (void*)languageKeys);