Giter Site home page Giter Site logo

xyproto / zsnes Goto Github PK

View Code? Open in Web Editor NEW
110.0 8.0 16.0 8.49 MB

A maintained fork of ZSNES, a Super Nintendo emulator. The original project needs patches to build and is not maintained anymore: https://sourceforge.net/projects/zsnes/

Home Page: https://zsnes.com

License: GNU General Public License v2.0

Makefile 0.20% C 41.44% Assembly 46.24% C++ 6.25% Shell 0.02% POV-Ray SDL 5.84%
linux emulator snes patched supernintendo zsnes lts

zsnes's Introduction

ZSNES 2

logo

The last release of ZSNES was well over 16 years ago. It requires heavy patching and tweaking of compilation flags to build and run on a modern Linux distro.

This is a fork of ZSNES that aims to solve this.

Running make produces a 32-bit x86 ELF executable with MMX support, that can be run on a 64-bit x86 system. Large parts of ZSNES is written in 32-bit x86 Assembly, which is not easily ported to other platforms or systems. SSE support is disabled.

Goals and non-goals:

  • Compiling ZSNES so that it works on 64-bit x86 is a goal (that has been reached).
  • Supporting 32-bit platforms is not a goal, but pull requests are welcome.
  • Supporting Windows is not a goal, but pull requests are welcome.
  • Supporting modern Linux distros (and FreeBSD, if possible) is a goal.
  • To be like an LTS release of ZSNES is a goal.
  • Porting ZSNES to SDL2 is a long term goal.
  • Adding back a more secure version of the net-play code is a long term goal.

Pull requests that fixes inaccuracies with the emulation are welcome, as well as pull requests for regular bugs.

  • Currently, sdl1 (or better: sdl12-compat) is a required dependency.
  • The sdl2 branch is a work-in-progress branch where ZSNES can be compiled with SDL2 but it does not yet run correctly.

Tested on Arch Linux, Fedora and Debian 12 on x86_64.

Build

make

For other platforms than Linux, adjust the first 70 lines of the Makefile as needed.

Debug build

Make sure that gdb is installed. Then:

make clean debug

Then type r in gdb to run zsnes with the example ROM (~/roms/snes/example.sfc must exist). Use ie. bt full to see the backtrace if ZSNES crashes.

Install

make install

Installing a desktop shortcut is possible. A zsnes.desktop file is included in linux/zsnes.desktop. It could also be generated with gendesk. If you have a suitable icon named zsnes.png then they can both be installed with:

install -Dm644 zsnes.png /usr/share/pixmaps/zsnes.png
install -Dm644 zsnes.desktop /usr/share/applications/zsnes.desktop

For other platforms than Linux, different flags may apply. ZSNES is primarily one executable, but for UNIX-inspired operating systems, the man page (man/zsnes.1) can be installed as ie. /usr/share/man/man1/zsnes.1 (this is handled by make install, though).

Debian and Ubuntu

Try installing ZSNES from this flatpak, or see if the following commands works for you, on x86_64. Please create a PR if they don't:

dpkg --add-architecture i386
apt update
apt install -y git make nasm pkg-config zlib1g-dev build-essential
git clone https://github.com/xyproto/zsnes
cd zsnes
make
apt install -y g++-multilib gcc-multilib libgl-dev libgl-dev:i386 libpng-dev libpng-dev:i386 libsdl1.2-compat-dev libsdl1.2-compat-dev:i386 libsdl2-dev zlib1g-dev zlib1g-dev:i386
make

Pull requests

  • Pull requests are welcome.
  • A port to SDL2 is extra warmly welcome!
  • Being able to build and run ZSNES on Linux is a priority.
  • Please have clang-format installed and run ./fmt.sh before submitting a pull request.

Windows users

General info

Thanks to Christoph Mallon for the commits that this fork is based on.

