Merge pull request #127 from mjbudd77/master
SDL GUI Ported to Qt5 from GTK3
This commit is contained in:
commit
ce495a6434
|
@ -0,0 +1,7 @@
|
|||
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
project(fceux)
|
||||
|
||||
add_subdirectory( src )
|
||||
|
71
README
71
README
|
@ -1,12 +1,13 @@
|
|||
FCEUX SDL 2.2.1 SDL README
|
||||
FCEUX SDL 2.2.3 SDL README
|
||||
==========================
|
||||
By Lukas Sabota (sf: punkrockguy318)
|
||||
Originally By Lukas Sabota (sf: punkrockguy318)
|
||||
Updated By mjbudd77
|
||||
|
||||
[NOTE: This is old and out of date and only applies to SDL (non windows) builds]
|
||||
[NOTE: This only applies to SDL (non windows) builds]
|
||||
|
||||
http://www.fceux.com
|
||||
|
||||
Last Modified: March 10, 2013
|
||||
Last Modified: July 12, 2020
|
||||
|
||||
Table of Contents
|
||||
-----------------
|
||||
|
@ -21,58 +22,64 @@ Table of Contents
|
|||
|
||||
1 - Requirements
|
||||
----------------
|
||||
* libsdl1.2 - It is strongly recommended that you upgrade to the latest
|
||||
version of sdl (1.2.15 at the time of writing).
|
||||
* scons - Required to build fceux.
|
||||
* libgtk2.0 (optional) - version >= 2.24 recommended
|
||||
* libgtk3.0 (optional) - this compiles as of fceux 2.2.0
|
||||
* liblua5.1 (optional)
|
||||
* libgd (optional) - required for LOGO and CREATE_AVI options (https://bitbucket.org/libgd/gd-libgd/downloads)
|
||||
* minizip (optional) - you may chose to use the version of minizip on your system by enabling SYSTEM_MINIZIP in the SConstruct
|
||||
* sdl2 - Version >= 2.0
|
||||
* cmake - Required to build fceux.
|
||||
* qt5 - version >= 5.11 recommended
|
||||
* liblua5.1 (optional) - Will statically link internally if the system cannot provide this.
|
||||
* minizip
|
||||
* zlib
|
||||
* openGL
|
||||
* c++ compiler -- you may use g++ from gcc or clang++ from llvm.
|
||||
|
||||
2 - Installation
|
||||
----------------
|
||||
Fceux can be compiled and built using the scons build system. To compile, run:
|
||||
Fceux can be compiled and built using the cmake build system. To compile, run:
|
||||
|
||||
scons
|
||||
mkdir build; cd build;
|
||||
cmake -DCMAKE_BUILD_TYPE=Release .. # For a release build
|
||||
|
||||
To build a binary with debug information included in it:
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug ..
|
||||
|
||||
To do the actual compiling:
|
||||
make
|
||||
|
||||
To compile faster with multiple processes in parallel:
|
||||
make -j `nproc`
|
||||
|
||||
After a sucessful compilation, the fceux binary will be generated to
|
||||
./src/fceux . You can install fceux to your system with the following command:
|
||||
./build/src/fceux . You can install fceux to your system with the following command:
|
||||
|
||||
scons install
|
||||
make install
|
||||
|
||||
You can optionally define a prefix:
|
||||
You can optionally define a install prefix when running cmake from the previous step:
|
||||
|
||||
scons --prefix=/usr/local install
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr/local install
|
||||
|
||||
You can choose to install the lua scripts (located in output/luaScripts) to a directory of your choosing:
|
||||
|
||||
cp -R output/luaScripts /usr/local/some/directory/that/i/will/find/later
|
||||
|
||||
If you would like to clean the temporary scons files to perform a 'make clean' like function, you can do the following:
|
||||
If you would like to do a full clean build a 'make clean' like function, you can do either of following:
|
||||
|
||||
scons -c && rm -rf .scon*
|
||||
make clean # from inside build directory
|
||||
|
||||
OR:
|
||||
Delete build directory and start over at initial cmake step:
|
||||
rm -rf build;
|
||||
|
||||
3 - Compile-time options
|
||||
------------------------
|
||||
You can enable and disable certain features of fceux at build time.
|
||||
To edit these options, edit the "BoolOptions" following the "opts.AddVariables" method
|
||||
at the head of the "SConstruct" file in this source directory. The
|
||||
default options will be fine for most users, but power users may want to
|
||||
tweak some of these options.
|
||||
Look in the src/CMakeList.txt file to tweak options.
|
||||
|
||||
4 - GUI
|
||||
-------
|
||||
You can enable the GTK GUI by setting GTK to 1 in the SConstruct build file.
|
||||
GfceuX is deprecated in favor of the new GTK GUI. You can disable the GTK GUI at
|
||||
run-time by passing the --nogui option, or disable it at build-time by setting
|
||||
GTK to 0 in the SConstruct file. If you prefer GTK3 to GTK2, you can set the
|
||||
GTK3 BoolVariable to 1 in the SConstruct.
|
||||
The Qt GUI is required and automatically builds as part of the build.
|
||||
|
||||
5 - LUA Scripting
|
||||
-----------------
|
||||
FCEUX provides a LUA 5.1 engine that allows for in-game scripting capabilities. LUA can be enabled or disabled at build time by adjusting the "LUA" BoolVariable in the SConstruct file.
|
||||
FCEUX provides a LUA 5.1 engine that allows for in-game scripting capabilities. LUA is enabled either way. It is just a matter of whether LUA is statically linked internally or dynamically linked to a system library.
|
||||
|
||||
A collection of LUA scripts are provided with the source distribuition in the output directory:
|
||||
|
||||
|
@ -94,7 +101,7 @@ Finally, if any scripts complaints about "attempt to index global 'iup' (a nil v
|
|||
|
||||
require("iuplua")
|
||||
|
||||
The latest version of iup (3.5 at the time of writing) is recomended.
|
||||
The latest version of iup (3.5 at the time of writing) is recommended.
|
||||
|
||||
6 - FAQ
|
||||
-------
|
||||
|
@ -116,4 +123,4 @@ Running fceux through esddsp is known to fix some audio issues with pulseaudio o
|
|||
|
||||
7 - Contact
|
||||
-----------
|
||||
If you have an issue with fceux, report it in the sourceforge bug tracker (see fceux.com). If you would like to contact the author of this readme personally, e-mail LTsmooth42 <at> gmail <dot> com. You can also check us out at #fceu on irc.freenode.net.
|
||||
If you have an issue with fceux, report it in the github bug tracker (see fceux at github.com). If you would like to contact the author of this readme personally, e-mail LTsmooth42 <at> gmail <dot> com. You can also check us out at #fceu on irc.freenode.net.
|
||||
|
|
44
TODO-SDL
44
TODO-SDL
|
@ -1,47 +1,25 @@
|
|||
Priorities
|
||||
==========
|
||||
* SDL 2.0 RC is released - SDL2.0 compatibility is a goal
|
||||
* Backwards-cpp still has an issue with clang++; look into this
|
||||
* Users are reporting crashing issues with hotkey dialog (probably because its a mess!). A huge chunk of the hotkey code should be rewritten (GUI and hotkey structs - or lack there-of)
|
||||
* GTK File menu quit element has "CTRL-Q" accelerator. This causes confusion with there being another SDL Hotkey for quit. This should be addressed.
|
||||
* Quit was mapped to '0' to prevent users from accidently quitting. Perhaps a default quit combo could be used.
|
||||
* Clean out old unused files - scons build system is dead, cmake is the way to go.
|
||||
* GTK GUI was not cross-platform. Has been replaced in favor of Qt5. Need to clean out dead code.
|
||||
* Cheat Editor will be a high priority.
|
||||
* Code cleanup. Lots of compiler warning with newer GCC. Maybe I'm OCD... but these warnings bother me.
|
||||
|
||||
Features
|
||||
========
|
||||
* SDL.Vsync
|
||||
* lets wait on this -- theres no simple way to use the OS default in SDL unless we just dont touch it, which might be the best thing to do here.
|
||||
* Emulator no runs as a separate thread from the GUI. Much improved performance.
|
||||
* Cross platform QT GUI is fully functional minus Debug Tools and Cheat Menu.
|
||||
|
||||
GTK
|
||||
QT
|
||||
===
|
||||
* Better on-the-fly video resizing with window resize / video config
|
||||
* Smarter video config (disable widgets that are not used when openGL is enabled)
|
||||
* Options to investigate:
|
||||
* bpp
|
||||
* scanlines
|
||||
* GUI Cheat editor
|
||||
|
||||
SDL 2.0
|
||||
=======
|
||||
* segfaults when opening a second game
|
||||
* segfaults on fullscreen entry
|
||||
* has not been tested in a while
|
||||
* Clean out rest of old GTK comments and #ifdefs
|
||||
* GUI Cheat editor TODO
|
||||
* GUI Debug Tools TODO
|
||||
* GUI should compile in windows as well.... but testing is not a priority since the windows gui has a totally separate backend.
|
||||
|
||||
BUGS
|
||||
====
|
||||
* F1 from terminal-less gui fceux process hangs fceux (since input is required from console in cheat editor)
|
||||
|
||||
OS X
|
||||
====
|
||||
* Single window mode does not work (the XWINDOWID hack does not work in Apples X11 server, so this may never get fixed).
|
||||
* It is possible to use GTK to build native OS X menus: http://developer.gnome.org/gtk3/3.4/GtkApplication.html . It would be awesome to do this and hide the main GTK window if the top bar is available
|
||||
* Zapper input is taken from GTK window instead of X11 window (a workaround could be implemented to resolve with with some #ifdef APPLE etc)
|
||||
* Not an "official" target, but testing should be done before release on OS X
|
||||
* DMG Static binary download for Intel OS X
|
||||
* Include needful libaries
|
||||
* Adjust scons to produce static binary/libraries with an option
|
||||
* http://www.scons.org/wiki/StaticallyLink
|
||||
|
||||
DOCS
|
||||
====
|
||||
* Be sure to include details about new scons features for package maintainers so that the manpage, luascripts, and auxlib will be included in future packages
|
||||
* Docs REALLY need a cleanup/rewrite
|
||||
|
|
12
appveyor.yml
12
appveyor.yml
|
@ -13,6 +13,9 @@ environment:
|
|||
appveyor_build_worker_image: Ubuntu2004
|
||||
#appveyor_build_worker_image: Ubuntu1804
|
||||
|
||||
- job_name: MacOS
|
||||
appveyor_build_worker_image: macOS
|
||||
|
||||
for:
|
||||
|
||||
-
|
||||
|
@ -38,3 +41,12 @@ for:
|
|||
|
||||
build_script:
|
||||
- sh: ./pipelines/linux_build.sh
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- job_name: MacOS
|
||||
|
||||
build_script:
|
||||
- sh: ./pipelines/macOS_build.sh
|
||||
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,369 @@
|
|||
######################################################################
|
||||
# Automatically generated by qmake (3.1) Sat Jun 20 21:20:47 2020
|
||||
######################################################################
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET = fceux
|
||||
INCLUDEPATH += .
|
||||
|
||||
# The following define makes your compiler warn you if you use any
|
||||
# feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
QT += widgets
|
||||
|
||||
CONFIG += object_parallel_to_source
|
||||
|
||||
INCLUDEPATH += src src/drivers
|
||||
|
||||
ENABLE_LUA = 0
|
||||
USE_INTERNAL_LUA = 0
|
||||
|
||||
unix {
|
||||
QT_CONFIG -= no-pkg-config
|
||||
CONFIG += link_pkgconfig
|
||||
|
||||
QMAKE_CXXFLAGS += -DPSS_STYLE=1 -DHAVE_ASPRINTF
|
||||
|
||||
packagesExist(minizip){
|
||||
PKGCONFIG += minizip
|
||||
QMAKE_CXXFLAGS += -D_SYSTEM_MINIZIP
|
||||
}
|
||||
|
||||
packagesExist(zlib){
|
||||
PKGCONFIG += zlib
|
||||
}
|
||||
|
||||
PKGCONFIG += sdl2
|
||||
|
||||
packagesExist(lua-5.1){
|
||||
PKGCONFIG += lua-5.1
|
||||
USE_INTERNAL_LUA = 0;
|
||||
QMAKE_CXXFLAGS += -D_S9XLUA_H
|
||||
} else {
|
||||
USE_INTERNAL_LUA = 1;
|
||||
QMAKE_CXXFLAGS += -D_S9XLUA_H
|
||||
}
|
||||
ENABLE_LUA = 1
|
||||
|
||||
QMAKE_CXXFLAGS -= -O2
|
||||
QMAKE_CXXFLAGS += -D__QT_DRIVER__ -O0 -g3 -Wall -Wno-write-strings -Wno-sign-compare -Wno-parentheses -Wno-unused-local-typedefs
|
||||
QMAKE_CXXFLAGS_RELEASE -= -O2
|
||||
|
||||
LIBS += -lz
|
||||
}
|
||||
|
||||
# Input
|
||||
SOURCES += src/asm.cpp
|
||||
SOURCES += src/cart.cpp
|
||||
SOURCES += src/cheat.cpp
|
||||
SOURCES += src/conddebug.cpp
|
||||
SOURCES += src/config.cpp
|
||||
SOURCES += src/debug.cpp
|
||||
SOURCES += src/drawing.cpp
|
||||
SOURCES += src/fceu.cpp
|
||||
SOURCES += src/fds.cpp
|
||||
SOURCES += src/file.cpp
|
||||
SOURCES += src/emufile.cpp
|
||||
SOURCES += src/filter.cpp
|
||||
SOURCES += src/ines.cpp
|
||||
SOURCES += src/input.cpp
|
||||
SOURCES += src/movie.cpp
|
||||
SOURCES += src/netplay.cpp
|
||||
SOURCES += src/nsf.cpp
|
||||
SOURCES += src/oldmovie.cpp
|
||||
SOURCES += src/palette.cpp
|
||||
SOURCES += src/ppu.cpp
|
||||
SOURCES += src/sound.cpp
|
||||
SOURCES += src/state.cpp
|
||||
SOURCES += src/unif.cpp
|
||||
SOURCES += src/video.cpp
|
||||
SOURCES += src/vsuni.cpp
|
||||
SOURCES += src/wave.cpp
|
||||
SOURCES += src/x6502.cpp
|
||||
|
||||
isEqual( ENABLE_LUA, 1 ) {
|
||||
isEqual( USE_INTERNAL_LUA, 1 ) {
|
||||
message("Enabling Internal LUA")
|
||||
INCLUDEPATH += src/lua/src
|
||||
SOURCES += src/lua/src/lapi.c
|
||||
SOURCES += src/lua/src/lauxlib.c
|
||||
SOURCES += src/lua/src/lbaselib.c
|
||||
SOURCES += src/lua/src/lcode.c
|
||||
SOURCES += src/lua/src/ldblib.c
|
||||
SOURCES += src/lua/src/ldebug.c
|
||||
SOURCES += src/lua/src/ldo.c
|
||||
SOURCES += src/lua/src/ldump.c
|
||||
SOURCES += src/lua/src/lfunc.c
|
||||
SOURCES += src/lua/src/lgc.c
|
||||
SOURCES += src/lua/src/linit.c
|
||||
SOURCES += src/lua/src/liolib.c
|
||||
SOURCES += src/lua/src/llex.c
|
||||
SOURCES += src/lua/src/lmathlib.c
|
||||
SOURCES += src/lua/src/lmem.c
|
||||
SOURCES += src/lua/src/loadlib.c
|
||||
SOURCES += src/lua/src/lobject.c
|
||||
SOURCES += src/lua/src/lopcodes.c
|
||||
SOURCES += src/lua/src/loslib.c
|
||||
SOURCES += src/lua/src/lparser.c
|
||||
SOURCES += src/lua/src/lstate.c
|
||||
SOURCES += src/lua/src/lstring.c
|
||||
SOURCES += src/lua/src/lstrlib.c
|
||||
SOURCES += src/lua/src/ltable.c
|
||||
SOURCES += src/lua/src/ltablib.c
|
||||
SOURCES += src/lua/src/ltm.c
|
||||
SOURCES += src/lua/src/lundump.c
|
||||
SOURCES += src/lua/src/lvm.c
|
||||
SOURCES += src/lua/src/lzio.c
|
||||
SOURCES += src/lua/src/print.c
|
||||
SOURCES += src/lua-engine.cpp
|
||||
} else {
|
||||
message("Enabling System LUA")
|
||||
SOURCES += src/lua-engine.cpp
|
||||
}
|
||||
message("Enabling LUA")
|
||||
} else {
|
||||
message("Disabling LUA")
|
||||
}
|
||||
|
||||
SOURCES += src/boards/01-222.cpp
|
||||
SOURCES += src/boards/09-034a.cpp
|
||||
SOURCES += src/boards/103.cpp
|
||||
SOURCES += src/boards/106.cpp
|
||||
SOURCES += src/boards/108.cpp
|
||||
SOURCES += src/boards/112.cpp
|
||||
SOURCES += src/boards/116.cpp
|
||||
SOURCES += src/boards/117.cpp
|
||||
SOURCES += src/boards/120.cpp
|
||||
SOURCES += src/boards/121.cpp
|
||||
SOURCES += src/boards/12in1.cpp
|
||||
SOURCES += src/boards/151.cpp
|
||||
SOURCES += src/boards/156.cpp
|
||||
SOURCES += src/boards/158B.cpp
|
||||
SOURCES += src/boards/15.cpp
|
||||
SOURCES += src/boards/164.cpp
|
||||
SOURCES += src/boards/168.cpp
|
||||
SOURCES += src/boards/170.cpp
|
||||
SOURCES += src/boards/175.cpp
|
||||
SOURCES += src/boards/176.cpp
|
||||
SOURCES += src/boards/177.cpp
|
||||
SOURCES += src/boards/178.cpp
|
||||
SOURCES += src/boards/183.cpp
|
||||
SOURCES += src/boards/185.cpp
|
||||
SOURCES += src/boards/186.cpp
|
||||
SOURCES += src/boards/187.cpp
|
||||
SOURCES += src/boards/189.cpp
|
||||
SOURCES += src/boards/18.cpp
|
||||
SOURCES += src/boards/190.cpp
|
||||
SOURCES += src/boards/193.cpp
|
||||
SOURCES += src/boards/199.cpp
|
||||
SOURCES += src/boards/206.cpp
|
||||
SOURCES += src/boards/208.cpp
|
||||
SOURCES += src/boards/222.cpp
|
||||
SOURCES += src/boards/225.cpp
|
||||
SOURCES += src/boards/228.cpp
|
||||
SOURCES += src/boards/230.cpp
|
||||
SOURCES += src/boards/232.cpp
|
||||
SOURCES += src/boards/234.cpp
|
||||
SOURCES += src/boards/235.cpp
|
||||
SOURCES += src/boards/244.cpp
|
||||
SOURCES += src/boards/246.cpp
|
||||
SOURCES += src/boards/252.cpp
|
||||
SOURCES += src/boards/253.cpp
|
||||
SOURCES += src/boards/28.cpp
|
||||
SOURCES += src/boards/32.cpp
|
||||
SOURCES += src/boards/33.cpp
|
||||
SOURCES += src/boards/34.cpp
|
||||
SOURCES += src/boards/36.cpp
|
||||
SOURCES += src/boards/3d-block.cpp
|
||||
SOURCES += src/boards/40.cpp
|
||||
SOURCES += src/boards/411120-c.cpp
|
||||
SOURCES += src/boards/41.cpp
|
||||
SOURCES += src/boards/42.cpp
|
||||
SOURCES += src/boards/43.cpp
|
||||
SOURCES += src/boards/46.cpp
|
||||
SOURCES += src/boards/50.cpp
|
||||
SOURCES += src/boards/51.cpp
|
||||
SOURCES += src/boards/57.cpp
|
||||
SOURCES += src/boards/603-5052.cpp
|
||||
SOURCES += src/boards/62.cpp
|
||||
SOURCES += src/boards/65.cpp
|
||||
SOURCES += src/boards/67.cpp
|
||||
SOURCES += src/boards/68.cpp
|
||||
SOURCES += src/boards/69.cpp
|
||||
SOURCES += src/boards/71.cpp
|
||||
SOURCES += src/boards/72.cpp
|
||||
SOURCES += src/boards/77.cpp
|
||||
SOURCES += src/boards/79.cpp
|
||||
SOURCES += src/boards/80013-B.cpp
|
||||
SOURCES += src/boards/80.cpp
|
||||
SOURCES += src/boards/8157.cpp
|
||||
SOURCES += src/boards/8237.cpp
|
||||
SOURCES += src/boards/82.cpp
|
||||
SOURCES += src/boards/830118C.cpp
|
||||
SOURCES += src/boards/88.cpp
|
||||
SOURCES += src/boards/8in1.cpp
|
||||
SOURCES += src/boards/90.cpp
|
||||
SOURCES += src/boards/91.cpp
|
||||
SOURCES += src/boards/96.cpp
|
||||
SOURCES += src/boards/99.cpp
|
||||
SOURCES += src/boards/a9746.cpp
|
||||
SOURCES += src/boards/ac-08.cpp
|
||||
SOURCES += src/boards/addrlatch.cpp
|
||||
SOURCES += src/boards/ax5705.cpp
|
||||
SOURCES += src/boards/bandai.cpp
|
||||
SOURCES += src/boards/bb.cpp
|
||||
SOURCES += src/boards/bmc13in1jy110.cpp
|
||||
SOURCES += src/boards/bmc42in1r.cpp
|
||||
SOURCES += src/boards/bmc64in1nr.cpp
|
||||
SOURCES += src/boards/bmc70in1.cpp
|
||||
SOURCES += src/boards/BMW8544.cpp
|
||||
SOURCES += src/boards/bonza.cpp
|
||||
SOURCES += src/boards/bs-5.cpp
|
||||
SOURCES += src/boards/cheapocabra.cpp
|
||||
SOURCES += src/boards/cityfighter.cpp
|
||||
SOURCES += src/boards/coolboy.cpp
|
||||
SOURCES += src/boards/dance2000.cpp
|
||||
SOURCES += src/boards/datalatch.cpp
|
||||
SOURCES += src/boards/dream.cpp
|
||||
SOURCES += src/boards/__dummy_mapper.cpp
|
||||
SOURCES += src/boards/edu2000.cpp
|
||||
SOURCES += src/boards/eh8813a.cpp
|
||||
SOURCES += src/boards/emu2413.c
|
||||
SOURCES += src/boards/et-100.cpp
|
||||
SOURCES += src/boards/et-4320.cpp
|
||||
SOURCES += src/boards/F-15.cpp
|
||||
SOURCES += src/boards/famicombox.cpp
|
||||
SOURCES += src/boards/ffe.cpp
|
||||
SOURCES += src/boards/fk23c.cpp
|
||||
SOURCES += src/boards/fns.cpp
|
||||
SOURCES += src/boards/ghostbusters63in1.cpp
|
||||
SOURCES += src/boards/gs-2004.cpp
|
||||
SOURCES += src/boards/gs-2013.cpp
|
||||
SOURCES += src/boards/h2288.cpp
|
||||
SOURCES += src/boards/hp10xx_hp20xx.cpp
|
||||
SOURCES += src/boards/hp898f.cpp
|
||||
SOURCES += src/boards/inlnsf.cpp
|
||||
SOURCES += src/boards/karaoke.cpp
|
||||
SOURCES += src/boards/kof97.cpp
|
||||
SOURCES += src/boards/ks7010.cpp
|
||||
SOURCES += src/boards/ks7012.cpp
|
||||
SOURCES += src/boards/ks7013.cpp
|
||||
SOURCES += src/boards/ks7016.cpp
|
||||
SOURCES += src/boards/ks7017.cpp
|
||||
SOURCES += src/boards/ks7030.cpp
|
||||
SOURCES += src/boards/ks7031.cpp
|
||||
SOURCES += src/boards/ks7032.cpp
|
||||
SOURCES += src/boards/ks7037.cpp
|
||||
SOURCES += src/boards/ks7057.cpp
|
||||
SOURCES += src/boards/le05.cpp
|
||||
SOURCES += src/boards/lh32.cpp
|
||||
SOURCES += src/boards/lh53.cpp
|
||||
SOURCES += src/boards/malee.cpp
|
||||
SOURCES += src/boards/mihunche.cpp
|
||||
SOURCES += src/boards/mmc1.cpp
|
||||
SOURCES += src/boards/mmc2and4.cpp
|
||||
SOURCES += src/boards/mmc3.cpp
|
||||
SOURCES += src/boards/mmc5.cpp
|
||||
SOURCES += src/boards/n106.cpp
|
||||
SOURCES += src/boards/n625092.cpp
|
||||
SOURCES += src/boards/novel.cpp
|
||||
SOURCES += src/boards/onebus.cpp
|
||||
SOURCES += src/boards/pec-586.cpp
|
||||
SOURCES += src/boards/rt-01.cpp
|
||||
SOURCES += src/boards/sa-9602b.cpp
|
||||
SOURCES += src/boards/sachen.cpp
|
||||
SOURCES += src/boards/sb-2000.cpp
|
||||
SOURCES += src/boards/sc-127.cpp
|
||||
SOURCES += src/boards/sheroes.cpp
|
||||
SOURCES += src/boards/sl1632.cpp
|
||||
SOURCES += src/boards/subor.cpp
|
||||
SOURCES += src/boards/super24.cpp
|
||||
SOURCES += src/boards/supervision.cpp
|
||||
SOURCES += src/boards/t-227-1.cpp
|
||||
SOURCES += src/boards/t-262.cpp
|
||||
SOURCES += src/boards/tengen.cpp
|
||||
SOURCES += src/boards/tf-1201.cpp
|
||||
SOURCES += src/boards/transformer.cpp
|
||||
SOURCES += src/boards/unrom512.cpp
|
||||
SOURCES += src/boards/vrc1.cpp
|
||||
SOURCES += src/boards/vrc2and4.cpp
|
||||
SOURCES += src/boards/vrc3.cpp
|
||||
SOURCES += src/boards/vrc5.cpp
|
||||
SOURCES += src/boards/vrc6.cpp
|
||||
SOURCES += src/boards/vrc7.cpp
|
||||
SOURCES += src/boards/vrc7p.cpp
|
||||
SOURCES += src/boards/yoko.cpp
|
||||
SOURCES += src/input/arkanoid.cpp
|
||||
SOURCES += src/input/bworld.cpp
|
||||
SOURCES += src/input/cursor.cpp
|
||||
SOURCES += src/input/fkb.cpp
|
||||
SOURCES += src/input/fns.cpp
|
||||
SOURCES += src/input/ftrainer.cpp
|
||||
SOURCES += src/input/hypershot.cpp
|
||||
SOURCES += src/input/mahjong.cpp
|
||||
SOURCES += src/input/mouse.cpp
|
||||
SOURCES += src/input/oekakids.cpp
|
||||
SOURCES += src/input/pec586kb.cpp
|
||||
SOURCES += src/input/powerpad.cpp
|
||||
SOURCES += src/input/quiz.cpp
|
||||
SOURCES += src/input/shadow.cpp
|
||||
SOURCES += src/input/snesmouse.cpp
|
||||
SOURCES += src/input/suborkb.cpp
|
||||
SOURCES += src/input/toprider.cpp
|
||||
SOURCES += src/input/virtualboy.cpp
|
||||
SOURCES += src/input/zapper.cpp
|
||||
SOURCES += src/utils/backward.cpp
|
||||
SOURCES += src/utils/ConvertUTF.c
|
||||
SOURCES += src/utils/xstring.cpp
|
||||
SOURCES += src/utils/crc32.cpp
|
||||
SOURCES += src/utils/endian.cpp
|
||||
SOURCES += src/utils/general.cpp
|
||||
SOURCES += src/utils/guid.cpp
|
||||
SOURCES += src/utils/md5.cpp
|
||||
SOURCES += src/utils/memory.cpp
|
||||
SOURCES += src/drivers/common/args.cpp
|
||||
SOURCES += src/drivers/common/cheat.cpp
|
||||
SOURCES += src/drivers/common/config.cpp
|
||||
SOURCES += src/drivers/common/configSys.cpp
|
||||
SOURCES += src/drivers/common/hq2x.cpp
|
||||
SOURCES += src/drivers/common/hq3x.cpp
|
||||
SOURCES += src/drivers/common/scale2x.cpp
|
||||
SOURCES += src/drivers/common/scale3x.cpp
|
||||
SOURCES += src/drivers/common/scalebit.cpp
|
||||
SOURCES += src/drivers/common/vidblit.cpp
|
||||
SOURCES += src/drivers/common/nes_ntsc.c
|
||||
|
||||
HEADERS += src/drivers/Qt/ConsoleWindow.h
|
||||
HEADERS += src/drivers/Qt/ConsoleViewerGL.h
|
||||
HEADERS += src/drivers/Qt/ConsoleViewerSDL.h
|
||||
HEADERS += src/drivers/Qt/GamePadConf.h
|
||||
HEADERS += src/drivers/Qt/HotKeyConf.h
|
||||
HEADERS += src/drivers/Qt/ConsoleVideoConf.h
|
||||
HEADERS += src/drivers/Qt/ConsoleSoundConf.h
|
||||
SOURCES += src/drivers/Qt/main.cpp
|
||||
SOURCES += src/drivers/Qt/ConsoleWindow.cpp
|
||||
SOURCES += src/drivers/Qt/ConsoleViewerGL.cpp
|
||||
SOURCES += src/drivers/Qt/ConsoleViewerSDL.cpp
|
||||
SOURCES += src/drivers/Qt/GamePadConf.cpp
|
||||
SOURCES += src/drivers/Qt/HotKeyConf.cpp
|
||||
SOURCES += src/drivers/Qt/ConsoleVideoConf.cpp
|
||||
SOURCES += src/drivers/Qt/ConsoleSoundConf.cpp
|
||||
SOURCES += src/drivers/Qt/fceuWrapper.cpp
|
||||
SOURCES += src/drivers/Qt/config.cpp
|
||||
SOURCES += src/drivers/Qt/input.cpp
|
||||
SOURCES += src/drivers/Qt/nes_shm.cpp
|
||||
SOURCES += src/drivers/Qt/keyscan.cpp
|
||||
SOURCES += src/drivers/Qt/sdl-sound.cpp
|
||||
SOURCES += src/drivers/Qt/sdl-video.cpp
|
||||
SOURCES += src/drivers/Qt/sdl-joystick.cpp
|
||||
SOURCES += src/drivers/Qt/sdl-throttle.cpp
|
||||
SOURCES += src/drivers/Qt/unix-netplay.cpp
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
|
@ -2,6 +2,7 @@
|
|||
|
||||
id
|
||||
pwd
|
||||
uname -a
|
||||
cat /etc/os-release
|
||||
|
||||
SCRIPT_DIR=$( cd $(dirname $BASH_SOURCE[0]); pwd );
|
||||
|
@ -54,22 +55,29 @@ pkg-config --cflags --libs minizip
|
|||
# GTK+-2 is no longer needed
|
||||
#sudo apt-get install libgtk2.0-dev
|
||||
|
||||
# Install GTK+-3
|
||||
echo '****************************************'
|
||||
echo 'Install Dependency libgtk-3-dev'
|
||||
echo '****************************************'
|
||||
sudo apt-get --assume-yes install libgtk-3-dev
|
||||
pkg-config --cflags --libs gtk+-3.0
|
||||
# GTK3 was retired in favor of cross platform QT
|
||||
## Install GTK+-3
|
||||
#echo '****************************************'
|
||||
#echo 'Install Dependency libgtk-3-dev'
|
||||
#echo '****************************************'
|
||||
#sudo apt-get --assume-yes install libgtk-3-dev
|
||||
#pkg-config --cflags --libs gtk+-3.0
|
||||
#
|
||||
## Install GTK+-3 Sourceview
|
||||
#sudo apt-get --assume-yes install libgtksourceview-3.0-dev
|
||||
#pkg-config --cflags --libs gtksourceview-3.0
|
||||
|
||||
# Install GTK+-3 Sourceview
|
||||
sudo apt-get --assume-yes install libgtksourceview-3.0-dev
|
||||
pkg-config --cflags --libs gtksourceview-3.0
|
||||
# Install QT5
|
||||
echo '****************************************'
|
||||
echo 'Install Dependency Qt5'
|
||||
echo '****************************************'
|
||||
sudo apt-get --assume-yes install qt5-default
|
||||
|
||||
# Install scons
|
||||
echo '****************************************'
|
||||
echo 'Install Build Dependency scons'
|
||||
echo '****************************************'
|
||||
sudo apt-get --assume-yes install scons
|
||||
#echo '****************************************'
|
||||
#echo 'Install Build Dependency scons'
|
||||
#echo '****************************************'
|
||||
#sudo apt-get --assume-yes install scons
|
||||
|
||||
# Install cppcheck
|
||||
echo '****************************************'
|
||||
|
@ -81,8 +89,35 @@ echo '**************************'
|
|||
echo '*** Building Project ***'
|
||||
echo '**************************'
|
||||
mkdir -p $INSTALL_PREFIX/usr;
|
||||
scons --clean
|
||||
scons GTK3=1 SYSTEM_LUA=1 SYSTEM_MINIZIP=1 CREATE_AVI=1 install --prefix=$INSTALL_PREFIX/usr
|
||||
#scons --clean
|
||||
#scons GTK3=1 SYSTEM_LUA=1 SYSTEM_MINIZIP=1 CREATE_AVI=1 install --prefix=$INSTALL_PREFIX/usr
|
||||
echo "Num CPU: `nproc`";
|
||||
mkdir build; cd build;
|
||||
#qmake PREFIX=$INSTALL_PREFIX/usr ..
|
||||
cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX/usr \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
..
|
||||
make -j `nproc`
|
||||
make install
|
||||
|
||||
# Install Files
|
||||
#cd .. # cd out of build
|
||||
#mkdir -p $INSTALL_PREFIX/usr/bin/.
|
||||
#mkdir -p $INSTALL_PREFIX/usr/share/fceux
|
||||
#mkdir -p $INSTALL_PREFIX/usr/share/pixmaps
|
||||
#mkdir -p $INSTALL_PREFIX/usr/share/applications
|
||||
#mkdir -p $INSTALL_PREFIX/usr/man/man6
|
||||
#
|
||||
#cp -f ./build/fceux $INSTALL_PREFIX/usr/bin/.
|
||||
#cp -a ./output/* $INSTALL_PREFIX/usr/share/fceux/.
|
||||
#cp -a ./src/auxlib.lua $INSTALL_PREFIX/usr/share/fceux/.
|
||||
#cp -a ./fceux.png $INSTALL_PREFIX/usr/share/pixmaps/.
|
||||
#cp -a ./fceux.desktop $INSTALL_PREFIX/usr/share/applications/.
|
||||
#cp -a ./documentation/fceux.6 $INSTALL_PREFIX/usr/man/man6/.
|
||||
#cp -a ./documentation/fceux-net-server.6 $INSTALL_PREFIX/usr/man/man6/.
|
||||
|
||||
|
||||
# Debug via ssh if necessary
|
||||
if [ ! -z $APPVEYOR_SSH_BLOCK ]; then
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo ' MacOS Build !!! '
|
||||
id
|
||||
pwd
|
||||
uname -a
|
||||
sw_vers
|
||||
|
||||
FCEUX_VERSION_MAJOR=2
|
||||
FCEUX_VERSION_MINOR=2
|
||||
FCEUX_VERSION_PATCH=3
|
||||
|
||||
SCRIPT_DIR=$( cd $(dirname $BASH_SOURCE[0]); pwd );
|
||||
|
||||
NPROC=`getconf _NPROCESSORS_ONLN`;
|
||||
echo "Number of Processors: $NPROC";
|
||||
|
||||
INSTALL_PREFIX=/tmp/fceux
|
||||
|
||||
gcc --version
|
||||
|
||||
echo '****************************************'
|
||||
echo "APPVEYOR_SSH_KEY=$APPVEYOR_SSH_KEY";
|
||||
echo "APPVEYOR_SSH_BLOCK=$APPVEYOR_SSH_BLOCK";
|
||||
echo '****************************************'
|
||||
|
||||
echo '****************************************'
|
||||
echo 'Install Dependency sdl2'
|
||||
echo '****************************************'
|
||||
brew install sdl2
|
||||
|
||||
echo '****************************************'
|
||||
echo 'Install Dependency Qt5'
|
||||
echo '****************************************'
|
||||
brew install qt5
|
||||
|
||||
echo '****************************************'
|
||||
echo 'Install Dependency minizip'
|
||||
echo '****************************************'
|
||||
brew install minizip
|
||||
|
||||
#brew install zlib # Already installed in appveyor macOS
|
||||
|
||||
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:
|
||||
|
||||
#QMAKE=`find /usr/local -name qmake`;
|
||||
QT_CMAKE=`find /usr/local -name Qt5Config.cmake`
|
||||
echo $QT_CMAKE;
|
||||
export Qt5_DIR=`dirname $QT_CMAKE`;
|
||||
echo "Qt5_DIR=$Qt5_DIR";
|
||||
|
||||
echo '**************************'
|
||||
echo '*** Building Project ***'
|
||||
echo '**************************'
|
||||
mkdir build;
|
||||
cd build;
|
||||
#$QMAKE ..
|
||||
cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_PROJECT_VERSION_MAJOR=$FCEUX_VERSION_MAJOR \
|
||||
-DCMAKE_PROJECT_VERSION_MINOR=$FCEUX_VERSION_MINOR \
|
||||
-DCMAKE_PROJECT_VERSION_PATCH=$FCEUX_VERSION_PATCH \
|
||||
-DCPACK_PACKAGE_VERSION_MAJOR=$FCEUX_VERSION_MAJOR \
|
||||
-DCPACK_PACKAGE_VERSION_MINOR=$FCEUX_VERSION_MINOR \
|
||||
-DCPACK_PACKAGE_VERSION_PATCH=$FCEUX_VERSION_PATCH \
|
||||
.. || exit 1
|
||||
make -j $NPROC || exit 1
|
||||
sudo make install || exit 1
|
||||
sudo cpack -G DragNDrop || exit 1
|
||||
|
||||
echo 'Pushing DMG Package to Build Artifacts'
|
||||
appveyor PushArtifact fceux-*.dmg
|
||||
|
||||
# Debug via ssh if necessary
|
||||
if [ ! -z $APPVEYOR_SSH_BLOCK ]; then
|
||||
curl -sflL 'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-ssh.sh' | bash -e -
|
||||
fi
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>fceux.png</file>
|
||||
<file>fceux1.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
|
||||
OUTPUT_DIR=$1;
|
||||
|
||||
FILE="fceux_git_info.cpp"
|
||||
TMP_FILE="/tmp/$FILE";
|
||||
|
||||
echo "Output File: $OUTPUT_DIR/$FILE";
|
||||
|
||||
GIT_URL=`git config --get remote.origin.url`;
|
||||
GIT_REV=`git rev-parse HEAD`;
|
||||
|
||||
echo "// fceux_gitrev.cpp -- DO NOT EDIT: This file is auto-generated at build" >| $TMP_FILE;
|
||||
echo "#include \"Qt/fceux_git_info.h\" " >> $TMP_FILE;
|
||||
echo "#define FCEUX_GIT_URL \"$GIT_URL\" " >> $TMP_FILE;
|
||||
echo "#define FCEUX_GIT_REV \"$GIT_REV\" " >> $TMP_FILE;
|
||||
echo "const char *fceu_get_git_url(void){ return FCEUX_GIT_URL; }" >> $TMP_FILE
|
||||
echo "const char *fceu_get_git_rev(void){ return FCEUX_GIT_REV; }" >> $TMP_FILE
|
||||
|
||||
echo "Git URL: $GIT_URL ";
|
||||
echo "Git Rev: $GIT_REV ";
|
||||
if [ -e $OUTPUT_DIR/$FILE ]; then
|
||||
|
||||
diff -q $TMP_FILE $OUTPUT_DIR/$FILE
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
mv -f $TMP_FILE $OUTPUT_DIR/$FILE;
|
||||
echo "Updated $OUTPUT_DIR/$FILE";
|
||||
fi
|
||||
else
|
||||
mv -f $TMP_FILE $OUTPUT_DIR/$FILE
|
||||
echo "Generated $OUTPUT_DIR/$FILE";
|
||||
fi
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
SRC_PNG=../fceux1.png
|
||||
OUTDIR=/tmp/fceux.iconset;
|
||||
mkdir -p $OUTDIR;
|
||||
|
||||
function convert() {
|
||||
#echo "Convert $1 $2"
|
||||
WIDTH=$1;
|
||||
SCALE=$2;
|
||||
WIDTH2=`expr $WIDTH / 2`;
|
||||
|
||||
if [ $SCALE == "2" ]; then
|
||||
OUT=icon_$WIDTH\x$WIDTH.png
|
||||
else
|
||||
OUT=icon_$WIDTH2\x$WIDTH2\@2x.png
|
||||
fi
|
||||
CMD="sips -z $WIDTH $WIDTH $SRC_PNG --out $OUTDIR/$OUT";
|
||||
echo $CMD;
|
||||
$CMD;
|
||||
}
|
||||
|
||||
convert 32 1 ;
|
||||
convert 32 2 ;
|
||||
convert 64 1 ;
|
||||
convert 64 2 ;
|
||||
convert 256 1 ;
|
||||
convert 256 2 ;
|
||||
convert 512 1 ;
|
||||
convert 512 2 ;
|
||||
convert 1024 1 ;
|
||||
convert 1024 2 ;
|
||||
|
||||
iconutil -c icns $OUTDIR/
|
|
@ -0,0 +1,473 @@
|
|||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
set( APP_NAME fceux)
|
||||
|
||||
if(WIN32)
|
||||
set(SOURCES ${SRC_CORE} ${SRC_DRIVERS_COMMON} ${SRC_DRIVERS_WIN})
|
||||
include_directories( ${CMAKE_SOURCE_DIR}/src/drivers/win/directx ${CMAKE_SOURCE_DIR}/src/drivers/win/zlib )
|
||||
add_definitions(
|
||||
-DWIN32
|
||||
-DFCEUDEF_DEBUGGER
|
||||
-D_USE_SHARED_MEMORY_
|
||||
-DPSS_STYLE=2
|
||||
-DNOMINMAX
|
||||
-D_S9XLUA_H
|
||||
)
|
||||
link_directories( ${CMAKE_SOURCE_DIR}/src/drivers/win/directx )
|
||||
else(WIN32)
|
||||
# Non Windows System
|
||||
# UNIX (Linux or Mac OSX)
|
||||
|
||||
#set (OpenGL_GL_PREFERENCE GLVND)
|
||||
set (OpenGL_GL_PREFERENCE LEGACY)
|
||||
|
||||
# Use the built-in cmake find_package functions to find dependencies
|
||||
# Use package PkgConfig to detect headers/library what find_package cannot find.
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Widgets OpenGL REQUIRED)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
add_definitions( ${Qt5Widgets_DEFINITIONS} )
|
||||
include_directories( ${Qt5Widgets_INCLUDE_DIRS} )
|
||||
|
||||
add_definitions( -D__QT_DRIVER__ -Wall -Wno-write-strings -Wno-sign-compare -Wno-parentheses -Wno-unused-local-typedefs -fPIC -DQT_DEPRECATED_WARNINGS )
|
||||
|
||||
# Check for libminizip
|
||||
pkg_check_modules( MINIZIP REQUIRED minizip)
|
||||
|
||||
if ( ${MINIZIP_FOUND} )
|
||||
add_definitions( -D_SYSTEM_MINIZIP ${MINIZIP_CFLAGS} )
|
||||
endif()
|
||||
|
||||
#pkg_check_modules( GL gl) # Use built in find package instead for OpenGL
|
||||
|
||||
# Check for OpenGL
|
||||
if ( ${OPENGL_FOUND} )
|
||||
include_directories( ${OPENGL_INCLUDE_DIR} )
|
||||
endif()
|
||||
|
||||
#pkg_check_modules( ZLIB REQUIRED zlib) # Use built in find package instead for zlib
|
||||
|
||||
# Check for zlib
|
||||
if ( ${ZLIB_FOUND} )
|
||||
#add_definitions( ${ZLIB_CFLAGS} )
|
||||
include_directories( ${ZLIB_INCLUDE_DIRS} )
|
||||
endif()
|
||||
|
||||
# Check for SDL2
|
||||
pkg_check_modules( SDL2 REQUIRED sdl2)
|
||||
|
||||
if ( ${SDL2_FOUND} )
|
||||
add_definitions( ${SDL2_CFLAGS} )
|
||||
endif()
|
||||
|
||||
# Check for LUA
|
||||
pkg_check_modules( LUA lua-5.1)
|
||||
|
||||
if ( ${LUA_FOUND} )
|
||||
# Use System LUA
|
||||
add_definitions( -D_S9XLUA_H ${LUA_CFLAGS} )
|
||||
|
||||
set( LUA_ENGINE_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/lua-engine.cpp )
|
||||
|
||||
else ()
|
||||
|
||||
# Use Internal LUA
|
||||
add_definitions( -D_S9XLUA_H -I${CMAKE_CURRENT_SOURCE_DIR}/lua/src )
|
||||
|
||||
set( LUA_ENGINE_SOURCE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lapi.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lauxlib.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lbaselib.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lcode.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/ldblib.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/ldebug.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/ldo.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/ldump.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lfunc.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lgc.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/linit.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/liolib.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/llex.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lmathlib.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lmem.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/loadlib.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lobject.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lopcodes.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/loslib.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lparser.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lstate.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lstring.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lstrlib.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/ltable.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/ltablib.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/ltm.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lundump.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lvm.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/lzio.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua/src/print.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lua-engine.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
add_definitions( -DHAVE_ASPRINTF ) # What system wouldn't have this?
|
||||
#add_definitions( -DCREATE_AVI )
|
||||
|
||||
if(APPLE)
|
||||
set( OPENGL_LDFLAGS "-framework OpenGL" )
|
||||
else()
|
||||
set( OPENGL_LDFLAGS ${OPENGL_LIBRARIES} )
|
||||
set( SYS_LIBS -lrt -lpthread )
|
||||
endif()
|
||||
|
||||
endif(WIN32)
|
||||
|
||||
include_directories( ${CMAKE_SOURCE_DIR}/src )
|
||||
include_directories( ${CMAKE_SOURCE_DIR}/src/drivers )
|
||||
|
||||
if(APPLE)
|
||||
add_definitions( -DPSS_STYLE=4 )
|
||||
else(APPLE)
|
||||
if(UNIX)
|
||||
add_definitions( -DPSS_STYLE=1 )
|
||||
endif(UNIX)
|
||||
endif(APPLE)
|
||||
|
||||
set(SRC_CORE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/asm.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cart.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cheat.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/conddebug.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/config.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/debug.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drawing.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fceu.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fds.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/file.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/emufile.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/filter.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ines.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/movie.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/netplay.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/nsf.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/oldmovie.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/palette.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ppu.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sound.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/state.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/unif.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/video.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vsuni.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wave.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/x6502.cpp
|
||||
${LUA_ENGINE_SOURCE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/01-222.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/09-034a.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/103.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/106.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/108.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/112.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/116.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/117.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/120.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/121.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/12in1.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/151.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/156.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/158B.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/15.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/164.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/168.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/170.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/175.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/176.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/177.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/178.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/183.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/185.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/186.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/187.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/189.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/18.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/190.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/193.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/199.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/206.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/208.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/222.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/225.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/228.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/230.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/232.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/234.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/235.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/244.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/246.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/252.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/253.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/28.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/32.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/33.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/34.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/36.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/3d-block.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/40.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/411120-c.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/41.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/42.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/43.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/46.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/50.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/51.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/57.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/603-5052.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/62.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/65.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/67.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/68.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/69.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/71.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/72.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/77.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/79.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/80013-B.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/80.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/8157.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/8237.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/82.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/830118C.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/88.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/8in1.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/90.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/91.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/96.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/99.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/a9746.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/ac-08.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/addrlatch.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/ax5705.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/bandai.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/bb.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/bmc13in1jy110.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/bmc42in1r.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/bmc64in1nr.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/bmc70in1.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/BMW8544.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/bonza.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/bs-5.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/cheapocabra.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/cityfighter.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/coolboy.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/dance2000.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/datalatch.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/dream.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/__dummy_mapper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/edu2000.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/eh8813a.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/emu2413.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/et-100.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/et-4320.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/F-15.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/famicombox.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/ffe.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/fk23c.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/fns.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/ghostbusters63in1.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/gs-2004.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/gs-2013.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/h2288.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/hp10xx_hp20xx.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/hp898f.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/inlnsf.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/karaoke.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/kof97.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/ks7010.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/ks7012.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/ks7013.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/ks7016.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/ks7017.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/ks7030.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/ks7031.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/ks7032.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/ks7037.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/ks7057.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/le05.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/lh32.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/lh53.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/malee.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/mihunche.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/mmc1.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/mmc2and4.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/mmc3.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/mmc5.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/n106.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/n625092.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/novel.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/onebus.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/pec-586.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/rt-01.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/sa-9602b.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/sachen.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/sb-2000.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/sc-127.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/sheroes.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/sl1632.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/subor.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/super24.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/supervision.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/t-227-1.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/t-262.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/tengen.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/tf-1201.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/transformer.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/unrom512.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/vrc1.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/vrc2and4.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/vrc3.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/vrc5.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/vrc6.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/vrc7.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/vrc7p.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/yoko.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/arkanoid.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/bworld.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/cursor.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/fkb.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/fns.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/ftrainer.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/hypershot.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/mahjong.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/mouse.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/oekakids.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/pec586kb.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/powerpad.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/quiz.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/shadow.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/snesmouse.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/suborkb.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/toprider.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/virtualboy.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/zapper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/backward.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/ConvertUTF.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/xstring.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/crc32.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/endian.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/general.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/guid.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/md5.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/memory.cpp
|
||||
)
|
||||
|
||||
|
||||
set(SRC_DRIVERS_COMMON
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/common/args.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/common/cheat.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/common/config.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/common/configSys.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/common/hq2x.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/common/hq3x.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/common/scale2x.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/common/scale3x.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/common/scalebit.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/common/vidblit.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/common/nes_ntsc.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/videolog/nesvideos-piece.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/videolog/rgbtorgb.cpp
|
||||
)
|
||||
|
||||
set(SRC_DRIVERS_SDL
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/main.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleWindow.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleViewerGL.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleViewerSDL.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/GamePadConf.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/HotKeyConf.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleVideoConf.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleSoundConf.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/AboutWindow.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/fceuWrapper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/config.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/input.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/nes_shm.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/keyscan.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/sdl-sound.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/sdl-video.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/sdl-joystick.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/sdl-throttle.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/unix-netplay.cpp
|
||||
)
|
||||
|
||||
set(SOURCES ${SRC_CORE} ${SRC_DRIVERS_COMMON} ${SRC_DRIVERS_SDL})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fceux_git_info.cpp
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/scripts/genGitHdr.sh ${CMAKE_CURRENT_BINARY_DIR}
|
||||
VERBATIM )
|
||||
|
||||
set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/fceux_git_info.cpp PROPERTY SKIP_AUTOGEN ON)
|
||||
|
||||
if (APPLE)
|
||||
|
||||
set(MACOSX_BUNDLE_ICON_FILE fceux.icns)
|
||||
set(APP_ICON ${CMAKE_SOURCE_DIR}/fceux.icns )
|
||||
set_source_files_properties( ${APP_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources" )
|
||||
|
||||
add_executable( ${APP_NAME} MACOSX_BUNDLE ${APP_ICON} ${SOURCES} ../resources.qrc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/fceux_git_info.cpp)
|
||||
|
||||
else()
|
||||
add_executable( ${APP_NAME} ${SOURCES} ../resources.qrc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/fceux_git_info.cpp)
|
||||
endif()
|
||||
|
||||
target_link_libraries( fceux
|
||||
${Qt5Widgets_LIBRARIES}
|
||||
${Qt5OpenGL_LIBRARIES}
|
||||
${OPENGL_LDFLAGS}
|
||||
${SDL2_LDFLAGS}
|
||||
${MINIZIP_LDFLAGS} ${ZLIB_LIBRARIES}
|
||||
${LUA_LDFLAGS}
|
||||
${SYS_LIBS}
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
|
||||
install( TARGETS ${APP_NAME}
|
||||
BUNDLE DESTINATION . COMPONENT Runtime
|
||||
RUNTIME DESTINATION bin COMPONENT Runtime )
|
||||
|
||||
set( APPS ${CMAKE_INSTALL_PREFIX}/${APP_NAME}.app)
|
||||
set( DIRS ${CMAKE_BINARY_DIR} /usr/local/lib)
|
||||
|
||||
message(STATUS APPS: ${APPS})
|
||||
message(STATUS DIRS: ${DIRS} )
|
||||
|
||||
set(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/fceux.icns )
|
||||
set(CPACK_BUNDLE_ICON ${CMAKE_SOURCE_DIR}/fceux.icns )
|
||||
set(CPACK_GENERATOR "DRAGNDROP")
|
||||
include(CPACK)
|
||||
|
||||
install( CODE "include(BundleUtilities)
|
||||
fixup_bundle( \"${APPS}\" \"\" \"${DIRS}\") "
|
||||
COMPONENT Runtime
|
||||
)
|
||||
|
||||
else(APPLE)
|
||||
|
||||
install( TARGETS ${APP_NAME}
|
||||
RUNTIME DESTINATION bin )
|
||||
|
||||
install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/auxlib.lua DESTINATION share/fceux/luaScripts )
|
||||
install( DIRECTORY ${CMAKE_SOURCE_DIR}/output/. DESTINATION share/fceux )
|
||||
install( FILES ${CMAKE_SOURCE_DIR}/fceux.png DESTINATION share/pixmaps )
|
||||
install( FILES ${CMAKE_SOURCE_DIR}/fceux.desktop DESTINATION share/applications )
|
||||
install( FILES ${CMAKE_SOURCE_DIR}/documentation/fceux.6 DESTINATION share/man/man6 )
|
||||
install( FILES ${CMAKE_SOURCE_DIR}/documentation/fceux-net-server.6 DESTINATION share/man/man6 )
|
||||
|
||||
endif(APPLE)
|
|
@ -40,7 +40,7 @@ typedef struct {
|
|||
|
||||
struct CHEATF {
|
||||
struct CHEATF *next;
|
||||
char *name = "";
|
||||
char *name;
|
||||
uint16 addr;
|
||||
uint8 val;
|
||||
int compare; /* -1 for no compare. */
|
||||
|
@ -65,4 +65,4 @@ struct SEARCHPOSSIBLE {
|
|||
#define FCEU_SEARCH_NEWVAL_GT_KNOWN 7
|
||||
#define FCEU_SEARCH_NEWVAL_LT_KNOWN 8
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -23,7 +23,7 @@ ArchiveScanRecord FCEUD_ScanArchive(std::string fname);
|
|||
const char *FCEUD_GetCompilerString();
|
||||
|
||||
//This makes me feel dirty for some reason.
|
||||
void FCEU_printf(char *format, ...);
|
||||
void FCEU_printf(const char *format, ...);
|
||||
#define FCEUI_printf FCEU_printf
|
||||
|
||||
//Video interface
|
||||
|
@ -183,7 +183,7 @@ void FCEUD_LuaRunFrom(void);
|
|||
int32 FCEUI_GetDesiredFPS(void);
|
||||
void FCEUI_SaveSnapshot(void);
|
||||
void FCEUI_SaveSnapshotAs(void);
|
||||
void FCEU_DispMessage(char *format, int disppos, ...);
|
||||
void FCEU_DispMessage(const char *format, int disppos, ...);
|
||||
#define FCEUI_DispMessage FCEU_DispMessage
|
||||
|
||||
int FCEUI_DecodePAR(const char *code, int *a, int *v, int *c, int *type);
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
QMAKE_CXX.INCDIRS = \
|
||||
/usr/include/c++/8 \
|
||||
/usr/include/c++/8/x86_64-redhat-linux \
|
||||
/usr/include/c++/8/backward \
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8/include \
|
||||
/usr/local/include \
|
||||
/usr/include
|
||||
QMAKE_CXX.LIBDIRS = \
|
||||
/usr/lib/gcc/x86_64-redhat-linux/8 \
|
||||
/usr/lib64 \
|
||||
/lib64 \
|
||||
/usr/lib \
|
||||
/lib
|
||||
QMAKE_CXX.QT_COMPILER_STDCXX = 201402L
|
||||
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 8
|
||||
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 3
|
||||
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 1
|
||||
QMAKE_CXX.COMPILER_MACROS = \
|
||||
QT_COMPILER_STDCXX \
|
||||
QMAKE_GCC_MAJOR_VERSION \
|
||||
QMAKE_GCC_MINOR_VERSION \
|
||||
QMAKE_GCC_PATCH_VERSION
|
|
@ -0,0 +1,150 @@
|
|||
// AboutWindow.cpp
|
||||
//
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QUrl>
|
||||
#include <QTextEdit>
|
||||
#include <QDesktopServices>
|
||||
//#include "Qt/icon.xpm"
|
||||
#include "Qt/AboutWindow.h"
|
||||
#include "Qt/fceux_git_info.h"
|
||||
#include "../../version.h"
|
||||
|
||||
static const char *Authors[] = {
|
||||
"Linux/SDL Developers:",
|
||||
"\t Lukas Sabota //punkrockguy318", "\t Soules", "\t Bryan Cain", "\t radsaq",
|
||||
"\t Shinydoofy",
|
||||
"FceuX 2.0 Developers:",
|
||||
"\t SP", "\t zeromus", "\t adelikat", "\t caH4e3", "\t qfox",
|
||||
"\t Luke Gustafson", "\t _mz", "\t UncombedCoconut", "\t DwEdit", "\t AnS",
|
||||
"\t rainwarrior", "\t feos",
|
||||
"Pre 2.0 Guys:",
|
||||
"\t Bero", "\t Xodnizel", "\t Aaron Oneal", "\t Joe Nahmias",
|
||||
"\t Paul Kuliniewicz", "\t Quietust", "\t Ben Parnell",
|
||||
"\t Parasyte & bbitmaster",
|
||||
"\t blip & nitsuja",
|
||||
"Included components:",
|
||||
"\t Mitsutaka Okazaki - YM2413 emulator",
|
||||
"\t Andrea Mazzoleni - Scale2x/Scale3x scalers",
|
||||
"\t Gilles Vollant - unzip.c PKZIP fileio",
|
||||
NULL
|
||||
};
|
||||
//----------------------------------------------------------------------------
|
||||
AboutWindow::AboutWindow(QWidget *parent)
|
||||
: QDialog( parent )
|
||||
{
|
||||
int i;
|
||||
QVBoxLayout *mainLayout;
|
||||
QHBoxLayout *hbox1;
|
||||
//QPixmap pm( icon_xpm );
|
||||
QPixmap pm(":fceux1.png");
|
||||
QPixmap pm2;
|
||||
QLabel *lbl;
|
||||
QTextEdit *credits;
|
||||
char stmp[256];
|
||||
|
||||
pm2 = pm.scaled( 64, 64 );
|
||||
|
||||
setWindowTitle( tr("About fceuX") );
|
||||
|
||||
resize( 512, 512 );
|
||||
|
||||
mainLayout = new QVBoxLayout();
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
lbl = new QLabel();
|
||||
lbl->setPixmap(pm2);
|
||||
|
||||
hbox1->addWidget( lbl );
|
||||
hbox1->setAlignment( Qt::AlignCenter );
|
||||
|
||||
mainLayout->addLayout( hbox1 );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
lbl = new QLabel( tr("fceuX") );
|
||||
|
||||
hbox1->addWidget( lbl );
|
||||
hbox1->setAlignment( Qt::AlignCenter );
|
||||
|
||||
mainLayout->addLayout( hbox1 );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
lbl = new QLabel( tr(FCEU_VERSION_STRING) );
|
||||
|
||||
hbox1->addWidget( lbl );
|
||||
hbox1->setAlignment( Qt::AlignCenter );
|
||||
|
||||
mainLayout->addLayout( hbox1 );
|
||||
|
||||
sprintf( stmp, "git URL: %s", fceu_get_git_url() );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
lbl = new QLabel( tr(stmp) );
|
||||
|
||||
hbox1->addWidget( lbl );
|
||||
hbox1->setAlignment( Qt::AlignCenter );
|
||||
|
||||
mainLayout->addLayout( hbox1 );
|
||||
|
||||
sprintf( stmp, "git Revision: %s", fceu_get_git_rev() );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
lbl = new QLabel( tr(stmp) );
|
||||
|
||||
hbox1->addWidget( lbl );
|
||||
hbox1->setAlignment( Qt::AlignCenter );
|
||||
|
||||
mainLayout->addLayout( hbox1 );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
lbl = new QLabel();
|
||||
lbl->setText("<a href=\"http://fceux.com\">Website</a>");
|
||||
lbl->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
lbl->setOpenExternalLinks(true);
|
||||
|
||||
hbox1->addWidget( lbl );
|
||||
hbox1->setAlignment( Qt::AlignCenter );
|
||||
|
||||
mainLayout->addLayout( hbox1 );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
lbl = new QLabel( tr("License: GPL") );
|
||||
|
||||
hbox1->addWidget( lbl );
|
||||
hbox1->setAlignment( Qt::AlignCenter );
|
||||
|
||||
mainLayout->addLayout( hbox1 );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
lbl = new QLabel( tr("© 2016 FceuX Development Team") );
|
||||
|
||||
hbox1->addWidget( lbl );
|
||||
hbox1->setAlignment( Qt::AlignCenter );
|
||||
|
||||
mainLayout->addLayout( hbox1 );
|
||||
|
||||
credits = new QTextEdit();
|
||||
|
||||
i=0;
|
||||
while ( Authors[i] != NULL )
|
||||
{
|
||||
credits->insertPlainText( Authors[i] ); i++;
|
||||
credits->insertPlainText( "\n");
|
||||
}
|
||||
credits->moveCursor(QTextCursor::Start);
|
||||
credits->setReadOnly(true);
|
||||
|
||||
mainLayout->addWidget( credits );
|
||||
|
||||
setLayout( mainLayout );
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
AboutWindow::~AboutWindow(void)
|
||||
{
|
||||
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
|
@ -0,0 +1,35 @@
|
|||
// GamePadConf.h
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QFrame>
|
||||
#include <QGroupBox>
|
||||
#include <QTreeView>
|
||||
#include <QTreeWidget>
|
||||
|
||||
#include "Qt/main.h"
|
||||
|
||||
class AboutWindow : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AboutWindow(QWidget *parent = 0);
|
||||
~AboutWindow(void);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
private slots:
|
||||
|
||||
};
|
|
@ -0,0 +1,449 @@
|
|||
// ConsoleSoundConf.cpp
|
||||
//
|
||||
#include "../../fceu.h"
|
||||
#include "../../driver.h"
|
||||
#include "Qt/ConsoleSoundConf.h"
|
||||
#include "Qt/main.h"
|
||||
#include "Qt/dface.h"
|
||||
#include "Qt/config.h"
|
||||
#include "Qt/fceuWrapper.h"
|
||||
|
||||
//----------------------------------------------------
|
||||
ConsoleSndConfDialog_t::ConsoleSndConfDialog_t(QWidget *parent)
|
||||
: QDialog( parent )
|
||||
{
|
||||
int buf;
|
||||
QHBoxLayout *hbox1, *hbox2;
|
||||
QVBoxLayout *vbox1, *vbox2;
|
||||
QLabel *lbl;
|
||||
QGroupBox *frame;
|
||||
QSlider *vslider;
|
||||
|
||||
setWindowTitle( tr("Sound Config") );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
vbox1 = new QVBoxLayout();
|
||||
|
||||
// Enable Sound Select
|
||||
enaChkbox = new QCheckBox( tr("Enable Sound") );
|
||||
// Enable Low Pass Filter Select
|
||||
enaLowPass = new QCheckBox( tr("Enable Low Pass Filter") );
|
||||
|
||||
setCheckBoxFromProperty( enaChkbox , "SDL.Sound" );
|
||||
setCheckBoxFromProperty( enaLowPass, "SDL.Sound.LowPass" );
|
||||
|
||||
connect(enaChkbox , SIGNAL(stateChanged(int)), this, SLOT(enaSoundStateChange(int)) );
|
||||
connect(enaLowPass, SIGNAL(stateChanged(int)), this, SLOT(enaSoundLowPassChange(int)) );
|
||||
|
||||
vbox1->addWidget( enaChkbox );
|
||||
vbox1->addWidget( enaLowPass );
|
||||
|
||||
// Audio Quality Select
|
||||
hbox2 = new QHBoxLayout();
|
||||
|
||||
lbl = new QLabel( tr("Quality:") );
|
||||
|
||||
qualitySelect = new QComboBox();
|
||||
|
||||
qualitySelect->addItem( tr("Low") , 0 );
|
||||
qualitySelect->addItem( tr("High") , 1 );
|
||||
qualitySelect->addItem( tr("Very High"), 2 );
|
||||
|
||||
setComboBoxFromProperty( qualitySelect, "SDL.Sound.Quality" );
|
||||
|
||||
connect(qualitySelect, SIGNAL(currentIndexChanged(int)), this, SLOT(soundQualityChanged(int)) );
|
||||
|
||||
hbox2->addWidget( lbl );
|
||||
hbox2->addWidget( qualitySelect );
|
||||
|
||||
vbox1->addLayout( hbox2 );
|
||||
|
||||
// Sample Rate Select
|
||||
hbox2 = new QHBoxLayout();
|
||||
|
||||
lbl = new QLabel("Rate:");
|
||||
|
||||
rateSelect = new QComboBox();
|
||||
|
||||
rateSelect->addItem( tr("11025"), 11025 );
|
||||
rateSelect->addItem( tr("22050"), 22050 );
|
||||
rateSelect->addItem( tr("44100"), 44100 );
|
||||
rateSelect->addItem( tr("48000"), 48000 );
|
||||
rateSelect->addItem( tr("96000"), 96000 );
|
||||
|
||||
setComboBoxFromProperty( rateSelect, "SDL.Sound.Rate" );
|
||||
|
||||
connect(rateSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(soundRateChanged(int)) );
|
||||
|
||||
g_config->getOption ("SDL.Sound.Rate", &buf);
|
||||
|
||||
hbox2->addWidget( lbl );
|
||||
hbox2->addWidget( rateSelect );
|
||||
|
||||
vbox1->addLayout( hbox2 );
|
||||
|
||||
// Buffer Size Select
|
||||
//
|
||||
hbox2 = new QHBoxLayout();
|
||||
|
||||
lbl = new QLabel( tr("Buffer Size (in ms):") );
|
||||
|
||||
bufSizeLabel = new QLabel("128");
|
||||
bufSizeSlider = new QSlider( Qt::Horizontal );
|
||||
|
||||
bufSizeSlider->setMinimum( 15);
|
||||
bufSizeSlider->setMaximum(200);
|
||||
//bufSizeSlider->setSliderPosition(128);
|
||||
setSliderFromProperty( bufSizeSlider, bufSizeLabel, "SDL.Sound.BufSize" );
|
||||
|
||||
hbox2->addWidget( lbl );
|
||||
hbox2->addWidget( bufSizeLabel );
|
||||
|
||||
vbox1->addLayout( hbox2 );
|
||||
vbox1->addWidget( bufSizeSlider );
|
||||
|
||||
connect(bufSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(bufSizeChanged(int)) );
|
||||
|
||||
// Swap Duty Cycles
|
||||
swapDutyChkbox = new QCheckBox( tr("Swap Duty Cycles") );
|
||||
vbox1->addWidget( swapDutyChkbox );
|
||||
|
||||
setCheckBoxFromProperty( swapDutyChkbox , "SDL.SwapDuty" );
|
||||
|
||||
connect(swapDutyChkbox , SIGNAL(stateChanged(int)), this, SLOT(swapDutyCallback(int)) );
|
||||
|
||||
hbox1->addLayout( vbox1 );
|
||||
|
||||
frame = new QGroupBox(tr("Mixer:"));
|
||||
hbox2 = new QHBoxLayout();
|
||||
|
||||
frame->setLayout( hbox2 );
|
||||
|
||||
hbox1->addWidget( frame );
|
||||
|
||||
frame = new QGroupBox(tr("Volume"));
|
||||
vbox2 = new QVBoxLayout();
|
||||
volLbl = new QLabel("150");
|
||||
vslider = new QSlider( Qt::Vertical );
|
||||
vslider->setMinimum( 0);
|
||||
vslider->setMaximum(255);
|
||||
setSliderFromProperty( vslider, volLbl, "SDL.Sound.Volume" );
|
||||
|
||||
vbox2->addWidget( volLbl );
|
||||
vbox2->addWidget( vslider );
|
||||
frame->setLayout( vbox2 );
|
||||
hbox2->addWidget( frame );
|
||||
|
||||
connect(vslider, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int)) );
|
||||
|
||||
frame = new QGroupBox(tr("Triangle"));
|
||||
vbox2 = new QVBoxLayout();
|
||||
triLbl = new QLabel("255");
|
||||
vslider = new QSlider( Qt::Vertical );
|
||||
vslider->setMinimum( 0);
|
||||
vslider->setMaximum(255);
|
||||
setSliderFromProperty( vslider, triLbl, "SDL.Sound.TriangleVolume" );
|
||||
|
||||
vbox2->addWidget( triLbl );
|
||||
vbox2->addWidget( vslider );
|
||||
frame->setLayout( vbox2 );
|
||||
hbox2->addWidget( frame );
|
||||
|
||||
connect(vslider, SIGNAL(valueChanged(int)), this, SLOT(triangleChanged(int)) );
|
||||
|
||||
frame = new QGroupBox(tr("Square1"));
|
||||
vbox2 = new QVBoxLayout();
|
||||
sqr1Lbl = new QLabel("255");
|
||||
vslider = new QSlider( Qt::Vertical );
|
||||
vslider->setMinimum( 0);
|
||||
vslider->setMaximum(255);
|
||||
setSliderFromProperty( vslider, sqr1Lbl, "SDL.Sound.Square1Volume" );
|
||||
|
||||
vbox2->addWidget( sqr1Lbl );
|
||||
vbox2->addWidget( vslider );
|
||||
frame->setLayout( vbox2 );
|
||||
hbox2->addWidget( frame );
|
||||
|
||||
connect(vslider, SIGNAL(valueChanged(int)), this, SLOT(square1Changed(int)) );
|
||||
|
||||
frame = new QGroupBox(tr("Square2"));
|
||||
vbox2 = new QVBoxLayout();
|
||||
sqr2Lbl = new QLabel("255");
|
||||
vslider = new QSlider( Qt::Vertical );
|
||||
vslider->setMinimum( 0);
|
||||
vslider->setMaximum(255);
|
||||
setSliderFromProperty( vslider, sqr2Lbl, "SDL.Sound.Square2Volume" );
|
||||
|
||||
vbox2->addWidget( sqr2Lbl );
|
||||
vbox2->addWidget( vslider );
|
||||
frame->setLayout( vbox2 );
|
||||
hbox2->addWidget( frame );
|
||||
|
||||
connect(vslider, SIGNAL(valueChanged(int)), this, SLOT(square2Changed(int)) );
|
||||
|
||||
frame = new QGroupBox(tr("Noise"));
|
||||
vbox2 = new QVBoxLayout();
|
||||
nseLbl = new QLabel("255");
|
||||
vslider = new QSlider( Qt::Vertical );
|
||||
vslider->setMinimum( 0);
|
||||
vslider->setMaximum(255);
|
||||
setSliderFromProperty( vslider, nseLbl, "SDL.Sound.NoiseVolume" );
|
||||
|
||||
vbox2->addWidget( nseLbl );
|
||||
vbox2->addWidget( vslider );
|
||||
frame->setLayout( vbox2 );
|
||||
hbox2->addWidget( frame );
|
||||
|
||||
connect(vslider, SIGNAL(valueChanged(int)), this, SLOT(noiseChanged(int)) );
|
||||
|
||||
frame = new QGroupBox(tr("PCM"));
|
||||
vbox2 = new QVBoxLayout();
|
||||
pcmLbl = new QLabel("255");
|
||||
vslider = new QSlider( Qt::Vertical );
|
||||
vslider->setMinimum( 0);
|
||||
vslider->setMaximum(255);
|
||||
setSliderFromProperty( vslider, pcmLbl, "SDL.Sound.PCMVolume" );
|
||||
|
||||
vbox2->addWidget( pcmLbl );
|
||||
vbox2->addWidget( vslider );
|
||||
frame->setLayout( vbox2 );
|
||||
hbox2->addWidget( frame );
|
||||
|
||||
connect(vslider, SIGNAL(valueChanged(int)), this, SLOT(pcmChanged(int)) );
|
||||
|
||||
// Set Final Layout
|
||||
setLayout( hbox1 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
ConsoleSndConfDialog_t::~ConsoleSndConfDialog_t(void)
|
||||
{
|
||||
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::setCheckBoxFromProperty( QCheckBox *cbx, const char *property )
|
||||
{
|
||||
int pval;
|
||||
g_config->getOption (property, &pval);
|
||||
|
||||
cbx->setCheckState( pval ? Qt::Checked : Qt::Unchecked );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::setComboBoxFromProperty( QComboBox *cbx, const char *property )
|
||||
{
|
||||
int i, pval;
|
||||
g_config->getOption (property, &pval);
|
||||
|
||||
for (i=0; i<cbx->count(); i++)
|
||||
{
|
||||
if ( pval == cbx->itemData(i).toInt() )
|
||||
{
|
||||
cbx->setCurrentIndex(i); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::setSliderFromProperty( QSlider *slider, QLabel *lbl, const char *property )
|
||||
{
|
||||
int pval;
|
||||
char stmp[32];
|
||||
g_config->getOption (property, &pval);
|
||||
slider->setValue( pval );
|
||||
sprintf( stmp, "%i", pval );
|
||||
lbl->setText( stmp );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::bufSizeChanged(int value)
|
||||
{
|
||||
char stmp[32];
|
||||
|
||||
sprintf( stmp, "%i", value );
|
||||
|
||||
bufSizeLabel->setText(stmp);
|
||||
|
||||
g_config->setOption ("SDL.Sound.BufSize", value);
|
||||
// reset sound subsystem for changes to take effect
|
||||
fceuWrapperLock();
|
||||
KillSound ();
|
||||
InitSound ();
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::volumeChanged(int value)
|
||||
{
|
||||
char stmp[32];
|
||||
|
||||
sprintf( stmp, "%i", value );
|
||||
|
||||
volLbl->setText(stmp);
|
||||
|
||||
g_config->setOption ("SDL.Sound.Volume", value);
|
||||
|
||||
fceuWrapperLock();
|
||||
FCEUI_SetSoundVolume (value);
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::triangleChanged(int value)
|
||||
{
|
||||
char stmp[32];
|
||||
|
||||
sprintf( stmp, "%i", value );
|
||||
|
||||
triLbl->setText(stmp);
|
||||
|
||||
g_config->setOption ("SDL.Sound.TriangleVolume", value);
|
||||
|
||||
fceuWrapperLock();
|
||||
FCEUI_SetTriangleVolume (value);
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::square1Changed(int value)
|
||||
{
|
||||
char stmp[32];
|
||||
|
||||
sprintf( stmp, "%i", value );
|
||||
|
||||
sqr1Lbl->setText(stmp);
|
||||
|
||||
g_config->setOption ("SDL.Sound.Square1Volume", value);
|
||||
|
||||
fceuWrapperLock();
|
||||
FCEUI_SetSquare1Volume (value);
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::square2Changed(int value)
|
||||
{
|
||||
char stmp[32];
|
||||
|
||||
sprintf( stmp, "%i", value );
|
||||
|
||||
sqr2Lbl->setText(stmp);
|
||||
|
||||
g_config->setOption ("SDL.Sound.Square2Volume", value);
|
||||
|
||||
fceuWrapperLock();
|
||||
FCEUI_SetSquare2Volume (value);
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::noiseChanged(int value)
|
||||
{
|
||||
char stmp[32];
|
||||
|
||||
sprintf( stmp, "%i", value );
|
||||
|
||||
nseLbl->setText(stmp);
|
||||
|
||||
g_config->setOption ("SDL.Sound.NoiseVolume", value);
|
||||
|
||||
fceuWrapperLock();
|
||||
FCEUI_SetNoiseVolume (value);
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::pcmChanged(int value)
|
||||
{
|
||||
char stmp[32];
|
||||
|
||||
sprintf( stmp, "%i", value );
|
||||
|
||||
pcmLbl->setText(stmp);
|
||||
|
||||
g_config->setOption ("SDL.Sound.PCMVolume", value);
|
||||
|
||||
fceuWrapperLock();
|
||||
FCEUI_SetPCMVolume (value);
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::enaSoundStateChange(int value)
|
||||
{
|
||||
if ( value )
|
||||
{
|
||||
int last_soundopt;
|
||||
g_config->getOption ("SDL.Sound", &last_soundopt);
|
||||
g_config->setOption ("SDL.Sound", 1);
|
||||
|
||||
fceuWrapperLock();
|
||||
|
||||
if (GameInfo && !last_soundopt)
|
||||
{
|
||||
InitSound ();
|
||||
}
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
else
|
||||
{
|
||||
g_config->setOption ("SDL.Sound", 0);
|
||||
|
||||
fceuWrapperLock();
|
||||
KillSound ();
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::enaSoundLowPassChange(int value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
g_config->setOption ("SDL.Sound.LowPass", 1);
|
||||
|
||||
fceuWrapperLock();
|
||||
FCEUI_SetLowPass (1);
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
else
|
||||
{
|
||||
g_config->setOption ("SDL.Sound.LowPass", 0);
|
||||
|
||||
fceuWrapperLock();
|
||||
FCEUI_SetLowPass (0);
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
g_config->save ();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::swapDutyCallback(int value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
g_config->setOption ("SDL.SwapDuty", 1);
|
||||
swapDuty = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_config->setOption ("SDL.SwapDuty", 0);
|
||||
swapDuty = 0;
|
||||
}
|
||||
g_config->save ();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::soundQualityChanged(int index)
|
||||
{
|
||||
//printf("Sound Quality: %i : %i \n", index, qualitySelect->itemData(index).toInt() );
|
||||
|
||||
g_config->setOption ("SDL.Sound.Quality", qualitySelect->itemData(index).toInt() );
|
||||
|
||||
// reset sound subsystem for changes to take effect
|
||||
fceuWrapperLock();
|
||||
KillSound ();
|
||||
InitSound ();
|
||||
fceuWrapperUnLock();
|
||||
g_config->save ();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::soundRateChanged(int index)
|
||||
{
|
||||
//printf("Sound Rate: %i : %i \n", index, rateSelect->itemData(index).toInt() );
|
||||
|
||||
g_config->setOption ("SDL.Sound.Rate", rateSelect->itemData(index).toInt() );
|
||||
// reset sound subsystem for changes to take effect
|
||||
fceuWrapperLock();
|
||||
KillSound ();
|
||||
InitSound ();
|
||||
fceuWrapperUnLock();
|
||||
g_config->save ();
|
||||
}
|
||||
//----------------------------------------------------
|
|
@ -0,0 +1,62 @@
|
|||
// GameSoundConf.h
|
||||
//
|
||||
|
||||
#ifndef __GameSndH__
|
||||
#define __GameSndH__
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QSlider>
|
||||
#include <QFrame>
|
||||
#include <QGroupBox>
|
||||
|
||||
class ConsoleSndConfDialog_t : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConsoleSndConfDialog_t(QWidget *parent = 0);
|
||||
~ConsoleSndConfDialog_t(void);
|
||||
|
||||
protected:
|
||||
QCheckBox *enaChkbox;
|
||||
QCheckBox *enaLowPass;
|
||||
QCheckBox *swapDutyChkbox;
|
||||
QComboBox *qualitySelect;
|
||||
QComboBox *rateSelect;
|
||||
QSlider *bufSizeSlider;
|
||||
QLabel *bufSizeLabel;
|
||||
QLabel *volLbl;
|
||||
QLabel *triLbl;
|
||||
QLabel *sqr1Lbl;
|
||||
QLabel *sqr2Lbl;
|
||||
QLabel *nseLbl;
|
||||
QLabel *pcmLbl;
|
||||
|
||||
void setCheckBoxFromProperty( QCheckBox *cbx, const char *property );
|
||||
void setComboBoxFromProperty( QComboBox *cbx, const char *property );
|
||||
void setSliderFromProperty( QSlider *slider, QLabel *lbl, const char *property );
|
||||
|
||||
private slots:
|
||||
void bufSizeChanged(int value);
|
||||
void volumeChanged(int value);
|
||||
void triangleChanged(int value);
|
||||
void square1Changed(int value);
|
||||
void square2Changed(int value);
|
||||
void noiseChanged(int value);
|
||||
void pcmChanged(int value);
|
||||
void enaSoundStateChange(int value);
|
||||
void enaSoundLowPassChange(int value);
|
||||
void swapDutyCallback(int value);
|
||||
void soundQualityChanged(int index);
|
||||
void soundRateChanged(int index);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,228 @@
|
|||
// ConsoleVideoConf.cpp
|
||||
//
|
||||
#include "../../fceu.h"
|
||||
#include "Qt/main.h"
|
||||
#include "Qt/dface.h"
|
||||
#include "Qt/config.h"
|
||||
#include "Qt/fceuWrapper.h"
|
||||
#include "Qt/ConsoleVideoConf.h"
|
||||
|
||||
//----------------------------------------------------
|
||||
ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
|
||||
: QDialog( parent )
|
||||
{
|
||||
QVBoxLayout *main_vbox;
|
||||
QHBoxLayout *hbox1;
|
||||
QLabel *lbl;
|
||||
QPushButton *button;
|
||||
|
||||
setWindowTitle( tr("Video Config") );
|
||||
|
||||
main_vbox = new QVBoxLayout();
|
||||
|
||||
// Video Driver Select
|
||||
lbl = new QLabel( tr("Driver:") );
|
||||
|
||||
driverSelect = new QComboBox();
|
||||
|
||||
driverSelect->addItem( tr("OpenGL"), 0 );
|
||||
//driverSelect->addItem( tr("SDL"), 1 );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
|
||||
hbox1->addWidget( lbl );
|
||||
hbox1->addWidget( driverSelect );
|
||||
|
||||
main_vbox->addLayout( hbox1 );
|
||||
|
||||
// Enable OpenGL Linear Filter Checkbox
|
||||
gl_LF_chkBox = new QCheckBox( tr("Enable OpenGL Linear Filter") );
|
||||
|
||||
setCheckBoxFromProperty( gl_LF_chkBox , "SDL.OpenGLip");
|
||||
|
||||
main_vbox->addWidget( gl_LF_chkBox );
|
||||
|
||||
// Region Select
|
||||
lbl = new QLabel( tr("Region:") );
|
||||
|
||||
regionSelect = new QComboBox();
|
||||
|
||||
regionSelect->addItem( tr("NTSC") , 0 );
|
||||
regionSelect->addItem( tr("PAL") , 1 );
|
||||
regionSelect->addItem( tr("Dendy"), 2 );
|
||||
|
||||
setComboBoxFromProperty( regionSelect, "SDL.PAL");
|
||||
|
||||
connect(regionSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(regionChanged(int)) );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
|
||||
hbox1->addWidget( lbl );
|
||||
hbox1->addWidget( regionSelect );
|
||||
|
||||
main_vbox->addLayout( hbox1 );
|
||||
|
||||
// Enable New PPU Checkbox
|
||||
new_PPU_ena = new QCheckBox( tr("Enable New PPU") );
|
||||
|
||||
// Enable New PPU Checkbox
|
||||
frmskipcbx = new QCheckBox( tr("Enable Frameskip") );
|
||||
|
||||
// Disable Sprite Limit Checkbox
|
||||
sprtLimCbx = new QCheckBox( tr("Disable Sprite Limit") );
|
||||
|
||||
// Clip Sides Checkbox
|
||||
clipSidesCbx = new QCheckBox( tr("Clip Sides") );
|
||||
|
||||
// Show FPS Checkbox
|
||||
showFPS_cbx = new QCheckBox( tr("Show FPS") );
|
||||
|
||||
setCheckBoxFromProperty( new_PPU_ena , "SDL.NewPPU");
|
||||
setCheckBoxFromProperty( frmskipcbx , "SDL.Frameskip");
|
||||
setCheckBoxFromProperty( sprtLimCbx , "SDL.DisableSpriteLimit");
|
||||
setCheckBoxFromProperty( clipSidesCbx , "SDL.ClipSides");
|
||||
setCheckBoxFromProperty( showFPS_cbx , "SDL.ShowFPS");
|
||||
|
||||
connect(new_PPU_ena , SIGNAL(stateChanged(int)), this, SLOT(use_new_PPU_changed(int)) );
|
||||
connect(frmskipcbx , SIGNAL(stateChanged(int)), this, SLOT(frameskip_changed(int)) );
|
||||
connect(sprtLimCbx , SIGNAL(stateChanged(int)), this, SLOT(useSpriteLimitChanged(int)) );
|
||||
connect(clipSidesCbx, SIGNAL(stateChanged(int)), this, SLOT(clipSidesChanged(int)) );
|
||||
connect(showFPS_cbx , SIGNAL(stateChanged(int)), this, SLOT(showFPSChanged(int)) );
|
||||
|
||||
main_vbox->addWidget( new_PPU_ena );
|
||||
main_vbox->addWidget( frmskipcbx );
|
||||
main_vbox->addWidget( sprtLimCbx );
|
||||
main_vbox->addWidget( clipSidesCbx);
|
||||
main_vbox->addWidget( showFPS_cbx );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
|
||||
button = new QPushButton( tr("Apply") );
|
||||
hbox1->addWidget( button );
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(applyChanges(void)) );
|
||||
|
||||
button = new QPushButton( tr("Close") );
|
||||
hbox1->addWidget( button );
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(closewindow(void)) );
|
||||
|
||||
main_vbox->addLayout( hbox1 );
|
||||
|
||||
setLayout( main_vbox );
|
||||
|
||||
}
|
||||
//----------------------------------------------------
|
||||
ConsoleVideoConfDialog_t::~ConsoleVideoConfDialog_t(void)
|
||||
{
|
||||
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::resetVideo(void)
|
||||
{
|
||||
KillVideo ();
|
||||
InitVideo (GameInfo);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::setCheckBoxFromProperty( QCheckBox *cbx, const char *property )
|
||||
{
|
||||
int pval;
|
||||
g_config->getOption (property, &pval);
|
||||
|
||||
cbx->setCheckState( pval ? Qt::Checked : Qt::Unchecked );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::setComboBoxFromProperty( QComboBox *cbx, const char *property )
|
||||
{
|
||||
int i, pval;
|
||||
g_config->getOption (property, &pval);
|
||||
|
||||
for (i=0; i<cbx->count(); i++)
|
||||
{
|
||||
if ( pval == cbx->itemData(i).toInt() )
|
||||
{
|
||||
cbx->setCurrentIndex(i); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::use_new_PPU_changed( int value )
|
||||
{
|
||||
//printf("Value:%i \n", value );
|
||||
g_config->setOption("SDL.NewPPU", (value == Qt::Checked) );
|
||||
g_config->save ();
|
||||
|
||||
fceuWrapperLock();
|
||||
UpdateEMUCore (g_config);
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::frameskip_changed( int value )
|
||||
{
|
||||
//printf("Value:%i \n", value );
|
||||
g_config->setOption("SDL.Frameskip", (value == Qt::Checked) );
|
||||
g_config->save ();
|
||||
|
||||
fceuWrapperLock();
|
||||
UpdateEMUCore (g_config);
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::useSpriteLimitChanged( int value )
|
||||
{
|
||||
//printf("Value:%i \n", value );
|
||||
g_config->setOption("SDL.DisableSpriteLimit", (value == Qt::Checked) );
|
||||
g_config->save ();
|
||||
|
||||
fceuWrapperLock();
|
||||
UpdateEMUCore (g_config);
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::clipSidesChanged( int value )
|
||||
{
|
||||
//printf("Value:%i \n", value );
|
||||
g_config->setOption("SDL.ClipSides", (value == Qt::Checked) );
|
||||
g_config->save ();
|
||||
|
||||
fceuWrapperLock();
|
||||
UpdateEMUCore (g_config);
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::showFPSChanged( int value )
|
||||
{
|
||||
//printf("Value:%i \n", value );
|
||||
g_config->setOption("SDL.ShowFPS", (value == Qt::Checked) );
|
||||
g_config->save ();
|
||||
|
||||
fceuWrapperLock();
|
||||
UpdateEMUCore (g_config);
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::regionChanged(int index)
|
||||
{
|
||||
int region;
|
||||
//printf("Region: %i : %i \n", index, regionSelect->itemData(index).toInt() );
|
||||
|
||||
region = regionSelect->itemData(index).toInt();
|
||||
|
||||
g_config->setOption ("SDL.PAL", region);
|
||||
|
||||
g_config->save ();
|
||||
|
||||
// reset sound subsystem for changes to take effect
|
||||
fceuWrapperLock();
|
||||
FCEUI_SetRegion (region, true);
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::applyChanges( void )
|
||||
{
|
||||
resetVideo();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::closewindow( void )
|
||||
{
|
||||
done(0);
|
||||
}
|
||||
//----------------------------------------------------
|
|
@ -0,0 +1,55 @@
|
|||
// ConsoleVideoConf.h
|
||||
//
|
||||
|
||||
#ifndef __ConsoleVideoH__
|
||||
#define __ConsoleVideoH__
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QSlider>
|
||||
#include <QFrame>
|
||||
#include <QGroupBox>
|
||||
|
||||
class ConsoleVideoConfDialog_t : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConsoleVideoConfDialog_t(QWidget *parent = 0);
|
||||
~ConsoleVideoConfDialog_t(void);
|
||||
|
||||
protected:
|
||||
QComboBox *driverSelect;
|
||||
QComboBox *regionSelect;
|
||||
QCheckBox *gl_LF_chkBox;
|
||||
QCheckBox *new_PPU_ena;
|
||||
QCheckBox *frmskipcbx;
|
||||
QCheckBox *sprtLimCbx;
|
||||
QCheckBox *clipSidesCbx;
|
||||
QCheckBox *showFPS_cbx;
|
||||
|
||||
void setCheckBoxFromProperty( QCheckBox *cbx, const char *property );
|
||||
void setComboBoxFromProperty( QComboBox *cbx, const char *property );
|
||||
//void setSliderFromProperty( QSlider *slider, QLabel *lbl, const char *property );
|
||||
|
||||
void resetVideo(void);
|
||||
|
||||
private slots:
|
||||
void use_new_PPU_changed( int value );
|
||||
void frameskip_changed( int value );
|
||||
void useSpriteLimitChanged( int value );
|
||||
void clipSidesChanged( int value );
|
||||
void showFPSChanged( int value );
|
||||
void regionChanged(int index);
|
||||
void applyChanges( void );
|
||||
void closewindow( void );
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,190 @@
|
|||
// GameViewer.cpp
|
||||
//
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QScreen>
|
||||
|
||||
#include "Qt/nes_shm.h"
|
||||
#include "Qt/ConsoleViewerGL.h"
|
||||
|
||||
extern unsigned int gui_draw_area_width;
|
||||
extern unsigned int gui_draw_area_height;
|
||||
|
||||
ConsoleViewGL_t::ConsoleViewGL_t(QWidget *parent)
|
||||
: QOpenGLWidget( parent )
|
||||
{
|
||||
view_width = 0;
|
||||
view_height = 0;
|
||||
gltexture = 0;
|
||||
devPixRatio = 1.0f;
|
||||
linearFilter = false;
|
||||
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
|
||||
if ( screen != NULL )
|
||||
{
|
||||
devPixRatio = screen->devicePixelRatio();
|
||||
//printf("Ratio: %f \n", screen->devicePixelRatio() );
|
||||
}
|
||||
localBufSize = GL_NES_WIDTH * GL_NES_HEIGHT * sizeof(uint32_t);
|
||||
|
||||
localBuf = (uint32_t*)malloc( localBufSize );
|
||||
|
||||
if ( localBuf )
|
||||
{
|
||||
memset( localBuf, 0, localBufSize );
|
||||
}
|
||||
}
|
||||
|
||||
ConsoleViewGL_t::~ConsoleViewGL_t(void)
|
||||
{
|
||||
// Make sure the context is current and then explicitly
|
||||
// destroy all underlying OpenGL resources.
|
||||
makeCurrent();
|
||||
|
||||
// Free GL texture
|
||||
if (gltexture)
|
||||
{
|
||||
//printf("Destroying GL Texture\n");
|
||||
glDeleteTextures(1, &gltexture);
|
||||
gltexture=0;
|
||||
}
|
||||
|
||||
doneCurrent();
|
||||
|
||||
if ( localBuf )
|
||||
{
|
||||
free( localBuf ); localBuf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int ConsoleViewGL_t::init( void )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ConsoleViewGL_t::buildTextures(void)
|
||||
{
|
||||
glEnable(GL_TEXTURE_RECTANGLE);
|
||||
|
||||
if ( gltexture )
|
||||
{
|
||||
glDeleteTextures(1, &gltexture);
|
||||
gltexture=0;
|
||||
}
|
||||
|
||||
glGenTextures(1, &gltexture);
|
||||
//printf("Linear Interpolation on GL Texture: %s \n", linearFilter ? "Enabled" : "Disabled");
|
||||
|
||||
glBindTexture( GL_TEXTURE_RECTANGLE, gltexture);
|
||||
|
||||
glTexParameteri( GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, linearFilter ? GL_LINEAR : GL_NEAREST );
|
||||
glTexParameteri( GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, linearFilter ? GL_LINEAR : GL_NEAREST );
|
||||
glTexParameteri( GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
|
||||
glTexParameteri( GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
|
||||
|
||||
glTexImage2D( GL_TEXTURE_RECTANGLE, 0,
|
||||
GL_RGBA8, GL_NES_WIDTH, GL_NES_HEIGHT, 0,
|
||||
GL_BGRA, GL_UNSIGNED_BYTE, 0 );
|
||||
|
||||
}
|
||||
|
||||
void ConsoleViewGL_t::initializeGL(void)
|
||||
{
|
||||
|
||||
initializeOpenGLFunctions();
|
||||
// Set up the rendering context, load shaders and other resources, etc.:
|
||||
//QOpenGLFunctions *gl = QOpenGLContext::currentContext()->functions();
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
//printf("GL Init!\n");
|
||||
|
||||
buildTextures();
|
||||
}
|
||||
|
||||
void ConsoleViewGL_t::resizeGL(int w, int h)
|
||||
{
|
||||
w = (int)( devPixRatio * w );
|
||||
h = (int)( devPixRatio * h );
|
||||
//printf("GL Resize: %i x %i \n", w, h );
|
||||
glViewport(0, 0, w, h);
|
||||
|
||||
view_width = w;
|
||||
view_height = h;
|
||||
|
||||
gui_draw_area_width = w;
|
||||
gui_draw_area_height = h;
|
||||
|
||||
buildTextures();
|
||||
}
|
||||
|
||||
void ConsoleViewGL_t::transfer2LocalBuffer(void)
|
||||
{
|
||||
memcpy( localBuf, nes_shm->pixbuf, localBufSize );
|
||||
}
|
||||
|
||||
void ConsoleViewGL_t::paintGL(void)
|
||||
{
|
||||
int texture_width = nes_shm->ncol;
|
||||
int texture_height = nes_shm->nrow;
|
||||
int l=0, r=texture_width;
|
||||
int t=0, b=texture_height;
|
||||
|
||||
float xscale = (float)view_width / (float)texture_width;
|
||||
float yscale = (float)view_height / (float)texture_height;
|
||||
|
||||
if (xscale < yscale )
|
||||
{
|
||||
yscale = xscale;
|
||||
}
|
||||
else
|
||||
{
|
||||
xscale = yscale;
|
||||
}
|
||||
int rw=(int)((r-l)*xscale);
|
||||
int rh=(int)((b-t)*yscale);
|
||||
int sx=(view_width-rw)/2;
|
||||
int sy=(view_height-rh)/2;
|
||||
|
||||
glViewport(sx, sy, rw, rh);
|
||||
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glOrtho( 0.0, rw, 0.0, rh, -1.0, 1.0);
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glClearColor( 0.0, 0.0f, 0.0f, 0.0f); // Background color to black.
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnable(GL_TEXTURE_RECTANGLE);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE, gltexture);
|
||||
|
||||
glTexSubImage2D(GL_TEXTURE_RECTANGLE, 0,
|
||||
0, 0, GL_NES_WIDTH, GL_NES_HEIGHT,
|
||||
GL_BGRA, GL_UNSIGNED_BYTE, localBuf );
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f( l, b); // Bottom left of picture.
|
||||
glVertex2f( 0.0, 0.0f); // Bottom left of target.
|
||||
|
||||
glTexCoord2f(r, b);// Bottom right of picture.
|
||||
glVertex2f( rw, 0.0f); // Bottom right of target.
|
||||
|
||||
glTexCoord2f(r, t); // Top right of our picture.
|
||||
glVertex2f( rw, rh); // Top right of target.
|
||||
|
||||
glTexCoord2f(l, t); // Top left of our picture.
|
||||
glVertex2f( 0.0f, rh); // Top left of target.
|
||||
glEnd();
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glDisable(GL_TEXTURE_RECTANGLE);
|
||||
|
||||
//printf("Paint GL!\n");
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
// GameViewerGL.h
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <QOpenGLWidget>
|
||||
#include <QOpenGLFunctions>
|
||||
|
||||
class ConsoleViewGL_t : public QOpenGLWidget, protected QOpenGLFunctions
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConsoleViewGL_t(QWidget *parent = 0);
|
||||
~ConsoleViewGL_t(void);
|
||||
|
||||
int init( void );
|
||||
|
||||
void transfer2LocalBuffer(void);
|
||||
|
||||
protected:
|
||||
void initializeGL(void);
|
||||
void resizeGL(int w, int h);
|
||||
void paintGL(void);
|
||||
|
||||
void buildTextures(void);
|
||||
void calcPixRemap(void);
|
||||
void doRemap(void);
|
||||
|
||||
double devPixRatio;
|
||||
int view_width;
|
||||
int view_height;
|
||||
GLuint gltexture;
|
||||
bool linearFilter;
|
||||
|
||||
uint32_t *localBuf;
|
||||
uint32_t localBufSize;
|
||||
|
||||
private slots:
|
||||
};
|
||||
|
|
@ -0,0 +1,198 @@
|
|||
// GameViewer.cpp
|
||||
//
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "Qt/nes_shm.h"
|
||||
#include "Qt/ConsoleViewerSDL.h"
|
||||
|
||||
extern unsigned int gui_draw_area_width;
|
||||
extern unsigned int gui_draw_area_height;
|
||||
|
||||
ConsoleViewSDL_t::ConsoleViewSDL_t(QWidget *parent)
|
||||
: QWidget( parent )
|
||||
{
|
||||
view_width = GL_NES_WIDTH;
|
||||
view_height = GL_NES_HEIGHT;
|
||||
|
||||
sx = sy = 0;
|
||||
rw = view_width;
|
||||
rh = view_height;
|
||||
sdlRendW = 0;
|
||||
sdlRendH = 0;
|
||||
|
||||
devPixRatio = 1.0f;
|
||||
sdlWindow = NULL;
|
||||
sdlRenderer = NULL;
|
||||
sdlTexture = NULL;
|
||||
|
||||
vsyncEnabled = false;
|
||||
}
|
||||
|
||||
ConsoleViewSDL_t::~ConsoleViewSDL_t(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int ConsoleViewSDL_t::init(void)
|
||||
{
|
||||
WId windowHandle;
|
||||
|
||||
if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0)
|
||||
{
|
||||
printf("[SDL] Failed to initialize video subsystem.\n");
|
||||
return -1;
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// printf("Initialized SDL Video Subsystem\n");
|
||||
//}
|
||||
|
||||
windowHandle = this->winId();
|
||||
|
||||
//printf("Window Handle: %llu \n", windowHandle );
|
||||
|
||||
//sleep(1);
|
||||
|
||||
sdlWindow = SDL_CreateWindowFrom( (void*)windowHandle);
|
||||
if (sdlWindow == NULL)
|
||||
{
|
||||
printf("[SDL] Failed to create window from handle.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t baseFlags = vsyncEnabled ? SDL_RENDERER_PRESENTVSYNC : 0;
|
||||
|
||||
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, baseFlags | SDL_RENDERER_ACCELERATED);
|
||||
|
||||
if (sdlRenderer == NULL)
|
||||
{
|
||||
printf("[SDL] Failed to create accelerated renderer.\n");
|
||||
|
||||
printf("[SDL] Attempting to create software renderer...\n");
|
||||
|
||||
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, baseFlags | SDL_RENDERER_SOFTWARE);
|
||||
|
||||
if (sdlRenderer == NULL)
|
||||
{
|
||||
printf("[SDL] Failed to create software renderer.\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_GetRendererOutputSize( sdlRenderer, &sdlRendW, &sdlRendH );
|
||||
|
||||
printf("[SDL] Renderer Output Size: %i x %i \n", sdlRendW, sdlRendH );
|
||||
|
||||
sdlTexture = SDL_CreateTexture(sdlRenderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, GL_NES_WIDTH, GL_NES_HEIGHT);
|
||||
|
||||
if (sdlTexture == NULL)
|
||||
{
|
||||
printf("[SDL] Failed to create texture: %i x %i", GL_NES_WIDTH, GL_NES_HEIGHT );
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ConsoleViewSDL_t::cleanup(void)
|
||||
{
|
||||
if (sdlTexture)
|
||||
{
|
||||
SDL_DestroyTexture(sdlTexture);
|
||||
sdlTexture = NULL;
|
||||
}
|
||||
if (sdlRenderer)
|
||||
{
|
||||
SDL_DestroyRenderer(sdlRenderer);
|
||||
sdlRenderer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleViewSDL_t::reset(void)
|
||||
{
|
||||
cleanup();
|
||||
if ( init() == 0 )
|
||||
{
|
||||
//console->GetVideoRenderer()->RegisterRenderingDevice(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleViewSDL_t::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QSize s;
|
||||
|
||||
s = event->size();
|
||||
view_width = s.width();
|
||||
view_height = s.height();
|
||||
//printf("SDL Resize: %i x %i \n", view_width, view_height);
|
||||
|
||||
reset();
|
||||
|
||||
sdlViewport.x = sdlRendW - view_width;
|
||||
sdlViewport.y = sdlRendH - view_height;
|
||||
sdlViewport.w = view_width;
|
||||
sdlViewport.h = view_height;
|
||||
}
|
||||
|
||||
void ConsoleViewSDL_t::paintEvent( QPaintEvent *event )
|
||||
{
|
||||
int nesWidth = GL_NES_WIDTH;
|
||||
int nesHeight = GL_NES_HEIGHT;
|
||||
|
||||
if ( nes_shm != NULL )
|
||||
{
|
||||
nesWidth = nes_shm->ncol;
|
||||
nesHeight = nes_shm->nrow;
|
||||
}
|
||||
//printf(" %i x %i \n", nesWidth, nesHeight );
|
||||
float xscale = (float)view_width / (float)nesWidth;
|
||||
float yscale = (float)view_height / (float)nesHeight;
|
||||
|
||||
if (xscale < yscale )
|
||||
{
|
||||
yscale = xscale;
|
||||
}
|
||||
else
|
||||
{
|
||||
xscale = yscale;
|
||||
}
|
||||
|
||||
rw=(int)(nesWidth*xscale);
|
||||
rh=(int)(nesHeight*yscale);
|
||||
sx=sdlViewport.x + (view_width-rw)/2;
|
||||
sy=sdlViewport.y + (view_height-rh)/2;
|
||||
|
||||
if ( (sdlRenderer == NULL) || (sdlTexture == NULL) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_SetRenderDrawColor( sdlRenderer, 0, 0, 0, 0 );
|
||||
|
||||
SDL_RenderClear(sdlRenderer);
|
||||
|
||||
uint8_t *textureBuffer;
|
||||
int rowPitch;
|
||||
SDL_LockTexture( sdlTexture, nullptr, (void**)&textureBuffer, &rowPitch);
|
||||
{
|
||||
memcpy( textureBuffer, nes_shm->pixbuf, GL_NES_HEIGHT*GL_NES_WIDTH*sizeof(uint32_t) );
|
||||
}
|
||||
SDL_UnlockTexture(sdlTexture);
|
||||
|
||||
SDL_RenderSetViewport( sdlRenderer, &sdlViewport );
|
||||
|
||||
SDL_Rect source = {0, 0, GL_NES_WIDTH, GL_NES_HEIGHT };
|
||||
SDL_Rect dest = { sx, sy, rw, rh };
|
||||
SDL_RenderCopy(sdlRenderer, sdlTexture, &source, &dest);
|
||||
|
||||
SDL_RenderPresent(sdlRenderer);
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
// GameViewerSDL.h
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPaintEvent>
|
||||
#include <QResizeEvent>
|
||||
#include <SDL.h>
|
||||
|
||||
class ConsoleViewSDL_t : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConsoleViewSDL_t(QWidget *parent = 0);
|
||||
~ConsoleViewSDL_t(void);
|
||||
|
||||
int init(void);
|
||||
void reset(void);
|
||||
void cleanup(void);
|
||||
|
||||
protected:
|
||||
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
int view_width;
|
||||
int view_height;
|
||||
|
||||
double devPixRatio;
|
||||
int rw;
|
||||
int rh;
|
||||
int sx;
|
||||
int sy;
|
||||
int sdlRendW;
|
||||
int sdlRendH;
|
||||
|
||||
bool vsyncEnabled;
|
||||
|
||||
SDL_Window *sdlWindow;
|
||||
SDL_Renderer *sdlRenderer;
|
||||
SDL_Texture *sdlTexture;
|
||||
SDL_Rect sdlViewport;
|
||||
|
||||
private slots:
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,153 @@
|
|||
|
||||
//
|
||||
|
||||
#ifndef __GameAppH__
|
||||
#define __GameAppH__
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
#include <QWidget>
|
||||
#include <QPushButton>
|
||||
#include <QMenu>
|
||||
#include <QMenuBar>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QKeyEvent>
|
||||
#include <QTimer>
|
||||
#include <QThread>
|
||||
#include <QMutex>
|
||||
|
||||
#include "Qt/ConsoleViewerGL.h"
|
||||
#include "Qt/ConsoleViewerSDL.h"
|
||||
#include "Qt/GamePadConf.h"
|
||||
|
||||
class emulatorThread_t : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
//public slots:
|
||||
void run( void ) override;
|
||||
signals:
|
||||
void finished();
|
||||
};
|
||||
|
||||
class consoleWin_t : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
consoleWin_t(QWidget *parent = 0);
|
||||
~consoleWin_t(void);
|
||||
|
||||
ConsoleViewGL_t *viewport;
|
||||
//ConsoleViewSDL_t *viewport;
|
||||
|
||||
void setCyclePeriodms( int ms );
|
||||
|
||||
QMutex *mutex;
|
||||
|
||||
protected:
|
||||
QMenu *fileMenu;
|
||||
QMenu *optMenu;
|
||||
QMenu *emuMenu;
|
||||
QMenu *movieMenu;
|
||||
QMenu *helpMenu;
|
||||
|
||||
QAction *openROM;
|
||||
QAction *closeROM;
|
||||
QAction *playNSF;
|
||||
QAction *loadStateAct;
|
||||
QAction *saveStateAct;
|
||||
QAction *quickLoadAct;
|
||||
QAction *quickSaveAct;
|
||||
QAction *loadLuaAct;
|
||||
QAction *scrShotAct;
|
||||
QAction *quitAct;
|
||||
QAction *gamePadConfig;
|
||||
QAction *gameSoundConfig;
|
||||
QAction *gameVideoConfig;
|
||||
QAction *hotkeyConfig;
|
||||
QAction *autoResume;
|
||||
QAction *fullscreen;
|
||||
QAction *aboutAct;
|
||||
QAction *state[10];
|
||||
QAction *powerAct;
|
||||
QAction *resetAct;
|
||||
QAction *sresetAct;
|
||||
QAction *pauseAct;
|
||||
QAction *gameGenieAct;
|
||||
QAction *loadGgROMAct;
|
||||
QAction *insCoinAct;
|
||||
QAction *fdsSwitchAct;
|
||||
QAction *fdsEjectAct;
|
||||
QAction *fdsLoadBiosAct;
|
||||
QAction *openMovAct;
|
||||
QAction *stopMovAct;
|
||||
QAction *recMovAct;
|
||||
QAction *recAsMovAct;
|
||||
|
||||
QTimer *gameTimer;
|
||||
emulatorThread_t *emulatorThread;
|
||||
|
||||
GamePadConfDialog_t *gamePadConfWin;
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void keyReleaseEvent(QKeyEvent *event);
|
||||
void syncActionConfig( QAction *act, const char *property );
|
||||
|
||||
int getDirFromFile( const char *path, char *dir );
|
||||
|
||||
private:
|
||||
void createMainMenu(void);
|
||||
|
||||
private slots:
|
||||
void closeApp(void);
|
||||
void openROMFile(void);
|
||||
void loadNSF(void);
|
||||
void loadStateFrom(void);
|
||||
void saveStateAs(void);
|
||||
void quickLoad(void);
|
||||
void quickSave(void);
|
||||
void closeROMCB(void);
|
||||
void aboutFCEUX(void);
|
||||
void openGamePadConfWin(void);
|
||||
void openGameSndConfWin(void);
|
||||
void openGameVideoConfWin(void);
|
||||
void openHotkeyConfWin(void);
|
||||
void toggleAutoResume(void);
|
||||
void toggleFullscreen(void);
|
||||
void updatePeriodic(void);
|
||||
void changeState0(void);
|
||||
void changeState1(void);
|
||||
void changeState2(void);
|
||||
void changeState3(void);
|
||||
void changeState4(void);
|
||||
void changeState5(void);
|
||||
void changeState6(void);
|
||||
void changeState7(void);
|
||||
void changeState8(void);
|
||||
void changeState9(void);
|
||||
void loadLua(void);
|
||||
void takeScreenShot(void);
|
||||
void powerConsoleCB(void);
|
||||
void consoleHardReset(void);
|
||||
void consoleSoftReset(void);
|
||||
void consolePause(void);
|
||||
void toggleGameGenie(bool checked);
|
||||
void loadGameGenieROM(void);
|
||||
void insertCoin(void);
|
||||
void fdsSwitchDisk(void);
|
||||
void fdsEjectDisk(void);
|
||||
void fdsLoadBiosFile(void);
|
||||
void openMovie(void);
|
||||
void stopMovie(void);
|
||||
void recordMovie(void);
|
||||
void recordMovieAs(void);
|
||||
|
||||
};
|
||||
|
||||
extern consoleWin_t *consoleWindow;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,439 @@
|
|||
// GamePadConf.cpp
|
||||
//
|
||||
#include "Qt/GamePadConf.h"
|
||||
#include "Qt/main.h"
|
||||
#include "Qt/input.h"
|
||||
#include "Qt/config.h"
|
||||
#include "Qt/keyscan.h"
|
||||
#include "Qt/fceuWrapper.h"
|
||||
|
||||
//----------------------------------------------------
|
||||
GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
|
||||
: QDialog( parent )
|
||||
{
|
||||
QHBoxLayout *hbox1, *hbox2;
|
||||
QGridLayout *grid;
|
||||
QCheckBox *efs_chkbox, *udlr_chkbox;
|
||||
QGroupBox *frame;
|
||||
QPushButton *loadDefaultButton;
|
||||
QPushButton *clearAllButton;
|
||||
QPushButton *closebutton;
|
||||
QPushButton *clearButton[GAMEPAD_NUM_BUTTONS];
|
||||
|
||||
portNum = 0;
|
||||
configNo = 0;
|
||||
buttonConfigStatus = 1;
|
||||
|
||||
setWindowTitle( tr("GamePad Config") );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
hbox2 = new QHBoxLayout();
|
||||
|
||||
QLabel *label = new QLabel(tr("Port:"));
|
||||
portSel = new QComboBox();
|
||||
hbox1->addWidget( label );
|
||||
hbox1->addWidget( portSel );
|
||||
|
||||
portSel->addItem( tr("1"), 0 );
|
||||
portSel->addItem( tr("2"), 1 );
|
||||
portSel->addItem( tr("3"), 2 );
|
||||
portSel->addItem( tr("4"), 3 );
|
||||
|
||||
efs_chkbox = new QCheckBox( tr("Enable Four Score") );
|
||||
udlr_chkbox = new QCheckBox( tr("Allow Up+Down/Left+Right") );
|
||||
|
||||
int fourScore;
|
||||
g_config->getOption("SDL.FourScore", &fourScore);
|
||||
efs_chkbox->setChecked( fourScore );
|
||||
|
||||
int opposite_dirs;
|
||||
g_config->getOption("SDL.Input.EnableOppositeDirectionals", &opposite_dirs);
|
||||
udlr_chkbox->setChecked( opposite_dirs );
|
||||
|
||||
frame = new QGroupBox(tr("Buttons:"));
|
||||
grid = new QGridLayout();
|
||||
|
||||
grid-> setHorizontalSpacing(50);
|
||||
|
||||
//frame->setFrameStyle( QFrame::Box );
|
||||
frame->setLayout( grid );
|
||||
|
||||
for (int i=0; i<GAMEPAD_NUM_BUTTONS; i++)
|
||||
{
|
||||
char text[64];
|
||||
QLabel *buttonName;
|
||||
|
||||
sprintf( text, "%s:", GamePadNames[i] );
|
||||
|
||||
//hbox2 = new QHBoxLayout();
|
||||
|
||||
//hbox2->setAlignment(Qt::AlignCenter);
|
||||
|
||||
buttonName = new QLabel(tr(text));
|
||||
keyName[i] = new QLabel();
|
||||
button[i] = new GamePadConfigButton_t(i);
|
||||
clearButton[i] = new QPushButton( tr("Clear") );
|
||||
|
||||
grid->addWidget( buttonName , i, 0, Qt::AlignCenter );
|
||||
grid->addWidget( keyName[i] , i, 1, Qt::AlignCenter );
|
||||
grid->addWidget( button[i] , i, 2, Qt::AlignCenter );
|
||||
grid->addWidget( clearButton[i], i, 3, Qt::AlignCenter );
|
||||
}
|
||||
updateCntrlrDpy();
|
||||
|
||||
loadDefaultButton = new QPushButton(tr("Load Defaults"));
|
||||
clearAllButton = new QPushButton(tr("Clear All"));
|
||||
closebutton = new QPushButton(tr("Close"));
|
||||
|
||||
hbox2->addWidget( loadDefaultButton );
|
||||
hbox2->addWidget( clearAllButton );
|
||||
hbox2->addWidget( closebutton );
|
||||
|
||||
connect(button[0], SIGNAL(clicked()), this, SLOT(changeButton0(void)) );
|
||||
connect(button[1], SIGNAL(clicked()), this, SLOT(changeButton1(void)) );
|
||||
connect(button[2], SIGNAL(clicked()), this, SLOT(changeButton2(void)) );
|
||||
connect(button[3], SIGNAL(clicked()), this, SLOT(changeButton3(void)) );
|
||||
connect(button[4], SIGNAL(clicked()), this, SLOT(changeButton4(void)) );
|
||||
connect(button[5], SIGNAL(clicked()), this, SLOT(changeButton5(void)) );
|
||||
connect(button[6], SIGNAL(clicked()), this, SLOT(changeButton6(void)) );
|
||||
connect(button[7], SIGNAL(clicked()), this, SLOT(changeButton7(void)) );
|
||||
connect(button[8], SIGNAL(clicked()), this, SLOT(changeButton8(void)) );
|
||||
connect(button[9], SIGNAL(clicked()), this, SLOT(changeButton9(void)) );
|
||||
|
||||
connect(clearButton[0], SIGNAL(clicked()), this, SLOT(clearButton0(void)) );
|
||||
connect(clearButton[1], SIGNAL(clicked()), this, SLOT(clearButton1(void)) );
|
||||
connect(clearButton[2], SIGNAL(clicked()), this, SLOT(clearButton2(void)) );
|
||||
connect(clearButton[3], SIGNAL(clicked()), this, SLOT(clearButton3(void)) );
|
||||
connect(clearButton[4], SIGNAL(clicked()), this, SLOT(clearButton4(void)) );
|
||||
connect(clearButton[5], SIGNAL(clicked()), this, SLOT(clearButton5(void)) );
|
||||
connect(clearButton[6], SIGNAL(clicked()), this, SLOT(clearButton6(void)) );
|
||||
connect(clearButton[7], SIGNAL(clicked()), this, SLOT(clearButton7(void)) );
|
||||
connect(clearButton[8], SIGNAL(clicked()), this, SLOT(clearButton8(void)) );
|
||||
connect(clearButton[9], SIGNAL(clicked()), this, SLOT(clearButton9(void)) );
|
||||
|
||||
connect(loadDefaultButton, SIGNAL(clicked()), this, SLOT(loadDefaults(void)) );
|
||||
connect(clearAllButton , SIGNAL(clicked()), this, SLOT(clearAllCallback(void)) );
|
||||
connect(closebutton , SIGNAL(clicked()), this, SLOT(closeWindow(void)) );
|
||||
|
||||
connect(portSel , SIGNAL(activated(int)), this, SLOT(controllerSelect(int)) );
|
||||
connect(efs_chkbox , SIGNAL(stateChanged(int)), this, SLOT(ena4score(int)) );
|
||||
connect(udlr_chkbox, SIGNAL(stateChanged(int)), this, SLOT(oppDirEna(int)) );
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout();
|
||||
|
||||
mainLayout->addLayout( hbox1 );
|
||||
mainLayout->addWidget( efs_chkbox );
|
||||
mainLayout->addWidget( udlr_chkbox );
|
||||
mainLayout->addWidget( frame );
|
||||
mainLayout->addLayout( hbox2 );
|
||||
|
||||
setLayout( mainLayout );
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
GamePadConfDialog_t::~GamePadConfDialog_t(void)
|
||||
{
|
||||
buttonConfigStatus = 0;
|
||||
}
|
||||
void GamePadConfDialog_t::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
//printf("GamePad Window Key Press: 0x%x \n", event->key() );
|
||||
pushKeyEvent( event, 1 );
|
||||
}
|
||||
|
||||
void GamePadConfDialog_t::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
//printf("GamePad Window Key Release: 0x%x \n", event->key() );
|
||||
pushKeyEvent( event, 0 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::updateCntrlrDpy(void)
|
||||
{
|
||||
char keyNameStr[128];
|
||||
|
||||
for (int i=0; i<GAMEPAD_NUM_BUTTONS; i++)
|
||||
{
|
||||
if (GamePadConfig[portNum][i].ButtType[configNo] == BUTTC_KEYBOARD)
|
||||
{
|
||||
snprintf( keyNameStr, sizeof (keyNameStr), "%s",
|
||||
SDL_GetKeyName (GamePadConfig[portNum][i].ButtonNum[configNo]));
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy( keyNameStr, ButtonName( &GamePadConfig[portNum][i], configNo ) );
|
||||
}
|
||||
keyName[i]->setText( tr(keyNameStr) );
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::controllerSelect(int index)
|
||||
{
|
||||
//printf("Port Number:%i \n", index);
|
||||
portNum = index;
|
||||
updateCntrlrDpy();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::ena4score(int state)
|
||||
{
|
||||
int value = (state == Qt::Unchecked) ? 0 : 1;
|
||||
//printf("Set 'SDL.FourScore' = %i\n", value);
|
||||
g_config->setOption("SDL.FourScore", value);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::oppDirEna(int state)
|
||||
{
|
||||
int value = (state == Qt::Unchecked) ? 0 : 1;
|
||||
//printf("Set 'SDL.Input.EnableOppositeDirectionals' = %i\n", value);
|
||||
g_config->setOption("SDL.Input.EnableOppositeDirectionals", value);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::changeButton(int padNo, int x)
|
||||
{
|
||||
char buf[256];
|
||||
std::string prefix;
|
||||
const char *keyNameStr;
|
||||
|
||||
if ( buttonConfigStatus == 2 )
|
||||
{
|
||||
buttonConfigStatus = 0;
|
||||
return;
|
||||
}
|
||||
buttonConfigStatus = 2;
|
||||
|
||||
ButtonConfigBegin ();
|
||||
|
||||
button[x]->setText("Waiting" );
|
||||
|
||||
snprintf (buf, sizeof(buf)-1, "SDL.Input.GamePad.%d.", padNo);
|
||||
prefix = buf;
|
||||
DWaitButton (NULL, &GamePadConfig[padNo][x], configNo, &buttonConfigStatus );
|
||||
|
||||
g_config->setOption (prefix + GamePadNames[x],
|
||||
GamePadConfig[padNo][x].ButtonNum[configNo]);
|
||||
|
||||
if (GamePadConfig[padNo][x].ButtType[configNo] == BUTTC_KEYBOARD)
|
||||
{
|
||||
g_config->setOption (prefix + "DeviceType", "Keyboard");
|
||||
}
|
||||
else if (GamePadConfig[padNo][x].ButtType[configNo] == BUTTC_JOYSTICK)
|
||||
{
|
||||
g_config->setOption (prefix + "DeviceType", "Joystick");
|
||||
}
|
||||
else
|
||||
{
|
||||
g_config->setOption (prefix + "DeviceType", "Unknown");
|
||||
}
|
||||
g_config->setOption (prefix + "DeviceNum",
|
||||
GamePadConfig[padNo][x].DeviceNum[configNo]);
|
||||
|
||||
keyNameStr = ButtonName( &GamePadConfig[padNo][x], configNo );
|
||||
|
||||
keyName[x]->setText( keyNameStr );
|
||||
button[x]->setText("Change");
|
||||
|
||||
ButtonConfigEnd ();
|
||||
|
||||
buttonConfigStatus = 1;
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::clearButton( int padNo, int x )
|
||||
{
|
||||
char buf[256];
|
||||
std::string prefix;
|
||||
|
||||
GamePadConfig[padNo][x].ButtonNum[configNo] = -1;
|
||||
|
||||
keyName[x]->setText("");
|
||||
|
||||
snprintf (buf, sizeof(buf)-1, "SDL.Input.GamePad.%d.", padNo);
|
||||
prefix = buf;
|
||||
|
||||
g_config->setOption (prefix + GamePadNames[x],
|
||||
GamePadConfig[padNo][x].ButtonNum[configNo]);
|
||||
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
//printf("GamePad Close Window Event\n");
|
||||
buttonConfigStatus = 0;
|
||||
done(0);
|
||||
event->accept();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::closeWindow(void)
|
||||
{
|
||||
//printf("Close Window\n");
|
||||
buttonConfigStatus = 0;
|
||||
done(0);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::changeButton0(void)
|
||||
{
|
||||
changeButton( portNum, 0 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::changeButton1(void)
|
||||
{
|
||||
changeButton( portNum, 1 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::changeButton2(void)
|
||||
{
|
||||
changeButton( portNum, 2 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::changeButton3(void)
|
||||
{
|
||||
changeButton( portNum, 3 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::changeButton4(void)
|
||||
{
|
||||
changeButton( portNum, 4 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::changeButton5(void)
|
||||
{
|
||||
changeButton( portNum, 5 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::changeButton6(void)
|
||||
{
|
||||
changeButton( portNum, 6 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::changeButton7(void)
|
||||
{
|
||||
changeButton( portNum, 7 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::changeButton8(void)
|
||||
{
|
||||
changeButton( portNum, 8 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::changeButton9(void)
|
||||
{
|
||||
changeButton( portNum, 9 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::clearButton0(void)
|
||||
{
|
||||
clearButton( portNum, 0 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::clearButton1(void)
|
||||
{
|
||||
clearButton( portNum, 1 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::clearButton2(void)
|
||||
{
|
||||
clearButton( portNum, 2 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::clearButton3(void)
|
||||
{
|
||||
clearButton( portNum, 3 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::clearButton4(void)
|
||||
{
|
||||
clearButton( portNum, 4 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::clearButton5(void)
|
||||
{
|
||||
clearButton( portNum, 5 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::clearButton6(void)
|
||||
{
|
||||
clearButton( portNum, 6 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::clearButton7(void)
|
||||
{
|
||||
clearButton( portNum, 7 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::clearButton8(void)
|
||||
{
|
||||
clearButton( portNum, 8 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::clearButton9(void)
|
||||
{
|
||||
clearButton( portNum, 9 );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::clearAllCallback(void)
|
||||
{
|
||||
for (int i=0; i<GAMEPAD_NUM_BUTTONS; i++)
|
||||
{
|
||||
clearButton( portNum, i );
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::loadDefaults(void)
|
||||
{
|
||||
char buf[256];
|
||||
std::string prefix;
|
||||
|
||||
if ( portNum > 0 )
|
||||
{
|
||||
clearAllCallback();
|
||||
return;
|
||||
}
|
||||
|
||||
snprintf (buf, sizeof(buf)-1, "SDL.Input.GamePad.%d.", portNum);
|
||||
prefix = buf;
|
||||
|
||||
for (int x=0; x<GAMEPAD_NUM_BUTTONS; x++)
|
||||
{
|
||||
GamePadConfig[portNum][x].ButtType[configNo] = BUTTC_KEYBOARD;
|
||||
GamePadConfig[portNum][x].DeviceNum[configNo] = 0;
|
||||
GamePadConfig[portNum][x].ButtonNum[configNo] = DefaultGamePad[portNum][x];
|
||||
GamePadConfig[portNum][x].NumC = 1;
|
||||
|
||||
g_config->setOption (prefix + GamePadNames[x],
|
||||
GamePadConfig[portNum][x].ButtonNum[configNo]);
|
||||
|
||||
if (GamePadConfig[portNum][x].ButtType[configNo] == BUTTC_KEYBOARD)
|
||||
{
|
||||
g_config->setOption (prefix + "DeviceType", "Keyboard");
|
||||
}
|
||||
else if (GamePadConfig[portNum][x].ButtType[configNo] == BUTTC_JOYSTICK)
|
||||
{
|
||||
g_config->setOption (prefix + "DeviceType", "Joystick");
|
||||
}
|
||||
else
|
||||
{
|
||||
g_config->setOption (prefix + "DeviceType", "Unknown");
|
||||
}
|
||||
g_config->setOption (prefix + "DeviceNum",
|
||||
GamePadConfig[portNum][x].DeviceNum[configNo]);
|
||||
}
|
||||
updateCntrlrDpy();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
GamePadConfigButton_t::GamePadConfigButton_t(int i)
|
||||
{
|
||||
idx = i;
|
||||
setText("Change");
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void GamePadConfigButton_t::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
//printf("GamePad Button Key Press: 0x%x \n", event->key() );
|
||||
pushKeyEvent( event, 1 );
|
||||
}
|
||||
|
||||
void GamePadConfigButton_t::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
//printf("GamePad Button Key Release: 0x%x \n", event->key() );
|
||||
pushKeyEvent( event, 0 );
|
||||
}
|
||||
//----------------------------------------------------
|
|
@ -0,0 +1,85 @@
|
|||
// GamePadConf.h
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QFrame>
|
||||
#include <QGroupBox>
|
||||
|
||||
#include "Qt/main.h"
|
||||
|
||||
class GamePadConfigButton_t : public QPushButton
|
||||
{
|
||||
public:
|
||||
GamePadConfigButton_t(int i);
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void keyReleaseEvent(QKeyEvent *event);
|
||||
|
||||
int idx;
|
||||
};
|
||||
|
||||
class GamePadConfDialog_t : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GamePadConfDialog_t(QWidget *parent = 0);
|
||||
~GamePadConfDialog_t(void);
|
||||
|
||||
protected:
|
||||
QComboBox *portSel;
|
||||
QLabel *keyName[GAMEPAD_NUM_BUTTONS];
|
||||
GamePadConfigButton_t *button[GAMEPAD_NUM_BUTTONS];
|
||||
|
||||
int portNum;
|
||||
int configNo;
|
||||
int buttonConfigStatus;
|
||||
|
||||
void changeButton( int port, int button );
|
||||
void clearButton( int port, int button );
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void keyReleaseEvent(QKeyEvent *event);
|
||||
void closeEvent(QCloseEvent *bar);
|
||||
private:
|
||||
void updateCntrlrDpy(void);
|
||||
|
||||
public slots:
|
||||
void closeWindow(void);
|
||||
private slots:
|
||||
void changeButton0(void);
|
||||
void changeButton1(void);
|
||||
void changeButton2(void);
|
||||
void changeButton3(void);
|
||||
void changeButton4(void);
|
||||
void changeButton5(void);
|
||||
void changeButton6(void);
|
||||
void changeButton7(void);
|
||||
void changeButton8(void);
|
||||
void changeButton9(void);
|
||||
void clearButton0(void);
|
||||
void clearButton1(void);
|
||||
void clearButton2(void);
|
||||
void clearButton3(void);
|
||||
void clearButton4(void);
|
||||
void clearButton5(void);
|
||||
void clearButton6(void);
|
||||
void clearButton7(void);
|
||||
void clearButton8(void);
|
||||
void clearButton9(void);
|
||||
void clearAllCallback(void);
|
||||
void loadDefaults(void);
|
||||
void ena4score(int state);
|
||||
void oppDirEna(int state);
|
||||
void controllerSelect(int index);
|
||||
|
||||
};
|
|
@ -0,0 +1,125 @@
|
|||
// HotKeyConf.cpp
|
||||
//
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
#include <SDL.h>
|
||||
#include <QHeaderView>
|
||||
|
||||
#include "Qt/main.h"
|
||||
#include "Qt/dface.h"
|
||||
#include "Qt/input.h"
|
||||
#include "Qt/config.h"
|
||||
#include "Qt/keyscan.h"
|
||||
#include "Qt/fceuWrapper.h"
|
||||
#include "Qt/HotKeyConf.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
HotKeyConfDialog_t::HotKeyConfDialog_t(QWidget *parent)
|
||||
: QDialog( parent )
|
||||
{
|
||||
QVBoxLayout *mainLayout;
|
||||
QTreeWidgetItem *item;
|
||||
std::string prefix = "SDL.Hotkeys.";
|
||||
int keycode;
|
||||
|
||||
setWindowTitle("Hotkey Configuration");
|
||||
|
||||
resize( 512, 512 );
|
||||
|
||||
mainLayout = new QVBoxLayout();
|
||||
|
||||
tree = new QTreeWidget();
|
||||
|
||||
tree->setColumnCount(2);
|
||||
|
||||
item = new QTreeWidgetItem();
|
||||
item->setText( 0, QString::fromStdString( "Command" ) );
|
||||
item->setText( 1, QString::fromStdString( "Key" ) );
|
||||
item->setTextAlignment( 0, Qt::AlignLeft);
|
||||
item->setTextAlignment( 1, Qt::AlignCenter);
|
||||
|
||||
tree->setHeaderItem( item );
|
||||
|
||||
tree->header()->setSectionResizeMode( QHeaderView::ResizeToContents );
|
||||
|
||||
for (int i=0; i<HK_MAX; i++)
|
||||
{
|
||||
std::string optionName = prefix + getHotkeyString(i);
|
||||
|
||||
g_config->getOption (optionName.c_str (), &keycode);
|
||||
|
||||
item = new QTreeWidgetItem();
|
||||
|
||||
item->setText( 0, QString::fromStdString( optionName ) );
|
||||
item->setText( 1, QString::fromStdString( SDL_GetKeyName (keycode) ) );
|
||||
|
||||
item->setTextAlignment( 0, Qt::AlignLeft);
|
||||
item->setTextAlignment( 1, Qt::AlignCenter);
|
||||
|
||||
tree->addTopLevelItem( item );
|
||||
}
|
||||
mainLayout->addWidget( tree );
|
||||
|
||||
setLayout( mainLayout );
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
HotKeyConfDialog_t::~HotKeyConfDialog_t(void)
|
||||
{
|
||||
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void HotKeyConfDialog_t::closeWindow(void)
|
||||
{
|
||||
//printf("Close Window\n");
|
||||
done(0);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void HotKeyConfDialog_t::assignHotkey(QKeyEvent *event)
|
||||
{
|
||||
SDL_Keycode k = convQtKey2SDLKeyCode( (Qt::Key)event->key() );
|
||||
|
||||
if ( k != SDLK_UNKNOWN )
|
||||
{
|
||||
QList <QTreeWidgetItem *> l;
|
||||
|
||||
l = tree->selectedItems();
|
||||
|
||||
for (size_t i=0; i < l.size(); i++)
|
||||
{
|
||||
//int idx;
|
||||
QString qs;
|
||||
QTreeWidgetItem *item;
|
||||
|
||||
item = l.at(i);
|
||||
|
||||
//idx = tree->indexOfTopLevelItem( item );
|
||||
|
||||
qs = item->text(0);
|
||||
|
||||
g_config->setOption ( qs.toStdString(), k );
|
||||
|
||||
setHotKeys();
|
||||
|
||||
item->setText( 1, QString::fromStdString( SDL_GetKeyName (k) ) );
|
||||
|
||||
//printf("Hotkey Window Key Press: 0x%x item:%p\n '%s' : %i\n",
|
||||
// k, item, qs.toStdString().c_str(), idx );
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void HotKeyConfDialog_t::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
//printf("Hotkey Window Key Press: 0x%x \n", event->key() );
|
||||
assignHotkey( event );
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void HotKeyConfDialog_t::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
//printf("Hotkey Window Key Release: 0x%x \n", event->key() );
|
||||
assignHotkey( event );
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
|
@ -0,0 +1,42 @@
|
|||
// GamePadConf.h
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QFrame>
|
||||
#include <QGroupBox>
|
||||
#include <QTreeView>
|
||||
#include <QTreeWidget>
|
||||
|
||||
#include "Qt/main.h"
|
||||
|
||||
class HotKeyConfDialog_t : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
HotKeyConfDialog_t(QWidget *parent = 0);
|
||||
~HotKeyConfDialog_t(void);
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void keyReleaseEvent(QKeyEvent *event);
|
||||
void assignHotkey(QKeyEvent *event);
|
||||
|
||||
QTreeWidget *tree;
|
||||
|
||||
private:
|
||||
|
||||
public slots:
|
||||
void closeWindow(void);
|
||||
private slots:
|
||||
|
||||
};
|
|
@ -0,0 +1,482 @@
|
|||
#include "Qt/main.h"
|
||||
#include "Qt/throttle.h"
|
||||
#include "Qt/config.h"
|
||||
|
||||
#include "../common/cheat.h"
|
||||
|
||||
#include "Qt/input.h"
|
||||
#include "Qt/dface.h"
|
||||
|
||||
#include "Qt/sdl.h"
|
||||
#include "Qt/sdl-video.h"
|
||||
#include "Qt/unix-netplay.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <csignal>
|
||||
#include <cstring>
|
||||
#include <cerrno>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
static const char* HotkeyStrings[HK_MAX] = {
|
||||
"CheatMenu",
|
||||
"BindState",
|
||||
"LoadLua",
|
||||
"ToggleBG",
|
||||
"SaveState",
|
||||
"FDSSelect",
|
||||
"LoadState",
|
||||
"FDSEject",
|
||||
"VSInsertCoin",
|
||||
"VSToggleDip",
|
||||
"MovieToggleFrameDisplay",
|
||||
"SubtitleDisplay",
|
||||
"Reset",
|
||||
"Screenshot",
|
||||
"Pause",
|
||||
"DecreaseSpeed",
|
||||
"IncreaseSpeed",
|
||||
"FrameAdvance",
|
||||
"Turbo",
|
||||
"ToggleInputDisplay",
|
||||
"ToggleMovieRW",
|
||||
"MuteCapture",
|
||||
"Quit",
|
||||
"FrameAdvanceLagSkip",
|
||||
"LagCounterDisplay",
|
||||
"SelectState0", "SelectState1", "SelectState2", "SelectState3",
|
||||
"SelectState4", "SelectState5", "SelectState6", "SelectState7",
|
||||
"SelectState8", "SelectState9", "SelectStateNext", "SelectStatePrev",
|
||||
"VolumeDown", "VolumeUp" };
|
||||
|
||||
const char *getHotkeyString( int i )
|
||||
{
|
||||
if ( (i>=0) && (i<HK_MAX) )
|
||||
{
|
||||
return HotkeyStrings[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a custom pallete from a file and load it into the core.
|
||||
*/
|
||||
int
|
||||
LoadCPalette(const std::string &file)
|
||||
{
|
||||
uint8 tmpp[192];
|
||||
FILE *fp;
|
||||
|
||||
if(!(fp = FCEUD_UTF8fopen(file.c_str(), "rb"))) {
|
||||
char errorMsg[256];
|
||||
strcpy(errorMsg, "Error loading custom palette from file: ");
|
||||
strcat(errorMsg, file.c_str());
|
||||
FCEUD_PrintError(errorMsg);
|
||||
return 0;
|
||||
}
|
||||
size_t result = fread(tmpp, 1, 192, fp);
|
||||
if(result != 192) {
|
||||
char errorMsg[256];
|
||||
strcpy(errorMsg, "Error loading custom palette from file: ");
|
||||
strcat(errorMsg, file.c_str());
|
||||
FCEUD_PrintError(errorMsg);
|
||||
return 0;
|
||||
}
|
||||
FCEUI_SetUserPalette(tmpp, result/3);
|
||||
fclose(fp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the subdirectories used for saving snapshots, movies, game
|
||||
* saves, etc. Hopefully obsolete with new configuration system.
|
||||
*/
|
||||
static void
|
||||
CreateDirs(const std::string &dir)
|
||||
{
|
||||
const char *subs[8]={"fcs","snaps","gameinfo","sav","cheats","movies","cfg.d"};
|
||||
std::string subdir;
|
||||
int x;
|
||||
|
||||
#if defined(WIN32) || defined(NEED_MINGW_HACKS)
|
||||
mkdir(dir.c_str());
|
||||
chmod(dir.c_str(), 755);
|
||||
for(x = 0; x < 6; x++) {
|
||||
subdir = dir + PSS + subs[x];
|
||||
mkdir(subdir.c_str());
|
||||
}
|
||||
#else
|
||||
mkdir(dir.c_str(), S_IRWXU);
|
||||
for(x = 0; x < 6; x++) {
|
||||
subdir = dir + PSS + subs[x];
|
||||
mkdir(subdir.c_str(), S_IRWXU);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to locate FCEU's application directory. This will
|
||||
* hopefully become obsolete once the new configuration system is in
|
||||
* place.
|
||||
*/
|
||||
static void
|
||||
GetBaseDirectory(std::string &dir)
|
||||
{
|
||||
char *home = getenv("HOME");
|
||||
if(home) {
|
||||
dir = std::string(home) + "/.fceux";
|
||||
} else {
|
||||
#ifdef WIN32
|
||||
home = new char[MAX_PATH + 1];
|
||||
GetModuleFileName(NULL, home, MAX_PATH + 1);
|
||||
|
||||
char *lastBS = strrchr(home,'\\');
|
||||
if(lastBS) {
|
||||
*lastBS = 0;
|
||||
}
|
||||
|
||||
dir = std::string(home);
|
||||
delete[] home;
|
||||
#else
|
||||
dir = "";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// returns a config structure with default options
|
||||
// also creates config base directory (ie: /home/user/.fceux as well as subdirs
|
||||
Config *
|
||||
InitConfig()
|
||||
{
|
||||
std::string dir, prefix;
|
||||
Config *config;
|
||||
|
||||
GetBaseDirectory(dir);
|
||||
|
||||
FCEUI_SetBaseDirectory(dir.c_str());
|
||||
CreateDirs(dir);
|
||||
|
||||
config = new Config(dir);
|
||||
|
||||
// sound options
|
||||
config->addOption('s', "sound", "SDL.Sound", 1);
|
||||
config->addOption("volume", "SDL.Sound.Volume", 150);
|
||||
config->addOption("trianglevol", "SDL.Sound.TriangleVolume", 256);
|
||||
config->addOption("square1vol", "SDL.Sound.Square1Volume", 256);
|
||||
config->addOption("square2vol", "SDL.Sound.Square2Volume", 256);
|
||||
config->addOption("noisevol", "SDL.Sound.NoiseVolume", 256);
|
||||
config->addOption("pcmvol", "SDL.Sound.PCMVolume", 256);
|
||||
config->addOption("soundrate", "SDL.Sound.Rate", 44100);
|
||||
config->addOption("soundq", "SDL.Sound.Quality", 1);
|
||||
config->addOption("soundrecord", "SDL.Sound.RecordFile", "");
|
||||
config->addOption("soundbufsize", "SDL.Sound.BufSize", 128);
|
||||
config->addOption("lowpass", "SDL.Sound.LowPass", 0);
|
||||
|
||||
config->addOption('g', "gamegenie", "SDL.GameGenie", 0);
|
||||
config->addOption("pal", "SDL.PAL", 0);
|
||||
config->addOption("frameskip", "SDL.Frameskip", 0);
|
||||
config->addOption("clipsides", "SDL.ClipSides", 0);
|
||||
config->addOption("nospritelim", "SDL.DisableSpriteLimit", 1);
|
||||
config->addOption("swapduty", "SDL.SwapDuty", 0);
|
||||
|
||||
// color control
|
||||
config->addOption('p', "palette", "SDL.Palette", "");
|
||||
config->addOption("tint", "SDL.Tint", 56);
|
||||
config->addOption("hue", "SDL.Hue", 72);
|
||||
config->addOption("ntsccolor", "SDL.NTSCpalette", 0);
|
||||
|
||||
// scanline settings
|
||||
config->addOption("slstart", "SDL.ScanLineStart", 0);
|
||||
config->addOption("slend", "SDL.ScanLineEnd", 239);
|
||||
|
||||
// video controls
|
||||
config->addOption('f', "fullscreen", "SDL.Fullscreen", 0);
|
||||
|
||||
// set x/y res to 0 for automatic fullscreen resolution detection (no change)
|
||||
config->addOption('x', "xres", "SDL.XResolution", 0);
|
||||
config->addOption('y', "yres", "SDL.YResolution", 0);
|
||||
config->addOption("SDL.LastXRes", 0);
|
||||
config->addOption("SDL.LastYRes", 0);
|
||||
config->addOption('b', "bpp", "SDL.BitsPerPixel", 32);
|
||||
config->addOption("doublebuf", "SDL.DoubleBuffering", 1);
|
||||
config->addOption("autoscale", "SDL.AutoScale", 1);
|
||||
config->addOption("keepratio", "SDL.KeepRatio", 1);
|
||||
config->addOption("xscale", "SDL.XScale", 1.0);
|
||||
config->addOption("yscale", "SDL.YScale", 1.0);
|
||||
config->addOption("xstretch", "SDL.XStretch", 0);
|
||||
config->addOption("ystretch", "SDL.YStretch", 0);
|
||||
config->addOption("noframe", "SDL.NoFrame", 0);
|
||||
config->addOption("special", "SDL.SpecialFilter", 0);
|
||||
config->addOption("showfps", "SDL.ShowFPS", 0);
|
||||
config->addOption("togglemenu", "SDL.ToggleMenu", 0);
|
||||
|
||||
// OpenGL options
|
||||
config->addOption("opengl", "SDL.OpenGL", 1);
|
||||
config->addOption("openglip", "SDL.OpenGLip", 1);
|
||||
config->addOption("SDL.SpecialFilter", 0);
|
||||
config->addOption("SDL.SpecialFX", 0);
|
||||
config->addOption("SDL.Vsync", 1);
|
||||
|
||||
// network play options - netplay is broken
|
||||
config->addOption("server", "SDL.NetworkIsServer", 0);
|
||||
config->addOption('n', "net", "SDL.NetworkIP", "");
|
||||
config->addOption('u', "user", "SDL.NetworkUsername", "");
|
||||
config->addOption('w', "pass", "SDL.NetworkPassword", "");
|
||||
config->addOption('k', "netkey", "SDL.NetworkGameKey", "");
|
||||
config->addOption("port", "SDL.NetworkPort", 4046);
|
||||
config->addOption("players", "SDL.NetworkPlayers", 1);
|
||||
|
||||
// input configuration options
|
||||
config->addOption("input1", "SDL.Input.0", "GamePad.0");
|
||||
config->addOption("input2", "SDL.Input.1", "GamePad.1");
|
||||
config->addOption("input3", "SDL.Input.2", "Gamepad.2");
|
||||
config->addOption("input4", "SDL.Input.3", "Gamepad.3");
|
||||
|
||||
// allow for input configuration
|
||||
config->addOption('i', "inputcfg", "SDL.InputCfg", InputCfg);
|
||||
|
||||
// display input
|
||||
config->addOption("inputdisplay", "SDL.InputDisplay", 0);
|
||||
|
||||
// enable / disable opposite directionals (left + right or up + down simultaneously)
|
||||
config->addOption("opposite-directionals", "SDL.Input.EnableOppositeDirectionals", 1);
|
||||
|
||||
// pause movie playback at frame x
|
||||
config->addOption("pauseframe", "SDL.PauseFrame", 0);
|
||||
config->addOption("recordhud", "SDL.RecordHUD", 1);
|
||||
config->addOption("moviemsg", "SDL.MovieMsg", 1);
|
||||
|
||||
// overwrite the config file?
|
||||
config->addOption("no-config", "SDL.NoConfig", 0);
|
||||
|
||||
config->addOption("autoresume", "SDL.AutoResume", 0);
|
||||
|
||||
// video playback
|
||||
config->addOption("playmov", "SDL.Movie", "");
|
||||
config->addOption("subtitles", "SDL.SubtitleDisplay", 1);
|
||||
config->addOption("movielength", "SDL.MovieLength", 0);
|
||||
|
||||
config->addOption("fourscore", "SDL.FourScore", 0);
|
||||
|
||||
config->addOption("nofscursor", "SDL.NoFullscreenCursor", 1);
|
||||
|
||||
#ifdef _S9XLUA_H
|
||||
// load lua script
|
||||
config->addOption("loadlua", "SDL.LuaScript", "");
|
||||
#endif
|
||||
|
||||
#ifdef CREATE_AVI
|
||||
config->addOption("videolog", "SDL.VideoLog", "");
|
||||
config->addOption("mute", "SDL.MuteCapture", 0);
|
||||
#endif
|
||||
|
||||
// auto load/save on gameload/close
|
||||
config->addOption("loadstate", "SDL.AutoLoadState", INVALID_STATE);
|
||||
config->addOption("savestate", "SDL.AutoSaveState", INVALID_STATE);
|
||||
|
||||
//TODO implement this
|
||||
config->addOption("periodicsaves", "SDL.PeriodicSaves", 0);
|
||||
|
||||
char* home_dir = getenv("HOME");
|
||||
// prefixed with _ because they are internal (not cli options)
|
||||
config->addOption("_lastopenfile", "SDL.LastOpenFile", home_dir);
|
||||
config->addOption("_laststatefrom", "SDL.LastLoadStateFrom", home_dir);
|
||||
config->addOption("_lastopennsf", "SDL.LastOpenNSF", home_dir);
|
||||
config->addOption("_lastsavestateas", "SDL.LastSaveStateAs", home_dir);
|
||||
config->addOption("_lastloadlua", "SDL.LastLoadLua", "");
|
||||
|
||||
// fcm -> fm2 conversion
|
||||
config->addOption("fcmconvert", "SDL.FCMConvert", "");
|
||||
|
||||
// fm2 -> srt conversion
|
||||
config->addOption("ripsubs", "SDL.RipSubs", "");
|
||||
|
||||
// enable new PPU core
|
||||
config->addOption("newppu", "SDL.NewPPU", 0);
|
||||
|
||||
// quit when a+b+select+start is pressed
|
||||
config->addOption("4buttonexit", "SDL.ABStartSelectExit", 0);
|
||||
|
||||
// GamePad 0 - 3
|
||||
for(unsigned int i = 0; i < GAMEPAD_NUM_DEVICES; i++)
|
||||
{
|
||||
char buf[64];
|
||||
snprintf(buf, sizeof(buf)-1, "SDL.Input.GamePad.%u.", i);
|
||||
prefix = buf;
|
||||
|
||||
config->addOption(prefix + "DeviceType", DefaultGamePadDevice[i]);
|
||||
config->addOption(prefix + "DeviceNum", 0);
|
||||
for(unsigned int j = 0; j < GAMEPAD_NUM_BUTTONS; j++) {
|
||||
config->addOption(prefix + GamePadNames[j], DefaultGamePad[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
// PowerPad 0 - 1
|
||||
for(unsigned int i = 0; i < POWERPAD_NUM_DEVICES; i++) {
|
||||
char buf[64];
|
||||
snprintf(buf, sizeof(buf)-1, "SDL.Input.PowerPad.%u.", i);
|
||||
prefix = buf;
|
||||
|
||||
config->addOption(prefix + "DeviceType", DefaultPowerPadDevice[i]);
|
||||
config->addOption(prefix + "DeviceNum", 0);
|
||||
for(unsigned int j = 0; j < POWERPAD_NUM_BUTTONS; j++) {
|
||||
config->addOption(prefix +PowerPadNames[j], DefaultPowerPad[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
// QuizKing
|
||||
prefix = "SDL.Input.QuizKing.";
|
||||
config->addOption(prefix + "DeviceType", DefaultQuizKingDevice);
|
||||
config->addOption(prefix + "DeviceNum", 0);
|
||||
for(unsigned int j = 0; j < QUIZKING_NUM_BUTTONS; j++) {
|
||||
config->addOption(prefix + QuizKingNames[j], DefaultQuizKing[j]);
|
||||
}
|
||||
|
||||
// HyperShot
|
||||
prefix = "SDL.Input.HyperShot.";
|
||||
config->addOption(prefix + "DeviceType", DefaultHyperShotDevice);
|
||||
config->addOption(prefix + "DeviceNum", 0);
|
||||
for(unsigned int j = 0; j < HYPERSHOT_NUM_BUTTONS; j++) {
|
||||
config->addOption(prefix + HyperShotNames[j], DefaultHyperShot[j]);
|
||||
}
|
||||
|
||||
// Mahjong
|
||||
prefix = "SDL.Input.Mahjong.";
|
||||
config->addOption(prefix + "DeviceType", DefaultMahjongDevice);
|
||||
config->addOption(prefix + "DeviceNum", 0);
|
||||
for(unsigned int j = 0; j < MAHJONG_NUM_BUTTONS; j++) {
|
||||
config->addOption(prefix + MahjongNames[j], DefaultMahjong[j]);
|
||||
}
|
||||
|
||||
// TopRider
|
||||
prefix = "SDL.Input.TopRider.";
|
||||
config->addOption(prefix + "DeviceType", DefaultTopRiderDevice);
|
||||
config->addOption(prefix + "DeviceNum", 0);
|
||||
for(unsigned int j = 0; j < TOPRIDER_NUM_BUTTONS; j++) {
|
||||
config->addOption(prefix + TopRiderNames[j], DefaultTopRider[j]);
|
||||
}
|
||||
|
||||
// FTrainer
|
||||
prefix = "SDL.Input.FTrainer.";
|
||||
config->addOption(prefix + "DeviceType", DefaultFTrainerDevice);
|
||||
config->addOption(prefix + "DeviceNum", 0);
|
||||
for(unsigned int j = 0; j < FTRAINER_NUM_BUTTONS; j++) {
|
||||
config->addOption(prefix + FTrainerNames[j], DefaultFTrainer[j]);
|
||||
}
|
||||
|
||||
// FamilyKeyBoard
|
||||
prefix = "SDL.Input.FamilyKeyBoard.";
|
||||
config->addOption(prefix + "DeviceType", DefaultFamilyKeyBoardDevice);
|
||||
config->addOption(prefix + "DeviceNum", 0);
|
||||
for(unsigned int j = 0; j < FAMILYKEYBOARD_NUM_BUTTONS; j++) {
|
||||
config->addOption(prefix + FamilyKeyBoardNames[j],
|
||||
DefaultFamilyKeyBoard[j]);
|
||||
}
|
||||
|
||||
// for FAMICOM microphone in pad 2 pad 1 didn't have it
|
||||
// Takeshi no Chousenjou uses it for example.
|
||||
prefix = "SDL.Input.FamicomPad2.";
|
||||
config->addOption("rp2mic", prefix + "EnableMic", 0);
|
||||
|
||||
// TODO: use a better data structure to store the hotkeys or something
|
||||
// improve this code overall in the future to make it
|
||||
// easier to maintain
|
||||
const int Hotkeys[HK_MAX] = {
|
||||
SDLK_F1, // cheat menu
|
||||
SDLK_F2, // bind state
|
||||
SDLK_F3, // load lua
|
||||
SDLK_F4, // toggleBG
|
||||
SDLK_F5, // save state
|
||||
SDLK_F6, // fds select
|
||||
SDLK_F7, // load state
|
||||
SDLK_F8, // fds eject
|
||||
SDLK_F6, // VS insert coin
|
||||
SDLK_F8, // VS toggle dipswitch
|
||||
SDLK_PERIOD, // toggle frame display
|
||||
SDLK_F10, // toggle subtitle
|
||||
SDLK_F11, // reset
|
||||
SDLK_F12, // screenshot
|
||||
SDLK_PAUSE, // pause
|
||||
SDLK_MINUS, // speed++
|
||||
SDLK_EQUALS, // speed--
|
||||
SDLK_BACKSLASH, //frame advnace
|
||||
SDLK_TAB, // turbo
|
||||
SDLK_COMMA, // toggle input display
|
||||
SDLK_q, // toggle movie RW
|
||||
SDLK_QUOTE, // toggle mute capture
|
||||
0, // quit // edit 10/11/11 - don't map to escape, it causes ugly things to happen to sdl. can be manually appended to config
|
||||
SDLK_DELETE, // frame advance lag skip
|
||||
SDLK_SLASH, // lag counter display
|
||||
SDLK_0, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5,
|
||||
SDLK_6, SDLK_7, SDLK_8, SDLK_9,
|
||||
SDLK_PAGEUP, // select state next
|
||||
SDLK_PAGEDOWN}; // select state prev
|
||||
|
||||
prefix = "SDL.Hotkeys.";
|
||||
for(int i=0; i < HK_MAX; i++)
|
||||
config->addOption(prefix + HotkeyStrings[i], Hotkeys[i]);
|
||||
// All mouse devices
|
||||
config->addOption("SDL.OekaKids.0.DeviceType", "Mouse");
|
||||
config->addOption("SDL.OekaKids.0.DeviceNum", 0);
|
||||
|
||||
config->addOption("SDL.Arkanoid.0.DeviceType", "Mouse");
|
||||
config->addOption("SDL.Arkanoid.0.DeviceNum", 0);
|
||||
|
||||
config->addOption("SDL.Shadow.0.DeviceType", "Mouse");
|
||||
config->addOption("SDL.Shadow.0.DeviceNum", 0);
|
||||
|
||||
config->addOption("SDL.Zapper.0.DeviceType", "Mouse");
|
||||
config->addOption("SDL.Zapper.0.DeviceNum", 0);
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
void
|
||||
UpdateEMUCore(Config *config)
|
||||
{
|
||||
int ntsccol, ntsctint, ntschue, flag, region, start, end;
|
||||
std::string cpalette;
|
||||
|
||||
config->getOption("SDL.NTSCpalette", &ntsccol);
|
||||
config->getOption("SDL.Tint", &ntsctint);
|
||||
config->getOption("SDL.Hue", &ntschue);
|
||||
FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue);
|
||||
|
||||
config->getOption("SDL.Palette", &cpalette);
|
||||
if(cpalette.size()) {
|
||||
LoadCPalette(cpalette);
|
||||
}
|
||||
|
||||
config->getOption("SDL.PAL", ®ion);
|
||||
FCEUI_SetRegion(region);
|
||||
|
||||
config->getOption("SDL.GameGenie", &flag);
|
||||
FCEUI_SetGameGenie(flag ? 1 : 0);
|
||||
|
||||
config->getOption("SDL.Sound.LowPass", &flag);
|
||||
FCEUI_SetLowPass(flag ? 1 : 0);
|
||||
|
||||
config->getOption("SDL.DisableSpriteLimit", &flag);
|
||||
FCEUI_DisableSpriteLimitation(flag ? 1 : 0);
|
||||
|
||||
config->getOption("SDL.ScanLineStart", &start);
|
||||
config->getOption("SDL.ScanLineEnd", &end);
|
||||
|
||||
#if DOING_SCANLINE_CHECKS
|
||||
for(int i = 0; i < 2; x++) {
|
||||
if(srendlinev[x]<0 || srendlinev[x]>239) srendlinev[x]=0;
|
||||
if(erendlinev[x]<srendlinev[x] || erendlinev[x]>239) erendlinev[x]=239;
|
||||
}
|
||||
#endif
|
||||
|
||||
FCEUI_SetRenderedLines(start + 8, end - 8, start, end);
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef CONFIG_H_HF128
|
||||
#define CONFIG_H_HF128
|
||||
|
||||
#include "common/configSys.h"
|
||||
|
||||
Config *InitConfig(void);
|
||||
void UpdateEMUCore(Config *);
|
||||
int LoadCPalette(const std::string &file);
|
||||
|
||||
// hotkey definitions
|
||||
// TODO: encapsulate this in an improved data structure
|
||||
enum HOTKEY { HK_CHEAT_MENU=0, HK_BIND_STATE, HK_LOAD_LUA, HK_TOGGLE_BG,
|
||||
HK_SAVE_STATE, HK_FDS_SELECT, HK_LOAD_STATE, HK_FDS_EJECT ,
|
||||
HK_VS_INSERT_COIN, HK_VS_TOGGLE_DIPSWITCH,
|
||||
HK_TOGGLE_FRAME_DISPLAY, HK_TOGGLE_SUBTITLE, HK_RESET, HK_SCREENSHOT,
|
||||
HK_PAUSE, HK_DECREASE_SPEED, HK_INCREASE_SPEED, HK_FRAME_ADVANCE, HK_TURBO,
|
||||
HK_TOGGLE_INPUT_DISPLAY, HK_MOVIE_TOGGLE_RW, HK_MUTE_CAPTURE, HK_QUIT,
|
||||
HK_FA_LAG_SKIP, HK_LAG_COUNTER_DISPLAY,
|
||||
HK_SELECT_STATE_0, HK_SELECT_STATE_1, HK_SELECT_STATE_2, HK_SELECT_STATE_3,
|
||||
HK_SELECT_STATE_4, HK_SELECT_STATE_5, HK_SELECT_STATE_6, HK_SELECT_STATE_7,
|
||||
HK_SELECT_STATE_8, HK_SELECT_STATE_9,
|
||||
HK_SELECT_STATE_NEXT, HK_SELECT_STATE_PREV, HK_VOLUME_DOWN, HK_VOLUME_UP,
|
||||
HK_MAX};
|
||||
|
||||
const char *getHotkeyString( int i );
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#include "common/args.h"
|
||||
#include "common/config.h"
|
||||
|
||||
#include "Qt/input.h"
|
||||
|
||||
extern CFGSTRUCT DriverConfig[];
|
||||
extern ARGPSTRUCT DriverArgs[];
|
||||
|
||||
void DoDriverArgs(void);
|
||||
|
||||
int InitSound();
|
||||
void WriteSound(int32 *Buffer, int Count);
|
||||
int KillSound(void);
|
||||
uint32 GetMaxSound(void);
|
||||
uint32 GetWriteSound(void);
|
||||
|
||||
void SilenceSound(int s); /* DOS and SDL */
|
||||
|
||||
int InitJoysticks(void);
|
||||
int KillJoysticks(void);
|
||||
uint32 *GetJSOr(void);
|
||||
|
||||
int InitVideo(FCEUGI *gi);
|
||||
int KillVideo(void);
|
||||
void BlitScreen(uint8 *XBuf);
|
||||
void LockConsole(void);
|
||||
void UnlockConsole(void);
|
||||
void ToggleFS(); /* SDL */
|
||||
|
||||
int LoadGame(const char *path);
|
||||
//int CloseGame(void);
|
||||
|
||||
void Giggles(int);
|
||||
void DoFun(void);
|
||||
|
||||
int FCEUD_NetworkConnect(void);
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,36 @@
|
|||
// fceuWrapper.h
|
||||
//
|
||||
#include "Qt/config.h"
|
||||
|
||||
//*****************************************************************
|
||||
// Define Global Variables to be shared with FCEU Core
|
||||
//*****************************************************************
|
||||
extern int dendy;
|
||||
extern int eoptions;
|
||||
extern int isLoaded;
|
||||
extern int pal_emulation;
|
||||
extern int gametype;
|
||||
extern int closeFinishedMovie;
|
||||
extern bool turbo;
|
||||
extern bool swapDuty;
|
||||
extern unsigned int gui_draw_area_width;
|
||||
extern unsigned int gui_draw_area_height;
|
||||
|
||||
// global configuration object
|
||||
extern Config *g_config;
|
||||
|
||||
int LoadGame(const char *path);
|
||||
int CloseGame(void);
|
||||
|
||||
int fceuWrapperInit( int argc, char *argv[] );
|
||||
int fceuWrapperClose( void );
|
||||
int fceuWrapperUpdate( void );
|
||||
void fceuWrapperLock(void);
|
||||
bool fceuWrapperTryLock(int timeout);
|
||||
bool fceuWrapperIsLocked(void);
|
||||
void fceuWrapperUnLock(void);
|
||||
int fceuWrapperSoftReset(void);
|
||||
int fceuWrapperHardReset(void);
|
||||
int fceuWrapperTogglePause(void);
|
||||
bool fceuWrapperGameLoaded(void);
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
// fceux_git_info.h
|
||||
|
||||
const char *fceu_get_git_url(void);
|
||||
const char *fceu_get_git_rev(void);
|
|
@ -0,0 +1,55 @@
|
|||
/* XPM */
|
||||
static const char * icon_xpm[] = {
|
||||
"32 32 20 1",
|
||||
" c None",
|
||||
". c #040204",
|
||||
"+ c #84A284",
|
||||
"@ c #C42204",
|
||||
"# c #8482C4",
|
||||
"$ c #FCFEFC",
|
||||
"% c #848284",
|
||||
"& c #648284",
|
||||
"* c #646284",
|
||||
"= c #444244",
|
||||
"- c #A4A284",
|
||||
"; c #C4A284",
|
||||
"> c #C48284",
|
||||
", c #A4CAF4",
|
||||
"' c #244244",
|
||||
") c #444204",
|
||||
"! c #442204",
|
||||
"~ c #446244",
|
||||
"{ c #646244",
|
||||
"] c #644244",
|
||||
" ",
|
||||
" ........ ",
|
||||
" ............... ",
|
||||
" ........................ ",
|
||||
" ...........................+ ",
|
||||
" ............@@..@@........... ",
|
||||
" .#............@@............$$ ",
|
||||
" .##..........@@.@.....$$%%%%$$ ",
|
||||
" &...........@....@$$$$$$%%&%$$ ",
|
||||
" *&...............$$$$$$$%%&%$$ ",
|
||||
" =&*.......-;;>;...$$,$$$%**&.. ",
|
||||
" '&&..............$$,,,%=)!~.. ",
|
||||
" ~&&............-%%##%*.~'=%& ",
|
||||
" *&&.....+%%****&&%%&*.&!!' ",
|
||||
" **&%&***********&&&*~{'= ",
|
||||
" ********=**~**~**~ ",
|
||||
" *****~******] ",
|
||||
" **~***]' ",
|
||||
" ~]== ",
|
||||
" ",
|
||||
" ..... .... .... .. ..@@ @@",
|
||||
" ..... .... .... .. ..@@@ @@@",
|
||||
" .. .. .. .. .. @@@ @@@ ",
|
||||
" .... .. .. .. .. @@@@@@ ",
|
||||
" .... .. ... .. .. @@@@ ",
|
||||
" .. .. ... .. .. @@@@ ",
|
||||
" .. .. .. .. .. @@@@@@ ",
|
||||
" .. .. .. .. .. @@@ @@@ ",
|
||||
" .. .... .... .....@@@ @@@",
|
||||
" .. .... .... ... @@ @@",
|
||||
" ",
|
||||
" "};
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,67 @@
|
|||
#ifndef _aosdfjk02fmasf
|
||||
#define _aosdfjk02fmasf
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "common/configSys.h"
|
||||
|
||||
#define MAXBUTTCONFIG 4
|
||||
|
||||
enum {
|
||||
BUTTC_KEYBOARD = 0,
|
||||
BUTTC_JOYSTICK = 1,
|
||||
BUTTC_MOUSE = 2
|
||||
};
|
||||
struct ButtConfig
|
||||
{
|
||||
int ButtType[MAXBUTTCONFIG];
|
||||
int DeviceNum[MAXBUTTCONFIG];
|
||||
int ButtonNum[MAXBUTTCONFIG];
|
||||
uint32_t NumC;
|
||||
//uint64 DeviceID[MAXBUTTCONFIG]; /* TODO */
|
||||
};
|
||||
|
||||
|
||||
extern int NoWaiting;
|
||||
extern CFGSTRUCT InputConfig[];
|
||||
extern ARGPSTRUCT InputArgs[];
|
||||
extern int Hotkeys[];
|
||||
void ParseGIInput(FCEUGI *GI);
|
||||
void setHotKeys(void);
|
||||
int getKeyState( int k );
|
||||
int ButtonConfigBegin();
|
||||
void ButtonConfigEnd();
|
||||
void ConfigButton(char *text, ButtConfig *bc);
|
||||
int DWaitButton(const uint8_t *text, ButtConfig *bc, int wb, int *buttonConfigStatus = NULL);
|
||||
|
||||
|
||||
#define FCFGD_GAMEPAD 1
|
||||
#define FCFGD_POWERPAD 2
|
||||
#define FCFGD_HYPERSHOT 3
|
||||
#define FCFGD_QUIZKING 4
|
||||
|
||||
#define SDL_FCEU_HOTKEY_EVENT SDL_USEREVENT
|
||||
|
||||
void InitInputInterface(void);
|
||||
void InputUserActiveFix(void);
|
||||
|
||||
extern bool replaceP2StartWithMicrophone;
|
||||
extern ButtConfig GamePadConfig[4][10];
|
||||
//extern ButtConfig powerpadsc[2][12];
|
||||
//extern ButtConfig QuizKingButtons[6];
|
||||
//extern ButtConfig FTrainerButtons[12];
|
||||
|
||||
void IncreaseEmulationSpeed(void);
|
||||
void DecreaseEmulationSpeed(void);
|
||||
|
||||
int DTestButtonJoy(ButtConfig *bc);
|
||||
|
||||
void FCEUD_UpdateInput(void);
|
||||
|
||||
void UpdateInput(Config *config);
|
||||
void InputCfg(const std::string &);
|
||||
|
||||
std::string GetUserText(const char* title);
|
||||
const char* ButtonName(const ButtConfig* bc, int which);
|
||||
#endif
|
||||
|
|
@ -0,0 +1,985 @@
|
|||
// keyscan.cpp
|
||||
//
|
||||
|
||||
#include <QtCore>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "Qt/keyscan.h"
|
||||
|
||||
using namespace Qt;
|
||||
|
||||
SDL_Scancode convQtKey2SDLScanCode( Qt::Key q )
|
||||
{
|
||||
SDL_Scancode s = SDL_SCANCODE_UNKNOWN;
|
||||
|
||||
switch (q)
|
||||
{
|
||||
case Key_Escape:
|
||||
s = SDL_SCANCODE_ESCAPE;
|
||||
break;
|
||||
case Key_Tab:
|
||||
case Key_Backtab:
|
||||
s = SDL_SCANCODE_TAB;
|
||||
break;
|
||||
case Key_Backspace:
|
||||
s = SDL_SCANCODE_BACKSPACE;
|
||||
break;
|
||||
case Key_Return:
|
||||
s = SDL_SCANCODE_RETURN;
|
||||
break;
|
||||
case Key_Enter:
|
||||
s = SDL_SCANCODE_RETURN;
|
||||
break;
|
||||
case Key_Insert:
|
||||
s = SDL_SCANCODE_INSERT;
|
||||
break;
|
||||
case Key_Delete:
|
||||
s = SDL_SCANCODE_DELETE;
|
||||
break;
|
||||
case Key_Pause:
|
||||
s = SDL_SCANCODE_PAUSE;
|
||||
break;
|
||||
case Key_Print:
|
||||
case Key_SysReq:
|
||||
s = SDL_SCANCODE_PRINTSCREEN;
|
||||
break;
|
||||
case Key_Clear:
|
||||
s = SDL_SCANCODE_CLEAR;
|
||||
break;
|
||||
case Key_Home:
|
||||
s = SDL_SCANCODE_HOME;
|
||||
break;
|
||||
case Key_End:
|
||||
s = SDL_SCANCODE_END;
|
||||
break;
|
||||
case Key_Left:
|
||||
s = SDL_SCANCODE_LEFT;
|
||||
break;
|
||||
case Key_Up:
|
||||
s = SDL_SCANCODE_UP;
|
||||
break;
|
||||
case Key_Right:
|
||||
s = SDL_SCANCODE_RIGHT;
|
||||
break;
|
||||
case Key_Down:
|
||||
s = SDL_SCANCODE_DOWN;
|
||||
break;
|
||||
case Key_PageUp:
|
||||
s = SDL_SCANCODE_PAGEUP;
|
||||
break;
|
||||
case Key_PageDown:
|
||||
s = SDL_SCANCODE_PAGEDOWN;
|
||||
break;
|
||||
case Key_Shift:
|
||||
s = SDL_SCANCODE_LSHIFT;
|
||||
break;
|
||||
case Key_Control:
|
||||
s = SDL_SCANCODE_LCTRL;
|
||||
break;
|
||||
case Key_Meta:
|
||||
s = SDL_SCANCODE_LGUI;
|
||||
break;
|
||||
case Key_Alt:
|
||||
s = SDL_SCANCODE_LALT;
|
||||
break;
|
||||
case Key_CapsLock:
|
||||
s = SDL_SCANCODE_CAPSLOCK;
|
||||
break;
|
||||
case Key_NumLock:
|
||||
s = SDL_SCANCODE_NUMLOCKCLEAR;
|
||||
break;
|
||||
case Key_ScrollLock:
|
||||
s = SDL_SCANCODE_SCROLLLOCK;
|
||||
break;
|
||||
case Key_F1:
|
||||
s = SDL_SCANCODE_F1;
|
||||
break;
|
||||
case Key_F2:
|
||||
s = SDL_SCANCODE_F2;
|
||||
break;
|
||||
case Key_F3:
|
||||
s = SDL_SCANCODE_F3;
|
||||
break;
|
||||
case Key_F4:
|
||||
s = SDL_SCANCODE_F4;
|
||||
break;
|
||||
case Key_F5:
|
||||
s = SDL_SCANCODE_F5;
|
||||
break;
|
||||
case Key_F6:
|
||||
s = SDL_SCANCODE_F6;
|
||||
break;
|
||||
case Key_F7:
|
||||
s = SDL_SCANCODE_F7;
|
||||
break;
|
||||
case Key_F8:
|
||||
s = SDL_SCANCODE_F8;
|
||||
break;
|
||||
case Key_F9:
|
||||
s = SDL_SCANCODE_F9;
|
||||
break;
|
||||
case Key_F10:
|
||||
s = SDL_SCANCODE_F10;
|
||||
break;
|
||||
case Key_F11:
|
||||
s = SDL_SCANCODE_F11;
|
||||
break;
|
||||
case Key_F12:
|
||||
s = SDL_SCANCODE_F12;
|
||||
break;
|
||||
case Key_F13:
|
||||
s = SDL_SCANCODE_F13;
|
||||
break;
|
||||
case Key_F14:
|
||||
s = SDL_SCANCODE_F14;
|
||||
break;
|
||||
case Key_F15:
|
||||
s = SDL_SCANCODE_F15;
|
||||
break;
|
||||
case Key_F16:
|
||||
s = SDL_SCANCODE_F16;
|
||||
break;
|
||||
case Key_F17:
|
||||
s = SDL_SCANCODE_F17;
|
||||
break;
|
||||
case Key_F18:
|
||||
s = SDL_SCANCODE_F18;
|
||||
break;
|
||||
case Key_F19:
|
||||
s = SDL_SCANCODE_F19;
|
||||
break;
|
||||
case Key_F20:
|
||||
s = SDL_SCANCODE_F20;
|
||||
break;
|
||||
case Key_F21:
|
||||
s = SDL_SCANCODE_F21;
|
||||
break;
|
||||
case Key_F22:
|
||||
s = SDL_SCANCODE_F22;
|
||||
break;
|
||||
case Key_F23:
|
||||
s = SDL_SCANCODE_F23;
|
||||
break;
|
||||
case Key_F24:
|
||||
s = SDL_SCANCODE_F24;
|
||||
break;
|
||||
//case Key_F25: // F25 .. F35 only on X11
|
||||
//case Key_F26:
|
||||
//case Key_F27:
|
||||
//case Key_F28:
|
||||
//case Key_F29:
|
||||
//case Key_F30:
|
||||
//case Key_F31:
|
||||
//case Key_F32:
|
||||
//case Key_F33:
|
||||
//case Key_F34:
|
||||
//case Key_F35:
|
||||
// s = SDL_SCANCODE_UNKNOWN;
|
||||
//break;
|
||||
case Key_Super_L:
|
||||
case Key_Super_R:
|
||||
s = SDL_SCANCODE_UNKNOWN;
|
||||
break;
|
||||
case Key_Menu:
|
||||
s = SDL_SCANCODE_MENU;
|
||||
break;
|
||||
case Key_Hyper_L:
|
||||
case Key_Hyper_R:
|
||||
s = SDL_SCANCODE_UNKNOWN;
|
||||
break;
|
||||
case Key_Help:
|
||||
s = SDL_SCANCODE_HELP;
|
||||
break;
|
||||
case Key_Direction_L:
|
||||
case Key_Direction_R:
|
||||
s = SDL_SCANCODE_UNKNOWN;
|
||||
break;
|
||||
|
||||
case Key_Space:
|
||||
//case Key_Any:
|
||||
s = SDL_SCANCODE_SPACE;
|
||||
break;
|
||||
|
||||
case Key_Exclam:
|
||||
s = SDL_SCANCODE_1;
|
||||
break;
|
||||
case Key_QuoteDbl:
|
||||
s = SDL_SCANCODE_APOSTROPHE;
|
||||
break;
|
||||
case Key_NumberSign:
|
||||
s = SDL_SCANCODE_3;
|
||||
break;
|
||||
case Key_Dollar:
|
||||
s = SDL_SCANCODE_4;
|
||||
break;
|
||||
case Key_Percent:
|
||||
s = SDL_SCANCODE_5;
|
||||
break;
|
||||
case Key_Ampersand:
|
||||
s = SDL_SCANCODE_7;
|
||||
break;
|
||||
case Key_Apostrophe:
|
||||
s = SDL_SCANCODE_APOSTROPHE;
|
||||
break;
|
||||
case Key_ParenLeft:
|
||||
s = SDL_SCANCODE_9;
|
||||
break;
|
||||
case Key_ParenRight:
|
||||
s = SDL_SCANCODE_0;
|
||||
break;
|
||||
case Key_Asterisk:
|
||||
s = SDL_SCANCODE_8;
|
||||
break;
|
||||
case Key_Plus:
|
||||
s = SDL_SCANCODE_EQUALS;
|
||||
break;
|
||||
case Key_Comma:
|
||||
s = SDL_SCANCODE_COMMA;
|
||||
break;
|
||||
case Key_Minus:
|
||||
s = SDL_SCANCODE_MINUS;
|
||||
break;
|
||||
case Key_Period:
|
||||
s = SDL_SCANCODE_PERIOD;
|
||||
break;
|
||||
case Key_Slash:
|
||||
s = SDL_SCANCODE_SLASH;
|
||||
break;
|
||||
case Key_0:
|
||||
s = SDL_SCANCODE_0;
|
||||
break;
|
||||
case Key_1:
|
||||
s = SDL_SCANCODE_1;
|
||||
break;
|
||||
case Key_2:
|
||||
s = SDL_SCANCODE_2;
|
||||
break;
|
||||
case Key_3:
|
||||
s = SDL_SCANCODE_3;
|
||||
break;
|
||||
case Key_4:
|
||||
s = SDL_SCANCODE_4;
|
||||
break;
|
||||
case Key_5:
|
||||
s = SDL_SCANCODE_5;
|
||||
break;
|
||||
case Key_6:
|
||||
s = SDL_SCANCODE_6;
|
||||
break;
|
||||
case Key_7:
|
||||
s = SDL_SCANCODE_7;
|
||||
break;
|
||||
case Key_8:
|
||||
s = SDL_SCANCODE_8;
|
||||
break;
|
||||
case Key_9:
|
||||
s = SDL_SCANCODE_9;
|
||||
break;
|
||||
case Key_Colon:
|
||||
case Key_Semicolon:
|
||||
s = SDL_SCANCODE_SEMICOLON;
|
||||
break;
|
||||
case Key_Less:
|
||||
s = SDL_SCANCODE_COMMA;
|
||||
break;
|
||||
case Key_Equal:
|
||||
s = SDL_SCANCODE_EQUALS;
|
||||
break;
|
||||
case Key_Greater:
|
||||
s = SDL_SCANCODE_PERIOD;
|
||||
break;
|
||||
case Key_Question:
|
||||
s = SDL_SCANCODE_SLASH;
|
||||
break;
|
||||
case Key_At:
|
||||
s = SDL_SCANCODE_2;
|
||||
break;
|
||||
break;
|
||||
case Key_A:
|
||||
s = SDL_SCANCODE_A;
|
||||
break;
|
||||
case Key_B:
|
||||
s = SDL_SCANCODE_B;
|
||||
break;
|
||||
case Key_C:
|
||||
s = SDL_SCANCODE_C;
|
||||
break;
|
||||
case Key_D:
|
||||
s = SDL_SCANCODE_D;
|
||||
break;
|
||||
case Key_E:
|
||||
s = SDL_SCANCODE_E;
|
||||
break;
|
||||
case Key_F:
|
||||
s = SDL_SCANCODE_F;
|
||||
break;
|
||||
case Key_G:
|
||||
s = SDL_SCANCODE_G;
|
||||
break;
|
||||
case Key_H:
|
||||
s = SDL_SCANCODE_H;
|
||||
break;
|
||||
case Key_I:
|
||||
s = SDL_SCANCODE_I;
|
||||
break;
|
||||
case Key_J:
|
||||
s = SDL_SCANCODE_J;
|
||||
break;
|
||||
case Key_K:
|
||||
s = SDL_SCANCODE_K;
|
||||
break;
|
||||
case Key_L:
|
||||
s = SDL_SCANCODE_L;
|
||||
break;
|
||||
case Key_M:
|
||||
s = SDL_SCANCODE_M;
|
||||
break;
|
||||
case Key_N:
|
||||
s = SDL_SCANCODE_N;
|
||||
break;
|
||||
case Key_O:
|
||||
s = SDL_SCANCODE_O;
|
||||
break;
|
||||
case Key_P:
|
||||
s = SDL_SCANCODE_P;
|
||||
break;
|
||||
case Key_Q:
|
||||
s = SDL_SCANCODE_Q;
|
||||
break;
|
||||
case Key_R:
|
||||
s = SDL_SCANCODE_R;
|
||||
break;
|
||||
case Key_S:
|
||||
s = SDL_SCANCODE_S;
|
||||
break;
|
||||
case Key_T:
|
||||
s = SDL_SCANCODE_T;
|
||||
break;
|
||||
case Key_U:
|
||||
s = SDL_SCANCODE_U;
|
||||
break;
|
||||
case Key_V:
|
||||
s = SDL_SCANCODE_V;
|
||||
break;
|
||||
case Key_W:
|
||||
s = SDL_SCANCODE_W;
|
||||
break;
|
||||
case Key_X:
|
||||
s = SDL_SCANCODE_X;
|
||||
break;
|
||||
case Key_Y:
|
||||
s = SDL_SCANCODE_Y;
|
||||
break;
|
||||
case Key_Z:
|
||||
s = SDL_SCANCODE_Z;
|
||||
break;
|
||||
case Key_BracketLeft:
|
||||
s = SDL_SCANCODE_LEFTBRACKET;
|
||||
break;
|
||||
case Key_Backslash:
|
||||
s = SDL_SCANCODE_BACKSLASH;
|
||||
break;
|
||||
case Key_BracketRight:
|
||||
s = SDL_SCANCODE_RIGHTBRACKET;
|
||||
break;
|
||||
//case Key_AsciiCircum:
|
||||
// s = SDL_SCANCODE_UNKNOWN;
|
||||
//break;
|
||||
case Key_Underscore:
|
||||
s = SDL_SCANCODE_MINUS;
|
||||
break;
|
||||
case Key_QuoteLeft:
|
||||
s = SDL_SCANCODE_GRAVE;
|
||||
break;
|
||||
case Key_BraceLeft:
|
||||
s = SDL_SCANCODE_LEFTBRACKET;
|
||||
break;
|
||||
case Key_Bar:
|
||||
s = SDL_SCANCODE_BACKSLASH;
|
||||
break;
|
||||
case Key_BraceRight:
|
||||
s = SDL_SCANCODE_RIGHTBRACKET;
|
||||
break;
|
||||
case Key_AsciiTilde:
|
||||
s = SDL_SCANCODE_GRAVE;
|
||||
break;
|
||||
|
||||
//case Key_nobreakspace:
|
||||
//case Key_exclamdown:
|
||||
//case Key_cent:
|
||||
//case Key_sterling:
|
||||
//case Key_currency:
|
||||
//case Key_yen:
|
||||
//case Key_brokenbar:
|
||||
//case Key_section:
|
||||
//case Key_diaeresis:
|
||||
//case Key_copyright:
|
||||
//case Key_ordfeminine:
|
||||
//case Key_guillemotleft:
|
||||
//case Key_notsign:
|
||||
//case Key_hyphen:
|
||||
//case Key_registered:
|
||||
//case Key_macron:
|
||||
//case Key_degree:
|
||||
//case Key_plusminus:
|
||||
//case Key_twosuperior:
|
||||
//case Key_threesuperior:
|
||||
//case Key_acute:
|
||||
//case Key_mu:
|
||||
//case Key_paragraph:
|
||||
//case Key_periodcentered:
|
||||
//case Key_cedilla:
|
||||
//case Key_onesuperior:
|
||||
//case Key_masculine:
|
||||
//case Key_guillemotright:
|
||||
//case Key_onequarter:
|
||||
//case Key_onehalf:
|
||||
//case Key_threequarters:
|
||||
//case Key_questiondown:
|
||||
//case Key_Agrave:
|
||||
//case Key_Aacute:
|
||||
//case Key_Acircumflex:
|
||||
//case Key_Atilde:
|
||||
//case Key_Adiaeresis:
|
||||
//case Key_Aring:
|
||||
//case Key_AE:
|
||||
//case Key_Ccedilla:
|
||||
//case Key_Egrave:
|
||||
//case Key_Eacute:
|
||||
//case Key_Ecircumflex:
|
||||
//case Key_Ediaeresis:
|
||||
//case Key_Igrave:
|
||||
//case Key_Iacute:
|
||||
//case Key_Icircumflex:
|
||||
//case Key_Idiaeresis:
|
||||
//case Key_ETH:
|
||||
//case Key_Ntilde:
|
||||
//case Key_Ograve:
|
||||
//case Key_Oacute:
|
||||
//case Key_Ocircumflex:
|
||||
//case Key_Otilde:
|
||||
//case Key_Odiaeresis:
|
||||
//case Key_multiply:
|
||||
//case Key_Ooblique:
|
||||
//case Key_Ugrave:
|
||||
//case Key_Uacute:
|
||||
//case Key_Ucircumflex:
|
||||
//case Key_Udiaeresis:
|
||||
//case Key_Yacute:
|
||||
//case Key_THORN:
|
||||
//case Key_ssharp:
|
||||
//case Key_division:
|
||||
//case Key_ydiaeresis:
|
||||
// s = SDL_SCANCODE_UNKNOWN;
|
||||
//break;
|
||||
default:
|
||||
s = SDL_SCANCODE_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
SDL_Keycode convQtKey2SDLKeyCode( Qt::Key q )
|
||||
{
|
||||
SDL_Keycode s = SDLK_UNKNOWN;
|
||||
|
||||
switch (q)
|
||||
{
|
||||
case Key_Escape:
|
||||
s = SDLK_ESCAPE;
|
||||
break;
|
||||
case Key_Tab:
|
||||
case Key_Backtab:
|
||||
s = SDLK_TAB;
|
||||
break;
|
||||
case Key_Backspace:
|
||||
s = SDLK_BACKSPACE;
|
||||
break;
|
||||
case Key_Return:
|
||||
s = SDLK_RETURN;
|
||||
break;
|
||||
case Key_Enter:
|
||||
s = SDLK_KP_ENTER;
|
||||
break;
|
||||
case Key_Insert:
|
||||
s = SDLK_INSERT;
|
||||
break;
|
||||
case Key_Delete:
|
||||
s = SDLK_DELETE;
|
||||
break;
|
||||
case Key_Pause:
|
||||
s = SDLK_PAUSE;
|
||||
break;
|
||||
case Key_Print:
|
||||
s = SDLK_PRINTSCREEN;
|
||||
break;
|
||||
case Key_SysReq:
|
||||
s = SDLK_SYSREQ;
|
||||
break;
|
||||
case Key_Clear:
|
||||
s = SDLK_CLEAR;
|
||||
break;
|
||||
case Key_Home:
|
||||
s = SDLK_HOME;
|
||||
break;
|
||||
case Key_End:
|
||||
s = SDLK_END;
|
||||
break;
|
||||
case Key_Left:
|
||||
s = SDLK_LEFT;
|
||||
break;
|
||||
case Key_Up:
|
||||
s = SDLK_UP;
|
||||
break;
|
||||
case Key_Right:
|
||||
s = SDLK_RIGHT;
|
||||
break;
|
||||
case Key_Down:
|
||||
s = SDLK_DOWN;
|
||||
break;
|
||||
case Key_PageUp:
|
||||
s = SDLK_PAGEUP;
|
||||
break;
|
||||
case Key_PageDown:
|
||||
s = SDLK_PAGEDOWN;
|
||||
break;
|
||||
case Key_Shift:
|
||||
s = SDLK_LSHIFT;
|
||||
break;
|
||||
case Key_Control:
|
||||
s = SDLK_LCTRL;
|
||||
break;
|
||||
case Key_Meta:
|
||||
s = SDLK_LGUI;
|
||||
break;
|
||||
case Key_Alt:
|
||||
s = SDL_SCANCODE_LALT;
|
||||
break;
|
||||
case Key_CapsLock:
|
||||
s = SDLK_LALT;
|
||||
break;
|
||||
case Key_NumLock:
|
||||
s = SDLK_NUMLOCKCLEAR;
|
||||
break;
|
||||
case Key_ScrollLock:
|
||||
s = SDLK_SCROLLLOCK;
|
||||
break;
|
||||
case Key_F1:
|
||||
s = SDLK_F1;
|
||||
break;
|
||||
case Key_F2:
|
||||
s = SDLK_F2;
|
||||
break;
|
||||
case Key_F3:
|
||||
s = SDLK_F3;
|
||||
break;
|
||||
case Key_F4:
|
||||
s = SDLK_F4;
|
||||
break;
|
||||
case Key_F5:
|
||||
s = SDLK_F5;
|
||||
break;
|
||||
case Key_F6:
|
||||
s = SDLK_F6;
|
||||
break;
|
||||
case Key_F7:
|
||||
s = SDLK_F7;
|
||||
break;
|
||||
case Key_F8:
|
||||
s = SDLK_F8;
|
||||
break;
|
||||
case Key_F9:
|
||||
s = SDLK_F9;
|
||||
break;
|
||||
case Key_F10:
|
||||
s = SDLK_F10;
|
||||
break;
|
||||
case Key_F11:
|
||||
s = SDLK_F11;
|
||||
break;
|
||||
case Key_F12:
|
||||
s = SDLK_F12;
|
||||
break;
|
||||
case Key_F13:
|
||||
s = SDLK_F13;
|
||||
break;
|
||||
case Key_F14:
|
||||
s = SDLK_F14;
|
||||
break;
|
||||
case Key_F15:
|
||||
s = SDLK_F15;
|
||||
break;
|
||||
case Key_F16:
|
||||
s = SDLK_F16;
|
||||
break;
|
||||
case Key_F17:
|
||||
s = SDLK_F17;
|
||||
break;
|
||||
case Key_F18:
|
||||
s = SDLK_F18;
|
||||
break;
|
||||
case Key_F19:
|
||||
s = SDLK_F19;
|
||||
break;
|
||||
case Key_F20:
|
||||
s = SDLK_F20;
|
||||
break;
|
||||
case Key_F21:
|
||||
s = SDLK_F21;
|
||||
break;
|
||||
case Key_F22:
|
||||
s = SDLK_F22;
|
||||
break;
|
||||
case Key_F23:
|
||||
s = SDLK_F23;
|
||||
break;
|
||||
case Key_F24:
|
||||
s = SDLK_F24;
|
||||
break;
|
||||
//case Key_F25: // F25 .. F35 only on X11
|
||||
//case Key_F26:
|
||||
//case Key_F27:
|
||||
//case Key_F28:
|
||||
//case Key_F29:
|
||||
//case Key_F30:
|
||||
//case Key_F31:
|
||||
//case Key_F32:
|
||||
//case Key_F33:
|
||||
//case Key_F34:
|
||||
//case Key_F35:
|
||||
// s = SDL_SCANCODE_UNKNOWN;
|
||||
//break;
|
||||
case Key_Super_L:
|
||||
case Key_Super_R:
|
||||
s = SDLK_UNKNOWN;
|
||||
break;
|
||||
case Key_Menu:
|
||||
s = SDLK_MENU;
|
||||
break;
|
||||
case Key_Hyper_L:
|
||||
case Key_Hyper_R:
|
||||
s = SDLK_UNKNOWN;
|
||||
break;
|
||||
case Key_Help:
|
||||
s = SDLK_HELP;
|
||||
break;
|
||||
case Key_Direction_L:
|
||||
case Key_Direction_R:
|
||||
s = SDLK_UNKNOWN;
|
||||
break;
|
||||
|
||||
case Key_Space:
|
||||
//case Key_Any:
|
||||
s = SDLK_SPACE;
|
||||
break;
|
||||
|
||||
case Key_Exclam:
|
||||
s = SDLK_EXCLAIM;
|
||||
break;
|
||||
case Key_QuoteDbl:
|
||||
s = SDLK_QUOTEDBL;
|
||||
break;
|
||||
case Key_NumberSign:
|
||||
s = SDLK_HASH;
|
||||
break;
|
||||
case Key_Dollar:
|
||||
s = SDLK_DOLLAR;
|
||||
break;
|
||||
case Key_Percent:
|
||||
s = SDLK_PERCENT;
|
||||
break;
|
||||
case Key_Ampersand:
|
||||
s = SDLK_AMPERSAND;
|
||||
break;
|
||||
case Key_Apostrophe:
|
||||
s = SDLK_QUOTE;
|
||||
break;
|
||||
case Key_ParenLeft:
|
||||
s = SDLK_LEFTPAREN;
|
||||
break;
|
||||
case Key_ParenRight:
|
||||
s = SDLK_RIGHTPAREN;
|
||||
break;
|
||||
case Key_Asterisk:
|
||||
s = SDLK_ASTERISK;
|
||||
break;
|
||||
case Key_Plus:
|
||||
s = SDLK_PLUS;
|
||||
break;
|
||||
case Key_Comma:
|
||||
s = SDLK_COMMA;
|
||||
break;
|
||||
case Key_Minus:
|
||||
s = SDLK_MINUS;
|
||||
break;
|
||||
case Key_Period:
|
||||
s = SDLK_PERIOD;
|
||||
break;
|
||||
case Key_Slash:
|
||||
s = SDLK_SLASH;
|
||||
break;
|
||||
case Key_0:
|
||||
s = SDLK_0;
|
||||
break;
|
||||
case Key_1:
|
||||
s = SDLK_1;
|
||||
break;
|
||||
case Key_2:
|
||||
s = SDLK_2;
|
||||
break;
|
||||
case Key_3:
|
||||
s = SDLK_3;
|
||||
break;
|
||||
case Key_4:
|
||||
s = SDLK_4;
|
||||
break;
|
||||
case Key_5:
|
||||
s = SDLK_5;
|
||||
break;
|
||||
case Key_6:
|
||||
s = SDLK_6;
|
||||
break;
|
||||
case Key_7:
|
||||
s = SDLK_7;
|
||||
break;
|
||||
case Key_8:
|
||||
s = SDLK_8;
|
||||
break;
|
||||
case Key_9:
|
||||
s = SDLK_9;
|
||||
break;
|
||||
case Key_Colon:
|
||||
s = SDLK_COLON;
|
||||
break;
|
||||
case Key_Semicolon:
|
||||
s = SDLK_SEMICOLON;
|
||||
break;
|
||||
case Key_Less:
|
||||
s = SDLK_LESS;
|
||||
break;
|
||||
case Key_Equal:
|
||||
s = SDLK_EQUALS;
|
||||
break;
|
||||
case Key_Greater:
|
||||
s = SDLK_GREATER;
|
||||
break;
|
||||
case Key_Question:
|
||||
s = SDLK_QUESTION;
|
||||
break;
|
||||
case Key_At:
|
||||
s = SDLK_AT;
|
||||
break;
|
||||
break;
|
||||
case Key_A:
|
||||
s = SDLK_a;
|
||||
break;
|
||||
case Key_B:
|
||||
s = SDLK_b;
|
||||
break;
|
||||
case Key_C:
|
||||
s = SDLK_c;
|
||||
break;
|
||||
case Key_D:
|
||||
s = SDLK_d;
|
||||
break;
|
||||
case Key_E:
|
||||
s = SDLK_e;
|
||||
break;
|
||||
case Key_F:
|
||||
s = SDLK_f;
|
||||
break;
|
||||
case Key_G:
|
||||
s = SDLK_g;
|
||||
break;
|
||||
case Key_H:
|
||||
s = SDLK_h;
|
||||
break;
|
||||
case Key_I:
|
||||
s = SDLK_i;
|
||||
break;
|
||||
case Key_J:
|
||||
s = SDLK_j;
|
||||
break;
|
||||
case Key_K:
|
||||
s = SDLK_k;
|
||||
break;
|
||||
case Key_L:
|
||||
s = SDLK_l;
|
||||
break;
|
||||
case Key_M:
|
||||
s = SDLK_m;
|
||||
break;
|
||||
case Key_N:
|
||||
s = SDLK_n;
|
||||
break;
|
||||
case Key_O:
|
||||
s = SDLK_o;
|
||||
break;
|
||||
case Key_P:
|
||||
s = SDLK_p;
|
||||
break;
|
||||
case Key_Q:
|
||||
s = SDLK_q;
|
||||
break;
|
||||
case Key_R:
|
||||
s = SDLK_r;
|
||||
break;
|
||||
case Key_S:
|
||||
s = SDLK_s;
|
||||
break;
|
||||
case Key_T:
|
||||
s = SDLK_t;
|
||||
break;
|
||||
case Key_U:
|
||||
s = SDLK_u;
|
||||
break;
|
||||
case Key_V:
|
||||
s = SDLK_v;
|
||||
break;
|
||||
case Key_W:
|
||||
s = SDLK_w;
|
||||
break;
|
||||
case Key_X:
|
||||
s = SDLK_x;
|
||||
break;
|
||||
case Key_Y:
|
||||
s = SDLK_y;
|
||||
break;
|
||||
case Key_Z:
|
||||
s = SDLK_z;
|
||||
break;
|
||||
case Key_BracketLeft:
|
||||
s = SDLK_LEFTBRACKET;
|
||||
break;
|
||||
case Key_Backslash:
|
||||
s = SDLK_BACKSLASH;
|
||||
break;
|
||||
case Key_BracketRight:
|
||||
s = SDLK_RIGHTBRACKET;
|
||||
break;
|
||||
//case Key_AsciiCircum:
|
||||
// s = SDLK_CARET;
|
||||
//break;
|
||||
case Key_Underscore:
|
||||
s = SDLK_UNDERSCORE;
|
||||
break;
|
||||
case Key_QuoteLeft:
|
||||
s = SDLK_BACKQUOTE;
|
||||
break;
|
||||
case Key_BraceLeft:
|
||||
s = SDLK_LEFTBRACKET;
|
||||
break;
|
||||
case Key_Bar:
|
||||
s = SDLK_BACKSLASH;
|
||||
break;
|
||||
case Key_BraceRight:
|
||||
s = SDLK_RIGHTBRACKET;
|
||||
break;
|
||||
case Key_AsciiTilde:
|
||||
s = SDLK_BACKQUOTE;
|
||||
break;
|
||||
|
||||
//case Key_nobreakspace:
|
||||
//case Key_exclamdown:
|
||||
//case Key_cent:
|
||||
//case Key_sterling:
|
||||
//case Key_currency:
|
||||
//case Key_yen:
|
||||
//case Key_brokenbar:
|
||||
//case Key_section:
|
||||
//case Key_diaeresis:
|
||||
//case Key_copyright:
|
||||
//case Key_ordfeminine:
|
||||
//case Key_guillemotleft:
|
||||
//case Key_notsign:
|
||||
//case Key_hyphen:
|
||||
//case Key_registered:
|
||||
//case Key_macron:
|
||||
//case Key_degree:
|
||||
//case Key_plusminus:
|
||||
//case Key_twosuperior:
|
||||
//case Key_threesuperior:
|
||||
//case Key_acute:
|
||||
//case Key_mu:
|
||||
//case Key_paragraph:
|
||||
//case Key_periodcentered:
|
||||
//case Key_cedilla:
|
||||
//case Key_onesuperior:
|
||||
//case Key_masculine:
|
||||
//case Key_guillemotright:
|
||||
//case Key_onequarter:
|
||||
//case Key_onehalf:
|
||||
//case Key_threequarters:
|
||||
//case Key_questiondown:
|
||||
//case Key_Agrave:
|
||||
//case Key_Aacute:
|
||||
//case Key_Acircumflex:
|
||||
//case Key_Atilde:
|
||||
//case Key_Adiaeresis:
|
||||
//case Key_Aring:
|
||||
//case Key_AE:
|
||||
//case Key_Ccedilla:
|
||||
//case Key_Egrave:
|
||||
//case Key_Eacute:
|
||||
//case Key_Ecircumflex:
|
||||
//case Key_Ediaeresis:
|
||||
//case Key_Igrave:
|
||||
//case Key_Iacute:
|
||||
//case Key_Icircumflex:
|
||||
//case Key_Idiaeresis:
|
||||
//case Key_ETH:
|
||||
//case Key_Ntilde:
|
||||
//case Key_Ograve:
|
||||
//case Key_Oacute:
|
||||
//case Key_Ocircumflex:
|
||||
//case Key_Otilde:
|
||||
//case Key_Odiaeresis:
|
||||
//case Key_multiply:
|
||||
//case Key_Ooblique:
|
||||
//case Key_Ugrave:
|
||||
//case Key_Uacute:
|
||||
//case Key_Ucircumflex:
|
||||
//case Key_Udiaeresis:
|
||||
//case Key_Yacute:
|
||||
//case Key_THORN:
|
||||
//case Key_ssharp:
|
||||
//case Key_division:
|
||||
//case Key_ydiaeresis:
|
||||
// s = SDL_SCANCODE_UNKNOWN;
|
||||
//break;
|
||||
default:
|
||||
s = SDLK_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
int pushKeyEvent( QKeyEvent *event, int pressDown )
|
||||
{
|
||||
SDL_Event sdlev;
|
||||
|
||||
if ( pressDown )
|
||||
{
|
||||
sdlev.type = SDL_KEYDOWN;
|
||||
sdlev.key.state = SDL_PRESSED;
|
||||
}
|
||||
else
|
||||
{
|
||||
sdlev.type = SDL_KEYUP;
|
||||
sdlev.key.state = SDL_RELEASED;
|
||||
}
|
||||
|
||||
sdlev.key.keysym.sym = convQtKey2SDLKeyCode( (Qt::Key)event->key() );
|
||||
|
||||
sdlev.key.keysym.scancode = SDL_GetScancodeFromKey( sdlev.key.keysym.sym );
|
||||
|
||||
sdlev.key.keysym.mod = 0;
|
||||
sdlev.key.repeat = 0;
|
||||
|
||||
if (sdlev.key.keysym.scancode != SDL_SCANCODE_UNKNOWN)
|
||||
{
|
||||
SDL_PushEvent (&sdlev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
#define SDLK_A SDLK_a
|
||||
#define SDLK_B SDLK_b
|
||||
#define SDLK_C SDLK_c
|
||||
#define SDLK_D SDLK_d
|
||||
#define SDLK_E SDLK_e
|
||||
#define SDLK_F SDLK_f
|
||||
#define SDLK_G SDLK_g
|
||||
#define SDLK_H SDLK_h
|
||||
#define SDLK_I SDLK_i
|
||||
#define SDLK_J SDLK_j
|
||||
#define SDLK_K SDLK_k
|
||||
#define SDLK_L SDLK_l
|
||||
#define SDLK_M SDLK_m
|
||||
#define SDLK_N SDLK_n
|
||||
#define SDLK_O SDLK_o
|
||||
#define SDLK_P SDLK_p
|
||||
#define SDLK_Q SDLK_q
|
||||
#define SDLK_R SDLK_r
|
||||
#define SDLK_S SDLK_s
|
||||
#define SDLK_T SDLK_t
|
||||
#define SDLK_U SDLK_u
|
||||
#define SDLK_V SDLK_v
|
||||
#define SDLK_W SDLK_w
|
||||
#define SDLK_X SDLK_x
|
||||
#define SDLK_Y SDLK_y
|
||||
#define SDLK_Z SDLK_z
|
||||
#define SDLK_LEFTCONTROL SDLK_LCTRL
|
||||
#define SDLK_RIGHTCONTROL SDLK_RCTRL
|
||||
#define SDLK_LEFTALT SDLK_LALT
|
||||
#define SDLK_RIGHTALT SDLK_RALT
|
||||
#define SDLK_LEFTSHIFT SDLK_LSHIFT
|
||||
#define SDLK_RIGHTSHIFT SDLK_RSHIFT
|
||||
#define SDLK_CURSORDOWN SDLK_DOWN
|
||||
#define SDLK_CURSORUP SDLK_UP
|
||||
#define SDLK_CURSORLEFT SDLK_LEFT
|
||||
#define SDLK_CURSORRIGHT SDLK_RIGHT
|
||||
#define SDLK_ENTER SDLK_RETURN
|
||||
#define SDLK_EQUAL SDLK_EQUALS
|
||||
#define SDLK_APOSTROPHE SDLK_QUOTE
|
||||
#define SDLK_BRACKET_LEFT SDLK_LEFTBRACKET
|
||||
#define SDLK_BRACKET_RIGHT SDLK_RIGHTBRACKET
|
||||
//#define SDLK_SCROLLLOCK SDLK_SCROLLOCK /* I guess the SDL people don't like lots of Ls... */
|
||||
#define SDLK_GRAVE SDLK_BACKQUOTE
|
||||
#define MKK(k) SDLK_##k
|
||||
|
||||
#include <QtCore>
|
||||
#include <QKeyEvent>
|
||||
#include <SDL.h>
|
||||
|
||||
SDL_Keycode convQtKey2SDLKeyCode( Qt::Key q );
|
||||
|
||||
SDL_Scancode convQtKey2SDLScanCode( Qt::Key q );
|
||||
|
||||
int pushKeyEvent( QKeyEvent *event, int pressDown );
|
|
@ -0,0 +1,30 @@
|
|||
#include <QApplication>
|
||||
|
||||
#include "Qt/ConsoleWindow.h"
|
||||
#include "Qt/fceuWrapper.h"
|
||||
|
||||
consoleWin_t *consoleWindow = NULL;
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
int retval;
|
||||
QApplication app(argc, argv);
|
||||
|
||||
fceuWrapperInit( argc, argv );
|
||||
|
||||
consoleWindow = new consoleWin_t();
|
||||
|
||||
consoleWindow->resize( 512, 512 );
|
||||
consoleWindow->show();
|
||||
|
||||
consoleWindow->viewport->init();
|
||||
|
||||
retval = app.exec();
|
||||
|
||||
//printf("App Return: %i \n", retval );
|
||||
|
||||
delete consoleWindow;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#ifndef __FCEU_SDL_MAIN_H
|
||||
#define __FCEU_SDL_MAIN_H
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "common/config.h"
|
||||
#include "common/args.h"
|
||||
|
||||
extern int eoptions;
|
||||
#define EO_NO8LIM 1
|
||||
#define EO_SUBASE 2
|
||||
#define EO_CLIPSIDES 8
|
||||
#define EO_SNAPNAME 16
|
||||
#define EO_FOURSCORE 32
|
||||
#define EO_NOTHROTTLE 64
|
||||
#define EO_GAMEGENIE 128
|
||||
#define EO_PAL 256
|
||||
#define EO_LOWPASS 512
|
||||
#define EO_AUTOHIDE 1024
|
||||
|
||||
extern int _sound;
|
||||
extern long soundrate;
|
||||
extern long soundbufsize;
|
||||
|
||||
extern int pal_emulation;
|
||||
|
||||
int CLImain(int argc, char *argv[]);
|
||||
|
||||
// Device management defaults
|
||||
#define NUM_INPUT_DEVICES 3
|
||||
|
||||
// GamePad defaults
|
||||
#define GAMEPAD_NUM_DEVICES 4
|
||||
#define GAMEPAD_NUM_BUTTONS 10
|
||||
extern const char *GamePadNames[GAMEPAD_NUM_BUTTONS];
|
||||
extern const char *DefaultGamePadDevice[GAMEPAD_NUM_DEVICES];
|
||||
extern const int DefaultGamePad[GAMEPAD_NUM_DEVICES][GAMEPAD_NUM_BUTTONS];
|
||||
|
||||
// PowerPad defaults
|
||||
#define POWERPAD_NUM_DEVICES 2
|
||||
#define POWERPAD_NUM_BUTTONS 12
|
||||
extern const char *PowerPadNames[POWERPAD_NUM_BUTTONS];
|
||||
extern const char *DefaultPowerPadDevice[POWERPAD_NUM_DEVICES];
|
||||
extern const int DefaultPowerPad[POWERPAD_NUM_DEVICES][POWERPAD_NUM_BUTTONS];
|
||||
|
||||
// QuizKing defaults
|
||||
#define QUIZKING_NUM_BUTTONS 6
|
||||
extern const char *QuizKingNames[QUIZKING_NUM_BUTTONS];
|
||||
extern const char *DefaultQuizKingDevice;
|
||||
extern const int DefaultQuizKing[QUIZKING_NUM_BUTTONS];
|
||||
|
||||
// HyperShot defaults
|
||||
#define HYPERSHOT_NUM_BUTTONS 4
|
||||
extern const char *HyperShotNames[HYPERSHOT_NUM_BUTTONS];
|
||||
extern const char *DefaultHyperShotDevice;
|
||||
extern const int DefaultHyperShot[HYPERSHOT_NUM_BUTTONS];
|
||||
|
||||
// Mahjong defaults
|
||||
#define MAHJONG_NUM_BUTTONS 21
|
||||
extern const char *MahjongNames[MAHJONG_NUM_BUTTONS];
|
||||
extern const char *DefaultMahjongDevice;
|
||||
extern const int DefaultMahjong[MAHJONG_NUM_BUTTONS];
|
||||
|
||||
// TopRider defaults
|
||||
#define TOPRIDER_NUM_BUTTONS 8
|
||||
extern const char *TopRiderNames[TOPRIDER_NUM_BUTTONS];
|
||||
extern const char *DefaultTopRiderDevice;
|
||||
extern const int DefaultTopRider[TOPRIDER_NUM_BUTTONS];
|
||||
|
||||
// FTrainer defaults
|
||||
#define FTRAINER_NUM_BUTTONS 12
|
||||
extern const char *FTrainerNames[FTRAINER_NUM_BUTTONS];
|
||||
extern const char *DefaultFTrainerDevice;
|
||||
extern const int DefaultFTrainer[FTRAINER_NUM_BUTTONS];
|
||||
|
||||
// FamilyKeyBoard defaults
|
||||
#define FAMILYKEYBOARD_NUM_BUTTONS 0x48
|
||||
extern const char *FamilyKeyBoardNames[FAMILYKEYBOARD_NUM_BUTTONS];
|
||||
extern const char *DefaultFamilyKeyBoardDevice;
|
||||
extern const int DefaultFamilyKeyBoard[FAMILYKEYBOARD_NUM_BUTTONS];
|
||||
|
||||
#endif
|
|
@ -0,0 +1,54 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "Qt/nes_shm.h"
|
||||
|
||||
nes_shm_t *nes_shm = NULL;
|
||||
|
||||
//************************************************************************
|
||||
nes_shm_t *open_nes_shm(void)
|
||||
{
|
||||
int shmId;
|
||||
nes_shm_t *vaddr;
|
||||
struct shmid_ds ds;
|
||||
|
||||
shmId = shmget( IPC_PRIVATE, sizeof(struct nes_shm_t), IPC_CREAT | S_IRWXU | S_IRWXG );
|
||||
|
||||
if ( shmId == -1 )
|
||||
{
|
||||
perror("Error: GL shmget Failed:");
|
||||
return NULL;
|
||||
}
|
||||
printf("Created ShmID: %i \n", shmId );
|
||||
|
||||
vaddr = (nes_shm_t*)shmat( shmId, NULL, 0);
|
||||
|
||||
if ( vaddr == (nes_shm_t*)-1 )
|
||||
{
|
||||
perror("Error: NES shmat Failed:");
|
||||
return NULL;
|
||||
}
|
||||
memset( vaddr, 0, sizeof(struct nes_shm_t));
|
||||
|
||||
if ( shmctl( shmId, IPC_RMID, &ds ) != 0 )
|
||||
{
|
||||
perror("Error: GLX shmctl IPC_RMID Failed:");
|
||||
}
|
||||
|
||||
//sem_init( &vaddr->sem, 1, 1 );
|
||||
|
||||
vaddr->ncol = 256;
|
||||
vaddr->nrow = 256;
|
||||
vaddr->pitch = 256 * 4;
|
||||
|
||||
return vaddr;
|
||||
}
|
||||
//************************************************************************
|
|
@ -0,0 +1,86 @@
|
|||
// nes_shm.h
|
||||
//
|
||||
|
||||
#ifndef __NES_SHM_H__
|
||||
#define __NES_SHM_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define GL_WIN_PIXEL_LINEAR_FILTER 0x0001
|
||||
#define GL_WIN_DOUBLE_BUFFER 0x0002
|
||||
|
||||
#define GL_NES_WIDTH 256
|
||||
#define GL_NES_HEIGHT 256
|
||||
#define NES_AUDIO_BUFLEN 480000
|
||||
|
||||
struct nes_shm_t
|
||||
{
|
||||
int pid;
|
||||
int run;
|
||||
uint32_t render_count;
|
||||
uint32_t blit_count;
|
||||
|
||||
int ncol;
|
||||
int nrow;
|
||||
int pitch;
|
||||
|
||||
char runEmulator;
|
||||
char blitUpdated;
|
||||
|
||||
// Pass Key Events back to QT Gui
|
||||
struct
|
||||
{
|
||||
int head;
|
||||
int tail;
|
||||
|
||||
struct {
|
||||
int type;
|
||||
int keycode;
|
||||
int state;
|
||||
} data[64];
|
||||
|
||||
} keyEventBuf;
|
||||
|
||||
// Gui Command Event Queue
|
||||
struct
|
||||
{
|
||||
int head;
|
||||
int tail;
|
||||
|
||||
struct {
|
||||
int id;
|
||||
|
||||
union {
|
||||
int i32[4];
|
||||
float f32[4];
|
||||
} param;
|
||||
} cmd[64];
|
||||
} guiEvent;
|
||||
|
||||
uint32_t pixbuf[65536]; // 256 x 256
|
||||
|
||||
void clear_pixbuf(void)
|
||||
{
|
||||
memset( pixbuf, 0, sizeof(pixbuf) );
|
||||
}
|
||||
|
||||
struct sndBuf_t
|
||||
{
|
||||
int head;
|
||||
int tail;
|
||||
int16_t data[NES_AUDIO_BUFLEN];
|
||||
unsigned int starveCounter;
|
||||
} sndBuf;
|
||||
|
||||
void push_sound_sample( int16_t sample )
|
||||
{
|
||||
sndBuf.data[ sndBuf.head ] = sample;
|
||||
sndBuf.head = (sndBuf.head + 1) % NES_AUDIO_BUFLEN;
|
||||
}
|
||||
};
|
||||
|
||||
extern nes_shm_t *nes_shm;
|
||||
|
||||
nes_shm_t *open_nes_shm(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,127 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
* Copyright (C) 2002 Paul Kuliniewicz
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/// \file
|
||||
/// \brief Handles joystick input using the SDL.
|
||||
|
||||
#include "Qt/sdl.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <cerrno>
|
||||
|
||||
#define MAX_JOYSTICKS 32
|
||||
static SDL_Joystick *s_Joysticks[MAX_JOYSTICKS] = {NULL};
|
||||
|
||||
static int s_jinited = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Tests if the given button is active on the joystick.
|
||||
*/
|
||||
int
|
||||
DTestButtonJoy(ButtConfig *bc)
|
||||
{
|
||||
int x;
|
||||
|
||||
for(x = 0; x < bc->NumC; x++)
|
||||
{
|
||||
if (bc->ButtonNum[x] == -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (bc->ButtonNum[x] & 0x2000)
|
||||
{
|
||||
/* Hat "button" */
|
||||
if(SDL_JoystickGetHat(s_Joysticks[bc->DeviceNum[x]],
|
||||
((bc->ButtonNum[x] >> 8) & 0x1F)) &
|
||||
(bc->ButtonNum[x]&0xFF))
|
||||
return 1;
|
||||
}
|
||||
else if (bc->ButtonNum[x] & 0x8000)
|
||||
{
|
||||
/* Axis "button" */
|
||||
int pos;
|
||||
pos = SDL_JoystickGetAxis(s_Joysticks[bc->DeviceNum[x]],
|
||||
bc->ButtonNum[x] & 16383);
|
||||
if ((bc->ButtonNum[x] & 0x4000) && pos <= -16383) {
|
||||
return 1;
|
||||
} else if (!(bc->ButtonNum[x] & 0x4000) && pos >= 16363) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if(SDL_JoystickGetButton(s_Joysticks[bc->DeviceNum[x]],
|
||||
bc->ButtonNum[x]))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shutdown the SDL joystick subsystem.
|
||||
*/
|
||||
int
|
||||
KillJoysticks()
|
||||
{
|
||||
int n; /* joystick index */
|
||||
|
||||
if(!s_jinited) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for(n = 0; n < MAX_JOYSTICKS; n++) {
|
||||
if (s_Joysticks[n] != 0) {
|
||||
SDL_JoystickClose(s_Joysticks[n]);
|
||||
}
|
||||
s_Joysticks[n]=0;
|
||||
}
|
||||
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the SDL joystick subsystem.
|
||||
*/
|
||||
int
|
||||
InitJoysticks()
|
||||
{
|
||||
int n; /* joystick index */
|
||||
int total;
|
||||
|
||||
SDL_InitSubSystem(SDL_INIT_JOYSTICK);
|
||||
|
||||
total = SDL_NumJoysticks();
|
||||
if(total>MAX_JOYSTICKS) {
|
||||
total = MAX_JOYSTICKS;
|
||||
}
|
||||
|
||||
for(n = 0; n < total; n++) {
|
||||
/* Open the joystick under SDL. */
|
||||
s_Joysticks[n] = SDL_JoystickOpen(n);
|
||||
//printf("Could not open joystick %d: %s.\n",
|
||||
//joy[n] - 1, SDL_GetError());
|
||||
continue;
|
||||
}
|
||||
|
||||
s_jinited = 1;
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,297 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/// \file
|
||||
/// \brief Handles sound emulation using the SDL.
|
||||
|
||||
#include "sdl.h"
|
||||
|
||||
#include "common/configSys.h"
|
||||
#include "utils/memory.h"
|
||||
#include "nes_shm.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
|
||||
extern Config *g_config;
|
||||
|
||||
static volatile int *s_Buffer = 0;
|
||||
static unsigned int s_BufferSize;
|
||||
static unsigned int s_BufferRead;
|
||||
static unsigned int s_BufferWrite;
|
||||
static volatile unsigned int s_BufferIn;
|
||||
|
||||
static int s_mute = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Callback from the SDL to get and play audio data.
|
||||
*/
|
||||
static void
|
||||
fillaudio(void *udata,
|
||||
uint8 *stream,
|
||||
int len)
|
||||
{
|
||||
char bufStarveDetected = 0;
|
||||
static int16_t sample = 0;
|
||||
int16 *tmps = (int16*)stream;
|
||||
len >>= 1;
|
||||
while (len)
|
||||
{
|
||||
//int16 sample = 0;
|
||||
if (s_BufferIn)
|
||||
{
|
||||
sample = s_Buffer[s_BufferRead];
|
||||
s_BufferRead = (s_BufferRead + 1) % s_BufferSize;
|
||||
s_BufferIn--;
|
||||
} else {
|
||||
// Retain last known sample value, helps avoid clicking
|
||||
// noise when sound system is starved of audio data.
|
||||
//sample = 0;
|
||||
bufStarveDetected = 1;
|
||||
nes_shm->sndBuf.starveCounter++;
|
||||
}
|
||||
|
||||
nes_shm->push_sound_sample( sample );
|
||||
|
||||
*tmps = sample;
|
||||
tmps++;
|
||||
len--;
|
||||
}
|
||||
if ( bufStarveDetected )
|
||||
{
|
||||
//printf("Starve:%u\n", nes_shm->sndBuf.starveCounter );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the audio subsystem.
|
||||
*/
|
||||
int
|
||||
InitSound()
|
||||
{
|
||||
int sound, soundrate, soundbufsize, soundvolume, soundtrianglevolume, soundsquare1volume, soundsquare2volume, soundnoisevolume, soundpcmvolume, soundq;
|
||||
SDL_AudioSpec spec;
|
||||
const char *driverName;
|
||||
|
||||
g_config->getOption("SDL.Sound", &sound);
|
||||
if (!sound)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&spec, 0, sizeof(spec));
|
||||
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
|
||||
{
|
||||
puts(SDL_GetError());
|
||||
KillSound();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// load configuration variables
|
||||
g_config->getOption("SDL.Sound.Rate", &soundrate);
|
||||
g_config->getOption("SDL.Sound.BufSize", &soundbufsize);
|
||||
g_config->getOption("SDL.Sound.Volume", &soundvolume);
|
||||
g_config->getOption("SDL.Sound.Quality", &soundq);
|
||||
g_config->getOption("SDL.Sound.TriangleVolume", &soundtrianglevolume);
|
||||
g_config->getOption("SDL.Sound.Square1Volume", &soundsquare1volume);
|
||||
g_config->getOption("SDL.Sound.Square2Volume", &soundsquare2volume);
|
||||
g_config->getOption("SDL.Sound.NoiseVolume", &soundnoisevolume);
|
||||
g_config->getOption("SDL.Sound.PCMVolume", &soundpcmvolume);
|
||||
|
||||
spec.freq = soundrate;
|
||||
spec.format = AUDIO_S16SYS;
|
||||
spec.channels = 1;
|
||||
spec.samples = 512;
|
||||
spec.callback = fillaudio;
|
||||
spec.userdata = 0;
|
||||
|
||||
s_BufferSize = soundbufsize * soundrate / 1000;
|
||||
|
||||
// For safety, set a bare minimum:
|
||||
if (s_BufferSize < spec.samples * 2)
|
||||
{
|
||||
s_BufferSize = spec.samples * 2;
|
||||
}
|
||||
|
||||
s_Buffer = (int *)FCEU_dmalloc(sizeof(int) * s_BufferSize);
|
||||
|
||||
if (!s_Buffer)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
s_BufferRead = s_BufferWrite = s_BufferIn = 0;
|
||||
|
||||
if (SDL_OpenAudio(&spec, 0) < 0)
|
||||
{
|
||||
puts(SDL_GetError());
|
||||
KillSound();
|
||||
return 0;
|
||||
}
|
||||
SDL_PauseAudio(0);
|
||||
|
||||
driverName = SDL_GetCurrentAudioDriver();
|
||||
|
||||
if ( driverName )
|
||||
{
|
||||
fprintf(stderr, "Loading SDL sound with %s driver...\n", driverName);
|
||||
}
|
||||
|
||||
FCEUI_SetSoundVolume(soundvolume);
|
||||
FCEUI_SetSoundQuality(soundq);
|
||||
FCEUI_Sound(soundrate);
|
||||
FCEUI_SetTriangleVolume(soundtrianglevolume);
|
||||
FCEUI_SetSquare1Volume(soundsquare1volume);
|
||||
FCEUI_SetSquare2Volume(soundsquare2volume);
|
||||
FCEUI_SetNoiseVolume(soundnoisevolume);
|
||||
FCEUI_SetPCMVolume(soundpcmvolume);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the size of the audio buffer.
|
||||
*/
|
||||
uint32
|
||||
GetMaxSound(void)
|
||||
{
|
||||
return(s_BufferSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of free space in the audio buffer.
|
||||
*/
|
||||
uint32
|
||||
GetWriteSound(void)
|
||||
{
|
||||
return(s_BufferSize - s_BufferIn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a sound clip to the audio subsystem.
|
||||
*/
|
||||
void
|
||||
WriteSound(int32 *buf,
|
||||
int Count)
|
||||
{
|
||||
extern int EmulationPaused;
|
||||
if (EmulationPaused == 0)
|
||||
{
|
||||
while(Count)
|
||||
{
|
||||
while(s_BufferIn == s_BufferSize)
|
||||
{
|
||||
SDL_Delay(1);
|
||||
}
|
||||
|
||||
s_Buffer[s_BufferWrite] = *buf;
|
||||
Count--;
|
||||
s_BufferWrite = (s_BufferWrite + 1) % s_BufferSize;
|
||||
|
||||
SDL_LockAudio();
|
||||
s_BufferIn++;
|
||||
SDL_UnlockAudio();
|
||||
|
||||
buf++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pause (1) or unpause (0) the audio output.
|
||||
*/
|
||||
void
|
||||
SilenceSound(int n)
|
||||
{
|
||||
SDL_PauseAudio(n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shut down the audio subsystem.
|
||||
*/
|
||||
int
|
||||
KillSound(void)
|
||||
{
|
||||
FCEUI_Sound(0);
|
||||
SDL_CloseAudio();
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
if(s_Buffer) {
|
||||
free((void *)s_Buffer);
|
||||
s_Buffer = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adjust the volume either down (-1), up (1), or to the default (0).
|
||||
* Unmutes if mute was active before.
|
||||
*/
|
||||
void
|
||||
FCEUD_SoundVolumeAdjust(int n)
|
||||
{
|
||||
int soundvolume;
|
||||
g_config->getOption("SDL.Sound.Volume", &soundvolume);
|
||||
|
||||
switch(n) {
|
||||
case -1:
|
||||
soundvolume -= 10;
|
||||
if(soundvolume < 0) {
|
||||
soundvolume = 0;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
soundvolume = 100;
|
||||
break;
|
||||
case 1:
|
||||
soundvolume += 10;
|
||||
if(soundvolume > 150) {
|
||||
soundvolume = 150;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
s_mute = 0;
|
||||
FCEUI_SetSoundVolume(soundvolume);
|
||||
g_config->setOption("SDL.Sound.Volume", soundvolume);
|
||||
|
||||
FCEU_DispMessage("Sound volume %d.",0, soundvolume);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the sound on or off.
|
||||
*/
|
||||
void
|
||||
FCEUD_SoundToggle(void)
|
||||
{
|
||||
if(s_mute) {
|
||||
int soundvolume;
|
||||
g_config->getOption("SDL.SoundVolume", &soundvolume);
|
||||
|
||||
s_mute = 0;
|
||||
FCEUI_SetSoundVolume(soundvolume);
|
||||
FCEU_DispMessage("Sound mute off.",0);
|
||||
} else {
|
||||
s_mute = 1;
|
||||
FCEUI_SetSoundVolume(0);
|
||||
FCEU_DispMessage("Sound mute on.",0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
/// \file
|
||||
/// \brief Handles emulation speed throttling using the SDL timing functions.
|
||||
|
||||
#include "Qt/sdl.h"
|
||||
#include "Qt/throttle.h"
|
||||
|
||||
static const double Slowest = 0.015625; // 1/64x speed (around 1 fps on NTSC)
|
||||
static const double Fastest = 32; // 32x speed (around 1920 fps on NTSC)
|
||||
static const double Normal = 1.0; // 1x speed (around 60 fps on NTSC)
|
||||
|
||||
static uint64 Lasttime, Nexttime;
|
||||
static double desired_frametime = (1.0 / 60.099823);
|
||||
static int InFrame = 0;
|
||||
double g_fpsScale = Normal; // used by sdl.cpp
|
||||
bool MaxSpeed = false;
|
||||
|
||||
/* LOGMUL = exp(log(2) / 3)
|
||||
*
|
||||
* This gives us a value such that if we do x*=LOGMUL three times,
|
||||
* then after that, x is twice the value it was before.
|
||||
*
|
||||
* This gives us three speed steps per order of magnitude.
|
||||
*
|
||||
*/
|
||||
#define LOGMUL 1.259921049894873
|
||||
|
||||
/**
|
||||
* Refreshes the FPS throttling variables.
|
||||
*/
|
||||
void
|
||||
RefreshThrottleFPS()
|
||||
{
|
||||
double hz;
|
||||
int32_t fps = FCEUI_GetDesiredFPS(); // Do >> 24 to get in Hz
|
||||
int32_t T;
|
||||
|
||||
hz = ( ((double)fps) / 16777216.0 );
|
||||
|
||||
desired_frametime = 1.0 / ( hz * g_fpsScale );
|
||||
|
||||
T = (int32_t)( desired_frametime * 1000.0 );
|
||||
|
||||
if ( T < 0 ) T = 1;
|
||||
|
||||
//printf("FrameTime: %llu %llu %f %lf \n", fps, fps >> 24, hz, desired_frametime );
|
||||
|
||||
Lasttime=0;
|
||||
Nexttime=0;
|
||||
InFrame=0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform FPS speed throttling by delaying until the next time slot.
|
||||
*/
|
||||
int
|
||||
SpeedThrottle()
|
||||
{
|
||||
if (g_fpsScale >= 32)
|
||||
{
|
||||
return 0; /* Done waiting */
|
||||
}
|
||||
uint64 time_left;
|
||||
uint64 cur_time;
|
||||
|
||||
if (!Lasttime)
|
||||
{
|
||||
Lasttime = SDL_GetTicks();
|
||||
}
|
||||
|
||||
if (!InFrame)
|
||||
{
|
||||
InFrame = 1;
|
||||
Nexttime = Lasttime + desired_frametime * 1000;
|
||||
}
|
||||
|
||||
cur_time = SDL_GetTicks();
|
||||
if(cur_time >= Nexttime)
|
||||
time_left = 0;
|
||||
else
|
||||
time_left = Nexttime - cur_time;
|
||||
|
||||
if (time_left > 50)
|
||||
{
|
||||
time_left = 50;
|
||||
/* In order to keep input responsive, don't wait too long at once */
|
||||
/* 50 ms wait gives us a 20 Hz responsetime which is nice. */
|
||||
}
|
||||
else
|
||||
{
|
||||
InFrame = 0;
|
||||
}
|
||||
|
||||
//fprintf(stderr, "attempting to sleep %Ld ms, frame complete=%s\n",
|
||||
// time_left, InFrame?"no":"yes");
|
||||
|
||||
if ( time_left > 0 )
|
||||
{
|
||||
SDL_Delay(time_left);
|
||||
}
|
||||
|
||||
if (!InFrame)
|
||||
{
|
||||
Lasttime = SDL_GetTicks();
|
||||
return 0; /* Done waiting */
|
||||
}
|
||||
return 1; /* Must still wait some more */
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the emulation speed throttling to the next entry in the speed table.
|
||||
*/
|
||||
void IncreaseEmulationSpeed(void)
|
||||
{
|
||||
g_fpsScale *= LOGMUL;
|
||||
|
||||
if(g_fpsScale > Fastest) g_fpsScale = Fastest;
|
||||
|
||||
RefreshThrottleFPS();
|
||||
|
||||
FCEU_DispMessage("Emulation speed %.1f%%",0, g_fpsScale*100.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the emulation speed throttling to the previous entry in the speed table.
|
||||
*/
|
||||
void DecreaseEmulationSpeed(void)
|
||||
{
|
||||
g_fpsScale /= LOGMUL;
|
||||
if(g_fpsScale < Slowest)
|
||||
g_fpsScale = Slowest;
|
||||
|
||||
RefreshThrottleFPS();
|
||||
|
||||
FCEU_DispMessage("Emulation speed %.1f%%",0, g_fpsScale*100.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the emulation speed throttling to a specific value.
|
||||
*/
|
||||
void
|
||||
FCEUD_SetEmulationSpeed(int cmd)
|
||||
{
|
||||
MaxSpeed = false;
|
||||
|
||||
switch(cmd) {
|
||||
case EMUSPEED_SLOWEST:
|
||||
g_fpsScale = Slowest;
|
||||
break;
|
||||
case EMUSPEED_SLOWER:
|
||||
DecreaseEmulationSpeed();
|
||||
break;
|
||||
case EMUSPEED_NORMAL:
|
||||
g_fpsScale = Normal;
|
||||
break;
|
||||
case EMUSPEED_FASTER:
|
||||
IncreaseEmulationSpeed();
|
||||
break;
|
||||
case EMUSPEED_FASTEST:
|
||||
g_fpsScale = Fastest;
|
||||
MaxSpeed = true;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
RefreshThrottleFPS();
|
||||
|
||||
FCEU_DispMessage("Emulation speed %.1f%%",0, g_fpsScale*100.0);
|
||||
}
|
|
@ -0,0 +1,473 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/// \file
|
||||
/// \brief Handles the graphical game display for the SDL implementation.
|
||||
|
||||
#include "Qt/sdl.h"
|
||||
#include "Qt/nes_shm.h"
|
||||
#include "common/vidblit.h"
|
||||
#include "../../fceu.h"
|
||||
#include "../../version.h"
|
||||
#include "../../video.h"
|
||||
|
||||
#include "utils/memory.h"
|
||||
|
||||
//#include "sdl-icon.h"
|
||||
#include "Qt/dface.h"
|
||||
|
||||
#include "common/configSys.h"
|
||||
#include "Qt/sdl-video.h"
|
||||
#include "Qt/fceuWrapper.h"
|
||||
|
||||
#ifdef CREATE_AVI
|
||||
#include "../videolog/nesvideos-piece.h"
|
||||
#endif
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#define LSB_FIRST
|
||||
#endif
|
||||
|
||||
// GLOBALS
|
||||
extern Config *g_config;
|
||||
|
||||
// STATIC GLOBALS
|
||||
static int s_curbpp = 0;
|
||||
static int s_srendline, s_erendline;
|
||||
static int s_tlines;
|
||||
static int s_inited = 0;
|
||||
|
||||
//#ifdef OPENGL
|
||||
//static int s_useOpenGL = 0;
|
||||
//#endif
|
||||
static double s_exs = 1.0, s_eys = 1.0;
|
||||
static int s_eefx = 0;
|
||||
static int s_clipSides = 0;
|
||||
static int s_fullscreen = 0;
|
||||
static int noframe = 0;
|
||||
static int initBlitToHighDone = 0;
|
||||
|
||||
#define NWIDTH (256 - (s_clipSides ? 16 : 0))
|
||||
#define NOFFSET (s_clipSides ? 8 : 0)
|
||||
|
||||
static int s_paletterefresh = 1;
|
||||
|
||||
extern bool MaxSpeed;
|
||||
|
||||
/**
|
||||
* Attempts to destroy the graphical video display. Returns 0 on
|
||||
* success, -1 on failure.
|
||||
*/
|
||||
|
||||
//draw input aids if we are fullscreen
|
||||
bool FCEUD_ShouldDrawInputAids()
|
||||
{
|
||||
return s_fullscreen!=0;
|
||||
}
|
||||
|
||||
int
|
||||
KillVideo()
|
||||
{
|
||||
//printf("Killing Video\n");
|
||||
|
||||
if ( nes_shm != NULL )
|
||||
{
|
||||
nes_shm->clear_pixbuf();
|
||||
}
|
||||
|
||||
//destroy_gui_video();
|
||||
|
||||
// return failure if the video system was not initialized
|
||||
if (s_inited == 0)
|
||||
return -1;
|
||||
|
||||
// if the rest of the system has been initialized, shut it down
|
||||
// // shut down the system that converts from 8 to 16/32 bpp
|
||||
// if (s_curbpp > 8)
|
||||
// {
|
||||
// KillBlitToHigh();
|
||||
// }
|
||||
|
||||
// SDL Video system is not used.
|
||||
// shut down the SDL video sub-system
|
||||
//SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
s_inited = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// this variable contains information about the special scaling filters
|
||||
static int s_sponge = 0;
|
||||
|
||||
/**
|
||||
* These functions determine an appropriate scale factor for fullscreen/
|
||||
*/
|
||||
inline double GetXScale(int xres)
|
||||
{
|
||||
return ((double)xres) / NWIDTH;
|
||||
}
|
||||
inline double GetYScale(int yres)
|
||||
{
|
||||
return ((double)yres) / s_tlines;
|
||||
}
|
||||
void FCEUD_VideoChanged()
|
||||
{
|
||||
int buf;
|
||||
g_config->getOption("SDL.PAL", &buf);
|
||||
if(buf == 1)
|
||||
PAL = 1;
|
||||
else
|
||||
PAL = 0; // NTSC and Dendy
|
||||
}
|
||||
|
||||
int InitVideo(FCEUGI *gi)
|
||||
{
|
||||
int doublebuf, xstretch, ystretch, xres, yres, show_fps;
|
||||
|
||||
FCEUI_printf("Initializing video...");
|
||||
|
||||
// load the relevant configuration variables
|
||||
g_config->getOption("SDL.Fullscreen", &s_fullscreen);
|
||||
g_config->getOption("SDL.DoubleBuffering", &doublebuf);
|
||||
//#ifdef OPENGL
|
||||
// g_config->getOption("SDL.OpenGL", &s_useOpenGL);
|
||||
//#endif
|
||||
//g_config->getOption("SDL.SpecialFilter", &s_sponge);
|
||||
g_config->getOption("SDL.XStretch", &xstretch);
|
||||
g_config->getOption("SDL.YStretch", &ystretch);
|
||||
//g_config->getOption("SDL.LastXRes", &xres);
|
||||
//g_config->getOption("SDL.LastYRes", &yres);
|
||||
g_config->getOption("SDL.ClipSides", &s_clipSides);
|
||||
g_config->getOption("SDL.NoFrame", &noframe);
|
||||
g_config->getOption("SDL.ShowFPS", &show_fps);
|
||||
//g_config->getOption("SDL.XScale", &s_exs);
|
||||
//g_config->getOption("SDL.YScale", &s_eys);
|
||||
uint32_t rmask, gmask, bmask;
|
||||
|
||||
s_sponge = 0;
|
||||
s_exs = 1.0;
|
||||
s_eys = 1.0;
|
||||
xres = gui_draw_area_width;
|
||||
yres = gui_draw_area_height;
|
||||
// check the starting, ending, and total scan lines
|
||||
|
||||
FCEUI_GetCurrentVidSystem(&s_srendline, &s_erendline);
|
||||
s_tlines = s_erendline - s_srendline + 1;
|
||||
|
||||
//init_gui_video( s_useOpenGL );
|
||||
|
||||
s_inited = 1;
|
||||
|
||||
// check to see if we are showing FPS
|
||||
FCEUI_SetShowFPS(show_fps);
|
||||
|
||||
#ifdef LSB_FIRST
|
||||
rmask = 0x00FF0000;
|
||||
gmask = 0x0000FF00;
|
||||
bmask = 0x000000FF;
|
||||
#else
|
||||
rmask = 0x00FF0000;
|
||||
gmask = 0x0000FF00;
|
||||
bmask = 0x000000FF;
|
||||
#endif
|
||||
|
||||
s_curbpp = 32; // Bits per pixel is always 32
|
||||
|
||||
FCEU_printf(" Video Mode: %d x %d x %d bpp %s\n",
|
||||
xres, yres, s_curbpp,
|
||||
s_fullscreen ? "full screen" : "");
|
||||
|
||||
if (s_curbpp != 8 && s_curbpp != 16 && s_curbpp != 24 && s_curbpp != 32)
|
||||
{
|
||||
FCEU_printf(" Sorry, %dbpp modes are not supported by FCE Ultra. Supported bit depths are 8bpp, 16bpp, and 32bpp.\n", s_curbpp);
|
||||
KillVideo();
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef OPENGL
|
||||
if(s_exs <= 0.01) {
|
||||
FCEUD_PrintError("xscale out of bounds.");
|
||||
KillVideo();
|
||||
return -1;
|
||||
}
|
||||
if(s_eys <= 0.01) {
|
||||
FCEUD_PrintError("yscale out of bounds.");
|
||||
KillVideo();
|
||||
return -1;
|
||||
}
|
||||
//if(s_sponge && s_useOpenGL) {
|
||||
// FCEUD_PrintError("scalers not compatible with openGL mode.");
|
||||
// KillVideo();
|
||||
// return -1;
|
||||
//}
|
||||
#endif
|
||||
|
||||
if ( !initBlitToHighDone )
|
||||
{
|
||||
InitBlitToHigh(s_curbpp >> 3,
|
||||
rmask,
|
||||
gmask,
|
||||
bmask,
|
||||
s_eefx, s_sponge, 0);
|
||||
|
||||
initBlitToHighDone = 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the full-screen display.
|
||||
*/
|
||||
void ToggleFS(void)
|
||||
{
|
||||
// pause while we we are making the switch
|
||||
bool paused = FCEUI_EmulationPaused();
|
||||
if(!paused)
|
||||
FCEUI_ToggleEmulationPause();
|
||||
|
||||
// flip the fullscreen flag
|
||||
g_config->setOption("SDL.Fullscreen", !s_fullscreen);
|
||||
|
||||
// TODO Call method to make full Screen
|
||||
|
||||
// if we paused to make the switch; unpause
|
||||
if(!paused)
|
||||
FCEUI_ToggleEmulationPause();
|
||||
}
|
||||
|
||||
static SDL_Color s_psdl[256];
|
||||
|
||||
/**
|
||||
* Sets the color for a particular index in the palette.
|
||||
*/
|
||||
void
|
||||
FCEUD_SetPalette(uint8 index,
|
||||
uint8 r,
|
||||
uint8 g,
|
||||
uint8 b)
|
||||
{
|
||||
s_psdl[index].r = r;
|
||||
s_psdl[index].g = g;
|
||||
s_psdl[index].b = b;
|
||||
|
||||
s_paletterefresh = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the color for a particular index in the palette.
|
||||
*/
|
||||
void
|
||||
FCEUD_GetPalette(uint8 index,
|
||||
uint8 *r,
|
||||
uint8 *g,
|
||||
uint8 *b)
|
||||
{
|
||||
*r = s_psdl[index].r;
|
||||
*g = s_psdl[index].g;
|
||||
*b = s_psdl[index].b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the palette structure into the underlying video subsystem.
|
||||
*/
|
||||
static void RedoPalette()
|
||||
{
|
||||
if (s_curbpp > 8)
|
||||
{
|
||||
SetPaletteBlitToHigh((uint8*)s_psdl);
|
||||
}
|
||||
}
|
||||
// XXX soules - console lock/unlock unimplemented?
|
||||
|
||||
///Currently unimplemented.
|
||||
void LockConsole(){}
|
||||
|
||||
///Currently unimplemented.
|
||||
void UnlockConsole(){}
|
||||
|
||||
static int testPattern = 0;
|
||||
|
||||
static void WriteTestPattern(void)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
k=0;
|
||||
for (i=0; i<GL_NES_WIDTH; i++)
|
||||
{
|
||||
for (j=0; j<GL_NES_HEIGHT; j++)
|
||||
{
|
||||
nes_shm->pixbuf[k] = 0xffffffff; k++;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Pushes the given buffer of bits to the screen.
|
||||
*/
|
||||
void
|
||||
BlitScreen(uint8 *XBuf)
|
||||
{
|
||||
uint8 *dest;
|
||||
int w, h, pitch;
|
||||
|
||||
// refresh the palette if required
|
||||
if (s_paletterefresh)
|
||||
{
|
||||
RedoPalette();
|
||||
s_paletterefresh = 0;
|
||||
}
|
||||
|
||||
// XXX soules - not entirely sure why this is being done yet
|
||||
XBuf += s_srendline * 256;
|
||||
|
||||
dest = (uint8*)nes_shm->pixbuf;
|
||||
w = GL_NES_WIDTH;
|
||||
h = GL_NES_HEIGHT;
|
||||
pitch = w*4;
|
||||
|
||||
nes_shm->ncol = NWIDTH;
|
||||
nes_shm->nrow = s_tlines;
|
||||
nes_shm->pitch = pitch;
|
||||
|
||||
if ( dest == NULL ) return;
|
||||
|
||||
if ( testPattern )
|
||||
{
|
||||
WriteTestPattern();
|
||||
}
|
||||
else
|
||||
{
|
||||
Blit8ToHigh(XBuf + NOFFSET, dest, NWIDTH, s_tlines, pitch, 1, 1);
|
||||
}
|
||||
nes_shm->blitUpdated = 1;
|
||||
|
||||
//guiPixelBufferReDraw();
|
||||
|
||||
#ifdef CREATE_AVI
|
||||
{ int fps = FCEUI_GetDesiredFPS();
|
||||
static unsigned char* result = NULL;
|
||||
static unsigned resultsize = 0;
|
||||
int width = NWIDTH, height = s_tlines;
|
||||
if(!result || resultsize != width*height*3*2)
|
||||
{
|
||||
if(result) free(result);
|
||||
result = (unsigned char*) FCEU_dmalloc(resultsize = width*height*3*2);
|
||||
}
|
||||
switch(s_curbpp)
|
||||
{
|
||||
#if 0
|
||||
case 24: case 32: case 15: case 16:
|
||||
/* Convert to I420 if possible, because our I420 conversion is optimized
|
||||
* and it'll produce less network traffic, hence faster throughput than
|
||||
* anything else. And H.264 eats only I420, so it'd be converted sooner
|
||||
* or later anyway if we didn't do it. Win-win situation.
|
||||
*/
|
||||
switch(s_curbpp)
|
||||
{
|
||||
case 32: Convert32To_I420Frame(s_screen->pixels, &result[0], width*height, width); break;
|
||||
case 24: Convert24To_I420Frame(s_screen->pixels, &result[0], width*height, width); break;
|
||||
case 15: Convert15To_I420Frame(s_screen->pixels, &result[0], width*height, width); break;
|
||||
case 16: Convert16To_I420Frame(s_screen->pixels, &result[0], width*height, width); break;
|
||||
}
|
||||
NESVideoLoggingVideo(&result[0], width,height, fps, 12);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
NESVideoLoggingVideo( dest, width,height, fps, s_curbpp);
|
||||
}
|
||||
}
|
||||
#endif // CREATE_AVI
|
||||
|
||||
#if REALTIME_LOGGING
|
||||
{
|
||||
static struct timeval last_time;
|
||||
static int first_time=1;
|
||||
extern long soundrate;
|
||||
|
||||
struct timeval cur_time;
|
||||
gettimeofday(&cur_time, NULL);
|
||||
|
||||
double timediff =
|
||||
(cur_time.tv_sec *1e6 + cur_time.tv_usec
|
||||
- (last_time.tv_sec *1e6 + last_time.tv_usec)) / 1e6;
|
||||
|
||||
int nframes = timediff * 60 - 1;
|
||||
if(first_time)
|
||||
first_time = 0;
|
||||
else while(nframes > 0)
|
||||
{
|
||||
static const unsigned char Buf[800*4] = {0};
|
||||
NESVideoLoggingVideo(screen->pixels, 256,tlines, FCEUI_GetDesiredFPS(), s_curbpp);
|
||||
NESVideoLoggingAudio(Buf, soundrate,16,1, soundrate/60.0);
|
||||
--nframes;
|
||||
}
|
||||
memcpy(&last_time, &cur_time, sizeof(last_time));
|
||||
}
|
||||
#endif // REALTIME_LOGGING
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an x-y coordinate in the window manager into an x-y
|
||||
* coordinate on FCEU's screen.
|
||||
*/
|
||||
uint32
|
||||
PtoV(uint16 x,
|
||||
uint16 y)
|
||||
{
|
||||
y = (uint16)((double)y / s_eys);
|
||||
x = (uint16)((double)x / s_exs);
|
||||
if(s_clipSides) {
|
||||
x += 8;
|
||||
}
|
||||
y += s_srendline;
|
||||
return (x | (y << 16));
|
||||
}
|
||||
|
||||
bool enableHUDrecording = false;
|
||||
bool FCEUI_AviEnableHUDrecording()
|
||||
{
|
||||
if (enableHUDrecording)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
void FCEUI_SetAviEnableHUDrecording(bool enable)
|
||||
{
|
||||
enableHUDrecording = enable;
|
||||
}
|
||||
|
||||
bool disableMovieMessages = false;
|
||||
bool FCEUI_AviDisableMovieMessages()
|
||||
{
|
||||
if (disableMovieMessages)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
void FCEUI_SetAviDisableMovieMessages(bool disable)
|
||||
{
|
||||
disableMovieMessages = disable;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef __FCEU_SDL_VIDEO_H
|
||||
#define __FCEU_SDL_VIDEO_H
|
||||
#ifdef _SDL2
|
||||
#include <SDL2/SDL.h>
|
||||
#else
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
uint32 PtoV(uint16 x, uint16 y);
|
||||
bool FCEUD_ShouldDrawInputAids();
|
||||
bool FCEUI_AviDisableMovieMessages();
|
||||
bool FCEUI_AviEnableHUDrecording();
|
||||
void FCEUI_SetAviEnableHUDrecording(bool enable);
|
||||
bool FCEUI_AviDisableMovieMessages();
|
||||
void FCEUI_SetAviDisableMovieMessages(bool disable);
|
||||
#endif
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef __FCEU_SDL_H
|
||||
#define __FCEU_SDL_H
|
||||
|
||||
#if _SDL2
|
||||
#include <SDL2/SDL.h>
|
||||
#else
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
#include "Qt/main.h"
|
||||
#include "Qt/dface.h"
|
||||
#include "Qt/input.h"
|
||||
|
||||
// I'm using this as a #define so the compiler can optimize the
|
||||
// modulo operation
|
||||
#define PERIODIC_SAVE_INTERVAL 5000 // milliseconds
|
||||
|
||||
const int INVALID_STATE = 99;
|
||||
|
||||
extern int noGui;
|
||||
extern int isloaded;
|
||||
|
||||
extern int dendy;
|
||||
extern int pal_emulation;
|
||||
extern bool swapDuty;
|
||||
|
||||
int LoadGame(const char *path);
|
||||
int CloseGame(void);
|
||||
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
|
||||
uint64 FCEUD_GetTime();
|
||||
|
||||
#endif
|
|
@ -0,0 +1,2 @@
|
|||
void RefreshThrottleFPS();
|
||||
int SpeedThrottle(void);
|
|
@ -0,0 +1,366 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
//todo - ensure that #ifdef WIN32 makes sense
|
||||
//consider changing this to use sdl net stuff?
|
||||
|
||||
//#include "Qt/main.h"
|
||||
//#include "Qt/input.h"
|
||||
//#include "Qt/dface.h"
|
||||
#include "Qt/unix-netplay.h"
|
||||
|
||||
#include "../../fceu.h"
|
||||
#include "../../driver.h"
|
||||
#include "utils/md5.h"
|
||||
#include "utils/memory.h"
|
||||
|
||||
#include <string>
|
||||
#include "common/configSys.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cerrno>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock.h>
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
extern Config *g_config;
|
||||
|
||||
#ifndef socklen_t
|
||||
#define socklen_t int
|
||||
#endif
|
||||
|
||||
#ifndef SOL_TCP
|
||||
#define SOL_TCP IPPROTO_TCP
|
||||
#endif
|
||||
|
||||
int FCEUDnetplay=0;
|
||||
|
||||
static int s_Socket = -1;
|
||||
|
||||
static void
|
||||
en32(uint8 *buf,
|
||||
uint32 morp)
|
||||
{
|
||||
buf[0] = morp;
|
||||
buf[1] = morp >> 8;
|
||||
buf[2] = morp >> 16;
|
||||
buf[3] = morp >> 24;
|
||||
}
|
||||
|
||||
/*
|
||||
static uint32 de32(uint8 *morp)
|
||||
{
|
||||
return(morp[0]|(morp[1]<<8)|(morp[2]<<16)|(morp[3]<<24));
|
||||
}
|
||||
*/
|
||||
|
||||
int
|
||||
FCEUD_NetworkConnect(void)
|
||||
{
|
||||
struct sockaddr_in sockin;
|
||||
struct hostent *phostentb;
|
||||
unsigned long hadr;
|
||||
int TSocket, tcpopt, error;
|
||||
int netdivisor;
|
||||
|
||||
// get any required configuration variables
|
||||
int port, localPlayers;
|
||||
std::string server, username, password, key;
|
||||
g_config->getOption("SDL.NetworkIP", &server);
|
||||
g_config->getOption("SDL.NetworkUsername", &username);
|
||||
g_config->getOption("SDL.NetworkPassword", &password);
|
||||
g_config->getOption("SDL.NetworkGameKey", &key);
|
||||
g_config->getOption("SDL.NetworkPort", &port);
|
||||
g_config->getOption("SDL.NetworkPlayers", &localPlayers);
|
||||
|
||||
|
||||
g_config->setOption("SDL.NetworkIP", "");
|
||||
g_config->setOption("SDL.NetworkPassword", "");
|
||||
g_config->setOption("SDL.NetworkGameKey", "");
|
||||
|
||||
|
||||
|
||||
// only initialize if remote server is specified
|
||||
if(!server.size()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
TSocket = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if(TSocket < 0) {
|
||||
const char* s = "Error creating stream socket.";
|
||||
puts(s);
|
||||
FCEU_DispMessage(s,0);
|
||||
FCEUD_NetworkClose();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// try to setup TCP_NODELAY to avoid network jitters
|
||||
tcpopt = 1;
|
||||
#ifdef BEOS
|
||||
error = setsockopt(TSocket, SOL_SOCKET, TCP_NODELAY, &tcpopt, sizeof(int));
|
||||
#elif WIN32
|
||||
error = setsockopt(TSocket, SOL_TCP, TCP_NODELAY,
|
||||
(char*)&tcpopt, sizeof(int));
|
||||
#else
|
||||
error = setsockopt(TSocket, SOL_TCP, TCP_NODELAY, &tcpopt, sizeof(int));
|
||||
#endif
|
||||
if(error) {
|
||||
puts("Nodelay fail");
|
||||
}
|
||||
|
||||
memset(&sockin, 0, sizeof(sockin));
|
||||
sockin.sin_family = AF_INET;
|
||||
hadr = inet_addr(server.c_str());
|
||||
if(hadr != INADDR_NONE) {
|
||||
sockin.sin_addr.s_addr = hadr;
|
||||
} else {
|
||||
puts("*** Looking up host name...");
|
||||
phostentb = gethostbyname(server.c_str());
|
||||
if(!phostentb) {
|
||||
puts("Error getting host network information.");
|
||||
FCEU_DispMessage("Error getting host info",0);
|
||||
close(TSocket);
|
||||
FCEUD_NetworkClose();
|
||||
return(0);
|
||||
}
|
||||
memcpy(&sockin.sin_addr, phostentb->h_addr, phostentb->h_length);
|
||||
}
|
||||
|
||||
sockin.sin_port = htons(port);
|
||||
puts("*** Connecting to remote host...");
|
||||
error = connect(TSocket, (struct sockaddr *)&sockin, sizeof(sockin));
|
||||
if(error < 0) {
|
||||
puts("Error connecting to remote host.");
|
||||
FCEU_DispMessage("Error connecting to server",0);
|
||||
close(TSocket);
|
||||
FCEUD_NetworkClose();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s_Socket = TSocket;
|
||||
|
||||
puts("*** Sending initialization data to server...");
|
||||
uint8 *sendbuf;
|
||||
uint8 buf[5];
|
||||
uint32 sblen;
|
||||
|
||||
sblen = 4 + 16 + 16 + 64 + 1 + username.size();
|
||||
sendbuf = (uint8 *)FCEU_dmalloc(sblen);
|
||||
memset(sendbuf, 0, sblen);
|
||||
|
||||
// XXX soules - should use htons instead of en32() from above!
|
||||
//uint32 data = htons(sblen - 4);
|
||||
//memcpy(sendbuf, &data, sizeof(data));
|
||||
en32(sendbuf, sblen - 4);
|
||||
|
||||
if(key.size())
|
||||
{
|
||||
struct md5_context md5;
|
||||
uint8 md5out[16];
|
||||
|
||||
md5_starts(&md5);
|
||||
md5_update(&md5, (uint8*)&GameInfo->MD5.data, 16);
|
||||
md5_update(&md5, (uint8 *)key.c_str(), key.size());
|
||||
md5_finish(&md5, md5out);
|
||||
memcpy(sendbuf + 4, md5out, 16);
|
||||
} else
|
||||
{
|
||||
memcpy(sendbuf + 4, (uint8*)&GameInfo->MD5.data, 16);
|
||||
}
|
||||
|
||||
if(password.size()) {
|
||||
struct md5_context md5;
|
||||
uint8 md5out[16];
|
||||
|
||||
md5_starts(&md5);
|
||||
md5_update(&md5, (uint8 *)password.c_str(), password.size());
|
||||
md5_finish(&md5, md5out);
|
||||
memcpy(sendbuf + 4 + 16, md5out, 16);
|
||||
}
|
||||
|
||||
memset(sendbuf + 4 + 16 + 16, 0, 64);
|
||||
|
||||
sendbuf[4 + 16 + 16 + 64] = (uint8)localPlayers;
|
||||
|
||||
if(username.size()) {
|
||||
memcpy(sendbuf + 4 + 16 + 16 + 64 + 1,
|
||||
username.c_str(), username.size());
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
send(s_Socket, (char*)sendbuf, sblen, 0);
|
||||
#else
|
||||
send(s_Socket, sendbuf, sblen, 0);
|
||||
#endif
|
||||
FCEU_dfree(sendbuf);
|
||||
|
||||
#ifdef WIN32
|
||||
recv(s_Socket, (char*)buf, 1, 0);
|
||||
#else
|
||||
recv(s_Socket, buf, 1, MSG_WAITALL);
|
||||
#endif
|
||||
netdivisor = buf[0];
|
||||
|
||||
puts("*** Connection established.");
|
||||
FCEU_DispMessage("Connection established.",0);
|
||||
|
||||
FCEUDnetplay = 1;
|
||||
FCEUI_NetplayStart(localPlayers, netdivisor);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
FCEUD_SendData(void *data,
|
||||
uint32 len)
|
||||
{
|
||||
int check = 0, error = 0;
|
||||
#ifndef WIN32
|
||||
error = ioctl(fileno(stdin), FIONREAD, &check);
|
||||
#endif
|
||||
if(!error && check) {
|
||||
char buf[1024];
|
||||
char *f;
|
||||
|
||||
buf[0] = 0;
|
||||
|
||||
if ( fgets(buf, 1024, stdin) )
|
||||
{
|
||||
if((f=strrchr(buf,'\n'))) {
|
||||
*f = 0;
|
||||
}
|
||||
}
|
||||
FCEUI_NetplayText((uint8 *)buf);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
send(s_Socket, (char*)data, len ,0);
|
||||
#else
|
||||
send(s_Socket, data, len ,0);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
FCEUD_RecvData(void *data,
|
||||
uint32 len)
|
||||
{
|
||||
int size;
|
||||
//NoWaiting &= ~2;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
fd_set funfun;
|
||||
struct timeval popeye;
|
||||
|
||||
popeye.tv_sec=0;
|
||||
popeye.tv_usec=100000;
|
||||
|
||||
FD_ZERO(&funfun);
|
||||
FD_SET(s_Socket, &funfun);
|
||||
|
||||
switch(select(s_Socket + 1,&funfun,0,0,&popeye)) {
|
||||
case 0: continue;
|
||||
case -1:return 0;
|
||||
}
|
||||
|
||||
if(FD_ISSET(s_Socket,&funfun)) {
|
||||
#ifdef WIN32
|
||||
size = recv(s_Socket, (char*)data, len, 0);
|
||||
#else
|
||||
size = recv(s_Socket, data, len, MSG_WAITALL);
|
||||
#endif
|
||||
|
||||
if(size == len) {
|
||||
//unsigned long beefie;
|
||||
|
||||
FD_ZERO(&funfun);
|
||||
FD_SET(s_Socket, &funfun);
|
||||
|
||||
popeye.tv_sec = popeye.tv_usec = 0;
|
||||
if(select(s_Socket + 1, &funfun, 0, 0, &popeye) == 1)
|
||||
//if(!ioctl(s_Socket,FIONREAD,&beefie))
|
||||
// if(beefie)
|
||||
{
|
||||
//NoWaiting|=2;
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
FCEUD_NetworkClose(void)
|
||||
{
|
||||
if(s_Socket > 0) {
|
||||
#ifdef BEOS
|
||||
closesocket(s_Socket);
|
||||
#else
|
||||
close(s_Socket);
|
||||
#endif
|
||||
}
|
||||
s_Socket = -1;
|
||||
|
||||
if(FCEUDnetplay) {
|
||||
FCEUI_NetplayStop();
|
||||
}
|
||||
FCEUDnetplay = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FCEUD_NetplayText(uint8 *text)
|
||||
{
|
||||
char *tot = (char *)FCEU_dmalloc(strlen((const char *)text) + 1);
|
||||
char *tmp;
|
||||
if (!tot)
|
||||
return;
|
||||
strcpy(tot, (const char *)text);
|
||||
tmp = tot;
|
||||
|
||||
while(*tmp) {
|
||||
if(*tmp < 0x20) {
|
||||
*tmp = ' ';
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
puts(tot);
|
||||
FCEU_dfree(tot);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
extern char *netplaynick;
|
||||
extern char *netplayhost;
|
||||
extern char *netpassword;
|
||||
extern char *netgamekey;
|
||||
extern int tport;
|
||||
extern int netlocalplayers;
|
|
@ -176,7 +176,7 @@ int AddToList(char *text, uint32 id)
|
|||
**/
|
||||
|
||||
typedef struct MENU {
|
||||
char *text;
|
||||
const char *text;
|
||||
void *action;
|
||||
int type; // 0 for menu, 1 for function.
|
||||
} MENU;
|
||||
|
@ -392,7 +392,7 @@ static void ShowRes(void)
|
|||
}
|
||||
}
|
||||
|
||||
static int ShowShortList(char *moe[], int n, int def)
|
||||
static int ShowShortList(const char *moe[], int n, int def)
|
||||
{
|
||||
int x,c;
|
||||
int baa; //mbg merge 7/17/06 made to normal int
|
||||
|
@ -430,7 +430,7 @@ static void DoSearch(void)
|
|||
{
|
||||
static int v1=0,v2=0;
|
||||
static int method=0;
|
||||
char *m[9]={"O==V1 && C==V2",
|
||||
const char *m[9]={"O==V1 && C==V2",
|
||||
"O==V1 && |O-C|==V2",
|
||||
"|O-C|==V2",
|
||||
"O!=C",
|
||||
|
|
|
@ -102,7 +102,7 @@ LoadCPalette(const std::string &file)
|
|||
static void
|
||||
CreateDirs(const std::string &dir)
|
||||
{
|
||||
char *subs[8]={"fcs","snaps","gameinfo","sav","cheats","movies","cfg.d"};
|
||||
const char *subs[8]={"fcs","snaps","gameinfo","sav","cheats","movies","cfg.d"};
|
||||
std::string subdir;
|
||||
int x;
|
||||
|
||||
|
|
|
@ -1808,7 +1808,7 @@ void ConfigDevice (int which, int arg)
|
|||
char buf[256];
|
||||
int x;
|
||||
std::string prefix;
|
||||
char *str[10] =
|
||||
const char *str[10] =
|
||||
{ "A", "B", "SELECT", "START", "UP", "DOWN", "LEFT", "RIGHT", "Rapid A",
|
||||
"Rapid B"
|
||||
};
|
||||
|
|
|
@ -493,12 +493,12 @@ FILE *FCEUD_UTF8fopen(const char *fn, const char *mode)
|
|||
return(fopen(fn,mode));
|
||||
}
|
||||
|
||||
static char *s_linuxCompilerString = "g++ " __VERSION__;
|
||||
static const char *s_linuxCompilerString = "g++ " __VERSION__;
|
||||
/**
|
||||
* Returns the compiler string.
|
||||
*/
|
||||
const char *FCEUD_GetCompilerString() {
|
||||
return (const char *)s_linuxCompilerString;
|
||||
return s_linuxCompilerString;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -590,7 +590,7 @@ int main(int argc, char *argv[])
|
|||
else if(strcmp(argv[i], "--nogui") == 0)
|
||||
{
|
||||
noGui = 1;
|
||||
argv[i] = "";
|
||||
//argv[i] = "";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ FCEUD_NetworkConnect(void)
|
|||
|
||||
TSocket = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if(TSocket < 0) {
|
||||
char* s = "Error creating stream socket.";
|
||||
const char* s = "Error creating stream socket.";
|
||||
puts(s);
|
||||
FCEU_DispMessage(s,0);
|
||||
FCEUD_NetworkClose();
|
||||
|
@ -252,9 +252,14 @@ FCEUD_SendData(void *data,
|
|||
if(!error && check) {
|
||||
char buf[1024];
|
||||
char *f;
|
||||
fgets(buf, 1024, stdin);
|
||||
if((f=strrchr(buf,'\n'))) {
|
||||
*f = 0;
|
||||
|
||||
buf[0] = 0;
|
||||
|
||||
if ( fgets(buf, 1024, stdin) )
|
||||
{
|
||||
if((f=strrchr(buf,'\n'))) {
|
||||
*f = 0;
|
||||
}
|
||||
}
|
||||
FCEUI_NetplayText((uint8 *)buf);
|
||||
}
|
||||
|
|
|
@ -543,7 +543,7 @@ void PopulateMappingDisplay(HWND hwndDlg)
|
|||
lvi.mask = LVIF_TEXT;
|
||||
lvi.iItem = idx;
|
||||
lvi.iSubItem = 1;
|
||||
lvi.pszText = FCEUI_CommandTable[i].name;
|
||||
lvi.pszText = (char*)FCEUI_CommandTable[i].name;
|
||||
|
||||
SendMessage(hwndListView, LVM_SETITEM, (WPARAM)0, (LPARAM)&lvi);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ extern SPLICER splicer;
|
|||
|
||||
extern FCEUGI *GameInfo;
|
||||
|
||||
extern void FCEU_PrintError(char *format, ...);
|
||||
extern void FCEU_PrintError(const char *format, ...);
|
||||
extern bool saveProject(bool save_compact = false);
|
||||
extern bool saveProjectAs(bool save_compact = false);
|
||||
extern int getInputType(MovieData& md);
|
||||
|
|
20
src/fceu.cpp
20
src/fceu.cpp
|
@ -75,8 +75,12 @@ extern void RefreshThrottleFPS();
|
|||
#include "drivers/win/memwatch.h"
|
||||
#include "drivers/win/tracer.h"
|
||||
#else
|
||||
#ifdef __QT_DRIVER__
|
||||
#include "drivers/Qt/sdl.h"
|
||||
#else
|
||||
#include "drivers/sdl/sdl.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
@ -980,7 +984,8 @@ void FCEU_ResetVidSys(void) {
|
|||
|
||||
FCEUS FSettings;
|
||||
|
||||
void FCEU_printf(char *format, ...) {
|
||||
void FCEU_printf(const char *format, ...)
|
||||
{
|
||||
char temp[2048];
|
||||
|
||||
va_list ap;
|
||||
|
@ -999,7 +1004,8 @@ void FCEU_printf(char *format, ...) {
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
void FCEU_PrintError(char *format, ...) {
|
||||
void FCEU_PrintError(const char *format, ...)
|
||||
{
|
||||
char temp[2048];
|
||||
|
||||
va_list ap;
|
||||
|
@ -1048,38 +1054,34 @@ void FCEUI_SetRegion(int region, int notify) {
|
|||
normalscanlines = 240;
|
||||
pal_emulation = 0;
|
||||
dendy = 0;
|
||||
// until it's fixed on sdl. see issue #740
|
||||
#ifdef WIN32
|
||||
|
||||
if (notify)
|
||||
{
|
||||
FCEU_DispMessage("NTSC mode set", 0);
|
||||
FCEUI_printf("NTSC mode set");
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 1: // PAL
|
||||
normalscanlines = 240;
|
||||
pal_emulation = 1;
|
||||
dendy = 0;
|
||||
#ifdef WIN32
|
||||
|
||||
if (notify)
|
||||
{
|
||||
FCEU_DispMessage("PAL mode set", 0);
|
||||
FCEUI_printf("PAL mode set");
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 2: // Dendy
|
||||
normalscanlines = 290;
|
||||
pal_emulation = 0;
|
||||
dendy = 1;
|
||||
#ifdef WIN32
|
||||
|
||||
if (notify)
|
||||
{
|
||||
FCEU_DispMessage("Dendy mode set", 0);
|
||||
FCEUI_printf("Dendy mode set");
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
normalscanlines += newppu;
|
||||
|
|
|
@ -133,10 +133,10 @@ extern FCEUS FSettings;
|
|||
|
||||
bool CheckFileExists(const char* filename); //Receives a filename (fullpath) and checks to see if that file exists
|
||||
|
||||
void FCEU_PrintError(char *format, ...);
|
||||
void FCEU_printf(char *format, ...);
|
||||
void FCEU_DispMessage(char *format, int disppos, ...);
|
||||
void FCEU_DispMessageOnMovie(char *format, ...);
|
||||
void FCEU_PrintError(const char *format, ...);
|
||||
void FCEU_printf(const char *format, ...);
|
||||
void FCEU_DispMessage(const char *format, int disppos, ...);
|
||||
void FCEU_DispMessageOnMovie(const char *format, ...);
|
||||
void FCEU_TogglePPU();
|
||||
|
||||
void SetNESDeemph_OldHacky(uint8 d, int force);
|
||||
|
|
|
@ -33,7 +33,11 @@
|
|||
#include "utils/memory.h"
|
||||
#include "utils/md5.h"
|
||||
#ifdef _SYSTEM_MINIZIP
|
||||
#ifdef __linux
|
||||
#include <minizip/unzip.h>
|
||||
#else // Apple Most Likely
|
||||
#include <unzip.h>
|
||||
#endif
|
||||
#else
|
||||
#include "utils/unzip.h"
|
||||
#endif
|
||||
|
@ -260,7 +264,7 @@ zpfail:
|
|||
return 0;
|
||||
}
|
||||
|
||||
FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext, int index, const char** extensions, int* userCancel)
|
||||
FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, const char *mode, char *ext, int index, const char** extensions, int* userCancel)
|
||||
{
|
||||
FILE *ipsfile=0;
|
||||
FCEUFILE *fceufp=0;
|
||||
|
|
|
@ -122,7 +122,7 @@ struct ArchiveScanRecord
|
|||
};
|
||||
|
||||
|
||||
FCEUFILE *FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext, int index=-1, const char** extensions = 0, int* userCancel = 0);
|
||||
FCEUFILE *FCEU_fopen(const char *path, const char *ipsfn, const char *mode, char *ext, int index=-1, const char** extensions = 0, int* userCancel = 0);
|
||||
bool FCEU_isFileInArchive(const char *path);
|
||||
int FCEU_fclose(FCEUFILE*);
|
||||
uint64 FCEU_fread(void *ptr, size_t size, size_t nmemb, FCEUFILE*);
|
||||
|
|
|
@ -233,7 +233,7 @@ static void SetInput(void) {
|
|||
|
||||
struct BADINF {
|
||||
uint64 md5partial;
|
||||
char *name;
|
||||
const char *name;
|
||||
uint32 type;
|
||||
};
|
||||
|
||||
|
@ -417,7 +417,7 @@ static void CheckHInfo(void) {
|
|||
if (tofix & 1)
|
||||
sprintf(gigastr + strlen(gigastr), "The mapper number should be set to %d. ", MapperNo);
|
||||
if (tofix & 2) {
|
||||
char *mstr[3] = { "Horizontal", "Vertical", "Four-screen" };
|
||||
const char *mstr[3] = { "Horizontal", "Vertical", "Four-screen" };
|
||||
sprintf(gigastr + strlen(gigastr), "Mirroring should be set to \"%s\". ", mstr[Mirroring & 3]);
|
||||
}
|
||||
if (tofix & 4)
|
||||
|
@ -839,7 +839,7 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
|
|||
FCEU_printf("\n");
|
||||
}
|
||||
|
||||
char* mappername = "Not Listed";
|
||||
const char* mappername = "Not Listed";
|
||||
|
||||
for (int mappertest = 0; mappertest < (sizeof bmap / sizeof bmap[0]) - 1; mappertest++) {
|
||||
if (bmap[mappertest].number == MapperNo) {
|
||||
|
|
|
@ -270,7 +270,7 @@ void Mapper254_Init(CartInfo *);
|
|||
void Mapper406_Init(CartInfo *);
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
const char *name;
|
||||
int32 number;
|
||||
void (*init)(CartInfo *);
|
||||
} BMAPPINGLocal;
|
||||
|
|
|
@ -295,7 +295,7 @@ struct EMUCMDTABLE
|
|||
EMUCMDFN* fn_on;
|
||||
EMUCMDFN* fn_off;
|
||||
int state;
|
||||
char* name;
|
||||
const char* name;
|
||||
int flags; //EMUCMDFLAG
|
||||
};
|
||||
|
||||
|
|
|
@ -515,6 +515,7 @@ static int emu_getdir(lua_State *L) {
|
|||
|
||||
return 1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -545,6 +546,7 @@ static int emu_loadrom(lua_State *L) {
|
|||
return 1;
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -5227,7 +5229,7 @@ static int doPopup(lua_State *L, const char* deftype, const char* deficon) {
|
|||
return 1;
|
||||
#else
|
||||
|
||||
char *t;
|
||||
const char *t;
|
||||
#ifdef __linux
|
||||
|
||||
int pid; // appease compiler
|
||||
|
@ -5285,9 +5287,9 @@ static int doPopup(lua_State *L, const char* deftype, const char* deficon) {
|
|||
|
||||
// I'm gonna be dead in a matter of microseconds anyways, so wasted memory doesn't matter to me.
|
||||
// Go ahead and abuse strdup.
|
||||
char * parameters[] = {"xmessage", "-buttons", t, strdup(str), NULL};
|
||||
const char * parameters[] = {"xmessage", "-buttons", t, strdup(str), NULL};
|
||||
|
||||
execvp("xmessage", parameters);
|
||||
execvp("xmessage", (char* const*)parameters);
|
||||
|
||||
// Aw shitty
|
||||
perror("exec xmessage");
|
||||
|
|
|
@ -2000,7 +2000,7 @@ void ProcessSubtitles(void)
|
|||
}
|
||||
}
|
||||
|
||||
void FCEU_DisplaySubtitles(char *format, ...)
|
||||
void FCEU_DisplaySubtitles(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
|
|
@ -309,7 +309,7 @@ void FCEUI_ToggleInputDisplay(void);
|
|||
|
||||
void LoadSubtitles(MovieData &);
|
||||
void ProcessSubtitles(void);
|
||||
void FCEU_DisplaySubtitles(char *format, ...);
|
||||
void FCEU_DisplaySubtitles(const char *format, ...);
|
||||
|
||||
void poweron(bool shouldDisableBatteryLoading);
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ int NSFLoad(const char *name, FCEUFILE *fp)
|
|||
FCEU_printf(" Name: %s\n Artist: %s\n Copyright: %s\n\n",NSFHeader.SongName,NSFHeader.Artist,NSFHeader.Copyright);
|
||||
if(NSFHeader.SoundChip)
|
||||
{
|
||||
static char *tab[6]={"Konami VRCVI","Konami VRCVII","Nintendo FDS","Nintendo MMC5","Namco 106","Sunsoft FME-07"};
|
||||
static const char *tab[6]={"Konami VRCVI","Konami VRCVII","Nintendo FDS","Nintendo MMC5","Namco 106","Sunsoft FME-07"};
|
||||
|
||||
for(x=0;x<6;x++)
|
||||
if(NSFHeader.SoundChip&(1<<x))
|
||||
|
|
|
@ -1853,8 +1853,8 @@ int FCEUPPU_Loop(int skip) {
|
|||
|
||||
for (scanline = 0; scanline < totalscanlines; ) { //scanline is incremented in DoLine. Evil. :/
|
||||
deempcnt[deemp]++;
|
||||
if (scanline < 240)
|
||||
#ifdef WIN32
|
||||
if (scanline < 240)
|
||||
DEBUG(FCEUD_UpdatePPUView(scanline, 1));
|
||||
#endif
|
||||
DoLine();
|
||||
|
|
|
@ -848,7 +848,7 @@ void ResetExState(void (*PreSave)(void), void (*PostSave)(void))
|
|||
for(x=0;x<SFEXINDEX;x++)
|
||||
{
|
||||
if(SFMDATA[x].desc)
|
||||
free(SFMDATA[x].desc);
|
||||
free( (void*)SFMDATA[x].desc);
|
||||
}
|
||||
// adelikat, 3/14/09: had to add this to clear out the size parameter. NROM(mapper 0) games were having savestate crashes if loaded after a non NROM game because the size variable was carrying over and causing savestates to save too much data
|
||||
SFMDATA[0].s = 0;
|
||||
|
@ -858,7 +858,7 @@ void ResetExState(void (*PreSave)(void), void (*PostSave)(void))
|
|||
SFEXINDEX=0;
|
||||
}
|
||||
|
||||
void AddExState(void *v, uint32 s, int type, char *desc)
|
||||
void AddExState(void *v, uint32 s, int type, const char *desc)
|
||||
{
|
||||
if(s==~0)
|
||||
{
|
||||
|
@ -885,8 +885,8 @@ void AddExState(void *v, uint32 s, int type, char *desc)
|
|||
|
||||
if(desc)
|
||||
{
|
||||
SFMDATA[SFEXINDEX].desc=(char *)FCEU_malloc(strlen(desc)+1);
|
||||
strcpy(SFMDATA[SFEXINDEX].desc,desc);
|
||||
SFMDATA[SFEXINDEX].desc=(const char *)FCEU_malloc(strlen(desc)+1);
|
||||
strcpy( (char*)SFMDATA[SFEXINDEX].desc,desc);
|
||||
}
|
||||
else
|
||||
SFMDATA[SFEXINDEX].desc=0;
|
||||
|
|
|
@ -44,11 +44,11 @@ struct SFORMAT
|
|||
uint32 s;
|
||||
|
||||
//a string description of the element
|
||||
char *desc;
|
||||
const char *desc;
|
||||
};
|
||||
|
||||
void ResetExState(void (*PreSave)(void),void (*PostSave)(void));
|
||||
void AddExState(void *v, uint32 s, int type, char *desc);
|
||||
void AddExState(void *v, uint32 s, int type, const char *desc);
|
||||
|
||||
//indicates that the value is a multibyte integer that needs to be put in the correct byte order
|
||||
#define FCEUSTATE_RLSB 0x80000000
|
||||
|
|
10
src/unif.cpp
10
src/unif.cpp
|
@ -45,13 +45,13 @@ typedef struct {
|
|||
} UNIF_HEADER;
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
const char *name;
|
||||
void (*init)(CartInfo *);
|
||||
int flags;
|
||||
} BMAPPING;
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
const char *name;
|
||||
int (*init)(FCEUFILE *fp);
|
||||
} BFMAPPING;
|
||||
|
||||
|
@ -129,7 +129,7 @@ static int DoMirroring(FCEUFILE *fp) {
|
|||
return(0);
|
||||
mirrortodo = t;
|
||||
{
|
||||
static char *stuffo[6] = { "Horizontal", "Vertical", "$2000", "$2400", "\"Four-screen\"", "Controlled by Mapper Hardware" };
|
||||
static const char *stuffo[6] = { "Horizontal", "Vertical", "$2000", "$2400", "\"Four-screen\"", "Controlled by Mapper Hardware" };
|
||||
if (t < 6)
|
||||
FCEU_printf(" Name/Attribute Table Mirroring: %s\n", stuffo[t]);
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ static int DINF(FCEUFILE *fp) {
|
|||
FCEU_printf(" Dumped by: %s\n", name);
|
||||
FCEU_printf(" Dumped with: %s\n", method);
|
||||
{
|
||||
char *months[12] = {
|
||||
const char *months[12] = {
|
||||
"January", "February", "March", "April", "May", "June", "July",
|
||||
"August", "September", "October", "November", "December"
|
||||
};
|
||||
|
@ -232,7 +232,7 @@ static int TVCI(FCEUFILE *fp) {
|
|||
if ((t = FCEU_fgetc(fp)) == EOF)
|
||||
return(0);
|
||||
if (t <= 2) {
|
||||
char *stuffo[3] = { "NTSC", "PAL", "NTSC and PAL" };
|
||||
const char *stuffo[3] = { "NTSC", "PAL", "NTSC and PAL" };
|
||||
if (t == 0) {
|
||||
GameInfo->vidsys = GIV_NTSC;
|
||||
FCEUI_SetVidSystem(0);
|
||||
|
|
|
@ -157,7 +157,7 @@ int chr_replace(char *str, char search, char replace) {
|
|||
|
||||
///Replaces all instances of 'search' with 'replace'
|
||||
///Returns number of sub-strings modified, or -1 on error
|
||||
int str_replace(char *str, char *search, char *replace) {
|
||||
int str_replace(char *str, const char *search, const char *replace) {
|
||||
unsigned int i=0,j=0; //mbg merge 7/17/06 changed to unsigned int
|
||||
int searchlen,replacelen;
|
||||
char *astr;
|
||||
|
|
|
@ -43,7 +43,7 @@ int str_ltrim(char *str, int flags);
|
|||
int str_rtrim(char *str, int flags);
|
||||
int str_strip(char *str, int flags);
|
||||
int chr_replace(char *str, char search, char replace);
|
||||
int str_replace(char *str, char *search, char *replace);
|
||||
int str_replace(char *str, const char *search, const char *replace);
|
||||
|
||||
int HexStringToBytesLength(const std::string& str);
|
||||
int Base64StringToBytesLength(const std::string& str);
|
||||
|
@ -129,4 +129,4 @@ std::string wcstombs(std::wstring str);
|
|||
std::string getExtension(const char* input);
|
||||
|
||||
std::string StripExtension(std::string filename);
|
||||
std::string StripPath(std::string filename);
|
||||
std::string StripPath(std::string filename);
|
||||
|
|
|
@ -398,7 +398,7 @@ void snapAVI()
|
|||
FCEUI_AviVideoUpdate(XBuf);
|
||||
}
|
||||
|
||||
void FCEU_DispMessageOnMovie(char *format, ...)
|
||||
void FCEU_DispMessageOnMovie(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
@ -414,7 +414,7 @@ void FCEU_DispMessageOnMovie(char *format, ...)
|
|||
guiMessage.howlong = 0;
|
||||
}
|
||||
|
||||
void FCEU_DispMessage(char *format, int disppos=0, ...)
|
||||
void FCEU_DispMessage(const char *format, int disppos=0, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
@ -455,7 +455,7 @@ void FCEU_ResetMessages()
|
|||
}
|
||||
|
||||
|
||||
static int WritePNGChunk(FILE *fp, uint32 size, char *type, uint8 *data)
|
||||
static int WritePNGChunk(FILE *fp, uint32 size, const char *type, uint8 *data)
|
||||
{
|
||||
uint32 crc;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
#define IOPTION_PREDIP 0x10
|
||||
typedef struct {
|
||||
char *name;
|
||||
const char *name;
|
||||
uint64 md5partial;
|
||||
int mapper;
|
||||
int mirroring;
|
||||
|
|
Loading…
Reference in New Issue