commit df3a2631ef5d9937684988694b9d250e6ad2ff2b
Author: Andrea Musuruane <musuruan(a)gmail.com>
Date: Sun Jul 10 14:41:52 2016 +0200
First import
.gitignore | 1 +
sources | 1 +
zboy-0.60-mbc5.patch | 44 ++++++++++++++++++++
zboy-0.60-sfmt.patch | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++
zboy.spec | 74 +++++++++++++++++++++++++++++++++
5 files changed, 234 insertions(+)
---
diff --git a/.gitignore b/.gitignore
index e69de29..4368198 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/zboy-0.60.tar.gz
diff --git a/sources b/sources
index e69de29..dd1e95d 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+05a2f3586a011be9d89ccce797901dd4 zboy-0.60.tar.gz
diff --git a/zboy-0.60-mbc5.patch b/zboy-0.60-mbc5.patch
new file mode 100644
index 0000000..db851b5
--- /dev/null
+++ b/zboy-0.60-mbc5.patch
@@ -0,0 +1,44 @@
+Index: mbc5.c
+===================================================================
+--- mbc5.c (revisione 84)
++++ mbc5.c (revisione 85)
+@@ -18,7 +18,7 @@
+ */
+
+
+-inline uint8_t MBC5_MemoryRead(int memaddr) {
++uint8_t MBC5_MemoryRead(int memaddr) {
+ if ((memaddr >= 0xA000) && (memaddr < 0xC000)) { /* RAM bank n
*/
+ return(MemoryBankedRAM[(CurRamBank << 13) + memaddr]);
+ } else if ((memaddr >= 0x4000) && (memaddr < 0x8000)) { /* ROM bank
#n */
+Index: mbc0.c
+===================================================================
+--- mbc0.c (revisione 84)
++++ mbc0.c (revisione 85)
+@@ -1,11 +1,11 @@
+ /*
+- --------------------------------------
+- This file is part of the zBoy project.
+- Copyright (C) Mateusz Viste 2010, 2011
+- --------------------------------------
+-
+- ROM-ONLY support
+-*/
++ * --------------------------------------------------------------------------
++ * This file is part of the zBoy project.
++ * Copyright (C) Mateusz Viste 2010, 2011, 2012, 2013, 2014, 2015
++ * --------------------------------------------------------------------------
++ *
++ * ROM-ONLY support
++ */
+
+
+ uint8_t MBC0_MemoryRead(int memaddr) {
+@@ -24,7 +24,5 @@
+
+
+ void MBC0_MemoryWrite(int memaddr, uint8_t DataByte) {
+- /*PRINT "MMU fatal error: Tried to write to an unknown memory address: ";
HEX(memaddr)
+- QuitEmulator = 1 */
+ MemoryMAP[memaddr] = DataByte;
+ }
diff --git a/zboy-0.60-sfmt.patch b/zboy-0.60-sfmt.patch
new file mode 100644
index 0000000..57d844c
--- /dev/null
+++ b/zboy-0.60-sfmt.patch
@@ -0,0 +1,114 @@
+Index: printmsg.c
+===================================================================
+--- printmsg.c (revisione 74)
++++ printmsg.c (revisione 75)
+@@ -3,10 +3,11 @@
+ */
+
+ void SetUserMsg(char *msg) {
+- sprintf(UserMessage, msg);
++ strcpy(UserMessage, msg);
+ UserMessageFramesLeft = 120; /* Make the message to be active for 120 frames (2s) */
+ }
+
++
+ void PrintMsg(char *txtorgmessage, unsigned char TransparentFlag) {
+ /* TransparentFlag = 1 --> Do not clear the screen, and do not print background
on chars
+ TransparentFlag = 0 --> Clear the screen before doing anything */
+@@ -15,7 +16,7 @@
+ signed int pixrow, pixcol, linenum = 0;
+ int x, textstring_len;
+ char textstring[1024], txtmessage[1024];
+- snprintf(txtmessage, 1023, txtorgmessage);
++ strncpy(txtmessage, txtorgmessage, 1023);
+ if (TransparentFlag == 0) {
+ for (pixcol = 0; pixcol < 160; pixcol++) {
+ for (pixrow = 0; pixrow < 144; pixrow++) ScreenBuffer[pixcol][pixrow] = 254;
+Index: Makefile.dos
+===================================================================
+--- Makefile.dos (revisione 74)
++++ Makefile.dos (revisione 75)
+@@ -1,4 +1,4 @@
+-CFLAGS = -s -std=gnu89 -O3 -Wall -Wextra -pedantic -Wfatal-errors -Wstrict-prototypes
-D__zboy4dos__
++CFLAGS = -s -std=gnu89 -O3 -Wall -Wextra -pedantic -Werror=format-security
-Wfatal-errors -Wstrict-prototypes -D__zboy4dos__
+
+
+ all: zboy.exe
+Index: zboy.c
+===================================================================
+--- zboy.c (revisione 74)
++++ zboy.c (revisione 75)
+@@ -300,7 +300,7 @@
+ } else { /* anything else is assumed to be a filename */
+ if (argv[x][0] != 0) { /* ignore if the parameter is empty */
+ if (RomInfos.Filename[0] == 0) {
+- snprintf(RomInfos.Filename, 1022, argv[x]);
++ strncpy(RomInfos.Filename, argv[x], 1022);
+ } else {
+ RomInfos.Filename[0] = 0; /* Clear out filename, to make sure to display
usage screen later */
+ x = 250; /* make sure to quit parsing now */
+@@ -374,7 +374,7 @@
+ /* if a custom color palette has been provided, load it */
+ if (zboyparams.custcolor != NULL) {
+ if (LoadPaletteFromFile(zboyparams.custcolor, ScreenPalette32) != 0) {
+- sprintf(UserMessage, "LOADING THE CUSTOM PALETTE FAILED");
++ strcpy(UserMessage, "LOADING THE CUSTOM PALETTE FAILED");
+ PrintMsg(UserMessage, 0);
+ RefreshScreen(0, 159, 0, 143, &zboyparams);
+ PressAnyKey();
+@@ -470,7 +470,7 @@
+ if (RomInfos.NiceTitle[0] != 0) {
+ snprintf(zboyparams.windowtitle, 256, "%s (zBoy)", RomInfos.NiceTitle);
+ } else {
+- snprintf(zboyparams.windowtitle, 256, "zBoy");
++ strncpy(zboyparams.windowtitle, "zBoy", 256);
+ }
+ drv_setwintitle(zboyparams.windowtitle);
+
+Index: Makefile.win
+===================================================================
+--- Makefile.win (revisione 74)
++++ Makefile.win (revisione 75)
+@@ -1,5 +1,5 @@
+ INCLUDE = /mingw/include
+-CFLAGS = -s -std=gnu89 -O3 -Wall -pedantic -Wfatal-errors -Wstrict-prototypes
-D__zboy4windows__ -DNETPLAY -DLFNAVAIL
++CFLAGS = -s -std=gnu89 -O3 -Wall -pedantic -Werror=format-security -Wfatal-errors
-Wstrict-prototypes -D__zboy4windows__ -DNETPLAY -DLFNAVAIL
+
+
+ zboy.exe: about.o drv_sdl2.o loadpal.o loadrom.o net_sock.o config.o crc32.o wordwrap.o
zboy.o
+Index: Makefile.linux
+===================================================================
+--- Makefile.linux (revisione 74)
++++ Makefile.linux (revisione 75)
+@@ -1,4 +1,4 @@
+-CFLAGS = -s -std=gnu89 -O3 -Wall -Wextra -pedantic -Wfatal-errors -Wstrict-prototypes
-D__zboy4linux__ -DNETPLAY -DLFNAVAIL
++CFLAGS = -s -std=gnu89 -O3 -Wall -Wextra -pedantic -Werror=format-security
-Wfatal-errors -Wstrict-prototypes -D__zboy4linux__ -DNETPLAY -DLFNAVAIL
+ #CFLAGS += -DDEBUGMODE
+
+
+Index: loadrominfos.c
+===================================================================
+--- loadrominfos.c (revisione 74)
++++ loadrominfos.c (revisione 75)
+@@ -19,7 +19,7 @@
+ while ((TempString[x] > 31) && (TempString[x] < 127) && (x <
16)) x++;
+ TempString[x] = 0; /* Trim all zeroed bytes at the end, as well as high bytes
(occuring on new-style licenses) */
+ /*TempString = TRIM(TempString) */ /* Trim any spaces on both ends of the string
*/
+- sprintf(RomInfos->Title, TempString);
++ sprintf(RomInfos->Title, "%s", TempString);
+
+ /* Now let's see if we can fix the title in any possible way... */
+
+Index: mmu.c
+===================================================================
+--- mmu.c (revisione 74)
++++ mmu.c (revisione 75)
+@@ -127,7 +127,7 @@
+ }
+ } else {
+ sprintf(UserMessage, "MMU FATAL ERROR!\nTRIED TO RUN LCD OAM DMA TRANSFER
USING AN INVALID RANGE!");
+- printf(UserMessage);
++ printf("%s", UserMessage);
+ PrintMsg(UserMessage, 0);
+ PressAnyKey();
+ exit(0);
diff --git a/zboy.spec b/zboy.spec
new file mode 100644
index 0000000..8c42ffb
--- /dev/null
+++ b/zboy.spec
@@ -0,0 +1,74 @@
+Name: zboy
+Version: 0.60
+Release: 2%{?dist}
+Summary: A GameBoy emulator
+
+License: GPLv3
+URL:
http://zboy.sourceforge.net/
+Source0:
http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
+# Fix format strings
+#
http://sourceforge.net/p/zboy/code/75/
+Patch0: %{name}-0.60-sfmt.patch
+# Fix compiling with GCC 5.1
+#
http://sourceforge.net/p/zboy/code/85/
+Patch1: %{name}-0.60-mbc5.patch
+
+BuildRequires: SDL2-devel
+
+
+%description
+zBoy is a multiplatform GameBoy emulator that provides a load/save feature,
+can perform PCX screenshots either manually or automatically (every few
+seconds) and emulates an internal battery for ROMs that were designed to use
+one (this allows to use the internal save option provided by such games,
+remember highest scores, etc).
+
+zBoy supports some additional features, too, like intelligent saving of
+hi-scores for some games that aren't able to save their hi-scores table by
+themselves because of the lack of a battery-backed RAM on the cartridge, and
+improving screen's resolution output using graphic algorithms like Scale2x,
+Scale3x, eagle...
+
+It is also one of the very few GameBoy emulators that provides a 2-gameboys
+link emulation, which makes it possible to play some games in 2-players mode
+on a LAN.
+
+
+%prep
+%setup -q
+%patch0 -p0
+%patch1 -p0
+
+# Use standard Fedora CFLAGS to compile
+sed -i 's/^CFLAGS = -s -std=gnu89 -O3 -Wall -Wextra -pedantic -Werror=format-security
-Wfatal-errors -Wstrict-prototypes/CFLAGS +=/' Makefile.linux
+
+# Fix end-of-line encoding
+for txtfile in license.txt history.txt todo.txt zboy.txt
+do
+ sed -i 's/\r//' $txtfile
+done
+
+
+%build
+export CFLAGS="%{optflags}"
+make %{?_smp_mflags} -f Makefile.linux
+
+
+%install
+mkdir -p %{buildroot}%{_bindir}
+install -p -m 0755 %{name} %{buildroot}%{_bindir}
+
+
+%files
+%{_bindir}/%{name}
+%license license.txt
+%doc colorize.txt history.txt todo.txt zboy.txt
+
+
+%changelog
+* Sun Oct 04 2015 Andrea Musuruane <musuruan(a)gmail.com> 0.60-2
+- Correctly marked license file
+
+* Thu May 14 2015 Andrea Musuruane <musuruan(a)gmail.com> 0.60-1
+- First release
+