From 6c225c269b6fb014a5965721965a0af38115c082 Mon Sep 17 00:00:00 2001 From: bladeoner Date: Thu, 27 Dec 2018 06:45:52 +0100 Subject: [PATCH 1/3] Change widescreen setting Change widescreen setting to no autocorrection, this fixes mangled screen on newer tv's --- source/preferences.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/preferences.cpp b/source/preferences.cpp index 8547068..606fd3e 100644 --- a/source/preferences.cpp +++ b/source/preferences.cpp @@ -443,7 +443,7 @@ DefaultSettings () GCSettings.render = 3; // Filtered (sharp) GCSettings.FilterMethod = FILTER_NONE; // no hq2x - GCSettings.widescreen = 1; // aspect ratio correction + GCSettings.widescreen = 0; // no aspect ratio correction GCSettings.zoomHor = 1.0; // horizontal zoom level GCSettings.zoomVert = 1.0; // vertical zoom level GCSettings.xshift = 0; // horizontal video shift From 531f0df37ebea986605ecf43b996279ac65b793a Mon Sep 17 00:00:00 2001 From: bladeoner Date: Thu, 27 Dec 2018 20:24:49 +0100 Subject: [PATCH 2/3] Add stub license --- source/snes9x/apu/apu.cpp | 1 - source/snes9x/apu/apu.h | 1 - source/snes9x/apu/hermite_resampler.h | 6 +++++- source/snes9x/apu/resampler.h | 6 +++++- source/snes9x/apu/ring_buffer.h | 6 +++++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/source/snes9x/apu/apu.cpp b/source/snes9x/apu/apu.cpp index 87ce82a..0d1e8a4 100644 --- a/source/snes9x/apu/apu.cpp +++ b/source/snes9x/apu/apu.cpp @@ -4,7 +4,6 @@ For further information, consult the LICENSE file in the root directory. \*****************************************************************************/ - #include #include "../snes9x.h" #include "apu.h" diff --git a/source/snes9x/apu/apu.h b/source/snes9x/apu/apu.h index 91722d1..07d233a 100644 --- a/source/snes9x/apu/apu.h +++ b/source/snes9x/apu/apu.h @@ -4,7 +4,6 @@ For further information, consult the LICENSE file in the root directory. \*****************************************************************************/ - #ifndef _APU_H_ #define _APU_H_ diff --git a/source/snes9x/apu/hermite_resampler.h b/source/snes9x/apu/hermite_resampler.h index 899223e..a0a8ec8 100644 --- a/source/snes9x/apu/hermite_resampler.h +++ b/source/snes9x/apu/hermite_resampler.h @@ -1,4 +1,8 @@ -/* Simple resampler based on bsnes's ruby audio library */ +/*****************************************************************************\ + Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. + This file is licensed under the Snes9x License. + For further information, consult the LICENSE file in the root directory. +\*****************************************************************************/ #ifndef __HERMITE_RESAMPLER_H #define __HERMITE_RESAMPLER_H diff --git a/source/snes9x/apu/resampler.h b/source/snes9x/apu/resampler.h index 4f8cf6f..d1125ba 100644 --- a/source/snes9x/apu/resampler.h +++ b/source/snes9x/apu/resampler.h @@ -1,4 +1,8 @@ -/* Simple resampler based on bsnes's ruby audio library */ +/*****************************************************************************\ + Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. + This file is licensed under the Snes9x License. + For further information, consult the LICENSE file in the root directory. +\*****************************************************************************/ #ifndef __RESAMPLER_H #define __RESAMPLER_H diff --git a/source/snes9x/apu/ring_buffer.h b/source/snes9x/apu/ring_buffer.h index eb8cbda..fb9cf58 100644 --- a/source/snes9x/apu/ring_buffer.h +++ b/source/snes9x/apu/ring_buffer.h @@ -1,4 +1,8 @@ -/* Simple byte-based ring buffer. Licensed under public domain (C) BearOso. */ +/*****************************************************************************\ + Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. + This file is licensed under the Snes9x License. + For further information, consult the LICENSE file in the root directory. +\*****************************************************************************/ #ifndef __RING_BUFFER_H #define __RING_BUFFER_H From d6fc51f01ad944975c1f7d176c3cf8f20bf3d0ef Mon Sep 17 00:00:00 2001 From: bladeoner Date: Sun, 30 Dec 2018 21:26:57 +0100 Subject: [PATCH 3/3] Backport some changes - Error: comma at end of enumerator list - Use strcspn instead of strtok for reentrancy - Include ctype.h --- source/snes9x/cheats2.cpp | 32 ++++++++++++++++++++++++-------- source/snes9x/messages.h | 2 +- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/source/snes9x/cheats2.cpp b/source/snes9x/cheats2.cpp index d0068ad..3918eb4 100644 --- a/source/snes9x/cheats2.cpp +++ b/source/snes9x/cheats2.cpp @@ -4,11 +4,24 @@ For further information, consult the LICENSE file in the root directory. \*****************************************************************************/ +#include + #include "snes9x.h" #include "memmap.h" #include "cheats.h" #include "bml.h" +static inline char *trim (char *string) +{ + int start; + int end; + + for (start = 0; string[start] && isspace (string[start]); start++) {} + for (end = start; string[end] && !isspace (string[end]); end++) {} + string[end] = '\0'; + return &string[start]; +} + static inline uint8 S9xGetByteFree (uint32 Address) { int block = (Address & 0xffffff) >> MEMMAP_SHIFT; @@ -394,20 +407,23 @@ SCheat S9xTextToCheat (char *text) SCheatGroup S9xCreateCheatGroup (const char *name, const char *cheat) { SCheatGroup g; - char *code; char *code_string = strdup (cheat); + char *code_ptr = code_string; + int len; g.name = strdup (name); g.enabled = false; - for (code = strtok (code_string, "+"); code; code = strtok (NULL, "+")) + for (len = strcspn (code_ptr, "+"); len; len = strcspn (code_ptr, "+")) { - if (code) - { - SCheat c = S9xTextToCheat (code); - if (c.address) - g.c.push_back (c); - } + char *code = code_ptr; + code_ptr += len + (code_ptr[len] == '\0' ? 0 : 1); + code[len] = '\0'; + code = trim (code); + + SCheat c = S9xTextToCheat (code); + if (c.address) + g.c.push_back (c); } delete[] code_string; diff --git a/source/snes9x/messages.h b/source/snes9x/messages.h index a7dfe74..6a9cb29 100644 --- a/source/snes9x/messages.h +++ b/source/snes9x/messages.h @@ -54,7 +54,7 @@ enum S9X_NOT_A_MOVIE_SNAPSHOT, S9X_SNAPSHOT_INCONSISTENT, S9X_AVI_INFO, - S9X_PRESSED_KEYS_INFO, + S9X_PRESSED_KEYS_INFO }; #endif