bsnes/sfc/system/system.hpp
Tim Allen 0271d6a12b Update to v094r39 release.
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.
2015-08-04 19:02:04 +10:00

85 lines
1.8 KiB
C++

struct Interface;
struct System : property<System> {
enum class Region : unsigned { NTSC = 0, PAL = 1, Autodetect = 2 };
enum class ExpansionPortDevice : unsigned { None = 0, Satellaview = 1 };
void run();
void runtosave();
void init();
void term();
void load();
void unload();
void power();
void reset();
void frame();
void scanline();
//return *active* system information (settings are cached upon power-on)
readonly<Region> region;
readonly<ExpansionPortDevice> expansion;
readonly<unsigned> cpu_frequency;
readonly<unsigned> apu_frequency;
readonly<unsigned> serialize_size;
serializer serialize();
bool unserialize(serializer&);
System();
struct Information {
string manifest;
} information;
private:
void runthreadtosave();
void serialize(serializer&);
void serialize_all(serializer&);
void serialize_init();
friend class Cartridge;
friend class Video;
friend class Audio;
friend class Input;
};
extern System system;
#include "video.hpp"
#include "audio.hpp"
#include "input.hpp"
#include <sfc/scheduler/scheduler.hpp>
struct Configuration {
Input::Device controller_port1 = Input::Device::Joypad;
Input::Device controller_port2 = Input::Device::Joypad;
System::ExpansionPortDevice expansion_port = System::ExpansionPortDevice::Satellaview;
System::Region region = System::Region::Autodetect;
bool random = true;
};
extern Configuration configuration;
struct Random {
void seed(unsigned seed) {
iter = seed;
}
unsigned operator()(unsigned result) {
if(configuration.random == false) return result;
return iter = (iter >> 1) ^ (((iter & 1) - 1) & 0xedb88320);
}
void serialize(serializer& s) {
s.integer(iter);
}
private:
unsigned iter = 0;
};
extern Random random;