mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-10-05 03:21:44 +02:00
byuu says: Changelog: - SNES mid-scanline BGMODE fixes finally merged (can run atx2.zip{mode7.smc}+mtest(2).sfc properly now) - Makefile now discards all built-in rules and variables - switch on bool warning disabled for GCC now as well (was already disabled for Clang) - when loading a game, if any required files are missing, display a warning message box (manifest.bml, program.rom, bios.rom, etc) - when loading a game (or a game slot), if manifest.bml is missing, it will invoke icarus to try and generate it - if that fails (icarus is missing or the folder is bad), you will get a warning telling you that the manifest can't be loaded The warning prompt on missing files work for both games and the .sys folders and their files. For some reason, failing to load the DMG/CGB BIOS is causing a crash before I can display the modal dialog. I have no idea why, and the stack frame backtrace is junk. I also can't seem to abort the failed loading process. If I call Program::unloadMedia(), I get a nasty segfault. Again with a really nasty stack trace. So for now, it'll just end up sitting there emulating an empty ROM (solid black screen.) In time, I'd like to fix that too. Lastly, I need a better method than popen for Windows. popen is kind of ugly and flashes a console window for a brief second even if the application launched is linked with -mwindows. Not sure if there even is one (I need to read the stdout result, so CreateProcess may not work unless I do something nasty like "> %tmp%/temp") I'm also using the regular popen instead of _wpopen, so for this WIP, it won't work if your game folder has non-English letters in the path.
117 lines
4.3 KiB
C++
117 lines
4.3 KiB
C++
#ifndef EMULATOR_INTERFACE_HPP
|
|
#define EMULATOR_INTERFACE_HPP
|
|
|
|
namespace Emulator {
|
|
|
|
struct Interface {
|
|
struct Information {
|
|
string name;
|
|
unsigned width;
|
|
unsigned height;
|
|
bool overscan;
|
|
double aspectRatio;
|
|
bool resettable;
|
|
struct Capability {
|
|
bool states;
|
|
bool cheats;
|
|
} capability;
|
|
} information;
|
|
|
|
struct Media {
|
|
unsigned id;
|
|
string name;
|
|
string type;
|
|
bool bootable; //false for cartridge slots (eg Sufami Turbo cartridges)
|
|
};
|
|
vector<Media> media;
|
|
|
|
struct Device {
|
|
unsigned id;
|
|
unsigned portmask;
|
|
string name;
|
|
struct Input {
|
|
unsigned id;
|
|
unsigned type; //0 = digital, 1 = analog (relative), 2 = rumble
|
|
string name;
|
|
uintptr_t guid; //user data field
|
|
};
|
|
vector<Input> input;
|
|
vector<unsigned> order;
|
|
};
|
|
|
|
struct Port {
|
|
unsigned id;
|
|
string name;
|
|
vector<Device> device;
|
|
};
|
|
vector<Port> port;
|
|
|
|
struct Bind {
|
|
virtual auto loadRequest(unsigned, string, string, bool) -> void {}
|
|
virtual auto loadRequest(unsigned, string, bool) -> void {}
|
|
virtual auto saveRequest(unsigned, string) -> void {}
|
|
virtual auto videoColor(unsigned, uint16_t, uint16_t, uint16_t, uint16_t) -> uint32_t { return 0u; }
|
|
virtual auto videoRefresh(const uint32_t*, const uint32_t*, unsigned, unsigned, unsigned) -> void {}
|
|
virtual auto audioSample(int16_t, int16_t) -> void {}
|
|
virtual auto inputPoll(unsigned, unsigned, unsigned) -> int16_t { return 0; }
|
|
virtual auto inputRumble(unsigned, unsigned, unsigned, bool) -> void {}
|
|
virtual auto dipSettings(const Markup::Node&) -> unsigned { return 0; }
|
|
virtual auto path(unsigned) -> string { return ""; }
|
|
virtual auto notify(string text) -> void { print(text, "\n"); }
|
|
};
|
|
Bind* bind = nullptr;
|
|
|
|
//callback bindings (provided by user interface)
|
|
auto loadRequest(unsigned id, string name, string type, bool required) -> void { return bind->loadRequest(id, name, type, required); }
|
|
auto loadRequest(unsigned id, string path, bool required) -> void { return bind->loadRequest(id, path, required); }
|
|
auto saveRequest(unsigned id, string path) -> void { return bind->saveRequest(id, path); }
|
|
auto videoColor(unsigned source, uint16_t alpha, uint16_t red, uint16_t green, uint16_t blue) -> uint32_t { return bind->videoColor(source, alpha, red, green, blue); }
|
|
auto videoRefresh(const uint32_t* palette, const uint32_t* data, unsigned pitch, unsigned width, unsigned height) -> void { return bind->videoRefresh(palette, data, pitch, width, height); }
|
|
auto audioSample(int16_t lsample, int16_t rsample) -> void { return bind->audioSample(lsample, rsample); }
|
|
auto inputPoll(unsigned port, unsigned device, unsigned input) -> int16_t { return bind->inputPoll(port, device, input); }
|
|
auto inputRumble(unsigned port, unsigned device, unsigned input, bool enable) -> void { return bind->inputRumble(port, device, input, enable); }
|
|
auto dipSettings(const Markup::Node& node) -> unsigned { return bind->dipSettings(node); }
|
|
auto path(unsigned group) -> string { return bind->path(group); }
|
|
template<typename... P> auto notify(P&&... p) -> void { return bind->notify({forward<P>(p)...}); }
|
|
|
|
//information
|
|
virtual auto title() -> string = 0;
|
|
virtual auto videoFrequency() -> double = 0;
|
|
virtual auto audioFrequency() -> double = 0;
|
|
|
|
//media interface
|
|
virtual auto loaded() -> bool { return false; }
|
|
virtual auto sha256() -> string { return ""; }
|
|
virtual auto group(unsigned id) -> unsigned = 0;
|
|
virtual auto load(unsigned id) -> void {}
|
|
virtual auto save() -> void {}
|
|
virtual auto load(unsigned id, const stream& memory) -> void {}
|
|
virtual auto save(unsigned id, const stream& memory) -> void {}
|
|
virtual auto unload() -> void {}
|
|
|
|
//system interface
|
|
virtual auto connect(unsigned port, unsigned device) -> void {}
|
|
virtual auto power() -> void {}
|
|
virtual auto reset() -> void {}
|
|
virtual auto run() -> void {}
|
|
|
|
//time functions
|
|
virtual auto rtc() -> bool { return false; }
|
|
virtual auto rtcsync() -> void {}
|
|
|
|
//state functions
|
|
virtual auto serialize() -> serializer = 0;
|
|
virtual auto unserialize(serializer&) -> bool = 0;
|
|
|
|
//cheat functions
|
|
virtual auto cheatSet(const lstring& = lstring{}) -> void {}
|
|
|
|
//utility functions
|
|
enum class PaletteMode : unsigned { Literal, Channel, Standard, Emulation };
|
|
virtual auto paletteUpdate(PaletteMode mode) -> void {}
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|