Merge branch 'rr1-maint'
This commit is contained in:
commit
37761ac6f5
7 changed files with 205 additions and 1 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1-Δ2
|
||||
1-Δ2ε1
|
|
@ -0,0 +1,84 @@
|
|||
From c6043046e5c742b9800b06b10584e346274d0e55 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 9 Nov 2011 00:37:44 +0200
|
||||
Subject: [PATCH 1/3] Don't use time() in emulating chips
|
||||
|
||||
Instead of using time() in chip emulation, create new interface method
|
||||
currentTime(), defaulting to time(0). This way frontend can cleanly
|
||||
override the current time bsnes is using.
|
||||
---
|
||||
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
|
||||
snes/chip/spc7110/spc7110.cpp | 2 +-
|
||||
snes/chip/srtc/srtc.cpp | 2 +-
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
5 files changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/snes/chip/bsx/satellaview/satellaview.cpp b/snes/chip/bsx/satellaview/satellaview.cpp
|
||||
index 386fb62..3c98019 100755
|
||||
--- a/snes/chip/bsx/satellaview/satellaview.cpp
|
||||
+++ b/snes/chip/bsx/satellaview/satellaview.cpp
|
||||
@@ -38,7 +38,7 @@ uint8 BSXSatellaview::mmio_read(unsigned addr) {
|
||||
|
||||
if(counter == 0) {
|
||||
time_t rawtime;
|
||||
- time(&rawtime);
|
||||
+ rawtime = SNES::interface->currentTime();
|
||||
tm *t = localtime(&rawtime);
|
||||
|
||||
regs.r2192_hour = t->tm_hour;
|
||||
diff --git a/snes/chip/spc7110/spc7110.cpp b/snes/chip/spc7110/spc7110.cpp
|
||||
index d2dc640..74a817a 100755
|
||||
--- a/snes/chip/spc7110/spc7110.cpp
|
||||
+++ b/snes/chip/spc7110/spc7110.cpp
|
||||
@@ -101,7 +101,7 @@ void SPC7110::set_data_adjust(unsigned addr) { r4814 = addr; r4815 = addr >> 8;
|
||||
|
||||
void SPC7110::update_time(int offset) {
|
||||
time_t rtc_time = (rtc[16] << 0) | (rtc[17] << 8) | (rtc[18] << 16) | (rtc[19] << 24);
|
||||
- time_t current_time = time(0) - offset;
|
||||
+ time_t current_time = SNES::interface->currentTime() - offset;
|
||||
|
||||
//sizeof(time_t) is platform-dependent; though rtc[] needs to be platform-agnostic.
|
||||
//yet platforms with 32-bit signed time_t will overflow every ~68 years. handle this by
|
||||
diff --git a/snes/chip/srtc/srtc.cpp b/snes/chip/srtc/srtc.cpp
|
||||
index 1b2fd2a..78fc4c1 100755
|
||||
--- a/snes/chip/srtc/srtc.cpp
|
||||
+++ b/snes/chip/srtc/srtc.cpp
|
||||
@@ -31,7 +31,7 @@ void SRTC::reset() {
|
||||
|
||||
void SRTC::update_time() {
|
||||
time_t rtc_time = (rtc[16] << 0) | (rtc[17] << 8) | (rtc[18] << 16) | (rtc[19] << 24);
|
||||
- time_t current_time = time(0);
|
||||
+ time_t current_time = SNES::interface->currentTime();
|
||||
|
||||
//sizeof(time_t) is platform-dependent; though rtc[] needs to be platform-agnostic.
|
||||
//yet platforms with 32-bit signed time_t will overflow every ~68 years. handle this by
|
||||
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
|
||||
index a0e3a81..b3017c9 100755
|
||||
--- a/snes/interface/interface.cpp
|
||||
+++ b/snes/interface/interface.cpp
|
||||
@@ -18,4 +18,9 @@ void Interface::message(const string &text) {
|
||||
print(text, "\n");
|
||||
}
|
||||
|
||||
+time_t Interface::currentTime()
|
||||
+{
|
||||
+ return time(0);
|
||||
+}
|
||||
+
|
||||
}
|
||||
diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
|
||||
index f1a48c0..df975e8 100755
|
||||
--- a/snes/interface/interface.hpp
|
||||
+++ b/snes/interface/interface.hpp
|
||||
@@ -5,6 +5,7 @@ struct Interface {
|
||||
|
||||
virtual string path(Cartridge::Slot slot, const string &hint) = 0;
|
||||
virtual void message(const string &text);
|
||||
+ virtual time_t currentTime();
|
||||
};
|
||||
|
||||
extern Interface *interface;
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
From 9fb6acd73f646d82e4b345292ee4c9156dfb49b3 Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Wed, 9 Nov 2011 01:52:08 +0200
|
||||
Subject: [PATCH 2/3] Save controller state when savestating
|
||||
|
||||
When savestating, save the controller state and restore it upon loadstate.
|
||||
Prevents libsnes from mixing up buttons.
|
||||
---
|
||||
snes/system/input.cpp | 16 ++++++++++++++++
|
||||
snes/system/input.hpp | 1 +
|
||||
2 files changed, 17 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/snes/system/input.cpp b/snes/system/input.cpp
|
||||
index 9050310..ec5559d 100755
|
||||
--- a/snes/system/input.cpp
|
||||
+++ b/snes/system/input.cpp
|
||||
@@ -26,6 +26,22 @@ void Input::connect(bool port, Input::Device id) {
|
||||
}
|
||||
}
|
||||
|
||||
+void Input::serialize(serializer &s)
|
||||
+{
|
||||
+ int p1, p2;
|
||||
+ p1 = (int)config.controller_port1;
|
||||
+ p2 = (int)config.controller_port2;
|
||||
+ s.integer(p1);
|
||||
+ s.integer(p2);
|
||||
+ if(s.mode() == nall::serializer::Load) {
|
||||
+ connect(Controller::Port1, (Device)p1);
|
||||
+ connect(Controller::Port2, (Device)p2);
|
||||
+ }
|
||||
+ port1->serialize(s);
|
||||
+ port2->serialize(s);
|
||||
+}
|
||||
+
|
||||
+
|
||||
Input::Input() : port1(nullptr), port2(nullptr) {
|
||||
connect(Controller::Port1, Input::Device::Joypad);
|
||||
connect(Controller::Port2, Input::Device::Joypad);
|
||||
diff --git a/snes/system/input.hpp b/snes/system/input.hpp
|
||||
index 13ef46e..6832e82 100755
|
||||
--- a/snes/system/input.hpp
|
||||
+++ b/snes/system/input.hpp
|
||||
@@ -31,6 +31,7 @@ struct Input {
|
||||
Controller *port1;
|
||||
Controller *port2;
|
||||
|
||||
+ void serialize(serializer &s);
|
||||
void connect(bool port, Input::Device id);
|
||||
Input();
|
||||
~Input();
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
From 5eb53888f8118d1894730d68fb3863919aaa309f Mon Sep 17 00:00:00 2001
|
||||
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
|
||||
Date: Fri, 11 Nov 2011 19:49:46 +0200
|
||||
Subject: [PATCH 3/3] Allow frontend to control random number seed
|
||||
|
||||
---
|
||||
snes/interface/interface.cpp | 5 +++++
|
||||
snes/interface/interface.hpp | 1 +
|
||||
snes/system/system.cpp | 2 +-
|
||||
3 files changed, 7 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
|
||||
index b3017c9..0a21a13 100755
|
||||
--- a/snes/interface/interface.cpp
|
||||
+++ b/snes/interface/interface.cpp
|
||||
@@ -23,4 +23,9 @@ time_t Interface::currentTime()
|
||||
return time(0);
|
||||
}
|
||||
|
||||
+time_t Interface::randomSeed()
|
||||
+{
|
||||
+ return time(0);
|
||||
+}
|
||||
+
|
||||
}
|
||||
diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
|
||||
index df975e8..30ee7fd 100755
|
||||
--- a/snes/interface/interface.hpp
|
||||
+++ b/snes/interface/interface.hpp
|
||||
@@ -6,6 +6,7 @@ struct Interface {
|
||||
virtual string path(Cartridge::Slot slot, const string &hint) = 0;
|
||||
virtual void message(const string &text);
|
||||
virtual time_t currentTime();
|
||||
+ virtual time_t randomSeed();
|
||||
};
|
||||
|
||||
extern Interface *interface;
|
||||
diff --git a/snes/system/system.cpp b/snes/system/system.cpp
|
||||
index 284e389..99901ff 100755
|
||||
--- a/snes/system/system.cpp
|
||||
+++ b/snes/system/system.cpp
|
||||
@@ -151,7 +151,7 @@ void System::unload() {
|
||||
}
|
||||
|
||||
void System::power() {
|
||||
- random.seed((unsigned)time(0));
|
||||
+ random.seed((unsigned)interface->randomSeed());
|
||||
|
||||
region = config.region;
|
||||
expansion = config.expansion_port;
|
||||
--
|
||||
1.7.9.48.g85da4d
|
||||
|
|
@ -5445,5 +5445,13 @@ Wxwidgets: Fix dumper submodes
|
|||
Set core controller types before loadstate
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection
|
||||
rr1-delta2epsilon1
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
Fix compiling with bsnes v086.
|
||||
\end_layout
|
||||
|
||||
\end_body
|
||||
\end_document
|
||||
|
|
|
@ -2661,3 +2661,7 @@ set-axis joystick0axis19 disabled
|
|||
|
||||
• Set core controller types before loadstate
|
||||
|
||||
15.49 rr1-delta2epsilon1
|
||||
|
||||
• Fix compiling with bsnes v086.
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "lsnes.hpp"
|
||||
#include <snes/snes.hpp>
|
||||
#include <gameboy/gameboy.hpp>
|
||||
#include <ui-libsnes/libsnes.hpp>
|
||||
|
||||
#include "core/command.hpp"
|
||||
|
|
Loading…
Add table
Reference in a new issue