1 From b19b3b2d1d7a522af695f4482abb28e52804326b Mon Sep 17 00:00:00 2001
2 From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
3 Date: Wed, 9 Nov 2011 00:30:36 +0200
4 Subject: [PATCH 01/27] Make libsnes compile
6 Changes between v083 and v084 had broken libsnes. Fix it so it at least
9 ui-libsnes/libsnes.cpp | 37 +++++++++++++++++++++++++++++++++++--
10 1 file changed, 35 insertions(+), 2 deletions(-)
12 diff --git a/ui-libsnes/libsnes.cpp b/ui-libsnes/libsnes.cpp
13 index fbb4482c..5f5ded69 100755
14 --- a/ui-libsnes/libsnes.cpp
15 +++ b/ui-libsnes/libsnes.cpp
17 #include "libsnes.hpp"
18 #include <snes/snes.hpp>
19 +#include <gameboy/gameboy.hpp>
21 #include <nall/snes/cartridge.hpp>
22 #include <nall/gameboy/cartridge.hpp>
23 @@ -46,6 +47,38 @@ struct Interface : public SNES::Interface {
27 + void setCheats(const lstring &list = lstring{}) {
28 + if(SNES::cartridge.mode() == SNES::Cartridge::Mode::SuperGameBoy) {
29 + GameBoy::cheat.reset();
30 + for(auto &code : list) {
32 + codelist.split("+", code);
33 + for(auto &part : codelist) {
34 + unsigned addr, data, comp;
35 + if(GameBoy::Cheat::decode(part, addr, data, comp)) {
36 + GameBoy::cheat.append({ addr, data, comp });
40 + GameBoy::cheat.synchronize();
44 + SNES::cheat.reset();
45 + for(auto &code : list) {
47 + codelist.split("+", code);
48 + for(auto &part : codelist) {
49 + unsigned addr, data;
50 + if(SNES::Cheat::decode(part, addr, data)) {
51 + SNES::cheat.append({ addr, data });
55 + SNES::cheat.synchronize();
59 string path(SNES::Cartridge::Slot slot, const string &hint) {
60 return { basename, hint };
62 @@ -115,7 +148,7 @@ void snes_set_cartridge_basename(const char *basename) {
65 void snes_init(void) {
66 - interface.initialize(&interface);
67 + SNES::system.init();
68 SNES::input.connect(SNES::Controller::Port1, SNES::Input::Device::Joypad);
69 SNES::input.connect(SNES::Controller::Port2, SNES::Input::Device::Joypad);
71 @@ -244,7 +277,7 @@ bool snes_load_cartridge_super_game_boy(
72 uint8_t *data = new uint8_t[dmg_size];
73 memcpy(data, dmg_data, dmg_size);
74 string xmldmg = (dmg_xml && *dmg_xml) ? string(dmg_xml) : GameBoyCartridge(data, dmg_size).markup;
75 - GameBoy::cartridge.load(xmldmg, data, dmg_size);
76 + GameBoy::cartridge.load(GameBoy::System::Revision::SuperGameBoy, xmldmg, data, dmg_size);
79 SNES::cartridge.load(SNES::Cartridge::Mode::SuperGameBoy, xmlrom);