Old documentation

  • Some of the information in the old text files in docs/readme.txt/*.txt has not yet been ported over to the linux/zsnes.1 man page, or to a Markdown document.
  • The plan is to do this. Pull requests are welcome.

This is a summary based on the other text files that were not in docs/readme.txt/*.txt:

List of contributors

These are the contributors listed in the text files that are included with the 1.51 release of ZSNES, and on the zsnes.com webpage:

  • zsKnight
  • _Demo_
  • pagefault
  • Nach
  • grinvader
  • Deathlike2
  • Jonas Quinn
  • blargg
  • Pharos
  • teuf
  • relnev
  • prometheus
  • theoddone33
  • EvilTypeGuy
  • stainless
  • aaronl
  • MKendora
  • kode54
  • zinx
  • amit
  • Khan Artist
  • hpsolo
  • Kreed
  • Neviksti
  • ipher
  • relnev
  • StatMat
  • MKendora
  • hpsolo
  • aaronl
  • Diablo-D3
  • Wilbern Cobb
  • Thorsten "mirabile" Glaser
  • Mitchell "The Khan Artist/Noxious Ninja" Mebane

Additional info from the text files that came with ZSNES 1.51:

How OpenGL renders the SNES video buffer

The SNES video buffer has dimensions 288x224 (sometimes 288x239 for certain games; however I have not come across any). The first 16 and last 16 column of pixels are not displayed (perhaps used as a scrolling buffer?), so the only important part of the video buffer is the middle 256x224 pixels. The SNES video buffer pointer is vidbuffer. With OpenGL, only the visible 256x224 pixels are needed and they are cropped into glvidbuffer. glvidbuffer is then turned into a texture that gets bound to a QUAD whose size depends on whether ZSNES uses aspect ratio to display each frame.

Hi-res filters with OpenGL

The video mode selection is taken care of by SDL, including full screen mode. The current code does not allow for many hi-res filter options. While it is not difficult to implement the hi-res features using the current filtering code (in copyvwin.asm), it appears that the code for copy640x480x16bwin() causes memory corruption and sometimes segfaults when you exit ZSNES. For this reason, the filters have been left out. You can, however, add it in yourself by:

  1. Allocating enough memory space for glvidbuffer (use realloc)
  2. Assign glvidbuffer to the destination pointer SurfBufD (instead of surface->pixels)
  3. Setting Temp1 to surface->pitch, i.e. Temp1 = 2*SurfaceX
  4. Calling copy640x480x16bwin()
  5. Correctly binding the glvidbuffer as a texture to a QUAD

Known issues and some work-arounds

  • After many video mode switches (all windowed), switching to full screen then back to window mode cases an SDL parachute exit; try not to use too many video mode changes, and restart ZSNES every once in a while if you are just testing out video modes.

  • Segfault after having compiled the source -- this might be due to an old zguicfg.dat file; delete this and see if the problem gets fixed.

File list

; Porting Routine Files

-DOS-
ZLOADER.C       ; Start-up C routines for DOS (Commandline parser, etc.)
DOSINTRF.ASM    ; DOS Interface routines (File,video,timers,etc.)

-WINDOWS-
ZLOADERW.C      ; Start-up C routines for Windows (Commandline parser, etc.)
Winintrf.asm    ; Windows Interface routines (File,video,timers,etc.)
winlink.cpp     ; Win32 routines (DirectX, Win32 functions)
copyvwin.asm    ; Video Blitter for D modes

-LINUX-
copyvwin.asm    ; Video Blitter for D modes
gl_draw.c       ; OpenGL routines for drawing the video buffer
gl_draw.h       ;
protect.c       ;
sdllink.c       ; SDL routines (video, input, sound init)
sdlintrf.asm    ; Interface routines
sw_draw.c       ; Software (via SDL) drawing routines
sw_draw.h       ;
zfilew.c        ;
zipxw.c         ;
zloaderw.c      ;

-MAN-
zsnes.1         ; man page for zsnes

; ----------------------------------------------------------------
; The following are generally compiled for both ports, but they
; are not necessarily used by both
; ----------------------------------------------------------------

; General Stuff
MACROS.MAC      ; Global Macro file (NEWSYM/EXTSYM global var control macros)
UI.ASM          ; Start-up/initialization routines (env variables, cfg
                ; loader, memory allocation, etc.)
INIT.ASM        ; Emulation initialization routines (eg. memory map, emu
                ; variables, etc.)
CFGLOAD.ASM     ; ZSNES.CFG/ZSNESW.CFG file loading/parsing routines
PROCVID.ASM     ; In-game video initialization/text displays/mouse routines/
                ; 8-bit palette/F3 menu routines
TABLE.ASM       ; Generates the SNES CPU tables (but in an inefficient way)
TABLEB.ASM
TABLEC.ASM
STABLE.ASM
VCACHE.ASM      ; Performs tile caching and also vframe initialization stuff
MENU.ASM        ; F1 Menu routines
ENDMEM.ASM      ; Where those large arrays go
ZFILE.C         ; File Access Routines
GBLHDR.H        ; Global Header Stuff

; ZSNES GUI Stuff
GUI.ASM         ; Main GUI file
GUITOOLS.INC    ; Simple tools for the GUI
GUIWINDP.INC    ; GUI Window Display Routines
GUINETPL INC    ; GUI Netplay Routines
GUILOAD  INC    ; GUI File Load Routines
GUIKEYS  INC    ; GUI Keyboard Input Routines
GUIMOUSE INC    ; GUI Mouse Input Routines
GUICHEAT INC    ; GUI Cheat Code Routines (search + regular codes)
GUICOMBO INC    ; GUI Key Combo Routines
GUIMISC  INC    ; Misc GUI Stuff (Movie, Joystick setting (display) routines,
                ; SNES Reset Function

; DOS Specific stuff
VESA2.ASM       ; VESA2 DOS Routines
VESA12.ASM      ; VESA1.2 DOS Routines
ZSIPX.ASM       ; IPX routines (DOS)
JOY.ASM         ; DOS Joystick Drivers
COPYVID.INC     ; Graphics blitter routines for DOS (copys screen to display)
INITVID.ASM     ; Video Initialization routines (DOS)
DEBUG.ASM       ; SNES Debugger routines
SW.ASM          ; Sidewinder routines
SW32.ASM        ; More Sidewinder routines (not sure which file is the real
                ;   one)
GPPRO.ASM       ; Gamepad Pro routines (non-USB)
MODEMRTN.ASM    ; DOS Modem routines

; Graphics Enhancers
2XSAIMMX.INC    ; Kreed's 2xSaI routines
2xSaI.cpp       ; Kreed's Super 2xSaI routines
2xsaiw.asm      ; 2xSaI for windows (without selector usage)
water.c         ; Water Effect

; SNES CPU Emulation routines
execute.asm     ; Main emulation execution loop routines (includes save
                ;   states and in-game netplay routines)
SPC700.ASM      ; SNES SPC700 Sound CPU emulation routine files
SPCADDR.INC
SPCDEF.INC
DSPPROC.ASM     ; SNES Digital Sound Processor main emulation routines
DSP.ASM         ; SNES Digital Sound Processor register routines
DMA.ASM         ; SNES PPU DMA/HDMA routines
IRQ.ASM         ; SNES 65816 IRQ routines (VIRQ/NMI)
MEMORY.ASM      ; SNES Memory access routines + C4 routines (Sorry that I
                ;   didn't have these in a separate file since a small memory
                ;   hack of the C4 originated on this file and just grew and
                ;   grew)
E65816.INC      ; 65816 emulation routines (w/o SPC700)
65816D.INC
E65816B.INC     ; 65816 emulation routines (Debugger I think)
65816DB.INC
E65816C.INC     ; 65816 emulation routines (w/ SPC700) - Sorry about these
                ;   3 files.  They used to be just 1 until I removed the
                ;   self-modifying code routines
65816DC.INC
SE65816.INC     ; 65816 emulation routines (SA-1)
S65816D.INC
ADDRNI.ASM      ; 65816 Non-incrementing addressing modes
ADDRNI.INC
SADDRNI.INC
ADDRESS.INC     ; 65816 Incrementing addressing modes
ADDRESS2.INC
SADDRESS.INC
REGS.INC        ; SNES I/O register emulation
REGS.MAC
REGSW.INC
REGSW.MAC

; SNES PPU Emulation Routines
MAKEVID.ASM     ; 8-bit old graphics engine
MAKEV16B.ASM    ; 16-bit old graphics engine
MAKEV16T.ASM    ; 16-bit old graphics engine (transparencies)
MV16TMS.ASM     ; 16-bit old graphics engine (transp w/ Main+Sub enabled)
MODE7.ASM       ; 8-bit mode 7 routines
MODE7.MAC
MODE7EXT.ASM    ; 8-bit mode 7 EXTBG routines
MODE716B.ASM    ; 16-bit mode 7 routines
MODE716T.ASM    ; 16-bit mode 7 routines (transparencies)
MODE716E.ASM    ; 16-bit mode 7 EXTBG routines
M716TEXT.ASM    ; 16-bit mode 7 EXTBG routines (transparencies)
MODE716D.ASM    ; 16-bit mode 7 Direct routines
mode716.asm     ; Mode 7 16-bit new graphics engine routines
mode716.mac
NEWGFX.ASM      ; 8-bit new graphics engine files
NEWGFX.MAC
NEWGFX2.ASM
NEWGFX2.MAC
NEWGFXB.MAC
NEWGFXWN.MAC
newgfx16.asm    ; 16-bit new graphics engine files
newgfx16.mac
NEWG162.ASM
newg162.mac
NEWG163.MAC
NEWG16WN.MAC
VIDMACRO.MAC    ; Generic Video Macros File
VIDMACRB.MAC

; Special Chip Emulation Routines
FXEMU2.ASM      ; Super FX emulation files
FXEMU2.MAC
FXEMU2B.ASM
FXEMU2B.MAC
FXEMU2C.ASM
FXEMU2C.MAC
FXTABLE.ASM
SFXPROC.ASM
DSP1PROC.ASM    ; DSP1 communication routines
DSP1EMU.C       ; DSP1 C routines (also includes some C4 C routines)
SA1PROC.ASM     ; SA-1 processing routinest
SA1REGS.ASM     ; SA-1 registers, also includes S-DD1 and SPC7110 routines

Issues

All ports

  • Recode netplay feature, once core is not random anymore.

SDL Port

  • Low performance due to differences in surface sizes (internal and SDL), make both the same size.
  • OpenGL code is awful, incomprehensible, stupid and awful again. We must fix it.
  • Support overscan in games like Dragon Quest 5

Windows port

  • OpenGL, or Direct3D support would be nice (we have the source for OpenGL but it needs to be integrated into the main tree, any takers?)
  • Windows port should be converted to Direct3D from DirectDraw 7.0.
  • Windows sound code needs to be rewritten to reflect the SDL port.

Compatibility

  • Games not working:
    • Guikuden 1
    • Cu-On-Pa
    • Loads more
  • Graphics Glitches:
    • Killer Instinct (black background)
    • Final Fantasy III (known as Final Fantasy VI in Japan; Range Time Over and other sprite trouble)
    • Tactic Ogre (Menus)
    • Lots of others
  • Special Chips:
    • DSP1 (99% done)
    • DSP3 (50% done)
    • DSP4 (99% done)
    • SA-1 (95% done)
    • SPC7110 (Needs decompression)
    • SFX1/2 (95% done)
    • Seta 11 (25% done)
    • Seta 18 (1% done)
    • BS-X (50% done)

Timing engine

  • Convert counter to 32-bit. (assigned to pagefault).
  • Fix 65816 timing and take into consideration cycle differences in 8/16-bit mode, branches etc.

Graphics Engine

  • Fix some windowing/sub-screen sprite problems that are still present in the new graphics engine. Probably pagefault will have to do this.

zsnes's People

Contributors

chmallon avatar jakobdev avatar jeffythedragonslayer avatar maizenalegal avatar miepee avatar trashraccoonsnuffy avatar xyproto avatar zapeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zsnes's Issues

Detection of PAL/NTSC games is completely broken.

Some games such as Top Gear 2 are detected as PAL incorrectly by ZSNES, which leads to them being unplayable.
image

Current workaround for this issue is to force the game to boot as NTSC by loading it from the Load File menu and ticking the force NTSC tick box.
image
image

Most likely an issue in header detection. The game works completely fine if NTSC is forced.

Cannot build on Ubuntu 20 with instructions on repository.

I am running a 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz (lscpu says it's x86_64), and running make seems to give the following results:
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libz.so when searching for -lz /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libz.a when searching for -lz /usr/bin/ld: cannot find -lz: No such file or directory /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libz.so when searching for -lz /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libX11.so when searching for -lX11 /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libX11.a when searching for -lX11 /usr/bin/ld: cannot find -lX11: No such file or directory /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libX11.so when searching for -lX11 /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libSDL.so when searching for -lSDL /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libSDL.a when searching for -lSDL /usr/bin/ld: cannot find -lSDL: No such file or directory /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libSDL.so when searching for -lSDL /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpng16.so when searching for -lpng16 /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpng16.a when searching for -lpng16 /usr/bin/ld: cannot find -lpng16: No such file or directory /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpng16.so when searching for -lpng16 /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libz.so when searching for -lz /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libz.a when searching for -lz /usr/bin/ld: cannot find -lz: No such file or directory /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libz.so when searching for -lz /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libGL.so when searching for -lGL /usr/bin/ld: cannot find -lGL: No such file or directory /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libGL.so when searching for -lGL

I saw issue #15 and I thought it might have been related, are the libraries necessary still i386?

I actually managed to get way further in compilation by removing -m32 from the cflags, the
ifeq ($(wildcard /usr/lib/i386-linux-gnu/.),)
line in the Makefile and changing the flags inside to
CFLAGS += -I/usr/include/x86_64-linux-gnu -I /usr/include/X11 CXXFLAGS += -I/usr/include/x86_64-linux-gnu -I /usr/include/X11 LDFLAGS = -Wl,--as-needed -no-pie -Wl,--gc-sections -lz -lSDL-1.2 -lpng16 -lX11

and now the errors are only
/usr/bin/ld: cannot find -lSDL-1.2: No such file or directory /usr/bin/ld: skipping incompatible /usr/lib32/libm.so when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib32/libm.a when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib32/libm.so when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib32/libm.a when searching for -lm

The libm issue seems pretty easy to fix, but I'm not sure about lsdl2 or if removing -m32 is safe at all.

build error: c_init.c:296:26: error: ‘pl1upk’ undeclared

Hello,

I'm trying to package this for GNU Guix, but I'm hitting the following compilation error:

===> CC chips/7110emu.c
gcc -I/gnu/store/8gq4c2s5y3sdbmx661ddnhx2d75q99wi-sdl12-compat-1.2.68/include/SDL  -c -MMD -o c_init.o c_init.c
gcc -I/gnu/store/8gq4c2s5y3sdbmx661ddnhx2d75q99wi-sdl12-compat-1.2.68/include/SDL  -c -MMD -o chips/7110emu.o chips/7110emu.c
c_init.c: In function ‘ReadInputDevice’:
c_init.c:296:26: error: ‘pl1upk’ undeclared (first use in this function); did you mean ‘pl5upk’?
  296 |         PlayerDeviceHelp(pl1upk, &JoyAOrig, 0x08000000);
      |                          ^~~~~~
      |                          pl5upk
c_init.c:296:26: note: each undeclared identifier is reported only once for each function it appears in
c_init.c:297:26: error: ‘pl1downk’ undeclared (first use in this function); did you mean ‘pl5downk’?
  297 |         PlayerDeviceHelp(pl1downk, &JoyAOrig, 0x04000000);
      |                          ^~~~~~~~
      |                          pl5downk
c_init.c:298:26: error: ‘pl1leftk’ undeclared (first use in this function); did you mean ‘pl5leftk’?
  298 |         PlayerDeviceHelp(pl1leftk, &JoyAOrig, 0x02000000);
      |                          ^~~~~~~~
      |                          pl5leftk
c_init.c:299:26: error: ‘pl1rightk’ undeclared (first use in this function); did you mean ‘pl5rightk’?
  299 |         PlayerDeviceHelp(pl1rightk, &JoyAOrig, 0x01000000);
      |                          ^~~~~~~~~
      |                          pl5rightk
make: *** [Makefile:365: c_init.o] Error 1
make: *** Waiting for unfinished jobs....
c_vcache.c: In function ‘ConvertToAFormat’:
c_vcache.c:556:9: error: impossible constraint in ‘asm’
  556 |         asm volatile(
      |         ^~~
make: *** [Makefile:365: c_vcache.o] Error 1
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "make" arguments: ("-j" "4" "CC=gcc" "CXX=g++" "CFLAGS=-I/gnu/store/8gq4c2s5y3sdbmx661ddnhx2d75q99wi-sdl12-compat-1.2.68/include/SDL") exit-status: 2 term-signal: #f stop-signal: #f> 
phase `build' failed after 7.3 seconds
command "make" "-j" "4" "CC=gcc" "CXX=g++" "CFLAGS=-I/gnu/store/8gq4c2s5y3sdbmx661ddnhx2d75q99wi-sdl12-compat-1.2.68/include/SDL" failed with status 2
builder for `/gnu/store/spcy144d6iizpm88xq06mpq45g02fwrb-zsnes-2.0.12.drv' failed with exit code 1
build of /gnu/store/spcy144d6iizpm88xq06mpq45g02fwrb-zsnes-2.0.12.drv failed
View build log at '/var/log/guix/drvs/sp/cy144d6iizpm88xq06mpq45g02fwrb-zsnes-2.0.12.drv'.
guix build: error: build of `/gnu/store/spcy144d6iizpm88xq06mpq45g02fwrb-zsnes-2.0.12.drv' failed

It seems the symbols pl1upk and friends are never defined. Looking at the source code, I see they are referred as external globals in input.h, but can't see their actual definition anywhere. Where are these supposed to be defined?

Thank you!

Graphical issues on Yoshi's Island

image
image
image

Most likely related to improper HDMA/DMA emulation (or the code being converted wrongly for 64-bit?), the game looks fine on ZSNES 1.51 and 1.42

Ability for exclusive fullscreen and select monitor.

Last time I used ZSNES, the old version when it could still be compiled on modern hardware, going into fullscreen would change the resolution on the monitor.

When I go into fullscreen it now doesn't, it stretches nicely, and looks very nice on LCDs. The thing is, though, I've got a CRT which I would love to run the native resolution on, but this doesn't work. It's also a pain to make ZSNES run in fullscreen on it, as it's the secondary monitor. It would be nice to have a monitor selection.

Thank you.

Segmentation fault on Fedora 37

Hello,

ZSNES segfaults immediately during startup on Fedora 37.
I don't know if the same happens on the 36 release, but on Fedora 35 it was working fine.
Please tell me if I can do something to help.

Thanks

Add the Netplay feature from 1.42n

The one feature that really kept me using ZSNES was the built-in netplay.
It used it about 4 years ago to play online with a friend. Lots of fun, the windows build and the linux build worked together effortlessly.

Do you have any idea of how much effort it would involve to apply your changes to the 1.42 version? That was the last version with netplay enabled.

P.S.
I just found your contribution to ZSNES on the AUR today, and I'd like to say thank you so much for your work.
I remember trying to build it when I played years ago and I couldn't for the life of me get it working, so I had to scour websites for a sketchy linux build.

Universal SDL port + removing DOS support (2.0.13)

It's currently extremely hard nowadays to compile ZSNES for DOS, even with all the right tools such as DJGPP, older versions of borland C, etc, it is just simply way too outdated to the point where you really need to emulate or have the older hardware to do the compilation process. There should be an effort to clean up the codebase and remove all the DOS related code to make it easier to maintain and reduce the amount of bugs that come from it. 1.51 and 1.42 are pretty good versions for DOS, either way.

The official (albeit unreleased) ZSNES 1.53 removed MS-DOS support already. https://board.zsnes.com/phpBB3/viewtopic.php?t=139390

I prefer to wait on a response to this, as I'm planning to help with the major rewrite of the SDL interface and a proper port to SDL 2.0 so that there is only one universal version of the code that works with both Windows and Linux with their specific compilation tools.

question: what is the goal of this?

are you working to improve upon zsnes, or just make it easy to compile on modern systems? what exactly is it that you want to do with this? saw this repo and my interest sparked for some odd reason. ive always liked zsnes's ui but hated how inaccurate it was..

Add support for 8MB SA-1/SDD-1 roms

Currently, 8MB roms that utilize SA-1 or SDD-1 are not recognized by ZSNES and cannot be opened. There was a fork of the program that added support for these roms here https://fusoya.eludevisibility.org/emulator/zsnes8.html (source code linked on page as well) and if possible, the changes from it should be ported to here.

I could look into porting this feature to the repository, but I am unable to compile it on Ubuntu 20.04, so perhaps instructions should be added for it?

Flatpak

I created a Flatpak build for ZSNES. You need this files:

io.github.xyproto.zsnes.yaml

id: io.github.xyproto.zsnes
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: zsnes
finish-args:
  - --share=ipc
  - --device=all
  - --socket=x11
  - --allow=multiarch
  - --socket=pulseaudio
  - --filesystem=host:rw

sdk-extensions:
  - org.freedesktop.Sdk.Compat.i386
  - org.freedesktop.Sdk.Extension.toolchain-i386

add-extensions:
  org.freedesktop.Platform.Compat.i386:
    directory: lib/i386-linux-gnu
    version: '22.08'

  org.freedesktop.Platform.GL32:
    directory: lib/i386-linux-gnu/GL
    version: '1.4'
    versions: 22.08;1.4
    subdirectories: true
    no-autodownload: true
    autodelete: false
    add-ld-path: lib
    merge-dirs: vulkan/icd.d;glvnd/egl_vendor.d;OpenCL/vendors;lib/dri;lib/d3d;vulkan/explicit_layer.d;vulkan/implicit_layer.d
    download-if: active-gl-driver
    enable-if: active-gl-driver

build-options: &compat-i386-build-options
  prepend-pkg-config-path: /app/lib32/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig
  ldflags: -L/app/lib32
  prepend-path: /usr/lib/sdk/toolchain-i386/bin
  env:
    CC: i686-unknown-linux-gnu-gcc
    CXX: i686-unknown-linux-gnu-g++
    CFLAGS: ''
    CXXFLAGS: ''
  libdir: /app/lib32

modules:
  - shared-modules/SDL/SDL-1.2.15.json

  - name: zsnes
    buildsystem: simple
    build-commands:
      - make
      - mkdir -p /app/lib/i386-linux-gnu
      - mkdir -p /app/lib/debug/lib/i386-linux-gnu
      - mkdir -p /app/lib/i386-linux-gnu/GL
      - install -Dm755 zsnes -t $FLATPAK_DEST/bin
      - install -Dm644 ld.so.conf -t $FLATPAK_DEST/etc
      - install -Dm644 io.github.xyproto.zsnes.png -t $FLATPAK_DEST/share/icons/hicolor/128x128/apps
      - install -Dm644 linux/zsnes.desktop $FLATPAK_DEST/share/applications/$FLATPAK_ID.desktop
      - desktop-file-edit --set-icon=$FLATPAK_ID --set-key=Exec --set-value="zsnes %f" --add-mime-type=application/vnd.nintendo.snes.rom --add-mime-type=application/x-snes-rom $FLATPAK_DEST/share/applications/$FLATPAK_ID.desktop
      - install -Dm644 io.github.xyproto.zsnes.metainfo.xml -t $FLATPAK_DEST/share/metainfo
    sources:
      - type: archive
        url: https://github.com/xyproto/zsnes/archive/refs/tags/2.0.10.tar.gz
        sha256: 18d503e5839dfdc74d4c889b824757596bbe27b8f97ca148ceb2537e420848a5
      - type: patch
        path: xdg-dir.patch
      - type: inline
        dest-filename: ld.so.conf
        contents: |
          /app/lib32
          /app/lib/i386-linux-gnu
      - type: file
        path: io.github.xyproto.zsnes.png
      - type: file
        path: io.github.xyproto.zsnes.metainfo.xml

xdg-dir.patch

diff -ruN original/zpath.c zsnes/zpath.c
--- original/zpath.c    2023-04-12 10:19:44.435685652 +0200
+++ zsnes/zpath.c       2023-04-12 10:19:03.652352332 +0200
@@ -76,7 +76,7 @@
     const char* const zpath = ZCONF;
 #else
 #ifndef __MACOSX__
-    const char* const zpath = ".zsnes";
+    const char* const zpath = "zsnes";
 #else
     const char* const zpath = "Library/Application Support/ZSNES";
 #endif
@@ -90,7 +90,7 @@

     if (ZCfgPath) {
         ZCfgAlloc = true;
-        strcpy(ZCfgPath, userinfo->pw_dir);
+        strcpy(ZCfgPath, getenv("XDG_CONFIG_HOME"));
         strcatslash(ZCfgPath);
         strcat(ZCfgPath, zpath);

io.github.xyproto.zsnes.metainfo.xml

<?xml version='1.0' encoding='utf-8'?>
<component type="desktop">
  <!--Created with jdAppStreamEdit 6.0-->
  <id>io.github.xyproto.zsnes</id>
  <name>ZSNES</name>
  <summary>Super Nintendo emulator</summary>
  <developer_name>Alexander F. Rødseth</developer_name>
  <launchable type="desktop-id">io.github.xyproto.zsnes.desktop</launchable>
  <metadata_license>CC0-1.0</metadata_license>
  <project_license>GPL-2.0</project_license>
  <description>
    <p>ZSNES is a classical SNES Emulator. It's development started 1998 and is was one of the most uses SNES Emulators for years.</p>
    <p>Today you should use ZSNES only for historical and nostalgia reasons, as there are Emulators ot there which provides more Features and a better Game compatibility.</p>
  </description>
  <screenshots>
    <screenshot type="default">
      <image type="source">https://upload.wikimedia.org/wikipedia/commons/5/5d/ZSNES.jpg</image>
    </screenshot>
  </screenshots>
  <releases>
    <release version="2.0.10" date="2022-06-13" type="stable"/>
    <release version="2.0.9" date="2021-08-18" type="stable"/>
  </releases>
  <url type="homepage">https://github.com/xyproto/zsnes</url>
  <url type="bugtracker">https://github.com/xyproto/zsnes/issues</url>
  <categories>
    <category>Game</category>
    <category>Emulator</category>
  </categories>
  <recommends>
    <control>pointing</control>
    <control>keyboard</control>
    <control>gamepad</control>
  </recommends>
  <content_rating type="oars-1.1"/>
  <provides>
    <binary>zsnes</binary>
    <mediatype>application/vnd.nintendo.snes.rom</mediatype>
    <mediatype>application/x-snes-rom</mediatype>
  </provides>
</component>

io.github.xyproto.zsnes.png
io github xyproto zsnes

You also need the shared-modules.

I have tested it and it works. Are you interested to maintain it on Flathub? If not, I can do that.

ZSNES Compiling Issues

In the Command Prompt, I made a command, make, and it did not work.

What are the requirements for compiling ZSNES?

buffer overflow when built with D_FORTIFY_SOURCE=2

Hi Zsnes team. I'm using Zsnes in EndeavourOS, a Arch Linux based distro.
Using Zsnes version 2.0.9-1 runs fine without errors, but after last upgrade (using pacman) to version 2.0.9-2, when I click run or enter in a terminal for any rom (this example using Actraiser 2 rom):

zsnes -s -r 3 ActRaiser\ 2\ \(U\)\ \[\!\].zip

It returns:
*** buffer overflow detected ***: terminated
Aborted (core dumped)

Any hints to solve this problem? Thanks in advance!
My specs:
https://clbin.com/Z8XID

Support building on Ubuntu

I have already installed gcc-multilib, g++-multilib, and lib32z1-dev, but I am still getting:

/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libX11.so when searching for -lX11
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libX11.a when searching for -lX11
/usr/bin/ld: cannot find -lX11: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libX11.so when searching for -lX11
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libSDL.so when searching for -lSDL
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libSDL.a when searching for -lSDL
/usr/bin/ld: cannot find -lSDL: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libSDL.so when searching for -lSDL
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpng16.so when searching for -lpng16
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpng16.a when searching for -lpng16
/usr/bin/ld: cannot find -lpng16: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpng16.so when searching for -lpng16
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libGL.so when searching for -lGL
/usr/bin/ld: cannot find -lGL: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libGL.so when searching for -lGL
collect2: error: ld returned 1 exit status
make: *** [Makefile:346: zsnes] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.