Compare commits
No commits in common. "master" and "interim-build" have entirely different histories.
master
...
interim-bu
|
@ -1,4 +1,3 @@
|
|||
build
|
||||
/vc/defaultconfig/scmrev.h
|
||||
/vc/.vs
|
||||
/vc/vc14_bin_Debug
|
||||
|
@ -18,7 +17,6 @@ build
|
|||
/output/auxlib.lua
|
||||
/output/fceux.pdb
|
||||
/output/7z.dll
|
||||
/output/7z_64.dll
|
||||
/output/fceux.exe
|
||||
/output/fceux.exp
|
||||
/output/fceux.lib
|
||||
|
@ -29,9 +27,6 @@ build
|
|||
/vc/fceux.zip
|
||||
/vc/fceux64.zip
|
||||
|
||||
# macOS junk
|
||||
.DS_Store
|
||||
|
||||
# linux build output
|
||||
bin
|
||||
src/fceux
|
||||
|
|
5
README
5
README
|
@ -5,9 +5,9 @@ Updated By mjbudd77
|
|||
|
||||
[NOTE: This only applies to Qt/SDL builds]
|
||||
|
||||
https://fceux.com
|
||||
http://www.fceux.com
|
||||
|
||||
Last Modified: April 30, 2023
|
||||
Last Modified: March 24, 2022
|
||||
|
||||
Table of Contents
|
||||
-----------------
|
||||
|
@ -32,7 +32,6 @@ Table of Contents
|
|||
* libx265 (optional) - H.265 video encoder for avi recording (recommended)
|
||||
* ffmpeg libraries (optional) - for avi recording (recommended)
|
||||
* - ffmpeg libraries used: libavcodec libavformat libavutil libswresample libswscale
|
||||
* libarchive (optional) - for 7zip archive support (test with version 3.4.0)
|
||||
* minizip
|
||||
* zlib
|
||||
* openGL
|
||||
|
|
|
@ -14,9 +14,10 @@ environment:
|
|||
|
||||
- job_name: Ubuntu
|
||||
appveyor_build_worker_image: Ubuntu2004
|
||||
#appveyor_build_worker_image: Ubuntu1804
|
||||
|
||||
- job_name: MacOS
|
||||
appveyor_build_worker_image: macos-ventura
|
||||
appveyor_build_worker_image: macOS
|
||||
|
||||
for:
|
||||
|
||||
|
@ -26,7 +27,7 @@ for:
|
|||
- job_name: Windows 32
|
||||
|
||||
build_script:
|
||||
- cmd: pipelines/WinAppveyorBuild.bat win32
|
||||
- cmd: perl pipelines/build.pl win32
|
||||
|
||||
-
|
||||
matrix:
|
||||
|
@ -34,7 +35,7 @@ for:
|
|||
- job_name: Windows 64
|
||||
|
||||
build_script:
|
||||
- cmd: pipelines/WinAppveyorBuild.bat win64
|
||||
- cmd: perl pipelines/build.pl win64
|
||||
|
||||
-
|
||||
matrix:
|
||||
|
@ -42,7 +43,7 @@ for:
|
|||
- job_name: Win64 Qt
|
||||
|
||||
build_script:
|
||||
- cmd: pipelines/WinAppveyorBuild.bat win64-QtSDL
|
||||
- cmd: perl pipelines/build.pl win64-QtSDL
|
||||
|
||||
-
|
||||
matrix:
|
||||
|
|
BIN
output/fceux.chm
BIN
output/fceux.chm
Binary file not shown.
|
@ -1,11 +0,0 @@
|
|||
|
||||
set PROJECT_ROOT=%~dp0..
|
||||
set PERL=C:\Strawberry\perl\bin\perl.exe
|
||||
set JOB=%1
|
||||
|
||||
echo %PERL%
|
||||
echo %JOB%
|
||||
|
||||
%PERL% pipelines\build.pl %JOB%
|
||||
|
||||
if %ERRORLEVEL% NEQ 0 EXIT /B 1
|
|
@ -61,13 +61,6 @@ echo '****************************************'
|
|||
sudo apt-get --assume-yes install libminizip-dev
|
||||
pkg-config --cflags --libs minizip
|
||||
|
||||
# Install libarchive-dev
|
||||
echo '****************************************'
|
||||
echo 'Install Dependency libarchive-dev'
|
||||
echo '****************************************'
|
||||
sudo apt-get --assume-yes install libarchive-dev
|
||||
pkg-config --cflags --libs libarchive
|
||||
|
||||
# GTK+-2 is no longer needed
|
||||
#sudo apt-get install libgtk2.0-dev
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ env
|
|||
|
||||
SCRIPT_DIR=$( cd $(dirname $BASH_SOURCE[0]); pwd );
|
||||
|
||||
QT_MAJOR=6;
|
||||
QT_MAJOR=5;
|
||||
QT_PKGNAME=qt$QT_MAJOR;
|
||||
FCEUX_VERSION_MAJOR=`perl $SCRIPT_DIR/../scripts/fceuVersion.pl -major`;
|
||||
FCEUX_VERSION_MINOR=`perl $SCRIPT_DIR/../scripts/fceuVersion.pl -minor`;
|
||||
|
@ -70,12 +70,6 @@ echo 'Install Dependency minizip'
|
|||
echo '****************************************'
|
||||
brew install minizip
|
||||
|
||||
echo '****************************************'
|
||||
echo 'Install Optional Dependency libarchive'
|
||||
echo '****************************************'
|
||||
brew install libarchive
|
||||
LIBARCHIVE_PATH=`brew --prefix libarchive`;
|
||||
|
||||
echo '****************************************'
|
||||
echo 'Install Optional Dependency x264'
|
||||
echo '****************************************'
|
||||
|
@ -93,7 +87,7 @@ brew install ffmpeg
|
|||
|
||||
#brew install zlib # Already installed in appveyor macOS
|
||||
|
||||
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:$LIBARCHIVE_PATH/lib/pkgconfig:
|
||||
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:
|
||||
|
||||
ls -ltr $HOME/Qt;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ set PROJECT_ROOT=%~dp0..
|
|||
set CWD=%CD%
|
||||
|
||||
call "C:\Qt\5.15\msvc2019_64\bin\qtenv2.bat"
|
||||
REM call "C:\Qt\6.5\msvc2019_64\bin\qtenv2.bat"
|
||||
REM call "C:\Qt\6.0\msvc2019_64\bin\qtenv2.bat"
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||
|
||||
cd /d %CWD%
|
||||
|
@ -22,46 +22,34 @@ mkdir build
|
|||
cd build
|
||||
mkdir bin
|
||||
|
||||
set SDL_VERSION=2.24.1
|
||||
set FFMPEG_VERSION=5.1.2
|
||||
set LIBARCHIVE_VERSION=3.6.2
|
||||
|
||||
curl -s -LO https://github.com/libsdl-org/SDL/releases/download/release-%SDL_VERSION%/SDL2-devel-%SDL_VERSION%-VC.zip
|
||||
curl -s -LO https://github.com/GyanD/codexffmpeg/releases/download/%FFMPEG_VERSION%/ffmpeg-%FFMPEG_VERSION%-full_build-shared.zip
|
||||
curl -s -LO https://www.libarchive.org/downloads/libarchive-v%LIBARCHIVE_VERSION%-amd64.zip
|
||||
curl -s -LO http://www.libsdl.org/release/SDL2-devel-2.0.20-VC.zip
|
||||
curl -s -LO https://github.com/GyanD/codexffmpeg/releases/download/5.0/ffmpeg-5.0-full_build-shared.zip
|
||||
|
||||
REM rmdir /q /s SDL2
|
||||
|
||||
powershell -command "Expand-Archive" SDL2-devel-%SDL_VERSION%-VC.zip .
|
||||
powershell -command "Expand-Archive" ffmpeg-%FFMPEG_VERSION%-full_build-shared.zip
|
||||
powershell -command "Expand-Archive" libarchive-v%LIBARCHIVE_VERSION%-amd64.zip
|
||||
powershell -command "Expand-Archive" SDL2-devel-2.0.20-VC.zip .
|
||||
powershell -command "Expand-Archive" ffmpeg-5.0-full_build-shared.zip
|
||||
|
||||
rename SDL2-%SDL_VERSION% SDL2
|
||||
move ffmpeg-%FFMPEG_VERSION%-full_build-shared\ffmpeg-%FFMPEG_VERSION%-full_build-shared ffmpeg
|
||||
rmdir ffmpeg-%FFMPEG_VERSION%-full_build-shared
|
||||
del ffmpeg-%FFMPEG_VERSION%-full_build-shared.zip
|
||||
move libarchive-v%LIBARCHIVE_VERSION%-amd64\libarchive libarchive
|
||||
rename SDL2-2.0.20 SDL2
|
||||
move ffmpeg-5.0-full_build-shared\ffmpeg-5.0-full_build-shared ffmpeg
|
||||
rmdir ffmpeg-5.0-full_build-shared
|
||||
del ffmpeg-5.0-full_build-shared.zip
|
||||
|
||||
set SDL_INSTALL_PREFIX=%CD%
|
||||
set FFMPEG_INSTALL_PREFIX=%CD%
|
||||
set LIBARCHIVE_INSTALL_PREFIX=%CD%
|
||||
set PUBLIC_RELEASE=0
|
||||
IF DEFINED FCEU_RELEASE_VERSION (set PUBLIC_RELEASE=1)
|
||||
|
||||
REM cmake -h
|
||||
REM cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DSDL_INSTALL_PREFIX=%SDL_INSTALL_PREFIX% ..
|
||||
cmake -DQT=5 -DPUBLIC_RELEASE=%PUBLIC_RELEASE% -DSDL_INSTALL_PREFIX=%SDL_INSTALL_PREFIX% -DLIBARCHIVE_INSTALL_PREFIX=%LIBARCHIVE_INSTALL_PREFIX% -DUSE_LIBAV=1 -DFFMPEG_INSTALL_PREFIX=%FFMPEG_INSTALL_PREFIX% -G"Visual Studio 16" -T"v142" ..
|
||||
cmake -DQT6=0 -DPUBLIC_RELEASE=%PUBLIC_RELEASE% -DSDL_INSTALL_PREFIX=%SDL_INSTALL_PREFIX% -DUSE_LIBAV=1 -DFFMPEG_INSTALL_PREFIX=%FFMPEG_INSTALL_PREFIX% -G"Visual Studio 16" -T"v142" ..
|
||||
|
||||
REM nmake
|
||||
msbuild /m fceux.sln /p:Configuration=Release
|
||||
if %ERRORLEVEL% NEQ 0 EXIT /B 1
|
||||
@if ERRORLEVEL 1 goto end
|
||||
|
||||
copy src\Release\fceux.exe bin\qfceux.exe
|
||||
copy %PROJECT_ROOT%\src\auxlib.lua bin\.
|
||||
copy %PROJECT_ROOT%\src\drivers\win\lua\x64\lua51.dll bin\.
|
||||
copy %PROJECT_ROOT%\src\drivers\win\lua\x64\lua5.1.dll bin\.
|
||||
copy %SDL_INSTALL_PREFIX%\SDL2\lib\x64\SDL2.dll bin\.
|
||||
copy %LIBARCHIVE_INSTALL_PREFIX%\libarchive\bin\archive.dll bin\.
|
||||
copy %FFMPEG_INSTALL_PREFIX%\ffmpeg\bin\*.dll bin\.
|
||||
|
||||
windeployqt --no-compiler-runtime bin\qfceux.exe
|
||||
|
@ -76,16 +64,16 @@ dir bin
|
|||
|
||||
REM Create Zip Archive
|
||||
%PROJECT_ROOT%\vc\zip -X -9 -r %PROJECT_ROOT%\vc\%ZIP_FILENAME% bin
|
||||
if %ERRORLEVEL% NEQ 0 EXIT /B 1
|
||||
@if ERRORLEVEL 1 goto end
|
||||
|
||||
cd %PROJECT_ROOT%\output
|
||||
%PROJECT_ROOT%\vc\zip -X -9 -u -r %PROJECT_ROOT%\vc\%ZIP_FILENAME% palettes luaScripts tools
|
||||
if %ERRORLEVEL% NEQ 0 EXIT /B 1
|
||||
@if ERRORLEVEL 1 goto end
|
||||
|
||||
mkdir doc
|
||||
copy *.chm doc\.
|
||||
%PROJECT_ROOT%\vc\zip -X -9 -u -r %PROJECT_ROOT%\vc\%ZIP_FILENAME% doc
|
||||
if %ERRORLEVEL% NEQ 0 EXIT /B 1
|
||||
@if ERRORLEVEL 1 goto end
|
||||
|
||||
cd %PROJECT_ROOT%
|
||||
|
||||
|
|
|
@ -10,14 +10,14 @@ set DEPLOY_GROUP=master
|
|||
IF DEFINED APPVEYOR_REPO_TAG_NAME set DEPLOY_GROUP=%APPVEYOR_REPO_TAG_NAME%
|
||||
|
||||
msbuild %PROJECT_ROOT%\vc\vc14_fceux.vcxproj /p:Configuration=%BUILD_CONFIG% /p:Platform="Win32"
|
||||
if %ERRORLEVEL% NEQ 0 EXIT /B 1
|
||||
@if ERRORLEVEL 1 goto end
|
||||
|
||||
cd %PROJECT_ROOT%\vc
|
||||
|
||||
REM Create Zip Archive
|
||||
cd %PROJECT_ROOT%\output
|
||||
..\vc\zip -X -9 -r ..\vc\%ZIP_FILENAME% fceux.exe fceux.chm taseditor.chm lua5.1.dll lua51.dll 7z.dll auxlib.lua palettes luaScripts tools
|
||||
if %ERRORLEVEL% NEQ 0 EXIT /B 1
|
||||
@if ERRORLEVEL 1 goto end
|
||||
|
||||
cd %PROJECT_ROOT%
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ set DEPLOY_GROUP=master
|
|||
IF DEFINED APPVEYOR_REPO_TAG_NAME set DEPLOY_GROUP=%APPVEYOR_REPO_TAG_NAME%
|
||||
|
||||
msbuild %PROJECT_ROOT%\vc\vc14_fceux.vcxproj /p:Configuration=%BUILD_CONFIG% /p:Platform="x64"
|
||||
if %ERRORLEVEL% NEQ 0 EXIT /B 1
|
||||
@if ERRORLEVEL 1 goto end
|
||||
|
||||
cd %PROJECT_ROOT%\vc
|
||||
|
||||
|
@ -18,9 +18,9 @@ REM Create Zip Archive
|
|||
|
||||
cd %PROJECT_ROOT%\output
|
||||
..\vc\zip -X -9 -j ..\vc\%ZIP_FILENAME% ..\vc\x64\%BUILD_CONFIG%\fceux64.exe ..\src\drivers\win\lua\x64\lua5.1.dll ..\src\drivers\win\lua\x64\lua51.dll ..\src\auxlib.lua ..\src\drivers\win\7z_64.dll
|
||||
if %ERRORLEVEL% NEQ 0 EXIT /B 1
|
||||
@if ERRORLEVEL 1 goto end
|
||||
..\vc\zip -X -9 -u -r ..\vc\%ZIP_FILENAME% fceux.chm taseditor.chm palettes luaScripts tools
|
||||
if %ERRORLEVEL% NEQ 0 EXIT /B 1
|
||||
@if ERRORLEVEL 1 goto end
|
||||
|
||||
cd %PROJECT_ROOT%
|
||||
|
||||
|
|
12
readme.md
12
readme.md
|
@ -5,11 +5,11 @@ An open source NES Emulator for Windows and Unix that features solid emulation a
|
|||
## Builds and Releases
|
||||
|
||||
Interim builds:
|
||||
* Win32: [fceux-win32.zip](https://github.com/TASEmulators/fceux/releases/download/interim-build/fceux-win32.zip)
|
||||
* Win64: [fceux-win64.zip](https://github.com/TASEmulators/fceux/releases/download/interim-build/fceux-win64.zip)
|
||||
* Win64 Qt/SDL: [fceux-win64-QtSDL.zip](https://github.com/TASEmulators/fceux/releases/download/interim-build/fceux-win64-QtSDL.zip)
|
||||
* Ubuntu: [fceux-ubuntu-x64.deb](https://github.com/TASEmulators/fceux/releases/download/interim-build/fceux-ubuntu-x64.deb)
|
||||
* MacOSX: [fceux-Darwin.dmg](https://github.com/TASEmulators/fceux/releases/download/interim-build/fceux-Darwin.dmg)
|
||||
* Win32: [fceux.zip](https://ci.appveyor.com/api/projects/zeromus/fceux/artifacts/fceux.zip?branch=master&job=Windows%2032)
|
||||
* Win64: [fceux64.zip](https://ci.appveyor.com/api/projects/zeromus/fceux/artifacts/fceux64.zip?branch=master&job=Windows%2064)
|
||||
* Win64 Qt/SDL: [qfceux64.zip](https://ci.appveyor.com/api/projects/zeromus/fceux/artifacts/qfceux64.zip?branch=master&job=Win64%20Qt)
|
||||
* Ubuntu: [fceux-2.6.4-amd64.deb](https://ci.appveyor.com/api/projects/zeromus/fceux/artifacts/fceux-2.6.4-amd64.deb?branch=master&job=Ubuntu)
|
||||
* MacOSX: [fceux-2.6.4-Darwin.dmg](https://ci.appveyor.com/api/projects/zeromus/fceux/artifacts/fceux-2.6.4-Darwin.dmg?branch=master&job=MacOS)
|
||||
* Status: [Appveyor](https://ci.appveyor.com/project/zeromus/fceux/)
|
||||
|
||||
But you might like mesen more: https://github.com/SourMesen/Mesen
|
||||
|
@ -18,4 +18,4 @@ You should get releases from here: https://sourceforge.net/projects/fceultra/fil
|
|||
|
||||
That's because github forces us to use tags we don't have for releases.
|
||||
|
||||
2.6.6 is the most recent release but most people are using the autobuilds.
|
||||
2.6.4 is the most recent release but most people are using the autobuilds.
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
|
||||
my $i; my $findResult;
|
||||
my $exe = "fceux";
|
||||
|
||||
$findResult = `find . -name fceux`;
|
||||
|
||||
if ( $findResult ne "")
|
||||
{
|
||||
$findResult =~ s/\n.*//;
|
||||
$exe=$findResult;
|
||||
}
|
||||
print "Executable: $exe\n";
|
||||
|
||||
my $gdbCmdFile = "/tmp/gdbCmdFile";
|
||||
open CMD_FILE, ">$gdbCmdFile" or die "Error: Could not open file: $gdbCmdFile\n";
|
||||
print CMD_FILE "run\n";
|
||||
print CMD_FILE "list\n";
|
||||
print CMD_FILE "backtrace\n";
|
||||
close(CMD_FILE);
|
||||
|
||||
system("gdb -x $gdbCmdFile $exe");
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
PROJECT_ROOT=$( cd "$(dirname ${BASH_SOURCE[0]})"/.. && pwd )
|
||||
echo $PROJECT_ROOT;
|
||||
|
||||
SRC_DIR=$PROJECT_ROOT/src
|
||||
|
||||
cd $SRC_DIR;
|
||||
|
||||
cppcheck --version
|
||||
|
||||
IGNORE_DIRS=" -i ./attic "
|
||||
IGNORE_DIRS+="-i ./drivers/sdl "
|
||||
#IGNORE_DIRS+="-i ./drivers/win "
|
||||
|
||||
cppcheck --force $IGNORE_DIRS .
|
|
@ -10,114 +10,29 @@ if (${PUBLIC_RELEASE})
|
|||
endif()
|
||||
|
||||
if ( ${QT6} )
|
||||
set( QT 6 )
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED QT)
|
||||
message( STATUS "Attempting to determine Qt Version...")
|
||||
find_package( Qt6 COMPONENTS Core QUIET)
|
||||
|
||||
if (${Qt6Core_FOUND})
|
||||
message( STATUS "Found Qt Version: ${Qt6Core_VERSION}")
|
||||
set( QT 6 )
|
||||
else()
|
||||
find_package( Qt5 COMPONENTS Core QUIET)
|
||||
|
||||
if (${Qt5Core_FOUND})
|
||||
message( STATUS "Found Qt Version: ${Qt5Core_VERSION}")
|
||||
set( QT 5 )
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if ( ${FCEU_PROFILER_ENABLE} )
|
||||
message( STATUS "FCEU Profiler Enabled")
|
||||
add_definitions( -D__FCEU_PROFILER_ENABLE__ )
|
||||
endif()
|
||||
|
||||
if ( ${QT} EQUAL 6 )
|
||||
message( STATUS "GUI Frontend: Qt6")
|
||||
set( Qt Qt6 )
|
||||
find_package( Qt6 REQUIRED COMPONENTS Widgets OpenGL OpenGLWidgets)
|
||||
find_package( Qt6 REQUIRED COMPONENTS Network)
|
||||
find_package( Qt6 COMPONENTS Help QUIET)
|
||||
find_package( Qt6 COMPONENTS Qml)
|
||||
find_package( Qt6 COMPONENTS UiTools)
|
||||
add_definitions( ${Qt6Widgets_DEFINITIONS} ${Qt6Qml_DEFINITIONS} ${Qt6Network_DEFINITIONS} ${Qt6Help_DEFINITIONS} ${Qt6OpenGLWidgets_DEFINITIONS} )
|
||||
# add_definitions(${Qt6UiTools_DEFINITIONS}) # Leave ${Qt6UiTools_DEFINITIONS} out as this is causing a build error
|
||||
include_directories( ${Qt6Widgets_INCLUDE_DIRS} ${Qt6Qml_INCLUDE_DIRS} ${Qt6UiTools_INCLUDE_DIRS} ${Qt6Network_INCLUDE_DIRS} ${Qt6Help_INCLUDE_DIRS} ${Qt6OpenGLWidgets_INCLUDE_DIRS} )
|
||||
|
||||
if (${Qt6Help_FOUND})
|
||||
message( STATUS "Qt6 Help Module Found")
|
||||
if (${QHELP})
|
||||
add_definitions( -D_USE_QHELP )
|
||||
endif()
|
||||
else()
|
||||
message( STATUS "Qt6 Help Module Not Found")
|
||||
endif()
|
||||
|
||||
if (${Qt6Network_FOUND})
|
||||
message( STATUS "Qt6 Network Module Found")
|
||||
add_definitions( -D__FCEU_QNETWORK_ENABLE__ )
|
||||
else()
|
||||
message( STATUS "Qt6 Network Module Not Found")
|
||||
endif()
|
||||
|
||||
if (${Qt6Qml_FOUND})
|
||||
message( STATUS "Qt6 Qml Module Found")
|
||||
add_definitions( -D__FCEU_QSCRIPT_ENABLE__ )
|
||||
else()
|
||||
message( STATUS "Qt6 Qml Module Not Found")
|
||||
endif()
|
||||
|
||||
if (${Qt6UiTools_FOUND})
|
||||
message( STATUS "Qt6 UiTools Module Found")
|
||||
add_definitions( -D__QT_UI_TOOLS__ )
|
||||
else()
|
||||
message( STATUS "Qt6 UiTools Module Not Found")
|
||||
endif()
|
||||
else()
|
||||
message( STATUS "GUI Frontend: Qt5")
|
||||
set( Qt Qt5 )
|
||||
find_package( Qt5 REQUIRED COMPONENTS Widgets OpenGL)
|
||||
find_package( Qt5 COMPONENTS Help QUIET)
|
||||
find_package( Qt5 COMPONENTS Network)
|
||||
find_package( Qt5 COMPONENTS Qml)
|
||||
find_package( Qt5 COMPONENTS UiTools)
|
||||
add_definitions( ${Qt5Widgets_DEFINITIONS} ${Qt5Qml_DEFINITIONS} ${Qt5UiTools_DEFINITIONS} ${Qt5Network_DEFINITIONS} ${Qt5Help_DEFINITIONS} )
|
||||
include_directories( ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Qml_INCLUDE_DIRS} ${Qt5UiTools_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} ${Qt5Help_INCLUDE_DIRS} )
|
||||
|
||||
if (${Qt5Help_FOUND})
|
||||
message( STATUS "Qt5 Help Module Found")
|
||||
if (${QHELP})
|
||||
add_definitions( -D_USE_QHELP )
|
||||
endif()
|
||||
else()
|
||||
message( STATUS "Qt5 Help Module Not Found")
|
||||
endif()
|
||||
|
||||
if (${Qt5Network_FOUND})
|
||||
message( STATUS "Qt5 Network Module Found")
|
||||
add_definitions( -D__FCEU_NETWORK_ENABLE__ )
|
||||
else()
|
||||
message( STATUS "Qt5 Network Module Not Found")
|
||||
endif()
|
||||
|
||||
if (${Qt5Qml_FOUND})
|
||||
message( STATUS "Qt5 Qml Module Found")
|
||||
add_definitions( -D__FCEU_QSCRIPT_ENABLE__ )
|
||||
else()
|
||||
message( STATUS "Qt5 Qml Module Not Found")
|
||||
endif()
|
||||
|
||||
if (${Qt5UiTools_FOUND})
|
||||
message( STATUS "Qt5 UiTools Module Found")
|
||||
add_definitions( -D__QT_UI_TOOLS__ )
|
||||
else()
|
||||
message( STATUS "Qt5 UiTools Module Not Found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if ( ${QHELP} )
|
||||
set(QtHelpModule Help)
|
||||
add_definitions( -D_USE_QHELP )
|
||||
endif()
|
||||
|
||||
if ( ${QT6} )
|
||||
find_package( Qt6 REQUIRED COMPONENTS Widgets OpenGL OpenGLWidgets ${QtHelpModule})
|
||||
add_definitions( ${Qt6Widgets_DEFINITIONS} ${Qt6Help_DEFINITIONS} ${Qt6OpenGLWidgets_DEFINITIONS} )
|
||||
include_directories( ${Qt6Widgets_INCLUDE_DIRS} ${Qt6Help_INCLUDE_DIRS} ${Qt6OpenGLWidgets_INCLUDE_DIRS} )
|
||||
else()
|
||||
find_package( Qt5 REQUIRED COMPONENTS Widgets OpenGL ${QtHelpModule})
|
||||
add_definitions( ${Qt5Widgets_DEFINITIONS} ${Qt5Help_DEFINITIONS} )
|
||||
include_directories( ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Help_INCLUDE_DIRS} )
|
||||
endif()
|
||||
|
||||
|
||||
if(WIN32)
|
||||
find_package(OpenGL REQUIRED)
|
||||
#find_package(Qt5 COMPONENTS Widgets OpenGL REQUIRED)
|
||||
|
@ -126,15 +41,10 @@ if(WIN32)
|
|||
add_definitions( -DMSVC -D_CRT_SECURE_NO_WARNINGS )
|
||||
add_definitions( -D__SDL__ -D__QT_DRIVER__ -DQT_DEPRECATED_WARNINGS )
|
||||
add_definitions( -DFCEUDEF_DEBUGGER )
|
||||
add_definitions( -D_USE_LIBARCHIVE )
|
||||
add_definitions( /wd4267 /wd4244 )
|
||||
#add_definitions( /wd4018 ) # Integer comparison sign mismatch warnings
|
||||
include_directories( ${SDL_INSTALL_PREFIX}/SDL2/include )
|
||||
include_directories( ${LIBARCHIVE_INSTALL_PREFIX}/libarchive/include )
|
||||
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/drivers/win/zlib )
|
||||
set( OPENGL_LDFLAGS OpenGL::GL )
|
||||
set( SDL2_LDFLAGS ${SDL_INSTALL_PREFIX}/SDL2/lib/x64/SDL2.lib )
|
||||
set( LIBARCHIVE_LDFLAGS ${LIBARCHIVE_INSTALL_PREFIX}/libarchive/lib/archive.lib )
|
||||
set( SYS_LIBS wsock32 ws2_32 vfw32 Htmlhelp )
|
||||
set(APP_ICON_RESOURCES_WINDOWS ${CMAKE_SOURCE_DIR}/icons/fceux.rc )
|
||||
|
||||
|
@ -166,8 +76,7 @@ else(WIN32)
|
|||
find_package(OpenGL REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
add_definitions( -Wall -Wno-write-strings -Wno-parentheses -Wno-unused-local-typedefs -fPIC )
|
||||
#add_definitions( -Wno-sign-compare ) # Integer comparison sign mismatch warnings
|
||||
add_definitions( -Wall -Wno-write-strings -Wno-sign-compare -Wno-parentheses -Wno-unused-local-typedefs -fPIC )
|
||||
add_definitions( -DFCEUDEF_DEBUGGER )
|
||||
|
||||
#if ( ${QT6} )
|
||||
|
@ -181,12 +90,6 @@ else(WIN32)
|
|||
#endif()
|
||||
add_definitions( -D__QT_DRIVER__ -DQT_DEPRECATED_WARNINGS )
|
||||
|
||||
if ( ${GPROF_ENABLE} )
|
||||
add_definitions( -pg )
|
||||
set( GPROF_LDFLAGS -pg )
|
||||
message( STATUS "GNU Profiling Enabled" )
|
||||
endif()
|
||||
|
||||
if ( ${ASAN_ENABLE} )
|
||||
add_definitions( -fsanitize=address -fsanitize=bounds-strict )
|
||||
add_definitions( -fsanitize=undefined -fno-sanitize=vptr )
|
||||
|
@ -204,13 +107,6 @@ else(WIN32)
|
|||
add_definitions( -D_SYSTEM_MINIZIP ${MINIZIP_CFLAGS} )
|
||||
endif()
|
||||
|
||||
pkg_check_modules( LIBARCHIVE libarchive)
|
||||
|
||||
if ( ${LIBARCHIVE_FOUND} )
|
||||
message( STATUS "Using System Libarchive Library ${LIBARCHIVE_VERSION}" )
|
||||
add_definitions( -D_USE_LIBARCHIVE ${LIBARCHIVE_CFLAGS} )
|
||||
endif()
|
||||
|
||||
pkg_check_modules( X264 x264)
|
||||
|
||||
if ( ${X264_FOUND} )
|
||||
|
@ -364,6 +260,14 @@ endif()
|
|||
include_directories( ${CMAKE_SOURCE_DIR}/src )
|
||||
include_directories( ${CMAKE_SOURCE_DIR}/src/drivers )
|
||||
|
||||
if(APPLE)
|
||||
add_definitions( -DPSS_STYLE=1 )
|
||||
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
|
||||
|
@ -371,7 +275,6 @@ set(SRC_CORE
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/conddebug.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/config.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/debug.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/debugsymboltable.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drawing.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fceu.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fds.cpp
|
||||
|
@ -380,13 +283,11 @@ set(SRC_CORE
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/filter.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ines.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ld65dbg.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}/profiler.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ppu.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sound.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/state.cpp
|
||||
|
@ -408,6 +309,7 @@ set(SRC_CORE
|
|||
${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
|
||||
|
@ -444,11 +346,7 @@ set(SRC_CORE
|
|||
${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/354.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/413.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/471.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/451.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/36.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
|
||||
|
@ -498,7 +396,6 @@ set(SRC_CORE
|
|||
${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/coolgirl.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/dance2000.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/datalatch.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/dream.cpp
|
||||
|
@ -570,7 +467,6 @@ set(SRC_CORE
|
|||
${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}/boards/inx007t.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/arkanoid.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/bworld.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/input/cursor.cpp
|
||||
|
@ -599,14 +495,13 @@ set(SRC_CORE
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/utils/guid.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/md5.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/memory.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/mutex.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/timeStamp.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
|
||||
|
@ -623,8 +518,6 @@ set(SRC_DRIVERS_SDL
|
|||
${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/ConsoleViewerQWidget.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleViewerInterface.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/InputConf.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/GamePadConf.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/FamilyKeyboard.cpp
|
||||
|
@ -650,9 +543,7 @@ set(SRC_DRIVERS_SDL
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleUtilities.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleVideoConf.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleSoundConf.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/StateRecorderConf.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/iNesHeaderEditor.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/QtScriptManager.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/SplashScreen.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/TraceLogger.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/AboutWindow.cpp
|
||||
|
@ -670,7 +561,6 @@ set(SRC_DRIVERS_SDL
|
|||
${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
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/NetPlay.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/AviRecord.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/AviRiffViewer.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/avi/avi-utils.cpp
|
||||
|
@ -737,18 +627,14 @@ add_executable( ${APP_NAME} ${SOURCES} ../resources.qrc
|
|||
${CMAKE_CURRENT_BINARY_DIR}/fceux_git_info.cpp)
|
||||
endif()
|
||||
|
||||
target_link_libraries( ${APP_NAME}
|
||||
${ASAN_LDFLAGS} ${GPROF_LDFLAGS}
|
||||
target_link_libraries( ${APP_NAME} ${ASAN_LDFLAGS}
|
||||
${${Qt}Widgets_LIBRARIES}
|
||||
${${Qt}Help_LIBRARIES}
|
||||
${${Qt}Qml_LIBRARIES}
|
||||
${${Qt}UiTools_LIBRARIES}
|
||||
${${Qt}Network_LIBRARIES}
|
||||
${${Qt}OpenGL_LIBRARIES}
|
||||
${${Qt}OpenGLWidgets_LIBRARIES}
|
||||
${OPENGL_LDFLAGS}
|
||||
${SDL2_LDFLAGS}
|
||||
${MINIZIP_LDFLAGS} ${ZLIB_LIBRARIES} ${LIBARCHIVE_LDFLAGS}
|
||||
${MINIZIP_LDFLAGS} ${ZLIB_LIBRARIES}
|
||||
${LUA_LDFLAGS} ${X264_LDFLAGS} ${X265_LDFLAGS} ${LIBAV_LDFLAGS}
|
||||
${SYS_LIBS}
|
||||
)
|
||||
|
|
321
src/asm.cpp
321
src/asm.cpp
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "types.h"
|
||||
#include "utils/xstring.h"
|
||||
#include "utils/StringBuilder.h"
|
||||
#include "debug.h"
|
||||
#include "asm.h"
|
||||
#include "x6502.h"
|
||||
|
@ -257,11 +256,8 @@ int Assemble(unsigned char *output, int addr, char *str) {
|
|||
|
||||
///disassembles the opcodes in the buffer assuming the provided address. Uses GetMem() and 6502 current registers to query referenced values. returns a static string buffer.
|
||||
char *Disassemble(int addr, uint8 *opcode) {
|
||||
static char str[64]={0};
|
||||
const char *chr;
|
||||
char indReg;
|
||||
static char str[64]={0},chr[5]={0};
|
||||
uint16 tmp,tmp2;
|
||||
StringBuilder sb(str);
|
||||
|
||||
//these may be replaced later with passed-in values to make a lighter-weight disassembly mode that may not query the referenced values
|
||||
#define RX (X.X)
|
||||
|
@ -290,7 +286,7 @@ char *Disassemble(int addr, uint8 *opcode) {
|
|||
|
||||
#ifdef BRK_3BYTE_HACK
|
||||
case 0x00:
|
||||
sb << "BRK " << sb_hex(opcode[1], 2) << ' ' << sb_hex(opcode[2], 2);
|
||||
sprintf(str,"BRK %02X %02X", opcode[1], opcode[2]);
|
||||
break;
|
||||
#else
|
||||
case 0x00: strcpy(str,"BRK"); break;
|
||||
|
@ -327,226 +323,207 @@ char *Disassemble(int addr, uint8 *opcode) {
|
|||
case 0xF8: strcpy(str,"SED"); break;
|
||||
|
||||
//(Indirect,X)
|
||||
case 0x01: chr = "ORA"; goto _indirectx;
|
||||
case 0x21: chr = "AND"; goto _indirectx;
|
||||
case 0x41: chr = "EOR"; goto _indirectx;
|
||||
case 0x61: chr = "ADC"; goto _indirectx;
|
||||
case 0x81: chr = "STA"; goto _indirectx;
|
||||
case 0xA1: chr = "LDA"; goto _indirectx;
|
||||
case 0xC1: chr = "CMP"; goto _indirectx;
|
||||
case 0xE1: chr = "SBC"; goto _indirectx;
|
||||
case 0x01: strcpy(chr,"ORA"); goto _indirectx;
|
||||
case 0x21: strcpy(chr,"AND"); goto _indirectx;
|
||||
case 0x41: strcpy(chr,"EOR"); goto _indirectx;
|
||||
case 0x61: strcpy(chr,"ADC"); goto _indirectx;
|
||||
case 0x81: strcpy(chr,"STA"); goto _indirectx;
|
||||
case 0xA1: strcpy(chr,"LDA"); goto _indirectx;
|
||||
case 0xC1: strcpy(chr,"CMP"); goto _indirectx;
|
||||
case 0xE1: strcpy(chr,"SBC"); goto _indirectx;
|
||||
_indirectx:
|
||||
indirectX(tmp);
|
||||
|
||||
sb << chr << " (" << sb_addr(opcode[1], 2) << ",X) @ " << sb_addr(tmp) << " = " << sb_lit(GetMem(tmp));
|
||||
sprintf(str,"%s ($%02X,X) @ $%04X = #$%02X", chr,opcode[1],tmp,GetMem(tmp));
|
||||
break;
|
||||
|
||||
//Zero Page
|
||||
case 0x05: chr = "ORA"; goto _zeropage;
|
||||
case 0x06: chr = "ASL"; goto _zeropage;
|
||||
case 0x24: chr = "BIT"; goto _zeropage;
|
||||
case 0x25: chr = "AND"; goto _zeropage;
|
||||
case 0x26: chr = "ROL"; goto _zeropage;
|
||||
case 0x45: chr = "EOR"; goto _zeropage;
|
||||
case 0x46: chr = "LSR"; goto _zeropage;
|
||||
case 0x65: chr = "ADC"; goto _zeropage;
|
||||
case 0x66: chr = "ROR"; goto _zeropage;
|
||||
case 0x84: chr = "STY"; goto _zeropage;
|
||||
case 0x85: chr = "STA"; goto _zeropage;
|
||||
case 0x86: chr = "STX"; goto _zeropage;
|
||||
case 0xA4: chr = "LDY"; goto _zeropage;
|
||||
case 0xA5: chr = "LDA"; goto _zeropage;
|
||||
case 0xA6: chr = "LDX"; goto _zeropage;
|
||||
case 0xC4: chr = "CPY"; goto _zeropage;
|
||||
case 0xC5: chr = "CMP"; goto _zeropage;
|
||||
case 0xC6: chr = "DEC"; goto _zeropage;
|
||||
case 0xE4: chr = "CPX"; goto _zeropage;
|
||||
case 0xE5: chr = "SBC"; goto _zeropage;
|
||||
case 0xE6: chr = "INC"; goto _zeropage;
|
||||
case 0x05: strcpy(chr,"ORA"); goto _zeropage;
|
||||
case 0x06: strcpy(chr,"ASL"); goto _zeropage;
|
||||
case 0x24: strcpy(chr,"BIT"); goto _zeropage;
|
||||
case 0x25: strcpy(chr,"AND"); goto _zeropage;
|
||||
case 0x26: strcpy(chr,"ROL"); goto _zeropage;
|
||||
case 0x45: strcpy(chr,"EOR"); goto _zeropage;
|
||||
case 0x46: strcpy(chr,"LSR"); goto _zeropage;
|
||||
case 0x65: strcpy(chr,"ADC"); goto _zeropage;
|
||||
case 0x66: strcpy(chr,"ROR"); goto _zeropage;
|
||||
case 0x84: strcpy(chr,"STY"); goto _zeropage;
|
||||
case 0x85: strcpy(chr,"STA"); goto _zeropage;
|
||||
case 0x86: strcpy(chr,"STX"); goto _zeropage;
|
||||
case 0xA4: strcpy(chr,"LDY"); goto _zeropage;
|
||||
case 0xA5: strcpy(chr,"LDA"); goto _zeropage;
|
||||
case 0xA6: strcpy(chr,"LDX"); goto _zeropage;
|
||||
case 0xC4: strcpy(chr,"CPY"); goto _zeropage;
|
||||
case 0xC5: strcpy(chr,"CMP"); goto _zeropage;
|
||||
case 0xC6: strcpy(chr,"DEC"); goto _zeropage;
|
||||
case 0xE4: strcpy(chr,"CPX"); goto _zeropage;
|
||||
case 0xE5: strcpy(chr,"SBC"); goto _zeropage;
|
||||
case 0xE6: strcpy(chr,"INC"); goto _zeropage;
|
||||
_zeropage:
|
||||
// ################################## Start of SP CODE ###########################
|
||||
// Change width to %04X // don't!
|
||||
sb << chr << ' ' << sb_addr(opcode[1], 2) << " = " << sb_lit(GetMem(opcode[1]));
|
||||
sprintf(str,"%s $%02X = #$%02X", chr,opcode[1],GetMem(opcode[1]));
|
||||
// ################################## End of SP CODE ###########################
|
||||
break;
|
||||
|
||||
//#Immediate
|
||||
case 0x09: chr = "ORA"; goto _immediate;
|
||||
case 0x29: chr = "AND"; goto _immediate;
|
||||
case 0x49: chr = "EOR"; goto _immediate;
|
||||
case 0x69: chr = "ADC"; goto _immediate;
|
||||
//case 0x89: chr = "STA"; goto _immediate; //baka, no STA #imm!!
|
||||
case 0xA0: chr = "LDY"; goto _immediate;
|
||||
case 0xA2: chr = "LDX"; goto _immediate;
|
||||
case 0xA9: chr = "LDA"; goto _immediate;
|
||||
case 0xC0: chr = "CPY"; goto _immediate;
|
||||
case 0xC9: chr = "CMP"; goto _immediate;
|
||||
case 0xE0: chr = "CPX"; goto _immediate;
|
||||
case 0xE9: chr = "SBC"; goto _immediate;
|
||||
case 0x09: strcpy(chr,"ORA"); goto _immediate;
|
||||
case 0x29: strcpy(chr,"AND"); goto _immediate;
|
||||
case 0x49: strcpy(chr,"EOR"); goto _immediate;
|
||||
case 0x69: strcpy(chr,"ADC"); goto _immediate;
|
||||
//case 0x89: strcpy(chr,"STA"); goto _immediate; //baka, no STA #imm!!
|
||||
case 0xA0: strcpy(chr,"LDY"); goto _immediate;
|
||||
case 0xA2: strcpy(chr,"LDX"); goto _immediate;
|
||||
case 0xA9: strcpy(chr,"LDA"); goto _immediate;
|
||||
case 0xC0: strcpy(chr,"CPY"); goto _immediate;
|
||||
case 0xC9: strcpy(chr,"CMP"); goto _immediate;
|
||||
case 0xE0: strcpy(chr,"CPX"); goto _immediate;
|
||||
case 0xE9: strcpy(chr,"SBC"); goto _immediate;
|
||||
_immediate:
|
||||
sb << chr << ' ' << sb_lit(opcode[1]);
|
||||
sprintf(str,"%s #$%02X", chr,opcode[1]);
|
||||
break;
|
||||
|
||||
//Absolute
|
||||
case 0x0D: chr = "ORA"; goto _absolute;
|
||||
case 0x0E: chr = "ASL"; goto _absolute;
|
||||
case 0x2C: chr = "BIT"; goto _absolute;
|
||||
case 0x2D: chr = "AND"; goto _absolute;
|
||||
case 0x2E: chr = "ROL"; goto _absolute;
|
||||
case 0x4D: chr = "EOR"; goto _absolute;
|
||||
case 0x4E: chr = "LSR"; goto _absolute;
|
||||
case 0x6D: chr = "ADC"; goto _absolute;
|
||||
case 0x6E: chr = "ROR"; goto _absolute;
|
||||
case 0x8C: chr = "STY"; goto _absolute;
|
||||
case 0x8D: chr = "STA"; goto _absolute;
|
||||
case 0x8E: chr = "STX"; goto _absolute;
|
||||
case 0xAC: chr = "LDY"; goto _absolute;
|
||||
case 0xAD: chr = "LDA"; goto _absolute;
|
||||
case 0xAE: chr = "LDX"; goto _absolute;
|
||||
case 0xCC: chr = "CPY"; goto _absolute;
|
||||
case 0xCD: chr = "CMP"; goto _absolute;
|
||||
case 0xCE: chr = "DEC"; goto _absolute;
|
||||
case 0xEC: chr = "CPX"; goto _absolute;
|
||||
case 0xED: chr = "SBC"; goto _absolute;
|
||||
case 0xEE: chr = "INC"; goto _absolute;
|
||||
case 0x0D: strcpy(chr,"ORA"); goto _absolute;
|
||||
case 0x0E: strcpy(chr,"ASL"); goto _absolute;
|
||||
case 0x2C: strcpy(chr,"BIT"); goto _absolute;
|
||||
case 0x2D: strcpy(chr,"AND"); goto _absolute;
|
||||
case 0x2E: strcpy(chr,"ROL"); goto _absolute;
|
||||
case 0x4D: strcpy(chr,"EOR"); goto _absolute;
|
||||
case 0x4E: strcpy(chr,"LSR"); goto _absolute;
|
||||
case 0x6D: strcpy(chr,"ADC"); goto _absolute;
|
||||
case 0x6E: strcpy(chr,"ROR"); goto _absolute;
|
||||
case 0x8C: strcpy(chr,"STY"); goto _absolute;
|
||||
case 0x8D: strcpy(chr,"STA"); goto _absolute;
|
||||
case 0x8E: strcpy(chr,"STX"); goto _absolute;
|
||||
case 0xAC: strcpy(chr,"LDY"); goto _absolute;
|
||||
case 0xAD: strcpy(chr,"LDA"); goto _absolute;
|
||||
case 0xAE: strcpy(chr,"LDX"); goto _absolute;
|
||||
case 0xCC: strcpy(chr,"CPY"); goto _absolute;
|
||||
case 0xCD: strcpy(chr,"CMP"); goto _absolute;
|
||||
case 0xCE: strcpy(chr,"DEC"); goto _absolute;
|
||||
case 0xEC: strcpy(chr,"CPX"); goto _absolute;
|
||||
case 0xED: strcpy(chr,"SBC"); goto _absolute;
|
||||
case 0xEE: strcpy(chr,"INC"); goto _absolute;
|
||||
_absolute:
|
||||
absolute(tmp);
|
||||
|
||||
sb << chr << ' ' << sb_addr(tmp) << " = " << sb_lit(GetMem(tmp));
|
||||
|
||||
sprintf(str,"%s $%04X = #$%02X", chr,tmp,GetMem(tmp));
|
||||
break;
|
||||
|
||||
//branches
|
||||
case 0x10: chr = "BPL"; goto _branch;
|
||||
case 0x30: chr = "BMI"; goto _branch;
|
||||
case 0x50: chr = "BVC"; goto _branch;
|
||||
case 0x70: chr = "BVS"; goto _branch;
|
||||
case 0x90: chr = "BCC"; goto _branch;
|
||||
case 0xB0: chr = "BCS"; goto _branch;
|
||||
case 0xD0: chr = "BNE"; goto _branch;
|
||||
case 0xF0: chr = "BEQ"; goto _branch;
|
||||
case 0x10: strcpy(chr,"BPL"); goto _branch;
|
||||
case 0x30: strcpy(chr,"BMI"); goto _branch;
|
||||
case 0x50: strcpy(chr,"BVC"); goto _branch;
|
||||
case 0x70: strcpy(chr,"BVS"); goto _branch;
|
||||
case 0x90: strcpy(chr,"BCC"); goto _branch;
|
||||
case 0xB0: strcpy(chr,"BCS"); goto _branch;
|
||||
case 0xD0: strcpy(chr,"BNE"); goto _branch;
|
||||
case 0xF0: strcpy(chr,"BEQ"); goto _branch;
|
||||
_branch:
|
||||
relative(tmp);
|
||||
|
||||
sb << chr << ' ' << sb_addr(tmp);
|
||||
|
||||
sprintf(str,"%s $%04X", chr,tmp);
|
||||
break;
|
||||
|
||||
//(Indirect),Y
|
||||
case 0x11: chr = "ORA"; goto _indirecty;
|
||||
case 0x31: chr = "AND"; goto _indirecty;
|
||||
case 0x51: chr = "EOR"; goto _indirecty;
|
||||
case 0x71: chr = "ADC"; goto _indirecty;
|
||||
case 0x91: chr = "STA"; goto _indirecty;
|
||||
case 0xB1: chr = "LDA"; goto _indirecty;
|
||||
case 0xD1: chr = "CMP"; goto _indirecty;
|
||||
case 0xF1: chr = "SBC"; goto _indirecty;
|
||||
case 0x11: strcpy(chr,"ORA"); goto _indirecty;
|
||||
case 0x31: strcpy(chr,"AND"); goto _indirecty;
|
||||
case 0x51: strcpy(chr,"EOR"); goto _indirecty;
|
||||
case 0x71: strcpy(chr,"ADC"); goto _indirecty;
|
||||
case 0x91: strcpy(chr,"STA"); goto _indirecty;
|
||||
case 0xB1: strcpy(chr,"LDA"); goto _indirecty;
|
||||
case 0xD1: strcpy(chr,"CMP"); goto _indirecty;
|
||||
case 0xF1: strcpy(chr,"SBC"); goto _indirecty;
|
||||
_indirecty:
|
||||
indirectY(tmp);
|
||||
|
||||
sb << chr << " (" << sb_addr(opcode[1], 2) << "),Y @ " << sb_addr(tmp) << " = " << sb_lit(GetMem(tmp));
|
||||
sprintf(str,"%s ($%02X),Y @ $%04X = #$%02X", chr,opcode[1],tmp,GetMem(tmp));
|
||||
break;
|
||||
|
||||
//Zero Page,X
|
||||
case 0x15: chr = "ORA"; goto _zeropagex;
|
||||
case 0x16: chr = "ASL"; goto _zeropagex;
|
||||
case 0x35: chr = "AND"; goto _zeropagex;
|
||||
case 0x36: chr = "ROL"; goto _zeropagex;
|
||||
case 0x55: chr = "EOR"; goto _zeropagex;
|
||||
case 0x56: chr = "LSR"; goto _zeropagex;
|
||||
case 0x75: chr = "ADC"; goto _zeropagex;
|
||||
case 0x76: chr = "ROR"; goto _zeropagex;
|
||||
case 0x94: chr = "STY"; goto _zeropagex;
|
||||
case 0x95: chr = "STA"; goto _zeropagex;
|
||||
case 0xB4: chr = "LDY"; goto _zeropagex;
|
||||
case 0xB5: chr = "LDA"; goto _zeropagex;
|
||||
case 0xD5: chr = "CMP"; goto _zeropagex;
|
||||
case 0xD6: chr = "DEC"; goto _zeropagex;
|
||||
case 0xF5: chr = "SBC"; goto _zeropagex;
|
||||
case 0xF6: chr = "INC"; goto _zeropagex;
|
||||
case 0x15: strcpy(chr,"ORA"); goto _zeropagex;
|
||||
case 0x16: strcpy(chr,"ASL"); goto _zeropagex;
|
||||
case 0x35: strcpy(chr,"AND"); goto _zeropagex;
|
||||
case 0x36: strcpy(chr,"ROL"); goto _zeropagex;
|
||||
case 0x55: strcpy(chr,"EOR"); goto _zeropagex;
|
||||
case 0x56: strcpy(chr,"LSR"); goto _zeropagex;
|
||||
case 0x75: strcpy(chr,"ADC"); goto _zeropagex;
|
||||
case 0x76: strcpy(chr,"ROR"); goto _zeropagex;
|
||||
case 0x94: strcpy(chr,"STY"); goto _zeropagex;
|
||||
case 0x95: strcpy(chr,"STA"); goto _zeropagex;
|
||||
case 0xB4: strcpy(chr,"LDY"); goto _zeropagex;
|
||||
case 0xB5: strcpy(chr,"LDA"); goto _zeropagex;
|
||||
case 0xD5: strcpy(chr,"CMP"); goto _zeropagex;
|
||||
case 0xD6: strcpy(chr,"DEC"); goto _zeropagex;
|
||||
case 0xF5: strcpy(chr,"SBC"); goto _zeropagex;
|
||||
case 0xF6: strcpy(chr,"INC"); goto _zeropagex;
|
||||
_zeropagex:
|
||||
zpIndex(tmp, RX);
|
||||
indReg = 'X';
|
||||
|
||||
_indexed:
|
||||
zpIndex(tmp,RX);
|
||||
// ################################## Start of SP CODE ###########################
|
||||
// Change width to %04X // don't!
|
||||
sb << chr << ' ' << sb_addr(opcode[1], 2) << ',' << indReg << " @ " << sb_addr(tmp) << " = " << sb_lit(GetMem(tmp));
|
||||
sprintf(str,"%s $%02X,X @ $%04X = #$%02X", chr,opcode[1],tmp,GetMem(tmp));
|
||||
// ################################## End of SP CODE ###########################
|
||||
break;
|
||||
|
||||
//Absolute,Y
|
||||
case 0x19: chr = "ORA"; goto _absolutey;
|
||||
case 0x39: chr = "AND"; goto _absolutey;
|
||||
case 0x59: chr = "EOR"; goto _absolutey;
|
||||
case 0x79: chr = "ADC"; goto _absolutey;
|
||||
case 0x99: chr = "STA"; goto _absolutey;
|
||||
case 0xB9: chr = "LDA"; goto _absolutey;
|
||||
case 0xBE: chr = "LDX"; goto _absolutey;
|
||||
case 0xD9: chr = "CMP"; goto _absolutey;
|
||||
case 0xF9: chr = "SBC"; goto _absolutey;
|
||||
case 0x19: strcpy(chr,"ORA"); goto _absolutey;
|
||||
case 0x39: strcpy(chr,"AND"); goto _absolutey;
|
||||
case 0x59: strcpy(chr,"EOR"); goto _absolutey;
|
||||
case 0x79: strcpy(chr,"ADC"); goto _absolutey;
|
||||
case 0x99: strcpy(chr,"STA"); goto _absolutey;
|
||||
case 0xB9: strcpy(chr,"LDA"); goto _absolutey;
|
||||
case 0xBE: strcpy(chr,"LDX"); goto _absolutey;
|
||||
case 0xD9: strcpy(chr,"CMP"); goto _absolutey;
|
||||
case 0xF9: strcpy(chr,"SBC"); goto _absolutey;
|
||||
_absolutey:
|
||||
absolute(tmp);
|
||||
tmp2 = (tmp + RY);
|
||||
indReg = 'Y';
|
||||
|
||||
_absindexed:
|
||||
sb << chr << ' ' << sb_addr(tmp) << ',' << indReg << " @ " << sb_addr(tmp2) << " = " << sb_lit(GetMem(tmp2));
|
||||
|
||||
tmp2=(tmp+RY);
|
||||
sprintf(str,"%s $%04X,Y @ $%04X = #$%02X", chr,tmp,tmp2,GetMem(tmp2));
|
||||
break;
|
||||
|
||||
//Absolute,X
|
||||
case 0x1D: chr = "ORA"; goto _absolutex;
|
||||
case 0x1E: chr = "ASL"; goto _absolutex;
|
||||
case 0x3D: chr = "AND"; goto _absolutex;
|
||||
case 0x3E: chr = "ROL"; goto _absolutex;
|
||||
case 0x5D: chr = "EOR"; goto _absolutex;
|
||||
case 0x5E: chr = "LSR"; goto _absolutex;
|
||||
case 0x7D: chr = "ADC"; goto _absolutex;
|
||||
case 0x7E: chr = "ROR"; goto _absolutex;
|
||||
case 0x9D: chr = "STA"; goto _absolutex;
|
||||
case 0xBC: chr = "LDY"; goto _absolutex;
|
||||
case 0xBD: chr = "LDA"; goto _absolutex;
|
||||
case 0xDD: chr = "CMP"; goto _absolutex;
|
||||
case 0xDE: chr = "DEC"; goto _absolutex;
|
||||
case 0xFD: chr = "SBC"; goto _absolutex;
|
||||
case 0xFE: chr = "INC"; goto _absolutex;
|
||||
case 0x1D: strcpy(chr,"ORA"); goto _absolutex;
|
||||
case 0x1E: strcpy(chr,"ASL"); goto _absolutex;
|
||||
case 0x3D: strcpy(chr,"AND"); goto _absolutex;
|
||||
case 0x3E: strcpy(chr,"ROL"); goto _absolutex;
|
||||
case 0x5D: strcpy(chr,"EOR"); goto _absolutex;
|
||||
case 0x5E: strcpy(chr,"LSR"); goto _absolutex;
|
||||
case 0x7D: strcpy(chr,"ADC"); goto _absolutex;
|
||||
case 0x7E: strcpy(chr,"ROR"); goto _absolutex;
|
||||
case 0x9D: strcpy(chr,"STA"); goto _absolutex;
|
||||
case 0xBC: strcpy(chr,"LDY"); goto _absolutex;
|
||||
case 0xBD: strcpy(chr,"LDA"); goto _absolutex;
|
||||
case 0xDD: strcpy(chr,"CMP"); goto _absolutex;
|
||||
case 0xDE: strcpy(chr,"DEC"); goto _absolutex;
|
||||
case 0xFD: strcpy(chr,"SBC"); goto _absolutex;
|
||||
case 0xFE: strcpy(chr,"INC"); goto _absolutex;
|
||||
_absolutex:
|
||||
absolute(tmp);
|
||||
tmp2 = (tmp + RX);
|
||||
indReg = 'X';
|
||||
|
||||
goto _absindexed;
|
||||
|
||||
//jumps
|
||||
case 0x20: chr = "JSR"; goto _jump;
|
||||
case 0x4C: chr = "JMP"; goto _jump;
|
||||
_jump:
|
||||
absolute(tmp);
|
||||
|
||||
sb << chr << ' ' << sb_addr(tmp);
|
||||
|
||||
tmp2=(tmp+RX);
|
||||
sprintf(str,"%s $%04X,X @ $%04X = #$%02X", chr,tmp,tmp2,GetMem(tmp2));
|
||||
break;
|
||||
|
||||
case 0x6C:
|
||||
//jumps
|
||||
case 0x20: strcpy(chr,"JSR"); goto _jump;
|
||||
case 0x4C: strcpy(chr,"JMP"); goto _jump;
|
||||
case 0x6C: absolute(tmp); sprintf(str,"JMP ($%04X) = $%04X", tmp,GetMem(tmp)|GetMem(tmp+1)<<8); break;
|
||||
_jump:
|
||||
absolute(tmp);
|
||||
|
||||
sb << "JMP (" << sb_addr(tmp);
|
||||
sb << ") = " << sb_addr(GetMem(tmp) | GetMem(tmp + 1) << 8);
|
||||
|
||||
sprintf(str,"%s $%04X", chr,tmp);
|
||||
break;
|
||||
|
||||
//Zero Page,Y
|
||||
case 0x96: chr = "STX"; goto _zeropagey;
|
||||
case 0xB6: chr = "LDX"; goto _zeropagey;
|
||||
case 0x96: strcpy(chr,"STX"); goto _zeropagey;
|
||||
case 0xB6: strcpy(chr,"LDX"); goto _zeropagey;
|
||||
_zeropagey:
|
||||
zpIndex(tmp, RY);
|
||||
indReg = 'Y';
|
||||
|
||||
goto _indexed;
|
||||
zpIndex(tmp,RY);
|
||||
// ################################## Start of SP CODE ###########################
|
||||
// Change width to %04X // don't!
|
||||
sprintf(str,"%s $%02X,Y @ $%04X = #$%02X", chr,opcode[1],tmp,GetMem(tmp));
|
||||
// ################################## End of SP CODE ###########################
|
||||
break;
|
||||
|
||||
//UNDEFINED
|
||||
default: strcpy(str, "ERROR"); break;
|
||||
default: strcpy(str,"ERROR"); break;
|
||||
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ static void M121CW(uint32 A, uint8 V) {
|
|||
if (PRGsize[0] == CHRsize[0]) { // A9713 multigame extension hack!
|
||||
setchr1(A, V | ((EXPREGS[3] & 0x80) << 1));
|
||||
} else {
|
||||
if ((A & 0x1000) == static_cast<uint32>((MMC3_cmd & 0x80) << 5))
|
||||
if ((A & 0x1000) == ((MMC3_cmd & 0x80) << 5))
|
||||
setchr1(A, V | 0x100);
|
||||
else
|
||||
setchr1(A, V);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
static uint16 latchea;
|
||||
static uint8 latched;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint32 WRAMSIZE;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &latchea, 2, "AREG" },
|
||||
|
@ -108,7 +108,8 @@ void Mapper15_Init(CartInfo *info) {
|
|||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -1,65 +1,59 @@
|
|||
/* FCEUmm - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2024 negativeExponent
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* NES 2.0 Mapper 471 denotes the Impact Soft IM1 circuit board, used for
|
||||
* Haratyler (without HG or MP) and Haraforce. It is basically INES Mapper 201
|
||||
* with the addition of a scanline IRQ.*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint32 latch;
|
||||
|
||||
static void Sync() {
|
||||
setprg32(0x8000, latch);
|
||||
setchr8(latch);
|
||||
}
|
||||
|
||||
static DECLFW(Write) {
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
latch = A;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Reset() {
|
||||
latch = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power() {
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, Write);
|
||||
Reset();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void HBHook() {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
|
||||
void Mapper471_Init(CartInfo *info) {
|
||||
info->Power = Power;
|
||||
info->Reset = Reset;
|
||||
GameHBIRQHook = HBHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&latch, sizeof(latch), 0, "LATC");
|
||||
}
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 regs[8];
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 8, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg8(0x8000, regs[0]);
|
||||
setprg8(0xA000, regs[2]);
|
||||
setprg8(0xC000, regs[4]);
|
||||
setprg8(0xE000, ~0);
|
||||
setchr4(0x0000, regs[6]);
|
||||
setchr4(0x1000, regs[7]);
|
||||
}
|
||||
|
||||
static DECLFW(M151Write) {
|
||||
regs[(A >> 12) & 7] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M151Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M151Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper151_Init(CartInfo *info) {
|
||||
info->Power = M151Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -27,7 +27,7 @@
|
|||
static uint8 laststrobe, trigger;
|
||||
static uint8 reg[8];
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static writefunc pcmwrite;
|
||||
|
||||
|
@ -123,7 +123,8 @@ void Mapper164_Init(CartInfo *info) {
|
|||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
|
@ -171,7 +172,8 @@ void Mapper163_Init(CartInfo *info) {
|
|||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
@ -221,7 +223,8 @@ void UNLFS304_Init(CartInfo *info) {
|
|||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
static uint8 reg;
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
|
@ -73,7 +73,8 @@ void Mapper177_Init(CartInfo *info) {
|
|||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
static uint8 reg[4];
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
// Tennis with VR sensor, very simple behaviour
|
||||
extern void GetMouseData(uint32 (&md)[3]);
|
||||
|
@ -192,7 +192,8 @@ void Mapper178_Init(CartInfo *info) {
|
|||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
|
|
|
@ -16,9 +16,6 @@
|
|||
* 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
|
||||
*
|
||||
* The Moero!! Pro Yakyuu series have an ADPCM chip with internal ROM,
|
||||
* used for voice samples (not dumped, so emulation isn't possible)
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
@ -27,7 +24,7 @@ static uint8 preg[4], creg[8];
|
|||
static uint8 IRQa, mirr;
|
||||
static int32 IRQCount, IRQLatch;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
|
@ -128,7 +125,8 @@ void Mapper18_Init(CartInfo *info) {
|
|||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "mmc3.h"
|
||||
|
||||
static void M187CW(uint32 A, uint8 V) {
|
||||
if ((A & 0x1000) == static_cast<uint32>((MMC3_cmd & 0x80) << 5))
|
||||
if ((A & 0x1000) == ((MMC3_cmd & 0x80) << 5))
|
||||
setchr1(A, V | 0x100);
|
||||
else
|
||||
setchr1(A, V);
|
||||
|
|
|
@ -1,40 +1,30 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
* Copyright (C) 2019 Libretro Team
|
||||
* Copyright (C) 2020
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* PCB-018 board, discrete multigame cart 110-in-1
|
||||
*
|
||||
* Mapper 225
|
||||
* Mapper 255
|
||||
*
|
||||
*/
|
||||
|
||||
/* 2020-2-20 - merge mapper 255, re-implement extra RAM */
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2011 CaH4e3
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 extraRAM[4], prg, mode, chr, mirr;
|
||||
static uint8 prot[4], prg, mode, chr, mirr;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ extraRAM, 4, "PROT" },
|
||||
{ prot, 4, "PROT" },
|
||||
{ &prg, 1, "PRG" },
|
||||
{ &chr, 1, "CHR" },
|
||||
{ &mode, 1, "MODE" },
|
||||
|
@ -46,15 +36,14 @@ static void Sync(void) {
|
|||
if (mode) {
|
||||
setprg16(0x8000, prg);
|
||||
setprg16(0xC000, prg);
|
||||
}
|
||||
else
|
||||
} else
|
||||
setprg32(0x8000, prg >> 1);
|
||||
setchr8(chr);
|
||||
setmirror(mirr ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M225Write) {
|
||||
uint8 bank = (A >> 14) & 1;
|
||||
uint32 bank = (A >> 14) & 1;
|
||||
mirr = (A >> 13) & 1;
|
||||
mode = (A >> 12) & 1;
|
||||
chr = (A & 0x3f) | (bank << 6);
|
||||
|
@ -63,28 +52,35 @@ static DECLFW(M225Write) {
|
|||
}
|
||||
|
||||
static DECLFW(M225LoWrite) {
|
||||
/* e.g. 115-in-1 [p1][!] CRC32 0xb39d30b4 */
|
||||
if (A & 0x800) extraRAM[A & 3] = V & 0x0F;
|
||||
if (A & 0x800) {
|
||||
prot[A & 0x03] = V;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(M225LoRead) {
|
||||
if (A & 0x800) return extraRAM[A & 3];
|
||||
if (A & 0x800) {
|
||||
return prot[A & 3] & 0x0F;
|
||||
}
|
||||
return X.DB;
|
||||
}
|
||||
|
||||
static void M225Power(void) {
|
||||
prg = 0;
|
||||
chr = 0;
|
||||
mode = 0;
|
||||
mirr = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x5000, 0x5fff, M225LoRead);
|
||||
SetWriteHandler(0x5000, 0x5fff, M225LoWrite);
|
||||
SetReadHandler(0x5000, 0x5FFF, M225LoRead);
|
||||
SetWriteHandler(0x5000, 0x5FFF, M225LoWrite);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M225Write);
|
||||
}
|
||||
|
||||
static void M225Reset(void) {
|
||||
prg = 0;
|
||||
chr = 0;
|
||||
mode = 0;
|
||||
mirr = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
|
@ -98,7 +94,3 @@ void Mapper225_Init(CartInfo *info) {
|
|||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper255_Init(CartInfo *info) {
|
||||
Mapper225_Init(info);
|
||||
}
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
static uint8 regs[8];
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE = 0;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
|
@ -79,7 +79,8 @@ void Mapper246_Init(CartInfo *info) {
|
|||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
static uint8 creg[8], preg[2];
|
||||
static int32 IRQa, IRQCount, IRQClock, IRQLatch;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint32 WRAMSIZE;
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE=0;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
|
@ -127,7 +127,8 @@ void Mapper252_Init(CartInfo *info) {
|
|||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
static uint8 chrlo[8], chrhi[8], prg[2], mirr, vlock;
|
||||
static int32 IRQa, IRQCount, IRQLatch, IRQClock;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint32 WRAMSIZE;
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE=0;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
|
@ -144,7 +144,8 @@ void Mapper253_Init(CartInfo *info) {
|
|||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
/* FCEUmm - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2022
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint16 latchAddr;
|
||||
static uint8 latchData;
|
||||
static uint8 submapper;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ &latchAddr, 2, "ADDR" },
|
||||
{ &latchData, 1, "DATA" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Mapper354_Sync(void)
|
||||
{
|
||||
int prg = latchData & 0x3F | latchAddr << 2 & 0x40 | latchAddr >> 5 & 0x80;
|
||||
switch (latchAddr & 7)
|
||||
{
|
||||
case 0: case 4:
|
||||
setprg32(0x8000, prg >> 1);
|
||||
break;
|
||||
case 1:
|
||||
setprg16(0x8000, prg);
|
||||
setprg16(0xC000, prg | 7);
|
||||
break;
|
||||
case 2: case 6:
|
||||
setprg8(0x8000, prg << 1 | latchData >> 7);
|
||||
setprg8(0xA000, prg << 1 | latchData >> 7);
|
||||
setprg8(0xC000, prg << 1 | latchData >> 7);
|
||||
setprg8(0xE000, prg << 1 | latchData >> 7);
|
||||
break;
|
||||
case 3: case 7:
|
||||
setprg16(0x8000, prg);
|
||||
setprg16(0xC000, prg);
|
||||
break;
|
||||
case 5:
|
||||
setprg8(0x6000, prg << 1 | latchData >> 7);
|
||||
setprg32(0x8000, prg >> 1 | 3);
|
||||
break;
|
||||
}
|
||||
SetupCartCHRMapping(0, CHRptr[0], CHRsize[0], (latchAddr & 8) ? 0 : 1);
|
||||
setchr8(0);
|
||||
setmirror(latchData & 0x40 ? MI_H : MI_V);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper354_WriteLatch)
|
||||
{
|
||||
latchData = V;
|
||||
latchAddr = A & 0xFFFF;
|
||||
Mapper354_Sync();
|
||||
}
|
||||
|
||||
static void Mapper354_Reset(void)
|
||||
{
|
||||
latchAddr = latchData = 0;
|
||||
Mapper354_Sync();
|
||||
}
|
||||
|
||||
static void Mapper354_Power(void)
|
||||
{
|
||||
latchAddr = latchData = 0;
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(submapper == 1 ? 0xE000 : 0xF000, 0xFFFF, Mapper354_WriteLatch);
|
||||
Mapper354_Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Mapper354_Sync();
|
||||
}
|
||||
|
||||
void Mapper354_Init(CartInfo *info)
|
||||
{
|
||||
submapper = info->submapper;
|
||||
info->Power = Mapper354_Power;
|
||||
info->Reset = Mapper354_Reset;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -1,147 +0,0 @@
|
|||
/* FCEUmm - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2024
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "../ines.h"
|
||||
|
||||
static uint8 reg[4];
|
||||
static uint8 IRQCount;
|
||||
static uint8 IRQReload;
|
||||
static uint8 IRQa;
|
||||
static uint8 serialControl;
|
||||
static uint32 serialAddress;
|
||||
|
||||
static SFORMAT StateRegs[] = {
|
||||
{ reg, 4, "REGS" },
|
||||
{ &IRQCount, 1, "IRQC" },
|
||||
{ &IRQReload, 1, "IRQR" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &serialAddress, 4, "ADDR" },
|
||||
{ &serialControl, 1, "CTRL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
setprg4(0x5000, 0x01);
|
||||
setprg8(0x6000, reg[0]);
|
||||
|
||||
setprg8(0x8000, reg[1]);
|
||||
setprg8(0xA000, reg[2]);
|
||||
setprg4(0xD000, 0x07);
|
||||
setprg8(0xE000, 0x04);
|
||||
|
||||
setchr4(0x0000, reg[3]);
|
||||
setchr4(0x1000, ~0x02);
|
||||
}
|
||||
|
||||
static uint64 lreset;
|
||||
static uint32 laddr;
|
||||
static DECLFR(M413ReadPCM) {
|
||||
uint8 ret = X.DB;
|
||||
if ((A == laddr) && ((timestampbase + timestamp) < (lreset + 4))) {
|
||||
return ret;
|
||||
}
|
||||
if (serialControl & 0x02) {
|
||||
ret = MiscROM[serialAddress++ & (MiscROM_size - 1)];
|
||||
} else {
|
||||
ret = MiscROM[serialAddress & (MiscROM_size - 1)];
|
||||
}
|
||||
laddr = A;
|
||||
lreset = timestampbase + timestamp;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static DECLFW(M413Write) {
|
||||
switch (A & 0xF000) {
|
||||
case 0x8000:
|
||||
IRQReload = V;
|
||||
break;
|
||||
case 0x9000:
|
||||
IRQCount = 0;
|
||||
break;
|
||||
case 0xA000:
|
||||
case 0xB000:
|
||||
IRQa = (A & 0x1000) != 0;
|
||||
if (!IRQa) {
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
}
|
||||
break;
|
||||
case 0xC000:
|
||||
serialAddress = (serialAddress << 1) | (V >> 7);
|
||||
break;
|
||||
case 0xD000:
|
||||
serialControl = V;
|
||||
break;
|
||||
case 0xE000:
|
||||
case 0xF000:
|
||||
reg[V >> 6] = V & 0x3F;
|
||||
Sync();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M413Power(void) {
|
||||
serialAddress = 0;
|
||||
serialControl = 0;
|
||||
|
||||
IRQCount = 0;
|
||||
IRQReload = 0;
|
||||
IRQa = 0;
|
||||
|
||||
reg[0] = 0;
|
||||
reg[1] = 0;
|
||||
reg[2] = 0;
|
||||
reg[3] = 0;
|
||||
|
||||
laddr = 0;
|
||||
lreset = 0;
|
||||
|
||||
Sync();
|
||||
|
||||
SetReadHandler(0x4800, 0x4FFF, M413ReadPCM);
|
||||
SetReadHandler(0x5000, 0x7FFF, CartBR);
|
||||
SetReadHandler(0x8000, 0xBFFF, CartBR);
|
||||
SetReadHandler(0xC000, 0xCFFF, M413ReadPCM);
|
||||
SetReadHandler(0xD000, 0xFFFF, CartBR);
|
||||
|
||||
SetWriteHandler(0x8000, 0xFFFF, M413Write);
|
||||
}
|
||||
|
||||
static void M413IRQHook(void) {
|
||||
if (IRQCount == 0) {
|
||||
IRQCount = IRQReload;
|
||||
} else {
|
||||
IRQCount--;
|
||||
}
|
||||
if ((IRQCount == 0) && IRQa) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper413_Init(CartInfo *info) {
|
||||
info->Power = M413Power;
|
||||
GameHBIRQHook = M413IRQHook;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -1,216 +0,0 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2024 negativeExponent
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* NES 2.0 Mapper 451 is used for the homebrew game Haratyler HP/MP. It is
|
||||
* basically a homebrew TLROM-like circuit board that implements the MMC3
|
||||
* register's in an unusual fashion, and saves the high score to flash ROM */
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
#include "../ines.h"
|
||||
|
||||
const int ROM_CHIP = 0x00;
|
||||
const int CFI_CHIP = 0x10;
|
||||
const int FLASH_CHIP = 0x11;
|
||||
|
||||
const int FLASH_SECTOR_SIZE = 64 * 1024;
|
||||
const int magic_addr1 = 0x0555;
|
||||
const int magic_addr2 = 0x02AA;
|
||||
|
||||
static uint8 flash_state, flash_id_mode;
|
||||
static uint8 *flash_data;
|
||||
static uint16 flash_buffer_a[10];
|
||||
static uint8 flash_buffer_v[10];
|
||||
static uint8 flash_id[2];
|
||||
|
||||
static DECLFW(M451FlashWrite)
|
||||
{
|
||||
if (flash_state < sizeof(flash_buffer_a) / sizeof(flash_buffer_a[0])) {
|
||||
flash_buffer_a[flash_state] = (A & 0xFFF);
|
||||
flash_buffer_v[flash_state] = V;
|
||||
flash_state++;
|
||||
|
||||
// enter flash ID mode
|
||||
if ((flash_state == 2) &&
|
||||
(flash_buffer_a[0] == magic_addr1) && (flash_buffer_v[0] == 0xAA) &&
|
||||
(flash_buffer_a[1] == magic_addr2) && (flash_buffer_v[1] == 0x55) &&
|
||||
(flash_buffer_a[1] == magic_addr1) && (flash_buffer_v[1] == 0x90)) {
|
||||
flash_id_mode = 0;
|
||||
flash_state = 0;
|
||||
}
|
||||
|
||||
// erase sector
|
||||
if ((flash_state == 6) &&
|
||||
(flash_buffer_a[0] == magic_addr1) && (flash_buffer_v[0] == 0xAA) &&
|
||||
(flash_buffer_a[1] == magic_addr2) && (flash_buffer_v[1] == 0x55) &&
|
||||
(flash_buffer_a[2] == magic_addr1) && (flash_buffer_v[2] == 0x80) &&
|
||||
(flash_buffer_a[3] == magic_addr1) && (flash_buffer_v[3] == 0xAA) &&
|
||||
(flash_buffer_a[4] == magic_addr2) && (flash_buffer_v[4] == 0x55) &&
|
||||
(flash_buffer_v[5] == 0x30)) {
|
||||
int offset = &Page[A >> 11][A] - flash_data;
|
||||
int sector = offset / FLASH_SECTOR_SIZE;
|
||||
for (int i = sector * FLASH_SECTOR_SIZE; i < (sector + 1) * FLASH_SECTOR_SIZE; i++)
|
||||
flash_data[i % PRGsize[ROM_CHIP]] = 0xFF;
|
||||
FCEU_printf("Flash sector #%d is erased (0x%08x - 0x%08x).\n", sector, offset, offset + FLASH_SECTOR_SIZE);
|
||||
}
|
||||
|
||||
// erase chip
|
||||
if ((flash_state == 6) &&
|
||||
(flash_buffer_a[0] == magic_addr1) && (flash_buffer_v[0] == 0xAA) &&
|
||||
(flash_buffer_a[1] == magic_addr2) && (flash_buffer_v[1] == 0x55) &&
|
||||
(flash_buffer_a[2] == magic_addr1) && (flash_buffer_v[2] == 0x80) &&
|
||||
(flash_buffer_a[3] == magic_addr1) && (flash_buffer_v[3] == 0xAA) &&
|
||||
(flash_buffer_a[4] == magic_addr2) && (flash_buffer_v[4] == 0x55) &&
|
||||
(flash_buffer_a[4] == magic_addr1) && (flash_buffer_v[4] == 0x10)) {
|
||||
memset(flash_data, 0xFF, PRGsize[ROM_CHIP]);
|
||||
FCEU_printf("Flash chip erased.\n");
|
||||
flash_state = 0;
|
||||
}
|
||||
|
||||
// write byte
|
||||
if ((flash_state == 4) &&
|
||||
(flash_buffer_a[0] == magic_addr1) && (flash_buffer_v[0] == 0xAA) &&
|
||||
(flash_buffer_a[1] == magic_addr2) && (flash_buffer_v[1] == 0x55) &&
|
||||
(flash_buffer_a[2] == magic_addr1) && (flash_buffer_v[2] == 0xA0)) {
|
||||
int offset = &Page[A >> 11][A] - flash_data;
|
||||
if (CartBR(A) != 0xFF) {
|
||||
FCEU_PrintError("Error: can't write to 0x%08x, flash sector is not erased.\n", offset);
|
||||
}
|
||||
else {
|
||||
CartBW(A, V);
|
||||
}
|
||||
flash_state = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// not a command
|
||||
if (((A & 0x00FF) != (magic_addr1 & 0x00FF)) && ((A & 0x00FF) != (magic_addr2 & 0x00FF))) {
|
||||
flash_state = 0;
|
||||
}
|
||||
|
||||
// reset
|
||||
if (V == 0xF0) {
|
||||
flash_state = 0;
|
||||
flash_id_mode = 0;
|
||||
}
|
||||
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void M451FixPRG(uint32 A, uint8 V) {
|
||||
setprg8r(FLASH_CHIP, 0x8000, 0);
|
||||
setprg8r(FLASH_CHIP, 0xA000, 0x10 | ((EXPREGS[0] << 2) & 0x08) | (EXPREGS[0] & 0x01));
|
||||
setprg8r(FLASH_CHIP, 0xC000, 0x20 | ((EXPREGS[0] << 2) & 0x08) | (EXPREGS[0] & 0x01));
|
||||
setprg8r(FLASH_CHIP, 0xE000, 0x30);
|
||||
}
|
||||
|
||||
static void M451FixCHR(uint32 A, uint8 V) {
|
||||
setchr8(EXPREGS[0] & 0x01);
|
||||
}
|
||||
|
||||
static DECLFR(M451Read) {
|
||||
if (flash_state == 0x90) {
|
||||
return flash_id[A & 1];
|
||||
}
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static DECLFW(M451Write) {
|
||||
M451FlashWrite(A, V);
|
||||
switch (A & 0xE000) {
|
||||
case 0xA000:
|
||||
MMC3_CMDWrite(0xA000, A & 0x01);
|
||||
break;
|
||||
case 0xC000:
|
||||
A &= 0xFF;
|
||||
MMC3_IRQWrite(0xC000, A - 1);
|
||||
MMC3_IRQWrite(0xC001, 0);
|
||||
MMC3_IRQWrite(0xE000 + ((A == 0xFF) ? 0x00 : 0x01), 0x00);
|
||||
break;
|
||||
case 0xE000:
|
||||
EXPREGS[0] = A & 0x03;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M451Power(void) {
|
||||
GenMMC3Power();
|
||||
SetReadHandler(0x8000, 0xFFFF, M451Read);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M451Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void M451Close(void) {
|
||||
if(flash_data)
|
||||
FCEU_gfree(flash_data);
|
||||
flash_data = NULL;
|
||||
}
|
||||
|
||||
static void M451FlashReset(void)
|
||||
{
|
||||
if (flash_data)
|
||||
{
|
||||
size_t flash_size = PRGsize[ROM_CHIP];
|
||||
// Copy ROM to flash data
|
||||
for (size_t i = 0; i < flash_size; i++) {
|
||||
flash_data[i] = PRGptr[ROM_CHIP][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Mapper451_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 512, 16, 0, 0);
|
||||
pwrap = M451FixPRG;
|
||||
cwrap = M451FixCHR;
|
||||
|
||||
info->Power = M451Power;
|
||||
info->Close = M451Close;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
flash_state = 0;
|
||||
flash_id_mode = 0;
|
||||
info->battery = 1;
|
||||
|
||||
// Allocate memory for flash
|
||||
size_t flash_size = PRGsize[ROM_CHIP];
|
||||
flash_data = (uint8*)FCEU_gmalloc(flash_size);
|
||||
// Copy ROM to flash data
|
||||
for (size_t i = 0; i < flash_size; i++) {
|
||||
flash_data[i] = PRGptr[ROM_CHIP][i];
|
||||
}
|
||||
SetupCartPRGMapping(FLASH_CHIP, flash_data, flash_size, 1);
|
||||
info->addSaveGameBuf( flash_data, flash_size, M451FlashReset );
|
||||
|
||||
flash_id[0] = 0x37;
|
||||
flash_id[1] = 0x86;
|
||||
SetupCartPRGMapping(CFI_CHIP, flash_id, sizeof(flash_id), 0);
|
||||
|
||||
AddExState(flash_data, flash_size, 0, "FLSH");
|
||||
AddExState(&flash_state, sizeof(flash_state), 0, "FLST");
|
||||
AddExState(&flash_id_mode, sizeof(flash_id_mode), 0, "FLMD");
|
||||
AddExState(flash_buffer_a, sizeof(flash_buffer_a), 0, "FLBA");
|
||||
AddExState(flash_buffer_v, sizeof(flash_buffer_v), 0, "FLBV");
|
||||
}
|
|
@ -24,7 +24,7 @@ static uint8 chr_reg[4];
|
|||
static uint8 kogame, prg_reg, nt1, nt2, mirr;
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0, count=0;
|
||||
static uint32 WRAMSIZE, count;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
|
@ -156,7 +156,8 @@ void Mapper68_Init(CartInfo *info) {
|
|||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -25,7 +25,7 @@ static uint8 cmdreg, preg[4], creg[8], mirr;
|
|||
static uint8 IRQa;
|
||||
static int32 IRQCount;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
|
@ -266,7 +266,8 @@ void Mapper69_Init(CartInfo *info) {
|
|||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
GameStateRestore = StateRestore;
|
||||
Mapper69_ESI();
|
||||
|
|
|
@ -17,14 +17,13 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Moero!! Pro Tennis and Moero!! Pro Yakyuu '88 Ketteiban have an ADPCM chip with
|
||||
* internal ROM, used for voice samples (not dumped, so emulation isn't possible)
|
||||
* Moero!! Pro Tennis have ADPCM codec on-board, PROM isn't dumped, emulation isn't
|
||||
* possible just now.
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 preg, creg;
|
||||
static void (*Sync)(void);
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
|
@ -33,19 +32,13 @@ static SFORMAT StateRegs[] =
|
|||
{ 0 }
|
||||
};
|
||||
|
||||
static void M72Sync(void) {
|
||||
static void Sync(void) {
|
||||
setprg16(0x8000, preg);
|
||||
setprg16(0xC000, ~0);
|
||||
setchr8(creg);
|
||||
}
|
||||
|
||||
static void M92Sync(void) {
|
||||
setprg16(0x8000, 0);
|
||||
setprg16(0xC000, preg);
|
||||
setchr8(creg);
|
||||
}
|
||||
|
||||
static DECLFW(Write) {
|
||||
static DECLFW(M72Write) {
|
||||
if (V & 0x80)
|
||||
preg = V & 0xF;
|
||||
if (V & 0x40)
|
||||
|
@ -53,10 +46,10 @@ static DECLFW(Write) {
|
|||
Sync();
|
||||
}
|
||||
|
||||
static void Power(void) {
|
||||
static void M72Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, Write);
|
||||
SetWriteHandler(0x6000, 0xFFFF, M72Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
|
@ -64,16 +57,7 @@ static void StateRestore(int version) {
|
|||
}
|
||||
|
||||
void Mapper72_Init(CartInfo *info) {
|
||||
Sync = M72Sync;
|
||||
info->Power = Power;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper92_Init(CartInfo *info) {
|
||||
Sync = M92Sync;
|
||||
info->Power = Power;
|
||||
info->Power = M72Power;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -169,7 +169,8 @@ void Mapper80_Init(CartInfo *info) {
|
|||
GameStateRestore = StateRestore;
|
||||
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( wram, sizeof(wram) );
|
||||
info->SaveGame[0] = wram;
|
||||
info->SaveGameLen[0] = 256;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs80, ~0, 0, 0);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
static uint8 regs[9], ctrl;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
|
@ -90,7 +90,8 @@ void Mapper82_Init(CartInfo *info) {
|
|||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -92,7 +92,8 @@ void MapperNNN_Init(CartInfo *info) {
|
|||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
*/
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -26,8 +26,7 @@ static uint8 dipswitch;
|
|||
static void (*WSync)(void);
|
||||
static readfunc defread;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint8 hasBattery = 0;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static DECLFW(LatchWrite) {
|
||||
latche = A;
|
||||
|
@ -78,7 +77,8 @@ static void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, uint16
|
|||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ static void UNL43272Sync(void) {
|
|||
if ((latche & 0x81) == 0x81) {
|
||||
setprg32(0x8000, (latche & 0x38) >> 3);
|
||||
} else
|
||||
FCEU_printf("unrecognized command %04x!\n", latche);
|
||||
FCEU_printf("unrecognized command %04!\n", latche);
|
||||
setchr8(0);
|
||||
setmirror(0);
|
||||
}
|
||||
|
@ -181,7 +181,6 @@ void Mapper59_Init(CartInfo *info) {
|
|||
}
|
||||
|
||||
//------------------ Map 061 ---------------------------
|
||||
|
||||
static void M61Sync(void) {
|
||||
if (((latche & 0x10) << 1) ^ (latche & 0x20)) {
|
||||
setprg16(0x8000, ((latche & 0xF) << 1) | (((latche & 0x20) >> 4)));
|
||||
|
@ -196,21 +195,30 @@ void Mapper61_Init(CartInfo *info) {
|
|||
Latch_Init(info, M61Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 174 ---------------------------
|
||||
//------------------ Map 092 ---------------------------
|
||||
// Another two-in-one mapper, two Jaleco carts uses similar
|
||||
// hardware, but with different wiring.
|
||||
// Original code provided by LULU
|
||||
// Additionally, PCB contains DSP extra sound chip, used for voice samples (unemulated)
|
||||
|
||||
static void M174Sync(void) {
|
||||
if (latche & 0x80) {
|
||||
setprg32(0x8000, (latche >> 5) & 3);
|
||||
static void M92Sync(void) {
|
||||
uint8 reg = latche & 0xF0;
|
||||
setprg16(0x8000, 0);
|
||||
if (latche >= 0x9000) {
|
||||
switch (reg) {
|
||||
case 0xD0: setprg16(0xc000, latche & 15); break;
|
||||
case 0xE0: setchr8(latche & 15); break;
|
||||
}
|
||||
} else {
|
||||
setprg16(0x8000, (latche >> 4) & 7);
|
||||
setprg16(0xC000, (latche >> 4) & 7);
|
||||
switch (reg) {
|
||||
case 0xB0: setprg16(0xc000, latche & 15); break;
|
||||
case 0x70: setchr8(latche & 15); break;
|
||||
}
|
||||
}
|
||||
setchr8((latche >> 1) & 7);
|
||||
setmirror((latche & 1) ^ 1);
|
||||
}
|
||||
|
||||
void Mapper174_Init(CartInfo *info) {
|
||||
Latch_Init(info, M174Sync, NULL, 0, 0x8000, 0xFFFF, 0);
|
||||
void Mapper92_Init(CartInfo *info) {
|
||||
Latch_Init(info, M92Sync, NULL, 0x80B0, 0x8000, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 200 ---------------------------
|
||||
|
@ -334,17 +342,20 @@ void Mapper217_Init(CartInfo *info) {
|
|||
}
|
||||
|
||||
//------------------ Map 227 ---------------------------
|
||||
|
||||
static void M227Sync(void) {
|
||||
uint32 S = latche & 1;
|
||||
uint32 p = ((latche >> 2) & 0x1F) + ((latche & 0x100) >> 3);
|
||||
uint32 L = (latche >> 9) & 1;
|
||||
|
||||
// Only Waixing appear to have battery flag enabled, while multicarts don't.
|
||||
// Multicarts needs CHR-RAM protect in NROM modes, so only apply CHR-RAM protect
|
||||
// on non battery-enabled carts.
|
||||
if (!hasBattery && (latche & 0x80) == 0x80)
|
||||
/* CHR-RAM write protect hack, needed for some multicarts */
|
||||
SetupCartCHRMapping(0, CHRptr[0], 0x2000, 0);
|
||||
// ok, according to nesdev wiki (refrenced to the nesdev dumping thread) there is a CHR write protection bit7.
|
||||
// however, this bit clearly determined a specific PRG layout for some game but does not meant to have additional
|
||||
// functionality. as I see from the menu code, it disables the chr writing before run an actual game.
|
||||
// this fix here makes happy both waixing rpgs and multigame menus at once. can't veryfy it on a hardware
|
||||
// but if I find some i'll definitly do this.
|
||||
|
||||
if ((latche & 0xF000) == 0xF000)
|
||||
SetupCartCHRMapping(0, CHRptr[0], 0x2000, 0);
|
||||
else
|
||||
SetupCartCHRMapping(0, CHRptr[0], 0x2000, 1);
|
||||
|
||||
|
@ -382,7 +393,6 @@ static void M227Sync(void) {
|
|||
|
||||
void Mapper227_Init(CartInfo *info) {
|
||||
Latch_Init(info, M227Sync, NULL, 0x0000, 0x8000, 0xFFFF, 1);
|
||||
hasBattery = info->battery;
|
||||
}
|
||||
|
||||
//------------------ Map 229 ---------------------------
|
||||
|
|
|
@ -29,7 +29,7 @@ static uint8 IRQa;
|
|||
static int16 IRQCount, IRQLatch;
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
|
@ -178,12 +178,9 @@ static void x24c02_write(uint8 data) {
|
|||
x24c02_addr <<= 1;
|
||||
x24c02_addr |= sda;
|
||||
} else {
|
||||
if ((x24c02_addr & 0x78) != 0x50) { // WRONG DEVICE ADDRESS
|
||||
x24c02_out = 1;
|
||||
x24c02_state = X24C0X_STANDBY;
|
||||
} else if (sda) // READ COMMAND
|
||||
if (sda) // READ COMMAND
|
||||
x24c02_state = X24C0X_READ;
|
||||
else // WRITE COMMAND
|
||||
else // WRITE COMMAND
|
||||
x24c02_state = X24C0X_WORD;
|
||||
}
|
||||
x24c02_bitcount++;
|
||||
|
@ -320,7 +317,8 @@ void Mapper16_Init(CartInfo *info) {
|
|||
MapIRQHook = BandaiIRQHook;
|
||||
|
||||
info->battery = 1;
|
||||
info->addSaveGameBuf( x24c0x_data + 256, 256 );
|
||||
info->SaveGame[0] = x24c0x_data + 256;
|
||||
info->SaveGameLen[0] = 256;
|
||||
AddExState(x24c0x_data, 256, 0, "DATA");
|
||||
AddExState(&x24c02StateRegs, ~0, 0, 0);
|
||||
|
||||
|
@ -335,7 +333,8 @@ void Mapper159_Init(CartInfo *info) {
|
|||
MapIRQHook = BandaiIRQHook;
|
||||
|
||||
info->battery = 1;
|
||||
info->addSaveGameBuf( x24c0x_data, 128 );
|
||||
info->SaveGame[0] = x24c0x_data;
|
||||
info->SaveGameLen[0] = 128;
|
||||
AddExState(x24c0x_data, 128, 0, "DATA");
|
||||
AddExState(&x24c01StateRegs, ~0, 0, 0);
|
||||
|
||||
|
@ -379,7 +378,8 @@ void Mapper153_Init(CartInfo *info) {
|
|||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
|
@ -599,7 +599,8 @@ void Mapper157_Init(CartInfo *info) {
|
|||
|
||||
GameInfo->cspecial = SIS_DATACH;
|
||||
info->battery = 1;
|
||||
info->addSaveGameBuf( x24c0x_data, 512 );
|
||||
info->SaveGame[0] = x24c0x_data;
|
||||
info->SaveGameLen[0] = 512;
|
||||
AddExState(x24c0x_data, 512, 0, "DATA");
|
||||
AddExState(&x24c01StateRegs, ~0, 0, 0);
|
||||
AddExState(&x24c02StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -252,7 +252,8 @@ void Mapper111_Init(CartInfo *info) {
|
|||
if (flash)
|
||||
{
|
||||
FLASHROM = (uint8*)FCEU_gmalloc(FLASHROMSIZE);
|
||||
info->addSaveGameBuf( FLASHROM, FLASHROMSIZE );
|
||||
info->SaveGame[0] = FLASHROM;
|
||||
info->SaveGameLen[0] = FLASHROMSIZE;
|
||||
AddExState(FLASHROM, FLASHROMSIZE, 0, "FROM");
|
||||
AddExState(&FlashRegs, ~0, 0, 0);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*
|
||||
* COOLBOY cartridges use registers at address $6xxx
|
||||
* MINDKIDS cartridges use a solder pad labelled "5/6K" to select between $5000 and $6000
|
||||
*
|
||||
*
|
||||
* $xxx0
|
||||
* 7 bit 0
|
||||
* ---- ----
|
||||
|
@ -29,11 +29,12 @@
|
|||
* |||| ||||
|
||||
* |||| |+++-- PRG offset (PRG A19, A18, A17)
|
||||
* |||| +----- Alternate CHR A17
|
||||
* ||++------- PRG offset (PRG A24, A23), CHR offset (CHR A19, A18)
|
||||
* ||++------- PRG offset (PRG A24, A23)
|
||||
* |+--------- PRG mask (PRG A17 from 0: MMC3; 1: offset)
|
||||
* +---------- CHR mask (CHR A17 from 0: MMC3; 1: alternate)
|
||||
*
|
||||
* $xxx1
|
||||
*
|
||||
* 7 bit 0
|
||||
* ---- ----
|
||||
* GHIJ KKLx
|
||||
|
@ -54,16 +55,15 @@
|
|||
* $xxx3
|
||||
* 7 bit 0
|
||||
* ---- ----
|
||||
* NPZP QQRx
|
||||
* |||| |||
|
||||
* |||| +++--- PRG offset for GNROM mode (PRG A16, A15, A14)
|
||||
* |||+------- 1: GNROM mode; 0: MMC3 mode
|
||||
* |||| (1: PRG A16...13 from QQ, L, R, CPU A14, A13 + CHR A16...10 from MMMM, PPU A12...10;
|
||||
* |||| 0: PRG A16...13 from MMC3 + CHR A16...A10 from MMC3 )
|
||||
* ||+-------- 1: Also enable PRG RAM in $5000-$5FFF
|
||||
* NPxP QQRx
|
||||
* || | |||
|
||||
* || | +++--- PRG offset for GNROM mode (PRG A16, A15, A14)
|
||||
* || +------- 1: GNROM mode; 0: MMC3 mode
|
||||
* || | (1: PRG A16...13 from QQ, L, R, CPU A14, A13 + CHR A16...10 from MMMM, PPU A12...10;
|
||||
* || | 0: PRG A16...13 from MMC3 + CHR A16...A10 from MMC3 )
|
||||
* |+-+------- Banking mode
|
||||
* |+--------- "Weird MMC3 mode"
|
||||
* +---------- Lockout (prevent further writes to all registers but the one at $xxx2, only works in MMC3 mode)
|
||||
* +---------- Lockout (prevent further writes to these four registers, only works in MMC3 mode)
|
||||
*
|
||||
* Also some new cartridges from MINDKIDS have /WE and /OE pins connected to mapper,
|
||||
* which allows you to rewrite flash memory without soldering.
|
||||
|
@ -75,90 +75,25 @@
|
|||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
#include "../ines.h"
|
||||
|
||||
const int ROM_CHIP = 0x00;
|
||||
const int CFI_CHIP = 0x11;
|
||||
const int FLASH_CHIP = 0x12;
|
||||
|
||||
const uint32 FLASH_SECTOR_SIZE = 128 * 1024;
|
||||
|
||||
extern uint8* WRAM;
|
||||
static uint8* CFI = NULL;
|
||||
static uint8* Flash = NULL;
|
||||
|
||||
static uint8 flash_save = 0;
|
||||
static uint8 flash_state = 0;
|
||||
static uint16 flash_buffer_a[10];
|
||||
static uint8 flash_buffer_v[10];
|
||||
static uint8 cfi_mode = 0;
|
||||
|
||||
static uint16 regs_base = 0;
|
||||
static uint8 flag23 = 0;
|
||||
static uint8 flag45 = 0;
|
||||
static uint8 flag67 = 0;
|
||||
static uint8 flag89 = 0;
|
||||
|
||||
// Macronix 256-mbit memory CFI data
|
||||
const uint8 cfi_data[] =
|
||||
{
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0x51, 0x52, 0x59, 0x02, 0x00, 0x40, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x27, 0x36, 0x00, 0x00, 0x03,
|
||||
0x06, 0x09, 0x13, 0x03, 0x05, 0x03, 0x02, 0x19,
|
||||
0x02, 0x00, 0x06, 0x00, 0x01, 0xFF, 0x00, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF,
|
||||
0x50, 0x52, 0x49, 0x31, 0x33, 0x14, 0x02, 0x01,
|
||||
0x00, 0x08, 0x00, 0x00, 0x02, 0x95, 0xA5, 0x05,
|
||||
0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
|
||||
static void AA6023CW(uint32 A, uint8 V) {
|
||||
if (flag89) {
|
||||
/*
|
||||
$xxx0
|
||||
7 bit 0
|
||||
---- ----
|
||||
AB.C DEEE
|
||||
|| | ||||
|
||||
|| | |+++-- PRG offset (PRG A19, A18, A17)
|
||||
|| | +----- Alternate CHR A17
|
||||
|| +------- 1=Write-protect CHR-RAM
|
||||
|+--------- PRG mask (PRG A17 from 0: MMC3; 1: offset)
|
||||
+---------- CHR mask (CHR A17 from 0: MMC3; 1: alternate)
|
||||
*/
|
||||
if (EXPREGS[0] & 0b00010000)
|
||||
SetupCartCHRMapping(0, VROM, CHRsize[0], 0); // write-protect CHR-RAM
|
||||
else
|
||||
SetupCartCHRMapping(0, VROM, CHRsize[0], 1); // allow CHR writes
|
||||
}
|
||||
|
||||
uint32 mask = 0xFF ^ (EXPREGS[0] & 0b10000000);
|
||||
if (EXPREGS[3] & 0b00010000) {
|
||||
if (EXPREGS[3] & 0b01000000) { // Weird mode
|
||||
static void COOLBOYCW(uint32 A, uint8 V) {
|
||||
uint32 mask = 0xFF ^ (EXPREGS[0] & 0x80);
|
||||
if (EXPREGS[3] & 0x10) {
|
||||
if (EXPREGS[3] & 0x40) { // Weird mode
|
||||
int cbase = (MMC3_cmd & 0x80) << 5;
|
||||
switch (cbase ^ A) { // Don't even try do understand
|
||||
case 0x0400:
|
||||
case 0x0C00: V &= 0x7F; break;
|
||||
}
|
||||
}
|
||||
// Highest bit goes from MMC3 registers when EXPREGS[0]&0x80==0 or from EXPREGS[0]&0x08 otherwise
|
||||
// Highest bit goes from MMC3 registers when EXPREGS[3]&0x80==0 or from EXPREGS[0]&0x08 otherwise
|
||||
setchr1(A,
|
||||
(V & 0x80 & mask) | ((((EXPREGS[0] & 0b00001000) << 4) & ~mask)) // 7th bit
|
||||
(V & 0x80 & mask) | ((((EXPREGS[0] & 0x08) << 4) & ~mask)) // 7th bit
|
||||
| ((EXPREGS[2] & 0x0F) << 3) // 6-3 bits
|
||||
| ((A >> 10) & 7) // 2-0 bits
|
||||
| ((EXPREGS[0] & 0b00110000) << 4) // There are some ROMs with 1 MiB CHR-ROM
|
||||
);
|
||||
}
|
||||
else {
|
||||
if (EXPREGS[3] & 0b01000000) { // Weird mode, again
|
||||
} else {
|
||||
if (EXPREGS[3] & 0x40) { // Weird mode, again
|
||||
int cbase = (MMC3_cmd & 0x80) << 5;
|
||||
switch (cbase ^ A) { // Don't even try do understand
|
||||
case 0x0000: V = DRegBuf[0]; break;
|
||||
|
@ -168,81 +103,18 @@ static void AA6023CW(uint32 A, uint8 V) {
|
|||
}
|
||||
}
|
||||
// Simple MMC3 mode
|
||||
// Highest bit goes from MMC3 registers when EXPREGS[0]&0x80==0 or from EXPREGS[0]&0x08 otherwise
|
||||
setchr1(A,
|
||||
(V & mask)
|
||||
| (((EXPREGS[0] & 0x08) << 4) & ~mask)
|
||||
| ((EXPREGS[0] & 0b00110000) << 4)); // There are some ROMs with 1 MiB CHR-ROM
|
||||
// Highest bit goes from MMC3 registers when EXPREGS[3]&0x80==0 or from EXPREGS[0]&0x08 otherwise
|
||||
setchr1(A, (V & mask) | (((EXPREGS[0] & 0x08) << 4) & ~mask));
|
||||
}
|
||||
}
|
||||
|
||||
static void AA6023PW(uint32 A, uint8 V) {
|
||||
uint8 CREGS[] = {EXPREGS[0], EXPREGS[1], EXPREGS[2], EXPREGS[3]};
|
||||
// Submappers has scrambled bits
|
||||
if (flag23) {
|
||||
/*
|
||||
$xxx1
|
||||
7 bit 0
|
||||
---- ----
|
||||
GHIL JKKx
|
||||
|||| |||
|
||||
|||| +++--- PRG offset (in order: PRG A20, A21, A22)
|
||||
|||+------- GNROM mode bank PRG size (0: 32 KiB bank, PRG A14=CPU A14; 1: 16 KiB bank, PRG A14=offset A14)
|
||||
||+-------- PRG mask (PRG A20 from 0: offset; 1: MMC3)
|
||||
|+--------- PRG mask (PRG A19 from 0: offset; 1: MMC3)
|
||||
+---------- PRG mask (PRG A18 from 0: MMC3; 1: offset)
|
||||
*/
|
||||
CREGS[1] = (CREGS[1] & 0b11100101)
|
||||
| ((CREGS[1] & 0b00001000) << 1) // PRG A20
|
||||
| ((CREGS[1] & 0b00000010) << 2) // PRG A22
|
||||
| ((((CREGS[1] ^ 0b00010000) & 0b00010000) >> 3)); // GNROM mode bank PRG size
|
||||
}
|
||||
if (flag45) {
|
||||
/*
|
||||
$xxx0
|
||||
7 bit 0
|
||||
---- ----
|
||||
ABCC DEEE
|
||||
|||| ||||
|
||||
|||| |+++-- PRG offset (PRG A19, A18, A17)
|
||||
|||| +----- Alternate CHR A17
|
||||
||++------- PRG offset (PRG A21, A20)
|
||||
|+--------- PRG mask (PRG A17 from 0: MMC3; 1: offset)
|
||||
+---------- CHR mask (CHR A17 from 0: MMC3; 1: alternate)
|
||||
$xxx1
|
||||
7 bit 0
|
||||
---- ----
|
||||
GHIx xxLx
|
||||
||| |
|
||||
||| +--- GNROM mode bank PRG size (1: 32 KiB bank, PRG A14=CPU A14; 0: 16 KiB bank, PRG A14=offset A14)
|
||||
||+-------- PRG mask (PRG A20 from 0: offset; 1: MMC3)
|
||||
|+--------- PRG mask (PRG A19 from 0: offset; 1: MMC3)
|
||||
+---------- PRG mask (PRG A18 from 0: MMC3; 1: offset)
|
||||
*/
|
||||
CREGS[1] = (CREGS[1] & 0b11100011)
|
||||
| ((CREGS[0] & 0b00100000) >> 3) // PRG A21
|
||||
| (CREGS[0] & 0b00010000); // PRG A20
|
||||
CREGS[0] &= 0b11001111;
|
||||
}
|
||||
|
||||
uint32 mask = ((0b00111111 | (CREGS[1] & 0b01000000) | ((CREGS[1] & 0b00100000) << 2)) ^ ((CREGS[0] & 0b01000000) >> 2)) ^ ((CREGS[1] & 0b10000000) >> 2);
|
||||
uint32 base = ((CREGS[0] & 0b00000111) >> 0) | ((CREGS[1] & 0b00010000) >> 1) | ((CREGS[1] & 0b00001100) << 2) | ((CREGS[0] & 0b00110000) << 2);
|
||||
|
||||
if (flash_save && cfi_mode) {
|
||||
setprg32r(CFI_CHIP, 0x8000, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
int chip = !flash_save ? ROM_CHIP : FLASH_CHIP;
|
||||
// There are ROMs with multiple PRG ROM chips
|
||||
int chip_offset = 0;
|
||||
if (flag67 && EXPREGS[0] & 0b00001000) {
|
||||
chip_offset += ROM_size;
|
||||
}
|
||||
static void COOLBOYPW(uint32 A, uint8 V) {
|
||||
uint32 mask = ((0x3F | (EXPREGS[1] & 0x40) | ((EXPREGS[1] & 0x20) << 2)) ^ ((EXPREGS[0] & 0x40) >> 2)) ^ ((EXPREGS[1] & 0x80) >> 2);
|
||||
uint32 base = ((EXPREGS[0] & 0x07) >> 0) | ((EXPREGS[1] & 0x10) >> 1) | ((EXPREGS[1] & 0x0C) << 2) | ((EXPREGS[0] & 0x30) << 2);
|
||||
|
||||
// Very weird mode
|
||||
// Last banks are first in this mode, ignored when MMC3_cmd&0x40
|
||||
if ((CREGS[3] & 0b01000000) && (V >= 0xFE) && !((MMC3_cmd & 0x40) != 0)) {
|
||||
if ((EXPREGS[3] & 0x40) && (V >= 0xFE) && !((MMC3_cmd & 0x40) != 0)) {
|
||||
switch (A & 0xE000) {
|
||||
case 0xC000:
|
||||
case 0xE000:
|
||||
|
@ -251,234 +123,91 @@ static void AA6023PW(uint32 A, uint8 V) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!(CREGS[3] & 0x10)) {
|
||||
// Regular MMC3 mode but can be extended to 2MiB
|
||||
setprg8r(chip, A, ((((base << 4) & ~mask)) | (V & mask)) + chip_offset);
|
||||
}
|
||||
else {
|
||||
// NROM mode
|
||||
// Regular MMC3 mode, internal ROM size can be up to 2048kb!
|
||||
if (!(EXPREGS[3] & 0x10))
|
||||
setprg8(A, (((base << 4) & ~mask)) | (V & mask));
|
||||
else { // NROM mode
|
||||
mask &= 0xF0;
|
||||
uint8 emask;
|
||||
if (CREGS[1] & 0b00000010) // 32kb mode
|
||||
emask = (CREGS[3] & 0b00001100) | ((A & 0x4000) >> 13);
|
||||
if ((((EXPREGS[1] & 2) != 0))) // 32kb mode
|
||||
emask = (EXPREGS[3] & 0x0C) | ((A & 0x4000) >> 13);
|
||||
else // 16kb mode
|
||||
emask = CREGS[3] & 0b00001110;
|
||||
setprg8r(chip, A, (
|
||||
((base << 4) & ~mask) // 7-4 bits are from base
|
||||
| (V & mask) // ... or from MM3 internal regs, depends on mask
|
||||
| emask // 3-1 (or 3-2 when (EXPREGS[3]&0x0C is set) from EXPREGS[3]
|
||||
| ((A & 0x2000) >> 13) // 0th just as is
|
||||
) + chip_offset); // For multi-chip ROMs
|
||||
emask = EXPREGS[3] & 0x0E;
|
||||
setprg8(A, ((base << 4) & ~mask) // 7-4 bits are from base (see below)
|
||||
| (V & mask) // ... or from MM3 internal regs, depends on mask
|
||||
| emask // 3-1 (or 3-2 when (EXPREGS[3]&0x0C is set) from EXPREGS[3]
|
||||
| ((A & 0x2000) >> 13)); // 0th just as is
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(AA6023WramWrite) {
|
||||
if (A001B & 0x80)
|
||||
CartBW(A, V);
|
||||
}
|
||||
|
||||
static DECLFW(AA6023Write) {
|
||||
if (A >= 0x6000) {
|
||||
AA6023WramWrite(A, V);
|
||||
}
|
||||
static DECLFW(COOLBOYWrite) {
|
||||
if(A001B & 0x80)
|
||||
CartBW(A,V);
|
||||
|
||||
// Deny any further writes when 7th bit is 1 AND 4th is 0
|
||||
if ((EXPREGS[3] & 0x90) != 0x80) {
|
||||
EXPREGS[A & 3] = V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static DECLFW(AA6023FlashWrite) {
|
||||
if (A < 0xC000)
|
||||
MMC3_CMDWrite(A, V);
|
||||
else
|
||||
MMC3_IRQWrite(A, V);
|
||||
|
||||
if (!flash_save) return;
|
||||
if (flash_state < sizeof(flash_buffer_a) / sizeof(flash_buffer_a[0])) {
|
||||
flash_buffer_a[flash_state] = A & 0xFFF;
|
||||
flash_buffer_v[flash_state] = V;
|
||||
flash_state++;
|
||||
|
||||
// enter CFI mode
|
||||
if ((flash_state == 1) &&
|
||||
(flash_buffer_a[0] == 0x0AAA) && (flash_buffer_v[0] == 0x98)) {
|
||||
cfi_mode = 1;
|
||||
flash_state = 0;
|
||||
}
|
||||
|
||||
// erase sector
|
||||
if ((flash_state == 6) &&
|
||||
(flash_buffer_a[0] == 0x0AAA) && (flash_buffer_v[0] == 0xAA) &&
|
||||
(flash_buffer_a[1] == 0x0555) && (flash_buffer_v[1] == 0x55) &&
|
||||
(flash_buffer_a[2] == 0x0AAA) && (flash_buffer_v[2] == 0x80) &&
|
||||
(flash_buffer_a[3] == 0x0AAA) && (flash_buffer_v[3] == 0xAA) &&
|
||||
(flash_buffer_a[4] == 0x0555) && (flash_buffer_v[4] == 0x55) &&
|
||||
(flash_buffer_v[5] == 0x30)) {
|
||||
int offset = &Page[A >> 11][A] - Flash;
|
||||
int sector = offset / FLASH_SECTOR_SIZE;
|
||||
for (uint32 i = sector * FLASH_SECTOR_SIZE; i < (sector + 1) * FLASH_SECTOR_SIZE; i++)
|
||||
Flash[i % PRGsize[ROM_CHIP]] = 0xFF;
|
||||
FCEU_printf("Flash sector #%d is erased (0x%08x - 0x%08x).\n", sector, offset, offset + FLASH_SECTOR_SIZE);
|
||||
flash_state = 0;
|
||||
}
|
||||
|
||||
// erase chip, lol
|
||||
if ((flash_state == 6) &&
|
||||
(flash_buffer_a[0] == 0x0AAA) && (flash_buffer_v[0] == 0xAA) &&
|
||||
(flash_buffer_a[1] == 0x0555) && (flash_buffer_v[1] == 0x55) &&
|
||||
(flash_buffer_a[2] == 0x0AAA) && (flash_buffer_v[2] == 0x80) &&
|
||||
(flash_buffer_a[3] == 0x0AAA) && (flash_buffer_v[3] == 0xAA) &&
|
||||
(flash_buffer_a[4] == 0x0555) && (flash_buffer_v[4] == 0x55) &&
|
||||
(flash_buffer_v[5] == 0x10)) {
|
||||
memset(Flash, 0xFF, PRGsize[ROM_CHIP]);
|
||||
FCEU_printf("Flash chip erased.\n");
|
||||
flash_state = 0;
|
||||
}
|
||||
|
||||
// write byte
|
||||
if ((flash_state == 4) &&
|
||||
(flash_buffer_a[0] == 0x0AAA) && (flash_buffer_v[0] == 0xAA) &&
|
||||
(flash_buffer_a[1] == 0x0555) && (flash_buffer_v[1] == 0x55) &&
|
||||
(flash_buffer_a[2] == 0x0AAA) && (flash_buffer_v[2] == 0xA0)) {
|
||||
int offset = &Page[A >> 11][A] - Flash;
|
||||
if (CartBR(A) != 0xFF) {
|
||||
FCEU_PrintError("Error: can't write to 0x%08x, flash sector is not erased.\n", offset);
|
||||
}
|
||||
else {
|
||||
CartBW(A, V);
|
||||
}
|
||||
flash_state = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// not a command
|
||||
if (((A & 0xFFF) != 0x0AAA) && ((A & 0xFFF) != 0x0555)) {
|
||||
flash_state = 0;
|
||||
}
|
||||
|
||||
// reset
|
||||
if (V == 0xF0) {
|
||||
flash_state = 0;
|
||||
cfi_mode = 0;
|
||||
}
|
||||
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void AA6023Reset(void) {
|
||||
static void COOLBOYReset(void) {
|
||||
MMC3RegReset();
|
||||
EXPREGS[0] = EXPREGS[1] = EXPREGS[2] = EXPREGS[3] = 0;
|
||||
flash_state = 0;
|
||||
cfi_mode = 0;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void AA6023Power(void) {
|
||||
static void COOLBOYPower(void) {
|
||||
GenMMC3Power();
|
||||
EXPREGS[0] = EXPREGS[1] = EXPREGS[2] = EXPREGS[3] = 0;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
if (regs_base != 0x5000)
|
||||
SetWriteHandler(0x5000, 0x5fff, CartBW); // some games access random unmapped areas and crashes because of KT-008 PCB hack in MMC3 source lol
|
||||
SetWriteHandler(0x6000, 0x7fff, AA6023WramWrite);
|
||||
SetWriteHandler(regs_base, regs_base + 0x0fff, AA6023Write);
|
||||
SetWriteHandler(0x8000, 0xFFFF, AA6023FlashWrite);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x5000, 0x5fff, CartBW); // some games access random unmapped areas and crashes because of KT-008 PCB hack in MMC3 source lol
|
||||
SetWriteHandler(0x6000, 0x6fff, COOLBOYWrite);
|
||||
}
|
||||
|
||||
static void AA6023Restore(int version) {
|
||||
static void MINDKIDSPower(void) {
|
||||
GenMMC3Power();
|
||||
EXPREGS[0] = EXPREGS[1] = EXPREGS[2] = EXPREGS[3] = 0;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void AA6023Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
if (Flash)
|
||||
FCEU_gfree(Flash);
|
||||
if (CFI)
|
||||
FCEU_gfree(CFI);
|
||||
WRAM = Flash = CFI = NULL;
|
||||
}
|
||||
|
||||
void CommonInit(CartInfo* info, int submapper)
|
||||
{
|
||||
GenMMC3_Init(info, 2048, info->vram_size / 1024, !info->ines2 ? 8 : (info->wram_size + info->battery_wram_size) / 1024, info->battery);
|
||||
pwrap = AA6023PW;
|
||||
cwrap = AA6023CW;
|
||||
|
||||
switch (submapper)
|
||||
{
|
||||
case 2:
|
||||
regs_base = 0x7000;
|
||||
break;
|
||||
case 0:
|
||||
case 4:
|
||||
case 6:
|
||||
case 8:
|
||||
regs_base = 0x6000;
|
||||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
case 5:
|
||||
case 7:
|
||||
case 9:
|
||||
regs_base = 0x5000;
|
||||
break;
|
||||
default:
|
||||
FCEU_PrintError("Submapper #%d is not supported", submapper);
|
||||
}
|
||||
flag23 = (submapper == 2) || (submapper == 3);
|
||||
flag45 = (submapper == 4) || (submapper == 5);
|
||||
flag67 = (submapper == 6) || (submapper == 7);
|
||||
flag89 = (submapper == 8) || (submapper == 9);
|
||||
info->Power = AA6023Power;
|
||||
info->Reset = AA6023Reset;
|
||||
info->Close = AA6023Close;
|
||||
GameStateRestore = AA6023Restore;
|
||||
|
||||
flash_save = info->battery;
|
||||
|
||||
if (flash_save) {
|
||||
CFI = (uint8*)FCEU_gmalloc(sizeof(cfi_data) * 2);
|
||||
for (size_t i = 0; i < sizeof(cfi_data); i++) {
|
||||
CFI[i * 2] = CFI[i * 2 + 1] = cfi_data[i];
|
||||
}
|
||||
SetupCartPRGMapping(CFI_CHIP, CFI, sizeof(cfi_data) * 2, 0);
|
||||
Flash = (uint8*)FCEU_gmalloc(PRGsize[ROM_CHIP]);
|
||||
for (unsigned int i = 0; i < PRGsize[ROM_CHIP]; i++) {
|
||||
Flash[i] = PRGptr[ROM_CHIP][i % PRGsize[ROM_CHIP]];
|
||||
}
|
||||
SetupCartPRGMapping(FLASH_CHIP, Flash, PRGsize[ROM_CHIP], 1);
|
||||
info->addSaveGameBuf( Flash, PRGsize[ROM_CHIP] );
|
||||
}
|
||||
|
||||
AddExState(EXPREGS, 4, 0, "EXPR");
|
||||
if (flash_save)
|
||||
{
|
||||
AddExState(&flash_state, sizeof(flash_state), 0, "FLST");
|
||||
AddExState(flash_buffer_a, sizeof(flash_buffer_a), 0, "FLBA");
|
||||
AddExState(flash_buffer_v, sizeof(flash_buffer_v), 0, "FLBV");
|
||||
AddExState(&cfi_mode, sizeof(cfi_mode), 0, "CFIM");
|
||||
AddExState(Flash, PRGsize[ROM_CHIP], 0, "FLAS");
|
||||
}
|
||||
SetWriteHandler(0x5000, 0x5fff, COOLBOYWrite);
|
||||
}
|
||||
|
||||
// Registers at $6xxx
|
||||
void COOLBOY_Init(CartInfo* info) {
|
||||
CommonInit(info, 0);
|
||||
void COOLBOY_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 2048, 256, 8, 1);
|
||||
pwrap = COOLBOYPW;
|
||||
cwrap = COOLBOYCW;
|
||||
info->Power = COOLBOYPower;
|
||||
info->Reset = COOLBOYReset;
|
||||
AddExState(EXPREGS, 4, 0, "EXPR");
|
||||
}
|
||||
|
||||
// Registers at $5xxx
|
||||
void MINDKIDS_Init(CartInfo* info) {
|
||||
CommonInit(info, 1);
|
||||
void MINDKIDS_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 2048, 256, 8, 1);
|
||||
pwrap = COOLBOYPW;
|
||||
cwrap = COOLBOYCW;
|
||||
info->Power = MINDKIDSPower;
|
||||
info->Reset = COOLBOYReset;
|
||||
AddExState(EXPREGS, 4, 0, "EXPR");
|
||||
}
|
||||
|
||||
// For NES 2.0 loader
|
||||
void AA6023_Init(CartInfo* info) {
|
||||
CommonInit(info, info->submapper);
|
||||
void SMD132_SMD133_Init(CartInfo *info) {
|
||||
switch (info->submapper)
|
||||
{
|
||||
case 0:
|
||||
COOLBOY_Init(info);
|
||||
break;
|
||||
case 1:
|
||||
MINDKIDS_Init(info);
|
||||
break;
|
||||
default:
|
||||
FCEU_PrintError("Unknown submapper: #%d.", info->submapper);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,12 +21,11 @@
|
|||
#include "mapinc.h"
|
||||
#include "../ines.h"
|
||||
|
||||
static uint8 latche=0, latcheinit=0, bus_conflict=0;
|
||||
static uint16 addrreg0=0, addrreg1=0;
|
||||
static uint8 latche, latcheinit, bus_conflict;
|
||||
static uint16 addrreg0, addrreg1;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static void (*WSync)(void) = nullptr;
|
||||
static uint8 submapper;
|
||||
static uint32 WRAMSIZE;
|
||||
static void (*WSync)(void);
|
||||
|
||||
static DECLFW(LatchWrite) {
|
||||
// FCEU_printf("bs %04x %02x\n",A,V);
|
||||
|
@ -69,7 +68,6 @@ static void Latch_Init(CartInfo *info, void (*proc)(void), uint8 init, uint16 ad
|
|||
info->Power = LatchPower;
|
||||
info->Close = LatchClose;
|
||||
GameStateRestore = StateRestore;
|
||||
submapper = info->submapper;
|
||||
if(info->ines2)
|
||||
if(info->battery_wram_size + info->wram_size > 0)
|
||||
wram = 1;
|
||||
|
@ -87,12 +85,14 @@ static void Latch_Init(CartInfo *info, void (*proc)(void), uint8 init, uint16 ad
|
|||
//else if(!info->wram_size && info->battery_wram_size)
|
||||
//{
|
||||
// SetupCartPRGMapping(0x10, WRAM, info->battery_wram_size, 1);
|
||||
// info->addSaveGameBuf( WRAM, info->battery_wram_size );
|
||||
// info->SaveGame[0] = WRAM;
|
||||
// info->SaveGameLen[0] = info->battery_wram_size;
|
||||
//} else {
|
||||
// //well, this is annoying
|
||||
// SetupCartPRGMapping(0x10, WRAM, info->wram_size, 1);
|
||||
// SetupCartPRGMapping(0x11, WRAM, info->battery_wram_size, 1); //? ? ? there probably isnt even a way to select this
|
||||
// info->addSaveGameBuf( WRAM + info->wram_size, info->battery_wram_size );
|
||||
// info->SaveGame[0] = WRAM + info->wram_size;
|
||||
// info->SaveGameLen[0] = info->battery_wram_size;
|
||||
//}
|
||||
|
||||
//this is more likely the only practical scenario
|
||||
|
@ -104,7 +104,8 @@ static void Latch_Init(CartInfo *info, void (*proc)(void), uint8 init, uint16 ad
|
|||
setprg8r(0x10, 0x6000, 0);
|
||||
if(info->battery_wram_size)
|
||||
{
|
||||
info->addSaveGameBuf( WRAM, 8192 );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -113,7 +114,8 @@ static void Latch_Init(CartInfo *info, void (*proc)(void), uint8 init, uint16 ad
|
|||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
}
|
||||
|
@ -156,7 +158,8 @@ void NROM_Init(CartInfo *info) {
|
|||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
}
|
||||
|
@ -297,11 +300,7 @@ static void M78Sync() {
|
|||
setprg16(0x8000, (latche & 7));
|
||||
setprg16(0xc000, ~0);
|
||||
setchr8(latche >> 4);
|
||||
if (submapper == 3) {
|
||||
setmirror((latche >> 3) & 1);
|
||||
} else {
|
||||
setmirror(MI_0 + ((latche >> 3) & 1));
|
||||
}
|
||||
setmirror(MI_0 + ((latche >> 3) & 1));
|
||||
}
|
||||
|
||||
void Mapper78_Init(CartInfo *info) {
|
||||
|
@ -309,8 +308,7 @@ void Mapper78_Init(CartInfo *info) {
|
|||
}
|
||||
|
||||
//------------------ Map 86 ---------------------------
|
||||
// Moero!! Pro Yakyuu has an ADPCM chip with internal ROM,
|
||||
// used for voice samples (not dumped, so emulation isn't possible)
|
||||
|
||||
static void M86Sync(void) {
|
||||
setprg32(0x8000, (latche >> 4) & 3);
|
||||
setchr8((latche & 3) | ((latche >> 4) & 4));
|
||||
|
@ -371,14 +369,31 @@ void Mapper94_Init(CartInfo *info) {
|
|||
//------------------ Map 97 ---------------------------
|
||||
|
||||
static void M97Sync(void) {
|
||||
setchr8(0);
|
||||
setprg16(0x8000, ~0);
|
||||
setprg16(0xc000, latche & 15);
|
||||
setmirror((latche >> 7) & 1);
|
||||
setchr8(0);
|
||||
switch (latche >> 6) {
|
||||
case 0: break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_V); break;
|
||||
case 3: break;
|
||||
}
|
||||
setchr8(((latche >> 1) & 1) | ((latche << 1) & 2));
|
||||
}
|
||||
|
||||
void Mapper97_Init(CartInfo *info) {
|
||||
Latch_Init(info, M97Sync, ~0, 0x8000, 0xBFFF, 0, 0);
|
||||
Latch_Init(info, M97Sync, ~0, 0x8000, 0xFFFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 101 ---------------------------
|
||||
|
||||
static void M101Sync(void) {
|
||||
setprg32(0x8000, 0);
|
||||
setchr8(latche);
|
||||
}
|
||||
|
||||
void Mapper101_Init(CartInfo *info) {
|
||||
Latch_Init(info, M101Sync, ~0, 0x6000, 0x7FFF, 0, 0);
|
||||
}
|
||||
|
||||
//------------------ Map 107 ---------------------------
|
||||
|
|
|
@ -70,7 +70,8 @@ void UNLEDU2000_Init(CartInfo *info) {
|
|||
WRAM = (uint8*)FCEU_gmalloc(32768);
|
||||
SetupCartPRGMapping(0x10, WRAM, 32768, 1);
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, 32768 );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 32768;
|
||||
}
|
||||
AddExState(WRAM, 32768, 0, "WRAM");
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -141,7 +141,8 @@ void Mapper6_Init(CartInfo *info) {
|
|||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -28,19 +28,17 @@
|
|||
static uint8 DRegs[4];
|
||||
static uint8 Buffer, BufferShift;
|
||||
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint32 WRAMSIZE;
|
||||
static uint8 *WRAM = NULL;
|
||||
|
||||
static int kanji_pos, kanji_page, r40C0;
|
||||
static int IRQa, IRQCount;
|
||||
|
||||
FCEU_MAYBE_UNUSED
|
||||
static DECLFW(MBWRAM) {
|
||||
if (!(DRegs[3] & 0x10))
|
||||
Page[A >> 11][A] = V;
|
||||
}
|
||||
|
||||
FCEU_MAYBE_UNUSED
|
||||
static DECLFR(MAWRAM) {
|
||||
if (DRegs[3] & 0x10)
|
||||
return X.DB;
|
||||
|
@ -256,7 +254,8 @@ void FNS_Init(CartInfo *info) {
|
|||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
|
||||
AddExState(DRegs, 4, 0, "DREG");
|
||||
AddExState(&lreset, 8, 1, "LRST");
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2022 Cluster
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* NES 2.0 Mapper 470 denotes the INX_007T_V01 multicart circuit board,
|
||||
* used for the Retro-Bit re-release of Battletoads and Double Dragon.
|
||||
* It is basically AOROM with an additional outer bank register at $5000-$5FFF
|
||||
* whose data selects the 256 KiB outer bank.
|
||||
*
|
||||
* $5000-$5FFF
|
||||
* 7 bit 0
|
||||
* ---- ----
|
||||
* xxxx xxOO
|
||||
* ||
|
||||
* ++- Select outer 256 KB PRG ROM bank for CPU $8000-$FFFF
|
||||
*
|
||||
* $8000-$FFFF
|
||||
* 7 bit 0
|
||||
* ---- ----
|
||||
* xxxM xPPP
|
||||
* | |||
|
||||
* | +++- Select inner 32 KB PRG ROM bank for CPU $8000-$FFFF
|
||||
* +------ Select 1 KB VRAM page for all 4 nametables
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch_out, latch_in;
|
||||
|
||||
static void INX_007T_Sync() {
|
||||
setprg32(0x8000, (latch_in & 0b111) | (latch_out << 3));
|
||||
setmirror(MI_0 + ((latch_in >> 4) & 1));
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
INX_007T_Sync();
|
||||
}
|
||||
|
||||
static DECLFW(INX_007T_WriteLow)
|
||||
{
|
||||
latch_out = V;
|
||||
INX_007T_Sync();
|
||||
}
|
||||
|
||||
static DECLFW(INX_007T_WriteHi)
|
||||
{
|
||||
latch_in = V;
|
||||
INX_007T_Sync();
|
||||
}
|
||||
|
||||
static void INX_007T_Power(void) {
|
||||
latch_in = latch_out = 0;
|
||||
INX_007T_Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x5000,0x5FFF, INX_007T_WriteLow);
|
||||
SetWriteHandler(0x8000, 0xFFFF, INX_007T_WriteHi);
|
||||
}
|
||||
|
||||
static void INX_007T_Reset(void) {
|
||||
latch_in = latch_out = 0;
|
||||
INX_007T_Sync();
|
||||
}
|
||||
|
||||
void INX_007T_Init(CartInfo *info) {
|
||||
info->Power = INX_007T_Power;
|
||||
info->Reset = INX_007T_Reset;
|
||||
GameStateRestore = StateRestore;
|
||||
SetupCartMirroring(MI_0, 0, NULL);
|
||||
AddExState(&latch_out, 1, 0, "LATO");
|
||||
AddExState(&latch_in, 1, 0, "LATI");
|
||||
}
|
|
@ -306,7 +306,8 @@ static void GenMMC1Init(CartInfo *info, int prg, int chr, int wram, int bram) {
|
|||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (bram) {
|
||||
info->addSaveGameBuf( WRAM + NONBRAMSIZE, bram * 1024 );
|
||||
info->SaveGame[0] = WRAM + NONBRAMSIZE;
|
||||
info->SaveGameLen[0] = bram * 1024;
|
||||
}
|
||||
}
|
||||
if (!chr) {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
static uint8 is10;
|
||||
static uint8 creg[4], latch0, latch1, preg, mirr;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
|
@ -130,7 +130,8 @@ void Mapper10_Init(CartInfo *info) {
|
|||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -324,7 +324,8 @@ void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery) {
|
|||
|
||||
if (battery) {
|
||||
mmc3opts |= 2;
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
// KT-008 boards hack 2-in-1, TODO assign to new ines mapper, most dump of KT-boards on the net are mapper 4, so need database or goodnes fix support
|
||||
|
@ -363,10 +364,8 @@ static void M4Power(void) {
|
|||
void Mapper4_Init(CartInfo *info) {
|
||||
int ws = 8;
|
||||
|
||||
if (info->ines2) {
|
||||
ws = (info->wram_size + info->battery_wram_size) / 1024;
|
||||
} else if ((info->CRC32 == 0x93991433 || info->CRC32 == 0xaf65aa84)) {
|
||||
FCEU_printf("Low-G-Man can not work normally in the iNES format.\nThis game has been recognized by its CRC32 value, and the appropriate changes will be made so it will run.\nIf you wish to hack this game, you should use the NES 2.0 format for your hack.\n\n");
|
||||
if ((info->CRC32 == 0x93991433 || info->CRC32 == 0xaf65aa84)) {
|
||||
FCEU_printf("Low-G-Man can not work normally in the iNES format.\nThis game has been recognized by its CRC32 value, and the appropriate changes will be made so it will run.\nIf you wish to hack this game, you should use the UNIF format for your hack.\n\n");
|
||||
ws = 0;
|
||||
}
|
||||
GenMMC3_Init(info, 512, 256, ws, info->battery);
|
||||
|
@ -500,38 +499,38 @@ void Mapper44_Init(CartInfo *info) {
|
|||
// ---------------------------- Mapper 45 -------------------------------
|
||||
|
||||
static void M45CW(uint32 A, uint8 V) {
|
||||
uint32 NV = V;
|
||||
const int mask = ((EXPREGS[2] & 0x0F) > 7)
|
||||
? ((1 << (EXPREGS[2] & 0x0F) << 3) - 1)
|
||||
: 0;
|
||||
NV |= (EXPREGS[0] & mask) | ((EXPREGS[2] & 0xF0) << 4);
|
||||
setchr1(A, NV);
|
||||
if (!UNIFchrrama) {
|
||||
uint32 NV = V;
|
||||
if (EXPREGS[2] & 8)
|
||||
NV &= (1 << ((EXPREGS[2] & 7) + 1)) - 1;
|
||||
else
|
||||
if (EXPREGS[2])
|
||||
NV &= 0; // hack ;( don't know exactly how it should be
|
||||
NV |= EXPREGS[0] | ((EXPREGS[2] & 0xF0) << 4);
|
||||
setchr1(A, NV);
|
||||
} else
|
||||
// setchr8(0); // i don't know what cart need this, but a new one need other lol
|
||||
setchr1(A, V);
|
||||
}
|
||||
|
||||
static void M45PW(uint32 A, uint8 V) {
|
||||
uint32 MV = V;
|
||||
const int mask = (EXPREGS[3] & 0x3F) ^ 0x3F;
|
||||
MV |= (EXPREGS[1] & 0x3F & mask) | (EXPREGS[1] & 0xC0);
|
||||
uint32 MV = V & ((EXPREGS[3] & 0x3F) ^ 0x3F);
|
||||
MV |= EXPREGS[1];
|
||||
if(UNIFchrrama)
|
||||
MV |= ((EXPREGS[2] & 0x40) << 2);
|
||||
setprg8(A, MV);
|
||||
// FCEU_printf("1:%02x 2:%02x 3:%02x A=%04x V=%03x\n",EXPREGS[1],EXPREGS[2],EXPREGS[3],A,MV);
|
||||
}
|
||||
|
||||
static DECLFW(M45Write) {
|
||||
WRAM[A - 0x6000] = V;
|
||||
if (!(A & 1))
|
||||
{
|
||||
if (EXPREGS[3] & 0x40) {
|
||||
WRAM[A - 0x6000] = V;
|
||||
return;
|
||||
}
|
||||
EXPREGS[EXPREGS[4]] = V;
|
||||
EXPREGS[4] = (EXPREGS[4] + 1) & 3;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
else {
|
||||
// lock reset
|
||||
EXPREGS[3] &= ~0x40;
|
||||
if (EXPREGS[3] & 0x40) {
|
||||
WRAM[A - 0x6000] = V;
|
||||
return;
|
||||
}
|
||||
EXPREGS[EXPREGS[4]] = V;
|
||||
EXPREGS[4] = (EXPREGS[4] + 1) & 3;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static DECLFR(M45Read) {
|
||||
|
@ -552,7 +551,7 @@ static void M45Reset(void) {
|
|||
static void M45Power(void) {
|
||||
GenMMC3Power();
|
||||
EXPREGS[0] = EXPREGS[1] = EXPREGS[2] = EXPREGS[3] = EXPREGS[4] = EXPREGS[5] = 0;
|
||||
SetWriteHandler(0x6000, 0x7FFF, M45Write);
|
||||
SetWriteHandler(0x5000, 0x7FFF, M45Write);
|
||||
SetReadHandler(0x5000, 0x5FFF, M45Read);
|
||||
}
|
||||
|
||||
|
@ -862,52 +861,32 @@ void Mapper119_Init(CartInfo *info) {
|
|||
// ---------------------------- Mapper 134 ------------------------------
|
||||
|
||||
static void M134PW(uint32 A, uint8 V) {
|
||||
if ((EXPREGS[1] & 0x88) == 0x80)
|
||||
setprg32(A, (EXPREGS[0] & 0x10) | ((EXPREGS[1] & 2) << 2)); // NROM-256
|
||||
else if ((EXPREGS[1] & 0x88) == 0x88)
|
||||
setprg16(0x8000 | (A & 0x4000), ((EXPREGS[0] & 0x10) << 1) | ((V & 0x10) >> 1) | ((EXPREGS[1] & 3) << 3)); // NROM-128
|
||||
else if (EXPREGS[1] & 4)
|
||||
setprg8(A, ((EXPREGS[0] & 0x10) << 2) | (V & 0x0F) | ((EXPREGS[1] & 3) << 4)); // MMC3 128KB mask
|
||||
else
|
||||
setprg8(A, ((EXPREGS[0] & 0x10) << 2) | (V & 0x1F) | ((EXPREGS[1] & 2) << 4)); // MMC3 256KB mask
|
||||
setprg8(A, (V & 0x1F) | ((EXPREGS[0] & 2) << 4));
|
||||
}
|
||||
|
||||
static void M134CW(uint32 A, uint8 V) {
|
||||
// CNROM mode. Unclear. Untested.
|
||||
if (EXPREGS[0] & 0x08)
|
||||
setchr8(EXPREGS[2]);
|
||||
else if (EXPREGS[1] & 0x40)
|
||||
setchr1(A, ((EXPREGS[0] & 0x20) << 4) | (V & 0x7F) | ((EXPREGS[1] & 0x30) << 3)); // 128KB mask
|
||||
else
|
||||
setchr1(A, ((EXPREGS[0] & 0x20) << 4) | (V & 0xFF) | ((EXPREGS[1] & 0x20) << 3)); // 256KB mask
|
||||
setchr1(A, (V & 0xFF) | ((EXPREGS[0] & 0x20) << 3));
|
||||
}
|
||||
|
||||
static DECLFW(M134Write) {
|
||||
if (EXPREGS[0] & 0x80)
|
||||
{
|
||||
// locked (except $6002.0-1)
|
||||
if ((A & 3) == 2)
|
||||
EXPREGS[2] = (EXPREGS[2] & 0xFC) | (V & 3);
|
||||
return;
|
||||
}
|
||||
EXPREGS[A & 3] = V;
|
||||
EXPREGS[0] = V;
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void M134Power(void) {
|
||||
EXPREGS[0] = EXPREGS[1] = EXPREGS[2] = EXPREGS[3] = 0;
|
||||
EXPREGS[0] = 0;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x6000, 0x7FFF, M134Write);
|
||||
SetWriteHandler(0x6001, 0x6001, M134Write);
|
||||
}
|
||||
|
||||
static void M134Reset(void) {
|
||||
EXPREGS[0] = EXPREGS[1] = EXPREGS[2] = EXPREGS[3] = 0;
|
||||
EXPREGS[0] = 0;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
void Mapper134_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 512, 512, 0, 0);
|
||||
GenMMC3_Init(info, 256, 256, 0, 0);
|
||||
pwrap = M134PW;
|
||||
cwrap = M134CW;
|
||||
info->Power = M134Power;
|
||||
|
@ -1158,73 +1137,20 @@ void Mapper198_Init(CartInfo *info) {
|
|||
info->Power = M195Power;
|
||||
}
|
||||
|
||||
/* ---------------------------- Mapper 205 ------------------------------ */
|
||||
/* UNIF boardname BMC-JC-016-2
|
||||
https://wiki.nesdev.com/w/index.php/INES_Mapper_205 */
|
||||
|
||||
/* 2023-02 : Update reg write logic and add solder pad */
|
||||
// ---------------------------- Mapper 205 ------------------------------
|
||||
// GN-45 BOARD
|
||||
|
||||
static void M205PW(uint32 A, uint8 V) {
|
||||
uint8 bank = V & ((EXPREGS[0] & 0x02) ? 0x0F : 0x1F);
|
||||
if (PRGsize[1]) { // split-rom variant
|
||||
setprg8r((EXPREGS[0] & 3) ? (EXPREGS[0] - 1) : 0, A, bank);
|
||||
} else {
|
||||
setprg8(A, EXPREGS[0] << 4 | bank);
|
||||
}
|
||||
}
|
||||
|
||||
static void M205CW(uint32 A, uint8 V) {
|
||||
uint8 bank = V & ((EXPREGS[0] & 0x02) ? 0x7F : 0xFF);
|
||||
if (CHRsize[1]) { // split-rom variant
|
||||
setchr1r((EXPREGS[0] & 3) ? (EXPREGS[0] - 1) : 0, A, bank);
|
||||
} else {
|
||||
setchr1(A, (EXPREGS[0] << 7) | bank);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M205Write) {
|
||||
EXPREGS[0] = V & 3;
|
||||
if (V & 1) {
|
||||
EXPREGS[0] |= EXPREGS[1];
|
||||
}
|
||||
CartBW(A, V);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void M205Reset(void) {
|
||||
EXPREGS[0] = 0;
|
||||
EXPREGS[1] ^= 2; /* solder pad */
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
static void M205Power(void) {
|
||||
EXPREGS[0] = EXPREGS[1] = 0;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x6000, 0x7FFF, M205Write);
|
||||
}
|
||||
|
||||
void Mapper205_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 256, 128, 0, 0);
|
||||
pwrap = M205PW;
|
||||
cwrap = M205CW;
|
||||
info->Power = M205Power;
|
||||
info->Reset = M205Reset;
|
||||
AddExState(EXPREGS, 2, 0, "EXPR");
|
||||
}
|
||||
|
||||
/* --------------------------- GN-45 BOARD ------------------------------ */
|
||||
|
||||
/* Mapper 361 and 366, previously assigned as Mapper 205 */
|
||||
static void GN45PW(uint32 A, uint8 V) {
|
||||
// GN-30A - íà÷àëüíàÿ ìàñêà äîëæíà áûòü 1F + àïïàðàòíûé ïåðåêëþ÷àòåëü íà øèíå àäðåñà
|
||||
setprg8(A, (V & 0x0f) | EXPREGS[0]);
|
||||
}
|
||||
|
||||
static void GN45CW(uint32 A, uint8 V) {
|
||||
static void M205CW(uint32 A, uint8 V) {
|
||||
// GN-30A - íà÷àëüíàÿ ìàñêà äîëæíà áûòü FF
|
||||
setchr1(A, (V & 0x7F) | (EXPREGS[0] << 3));
|
||||
}
|
||||
|
||||
static DECLFW(GN45Write0) {
|
||||
static DECLFW(M205Write0) {
|
||||
if (EXPREGS[2] == 0) {
|
||||
EXPREGS[0] = A & 0x30;
|
||||
EXPREGS[2] = A & 0x80;
|
||||
|
@ -1234,7 +1160,7 @@ static DECLFW(GN45Write0) {
|
|||
CartBW(A, V);
|
||||
}
|
||||
|
||||
static DECLFW(GN45Write1) {
|
||||
static DECLFW(M205Write1) {
|
||||
if (EXPREGS[2] == 0) {
|
||||
EXPREGS[0] = V & 0x30;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
|
@ -1243,23 +1169,23 @@ static DECLFW(GN45Write1) {
|
|||
CartBW(A, V);
|
||||
}
|
||||
|
||||
static void GN45Reset(void) {
|
||||
static void M205Reset(void) {
|
||||
EXPREGS[0] = EXPREGS[2] = 0;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
static void GN45Power(void) {
|
||||
static void M205Power(void) {
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x6000, 0x6fff, GN45Write0);
|
||||
SetWriteHandler(0x7000, 0x7fff, GN45Write1); /* OK-411 boards, the same logic, but data latched, 2-in-1 frankenstein */
|
||||
SetWriteHandler(0x6000, 0x6fff, M205Write0);
|
||||
SetWriteHandler(0x7000, 0x7fff, M205Write1); // OK-411 boards, the same logic, but data latched, 2-in-1 frankenstein
|
||||
}
|
||||
|
||||
void GN45_Init(CartInfo *info) {
|
||||
void Mapper205_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 128, 8, 0);
|
||||
pwrap = GN45PW;
|
||||
cwrap = GN45CW;
|
||||
info->Power = GN45Power;
|
||||
info->Reset = GN45Reset;
|
||||
pwrap = M205PW;
|
||||
cwrap = M205CW;
|
||||
info->Power = M205Power;
|
||||
info->Reset = M205Reset;
|
||||
AddExState(EXPREGS, 1, 0, "EXPR");
|
||||
}
|
||||
|
||||
|
@ -1450,7 +1376,6 @@ static DECLFW(M406IRQWrite) {
|
|||
MMC3_IRQWrite((A & 0xFFFE) | ((A & 2) >> 1), V);
|
||||
}
|
||||
|
||||
FCEU_MAYBE_UNUSED
|
||||
static DECLFW(M406Write) {
|
||||
}
|
||||
|
||||
|
|
|
@ -307,7 +307,8 @@ cartdata MMC5CartList[] =
|
|||
|
||||
#define MMC5_NOCARTS (sizeof(MMC5CartList) / sizeof(MMC5CartList[0]))
|
||||
int DetectMMC5WRAMSize(uint32 crc32) {
|
||||
for (size_t x = 0; x < MMC5_NOCARTS; x++) {
|
||||
int x;
|
||||
for (x = 0; x < MMC5_NOCARTS; x++) {
|
||||
if (crc32 == MMC5CartList[x].crc32) {
|
||||
if(MMC5CartList[x].size > 1)
|
||||
FCEU_printf(" >8KB external WRAM present. Use UNIF if you hack the ROM image.\n");
|
||||
|
@ -424,7 +425,7 @@ static void MMC5PRG(void) {
|
|||
switch (mmc5psize & 3) {
|
||||
case 0:
|
||||
MMC5ROMWrProtect[0] = MMC5ROMWrProtect[1] = MMC5ROMWrProtect[2] = MMC5ROMWrProtect[3] = 1;
|
||||
setprg32(0x8000, ((PRGBanks[3] & 0x7F) >> 2));
|
||||
setprg32(0x8000, ((PRGBanks[1] & 0x7F) >> 2));
|
||||
for (x = 0; x < 4; x++)
|
||||
MMC5MemIn[1 + x] = 1;
|
||||
break;
|
||||
|
@ -903,14 +904,14 @@ static void GenMMC5Power(void) {
|
|||
|
||||
PRGBanks.fill(0xFF);
|
||||
WRAMPage = 0;
|
||||
CHRBanksA.fill(0);
|
||||
CHRBanksB.fill(0);
|
||||
CHRBanksA.fill(0xFF);
|
||||
CHRBanksB.fill(0xFF);
|
||||
WRAMMaskEnable.fill(0xFF);
|
||||
mmc5ABMode = 0;
|
||||
IRQScanline = 0;
|
||||
IRQEnable = 0;
|
||||
CHRMode = 0;
|
||||
NTAMirroring = NTFill = ATFill = 0;
|
||||
NTAMirroring = NTFill = ATFill = 0xFF;
|
||||
MMC5IRQR = 0;
|
||||
MMC5LineCounter = 0;
|
||||
mmc5psize = mmc5vsize = 3;
|
||||
|
@ -1021,23 +1022,22 @@ static void GenMMC5_Init(CartInfo *info, int wsize, int battery) {
|
|||
|
||||
MMC5battery = battery;
|
||||
if (battery) {
|
||||
uint32 saveGameSize = 0;
|
||||
info->SaveGame[0] = WRAM;
|
||||
if (info->ines2)
|
||||
{
|
||||
saveGameSize = info->battery_wram_size;
|
||||
info->SaveGameLen[0] = info->battery_wram_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
//this is more complex than it looks because it MUST BE, I guess. is there an assumption that only 8KB of 16KB is battery backed? That's NES mappers for you
|
||||
//I added 64KB for the new 64KB homebrews
|
||||
if (wsize <= 16)
|
||||
saveGameSize = 8192;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
else if(wsize == 64)
|
||||
saveGameSize = 64*1024;
|
||||
info->SaveGameLen[0] = 64*1024;
|
||||
else
|
||||
saveGameSize = 32768;
|
||||
info->SaveGameLen[0] = 32768;
|
||||
}
|
||||
info->addSaveGameBuf( WRAM, saveGameSize );
|
||||
}
|
||||
|
||||
MMC5HackVROMMask = CHRmask4[0];
|
||||
|
|
|
@ -429,8 +429,10 @@ void Mapper19_Init(CartInfo *info) {
|
|||
AddExState(N106_StateRegs, ~0, 0, 0);
|
||||
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, 8192 );
|
||||
info->addSaveGameBuf( IRAM, 128 );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
info->SaveGame[1] = IRAM;
|
||||
info->SaveGameLen[1] = 128;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -320,7 +320,8 @@ void UNLOneBus_Init(CartInfo *info) {
|
|||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,8 @@ void SA9602B_Init(CartInfo *info) {
|
|||
GenMMC3_Init(info, 512, 0, 0, 0);
|
||||
pwrap = SA9602BPW;
|
||||
mmc3opts |= 2;
|
||||
info->addSaveGameBuf( UNIFchrrama, 32 * 1024 );
|
||||
info->SaveGame[0] = UNIFchrrama;
|
||||
info->SaveGameLen[0] = 32 * 1024;
|
||||
info->Power = SA9602BPower;
|
||||
AddExState(EXPREGS, 2, 0, "EXPR");
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ static uint8 preg[8];
|
|||
static uint8 IRQa;
|
||||
static int16 IRQCount, IRQLatch;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint32 WRAMSIZE;
|
||||
/*
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
|
@ -187,7 +187,8 @@ void UNLSB2000_Init(CartInfo *info) {
|
|||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
unsigned int *GetKeyboard(void); // FIXME: 10/28 - now implemented in SDL as well. should we rename this to a FCEUI_* function?
|
||||
|
||||
|
@ -90,7 +90,8 @@ void Transformer_Init(CartInfo *info) {
|
|||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2014 CaitSith2, 2022 Cluster
|
||||
* Copyright (C) 2014 CaitSith2
|
||||
*
|
||||
* 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
|
||||
|
@ -19,7 +19,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Roms still using NES 1.0 format should be loaded as 8K CHR RAM.
|
||||
* Roms still using NES 1.0 format should be loaded as 32K CHR RAM.
|
||||
* Roms defined under NES 2.0 should use the VRAM size field, defining 7, 8 or 9, based on how much VRAM should be present.
|
||||
* UNIF doesn't have this problem, because unique board names can define this information.
|
||||
* The UNIF names are UNROM-512-8K, UNROM-512-16K and UNROM-512-32K
|
||||
|
@ -28,7 +28,6 @@
|
|||
* Known games to use this board are:
|
||||
* Battle Kid 2: Mountain of Torment (512K PRG, 8K CHR RAM, Horizontal Mirroring, Flash disabled)
|
||||
* Study Hall (128K PRG (in 512K flash chip), 8K CHR RAM, Horizontal Mirroring, Flash enabled)
|
||||
* Nix: The Paradox Relic (512 PRG, 8K CHR RAM, Vertical Mirroring, Flash enabled)
|
||||
* Although Xmas 2013 uses a different board, where LEDs can be controlled (with writes to the $8000-BFFF space),
|
||||
* it otherwise functions identically.
|
||||
*/
|
||||
|
@ -36,159 +35,211 @@
|
|||
#include "mapinc.h"
|
||||
#include "../ines.h"
|
||||
|
||||
const int ROM_CHIP = 0x00;
|
||||
const int CFI_CHIP = 0x10;
|
||||
const int FLASH_CHIP = 0x11;
|
||||
|
||||
const int FLASH_SECTOR_SIZE = 4 * 1024;
|
||||
|
||||
static uint8 flash_save, flash_state, flash_id_mode, latche, bus_conflict;
|
||||
static uint8 latche, latcheinit, bus_conflict, chrram_mask, software_id=false;
|
||||
static uint16 latcha;
|
||||
static uint8 *flash_data;
|
||||
static uint16 flash_buffer_a[10];
|
||||
static uint8 flash_buffer_v[10];
|
||||
static uint8 flash_id[2];
|
||||
static uint8 *flashdata;
|
||||
static uint32 *flash_write_count;
|
||||
static uint8 *FlashPage[32];
|
||||
//static uint32 *FlashWriteCountPage[32];
|
||||
//static uint8 flashloaded = false;
|
||||
|
||||
static void UNROM512_Sync() {
|
||||
int chip;
|
||||
if (flash_save)
|
||||
chip = !flash_id_mode ? FLASH_CHIP : CFI_CHIP;
|
||||
static uint8 flash_save=0, flash_state=0, flash_mode=0, flash_bank;
|
||||
static void (*WLSync)(void);
|
||||
static void (*WHSync)(void);
|
||||
|
||||
static INLINE void setfpageptr(int s, uint32 A, uint8 *p) {
|
||||
uint32 AB = A >> 11;
|
||||
int x;
|
||||
|
||||
if (p)
|
||||
for (x = (s >> 1) - 1; x >= 0; x--) {
|
||||
FlashPage[AB + x] = p - A;
|
||||
}
|
||||
else
|
||||
chip = ROM_CHIP;
|
||||
setprg16r(chip, 0x8000, latche);
|
||||
setprg16r(chip, 0xc000, ~0);
|
||||
setchr8(latche >> 5);
|
||||
setmirror(MI_0 + ((latche >> 7) & 1));
|
||||
for (x = (s >> 1) - 1; x >= 0; x--) {
|
||||
FlashPage[AB + x] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void setfprg16(uint32 A, uint32 V) {
|
||||
if (PRGsize[0] >= 16384) {
|
||||
V &= PRGmask16[0];
|
||||
setfpageptr(16, A, flashdata ? (&flashdata[V << 14]) : 0);
|
||||
} else {
|
||||
uint32 VA = V << 3;
|
||||
int x;
|
||||
|
||||
for (x = 0; x < 8; x++)
|
||||
setfpageptr(2, A + (x << 11), flashdata ? (&flashdata[((VA + x) & PRGmask2[0]) << 11]) : 0);
|
||||
}
|
||||
}
|
||||
|
||||
void inc_flash_write_count(uint8 bank, uint32 A)
|
||||
{
|
||||
flash_write_count[(bank*4) + ((A&0x3000)>>12)]++;
|
||||
if(!flash_write_count[(bank*4) + ((A&0x3000)>>12)])
|
||||
flash_write_count[(bank*4) + ((A&0x3000)>>12)]++;
|
||||
}
|
||||
|
||||
uint32 GetFlashWriteCount(uint8 bank, uint32 A)
|
||||
{
|
||||
return flash_write_count[(bank*4) + ((A&0x3000)>>12)];
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
UNROM512_Sync();
|
||||
WHSync();
|
||||
}
|
||||
|
||||
static DECLFW(UNROM512FlashWrite)
|
||||
static DECLFW(UNROM512LLatchWrite)
|
||||
{
|
||||
if (flash_state < sizeof(flash_buffer_a) / sizeof(flash_buffer_a[0])) {
|
||||
flash_buffer_a[flash_state] = (A & 0x3FFF) | ((latche & 1) << 14);
|
||||
flash_buffer_v[flash_state] = V;
|
||||
flash_state++;
|
||||
|
||||
// enter flash ID mode
|
||||
if ((flash_state == 2) &&
|
||||
(flash_buffer_a[0] == 0x5555) && (flash_buffer_v[0] == 0xAA) &&
|
||||
(flash_buffer_a[1] == 0x2AAA) && (flash_buffer_v[1] == 0x55) &&
|
||||
(flash_buffer_a[1] == 0x5555) && (flash_buffer_v[1] == 0x90)) {
|
||||
flash_id_mode = 0;
|
||||
flash_state = 0;
|
||||
}
|
||||
|
||||
// erase sector
|
||||
if ((flash_state == 6) &&
|
||||
(flash_buffer_a[0] == 0x5555) && (flash_buffer_v[0] == 0xAA) &&
|
||||
(flash_buffer_a[1] == 0x2AAA) && (flash_buffer_v[1] == 0x55) &&
|
||||
(flash_buffer_a[2] == 0x5555) && (flash_buffer_v[2] == 0x80) &&
|
||||
(flash_buffer_a[3] == 0x5555) && (flash_buffer_v[3] == 0xAA) &&
|
||||
(flash_buffer_a[4] == 0x2AAA) && (flash_buffer_v[4] == 0x55) &&
|
||||
(flash_buffer_v[5] == 0x30)) {
|
||||
int offset = &Page[A >> 11][A] - flash_data;
|
||||
int sector = offset / FLASH_SECTOR_SIZE;
|
||||
for (int i = sector * FLASH_SECTOR_SIZE; i < (sector + 1) * FLASH_SECTOR_SIZE; i++)
|
||||
flash_data[i % PRGsize[ROM_CHIP]] = 0xFF;
|
||||
FCEU_printf("Flash sector #%d is erased (0x%08x - 0x%08x).\n", sector, offset, offset + FLASH_SECTOR_SIZE);
|
||||
}
|
||||
|
||||
// erase chip
|
||||
if ((flash_state == 6) &&
|
||||
(flash_buffer_a[0] == 0x5555) && (flash_buffer_v[0] == 0xAA) &&
|
||||
(flash_buffer_a[1] == 0x2AAA) && (flash_buffer_v[1] == 0x55) &&
|
||||
(flash_buffer_a[2] == 0x5555) && (flash_buffer_v[2] == 0x80) &&
|
||||
(flash_buffer_a[3] == 0x5555) && (flash_buffer_v[3] == 0xAA) &&
|
||||
(flash_buffer_a[4] == 0x2AAA) && (flash_buffer_v[4] == 0x55) &&
|
||||
(flash_buffer_a[4] == 0x5555) && (flash_buffer_v[4] == 0x10)) {
|
||||
memset(flash_data, 0xFF, PRGsize[ROM_CHIP]);
|
||||
FCEU_printf("Flash chip erased.\n");
|
||||
flash_state = 0;
|
||||
}
|
||||
|
||||
// write byte
|
||||
if ((flash_state == 4) &&
|
||||
(flash_buffer_a[0] == 0x5555) && (flash_buffer_v[0] == 0xAA) &&
|
||||
(flash_buffer_a[1] == 0x2AAA) && (flash_buffer_v[1] == 0x55) &&
|
||||
(flash_buffer_a[2] == 0x5555) && (flash_buffer_v[2] == 0xA0)) {
|
||||
int offset = &Page[A >> 11][A] - flash_data;
|
||||
if (CartBR(A) != 0xFF) {
|
||||
FCEU_PrintError("Error: can't write to 0x%08x, flash sector is not erased.\n", offset);
|
||||
}
|
||||
else {
|
||||
CartBW(A, V);
|
||||
}
|
||||
flash_state = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// not a command
|
||||
if (((A & 0xFFF) != 0x0AAA) && ((A & 0xFFF) != 0x0555)) {
|
||||
flash_state = 0;
|
||||
}
|
||||
|
||||
// reset
|
||||
if (V == 0xF0) {
|
||||
flash_state = 0;
|
||||
flash_id_mode = 0;
|
||||
}
|
||||
|
||||
UNROM512_Sync();
|
||||
latche = V;
|
||||
latcha = A;
|
||||
WLSync();
|
||||
}
|
||||
|
||||
static DECLFW(UNROM512HLatchWrite)
|
||||
{
|
||||
if (bus_conflict)
|
||||
latche = V & CartBR(A);
|
||||
latche = (V == CartBR(A)) ? V : 0;
|
||||
else
|
||||
latche = V;
|
||||
latcha = A;
|
||||
UNROM512_Sync();
|
||||
WHSync();
|
||||
}
|
||||
|
||||
static DECLFR(UNROM512LatchRead)
|
||||
{
|
||||
uint8 flash_id[3]={0xB5,0xB6,0xB7};
|
||||
if(software_id)
|
||||
{
|
||||
if(A&1)
|
||||
return flash_id[ROM_size>>4];
|
||||
else
|
||||
return 0xBF;
|
||||
}
|
||||
if(flash_save)
|
||||
{
|
||||
if(A < 0xC000)
|
||||
{
|
||||
if(GetFlashWriteCount(flash_bank,A))
|
||||
return FlashPage[A >> 11][A];
|
||||
}
|
||||
else
|
||||
{
|
||||
if(GetFlashWriteCount(ROM_size-1,A))
|
||||
return FlashPage[A >> 11][A];
|
||||
}
|
||||
}
|
||||
return Page[A >> 11][A];
|
||||
}
|
||||
|
||||
static void UNROM512LatchPower(void) {
|
||||
latche = 0;
|
||||
UNROM512_Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
latche = latcheinit;
|
||||
WHSync();
|
||||
SetReadHandler(0x8000, 0xFFFF, UNROM512LatchRead);
|
||||
if(!flash_save)
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNROM512HLatchWrite);
|
||||
else
|
||||
{
|
||||
SetWriteHandler(0x8000,0xBFFF,UNROM512FlashWrite);
|
||||
SetWriteHandler(0x8000,0xBFFF,UNROM512LLatchWrite);
|
||||
SetWriteHandler(0xC000,0xFFFF,UNROM512HLatchWrite);
|
||||
}
|
||||
}
|
||||
|
||||
static void UNROM512LatchClose(void) {
|
||||
if(flash_data)
|
||||
FCEU_gfree(flash_data);
|
||||
flash_data = NULL;
|
||||
if(flash_write_count)
|
||||
FCEU_gfree(flash_write_count);
|
||||
if(flashdata)
|
||||
FCEU_gfree(flashdata);
|
||||
flash_write_count = NULL;
|
||||
flashdata = NULL;
|
||||
}
|
||||
|
||||
static void UNROM512_FlashReset(void)
|
||||
{
|
||||
if (flash_data)
|
||||
|
||||
static void UNROM512LSync() {
|
||||
int erase_a[5]={0x9555,0xAAAA,0x9555,0x9555,0xAAAA};
|
||||
int erase_d[5]={0xAA,0x55,0x80,0xAA,0x55};
|
||||
int erase_b[5]={1,0,1,1,0};
|
||||
|
||||
if(flash_mode==0)
|
||||
{
|
||||
size_t flash_size = PRGsize[ROM_CHIP];
|
||||
// Copy ROM to flash data
|
||||
for (size_t i = 0; i < flash_size; i++) {
|
||||
flash_data[i] = PRGptr[ROM_CHIP][i];
|
||||
if((latcha == erase_a[flash_state]) && (latche == erase_d[flash_state]) && (flash_bank == erase_b[flash_state]))
|
||||
{
|
||||
flash_state++;
|
||||
if(flash_state == 5)
|
||||
{
|
||||
flash_mode=1;
|
||||
}
|
||||
}
|
||||
else if ((flash_state==2)&&(latcha==0x9555)&&(latche==0xA0)&&(flash_bank==1))
|
||||
{
|
||||
flash_state++;
|
||||
flash_mode=2;
|
||||
}
|
||||
else if ((flash_state==2)&&(latcha==0x9555)&&(latche==0x90)&&(flash_bank==1))
|
||||
{
|
||||
flash_state=0;
|
||||
software_id=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(latche==0xF0)
|
||||
software_id=false;
|
||||
flash_state=0;
|
||||
}
|
||||
}
|
||||
else if(flash_mode==1) //Chip Erase or Sector Erase
|
||||
{
|
||||
if(latche==0x30)
|
||||
{
|
||||
inc_flash_write_count(flash_bank,latcha);
|
||||
memset(&FlashPage[(latcha & 0xF000) >> 11][latcha & 0xF000],0xFF,0x1000);
|
||||
}
|
||||
else if (latche==0x10)
|
||||
{
|
||||
for(uint32 i=0;i<(ROM_size*4);i++)
|
||||
inc_flash_write_count(i>>2,i<<12);
|
||||
memset(flashdata,0xFF,ROM_size*0x4000); //Erasing the rom chip as instructed. Crash rate calulated to be 99.9% :)
|
||||
}
|
||||
flash_state=0;
|
||||
flash_mode=0;
|
||||
}
|
||||
else if(flash_mode==2) //Byte Program
|
||||
{
|
||||
if(!GetFlashWriteCount(flash_bank,latcha))
|
||||
{
|
||||
inc_flash_write_count(flash_bank,latcha);
|
||||
memcpy(&FlashPage[(latcha & 0xF000) >> 11][latcha & 0xF000],&Page[(latcha & 0xF000)>>11][latcha & 0xF000],0x1000);
|
||||
}
|
||||
FlashPage[latcha>>11][latcha]&=latche;
|
||||
flash_state=0;
|
||||
flash_mode=0;
|
||||
}
|
||||
}
|
||||
|
||||
void UNROM512_Init(CartInfo *info) {
|
||||
info->Power = UNROM512LatchPower;
|
||||
info->Close = UNROM512LatchClose;
|
||||
GameStateRestore = StateRestore;
|
||||
static void UNROM512HSync()
|
||||
{
|
||||
flash_bank=latche&(ROM_size-1);
|
||||
|
||||
setprg16(0x8000, flash_bank);
|
||||
setprg16(0xc000, ~0);
|
||||
setfprg16(0x8000, flash_bank);
|
||||
setfprg16(0xC000, ~0);
|
||||
setchr8r(0, (latche & chrram_mask) >> 5);
|
||||
setmirror(MI_0+(latche>>7));
|
||||
}
|
||||
|
||||
flash_state = 0;
|
||||
flash_id_mode = 0;
|
||||
flash_save = info->battery;
|
||||
bus_conflict = !info->battery; // Is it required by any game?
|
||||
void UNROM512_Init(CartInfo *info) {
|
||||
flash_state=0;
|
||||
flash_bank=0;
|
||||
flash_save=info->battery;
|
||||
|
||||
if(info->vram_size == 8192)
|
||||
chrram_mask = 0;
|
||||
else if (info->vram_size == 16384)
|
||||
chrram_mask = 0x20;
|
||||
else
|
||||
chrram_mask = 0x60;
|
||||
|
||||
int mirror = (head.ROM_type & 1) | ((head.ROM_type & 8) >> 2);
|
||||
switch (mirror)
|
||||
|
@ -207,29 +258,28 @@ void UNROM512_Init(CartInfo *info) {
|
|||
break;
|
||||
}
|
||||
|
||||
bus_conflict = !info->battery;
|
||||
latcheinit = 0;
|
||||
WLSync = UNROM512LSync;
|
||||
WHSync = UNROM512HSync;
|
||||
info->Power = UNROM512LatchPower;
|
||||
info->Close = UNROM512LatchClose;
|
||||
GameStateRestore = StateRestore;
|
||||
if(flash_save)
|
||||
{
|
||||
// Allocate memory for flash
|
||||
size_t flash_size = PRGsize[ROM_CHIP];
|
||||
flash_data = (uint8*)FCEU_gmalloc(flash_size);
|
||||
// Copy ROM to flash data
|
||||
for (size_t i = 0; i < flash_size; i++) {
|
||||
flash_data[i] = PRGptr[ROM_CHIP][i];
|
||||
}
|
||||
SetupCartPRGMapping(FLASH_CHIP, flash_data, flash_size, 1);
|
||||
info->addSaveGameBuf( flash_data, flash_size, UNROM512_FlashReset );
|
||||
|
||||
flash_id[0] = 0xBF;
|
||||
flash_id[1] = 0xB5 + (ROM_size >> 4);
|
||||
SetupCartPRGMapping(CFI_CHIP, flash_id, sizeof(flash_id), 0);
|
||||
|
||||
AddExState(flash_data, flash_size, 0, "FLSH");
|
||||
AddExState(&flash_state, sizeof(flash_state), 0, "FLST");
|
||||
AddExState(&flash_id_mode, sizeof(flash_id_mode), 0, "FLMD");
|
||||
AddExState(flash_buffer_a, sizeof(flash_buffer_a), 0, "FLBA");
|
||||
AddExState(flash_buffer_v, sizeof(flash_buffer_v), 0, "FLBV");
|
||||
flashdata = (uint8*)FCEU_gmalloc(ROM_size*0x4000);
|
||||
flash_write_count = (uint32*)FCEU_gmalloc(ROM_size*4*sizeof(uint32));
|
||||
info->SaveGame[0] = (uint8*)flash_write_count;
|
||||
info->SaveGame[1] = flashdata;
|
||||
info->SaveGameLen[0] = ROM_size*4*sizeof(uint32);
|
||||
info->SaveGameLen[1] = ROM_size*0x4000;
|
||||
AddExState(flash_write_count,ROM_size*4*sizeof(uint32),0,"FLASH_WRITE_COUNT");
|
||||
AddExState(flashdata,ROM_size*0x4000,0,"FLASH_DATA");
|
||||
AddExState(&flash_state,1,0,"FLASH_STATE");
|
||||
AddExState(&flash_mode,1,0,"FLASH_MODE");
|
||||
AddExState(&flash_bank,1,0,"FLASH_BANK");
|
||||
AddExState(&latcha,2,0,"LATA");
|
||||
}
|
||||
AddExState(&latcha, sizeof(latcha), 0, "LATA");
|
||||
AddExState(&latche, sizeof(latche), 0, "LATC");
|
||||
AddExState(&bus_conflict, sizeof(bus_conflict), 0, "BUSC");
|
||||
AddExState(&latche, 1, 0, "LATC");
|
||||
AddExState(&bus_conflict, 1, 0, "BUSC");
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
static bool isPirate;
|
||||
static uint8 is22, reg1mask, reg2mask;
|
||||
static uint16 IRQCount;
|
||||
static uint8 IRQLatch, IRQa, IRQMode;
|
||||
static uint8 IRQLatch, IRQa;
|
||||
static uint8 prgreg[2], chrreg[8];
|
||||
static uint16 chrhi[8];
|
||||
static uint8 regcmd, irqcmd, mirr, big_bank;
|
||||
|
@ -45,7 +45,6 @@ static SFORMAT StateRegs[] =
|
|||
{ &IRQCount, 2, "IRQC" },
|
||||
{ &IRQLatch, 1, "IRQL" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQMode, 1, "IRQM" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
|
@ -116,7 +115,7 @@ static DECLFW(VRC24Write) {
|
|||
case 0x9003: regcmd = V; Sync(); break;
|
||||
case 0xF000: X6502_IRQEnd(FCEU_IQEXT); IRQLatch &= 0xF0; IRQLatch |= V & 0xF; break;
|
||||
case 0xF001: X6502_IRQEnd(FCEU_IQEXT); IRQLatch &= 0x0F; IRQLatch |= V << 4; break;
|
||||
case 0xF002: X6502_IRQEnd(FCEU_IQEXT); acount = 0; IRQCount = IRQLatch; IRQMode = V & 4; IRQa = V & 2; irqcmd = V & 1; break;
|
||||
case 0xF002: X6502_IRQEnd(FCEU_IQEXT); acount = 0; IRQCount = IRQLatch; IRQa = V & 2; irqcmd = V & 1; break;
|
||||
case 0xF003: X6502_IRQEnd(FCEU_IQEXT); IRQa = irqcmd; break;
|
||||
}
|
||||
}
|
||||
|
@ -137,28 +136,16 @@ static void VRC24Power(void) {
|
|||
void VRC24IRQHook(int a) {
|
||||
#define LCYCS 341
|
||||
if (IRQa) {
|
||||
if (IRQMode) {
|
||||
acount += a;
|
||||
while (acount > 0) {
|
||||
acount--;
|
||||
acount += a * 3;
|
||||
if (acount >= LCYCS) {
|
||||
while (acount >= LCYCS) {
|
||||
acount -= LCYCS;
|
||||
IRQCount++;
|
||||
if (IRQCount & 0x100) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQCount = IRQLatch;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
acount += a * 3;
|
||||
if (acount >= LCYCS) {
|
||||
while (acount >= LCYCS) {
|
||||
acount -= LCYCS;
|
||||
IRQCount++;
|
||||
if (IRQCount & 0x100) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQCount = IRQLatch;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +172,8 @@ static void VRC24_Init(CartInfo *info) {
|
|||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
if(info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0]=WRAM;
|
||||
info->SaveGameLen[0]=WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -254,10 +254,11 @@ void QTAi_Init(CartInfo *info) {
|
|||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
// note, only extrnal cart's SRAM is battery backed, the the part on the main cartridge is just
|
||||
// an additional work ram. so we may save only half here, but I forgot what part is saved lol, will
|
||||
// find out later.
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
|
||||
static uint8 is26;
|
||||
static uint8 prg[2], chr[8], mirr;
|
||||
static uint8 IRQLatch, IRQa, IRQd, IRQMode;
|
||||
static uint8 IRQLatch, IRQa, IRQd;
|
||||
static int32 IRQCount, CycleCount;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
|
@ -40,7 +40,6 @@ static SFORMAT StateRegs[] =
|
|||
{ &IRQLatch, 1, "IRQL" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &CycleCount, 4, "CYCC" },
|
||||
{ &IRQMode, 1, "IRQM" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
|
@ -110,7 +109,6 @@ static DECLFW(VRC6Write) {
|
|||
case 0xE003: chr[7] = V; Sync(); break;
|
||||
case 0xF000: IRQLatch = V; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xF001:
|
||||
IRQMode = V & 4;
|
||||
IRQa = V & 2;
|
||||
IRQd = V & 1;
|
||||
if (V & 2)
|
||||
|
@ -134,25 +132,13 @@ static void VRC6Power(void) {
|
|||
|
||||
static void VRC6IRQHook(int a) {
|
||||
if (IRQa) {
|
||||
if (IRQMode) {
|
||||
CycleCount += a;
|
||||
while (CycleCount > 0) {
|
||||
CycleCount--;
|
||||
IRQCount++;
|
||||
if (IRQCount & 0x100) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQCount = IRQLatch;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CycleCount += a * 3;
|
||||
while(CycleCount >= 341) {
|
||||
CycleCount -= 341;
|
||||
IRQCount++;
|
||||
if (IRQCount == 0x100) {
|
||||
IRQCount = IRQLatch;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
CycleCount += a * 3;
|
||||
while(CycleCount >= 341) {
|
||||
CycleCount -= 341;
|
||||
IRQCount++;
|
||||
if (IRQCount == 0x100) {
|
||||
IRQCount = IRQLatch;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -379,7 +365,8 @@ void Mapper26_Init(CartInfo *info) {
|
|||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 vrc7idx, preg[3], creg[8], mirr;
|
||||
static uint8 IRQLatch, IRQa, IRQd, IRQMode;
|
||||
static uint8 IRQLatch, IRQa, IRQd;
|
||||
static int32 IRQCount, CycleCount;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE=0;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
#include "emu2413.h"
|
||||
|
||||
|
@ -44,7 +44,6 @@ static SFORMAT StateRegs[] =
|
|||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &CycleCount, 4, "CYCC" },
|
||||
{ (void**)VRC7Sound_saveptr, sizeof(*VRC7Sound) | FCEUSTATE_INDIRECT, "VRC7" },
|
||||
{ &IRQMode, 1, "IRQM" },
|
||||
{0}
|
||||
};
|
||||
|
||||
|
@ -135,7 +134,6 @@ static DECLFW(VRC7Write) {
|
|||
case 0xE000: mirr = V & 3; Sync(); break;
|
||||
case 0xE010: IRQLatch = V; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xF000:
|
||||
IRQMode = V & 4;
|
||||
IRQa = V & 2;
|
||||
IRQd = V & 1;
|
||||
if (V & 2)
|
||||
|
@ -167,25 +165,13 @@ static void VRC7Close(void)
|
|||
|
||||
static void VRC7IRQHook(int a) {
|
||||
if (IRQa) {
|
||||
if (IRQMode) {
|
||||
CycleCount += a;
|
||||
while (CycleCount > 0) {
|
||||
CycleCount--;
|
||||
IRQCount++;
|
||||
if (IRQCount & 0x100) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQCount = IRQLatch;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CycleCount += a * 3;
|
||||
while(CycleCount >= 341) {
|
||||
CycleCount -= 341;
|
||||
IRQCount++;
|
||||
if (IRQCount == 0x100) {
|
||||
IRQCount = IRQLatch;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
CycleCount += a * 3;
|
||||
while(CycleCount >= 341) {
|
||||
CycleCount -= 341;
|
||||
IRQCount++;
|
||||
if (IRQCount == 0x100) {
|
||||
IRQCount = IRQLatch;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -204,7 +190,8 @@ void Mapper85_Init(CartInfo *info) {
|
|||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
if (info->battery) {
|
||||
info->addSaveGameBuf( WRAM, WRAMSIZE );
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
GameStateRestore = StateRestore;
|
||||
VRC7_ESI();
|
||||
|
|
68
src/cart.cpp
68
src/cart.cpp
|
@ -536,28 +536,19 @@ void FCEU_GeniePower(void) {
|
|||
}
|
||||
|
||||
|
||||
void FCEU_SaveGameSave(CartInfo *LocalHWInfo)
|
||||
{
|
||||
if (LocalHWInfo->battery && !LocalHWInfo->SaveGame.empty())
|
||||
{
|
||||
void FCEU_SaveGameSave(CartInfo *LocalHWInfo) {
|
||||
if (LocalHWInfo->battery && LocalHWInfo->SaveGame[0]) {
|
||||
FILE *sp;
|
||||
|
||||
std::string soot = FCEU_MakeFName(FCEUMKF_SAV, 0, "sav");
|
||||
if ((sp = FCEUD_UTF8fopen(soot, "wb")) == NULL)
|
||||
{
|
||||
if ((sp = FCEUD_UTF8fopen(soot, "wb")) == NULL) {
|
||||
FCEU_PrintError("WRAM file \"%s\" cannot be written to.\n", soot.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t x = 0; x < LocalHWInfo->SaveGame.size(); x++)
|
||||
{
|
||||
if (LocalHWInfo->SaveGame[x].bufptr)
|
||||
{
|
||||
fwrite(LocalHWInfo->SaveGame[x].bufptr, 1,
|
||||
LocalHWInfo->SaveGame[x].buflen, sp);
|
||||
} else {
|
||||
for (int x = 0; x < 4; x++)
|
||||
if (LocalHWInfo->SaveGame[x]) {
|
||||
fwrite(LocalHWInfo->SaveGame[x], 1,
|
||||
LocalHWInfo->SaveGameLen[x], sp);
|
||||
}
|
||||
}
|
||||
fclose(sp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -565,46 +556,25 @@ void FCEU_SaveGameSave(CartInfo *LocalHWInfo)
|
|||
// hack, movie.cpp has to communicate with this function somehow
|
||||
int disableBatteryLoading = 0;
|
||||
|
||||
void FCEU_LoadGameSave(CartInfo *LocalHWInfo)
|
||||
{
|
||||
if (LocalHWInfo->battery && !LocalHWInfo->SaveGame.empty() && !disableBatteryLoading)
|
||||
{
|
||||
void FCEU_LoadGameSave(CartInfo *LocalHWInfo) {
|
||||
if (LocalHWInfo->battery && LocalHWInfo->SaveGame[0] && !disableBatteryLoading) {
|
||||
FILE *sp;
|
||||
|
||||
std::string soot = FCEU_MakeFName(FCEUMKF_SAV, 0, "sav");
|
||||
sp = FCEUD_UTF8fopen(soot, "rb");
|
||||
if (sp != NULL)
|
||||
{
|
||||
for (size_t x = 0; x < LocalHWInfo->SaveGame.size(); x++)
|
||||
{
|
||||
if (LocalHWInfo->SaveGame[x].bufptr)
|
||||
{
|
||||
if ( fread(LocalHWInfo->SaveGame[x].bufptr, 1, LocalHWInfo->SaveGame[x].buflen, sp) != LocalHWInfo->SaveGame[x].buflen )
|
||||
{
|
||||
FCEU_printf("Warning save game data read came up short!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(sp);
|
||||
if (sp != NULL) {
|
||||
for (int x = 0; x < 4; x++)
|
||||
if (LocalHWInfo->SaveGame[x])
|
||||
fread(LocalHWInfo->SaveGame[x], 1, LocalHWInfo->SaveGameLen[x], sp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//clears all save memory. call this if you want to pretend the saveram has been reset (it doesnt touch what is on disk though)
|
||||
void FCEU_ClearGameSave(CartInfo *LocalHWInfo)
|
||||
{
|
||||
if (LocalHWInfo->battery && !LocalHWInfo->SaveGame.empty())
|
||||
{
|
||||
for (size_t x = 0; x < LocalHWInfo->SaveGame.size(); x++)
|
||||
{
|
||||
if (LocalHWInfo->SaveGame[x].bufptr)
|
||||
{
|
||||
memset(LocalHWInfo->SaveGame[x].bufptr, 0, LocalHWInfo->SaveGame[x].buflen);
|
||||
}
|
||||
if (LocalHWInfo->SaveGame[x].resetFunc)
|
||||
{
|
||||
LocalHWInfo->SaveGame[x].resetFunc();
|
||||
}
|
||||
}
|
||||
void FCEU_ClearGameSave(CartInfo *LocalHWInfo) {
|
||||
if (LocalHWInfo->battery && LocalHWInfo->SaveGame[0]) {
|
||||
for (int x = 0; x < 4; x++)
|
||||
if (LocalHWInfo->SaveGame[x])
|
||||
memset(LocalHWInfo->SaveGame[x], 0, LocalHWInfo->SaveGameLen[x]);
|
||||
}
|
||||
}
|
||||
|
|
67
src/cart.h
67
src/cart.h
|
@ -1,45 +1,20 @@
|
|||
#ifndef CART_H
|
||||
#define CART_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
struct CartInfo
|
||||
{
|
||||
typedef struct {
|
||||
// Set by mapper/board code:
|
||||
void (*Power)(void);
|
||||
void (*Reset)(void);
|
||||
void (*Close)(void);
|
||||
|
||||
struct SaveGame_t
|
||||
{
|
||||
uint8 *bufptr; // Pointer to memory to save/load.
|
||||
uint32 buflen; // How much memory to save/load.
|
||||
void (*resetFunc)(void); // Callback to reset save game memory
|
||||
|
||||
SaveGame_t(void)
|
||||
: bufptr(nullptr), buflen(0), resetFunc(nullptr)
|
||||
{
|
||||
}
|
||||
};
|
||||
std::vector <SaveGame_t> SaveGame;
|
||||
|
||||
void addSaveGameBuf( uint8* bufptrIn, uint32 buflenIn, void (*resetFuncIn)(void) = nullptr )
|
||||
{
|
||||
SaveGame_t tmp;
|
||||
|
||||
tmp.bufptr = bufptrIn;
|
||||
tmp.buflen = buflenIn;
|
||||
tmp.resetFunc = resetFuncIn;
|
||||
|
||||
SaveGame.push_back( tmp );
|
||||
}
|
||||
uint8 *SaveGame[4]; // Pointers to memory to save/load.
|
||||
uint32 SaveGameLen[4]; // How much memory to save/load.
|
||||
|
||||
// Set by iNES/UNIF loading code.
|
||||
int mirror; // As set in the header or chunk.
|
||||
// iNES/UNIF specific. Intended
|
||||
// to help support games like "Karnov"
|
||||
// that are not really MMC3 but are
|
||||
// set to mapper 4.
|
||||
// iNES/UNIF specific. Intended
|
||||
// to help support games like "Karnov"
|
||||
// that are not really MMC3 but are
|
||||
// set to mapper 4.
|
||||
int mirrorAs2Bits;
|
||||
int battery; // Presence of an actual battery.
|
||||
int ines2;
|
||||
|
@ -52,33 +27,7 @@ struct CartInfo
|
|||
uint32 CRC32; // Should be set by the iNES/UNIF loading
|
||||
// code, used by mapper/board code, maybe
|
||||
// other code in the future.
|
||||
|
||||
CartInfo(void)
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
void clear(void)
|
||||
{
|
||||
Power = nullptr;
|
||||
Reset = nullptr;
|
||||
Close = nullptr;
|
||||
|
||||
SaveGame.clear();
|
||||
|
||||
mirror = 0;
|
||||
mirrorAs2Bits = 0;
|
||||
battery = 0;
|
||||
ines2 = 0;
|
||||
submapper = 0;
|
||||
wram_size = 0;
|
||||
battery_wram_size = 0;
|
||||
vram_size = 0;
|
||||
battery_vram_size = 0;
|
||||
memset( MD5, 0, sizeof(MD5));
|
||||
CRC32 = 0;
|
||||
};
|
||||
};
|
||||
} CartInfo;
|
||||
|
||||
extern CartInfo *currCartInfo;
|
||||
|
||||
|
|
|
@ -58,17 +58,8 @@ void FCEU_CheatAddRAM(int s, uint32 A, uint8 *p)
|
|||
CheatRPtrs[AB+x]=p-A;
|
||||
}
|
||||
|
||||
// Cheat change event callback. Called whenever cheat map is changed or recalculated.
|
||||
static void (*cheatsChangeEventCB)(void*) = nullptr;
|
||||
static void* cheatsChangeEventUserData = nullptr;
|
||||
|
||||
void FCEU_SetCheatChangeEventCallback( void (*func)(void*), void* userData )
|
||||
{
|
||||
cheatsChangeEventCB = func;
|
||||
cheatsChangeEventUserData = userData;
|
||||
}
|
||||
|
||||
CHEATF_SUBFAST SubCheats[256];
|
||||
CHEATF_SUBFAST SubCheats[256] = { 0 };
|
||||
uint32 numsubcheats = 0;
|
||||
int globalCheatDisabled = 0;
|
||||
int disableAutoLSCheats = 0;
|
||||
|
@ -141,11 +132,6 @@ void RebuildSubCheats(void)
|
|||
}
|
||||
FrozenAddressCount = numsubcheats; //Update the frozen address list
|
||||
|
||||
// Notify the system of a change
|
||||
if (cheatsChangeEventCB != nullptr)
|
||||
{
|
||||
cheatsChangeEventCB( cheatsChangeEventUserData );
|
||||
}
|
||||
}
|
||||
|
||||
void FCEU_PowerCheats()
|
||||
|
@ -382,15 +368,12 @@ void FCEU_FlushGameCheats(FILE *override, int nosave)
|
|||
}
|
||||
|
||||
|
||||
int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int type, int status, bool rebuild)
|
||||
int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int type)
|
||||
{
|
||||
AddCheatEntry(name, addr, val, compare, status, type);
|
||||
AddCheatEntry(name, addr, val, compare, 1, type);
|
||||
savecheats = 1;
|
||||
RebuildSubCheats();
|
||||
|
||||
if (rebuild)
|
||||
{
|
||||
RebuildSubCheats();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -661,7 +644,7 @@ int FCEUI_ToggleCheat(uint32 which)
|
|||
|
||||
int FCEUI_GlobalToggleCheat(int global_enabled)
|
||||
{
|
||||
unsigned int _numsubcheats = numsubcheats;
|
||||
int _numsubcheats = numsubcheats;
|
||||
globalCheatDisabled = !global_enabled;
|
||||
RebuildSubCheats();
|
||||
return _numsubcheats != numsubcheats;
|
||||
|
|
12
src/cheat.h
12
src/cheat.h
|
@ -33,20 +33,12 @@ extern int disableAutoLSCheats;
|
|||
int FCEU_DisableAllCheats(void);
|
||||
int FCEU_DeleteAllCheats(void);
|
||||
|
||||
void FCEU_SetCheatChangeEventCallback( void (*func)(void*) = nullptr, void* userData = nullptr );
|
||||
|
||||
struct CHEATF_SUBFAST
|
||||
{
|
||||
typedef struct {
|
||||
uint16 addr;
|
||||
uint8 val;
|
||||
int compare;
|
||||
readfunc PrevRead;
|
||||
|
||||
CHEATF_SUBFAST(void)
|
||||
{
|
||||
addr = 0; val = 0; compare = 0; PrevRead = nullptr;
|
||||
}
|
||||
};
|
||||
} CHEATF_SUBFAST;
|
||||
|
||||
struct CHEATF {
|
||||
struct CHEATF *next;
|
||||
|
|
|
@ -52,17 +52,17 @@
|
|||
#include <cctype>
|
||||
|
||||
uint16 debugLastAddress = 0; // used by 'T' and 'R' conditions
|
||||
uint8 debugLastOpcode = 0; // used to evaluate 'W' condition
|
||||
uint8 debugLastOpcode; // used to evaluate 'W' condition
|
||||
|
||||
// Next non-whitespace character in string
|
||||
static char next = 0;
|
||||
char next;
|
||||
|
||||
static int ishex(char c)
|
||||
int ishex(char c)
|
||||
{
|
||||
return isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
|
||||
}
|
||||
|
||||
static void scan(const char** str)
|
||||
void scan(const char** str)
|
||||
{
|
||||
do
|
||||
{
|
||||
|
@ -71,37 +71,40 @@ static void scan(const char** str)
|
|||
} while (isspace(next));
|
||||
}
|
||||
|
||||
// Frees a condition and all of it's sub conditions
|
||||
void freeTree(Condition* c)
|
||||
{
|
||||
if (c->lhs) freeTree(c->lhs);
|
||||
if (c->rhs) freeTree(c->rhs);
|
||||
|
||||
free(c);
|
||||
}
|
||||
|
||||
// Generic function to handle all infix operators but the last one in the precedence hierarchy. : '(' E ')'
|
||||
static Condition* InfixOperator(const char** str, Condition(*nextPart(const char**)), int(*operators)(const char**))
|
||||
Condition* InfixOperator(const char** str, Condition(*nextPart(const char**)), int(*operators)(const char**))
|
||||
{
|
||||
Condition* t = nextPart(str);
|
||||
Condition* t1;
|
||||
Condition* mid;
|
||||
int op;
|
||||
|
||||
if (t == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
while ((op = operators(str)))
|
||||
{
|
||||
scan(str);
|
||||
|
||||
t1 = nextPart(str);
|
||||
|
||||
if (t1 == nullptr)
|
||||
if (t1 == 0)
|
||||
{
|
||||
delete t;
|
||||
if(t)
|
||||
freeTree(t);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mid = new Condition();
|
||||
if (mid == nullptr)
|
||||
{
|
||||
delete t;
|
||||
delete t1;
|
||||
return nullptr;
|
||||
}
|
||||
mid = (Condition*)FCEU_dmalloc(sizeof(Condition));
|
||||
if (!mid)
|
||||
return NULL;
|
||||
memset(mid, 0, sizeof(Condition));
|
||||
|
||||
mid->lhs = t;
|
||||
mid->rhs = t1;
|
||||
|
@ -114,7 +117,7 @@ static Condition* InfixOperator(const char** str, Condition(*nextPart(const char
|
|||
}
|
||||
|
||||
// Generic handler for two-character operators
|
||||
static int TwoCharOperator(const char** str, char c1, char c2, int op)
|
||||
int TwoCharOperator(const char** str, char c1, char c2, int op)
|
||||
{
|
||||
if (next == c1 && **str == c2)
|
||||
{
|
||||
|
@ -128,43 +131,43 @@ static int TwoCharOperator(const char** str, char c1, char c2, int op)
|
|||
}
|
||||
|
||||
// Determines if a character is a flag
|
||||
static int isFlag(char c)
|
||||
int isFlag(char c)
|
||||
{
|
||||
return c == 'N' || c == 'I' || c == 'C' || c == 'V' || c == 'Z' || c == 'B' || c == 'U' || c == 'D';
|
||||
}
|
||||
|
||||
// Determines if a character is a register
|
||||
static int isRegister(char c)
|
||||
int isRegister(char c)
|
||||
{
|
||||
return c == 'A' || c == 'X' || c == 'Y' || c == 'P' || c == 'S';
|
||||
}
|
||||
|
||||
// Determines if a character is for PC bank
|
||||
static int isPCBank(char c)
|
||||
int isPCBank(char c)
|
||||
{
|
||||
return c == 'K';
|
||||
}
|
||||
|
||||
// Determines if a character is for Data bank
|
||||
static int isDataBank(char c)
|
||||
int isDataBank(char c)
|
||||
{
|
||||
return c == 'T';
|
||||
}
|
||||
|
||||
// Determines if a character is for value read
|
||||
static int isValueRead(char c)
|
||||
int isValueRead(char c)
|
||||
{
|
||||
return c == 'R';
|
||||
}
|
||||
|
||||
// Determines if a character is for value write
|
||||
static int isValueWrite(char c)
|
||||
int isValueWrite(char c)
|
||||
{
|
||||
return c == 'W';
|
||||
}
|
||||
|
||||
// Reads a hexadecimal number from str
|
||||
static int getNumber(unsigned int* number, const char** str)
|
||||
int getNumber(unsigned int* number, const char** str)
|
||||
{
|
||||
// char buffer[5];
|
||||
|
||||
|
@ -182,10 +185,10 @@ static int getNumber(unsigned int* number, const char** str)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static Condition* Connect(const char** str);
|
||||
Condition* Connect(const char** str);
|
||||
|
||||
// Handles the following part of the grammar: '(' E ')'
|
||||
static Condition* Parentheses(const char** str, Condition* c, char openPar, char closePar)
|
||||
Condition* Parentheses(const char** str, Condition* c, char openPar, char closePar)
|
||||
{
|
||||
if (next == openPar)
|
||||
{
|
||||
|
@ -213,7 +216,7 @@ static Condition* Parentheses(const char** str, Condition* c, char openPar, char
|
|||
* Check for primitives
|
||||
* Flags, Registers, Numbers, Addresses and parentheses
|
||||
*/
|
||||
static Condition* Primitive(const char** str, Condition* c)
|
||||
Condition* Primitive(const char** str, Condition* c)
|
||||
{
|
||||
if (isFlag(next)) /* Flags */
|
||||
{
|
||||
|
@ -391,22 +394,24 @@ static Condition* Primitive(const char** str, Condition* c)
|
|||
}
|
||||
|
||||
/* Handle * and / operators */
|
||||
static Condition* Term(const char** str)
|
||||
Condition* Term(const char** str)
|
||||
{
|
||||
Condition* t;
|
||||
Condition* t1;
|
||||
Condition* mid;
|
||||
|
||||
t = new Condition();
|
||||
t = (Condition*)FCEU_dmalloc(sizeof(Condition));
|
||||
|
||||
if (t == nullptr)
|
||||
if (!t)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(t, 0, sizeof(Condition));
|
||||
|
||||
if (!Primitive(str, t))
|
||||
{
|
||||
delete t;
|
||||
freeTree(t);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -416,25 +421,22 @@ static Condition* Term(const char** str)
|
|||
|
||||
scan(str);
|
||||
|
||||
if ((t1 = new Condition()) == nullptr)
|
||||
{
|
||||
delete t;
|
||||
return nullptr;
|
||||
}
|
||||
if (!(t1 = (Condition*)FCEU_dmalloc(sizeof(Condition))))
|
||||
return NULL;
|
||||
|
||||
memset(t1, 0, sizeof(Condition));
|
||||
|
||||
if (!Primitive(str, t1))
|
||||
{
|
||||
delete t;
|
||||
delete t1;
|
||||
freeTree(t);
|
||||
freeTree(t1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((mid = new Condition()) == nullptr)
|
||||
{
|
||||
delete t;
|
||||
delete t1;
|
||||
return nullptr;
|
||||
}
|
||||
if (!(mid = (Condition*)FCEU_dmalloc(sizeof(Condition))))
|
||||
return NULL;
|
||||
|
||||
memset(mid, 0, sizeof(Condition));
|
||||
|
||||
mid->lhs = t;
|
||||
mid->rhs = t1;
|
||||
|
@ -447,7 +449,7 @@ static Condition* Term(const char** str)
|
|||
}
|
||||
|
||||
/* Check for + and - operators */
|
||||
static int SumOperators(const char** str)
|
||||
int SumOperators(const char** str)
|
||||
{
|
||||
switch (next)
|
||||
{
|
||||
|
@ -458,13 +460,13 @@ static int SumOperators(const char** str)
|
|||
}
|
||||
|
||||
/* Handle + and - operators */
|
||||
static Condition* Sum(const char** str)
|
||||
Condition* Sum(const char** str)
|
||||
{
|
||||
return InfixOperator(str, Term, SumOperators);
|
||||
}
|
||||
|
||||
/* Check for <=, =>, ==, !=, > and < operators */
|
||||
static int CompareOperators(const char** str)
|
||||
int CompareOperators(const char** str)
|
||||
{
|
||||
int val = TwoCharOperator(str, '=', '=', OP_EQ);
|
||||
if (val) return val;
|
||||
|
@ -488,13 +490,13 @@ static int CompareOperators(const char** str)
|
|||
}
|
||||
|
||||
/* Handle <=, =>, ==, !=, > and < operators */
|
||||
static Condition* Compare(const char** str)
|
||||
Condition* Compare(const char** str)
|
||||
{
|
||||
return InfixOperator(str, Sum, CompareOperators);
|
||||
}
|
||||
|
||||
/* Check for || or && operators */
|
||||
static int ConnectOperators(const char** str)
|
||||
int ConnectOperators(const char** str)
|
||||
{
|
||||
int val = TwoCharOperator(str, '|', '|', OP_OR);
|
||||
if(val) return val;
|
||||
|
@ -506,7 +508,7 @@ static int ConnectOperators(const char** str)
|
|||
}
|
||||
|
||||
/* Handle || and && operators */
|
||||
static Condition* Connect(const char** str)
|
||||
Condition* Connect(const char** str)
|
||||
{
|
||||
return InfixOperator(str, Compare, ConnectOperators);
|
||||
}
|
||||
|
@ -519,10 +521,6 @@ Condition* generateCondition(const char* str)
|
|||
scan(&str);
|
||||
c = Connect(&str);
|
||||
|
||||
if (!c || next != 0)
|
||||
{
|
||||
if (c) delete c;
|
||||
return 0;
|
||||
}
|
||||
if (!c || next != 0) return 0;
|
||||
else return c;
|
||||
}
|
||||
|
|
|
@ -61,28 +61,9 @@ struct Condition
|
|||
|
||||
unsigned int type2;
|
||||
unsigned int value2;
|
||||
|
||||
Condition(void)
|
||||
{
|
||||
op = 0;
|
||||
lhs = rhs = nullptr;
|
||||
type1 = value1 = 0;
|
||||
type2 = value2 = 0;
|
||||
};
|
||||
|
||||
~Condition(void)
|
||||
{
|
||||
if (lhs)
|
||||
{
|
||||
delete lhs;
|
||||
}
|
||||
if (rhs)
|
||||
{
|
||||
delete rhs;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void freeTree(Condition* c);
|
||||
Condition* generateCondition(const char* str);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,14 +11,12 @@
|
|||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
static std::string aboutString;
|
||||
static char *aboutString = 0;
|
||||
|
||||
#ifndef FCEUX_BUILD_TIMESTAMP
|
||||
#define FCEUX_BUILD_TIMESTAMP __TIME__ " " __DATE__
|
||||
#endif
|
||||
|
||||
//#pragma message( "Compiling using C++ Std: " __FCEU_STRINGIZE(__cplusplus) )
|
||||
|
||||
// returns a string suitable for use in an aboutbox
|
||||
const char *FCEUI_GetAboutString(void)
|
||||
{
|
||||
|
@ -28,7 +26,7 @@ const char *FCEUI_GetAboutString(void)
|
|||
"zeromus, feos\n"
|
||||
"\n"
|
||||
"Current Contributors:\n"
|
||||
"CaH4e3, rainwarrior, owomomo, punkrockguy318, Cluster\n"
|
||||
"CaH4e3, rainwarrior, owomomo, punkrockguy318\n"
|
||||
"\n"
|
||||
"Past Contributors:\n"
|
||||
"xhainingx, gocha, AnS, mjbudd77\n"
|
||||
|
@ -57,17 +55,14 @@ const char *FCEUI_GetAboutString(void)
|
|||
"\n"
|
||||
FCEUX_BUILD_TIMESTAMP "\n";
|
||||
|
||||
if (aboutString.size() > 0) return aboutString.c_str();
|
||||
if (aboutString) return aboutString;
|
||||
|
||||
const char *compilerString = FCEUD_GetCompilerString();
|
||||
|
||||
char cppVersion[128];
|
||||
//allocate the string and concatenate the template with the compiler string
|
||||
if (!(aboutString = (char*)FCEU_dmalloc(strlen(aboutTemplate) + strlen(compilerString) + 1)))
|
||||
return NULL;
|
||||
|
||||
snprintf( cppVersion, sizeof(cppVersion), "\nCompiled using C++ Language Standard: %li\n", __cplusplus);
|
||||
|
||||
aboutString.assign( aboutTemplate );
|
||||
aboutString.append( compilerString );
|
||||
aboutString.append( cppVersion );
|
||||
|
||||
return aboutString.c_str();
|
||||
sprintf(aboutString,"%s%s",aboutTemplate,compilerString);
|
||||
return aboutString;
|
||||
}
|
||||
|
|
177
src/debug.cpp
177
src/debug.cpp
|
@ -6,7 +6,6 @@
|
|||
#include "cart.h"
|
||||
#include "ines.h"
|
||||
#include "debug.h"
|
||||
#include "debugsymboltable.h"
|
||||
#include "driver.h"
|
||||
#include "ppu.h"
|
||||
|
||||
|
@ -19,23 +18,10 @@ unsigned int debuggerPageSize = 14;
|
|||
int vblankScanLines = 0; //Used to calculate scanlines 240-261 (vblank)
|
||||
int vblankPixel = 0; //Used to calculate the pixels in vblank
|
||||
|
||||
|
||||
struct TraceInstructionCallback
|
||||
{
|
||||
void (*func)(uint8 *opcode, int size) = nullptr;
|
||||
TraceInstructionCallback* next = nullptr;
|
||||
};
|
||||
static TraceInstructionCallback* traceInstructionCB = nullptr;
|
||||
|
||||
int offsetStringToInt(unsigned int type, const char* offsetBuffer, bool *conversionOk)
|
||||
int offsetStringToInt(unsigned int type, const char* offsetBuffer)
|
||||
{
|
||||
int offset = -1;
|
||||
|
||||
if (conversionOk)
|
||||
{
|
||||
*conversionOk = false;
|
||||
}
|
||||
|
||||
if (sscanf(offsetBuffer,"%7X",(unsigned int *)&offset) == EOF)
|
||||
{
|
||||
return -1;
|
||||
|
@ -43,41 +29,18 @@ int offsetStringToInt(unsigned int type, const char* offsetBuffer, bool *convers
|
|||
|
||||
if (type & BT_P)
|
||||
{
|
||||
if (conversionOk)
|
||||
{
|
||||
*conversionOk = (offset >= 0) && (offset < 0x4000);
|
||||
}
|
||||
return offset & 0x3FFF;
|
||||
}
|
||||
else if (type & BT_S)
|
||||
{
|
||||
if (conversionOk)
|
||||
{
|
||||
*conversionOk = (offset >= 0) && (offset < 0x100);
|
||||
}
|
||||
return offset & 0x00FF;
|
||||
}
|
||||
else if (type & BT_R)
|
||||
{
|
||||
if (conversionOk)
|
||||
{
|
||||
*conversionOk = (offset >= 0);
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
else // BT_C
|
||||
{
|
||||
auto sym = debugSymbolTable.getSymbolAtAnyBank(offsetBuffer);
|
||||
|
||||
if (sym)
|
||||
{
|
||||
if (conversionOk)
|
||||
{
|
||||
*conversionOk = true;
|
||||
}
|
||||
return sym->offset() & 0xFFFF;
|
||||
}
|
||||
|
||||
int type = GIT_CART;
|
||||
|
||||
if (GameInfo)
|
||||
|
@ -85,26 +48,21 @@ int offsetStringToInt(unsigned int type, const char* offsetBuffer, bool *convers
|
|||
type = GameInfo->type;
|
||||
}
|
||||
if (type == GIT_NSF) { //NSF Breakpoint keywords
|
||||
if (strcmp(offsetBuffer,"LOAD") == 0) offset = (NSFHeader.LoadAddressLow | (NSFHeader.LoadAddressHigh<<8));
|
||||
else if (strcmp(offsetBuffer,"INIT") == 0) offset = (NSFHeader.InitAddressLow | (NSFHeader.InitAddressHigh<<8));
|
||||
else if (strcmp(offsetBuffer,"PLAY") == 0) offset = (NSFHeader.PlayAddressLow | (NSFHeader.PlayAddressHigh<<8));
|
||||
if (strcmp(offsetBuffer,"LOAD") == 0) return (NSFHeader.LoadAddressLow | (NSFHeader.LoadAddressHigh<<8));
|
||||
if (strcmp(offsetBuffer,"INIT") == 0) return (NSFHeader.InitAddressLow | (NSFHeader.InitAddressHigh<<8));
|
||||
if (strcmp(offsetBuffer,"PLAY") == 0) return (NSFHeader.PlayAddressLow | (NSFHeader.PlayAddressHigh<<8));
|
||||
}
|
||||
else if (type == GIT_FDS) { //FDS Breakpoint keywords
|
||||
if (strcmp(offsetBuffer,"NMI1") == 0) offset = (GetMem(0xDFF6) | (GetMem(0xDFF7)<<8));
|
||||
else if (strcmp(offsetBuffer,"NMI2") == 0) offset = (GetMem(0xDFF8) | (GetMem(0xDFF9)<<8));
|
||||
else if (strcmp(offsetBuffer,"NMI3") == 0) offset = (GetMem(0xDFFA) | (GetMem(0xDFFB)<<8));
|
||||
else if (strcmp(offsetBuffer,"RST") == 0) offset = (GetMem(0xDFFC) | (GetMem(0xDFFD)<<8));
|
||||
else if ((strcmp(offsetBuffer,"IRQ") == 0) || (strcmp(offsetBuffer,"BRK") == 0)) offset = (GetMem(0xDFFE) | (GetMem(0xDFFF)<<8));
|
||||
if (strcmp(offsetBuffer,"NMI1") == 0) return (GetMem(0xDFF6) | (GetMem(0xDFF7)<<8));
|
||||
if (strcmp(offsetBuffer,"NMI2") == 0) return (GetMem(0xDFF8) | (GetMem(0xDFF9)<<8));
|
||||
if (strcmp(offsetBuffer,"NMI3") == 0) return (GetMem(0xDFFA) | (GetMem(0xDFFB)<<8));
|
||||
if (strcmp(offsetBuffer,"RST") == 0) return (GetMem(0xDFFC) | (GetMem(0xDFFD)<<8));
|
||||
if ((strcmp(offsetBuffer,"IRQ") == 0) || (strcmp(offsetBuffer,"BRK") == 0)) return (GetMem(0xDFFE) | (GetMem(0xDFFF)<<8));
|
||||
}
|
||||
else { //NES Breakpoint keywords
|
||||
if ((strcmp(offsetBuffer,"NMI") == 0) || (strcmp(offsetBuffer,"VBL") == 0)) offset = (GetMem(0xFFFA) | (GetMem(0xFFFB)<<8));
|
||||
else if (strcmp(offsetBuffer,"RST") == 0) offset = (GetMem(0xFFFC) | (GetMem(0xFFFD)<<8));
|
||||
else if ((strcmp(offsetBuffer,"IRQ") == 0) || (strcmp(offsetBuffer,"BRK") == 0)) offset = (GetMem(0xFFFE) | (GetMem(0xFFFF)<<8));
|
||||
}
|
||||
|
||||
if (conversionOk)
|
||||
{
|
||||
*conversionOk = (offset >= 0) && (offset < 0x10000);
|
||||
if ((strcmp(offsetBuffer,"NMI") == 0) || (strcmp(offsetBuffer,"VBL") == 0)) return (GetMem(0xFFFA) | (GetMem(0xFFFB)<<8));
|
||||
if (strcmp(offsetBuffer,"RST") == 0) return (GetMem(0xFFFC) | (GetMem(0xFFFD)<<8));
|
||||
if ((strcmp(offsetBuffer,"IRQ") == 0) || (strcmp(offsetBuffer,"BRK") == 0)) return (GetMem(0xFFFE) | (GetMem(0xFFFF)<<8));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,7 +131,7 @@ int checkCondition(const char* condition, int num)
|
|||
// Remove the old breakpoint condition before adding a new condition.
|
||||
if (watchpoint[num].cond)
|
||||
{
|
||||
delete watchpoint[num].cond;
|
||||
freeTree(watchpoint[num].cond);
|
||||
free(watchpoint[num].condText);
|
||||
watchpoint[num].cond = 0;
|
||||
watchpoint[num].condText = 0;
|
||||
|
@ -187,8 +145,8 @@ int checkCondition(const char* condition, int num)
|
|||
{
|
||||
watchpoint[num].cond = c;
|
||||
watchpoint[num].condText = (char*)malloc(strlen(condition) + 1);
|
||||
if (!watchpoint[num].condText)
|
||||
return 0;
|
||||
if (!watchpoint[num].condText)
|
||||
return 0;
|
||||
strcpy(watchpoint[num].condText, condition);
|
||||
}
|
||||
else
|
||||
|
@ -203,7 +161,7 @@ int checkCondition(const char* condition, int num)
|
|||
// Remove the old breakpoint condition
|
||||
if (watchpoint[num].cond)
|
||||
{
|
||||
delete watchpoint[num].cond;
|
||||
freeTree(watchpoint[num].cond);
|
||||
free(watchpoint[num].condText);
|
||||
watchpoint[num].cond = 0;
|
||||
watchpoint[num].condText = 0;
|
||||
|
@ -300,7 +258,7 @@ int getBank(int offs)
|
|||
//Anything over FFFFF will kill it.
|
||||
|
||||
//GetNesFileAddress doesn't work well with Unif files
|
||||
int addr = GetNesFileAddress(offs)-NES_HEADER_SIZE;
|
||||
int addr = GetNesFileAddress(offs)-16;
|
||||
|
||||
if (GameInfo && GameInfo->type==GIT_NSF)
|
||||
return addr != -1 ? addr / 0x1000 : -1;
|
||||
|
@ -312,12 +270,12 @@ int GetNesFileAddress(int A){
|
|||
if((A < 0x6000) || (A > 0xFFFF))return -1;
|
||||
result = &Page[A>>11][A]-PRGptr[0];
|
||||
if((result > (int)(PRGsize[0])) || (result < 0))return -1;
|
||||
else return result+NES_HEADER_SIZE; //16 bytes for the header remember
|
||||
else return result+16; //16 bytes for the header remember
|
||||
}
|
||||
|
||||
int GetRomAddress(int A){
|
||||
int i;
|
||||
uint8 *p = GetNesPRGPointer(A-=NES_HEADER_SIZE);
|
||||
uint8 *p = GetNesPRGPointer(A-=16);
|
||||
for(i = 16;i < 32;i++){
|
||||
if((&Page[i][i<<11] <= p) && (&Page[i][(i+1)<<11] > p))break;
|
||||
}
|
||||
|
@ -554,7 +512,7 @@ void LogCDData(uint8 *opcode, uint16 A, int size)
|
|||
case 4: memop = 0x20; break;
|
||||
}
|
||||
|
||||
if (((j = GetPRGAddress(A)) != -1) && (opcode[0] != 0x4C) && (opcode[0] != 0x6C))
|
||||
if ((j = GetPRGAddress(A)) != -1)
|
||||
{
|
||||
if (opwrite[opcode[0]] == 0)
|
||||
{
|
||||
|
@ -569,12 +527,7 @@ void LogCDData(uint8 *opcode, uint16 A, int size)
|
|||
newDataHit = true;
|
||||
}
|
||||
}
|
||||
// Unclear why the write destination's access types gets reset for FDS...
|
||||
// See:
|
||||
// - https://github.com/TASEmulators/fceux/commit/a4fa6225a04b5ab8d3dfca3fc9abd7190bceec85
|
||||
// - https://github.com/TASEmulators/fceux/commit/b10b6254c3d5c9519a85cb4382cdb22846d2e394
|
||||
// - https://github.com/TASEmulators/fceux/commit/67942accc72149ae028d58f36419b64ea8651db9?diff=unified&w=1
|
||||
else if(GameInfo && GameInfo->type == GIT_FDS)
|
||||
else
|
||||
{
|
||||
if (cdloggerdata[j] & 1)
|
||||
{
|
||||
|
@ -689,8 +642,7 @@ uint16 StackNextIgnorePC = 0xFFFF;
|
|||
|
||||
///fires a breakpoint
|
||||
static void breakpoint(uint8 *opcode, uint16 A, int size) {
|
||||
int i, romAddrPC;
|
||||
unsigned int j;
|
||||
int i, j, romAddrPC;
|
||||
uint8 brk_type;
|
||||
uint8 stackop=0;
|
||||
uint8 stackopstartaddr=0,stackopendaddr=0;
|
||||
|
@ -831,7 +783,7 @@ static void breakpoint(uint8 *opcode, uint16 A, int size) {
|
|||
{
|
||||
if (watchpoint[i].flags & BT_R)
|
||||
{
|
||||
if ( (watchpoint[i].flags & WP_X) && (watchpoint[i].address == static_cast<unsigned int>(romAddrPC)) )
|
||||
if ( (watchpoint[i].flags & WP_X) && (watchpoint[i].address == romAddrPC) )
|
||||
{
|
||||
BREAKHIT(i);
|
||||
}
|
||||
|
@ -862,7 +814,7 @@ static void breakpoint(uint8 *opcode, uint16 A, int size) {
|
|||
// TXS and TSX only deal with the pointer.
|
||||
if (watchpoint[i].flags & stackop)
|
||||
{
|
||||
for (j = (stackopstartaddr|0x0100); j <= (static_cast<unsigned int>(stackopendaddr)|0x0100); j++)
|
||||
for (j = (stackopstartaddr|0x0100); j <= (stackopendaddr|0x0100); j++)
|
||||
{
|
||||
if (watchpoint[i].endaddress)
|
||||
{
|
||||
|
@ -888,7 +840,7 @@ static void breakpoint(uint8 *opcode, uint16 A, int size) {
|
|||
// Pushes to stack
|
||||
if (watchpoint[i].flags & WP_W)
|
||||
{
|
||||
for (j = (X.S|0x0100); j < (static_cast<unsigned int>(StackAddrBackup)|0x0100); j++)
|
||||
for (j = (X.S|0x0100); j < (StackAddrBackup|0x0100); j++)
|
||||
{
|
||||
if (watchpoint[i].endaddress)
|
||||
{
|
||||
|
@ -906,7 +858,7 @@ static void breakpoint(uint8 *opcode, uint16 A, int size) {
|
|||
// Pulls from stack
|
||||
if (watchpoint[i].flags & WP_R)
|
||||
{
|
||||
for (j = (StackAddrBackup|0x0100); j < (static_cast<unsigned int>(X.S)|0x0100); j++)
|
||||
for (j = (StackAddrBackup|0x0100); j < (X.S|0x0100); j++)
|
||||
{
|
||||
if (watchpoint[i].endaddress)
|
||||
{
|
||||
|
@ -1002,82 +954,5 @@ void DebugCycle()
|
|||
if(debug_loggingCD)
|
||||
LogCDData(opcode, A, size);
|
||||
|
||||
#ifdef __WIN_DRIVER__
|
||||
FCEUD_TraceInstruction(opcode, size);
|
||||
#else
|
||||
// Use callback pointer that can be null checked, this saves on the overhead
|
||||
// of calling a function for every instruction when we aren't tracing.
|
||||
if (traceInstructionCB != nullptr)
|
||||
{
|
||||
auto* cb = traceInstructionCB;
|
||||
while (cb != nullptr)
|
||||
{
|
||||
cb->func(opcode, size);
|
||||
cb = cb->next;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void* FCEUI_TraceInstructionRegister( void (*func)(uint8*,int) )
|
||||
{
|
||||
TraceInstructionCallback* cb = nullptr;
|
||||
|
||||
if (traceInstructionCB == nullptr)
|
||||
{
|
||||
cb = traceInstructionCB = new TraceInstructionCallback();
|
||||
cb->func = func;
|
||||
}
|
||||
else
|
||||
{
|
||||
cb = traceInstructionCB;
|
||||
|
||||
while (cb != nullptr)
|
||||
{
|
||||
if (cb->func == func)
|
||||
{
|
||||
// This function has already been registered, don't double add.
|
||||
return nullptr;
|
||||
}
|
||||
if (cb->next == nullptr)
|
||||
{
|
||||
auto* newCB = new TraceInstructionCallback();
|
||||
newCB->func = func;
|
||||
cb->next = newCB;
|
||||
return newCB;
|
||||
}
|
||||
cb = cb->next;
|
||||
}
|
||||
}
|
||||
return cb;
|
||||
}
|
||||
|
||||
bool FCEUI_TraceInstructionUnregisterHandle( void* handle )
|
||||
{
|
||||
TraceInstructionCallback* cb, *cb_prev, *cb_handle;
|
||||
|
||||
cb_handle = static_cast<TraceInstructionCallback*>(handle);
|
||||
cb_prev = nullptr;
|
||||
cb = traceInstructionCB;
|
||||
|
||||
while (cb != nullptr)
|
||||
{
|
||||
if (cb == cb_handle)
|
||||
{ // Match we are going to remove from list and delete
|
||||
if (cb_prev != nullptr)
|
||||
{
|
||||
cb_prev = cb->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
traceInstructionCB = cb->next;
|
||||
}
|
||||
delete cb;
|
||||
return true;
|
||||
}
|
||||
cb_prev = cb;
|
||||
cb = cb->next;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -172,10 +172,7 @@ DebuggerState &FCEUI_Debugger();
|
|||
//#define WRITE_BREAKPOINT 16
|
||||
//#define EXECUTE_BREAKPOINT 32
|
||||
|
||||
int offsetStringToInt(unsigned int type, const char* offsetBuffer, bool *conversionOk = nullptr);
|
||||
int offsetStringToInt(unsigned int type, const char* offsetBuffer);
|
||||
unsigned int NewBreak(const char* name, int start, int end, unsigned int type, const char* condition, unsigned int num, bool enable);
|
||||
|
||||
void* FCEUI_TraceInstructionRegister( void (*func)(uint8*,int) );
|
||||
bool FCEUI_TraceInstructionUnregisterHandle( void* handle );
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,170 +0,0 @@
|
|||
#ifndef _DEBUGSYMBOLTABLE_H_
|
||||
#define _DEBUGSYMBOLTABLE_H_
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "utils/mutex.h"
|
||||
#include "ld65dbg.h"
|
||||
|
||||
class debugSymbolPage_t;
|
||||
class debugSymbolTable_t;
|
||||
|
||||
class debugSymbol_t
|
||||
{
|
||||
public:
|
||||
debugSymbol_t(void)
|
||||
{
|
||||
ofs = 0;
|
||||
page = nullptr;
|
||||
};
|
||||
|
||||
debugSymbol_t( int ofs, const char *name = nullptr, const char *comment = nullptr )
|
||||
{
|
||||
this->ofs = ofs;
|
||||
|
||||
if (name)
|
||||
{
|
||||
this->_name.assign(name);
|
||||
}
|
||||
if ( comment )
|
||||
{
|
||||
this->_comment.assign( comment );
|
||||
}
|
||||
page = nullptr;
|
||||
}
|
||||
|
||||
const std::string &name(void)
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
const std::string &comment(void)
|
||||
{
|
||||
return _comment;
|
||||
}
|
||||
|
||||
void commentAssign( std::string str )
|
||||
{
|
||||
_comment.assign(str);
|
||||
return;
|
||||
}
|
||||
|
||||
void commentAssign( const char *str )
|
||||
{
|
||||
_comment.assign(str);
|
||||
return;
|
||||
}
|
||||
|
||||
int offset(void)
|
||||
{
|
||||
return ofs;
|
||||
}
|
||||
|
||||
void setOffset( int o )
|
||||
{
|
||||
if (o != ofs)
|
||||
{
|
||||
ofs = o;
|
||||
}
|
||||
}
|
||||
|
||||
int updateName( const char *name, int arrayIndex = -1 );
|
||||
|
||||
void trimTrailingSpaces(void);
|
||||
|
||||
private:
|
||||
|
||||
int ofs;
|
||||
std::string _name;
|
||||
std::string _comment;
|
||||
debugSymbolPage_t *page;
|
||||
|
||||
friend class debugSymbolPage_t;
|
||||
friend class debugSymbolTable_t;
|
||||
};
|
||||
|
||||
class debugSymbolPage_t
|
||||
{
|
||||
public:
|
||||
debugSymbolPage_t(int page);
|
||||
~debugSymbolPage_t(void);
|
||||
|
||||
int save(void);
|
||||
void print(void);
|
||||
int size(void){ return static_cast<int>(symMap.size()); }
|
||||
|
||||
int addSymbol( debugSymbol_t *sym );
|
||||
|
||||
int deleteSymbolAtOffset( int ofs );
|
||||
|
||||
int updateSymbol( debugSymbol_t *sym );
|
||||
|
||||
debugSymbol_t *getSymbolAtOffset( int ofs );
|
||||
|
||||
debugSymbol_t *getSymbol( const std::string &name );
|
||||
|
||||
int pageNum(void)
|
||||
{
|
||||
return _pageNum;
|
||||
}
|
||||
|
||||
const char *pageName(void)
|
||||
{
|
||||
return _pageName;
|
||||
}
|
||||
|
||||
private:
|
||||
int _pageNum;
|
||||
char _pageName[8];
|
||||
std::map <int, debugSymbol_t*> symMap;
|
||||
std::map <std::string, debugSymbol_t*> symNameMap;
|
||||
|
||||
friend class debugSymbolTable_t;
|
||||
};
|
||||
|
||||
class debugSymbolTable_t
|
||||
{
|
||||
|
||||
public:
|
||||
debugSymbolTable_t(void);
|
||||
~debugSymbolTable_t(void);
|
||||
|
||||
int loadFileNL( int addr );
|
||||
int loadRegisterMap(void);
|
||||
int loadGameSymbols(void);
|
||||
int numPages(void){ return pageMap.size(); }
|
||||
int numSymbols(void);
|
||||
|
||||
void save(void);
|
||||
void clear(void);
|
||||
void print(void);
|
||||
|
||||
debugSymbol_t *getSymbolAtBankOffset( int bank, int ofs );
|
||||
|
||||
debugSymbol_t *getSymbol( int bank, const std::string& name);
|
||||
|
||||
debugSymbol_t *getSymbolAtAnyBank( const std::string& name);
|
||||
|
||||
int addSymbolAtBankOffset( int bank, int ofs, debugSymbol_t *sym );
|
||||
|
||||
int addSymbolAtBankOffset(int bank, int ofs, const char* name, const char* comment = nullptr);
|
||||
|
||||
int deleteSymbolAtBankOffset( int bank, int ofs );
|
||||
|
||||
int updateSymbol( debugSymbol_t *sym );
|
||||
|
||||
const char *errorMessage(void);
|
||||
|
||||
int ld65LoadDebugFile( const char *dbgFilePath );
|
||||
|
||||
void ld65_SymbolLoad( ld65::sym *s );
|
||||
|
||||
private:
|
||||
std::map <int, debugSymbolPage_t*> pageMap;
|
||||
FCEU::mutex *cs;
|
||||
};
|
||||
|
||||
extern debugSymbolTable_t debugSymbolTable;
|
||||
|
||||
#endif
|
|
@ -346,7 +346,7 @@ void FCEU_DrawRecordingStatus(uint8* XBuf)
|
|||
hasPlayRecIcon = true;
|
||||
}
|
||||
|
||||
if( EmulationPaused & (EMULATIONPAUSED_PAUSED | EMULATIONPAUSED_TIMER) )
|
||||
if(FCEUI_EmulationPaused())
|
||||
drawstatus(XBuf-ClipSidesOffset,3,28,hasPlayRecIcon?-16:0);
|
||||
}
|
||||
}
|
||||
|
|
18
src/driver.h
18
src/driver.h
|
@ -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( __FCEU_PRINTF_FORMAT const char *format, ...) __FCEU_PRINTF_ATTRIBUTE( 1, 2 );
|
||||
void FCEU_printf(const char *format, ...);
|
||||
#define FCEUI_printf FCEU_printf
|
||||
|
||||
//Video interface
|
||||
|
@ -192,12 +192,12 @@ void TaseditorManualFunction(void);
|
|||
int32 FCEUI_GetDesiredFPS(void);
|
||||
void FCEUI_SaveSnapshot(void);
|
||||
void FCEUI_SaveSnapshotAs(void);
|
||||
void FCEU_DispMessage( __FCEU_PRINTF_FORMAT const char *format, int disppos, ...) __FCEU_PRINTF_ATTRIBUTE( 1, 3 );
|
||||
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);
|
||||
int FCEUI_DecodeGG(const char *str, int *a, int *v, int *c);
|
||||
int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int type, int status = 1, bool rebuild = true);
|
||||
int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int type);
|
||||
int FCEUI_DelCheat(uint32 which);
|
||||
int FCEUI_ToggleCheat(uint32 which);
|
||||
int FCEUI_GlobalToggleCheat(int global_enable);
|
||||
|
@ -254,8 +254,6 @@ void FCEUI_VSUniToggleDIP(int w);
|
|||
uint8 FCEUI_VSUniGetDIPs(void);
|
||||
void FCEUI_VSUniSetDIP(int w, int state);
|
||||
void FCEUI_VSUniCoin(void);
|
||||
void FCEUI_VSUniCoin2(void);
|
||||
void FCEUI_VSUniService(void);
|
||||
|
||||
void FCEUI_FDSInsert(void); //mbg merge 7/17/06 changed to void fn(void) to make it an EMUCMDFN
|
||||
//int FCEUI_FDSEject(void);
|
||||
|
@ -273,10 +271,6 @@ void FCEUI_ClearEmulationFrameStepped();
|
|||
void FCEUI_SetEmulationPaused(int val);
|
||||
///toggles the paused bit (bit0) for EmulationPaused. caused FCEUD_DebugUpdate() to fire if the emulation pauses
|
||||
void FCEUI_ToggleEmulationPause();
|
||||
void FCEUI_PauseForDuration(int secs);
|
||||
int FCEUI_PauseFramesRemaining();
|
||||
void FCEUI_SetNetPlayPause(bool value);
|
||||
bool FCEUI_GetNetPlayPause();
|
||||
|
||||
//indicates whether input aids should be drawn (such as crosshairs, etc; usually in fullscreen mode)
|
||||
bool FCEUD_ShouldDrawInputAids();
|
||||
|
@ -367,11 +361,7 @@ bool FCEU_IsValidUI(EFCEUI ui);
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
FILE *FCEUI_UTF8fopen_C(const char *n, const char *m);
|
||||
#ifdef __cplusplus
|
||||
} // extern C
|
||||
#endif
|
||||
FILE *FCEUI_UTF8fopen_C(const char *n, const char *m);
|
||||
|
||||
#endif //__DRIVER_H_
|
||||
|
|
|
@ -30,14 +30,9 @@
|
|||
#endif
|
||||
|
||||
#ifdef _USE_X264
|
||||
#include <cstdint>
|
||||
#include "x264.h"
|
||||
#endif
|
||||
|
||||
#ifdef _USE_LIBARCHIVE
|
||||
#include <archive.h>
|
||||
#endif
|
||||
|
||||
#ifdef _USE_LIBAV
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
|
@ -74,7 +69,7 @@ static const char *Authors[] = {
|
|||
"\t rainwarrior", "\t feos",
|
||||
"Pre 2.0 Guys:",
|
||||
"\t Bero", "\t Xodnizel", "\t Aaron Oneal", "\t Joe Nahmias",
|
||||
"\t Paul Kuliniewicz", "\t Quietust",
|
||||
"\t Paul Kuliniewicz", "\t Quietust", "\t Ben Parnell",
|
||||
"\t Parasyte & bbitmaster",
|
||||
"\t blip & nitsuja",
|
||||
"Included components:",
|
||||
|
@ -130,7 +125,7 @@ AboutWindow::AboutWindow(QWidget *parent)
|
|||
|
||||
mainLayout->addLayout( hbox1 );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "git URL: %s", fceu_get_git_url() );
|
||||
sprintf( stmp, "git URL: %s", fceu_get_git_url() );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
lbl = new QLabel( tr(stmp) );
|
||||
|
@ -140,7 +135,7 @@ AboutWindow::AboutWindow(QWidget *parent)
|
|||
|
||||
mainLayout->addLayout( hbox1 );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "git Revision: %s", fceu_get_git_rev() );
|
||||
sprintf( stmp, "git Revision: %s", fceu_get_git_rev() );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
lbl = new QLabel( tr(stmp) );
|
||||
|
@ -152,7 +147,7 @@ AboutWindow::AboutWindow(QWidget *parent)
|
|||
|
||||
hbox1 = new QHBoxLayout();
|
||||
lbl = new QLabel();
|
||||
lbl->setText("<a href=\"https://fceux.com\">Website</a>");
|
||||
lbl->setText("<a href=\"http://fceux.com\">Website</a>");
|
||||
lbl->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
lbl->setOpenExternalLinks(true);
|
||||
|
||||
|
@ -191,61 +186,44 @@ AboutWindow::AboutWindow(QWidget *parent)
|
|||
|
||||
credits->insertPlainText( "\nOpen Source Dependencies:\n" );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), " Compiled with Qt version %d.%d.%d\n", QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH );
|
||||
sprintf( stmp, " Compiled with Qt version %d.%d.%d\n", QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH );
|
||||
credits->insertPlainText( stmp );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), " Compiled with SDL version %d.%d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL );
|
||||
sprintf( stmp, " Compiled with SDL version %d.%d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL );
|
||||
credits->insertPlainText( stmp );
|
||||
|
||||
SDL_version v;
|
||||
SDL_GetVersion(&v);
|
||||
snprintf( stmp, sizeof(stmp), " Linked with SDL version %d.%d.%d\n", v.major, v.minor, v.patch);
|
||||
sprintf( stmp, " Linked with SDL version %d.%d.%d\n", v.major, v.minor, v.patch);
|
||||
credits->insertPlainText( stmp );
|
||||
|
||||
#ifdef ZLIB_VERSION
|
||||
snprintf( stmp, sizeof(stmp), " Compiled with zlib %s\n", ZLIB_VERSION );
|
||||
sprintf( stmp, " Compiled with zlib %s\n", ZLIB_VERSION );
|
||||
credits->insertPlainText( stmp );
|
||||
#endif
|
||||
#ifdef _USE_LIBARCHIVE
|
||||
snprintf( stmp, sizeof(stmp), " Compiled with libarchive %s\n", ARCHIVE_VERSION_ONLY_STRING );
|
||||
credits->insertPlainText( stmp );
|
||||
const char *libArcName[] = { "zlib", "liblzma", "bzlib", "liblz4", "libzstd", nullptr };
|
||||
const char *libArcVersion[] = { archive_zlib_version(), archive_liblzma_version(),
|
||||
archive_bzlib_version(), archive_liblz4_version(), archive_libzstd_version(), nullptr };
|
||||
i=0;
|
||||
while (libArcName[i])
|
||||
{
|
||||
if (libArcVersion[i])
|
||||
{
|
||||
snprintf( stmp, sizeof(stmp), " %s %s\n", libArcName[i], libArcVersion[i]);
|
||||
credits->insertPlainText( stmp );
|
||||
}
|
||||
i++;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _S9XLUA_H
|
||||
snprintf( stmp, sizeof(stmp), " Compiled with %s\n", LUA_RELEASE );
|
||||
sprintf( stmp, " Compiled with %s\n", LUA_RELEASE );
|
||||
credits->insertPlainText( stmp );
|
||||
#endif
|
||||
|
||||
#ifdef _USE_LIBAV
|
||||
snprintf( stmp, sizeof(stmp), " Compiled with ffmpeg libraries:\n");
|
||||
sprintf( stmp, " Compiled with ffmpeg libraries:\n");
|
||||
credits->insertPlainText( stmp );
|
||||
snprintf( stmp, sizeof(stmp), " libavutil %i.%i.%i\n", LIBAVUTIL_VERSION_MAJOR, LIBAVUTIL_VERSION_MINOR, LIBAVUTIL_VERSION_MICRO);
|
||||
sprintf( stmp, " libavutil %i.%i.%i\n", LIBAVUTIL_VERSION_MAJOR, LIBAVUTIL_VERSION_MINOR, LIBAVUTIL_VERSION_MICRO);
|
||||
credits->insertPlainText( stmp );
|
||||
snprintf( stmp, sizeof(stmp), " libavformat %i.%i.%i\n", LIBAVFORMAT_VERSION_MAJOR, LIBAVFORMAT_VERSION_MINOR, LIBAVFORMAT_VERSION_MICRO);
|
||||
sprintf( stmp, " libavformat %i.%i.%i\n", LIBAVFORMAT_VERSION_MAJOR, LIBAVFORMAT_VERSION_MINOR, LIBAVFORMAT_VERSION_MICRO);
|
||||
credits->insertPlainText( stmp );
|
||||
snprintf( stmp, sizeof(stmp), " libavcodec %i.%i.%i\n", LIBAVCODEC_VERSION_MAJOR, LIBAVCODEC_VERSION_MINOR, LIBAVCODEC_VERSION_MICRO);
|
||||
sprintf( stmp, " libavcodec %i.%i.%i\n", LIBAVCODEC_VERSION_MAJOR, LIBAVCODEC_VERSION_MINOR, LIBAVCODEC_VERSION_MICRO);
|
||||
credits->insertPlainText( stmp );
|
||||
snprintf( stmp, sizeof(stmp), " libswscale %i.%i.%i\n", LIBSWSCALE_VERSION_MAJOR, LIBSWSCALE_VERSION_MINOR, LIBSWSCALE_VERSION_MICRO);
|
||||
sprintf( stmp, " libswscale %i.%i.%i\n", LIBSWSCALE_VERSION_MAJOR, LIBSWSCALE_VERSION_MINOR, LIBSWSCALE_VERSION_MICRO);
|
||||
credits->insertPlainText( stmp );
|
||||
snprintf( stmp, sizeof(stmp), " libswresample %i.%i.%i\n", LIBSWRESAMPLE_VERSION_MAJOR, LIBSWRESAMPLE_VERSION_MINOR, LIBSWRESAMPLE_VERSION_MICRO);
|
||||
sprintf( stmp, " libswresample %i.%i.%i\n", LIBSWRESAMPLE_VERSION_MAJOR, LIBSWRESAMPLE_VERSION_MINOR, LIBSWRESAMPLE_VERSION_MICRO);
|
||||
credits->insertPlainText( stmp );
|
||||
#endif
|
||||
|
||||
#ifdef _USE_X264
|
||||
snprintf( stmp, sizeof(stmp), " Compiled with x264 version %s\n", X264_POINTVER );
|
||||
sprintf( stmp, " Compiled with x264 version %s\n", X264_POINTVER );
|
||||
credits->insertPlainText( stmp );
|
||||
#endif
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <atomic>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
|
@ -80,12 +79,12 @@ extern "C"
|
|||
static gwavi_t *gwavi = NULL;
|
||||
static bool recordEnable = false;
|
||||
static bool recordAudio = true;
|
||||
static std::atomic<int> vbufHead(0);
|
||||
static std::atomic<int> vbufTail(0);
|
||||
static constexpr int vbufSize = 1024 * 1024 * 64;
|
||||
static std::atomic<int> abufHead(0);
|
||||
static std::atomic<int> abufTail(0);
|
||||
static constexpr int abufSize = 256 * 1024;
|
||||
static int vbufHead = 0;
|
||||
static int vbufTail = 0;
|
||||
static int vbufSize = 0;
|
||||
static int abufHead = 0;
|
||||
static int abufTail = 0;
|
||||
static int abufSize = 0;
|
||||
static uint32_t *rawVideoBuf = NULL;
|
||||
static int16_t *rawAudioBuf = NULL;
|
||||
static int aviDriver = 0;
|
||||
|
@ -461,14 +460,7 @@ static int encode_frame( unsigned char *inBuf, int width, int height )
|
|||
pic->stride[1] = width/2;
|
||||
pic->stride[2] = width/2;
|
||||
|
||||
#if defined(MAX_SCALABLE_LAYERS) && (X265_BUILD >= 210) && (X265_BUILD < 213)
|
||||
/* Handle API changes for scalable layers output in x265 4.0 */
|
||||
x265_picture *pics[MAX_SCALABLE_LAYERS] = {NULL};
|
||||
pics[0] = pic;
|
||||
ret = x265_encoder_encode( hdl, &nal, &i_nal, pic, pics );
|
||||
#else
|
||||
ret = x265_encoder_encode( hdl, &nal, &i_nal, pic, &pic_out );
|
||||
#endif
|
||||
|
||||
if ( ret <= 0 )
|
||||
{
|
||||
|
@ -501,14 +493,7 @@ static int close(void)
|
|||
/* Flush delayed frames */
|
||||
while( hdl != NULL )
|
||||
{
|
||||
#if defined(MAX_SCALABLE_LAYERS) && (X265_BUILD >= 210) && (X265_BUILD < 213)
|
||||
/* Handle API changes for scalable layers output in x265 4.0 */
|
||||
x265_picture *pics[MAX_SCALABLE_LAYERS] = {NULL};
|
||||
pics[0] = pic;
|
||||
ret = x265_encoder_encode( hdl, &nal, &i_nal, pic, pics );
|
||||
#else
|
||||
ret = x265_encoder_encode( hdl, &nal, &i_nal, NULL, &pic_out );
|
||||
#endif
|
||||
|
||||
if ( ret <= 0 )
|
||||
{
|
||||
|
@ -810,7 +795,7 @@ struct OutputStream
|
|||
if ( writeError )
|
||||
{
|
||||
char msg[512];
|
||||
snprintf( msg, sizeof(msg), "%s Stream Write Errors Detected.\nOutput may be incomplete or corrupt.\nSee log file '%s' for details\n",
|
||||
sprintf( msg, "%s Stream Write Errors Detected.\nOutput may be incomplete or corrupt.\nSee log file '%s' for details\n",
|
||||
isAudio ? "Audio" : "Video", AV_LOG_FILE_NAME);
|
||||
FCEUD_PrintError(msg);
|
||||
}
|
||||
|
@ -868,16 +853,14 @@ static void log_callback( void *avcl, int level, const char *fmt, va_list vl)
|
|||
int loadCodecConfig( int type, const char *codec_name, AVCodecContext *ctx)
|
||||
{
|
||||
int i,j;
|
||||
char filename[4096];
|
||||
char filename[512];
|
||||
char line[512];
|
||||
char section[256], id[256], val[256];
|
||||
void *obj, *child;
|
||||
FILE *fp;
|
||||
const char *baseDir = FCEUI_GetBaseDirectory();
|
||||
|
||||
snprintf( filename, sizeof(filename), "%s/avi/%s.conf", baseDir, codec_name );
|
||||
|
||||
filename[sizeof(filename)-1] = 0;
|
||||
sprintf( filename, "%s/avi/%s.conf", baseDir, codec_name );
|
||||
|
||||
fp = fopen( filename, "r");
|
||||
|
||||
|
@ -1008,14 +991,12 @@ int saveCodecConfig( int type, const char *codec_name, AVCodecContext *ctx)
|
|||
void *obj, *child = NULL;
|
||||
FILE *fp;
|
||||
uint8_t *str;
|
||||
char filename[4096];
|
||||
char filename[512];
|
||||
const AVOption *opt;
|
||||
bool useOpt;
|
||||
const char *baseDir = FCEUI_GetBaseDirectory();
|
||||
|
||||
snprintf( filename, sizeof(filename), "%s/avi/%s.conf", baseDir, codec_name );
|
||||
|
||||
filename[sizeof(filename)-1] = 0;
|
||||
sprintf( filename, "%s/avi/%s.conf", baseDir, codec_name );
|
||||
|
||||
fp = fopen( filename, "w");
|
||||
|
||||
|
@ -1304,8 +1285,9 @@ static int initVideoStream( const char *codec_name, OutputStream *ost )
|
|||
return 0;
|
||||
}
|
||||
|
||||
static AVFrame *alloc_audio_frame(const AVCodecContext *c,
|
||||
int nb_samples)
|
||||
static AVFrame *alloc_audio_frame(enum AVSampleFormat sample_fmt,
|
||||
uint64_t channel_layout,
|
||||
int sample_rate, int nb_samples)
|
||||
{
|
||||
AVFrame *frame = av_frame_alloc();
|
||||
int ret;
|
||||
|
@ -1314,13 +1296,9 @@ static AVFrame *alloc_audio_frame(const AVCodecContext *c,
|
|||
fprintf(stderr, "Error allocating an audio frame\n");
|
||||
return NULL;
|
||||
}
|
||||
frame->format = c->sample_fmt;
|
||||
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 28, 100)
|
||||
frame->channel_layout = c->channel_layout;
|
||||
#else
|
||||
av_channel_layout_copy(&frame->ch_layout, &c->ch_layout);
|
||||
#endif
|
||||
frame->sample_rate = c->sample_rate;
|
||||
frame->format = sample_fmt;
|
||||
frame->channel_layout = channel_layout;
|
||||
frame->sample_rate = sample_rate;
|
||||
frame->nb_samples = nb_samples;
|
||||
|
||||
if (nb_samples)
|
||||
|
@ -1335,48 +1313,6 @@ static AVFrame *alloc_audio_frame(const AVCodecContext *c,
|
|||
return frame;
|
||||
}
|
||||
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100)
|
||||
static int select_audio_channel_layout(const OutputStream *ost, const AVCodec *codec, AVChannelLayout *dst)
|
||||
{
|
||||
int best_nb_channels = 0;
|
||||
const AVChannelLayout *p, *best_ch_layout;
|
||||
#if __cplusplus >= 202002L
|
||||
const AVChannelLayout defaultLayout = AV_CHANNEL_LAYOUT_MONO;
|
||||
#else
|
||||
AVChannelLayout defaultLayout;
|
||||
av_channel_layout_from_mask( &defaultLayout, AV_CH_LAYOUT_MONO );
|
||||
#endif
|
||||
|
||||
if (!codec->ch_layouts)
|
||||
{
|
||||
return av_channel_layout_copy(dst, &defaultLayout);
|
||||
}
|
||||
|
||||
best_ch_layout = p = codec->ch_layouts;
|
||||
while (p && p->nb_channels)
|
||||
{
|
||||
int nb_channels = p->nb_channels;
|
||||
|
||||
if ( ost->chanLayout > 0 )
|
||||
{
|
||||
if (ost->chanLayout == p->u.mask)
|
||||
{
|
||||
best_ch_layout = p;
|
||||
best_nb_channels = nb_channels;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nb_channels > best_nb_channels)
|
||||
{
|
||||
best_ch_layout = p;
|
||||
best_nb_channels = nb_channels;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
return av_channel_layout_copy(dst, best_ch_layout);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int initAudioStream( const char *codec_name, OutputStream *ost )
|
||||
{
|
||||
int ret, nb_samples;
|
||||
|
@ -1470,7 +1406,6 @@ static int initAudioStream( const char *codec_name, OutputStream *ost )
|
|||
}
|
||||
|
||||
// Channel Layout Selection
|
||||
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 28, 100)
|
||||
if ( ost->chanLayout > 0 )
|
||||
{
|
||||
c->channel_layout = ost->chanLayout;
|
||||
|
@ -1497,13 +1432,6 @@ static int initAudioStream( const char *codec_name, OutputStream *ost )
|
|||
c->channel_layout = codec->channel_layouts ? codec->channel_layouts[0] : AV_CH_LAYOUT_STEREO;
|
||||
}
|
||||
c->channels = av_get_channel_layout_nb_channels(c->channel_layout);
|
||||
#else
|
||||
if (select_audio_channel_layout( ost, codec, &c->ch_layout) )
|
||||
{
|
||||
fprintf( avLogFp, "Error selecting the audio channel layout\n");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
c->bit_rate = 64000;
|
||||
//ost->st->time_base = (AVRational){ 1, c->sample_rate };
|
||||
ost->st->time_base.num = 1;
|
||||
|
@ -1526,24 +1454,10 @@ static int initAudioStream( const char *codec_name, OutputStream *ost )
|
|||
}
|
||||
av_opt_set_sample_fmt(ost->swr_ctx, "in_sample_fmt", AV_SAMPLE_FMT_S16, 0);
|
||||
av_opt_set_int(ost->swr_ctx, "in_sample_rate", audioSampleRate, 0);
|
||||
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 28, 100)
|
||||
av_opt_set_int(ost->swr_ctx, "in_channel_layout", AV_CH_LAYOUT_MONO, 0);
|
||||
#else
|
||||
#if __cplusplus >= 202002L
|
||||
AVChannelLayout src_ch_layout = AV_CHANNEL_LAYOUT_MONO;
|
||||
#else
|
||||
AVChannelLayout src_ch_layout;
|
||||
av_channel_layout_from_mask( &src_ch_layout, AV_CH_LAYOUT_MONO );
|
||||
#endif
|
||||
av_opt_set_chlayout(ost->swr_ctx, "in_chlayout", &src_ch_layout, 0);
|
||||
#endif
|
||||
av_opt_set_sample_fmt(ost->swr_ctx, "out_sample_fmt", c->sample_fmt, 0);
|
||||
av_opt_set_int(ost->swr_ctx, "out_sample_rate", c->sample_rate, 0);
|
||||
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 28, 100)
|
||||
av_opt_set_int(ost->swr_ctx, "out_channel_layout", c->channel_layout, 0);
|
||||
#else
|
||||
av_opt_set_chlayout(ost->swr_ctx, "out_chlayout", &c->ch_layout, 0);
|
||||
#endif
|
||||
|
||||
ret = swr_init(ost->swr_ctx);
|
||||
if (ret < 0)
|
||||
|
@ -1584,8 +1498,9 @@ static int initAudioStream( const char *codec_name, OutputStream *ost )
|
|||
ost->frameSize = nb_samples;
|
||||
ost->bytesPerSample = av_get_bytes_per_sample( c->sample_fmt );
|
||||
|
||||
ost->frame = alloc_audio_frame(c, nb_samples);
|
||||
ost->tmp_frame = alloc_audio_frame(c, nb_samples);
|
||||
ost->frame = alloc_audio_frame(c->sample_fmt, c->channel_layout, c->sample_rate, nb_samples);
|
||||
ost->tmp_frame = alloc_audio_frame(c->sample_fmt, c->channel_layout, c->sample_rate, nb_samples);
|
||||
//ost->tmp_frame = alloc_audio_frame(AV_SAMPLE_FMT_S16, AV_CH_LAYOUT_MONO, audioSampleRate, nb_samples);
|
||||
|
||||
//printf("Audio: FMT:%i ChanLayout:%li Rate:%i FrameSize:%i bytesPerSample:%i \n",
|
||||
// c->sample_fmt, c->channel_layout, c->sample_rate, nb_samples, ost->bytesPerSample );
|
||||
|
@ -1941,12 +1856,7 @@ static int encode_audio_frame( int16_t *audioOut, int numSamples)
|
|||
|
||||
ret = av_samples_copy( ost->frame->data, ost->tmp_frame->data,
|
||||
ost->frame->nb_samples, srcOffset, copySize,
|
||||
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 28, 100)
|
||||
ost->frame->channels,
|
||||
#else
|
||||
ost->frame->ch_layout.nb_channels,
|
||||
#endif
|
||||
ost->enc->sample_fmt );
|
||||
ost->frame->channels, ost->enc->sample_fmt );
|
||||
|
||||
if ( ret < 0 )
|
||||
{
|
||||
|
@ -2138,7 +2048,7 @@ int aviRecordLogOpen(void)
|
|||
if ( avLogFp == NULL )
|
||||
{
|
||||
char msg[512];
|
||||
snprintf( msg, sizeof(msg), "Error: Failed to open AV Recording log file for writing: %s\n", AV_LOG_FILE_NAME);
|
||||
sprintf( msg, "Error: Failed to open AV Recording log file for writing: %s\n", AV_LOG_FILE_NAME);
|
||||
FCEUD_PrintError(msg);
|
||||
avLogFp = stdout;
|
||||
}
|
||||
|
@ -2153,7 +2063,7 @@ int aviRecordOpenFile( const char *filepath )
|
|||
char fourcc[8];
|
||||
gwavi_audio_t audioConfig;
|
||||
double fps;
|
||||
std::string fileName;
|
||||
char fileName[1024];
|
||||
char txt[512];
|
||||
const char *romFile;
|
||||
|
||||
|
@ -2166,7 +2076,7 @@ int aviRecordOpenFile( const char *filepath )
|
|||
|
||||
if ( filepath != NULL )
|
||||
{
|
||||
fileName.assign( filepath );
|
||||
strcpy( fileName, filepath );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2185,21 +2095,21 @@ int aviRecordOpenFile( const char *filepath )
|
|||
|
||||
if ( lastPath.size() > 0 )
|
||||
{
|
||||
fileName.assign( lastPath.c_str() );
|
||||
fileName.append( "/" );
|
||||
strcpy( fileName, lastPath.c_str() );
|
||||
strcat( fileName, "/" );
|
||||
}
|
||||
else if ( baseDir )
|
||||
{
|
||||
fileName.assign( baseDir );
|
||||
fileName.append( "/avi/" );
|
||||
strcpy( fileName, baseDir );
|
||||
strcat( fileName, "/avi/" );
|
||||
}
|
||||
else
|
||||
{
|
||||
fileName.clear();
|
||||
fileName[0] = 0;
|
||||
}
|
||||
fileName.append( base );
|
||||
fileName.append(".avi");
|
||||
//printf("AVI Filepath:'%s'\n", fileName.c_str() );
|
||||
strcat( fileName, base );
|
||||
strcat( fileName, ".avi");
|
||||
//printf("AVI Filepath:'%s'\n", fileName );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2207,9 +2117,9 @@ int aviRecordOpenFile( const char *filepath )
|
|||
}
|
||||
}
|
||||
|
||||
if ( fileName.size() > 0 )
|
||||
if ( fileName[0] != 0 )
|
||||
{
|
||||
QFile file(fileName.c_str());
|
||||
QFile file(fileName);
|
||||
|
||||
if ( file.exists() )
|
||||
{
|
||||
|
@ -2217,7 +2127,7 @@ int aviRecordOpenFile( const char *filepath )
|
|||
std::string msg;
|
||||
|
||||
msg = "Pre-existing AVI file will be overwritten:\n\n" +
|
||||
fileName + "\n\nReplace file?";
|
||||
std::string(fileName) + "\n\nReplace file?";
|
||||
|
||||
ret = QMessageBox::warning( consoleWindow, QObject::tr("Overwrite Warning"),
|
||||
QString::fromStdString(msg), QMessageBox::Yes | QMessageBox::No );
|
||||
|
@ -2231,15 +2141,15 @@ int aviRecordOpenFile( const char *filepath )
|
|||
|
||||
date = QDate::currentDate();
|
||||
|
||||
avi_info.add_pair( "ICRD", date.toString(Qt::ISODate).toLocal8Bit().constData() );
|
||||
avi_info.add_pair( "ICRD", date.toString(Qt::ISODate).toStdString().c_str() );
|
||||
|
||||
avi_info.add_pair( "ILNG", QLocale::languageToString( locale.language() ).toLocal8Bit().constData() );
|
||||
avi_info.add_pair( "ILNG", QLocale::languageToString( locale.language() ).toStdString().c_str() );
|
||||
|
||||
avi_info.add_pair( "IARL", QLocale::countryToString( locale.country() ).toLocal8Bit().constData() );
|
||||
avi_info.add_pair( "IARL", QLocale::countryToString( locale.country() ).toStdString().c_str() );
|
||||
|
||||
avi_info.add_pair( "IMED", QSysInfo::prettyProductName().toLocal8Bit().constData() );
|
||||
avi_info.add_pair( "IMED", QSysInfo::prettyProductName().toStdString().c_str() );
|
||||
|
||||
snprintf( txt, sizeof(txt), "FCEUX %s", FCEU_VERSION_STRING );
|
||||
sprintf( txt, "FCEUX %s", FCEU_VERSION_STRING );
|
||||
avi_info.add_pair( "ITCH", txt );
|
||||
|
||||
romFile = getRomFile();
|
||||
|
@ -2315,12 +2225,12 @@ int aviRecordOpenFile( const char *filepath )
|
|||
#ifdef _USE_LIBAV
|
||||
if ( aviDriver == AVI_DRIVER_LIBAV )
|
||||
{
|
||||
if ( LIBAV::initMedia( fileName.c_str() ) )
|
||||
if ( LIBAV::initMedia( fileName ) )
|
||||
{
|
||||
char msg[512];
|
||||
fprintf( avLogFp, "Error: Failed to open AVI file.\n");
|
||||
recordEnable = false;
|
||||
snprintf( msg, sizeof(msg), "Error: AV Recording Initialization Failed.\nSee %s for details...\n", AV_LOG_FILE_NAME);
|
||||
sprintf( msg, "Error: AV Recording Initialization Failed.\nSee %s for details...\n", AV_LOG_FILE_NAME);
|
||||
FCEUD_PrintError(msg);
|
||||
return -1;
|
||||
}
|
||||
|
@ -2330,19 +2240,21 @@ int aviRecordOpenFile( const char *filepath )
|
|||
{
|
||||
gwavi = new gwavi_t();
|
||||
|
||||
if ( gwavi->open( fileName.c_str(), nes_shm->video.ncol, nes_shm->video.nrow, fourcc, fps, recordAudio ? &audioConfig : NULL ) )
|
||||
if ( gwavi->open( fileName, nes_shm->video.ncol, nes_shm->video.nrow, fourcc, fps, recordAudio ? &audioConfig : NULL ) )
|
||||
{
|
||||
char msg[512];
|
||||
fprintf( avLogFp, "Error: Failed to open AVI file.\n");
|
||||
recordEnable = false;
|
||||
snprintf( msg, sizeof(msg), "Error: AV Recording Initialization Failed.\nSee %s for details...\n", AV_LOG_FILE_NAME);
|
||||
sprintf( msg, "Error: AV Recording Initialization Failed.\nSee %s for details...\n", AV_LOG_FILE_NAME);
|
||||
FCEUD_PrintError(msg);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
vbufSize = 1024 * 1024 * 60;
|
||||
rawVideoBuf = (uint32_t*)malloc( vbufSize * sizeof(uint32_t) );
|
||||
|
||||
abufSize = 96000;
|
||||
rawAudioBuf = (int16_t*)malloc( abufSize * sizeof(uint16_t) );
|
||||
|
||||
vbufHead = 0;
|
||||
|
@ -2361,6 +2273,10 @@ int aviRecordAddFrame( void )
|
|||
return -1;
|
||||
}
|
||||
|
||||
//if ( gwavi == NULL )
|
||||
//{
|
||||
// return -1;
|
||||
//}
|
||||
if ( FCEUI_EmulationPaused() )
|
||||
{
|
||||
return 0;
|
||||
|
@ -2370,28 +2286,25 @@ int aviRecordAddFrame( void )
|
|||
|
||||
numPixels = nes_shm->video.ncol * nes_shm->video.nrow;
|
||||
|
||||
head = vbufHead;
|
||||
|
||||
auto calcAvailSize = [&]()
|
||||
availSize = (vbufTail - vbufHead);
|
||||
if ( availSize <= 0 )
|
||||
{
|
||||
availSize = (vbufTail - head);
|
||||
if ( availSize <= 0 )
|
||||
{
|
||||
availSize += vbufSize;
|
||||
}
|
||||
};
|
||||
|
||||
calcAvailSize();
|
||||
availSize += vbufSize;
|
||||
}
|
||||
|
||||
while ( numPixels > availSize )
|
||||
{
|
||||
//printf("Video Unavail %i \n", availSize );
|
||||
msleep(1);
|
||||
|
||||
calcAvailSize();
|
||||
availSize = (vbufTail - vbufHead);
|
||||
if ( availSize <= 0 )
|
||||
{
|
||||
availSize += vbufSize;
|
||||
}
|
||||
}
|
||||
|
||||
i = 0;
|
||||
i = 0; head = vbufHead;
|
||||
|
||||
while ( i < numPixels )
|
||||
{
|
||||
|
@ -2420,17 +2333,12 @@ int aviRecordAddAudioFrame( int32_t *buf, int numSamples )
|
|||
return -1;
|
||||
}
|
||||
|
||||
// Get current buffer index values from atomic variables and store in stack variables
|
||||
// Do loop processing with stack variables and then update atomics when finished
|
||||
int head = abufHead;
|
||||
|
||||
for (int i=0; i<numSamples; i++)
|
||||
{
|
||||
rawAudioBuf[ head ] = buf[i];
|
||||
rawAudioBuf[ abufHead ] = buf[i];
|
||||
|
||||
head = (head + 1) % abufSize;
|
||||
abufHead = (abufHead + 1) % abufSize;
|
||||
}
|
||||
abufHead = head;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2454,10 +2362,8 @@ int aviRecordClose(void)
|
|||
{
|
||||
free(rawAudioBuf); rawAudioBuf = NULL;
|
||||
}
|
||||
vbufHead = 0;
|
||||
abufHead = 0;
|
||||
vbufTail = 0;
|
||||
abufTail = 0;
|
||||
vbufTail = abufTail = 0;
|
||||
vbufSize = abufSize = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2599,7 +2505,6 @@ int FCEUD_AviGetFormatOpts( std::vector <std::string> &formatList )
|
|||
AviRecordDiskThread_t::AviRecordDiskThread_t( QObject *parent )
|
||||
: QThread(parent)
|
||||
{
|
||||
setObjectName( QString("AviRecordDiskThread") );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
AviRecordDiskThread_t::~AviRecordDiskThread_t(void)
|
||||
|
@ -2619,8 +2524,6 @@ void AviRecordDiskThread_t::run(void)
|
|||
char localRecordAudio = 0;
|
||||
int avgAudioPerFrame, audioChunkSize, audioSamplesAvail=0;
|
||||
int localVideoFormat;
|
||||
int audioHead = 0;
|
||||
int audioTail = 0;
|
||||
|
||||
fprintf( avLogFp, "AVI Record Disk Thread Start\n");
|
||||
|
||||
|
@ -2693,19 +2596,12 @@ void AviRecordDiskThread_t::run(void)
|
|||
// Main Disk Record Loop
|
||||
while ( !isInterruptionRequested() )
|
||||
{
|
||||
|
||||
while ( (numPixelsReady < numPixels) && (vbufTail != vbufHead) )
|
||||
{
|
||||
// Get current buffer index values from atomic variables and store in stack variables
|
||||
// Do loop processing with stack variables and then update atomics when finished
|
||||
int vhead = vbufHead;
|
||||
int vtail = vbufTail;
|
||||
|
||||
while ( (numPixelsReady < numPixels) && (vtail != vhead) )
|
||||
{
|
||||
videoOut[ numPixelsReady ] = rawVideoBuf[ vtail ]; numPixelsReady++;
|
||||
|
||||
vtail = (vtail + 1) % vbufSize;
|
||||
}
|
||||
vbufTail = vtail;
|
||||
videoOut[ numPixelsReady ] = rawVideoBuf[ vbufTail ]; numPixelsReady++;
|
||||
|
||||
vbufTail = (vbufTail + 1) % vbufSize;
|
||||
}
|
||||
|
||||
if ( numPixelsReady >= numPixels )
|
||||
|
@ -2759,11 +2655,7 @@ void AviRecordDiskThread_t::run(void)
|
|||
|
||||
numPixelsReady = 0;
|
||||
|
||||
// Get current buffer index values from atomic variables and store in stack variables
|
||||
// Do loop processing with stack variables and then update atomics when finished
|
||||
audioHead = abufHead;
|
||||
audioTail = abufTail;
|
||||
audioSamplesAvail = audioHead - audioTail;
|
||||
audioSamplesAvail = abufHead - abufTail;
|
||||
|
||||
if ( audioSamplesAvail < 0 )
|
||||
{
|
||||
|
@ -2775,18 +2667,17 @@ void AviRecordDiskThread_t::run(void)
|
|||
{
|
||||
numSamples = 0;
|
||||
|
||||
while ( audioHead != audioTail )
|
||||
while ( abufHead != abufTail )
|
||||
{
|
||||
audioOut[ numSamples ] = rawAudioBuf[ audioTail ]; numSamples++;
|
||||
audioOut[ numSamples ] = rawAudioBuf[ abufTail ]; numSamples++;
|
||||
|
||||
audioTail = (audioTail + 1) % abufSize;
|
||||
abufTail = (abufTail + 1) % abufSize;
|
||||
|
||||
if ( numSamples >= audioChunkSize )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
abufTail = audioTail;
|
||||
|
||||
if ( numSamples > 0 )
|
||||
{
|
||||
|
@ -2812,11 +2703,8 @@ void AviRecordDiskThread_t::run(void)
|
|||
}
|
||||
}
|
||||
|
||||
audioHead = abufHead;
|
||||
audioTail = abufTail;
|
||||
|
||||
// Write Leftover Audio Samples
|
||||
audioSamplesAvail = audioHead - audioTail;
|
||||
audioSamplesAvail = abufHead - abufTail;
|
||||
|
||||
if ( audioSamplesAvail < 0 )
|
||||
{
|
||||
|
@ -2829,13 +2717,12 @@ void AviRecordDiskThread_t::run(void)
|
|||
//printf("Writing Last %i Audio Samples\n", audioSamplesAvail );
|
||||
numSamples = 0;
|
||||
|
||||
while ( audioHead != audioTail )
|
||||
while ( abufHead != abufTail )
|
||||
{
|
||||
audioOut[ numSamples ] = rawAudioBuf[ audioTail ]; numSamples++;
|
||||
audioOut[ numSamples ] = rawAudioBuf[ abufTail ]; numSamples++;
|
||||
|
||||
audioTail = (audioTail + 1) % abufSize;
|
||||
abufTail = (abufTail + 1) % abufSize;
|
||||
}
|
||||
abufTail = audioTail;
|
||||
|
||||
if ( numSamples > 0 )
|
||||
{
|
||||
|
@ -3173,7 +3060,7 @@ void LibavOptionsPage::initSampleRateSelect( const char *codec_name )
|
|||
|
||||
while ( c->supported_samplerates[i] != 0 )
|
||||
{
|
||||
snprintf( rateName, sizeof(rateName), "%i", c->supported_samplerates[i] );
|
||||
sprintf( rateName, "%i", c->supported_samplerates[i] );
|
||||
|
||||
audioSampleRate->addItem( tr(rateName), c->supported_samplerates[i] );
|
||||
|
||||
|
@ -3206,7 +3093,6 @@ void LibavOptionsPage::initChannelLayoutSelect( const char *codec_name )
|
|||
{
|
||||
return;
|
||||
}
|
||||
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 28, 100)
|
||||
if ( c->channel_layouts )
|
||||
{
|
||||
int i=0;
|
||||
|
@ -3218,34 +3104,14 @@ void LibavOptionsPage::initChannelLayoutSelect( const char *codec_name )
|
|||
|
||||
audioChanLayout->addItem( tr(layoutDesc), (unsigned long long)c->channel_layouts[i] );
|
||||
|
||||
if ( static_cast<uint64_t>(LIBAV::audio_st.chanLayout) == c->channel_layouts[i] )
|
||||
if ( LIBAV::audio_st.chanLayout == c->channel_layouts[i] )
|
||||
{
|
||||
audioChanLayout->setCurrentIndex( audioChanLayout->count() - 1 );
|
||||
formatOk = true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
#else
|
||||
const AVChannelLayout *p = c->ch_layouts;
|
||||
|
||||
while (p && p->nb_channels)
|
||||
{
|
||||
char layoutDesc[256];
|
||||
|
||||
av_channel_layout_describe(p, layoutDesc, sizeof(layoutDesc));
|
||||
|
||||
audioChanLayout->addItem( tr(layoutDesc), (unsigned long long)p->u.mask );
|
||||
|
||||
if ( LIBAV::audio_st.chanLayout == p->u.mask )
|
||||
{
|
||||
audioChanLayout->setCurrentIndex( audioChanLayout->count() - 1 );
|
||||
formatOk = true;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
#endif
|
||||
if ( !formatOk )
|
||||
{
|
||||
LIBAV::audio_st.chanLayout = -1;
|
||||
|
@ -3300,10 +3166,10 @@ void LibavOptionsPage::initCodecLists(void)
|
|||
c = av_codec_iterate( &it );
|
||||
}
|
||||
|
||||
initPixelFormatSelect( videoEncSel->currentText().toLocal8Bit().constData() );
|
||||
initSampleFormatSelect( audioEncSel->currentText().toLocal8Bit().constData() );
|
||||
initSampleRateSelect( audioEncSel->currentText().toLocal8Bit().constData() );
|
||||
initChannelLayoutSelect( audioEncSel->currentText().toLocal8Bit().constData() );
|
||||
initPixelFormatSelect( videoEncSel->currentText().toStdString().c_str() );
|
||||
initSampleFormatSelect( audioEncSel->currentText().toStdString().c_str() );
|
||||
initSampleRateSelect( audioEncSel->currentText().toStdString().c_str() );
|
||||
initChannelLayoutSelect( audioEncSel->currentText().toStdString().c_str() );
|
||||
|
||||
videoEncSel->model()->sort(0, Qt::AscendingOrder);
|
||||
audioEncSel->model()->sort(0, Qt::AscendingOrder);
|
||||
|
@ -3318,7 +3184,7 @@ void LibavOptionsPage::videoCodecChanged(int idx)
|
|||
{
|
||||
const AVCodec *c;
|
||||
|
||||
LIBAV::video_st.selEnc = videoEncSel->currentText().toLocal8Bit().constData();
|
||||
LIBAV::video_st.selEnc = videoEncSel->currentText().toStdString().c_str();
|
||||
|
||||
c = avcodec_find_encoder_by_name( LIBAV::video_st.selEnc.c_str() );
|
||||
|
||||
|
@ -3333,7 +3199,7 @@ void LibavOptionsPage::audioCodecChanged(int idx)
|
|||
{
|
||||
const AVCodec *c;
|
||||
|
||||
LIBAV::audio_st.selEnc = audioEncSel->currentText().toLocal8Bit().constData();
|
||||
LIBAV::audio_st.selEnc = audioEncSel->currentText().toStdString().c_str();
|
||||
|
||||
c = avcodec_find_encoder_by_name( LIBAV::audio_st.selEnc.c_str() );
|
||||
|
||||
|
@ -3447,7 +3313,7 @@ void LibavEncOptItem::setValueText(void)
|
|||
if ( units[x]->default_val.i64 & i )
|
||||
{
|
||||
char stmp2[128];
|
||||
snprintf( stmp2, sizeof(stmp2), "%s", units[x]->name );
|
||||
sprintf( stmp2, "%s", units[x]->name );
|
||||
if (j>0)
|
||||
{
|
||||
strcat( stmp, ",");
|
||||
|
@ -3469,9 +3335,7 @@ void LibavEncOptItem::setValueText(void)
|
|||
break;
|
||||
case AV_OPT_TYPE_INT:
|
||||
case AV_OPT_TYPE_INT64:
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(55, 58, 100)
|
||||
case AV_OPT_TYPE_UINT64:
|
||||
#endif
|
||||
{
|
||||
int64_t i;
|
||||
|
||||
|
@ -3482,7 +3346,7 @@ void LibavEncOptItem::setValueText(void)
|
|||
if ( units[x]->default_val.i64 == i )
|
||||
{
|
||||
char stmp2[128];
|
||||
snprintf( stmp2, sizeof(stmp2), " (%s)", units[x]->name );
|
||||
sprintf( stmp2, " (%s)", units[x]->name );
|
||||
strcat( stmp, stmp2 );
|
||||
break;
|
||||
}
|
||||
|
@ -3518,12 +3382,12 @@ LibavEncOptWin::LibavEncOptWin(int type, QWidget *parent)
|
|||
if ( type )
|
||||
{
|
||||
codec_name = LIBAV::audio_st.selEnc.c_str();
|
||||
snprintf( title, sizeof(title), "%s Audio Encoder Configuration", codec_name );
|
||||
sprintf( title, "%s Audio Encoder Configuration", codec_name );
|
||||
}
|
||||
else
|
||||
{
|
||||
codec_name = LIBAV::video_st.selEnc.c_str();
|
||||
snprintf( title, sizeof(title), "%s Video Encoder Configuration", codec_name );
|
||||
sprintf( title, "%s Video Encoder Configuration", codec_name );
|
||||
}
|
||||
setWindowTitle( title );
|
||||
resize(512, 512);
|
||||
|
@ -3843,9 +3707,7 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
|
|||
{
|
||||
case AV_OPT_TYPE_INT:
|
||||
case AV_OPT_TYPE_INT64:
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(55, 58, 100)
|
||||
case AV_OPT_TYPE_UINT64:
|
||||
#endif
|
||||
{
|
||||
int64_t val;
|
||||
|
||||
|
@ -3853,13 +3715,13 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
|
|||
|
||||
grid->addWidget( new QLabel( tr("Range:") ), 2, 0 );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "[ %.0f, %.0f ]", opt->min, opt->max );
|
||||
sprintf( stmp, "[ %.0f, %.0f ]", opt->min, opt->max );
|
||||
|
||||
grid->addWidget( new QLabel( tr(stmp) ), 2, 1 );
|
||||
|
||||
grid->addWidget( new QLabel( tr("Default:") ), 3, 0 );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%lli", (long long)opt->default_val.i64 );
|
||||
sprintf( stmp, "%lli", (long long)opt->default_val.i64 );
|
||||
|
||||
grid->addWidget( new QLabel( tr(stmp) ), 3, 1 );
|
||||
|
||||
|
@ -3875,12 +3737,12 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
|
|||
{
|
||||
if ( item->units[i]->help )
|
||||
{
|
||||
snprintf( stmp, sizeof(stmp), "%3lli: %s - %s", (long long)item->units[i]->default_val.i64,
|
||||
sprintf( stmp, "%3lli: %s - %s", (long long)item->units[i]->default_val.i64,
|
||||
item->units[i]->name, item->units[i]->help );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( stmp, sizeof(stmp), "%3lli: %s", (long long)item->units[i]->default_val.i64,
|
||||
sprintf( stmp, "%3lli: %s", (long long)item->units[i]->default_val.i64,
|
||||
item->units[i]->name );
|
||||
}
|
||||
|
||||
|
@ -3911,13 +3773,13 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
|
|||
|
||||
grid->addWidget( new QLabel( tr("Range:") ), 2, 0 );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "[ %e, %e ]", opt->min, opt->max );
|
||||
sprintf( stmp, "[ %e, %e ]", opt->min, opt->max );
|
||||
|
||||
grid->addWidget( new QLabel( tr(stmp) ), 2, 1 );
|
||||
|
||||
grid->addWidget( new QLabel( tr("Default:") ), 3, 0 );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%f", opt->default_val.dbl );
|
||||
sprintf( stmp, "%f", opt->default_val.dbl );
|
||||
|
||||
grid->addWidget( new QLabel( tr(stmp) ), 3, 1 );
|
||||
|
||||
|
@ -3942,7 +3804,7 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
|
|||
|
||||
if ( opt->default_val.str )
|
||||
{
|
||||
snprintf( stmp, sizeof(stmp), "%s", opt->default_val.str );
|
||||
sprintf( stmp, "%s", opt->default_val.str );
|
||||
}
|
||||
grid->addWidget( new QLabel( tr(stmp) ), 2, 1 );
|
||||
|
||||
|
@ -3966,7 +3828,7 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
|
|||
|
||||
grid->addWidget( new QLabel( tr("Default:") ), 2, 0 );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%i/%i", opt->default_val.q.num, opt->default_val.q.den );
|
||||
sprintf( stmp, "%i/%i", opt->default_val.q.num, opt->default_val.q.den );
|
||||
|
||||
grid->addWidget( new QLabel( tr(stmp) ), 2, 1 );
|
||||
|
||||
|
@ -3996,7 +3858,7 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
|
|||
|
||||
grid->addWidget( new QLabel( tr("Default:") ), 2, 0 );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%s", opt->default_val.i64 ? "true" : "false" );
|
||||
sprintf( stmp, "%s", opt->default_val.i64 ? "true" : "false" );
|
||||
|
||||
grid->addWidget( new QLabel( tr(stmp) ), 2, 1 );
|
||||
|
||||
|
@ -4020,7 +3882,7 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
|
|||
|
||||
grid->addWidget( new QLabel( tr("Default:") ), 2, 0 );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "0x%08llX", (unsigned long long)opt->default_val.i64 );
|
||||
sprintf( stmp, "0x%08llX", (unsigned long long)opt->default_val.i64 );
|
||||
|
||||
grid->addWidget( new QLabel( tr(stmp) ), 2, 1 );
|
||||
|
||||
|
@ -4030,7 +3892,7 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
|
|||
|
||||
for (size_t i=0; i<item->units.size(); i++)
|
||||
{
|
||||
snprintf( stmp, sizeof(stmp), "%s", item->units[i]->name );
|
||||
sprintf( stmp, "%s", item->units[i]->name );
|
||||
|
||||
c = new QCheckBox( tr(stmp) );
|
||||
|
||||
|
@ -4110,9 +3972,7 @@ void LibavEncOptInputWin::applyChanges(void)
|
|||
{
|
||||
case AV_OPT_TYPE_INT:
|
||||
case AV_OPT_TYPE_INT64:
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(55, 58, 100)
|
||||
case AV_OPT_TYPE_UINT64:
|
||||
#endif
|
||||
{
|
||||
if ( intEntry )
|
||||
{
|
||||
|
@ -4139,7 +3999,7 @@ void LibavEncOptInputWin::applyChanges(void)
|
|||
{
|
||||
if ( strEntry )
|
||||
{
|
||||
av_opt_set( item->obj, item->opt->name, strEntry->text().toLocal8Bit().constData(), 0 );
|
||||
av_opt_set( item->obj, item->opt->name, strEntry->text().toStdString().c_str(), 0 );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -4202,9 +4062,7 @@ void LibavEncOptInputWin::resetDefaultsCB(void)
|
|||
{
|
||||
case AV_OPT_TYPE_INT:
|
||||
case AV_OPT_TYPE_INT64:
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(55, 58, 100)
|
||||
case AV_OPT_TYPE_UINT64:
|
||||
#endif
|
||||
{
|
||||
if ( intEntry )
|
||||
{
|
||||
|
|
|
@ -294,18 +294,18 @@ void AviRiffViewerDialog::openAviFileDialog(void)
|
|||
{
|
||||
return;
|
||||
}
|
||||
//qDebug() << "selected file path : " << filename.toLocal8Bit();
|
||||
//qDebug() << "selected file path : " << filename.toUtf8();
|
||||
|
||||
printf( "AVI Debug movie %s\n", filename.toLocal8Bit().constData() );
|
||||
printf( "AVI Debug movie %s\n", filename.toStdString().c_str() );
|
||||
|
||||
lastPath = QFileInfo(filename).absolutePath().toLocal8Bit().constData();
|
||||
lastPath = QFileInfo(filename).absolutePath().toStdString();
|
||||
|
||||
if ( lastPath.size() > 0 )
|
||||
{
|
||||
g_config->setOption ("SDL.AviFilePath", lastPath);
|
||||
}
|
||||
|
||||
openFile( filename.toLocal8Bit().constData() );
|
||||
openFile( filename.toStdString().c_str() );
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
int AviRiffViewerDialog::openFile( const char *filepath )
|
||||
|
@ -475,112 +475,112 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
|
|||
|
||||
avi->getChunkData( item->filePos(), data.buf, item->getSize()+8 );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
|
||||
sprintf( stmp, "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("fcc") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(4) );
|
||||
sprintf( stmp, "%u", data.readU32(4) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("cb") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(8) );
|
||||
sprintf( stmp, "%u", data.readU32(8) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwMicroSecPerFrame") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(12) );
|
||||
sprintf( stmp, "%u", data.readU32(12) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwMaxBytesPerSec") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(16) );
|
||||
sprintf( stmp, "%u", data.readU32(16) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwPaddingGranularity") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "0x%X", data.readU32(20) );
|
||||
sprintf( stmp, "0x%X", data.readU32(20) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwFlags") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(24) );
|
||||
sprintf( stmp, "%u", data.readU32(24) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwTotalFrames") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(28) );
|
||||
sprintf( stmp, "%u", data.readU32(28) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwInitialFrames") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(32) );
|
||||
sprintf( stmp, "%u", data.readU32(32) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwStreams") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(36) );
|
||||
sprintf( stmp, "%u", data.readU32(36) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwSuggestedBufferSize") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(40) );
|
||||
sprintf( stmp, "%u", data.readU32(40) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwWidth") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(44) );
|
||||
sprintf( stmp, "%u", data.readU32(44) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwHeight") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(48) );
|
||||
sprintf( stmp, "%u", data.readU32(48) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwScale") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(52) );
|
||||
sprintf( stmp, "%u", data.readU32(52) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwRate") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(56) );
|
||||
sprintf( stmp, "%u", data.readU32(56) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwStart") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(60) );
|
||||
sprintf( stmp, "%u", data.readU32(60) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwLength") );
|
||||
|
@ -593,21 +593,21 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
|
|||
|
||||
avi->getChunkData( item->filePos(), data.buf, item->getSize()+8 );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
|
||||
sprintf( stmp, "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("fcc") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(4) );
|
||||
sprintf( stmp, "%u", data.readU32(4) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("cb") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%c%c%c%c", data.buf[8], data.buf[9], data.buf[10], data.buf[11] );
|
||||
sprintf( stmp, "%c%c%c%c", data.buf[8], data.buf[9], data.buf[10], data.buf[11] );
|
||||
strcpy( strhType, stmp );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
|
@ -617,11 +617,11 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
|
|||
|
||||
if ( isalnum(data.buf[12]) )
|
||||
{
|
||||
snprintf( stmp, sizeof(stmp), "%c%c%c%c", data.buf[12], data.buf[13], data.buf[14], data.buf[15] );
|
||||
sprintf( stmp, "%c%c%c%c", data.buf[12], data.buf[13], data.buf[14], data.buf[15] );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( stmp, sizeof(stmp), "0x%X", data.readU32(12) );
|
||||
sprintf( stmp, "0x%X", data.readU32(12) );
|
||||
}
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
|
@ -629,42 +629,42 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
|
|||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "0x%X", data.readU32(16) );
|
||||
sprintf( stmp, "0x%X", data.readU32(16) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwFlags") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU16(20) );
|
||||
sprintf( stmp, "%u", data.readU16(20) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("wPriority") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU16(22) );
|
||||
sprintf( stmp, "%u", data.readU16(22) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("wLanguage") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(24) );
|
||||
sprintf( stmp, "%u", data.readU32(24) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwInitialFrames") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(28) );
|
||||
sprintf( stmp, "%u", data.readU32(28) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwScale") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(32) );
|
||||
sprintf( stmp, "%u", data.readU32(32) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwRate") );
|
||||
|
@ -672,68 +672,68 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
|
|||
|
||||
if ( strcmp( strhType, "vids" ) == 0 )
|
||||
{
|
||||
snprintf( stmp, sizeof(stmp), "(%13.10f Hz)", (double)data.readU32(32) / (double)data.readU32(28) );
|
||||
sprintf( stmp, "(%13.10f Hz)", (double)data.readU32(32) / (double)data.readU32(28) );
|
||||
twi->setText( 3, tr(stmp) );
|
||||
}
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(36) );
|
||||
sprintf( stmp, "%u", data.readU32(36) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwStart") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(40) );
|
||||
sprintf( stmp, "%u", data.readU32(40) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwLength") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(44) );
|
||||
sprintf( stmp, "%u", data.readU32(44) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwSuggestedBufferSize") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%i", data.readI32(48) );
|
||||
sprintf( stmp, "%i", data.readI32(48) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwQuality") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(52) );
|
||||
sprintf( stmp, "%u", data.readU32(52) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("dwSampleSize") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU16(56) );
|
||||
sprintf( stmp, "%u", data.readU16(56) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("rcFrame.left") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU16(58) );
|
||||
sprintf( stmp, "%u", data.readU16(58) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("rcFrame.top") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU16(60) );
|
||||
sprintf( stmp, "%u", data.readU16(60) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("rcFrame.right") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU16(62) );
|
||||
sprintf( stmp, "%u", data.readU16(62) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("rcFrame.bottom") );
|
||||
|
@ -748,49 +748,49 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
|
|||
|
||||
avi->getChunkData( item->filePos(), data.buf, item->getSize()+8 );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
|
||||
sprintf( stmp, "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("fcc") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(4) );
|
||||
sprintf( stmp, "%u", data.readU32(4) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("cb") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(8) );
|
||||
sprintf( stmp, "%u", data.readU32(8) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("biSize") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%i", data.readI32(12) );
|
||||
sprintf( stmp, "%i", data.readI32(12) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("biWidth") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%i", data.readI32(16) );
|
||||
sprintf( stmp, "%i", data.readI32(16) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("biHeight") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU16(20) );
|
||||
sprintf( stmp, "%u", data.readU16(20) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("biPlanes") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU16(22) );
|
||||
sprintf( stmp, "%u", data.readU16(22) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("biBitCount") );
|
||||
|
@ -799,11 +799,11 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
|
|||
|
||||
if ( isalnum(data.buf[24]) )
|
||||
{
|
||||
snprintf( stmp, sizeof(stmp), "%c%c%c%c", data.buf[24], data.buf[25], data.buf[26], data.buf[27] );
|
||||
sprintf( stmp, "%c%c%c%c", data.buf[24], data.buf[25], data.buf[26], data.buf[27] );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( stmp, sizeof(stmp), "0x%X", data.readU32(24) );
|
||||
sprintf( stmp, "0x%X", data.readU32(24) );
|
||||
}
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
|
@ -811,35 +811,35 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
|
|||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(28) );
|
||||
sprintf( stmp, "%u", data.readU32(28) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("biSizeImage") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%i", data.readI32(32) );
|
||||
sprintf( stmp, "%i", data.readI32(32) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("biXPelsPerMeter") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%i", data.readI32(36) );
|
||||
sprintf( stmp, "%i", data.readI32(36) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("biYPelsPerMeter") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(40) );
|
||||
sprintf( stmp, "%u", data.readU32(40) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("biClrUsed") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(44) );
|
||||
sprintf( stmp, "%u", data.readU32(44) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("biClrImportant") );
|
||||
|
@ -854,56 +854,56 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
|
|||
|
||||
avi->getChunkData( item->filePos(), data.buf, dataSize );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
|
||||
sprintf( stmp, "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("fcc") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(4) );
|
||||
sprintf( stmp, "%u", data.readU32(4) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("cb") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU16(8) );
|
||||
sprintf( stmp, "%u", data.readU16(8) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("wFormatTag") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU16(10) );
|
||||
sprintf( stmp, "%u", data.readU16(10) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("nChannels") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(12) );
|
||||
sprintf( stmp, "%u", data.readU32(12) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("nSamplesPerSec") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(16) );
|
||||
sprintf( stmp, "%u", data.readU32(16) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("nAvgBytesPerSec") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU16(20) );
|
||||
sprintf( stmp, "%u", data.readU16(20) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("nBlockAlign") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU16(22) );
|
||||
sprintf( stmp, "%u", data.readU16(22) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("nBitsPerSample") );
|
||||
|
@ -929,25 +929,25 @@ int AviRiffViewerDialog::processChunk( AviRiffTreeItem *item )
|
|||
|
||||
avi->getChunkData( item->filePos(), data.buf, item->getSize()+8 );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
|
||||
sprintf( stmp, "%c%c%c%c", data.buf[0], data.buf[1], data.buf[2], data.buf[3] );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("fcc") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(4) );
|
||||
sprintf( stmp, "%u", data.readU32(4) );
|
||||
|
||||
twi = new QTreeWidgetItem();
|
||||
twi->setText( 0, tr("cb") );
|
||||
twi->setText( 2, tr(stmp) );
|
||||
item->addChild(twi);
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%u", data.readU32(8) );
|
||||
sprintf( stmp, "%u", data.readU32(8) );
|
||||
|
||||
for (i=0; i < static_cast<int>(item->getSize()); i++)
|
||||
for (i=0; i<item->getSize(); i++)
|
||||
{
|
||||
if ( i >= (static_cast<int>(sizeof(stmp))-1 ) )
|
||||
if ( i >= ( sizeof(stmp)-1 ) )
|
||||
{
|
||||
i = sizeof(stmp)-1; break;
|
||||
}
|
||||
|
@ -991,7 +991,7 @@ AviRiffTreeItem::AviRiffTreeItem(int typeIn, long long int fposIn, const char *f
|
|||
|
||||
strcpy( fourcc, fourccIn );
|
||||
|
||||
//snprintf( stmp, sizeof(stmp), "0x%08llX", fposIn );
|
||||
//sprintf( stmp, "0x%08llX", fposIn );
|
||||
|
||||
switch ( type )
|
||||
{
|
||||
|
@ -1013,16 +1013,16 @@ AviRiffTreeItem::AviRiffTreeItem(int typeIn, long long int fposIn, const char *f
|
|||
|
||||
if ( showSizeHex )
|
||||
{
|
||||
snprintf( stmp, sizeof(stmp), "0x%08lX", (unsigned long)size );
|
||||
sprintf( stmp, "0x%08lX", (unsigned long)size );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( stmp, sizeof(stmp), "%zu", size );
|
||||
sprintf( stmp, "%zu", size );
|
||||
}
|
||||
|
||||
setText( 2, QString(stmp) );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "0x%08llX", fposIn );
|
||||
sprintf( stmp, "0x%08llX", fposIn );
|
||||
|
||||
setText( 3, QString(stmp) );
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ void openCheatDialog(QWidget *parent)
|
|||
{
|
||||
win->activateWindow();
|
||||
win->raise();
|
||||
win->setFocus();
|
||||
return;
|
||||
}
|
||||
win = new GuiCheatsDialog_t(parent);
|
||||
|
@ -517,9 +518,9 @@ int GuiCheatsDialog_t::addSearchResult(uint32_t a, uint8_t last, uint8_t current
|
|||
|
||||
item = new QTreeWidgetItem();
|
||||
|
||||
snprintf(addrStr, sizeof(addrStr), "$%04X", a);
|
||||
snprintf(lastStr, sizeof(lastStr), "%02X", last);
|
||||
snprintf(curStr, sizeof(curStr), "%02X", current);
|
||||
sprintf(addrStr, "$%04X", a);
|
||||
sprintf(lastStr, "%02X", last);
|
||||
sprintf(curStr, "%02X", current);
|
||||
|
||||
//item->setFont( 0, font );
|
||||
//item->setFont( 1, font );
|
||||
|
@ -591,9 +592,9 @@ void GuiCheatsDialog_t::knownValueCallback(void)
|
|||
//printf("Cheat Search Known!\n");
|
||||
FCEU_WRAPPER_LOCK();
|
||||
|
||||
//printf("'%s'\n", knownValEntry->displayText().toLocal8Bit().constData() );
|
||||
//printf("'%s'\n", knownValEntry->displayText().toStdString().c_str() );
|
||||
|
||||
value = strtol(knownValEntry->displayText().toLocal8Bit().constData(), NULL, 16);
|
||||
value = strtol(knownValEntry->displayText().toStdString().c_str(), NULL, 16);
|
||||
|
||||
FCEUI_CheatSearchEnd(FCEU_SEARCH_NEWVAL_KNOWN, value, 0);
|
||||
|
||||
|
@ -624,7 +625,7 @@ void GuiCheatsDialog_t::notEqualValueCallback(void)
|
|||
|
||||
if (checked)
|
||||
{
|
||||
value = strtol(neValEntry->displayText().toLocal8Bit().constData(), NULL, 16);
|
||||
value = strtol(neValEntry->displayText().toStdString().c_str(), NULL, 16);
|
||||
|
||||
FCEUI_CheatSearchEnd(FCEU_SEARCH_PUERLY_RELATIVE_CHANGE, 0, value);
|
||||
}
|
||||
|
@ -648,7 +649,7 @@ void GuiCheatsDialog_t::greaterThanValueCallback(void)
|
|||
|
||||
if (checked)
|
||||
{
|
||||
value = strtol(grValEntry->displayText().toLocal8Bit().constData(), NULL, 16);
|
||||
value = strtol(grValEntry->displayText().toStdString().c_str(), NULL, 16);
|
||||
|
||||
FCEUI_CheatSearchEnd(FCEU_SEARCH_NEWVAL_GT_KNOWN, 0, value);
|
||||
}
|
||||
|
@ -672,7 +673,7 @@ void GuiCheatsDialog_t::lessThanValueCallback(void)
|
|||
|
||||
if (checked)
|
||||
{
|
||||
value = strtol(ltValEntry->displayText().toLocal8Bit().constData(), NULL, 16);
|
||||
value = strtol(ltValEntry->displayText().toStdString().c_str(), NULL, 16);
|
||||
|
||||
FCEUI_CheatSearchEnd(FCEU_SEARCH_NEWVAL_LT_KNOWN, 0, value);
|
||||
}
|
||||
|
@ -693,21 +694,25 @@ int GuiCheatsDialog_t::activeCheatListCB(const char *name, uint32 a, uint8 v, in
|
|||
|
||||
if (c >= 0)
|
||||
{
|
||||
snprintf(codeStr, sizeof(codeStr), "$%04X?%02X:%02X", a, c, v);
|
||||
sprintf(codeStr, "$%04X?%02X:%02X", a, c, v);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(codeStr, sizeof(codeStr), "$%04X:%02X ", a, v);
|
||||
sprintf(codeStr, "$%04X:%02X ", a, v);
|
||||
}
|
||||
|
||||
item = actvCheatList->topLevelItem(actvCheatIdx);
|
||||
|
||||
if (item == NULL)
|
||||
{
|
||||
item = new QTreeWidgetItem(actvCheatList);
|
||||
item = new QTreeWidgetItem();
|
||||
|
||||
actvCheatList->addTopLevelItem(item);
|
||||
}
|
||||
|
||||
//item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable );
|
||||
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemNeverHasChildren);
|
||||
|
||||
item->setCheckState(0, s ? Qt::Checked : Qt::Unchecked);
|
||||
|
||||
item->setText(0, tr(codeStr));
|
||||
|
@ -733,6 +738,8 @@ void GuiCheatsDialog_t::showActiveCheatList(bool redraw)
|
|||
|
||||
enaCheats->setChecked(!globalCheatDisabled);
|
||||
|
||||
actvCheatRedraw = redraw;
|
||||
|
||||
if (redraw)
|
||||
{
|
||||
actvCheatList->clear();
|
||||
|
@ -740,8 +747,6 @@ void GuiCheatsDialog_t::showActiveCheatList(bool redraw)
|
|||
actvCheatIdx = 0;
|
||||
|
||||
FCEUI_ListCheats(::activeCheatListCB, (void *)this);
|
||||
|
||||
actvCheatList->viewport()->update();
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void GuiCheatsDialog_t::openCheatFile(void)
|
||||
|
@ -750,7 +755,7 @@ void GuiCheatsDialog_t::openCheatFile(void)
|
|||
int ret, useNativeFileDialogVal;
|
||||
QString filename;
|
||||
std::string last;
|
||||
std::string dir;
|
||||
char dir[512];
|
||||
QFileDialog dialog(this, tr("Open Cheat File"));
|
||||
|
||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||
|
@ -765,77 +770,6 @@ void GuiCheatsDialog_t::openCheatFile(void)
|
|||
|
||||
getDirFromFile(last.c_str(), dir);
|
||||
|
||||
dialog.setDirectory(tr(dir.c_str()));
|
||||
|
||||
// Check config option to use native file dialog or not
|
||||
g_config->getOption("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||
|
||||
dialog.setOption(QFileDialog::DontUseNativeDialog, !useNativeFileDialogVal);
|
||||
|
||||
ret = dialog.exec();
|
||||
|
||||
if (ret)
|
||||
{
|
||||
QStringList fileList;
|
||||
fileList = dialog.selectedFiles();
|
||||
|
||||
if (fileList.size() > 0)
|
||||
{
|
||||
filename = fileList[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (filename.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
qDebug() << "selected file path : " << filename.toLocal8Bit();
|
||||
|
||||
g_config->setOption("SDL.LastOpenFile", filename.toLocal8Bit().constData());
|
||||
|
||||
FCEU_WRAPPER_LOCK();
|
||||
|
||||
fp = fopen(filename.toLocal8Bit().constData(), "r");
|
||||
|
||||
if (fp != NULL)
|
||||
{
|
||||
FCEU_LoadGameCheats(fp, 0);
|
||||
fclose(fp);
|
||||
}
|
||||
FCEU_WRAPPER_UNLOCK();
|
||||
|
||||
showActiveCheatList(true);
|
||||
|
||||
return;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void GuiCheatsDialog_t::saveCheatFile(void)
|
||||
{
|
||||
FILE *fp;
|
||||
int ret, useNativeFileDialogVal;
|
||||
QString filename;
|
||||
char dir[4096];
|
||||
QFileDialog dialog(this, tr("Save Cheat File"));
|
||||
|
||||
dialog.setFileMode(QFileDialog::AnyFile);
|
||||
|
||||
dialog.setNameFilter(tr("Cheat files (*.cht *.CHT) ;; All files (*)"));
|
||||
|
||||
dialog.setViewMode(QFileDialog::List);
|
||||
dialog.setFilter(QDir::AllEntries | QDir::AllDirs | QDir::Hidden);
|
||||
dialog.setLabelText(QFileDialog::Accept, tr("Save"));
|
||||
|
||||
if (GameInfo)
|
||||
{
|
||||
getFileBaseName(GameInfo->filename, dir);
|
||||
|
||||
strcat(dir, ".cht");
|
||||
|
||||
dialog.selectFile(dir);
|
||||
}
|
||||
|
||||
snprintf(dir, sizeof(dir), "%s/cheats", FCEUI_GetBaseDirectory());
|
||||
|
||||
dialog.setDirectory(tr(dir));
|
||||
|
||||
// Check config option to use native file dialog or not
|
||||
|
@ -860,13 +794,84 @@ void GuiCheatsDialog_t::saveCheatFile(void)
|
|||
{
|
||||
return;
|
||||
}
|
||||
qDebug() << "selected file path : " << filename.toLocal8Bit();
|
||||
qDebug() << "selected file path : " << filename.toUtf8();
|
||||
|
||||
//g_config->setOption ("SDL.LastOpenFile", filename.toLocal8Bit().constData() );
|
||||
g_config->setOption("SDL.LastOpenFile", filename.toStdString().c_str());
|
||||
|
||||
FCEU_WRAPPER_LOCK();
|
||||
|
||||
fp = FCEUD_UTF8fopen(filename.toLocal8Bit().constData(), "wb");
|
||||
fp = fopen(filename.toStdString().c_str(), "r");
|
||||
|
||||
if (fp != NULL)
|
||||
{
|
||||
FCEU_LoadGameCheats(fp, 0);
|
||||
fclose(fp);
|
||||
}
|
||||
FCEU_WRAPPER_UNLOCK();
|
||||
|
||||
showActiveCheatList(true);
|
||||
|
||||
return;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void GuiCheatsDialog_t::saveCheatFile(void)
|
||||
{
|
||||
FILE *fp;
|
||||
int ret, useNativeFileDialogVal;
|
||||
QString filename;
|
||||
char dir[512];
|
||||
QFileDialog dialog(this, tr("Save Cheat File"));
|
||||
|
||||
dialog.setFileMode(QFileDialog::AnyFile);
|
||||
|
||||
dialog.setNameFilter(tr("Cheat files (*.cht *.CHT) ;; All files (*)"));
|
||||
|
||||
dialog.setViewMode(QFileDialog::List);
|
||||
dialog.setFilter(QDir::AllEntries | QDir::AllDirs | QDir::Hidden);
|
||||
dialog.setLabelText(QFileDialog::Accept, tr("Save"));
|
||||
|
||||
if (GameInfo)
|
||||
{
|
||||
getFileBaseName(GameInfo->filename, dir);
|
||||
|
||||
strcat(dir, ".cht");
|
||||
|
||||
dialog.selectFile(dir);
|
||||
}
|
||||
|
||||
sprintf(dir, "%s/cheats", FCEUI_GetBaseDirectory());
|
||||
|
||||
dialog.setDirectory(tr(dir));
|
||||
|
||||
// Check config option to use native file dialog or not
|
||||
g_config->getOption("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||
|
||||
dialog.setOption(QFileDialog::DontUseNativeDialog, !useNativeFileDialogVal);
|
||||
|
||||
ret = dialog.exec();
|
||||
|
||||
if (ret)
|
||||
{
|
||||
QStringList fileList;
|
||||
fileList = dialog.selectedFiles();
|
||||
|
||||
if (fileList.size() > 0)
|
||||
{
|
||||
filename = fileList[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (filename.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
qDebug() << "selected file path : " << filename.toUtf8();
|
||||
|
||||
//g_config->setOption ("SDL.LastOpenFile", filename.toStdString().c_str() );
|
||||
|
||||
FCEU_WRAPPER_LOCK();
|
||||
|
||||
fp = FCEUD_UTF8fopen(filename.toStdString().c_str(), "wb");
|
||||
|
||||
if (fp != NULL)
|
||||
{
|
||||
|
@ -888,11 +893,11 @@ void GuiCheatsDialog_t::addActvCheat(void)
|
|||
int t = 1;
|
||||
std::string name, cmpStr;
|
||||
|
||||
a = strtoul(cheatAddrEntry->displayText().toLocal8Bit().constData(), NULL, 16);
|
||||
a = strtoul(cheatAddrEntry->displayText().toStdString().c_str(), NULL, 16);
|
||||
|
||||
v = strtoul(cheatValEntry->displayText().toLocal8Bit().constData(), NULL, 16);
|
||||
v = strtoul(cheatValEntry->displayText().toStdString().c_str(), NULL, 16);
|
||||
|
||||
cmpStr = cheatCmpEntry->displayText().toLocal8Bit().constData();
|
||||
cmpStr = cheatCmpEntry->displayText().toStdString();
|
||||
|
||||
if (isxdigit(cmpStr[0]))
|
||||
{
|
||||
|
@ -903,7 +908,7 @@ void GuiCheatsDialog_t::addActvCheat(void)
|
|||
c = -1;
|
||||
}
|
||||
|
||||
name = cheatNameEntry->text().toLocal8Bit().constData();
|
||||
name = cheatNameEntry->text().toStdString();
|
||||
|
||||
t = typeEntry->currentData().toInt();
|
||||
|
||||
|
@ -965,11 +970,11 @@ void GuiCheatsDialog_t::updateCheatParameters(void)
|
|||
}
|
||||
//printf("Row: %i \n", row );
|
||||
|
||||
a = strtoul(cheatAddrEntry->displayText().toLocal8Bit().constData(), NULL, 16);
|
||||
a = strtoul(cheatAddrEntry->displayText().toStdString().c_str(), NULL, 16);
|
||||
|
||||
v = strtoul(cheatValEntry->displayText().toLocal8Bit().constData(), NULL, 16);
|
||||
v = strtoul(cheatValEntry->displayText().toStdString().c_str(), NULL, 16);
|
||||
|
||||
cmpStr = cheatCmpEntry->displayText().toLocal8Bit().constData();
|
||||
cmpStr = cheatCmpEntry->displayText().toStdString();
|
||||
|
||||
//printf("CMP: '%s' \n", cmpStr.c_str() );
|
||||
|
||||
|
@ -983,7 +988,7 @@ void GuiCheatsDialog_t::updateCheatParameters(void)
|
|||
}
|
||||
//printf("CMP: '%i' 0x%X\n", c, c );
|
||||
|
||||
name = cheatNameEntry->text().toLocal8Bit().constData();
|
||||
name = cheatNameEntry->text().toStdString();
|
||||
|
||||
//printf("Name: %s \n", name.c_str() );
|
||||
|
||||
|
@ -1025,15 +1030,15 @@ void GuiCheatsDialog_t::actvCheatItemClicked(QTreeWidgetItem *item, int column)
|
|||
FCEUI_ToggleCheat(row);
|
||||
}
|
||||
}
|
||||
snprintf(stmp, sizeof(stmp), "%04X", a);
|
||||
sprintf(stmp, "%04X", a);
|
||||
cheatAddrEntry->setText(tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%02X", v);
|
||||
sprintf(stmp, "%02X", v);
|
||||
cheatValEntry->setText(tr(stmp));
|
||||
|
||||
if (c >= 0)
|
||||
{
|
||||
snprintf(stmp, sizeof(stmp), "%02X", c);
|
||||
sprintf(stmp, "%02X", c);
|
||||
cheatCmpEntry->setText(tr(stmp));
|
||||
}
|
||||
else
|
||||
|
|
|
@ -72,6 +72,7 @@ protected:
|
|||
|
||||
int fontCharWidth;
|
||||
int actvCheatIdx;
|
||||
bool actvCheatRedraw;
|
||||
bool pauseWhileActive;
|
||||
bool wasPausedByCheats;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ static int autoResumeCDL = false;
|
|||
static bool autoSaveArmedCDL = false;
|
||||
static char loadedcdfile[512] = {0};
|
||||
|
||||
static int getDefaultCDLFile(std::string &filepath);
|
||||
static int getDefaultCDLFile(char *filepath);
|
||||
|
||||
static CodeDataLoggerDialog_t *cdlWin = NULL;
|
||||
//----------------------------------------------------
|
||||
|
@ -63,6 +63,7 @@ int openCDLWindow( QWidget *parent )
|
|||
{
|
||||
cdlWin->activateWindow();
|
||||
cdlWin->raise();
|
||||
cdlWin->setFocus();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -279,9 +280,9 @@ CodeDataLoggerDialog_t::CodeDataLoggerDialog_t(QWidget *parent)
|
|||
|
||||
if (autoLoadCDL)
|
||||
{
|
||||
std::string nameo;
|
||||
char nameo[2048];
|
||||
getDefaultCDLFile(nameo);
|
||||
LoadCDLog(nameo.c_str());
|
||||
LoadCDLog(nameo);
|
||||
}
|
||||
|
||||
restoreGeometry(settings.value("cdLogger/geometry").toByteArray());
|
||||
|
@ -364,22 +365,22 @@ void CodeDataLoggerDialog_t::updatePeriodic(void)
|
|||
|
||||
if (cdloggerdataSize > 0)
|
||||
{
|
||||
snprintf(str, sizeof(str), "0x%06x %.2f%%", codecount, (fcodecount / fromsize) * 100);
|
||||
sprintf(str, "0x%06x %.2f%%", codecount, (fcodecount / fromsize) * 100);
|
||||
prgLoggedCodeLabel->setText(tr(str));
|
||||
|
||||
snprintf(str, sizeof(str), "0x%06x %.2f%%", datacount, (fdatacount / fromsize) * 100);
|
||||
sprintf(str, "0x%06x %.2f%%", datacount, (fdatacount / fromsize) * 100);
|
||||
prgLoggedDataLabel->setText(tr(str));
|
||||
|
||||
snprintf(str, sizeof(str), "0x%06x %.2f%%", undefinedcount, (fundefinedcount / fromsize) * 100);
|
||||
sprintf(str, "0x%06x %.2f%%", undefinedcount, (fundefinedcount / fromsize) * 100);
|
||||
prgUnloggedLabel->setText(tr(str));
|
||||
|
||||
snprintf(str, sizeof(str), "0x%06x %.2f%%", rendercount, (frendercount / fvromsize) * 100);
|
||||
sprintf(str, "0x%06x %.2f%%", rendercount, (frendercount / fvromsize) * 100);
|
||||
chrLoggedCodeLabel->setText(tr(str));
|
||||
|
||||
snprintf(str, sizeof(str), "0x%06x %.2f%%", vromreadcount, (fvromreadcount / fvromsize) * 100);
|
||||
sprintf(str, "0x%06x %.2f%%", vromreadcount, (fvromreadcount / fvromsize) * 100);
|
||||
chrLoggedDataLabel->setText(tr(str));
|
||||
|
||||
snprintf(str, sizeof(str), "0x%06x %.2f%%", undefinedvromcount, (fundefinedvromcount / fvromsize) * 100);
|
||||
sprintf(str, "0x%06x %.2f%%", undefinedvromcount, (fundefinedvromcount / fvromsize) * 100);
|
||||
chrUnloggedLabel->setText(tr(str));
|
||||
}
|
||||
else
|
||||
|
@ -392,7 +393,7 @@ void CodeDataLoggerDialog_t::updatePeriodic(void)
|
|||
chrUnloggedLabel->setText(tr("------"));
|
||||
}
|
||||
|
||||
snprintf(str, sizeof(str), "CDL File: %s", loadedcdfile);
|
||||
sprintf(str, "CDL File: %s", loadedcdfile);
|
||||
|
||||
cdlFileLabel->setText(tr(str));
|
||||
}
|
||||
|
@ -443,15 +444,15 @@ void CodeDataLoggerDialog_t::saveCdlFileAs(void)
|
|||
|
||||
if (romFile != NULL)
|
||||
{
|
||||
std::string dir, base;
|
||||
char dir[512], base[256];
|
||||
|
||||
parseFilepath(romFile, &dir, &base);
|
||||
parseFilepath(romFile, dir, base);
|
||||
|
||||
base.append(".cdl");
|
||||
strcat(base, ".cdl");
|
||||
|
||||
dialog.setDirectory(tr(dir.c_str()));
|
||||
dialog.setDirectory(tr(dir));
|
||||
|
||||
dialog.selectFile(tr(base.c_str()));
|
||||
dialog.selectFile(tr(base));
|
||||
}
|
||||
|
||||
// Check config option to use native file dialog or not
|
||||
|
@ -476,10 +477,10 @@ void CodeDataLoggerDialog_t::saveCdlFileAs(void)
|
|||
{
|
||||
return;
|
||||
}
|
||||
//qDebug() << "selected file path : " << filename.toLocal8Bit();
|
||||
//qDebug() << "selected file path : " << filename.toUtf8();
|
||||
|
||||
FCEU_WRAPPER_LOCK();
|
||||
strcpy(loadedcdfile, filename.toLocal8Bit().constData());
|
||||
strcpy(loadedcdfile, filename.toStdString().c_str());
|
||||
SaveCDLogFile();
|
||||
FCEU_WRAPPER_UNLOCK();
|
||||
}
|
||||
|
@ -488,7 +489,7 @@ void CodeDataLoggerDialog_t::loadCdlFile(void)
|
|||
{
|
||||
int ret, useNativeFileDialogVal;
|
||||
QString filename;
|
||||
std::string dir;
|
||||
char dir[512];
|
||||
const char *romFile;
|
||||
QFileDialog dialog(this, tr("Load CDL File"));
|
||||
|
||||
|
@ -506,7 +507,7 @@ void CodeDataLoggerDialog_t::loadCdlFile(void)
|
|||
{
|
||||
getDirFromFile(romFile, dir);
|
||||
|
||||
dialog.setDirectory(tr(dir.c_str()));
|
||||
dialog.setDirectory(tr(dir));
|
||||
}
|
||||
|
||||
// Check config option to use native file dialog or not
|
||||
|
@ -531,10 +532,10 @@ void CodeDataLoggerDialog_t::loadCdlFile(void)
|
|||
{
|
||||
return;
|
||||
}
|
||||
//qDebug() << "selected file path : " << filename.toLocal8Bit();
|
||||
//qDebug() << "selected file path : " << filename.toUtf8();
|
||||
|
||||
FCEU_WRAPPER_LOCK();
|
||||
LoadCDLog(filename.toLocal8Bit().constData());
|
||||
LoadCDLog(filename.toStdString().c_str());
|
||||
FCEU_WRAPPER_UNLOCK();
|
||||
|
||||
return;
|
||||
|
@ -586,11 +587,11 @@ void CodeDataLoggerDialog_t::SaveStrippedROM(int invert)
|
|||
|
||||
if (romFile != NULL)
|
||||
{
|
||||
std::string dir;
|
||||
char dir[512], base[256];
|
||||
|
||||
parseFilepath(romFile, &dir);
|
||||
parseFilepath(romFile, dir, base);
|
||||
|
||||
dialog.setDirectory(tr(dir.c_str()));
|
||||
dialog.setDirectory(tr(dir));
|
||||
}
|
||||
|
||||
// Check config option to use native file dialog or not
|
||||
|
@ -615,9 +616,9 @@ void CodeDataLoggerDialog_t::SaveStrippedROM(int invert)
|
|||
{
|
||||
return;
|
||||
}
|
||||
//qDebug() << "selected file path : " << filename.toLocal8Bit();
|
||||
//qDebug() << "selected file path : " << filename.toUtf8();
|
||||
|
||||
FILE *fp = fopen(filename.toLocal8Bit().constData(), "wb");
|
||||
FILE *fp = fopen(filename.toStdString().c_str(), "wb");
|
||||
if (!fp)
|
||||
{
|
||||
FCEUD_PrintError("Error opening target stripped rom file!");
|
||||
|
@ -724,12 +725,12 @@ void CodeDataLoggerDialog_t::SaveUnusedROMClicked(void)
|
|||
SaveStrippedROM(1);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
static int getDefaultCDLFile(std::string &filepath)
|
||||
static int getDefaultCDLFile(char *filepath)
|
||||
{
|
||||
const char *romFile;
|
||||
std::string dir, baseFile;
|
||||
char dir[512], baseFile[256];
|
||||
|
||||
filepath.clear();
|
||||
filepath[0] = 0;
|
||||
|
||||
romFile = getRomFile();
|
||||
|
||||
|
@ -738,18 +739,15 @@ static int getDefaultCDLFile(std::string &filepath)
|
|||
return -1;
|
||||
}
|
||||
|
||||
parseFilepath(romFile, &dir, &baseFile);
|
||||
parseFilepath(romFile, dir, baseFile);
|
||||
|
||||
if (dir.size() == 0)
|
||||
if (dir[0] == 0)
|
||||
{
|
||||
filepath.assign(baseFile);
|
||||
filepath.append(".cdl");
|
||||
sprintf(filepath, "%s.cdl", baseFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
filepath.assign(dir);
|
||||
filepath.append(baseFile);
|
||||
filepath.append(".cdl");
|
||||
sprintf(filepath, "%s/%s.cdl", dir, baseFile);
|
||||
}
|
||||
|
||||
//printf("%s\n", filepath );
|
||||
|
@ -789,14 +787,7 @@ void InitCDLog(void)
|
|||
if (!CHRram[0] || (CHRptr[0] == PRGptr[0]))
|
||||
{ // Some kind of workaround for my OneBus VRAM hack, will remove it if I find another solution for that
|
||||
cdloggerVideoDataSize = CHRsize[0];
|
||||
if (cdloggerVideoDataSize > 0)
|
||||
{
|
||||
cdloggervdata = (unsigned char *)malloc(cdloggerVideoDataSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
cdloggervdata = nullptr;
|
||||
}
|
||||
cdloggervdata = (unsigned char *)malloc(cdloggerVideoDataSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -838,10 +829,7 @@ void ResetCDLog(void)
|
|||
if (GameInfo->type != GIT_NSF)
|
||||
{
|
||||
undefinedvromcount = 8192;
|
||||
if (cdloggervdata != NULL)
|
||||
{
|
||||
memset(cdloggervdata, 0, 8192);
|
||||
}
|
||||
memset(cdloggervdata, 0, 8192);
|
||||
}
|
||||
}
|
||||
FCEU_WRAPPER_UNLOCK();
|
||||
|
@ -950,11 +938,11 @@ void CDLoggerROMChanged(void)
|
|||
return;
|
||||
|
||||
// try to load respective CDL file
|
||||
std::string nameo;
|
||||
char nameo[1024];
|
||||
getDefaultCDLFile(nameo);
|
||||
|
||||
FILE *FP;
|
||||
FP = fopen(nameo.c_str(), "rb");
|
||||
FP = fopen(nameo, "rb");
|
||||
if (FP != NULL)
|
||||
{
|
||||
// .cdl file with this ROM name exists
|
||||
|
@ -963,7 +951,7 @@ void CDLoggerROMChanged(void)
|
|||
//{
|
||||
// DoCDLogger();
|
||||
//}
|
||||
if (LoadCDLog(nameo.c_str()))
|
||||
if (LoadCDLog(nameo))
|
||||
{
|
||||
StartCDLogging();
|
||||
}
|
||||
|
@ -979,9 +967,9 @@ void SaveCDLogFile(void)
|
|||
{
|
||||
if (loadedcdfile[0] == 0)
|
||||
{
|
||||
std::string nameo;
|
||||
char nameo[1024];
|
||||
getDefaultCDLFile(nameo);
|
||||
RenameCDLog(nameo.c_str());
|
||||
RenameCDLog(nameo);
|
||||
}
|
||||
|
||||
FILE *FP;
|
||||
|
|
|
@ -73,7 +73,7 @@ void ColorMenuItem::setImageColor( QColor c )
|
|||
|
||||
lastColor = c;
|
||||
|
||||
b = qobject_cast<QWidget*>(parent())->palette().color(QPalette::WindowText);
|
||||
b = parentWidget()->palette().color(QPalette::WindowText);
|
||||
|
||||
i=0;
|
||||
|
||||
|
@ -119,9 +119,9 @@ void ColorMenuItem::pickerClosed(int ret)
|
|||
|
||||
colorText = colorPtr->name();
|
||||
|
||||
//printf("Saving '%s' = Color string '%s'\n", confName.c_str(), colorText.toLocal8Bit().constData() );
|
||||
//printf("Saving '%s' = Color string '%s'\n", confName.c_str(), colorText.toStdString().c_str() );
|
||||
|
||||
g_config->setOption( confName, colorText.toLocal8Bit().constData() );
|
||||
g_config->setOption( confName, colorText.toStdString().c_str() );
|
||||
|
||||
g_config->save();
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ void ColorMenuItem::openColorPicker(void)
|
|||
qs = title;
|
||||
qs.replace( "&", "", Qt::CaseInsensitive); // get rid of & accelerator characters
|
||||
|
||||
picker = new ColorMenuPickerDialog_t( colorPtr, qs.toLocal8Bit().constData(), qobject_cast<QWidget*>(parent()) );
|
||||
picker = new ColorMenuPickerDialog_t( colorPtr, qs.toStdString().c_str(), parentWidget() );
|
||||
|
||||
picker->show();
|
||||
|
||||
|
@ -167,7 +167,7 @@ ColorMenuPickerDialog_t::ColorMenuPickerDialog_t( QColor *c, const char *titleTe
|
|||
|
||||
style = this->style();
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "Pick Color for %s", titleText);
|
||||
sprintf( stmp, "Pick Color for %s", titleText);
|
||||
|
||||
setWindowTitle( stmp );
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -167,8 +167,6 @@ class QAsmView : public QWidget
|
|||
|
||||
QFont getFont(void){ return font; };
|
||||
|
||||
enum UpdateType { UPDATE_NONE, UPDATE_ALL, UPDATE_NO_SCROLL };
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
@ -422,51 +420,6 @@ class DebugBreakOnDialog : public QDialog
|
|||
void resetDeltas(void);
|
||||
};
|
||||
|
||||
class DebuggerBreakpointEditor : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DebuggerBreakpointEditor(int editIndex = -1, watchpointinfo *wpIn = nullptr, QWidget *parent = 0);
|
||||
~DebuggerBreakpointEditor(void);
|
||||
|
||||
void loadBreakpoint(void);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void checkDataValid(void);
|
||||
|
||||
private:
|
||||
int editIdx;
|
||||
watchpointinfo *wp;
|
||||
|
||||
QLineEdit *addr1;
|
||||
QLineEdit *addr2;
|
||||
QLineEdit *cond;
|
||||
QLineEdit *name;
|
||||
QCheckBox *forbidChkBox;
|
||||
QCheckBox *rbp;
|
||||
QCheckBox *wbp;
|
||||
QCheckBox *xbp;
|
||||
QCheckBox *ebp;
|
||||
QLabel *msgLbl;
|
||||
|
||||
QPushButton *okButton;
|
||||
QPushButton *cancelButton;
|
||||
QRadioButton *cpu_radio;
|
||||
QRadioButton *ppu_radio;
|
||||
QRadioButton *oam_radio;
|
||||
QRadioButton *rom_radio;
|
||||
|
||||
bool condValid;
|
||||
|
||||
private slots:
|
||||
void closeWindow(int ret);
|
||||
void typeChanged(bool checked);
|
||||
void addressTextChanged( const QString &text );
|
||||
void conditionTextChanged( const QString &text );
|
||||
};
|
||||
|
||||
class ConsoleDebugger : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -475,7 +428,7 @@ class ConsoleDebugger : public QDialog
|
|||
ConsoleDebugger(QWidget *parent = 0);
|
||||
~ConsoleDebugger(void);
|
||||
|
||||
void updateWindowData(enum QAsmView::UpdateType type);
|
||||
void updateWindowData(void);
|
||||
void updateRegisterView(void);
|
||||
void updateTabVisibility(void);
|
||||
void breakPointNotify(int bpNum);
|
||||
|
@ -484,7 +437,7 @@ class ConsoleDebugger : public QDialog
|
|||
void setBookmarkSelectedAddress( int addr );
|
||||
int getBookmarkSelectedAddress(void){ return selBmAddrVal; };
|
||||
void edit_BM_name( int addr );
|
||||
void queueUpdate(enum QAsmView::UpdateType type);
|
||||
void queueUpdate(void);
|
||||
|
||||
QLabel *asmLineSelLbl;
|
||||
|
||||
|
@ -577,9 +530,7 @@ class ConsoleDebugger : public QDialog
|
|||
ColorMenuItem *pcColorAct;
|
||||
|
||||
int selBmAddrVal;
|
||||
enum QAsmView::UpdateType windowUpdateReq;
|
||||
|
||||
bool startedTraceLogger;
|
||||
bool windowUpdateReq;
|
||||
|
||||
private:
|
||||
void setRegsFromEntry(void);
|
||||
|
@ -606,7 +557,6 @@ class ConsoleDebugger : public QDialog
|
|||
void asmViewCtxMenuRunToCursor(void);
|
||||
void moveTab( QWidget *w, int row, int column);
|
||||
private slots:
|
||||
void ld65ImportDebug(void);
|
||||
void updatePeriodic(void);
|
||||
void hbarChanged(int value);
|
||||
void vbarChanged(int value);
|
||||
|
@ -632,7 +582,6 @@ class ConsoleDebugger : public QDialog
|
|||
void resizeToMinimumSizeHint(void);
|
||||
void resetCountersCB (void);
|
||||
void reloadSymbolsCB(void);
|
||||
void saveSymbolsCB(void);
|
||||
void displayByteCodesCB(bool value);
|
||||
void displayTraceDataCB(bool value);
|
||||
void displayROMoffsetCB(bool value);
|
||||
|
@ -640,7 +589,6 @@ class ConsoleDebugger : public QDialog
|
|||
void registerNameEnableCB(bool value);
|
||||
void autoOpenDebugCB( bool value );
|
||||
void debFileAutoLoadCB( bool value );
|
||||
void autoStartTraceLoggerOnOpen(bool value);
|
||||
void breakOnBadOpcodeCB(bool value);
|
||||
void breakOnNewCodeCB(bool value);
|
||||
void breakOnNewDataCB(bool value);
|
||||
|
@ -674,6 +622,6 @@ void saveGameDebugBreakpoints( bool force = false );
|
|||
void loadGameDebugBreakpoints(void);
|
||||
void debuggerClearAllBreakpoints(void);
|
||||
void debuggerClearAllBookmarks(void);
|
||||
void updateAllDebuggerWindows(enum QAsmView::UpdateType type);
|
||||
void updateAllDebuggerWindows(void);
|
||||
|
||||
extern debuggerBookmarkManager_t dbgBmMgr;
|
||||
|
|
|
@ -54,21 +54,16 @@ ConsoleSndConfDialog_t::ConsoleSndConfDialog_t(QWidget *parent)
|
|||
|
||||
// Enable Sound Select
|
||||
enaChkbox = new QCheckBox(tr("Enable Sound"));
|
||||
// Speaker Mute Select
|
||||
muteChkbox = new QCheckBox(tr("Mute Speaker Output"));
|
||||
// Enable Low Pass Filter Select
|
||||
enaLowPass = new QCheckBox(tr("Enable Low Pass Filter"));
|
||||
|
||||
setCheckBoxFromProperty(enaChkbox, "SDL.Sound");
|
||||
setCheckBoxFromProperty(muteChkbox, "SDL.Sound.Mute");
|
||||
setCheckBoxFromProperty(enaLowPass, "SDL.Sound.LowPass");
|
||||
|
||||
connect(enaChkbox, SIGNAL(stateChanged(int)), this, SLOT(enaSoundStateChange(int)));
|
||||
connect(muteChkbox, SIGNAL(stateChanged(int)), this, SLOT(enaSpeakerMuteChange(int)));
|
||||
connect(enaLowPass, SIGNAL(stateChanged(int)), this, SLOT(enaSoundLowPassChange(int)));
|
||||
|
||||
vbox1->addWidget(enaChkbox);
|
||||
vbox1->addWidget(muteChkbox);
|
||||
vbox1->addWidget(enaLowPass);
|
||||
|
||||
// Audio Quality Select
|
||||
|
@ -189,10 +184,10 @@ ConsoleSndConfDialog_t::ConsoleSndConfDialog_t(QWidget *parent)
|
|||
|
||||
frame = new QGroupBox(tr("Triangle"));
|
||||
vbox2 = new QVBoxLayout();
|
||||
triLbl = new QLabel("256");
|
||||
triLbl = new QLabel("255");
|
||||
vslider = new QSlider(Qt::Vertical);
|
||||
vslider->setMinimum(0);
|
||||
vslider->setMaximum(256);
|
||||
vslider->setMaximum(255);
|
||||
setSliderFromProperty(vslider, triLbl, "SDL.Sound.TriangleVolume");
|
||||
|
||||
vbox2->addWidget(triLbl);
|
||||
|
@ -204,10 +199,10 @@ ConsoleSndConfDialog_t::ConsoleSndConfDialog_t(QWidget *parent)
|
|||
|
||||
frame = new QGroupBox(tr("Square1"));
|
||||
vbox2 = new QVBoxLayout();
|
||||
sqr1Lbl = new QLabel("256");
|
||||
sqr1Lbl = new QLabel("255");
|
||||
vslider = new QSlider(Qt::Vertical);
|
||||
vslider->setMinimum(0);
|
||||
vslider->setMaximum(256);
|
||||
vslider->setMaximum(255);
|
||||
setSliderFromProperty(vslider, sqr1Lbl, "SDL.Sound.Square1Volume");
|
||||
|
||||
vbox2->addWidget(sqr1Lbl);
|
||||
|
@ -219,10 +214,10 @@ ConsoleSndConfDialog_t::ConsoleSndConfDialog_t(QWidget *parent)
|
|||
|
||||
frame = new QGroupBox(tr("Square2"));
|
||||
vbox2 = new QVBoxLayout();
|
||||
sqr2Lbl = new QLabel("256");
|
||||
sqr2Lbl = new QLabel("255");
|
||||
sqr2Slider = new QSlider(Qt::Vertical);
|
||||
sqr2Slider->setMinimum(0);
|
||||
sqr2Slider->setMaximum(256);
|
||||
sqr2Slider->setMaximum(255);
|
||||
setSliderFromProperty(sqr2Slider, sqr2Lbl, "SDL.Sound.Square2Volume");
|
||||
|
||||
vbox2->addWidget(sqr2Lbl);
|
||||
|
@ -234,10 +229,10 @@ ConsoleSndConfDialog_t::ConsoleSndConfDialog_t(QWidget *parent)
|
|||
|
||||
frame = new QGroupBox(tr("Noise"));
|
||||
vbox2 = new QVBoxLayout();
|
||||
nseLbl = new QLabel("256");
|
||||
nseLbl = new QLabel("255");
|
||||
nseSlider = new QSlider(Qt::Vertical);
|
||||
nseSlider->setMinimum(0);
|
||||
nseSlider->setMaximum(256);
|
||||
nseSlider->setMaximum(255);
|
||||
setSliderFromProperty(nseSlider, nseLbl, "SDL.Sound.NoiseVolume");
|
||||
|
||||
vbox2->addWidget(nseLbl);
|
||||
|
@ -249,10 +244,10 @@ ConsoleSndConfDialog_t::ConsoleSndConfDialog_t(QWidget *parent)
|
|||
|
||||
frame = new QGroupBox(tr("PCM"));
|
||||
vbox2 = new QVBoxLayout();
|
||||
pcmLbl = new QLabel("256");
|
||||
pcmLbl = new QLabel("255");
|
||||
pcmSlider = new QSlider(Qt::Vertical);
|
||||
pcmSlider->setMinimum(0);
|
||||
pcmSlider->setMaximum(256);
|
||||
pcmSlider->setMaximum(255);
|
||||
setSliderFromProperty(pcmSlider, pcmLbl, "SDL.Sound.PCMVolume");
|
||||
|
||||
vbox2->addWidget(pcmLbl);
|
||||
|
@ -332,14 +327,9 @@ void ConsoleSndConfDialog_t::periodicUpdate(void)
|
|||
|
||||
bufUsage->setValue( (int)(percBufUse) );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "Sink Starve Count: %u", nes_shm->sndBuf.starveCounter );
|
||||
sprintf( stmp, "Sink Starve Count: %u", nes_shm->sndBuf.starveCounter );
|
||||
|
||||
starveLbl->setText( tr(stmp) );
|
||||
|
||||
if ( FCEUD_SoundIsMuted() != muteChkbox->isChecked() )
|
||||
{
|
||||
muteChkbox->setChecked( FCEUD_SoundIsMuted() );
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::setSliderEnables(void)
|
||||
|
@ -396,7 +386,7 @@ void ConsoleSndConfDialog_t::setSliderFromProperty(QSlider *slider, QLabel *lbl,
|
|||
char stmp[32];
|
||||
g_config->getOption(property, &pval);
|
||||
slider->setValue(pval);
|
||||
snprintf(stmp, sizeof(stmp), "%i", pval);
|
||||
sprintf(stmp, "%i", pval);
|
||||
lbl->setText(stmp);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
|
@ -404,7 +394,7 @@ void ConsoleSndConfDialog_t::bufSizeChanged(int value)
|
|||
{
|
||||
char stmp[32];
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%i", value);
|
||||
sprintf(stmp, "%i", value);
|
||||
|
||||
bufSizeLabel->setText(stmp);
|
||||
|
||||
|
@ -422,7 +412,7 @@ void ConsoleSndConfDialog_t::volumeChanged(int value)
|
|||
{
|
||||
char stmp[32];
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%i", value);
|
||||
sprintf(stmp, "%i", value);
|
||||
|
||||
volLbl->setText(stmp);
|
||||
|
||||
|
@ -439,7 +429,7 @@ void ConsoleSndConfDialog_t::triangleChanged(int value)
|
|||
{
|
||||
char stmp[32];
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%i", value);
|
||||
sprintf(stmp, "%i", value);
|
||||
|
||||
triLbl->setText(stmp);
|
||||
|
||||
|
@ -456,7 +446,7 @@ void ConsoleSndConfDialog_t::square1Changed(int value)
|
|||
{
|
||||
char stmp[32];
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%i", value);
|
||||
sprintf(stmp, "%i", value);
|
||||
|
||||
sqr1Lbl->setText(stmp);
|
||||
|
||||
|
@ -473,7 +463,7 @@ void ConsoleSndConfDialog_t::square2Changed(int value)
|
|||
{
|
||||
char stmp[32];
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%i", value);
|
||||
sprintf(stmp, "%i", value);
|
||||
|
||||
sqr2Lbl->setText(stmp);
|
||||
|
||||
|
@ -490,7 +480,7 @@ void ConsoleSndConfDialog_t::noiseChanged(int value)
|
|||
{
|
||||
char stmp[32];
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%i", value);
|
||||
sprintf(stmp, "%i", value);
|
||||
|
||||
nseLbl->setText(stmp);
|
||||
|
||||
|
@ -507,7 +497,7 @@ void ConsoleSndConfDialog_t::pcmChanged(int value)
|
|||
{
|
||||
char stmp[32];
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%i", value);
|
||||
sprintf(stmp, "%i", value);
|
||||
|
||||
pcmLbl->setText(stmp);
|
||||
|
||||
|
@ -546,11 +536,6 @@ void ConsoleSndConfDialog_t::enaSoundStateChange(int value)
|
|||
}
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::enaSpeakerMuteChange(int value)
|
||||
{
|
||||
FCEUD_MuteSoundOutput( value ? true : false );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleSndConfDialog_t::enaSoundLowPassChange(int value)
|
||||
{
|
||||
if (value)
|
||||
|
|
|
@ -31,7 +31,6 @@ protected:
|
|||
|
||||
int sndQuality;
|
||||
QCheckBox *enaChkbox;
|
||||
QCheckBox *muteChkbox;
|
||||
QCheckBox *enaLowPass;
|
||||
QCheckBox *swapDutyChkbox;
|
||||
QCheckBox *useGlobalFocus;
|
||||
|
@ -69,7 +68,6 @@ private slots:
|
|||
void noiseChanged(int value);
|
||||
void pcmChanged(int value);
|
||||
void enaSoundStateChange(int value);
|
||||
void enaSpeakerMuteChange(int value);
|
||||
void enaSoundLowPassChange(int value);
|
||||
void swapDutyCallback(int value);
|
||||
void useGlobalFocusChanged(int value);
|
||||
|
|
|
@ -21,12 +21,10 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
#include <QWindow>
|
||||
#include <QScreen>
|
||||
#include <QToolTip>
|
||||
#include <QFileInfo>
|
||||
#include <QApplication>
|
||||
|
||||
#if WIN32
|
||||
|
@ -48,27 +46,32 @@
|
|||
#include "Qt/fceuWrapper.h"
|
||||
#include "Qt/ConsoleUtilities.h"
|
||||
|
||||
static std::string fceuExecPath;
|
||||
//---------------------------------------------------------------------------
|
||||
int getDirFromFile( const char *path, std::string &dir )
|
||||
int getDirFromFile( const char *path, char *dir )
|
||||
{
|
||||
dir.clear();
|
||||
int i, lastSlash = -1, lastPeriod = -1;
|
||||
|
||||
if (path[0] != 0)
|
||||
i=0;
|
||||
while ( path[i] != 0 )
|
||||
{
|
||||
QFileInfo fi;
|
||||
|
||||
fi.setFile( QString(path) );
|
||||
|
||||
if (fi.exists())
|
||||
if ( path[i] == '/' )
|
||||
{
|
||||
dir = fi.canonicalPath().toLocal8Bit().constData();
|
||||
lastSlash = i;
|
||||
}
|
||||
else
|
||||
else if ( path[i] == '.' )
|
||||
{
|
||||
dir = fi.absolutePath().toLocal8Bit().constData();
|
||||
lastPeriod = i;
|
||||
}
|
||||
dir[i] = path[i]; i++;
|
||||
}
|
||||
dir[i] = 0;
|
||||
|
||||
if ( lastPeriod >= 0 )
|
||||
{
|
||||
if ( lastPeriod > lastSlash )
|
||||
{
|
||||
dir[lastSlash] = 0;
|
||||
}
|
||||
//printf("Dir: '%s'\n", dir.c_str());
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -76,7 +79,7 @@ int getDirFromFile( const char *path, std::string &dir )
|
|||
//---------------------------------------------------------------------------
|
||||
const char *getRomFile( void )
|
||||
{
|
||||
static std::string filePath;
|
||||
static char filePath[2048];
|
||||
|
||||
if ( GameInfo )
|
||||
{
|
||||
|
@ -85,32 +88,32 @@ const char *getRomFile( void )
|
|||
|
||||
if ( GameInfo->archiveFilename != NULL )
|
||||
{
|
||||
std::string dir, base, suffix;
|
||||
char dir[1024], base[512], suffix[64];
|
||||
|
||||
parseFilepath( GameInfo->archiveFilename, &dir, &base, &suffix );
|
||||
parseFilepath( GameInfo->archiveFilename, dir, base, suffix );
|
||||
|
||||
filePath.clear();
|
||||
filePath[0] = 0;
|
||||
|
||||
if ( dir.size() != 0 )
|
||||
if ( dir[0] != 0 )
|
||||
{
|
||||
filePath.append( dir );
|
||||
strcat( filePath, dir );
|
||||
}
|
||||
|
||||
parseFilepath( GameInfo->filename, &dir, &base, &suffix );
|
||||
parseFilepath( GameInfo->filename, dir, base, suffix );
|
||||
|
||||
filePath.append( base );
|
||||
filePath.append( suffix );
|
||||
strcat( filePath, base );
|
||||
strcat( filePath, suffix );
|
||||
|
||||
//printf("ArchivePath: '%s' \n", filePath.c_str() );
|
||||
//printf("ArchivePath: '%s' \n", filePath );
|
||||
|
||||
return filePath.c_str();
|
||||
return filePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GameInfo->filename;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
// Return file base name stripping out preceding path and trailing suffix.
|
||||
|
@ -160,25 +163,19 @@ int getFileBaseName( const char *filepath, char *base, char *suffix )
|
|||
return end;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int parseFilepath( const char *filepath, std::string *dir, std::string *base, std::string *suffix )
|
||||
int parseFilepath( const char *filepath, char *dir, char *base, char *suffix )
|
||||
{
|
||||
if (dir)
|
||||
{
|
||||
dir->clear();
|
||||
}
|
||||
if (base)
|
||||
{
|
||||
base->clear();
|
||||
}
|
||||
if (suffix)
|
||||
{
|
||||
suffix->clear();
|
||||
}
|
||||
|
||||
size_t i=0,j=0;
|
||||
int i=0,j=0,end=0;
|
||||
|
||||
if ( suffix != NULL )
|
||||
{
|
||||
suffix[0] = 0;
|
||||
}
|
||||
if ( filepath == NULL )
|
||||
{
|
||||
if ( dir ) dir[0] = 0;
|
||||
if ( base ) base[0] = 0;
|
||||
if ( suffix) suffix[0] = 0;
|
||||
return 0;
|
||||
}
|
||||
i=0; j=0;
|
||||
|
@ -190,55 +187,57 @@ int parseFilepath( const char *filepath, std::string *dir, std::string *base, st
|
|||
}
|
||||
if ( dir )
|
||||
{
|
||||
dir->push_back(filepath[i]);
|
||||
dir[i] = filepath[i];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (dir)
|
||||
if ( dir )
|
||||
{
|
||||
if (j > 0)
|
||||
{
|
||||
dir->erase(j);
|
||||
}
|
||||
dir[j] = 0;
|
||||
}
|
||||
i = j;
|
||||
|
||||
if ( base == NULL )
|
||||
{
|
||||
return end;
|
||||
}
|
||||
|
||||
j=0;
|
||||
while ( filepath[i] != 0 )
|
||||
{
|
||||
if (filepath[i] == '.')
|
||||
{
|
||||
j = i;
|
||||
}
|
||||
if (base)
|
||||
{
|
||||
base->push_back(filepath[i]);
|
||||
}
|
||||
i++;
|
||||
base[j] = filepath[i]; i++; j++;
|
||||
}
|
||||
base[j] = 0; end=j;
|
||||
|
||||
if (filepath[j] == '.')
|
||||
if ( suffix )
|
||||
{
|
||||
if ( suffix )
|
||||
{
|
||||
suffix->assign( &filepath[j] );
|
||||
}
|
||||
if (base)
|
||||
{
|
||||
i = base->find_last_of('.');
|
||||
suffix[0] = 0;
|
||||
}
|
||||
|
||||
if ( i != std::string::npos )
|
||||
while ( j > 1 )
|
||||
{
|
||||
j--;
|
||||
if ( base[j] == '.' )
|
||||
{
|
||||
if ( suffix )
|
||||
{
|
||||
base->erase(i);
|
||||
strcpy( suffix, &base[j] );
|
||||
}
|
||||
end=j; base[j] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return end;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
// Returns the path of fceux.exe as a string.
|
||||
static int _fceuExecutablePath( std::string &outputPath )
|
||||
int fceuExecutablePath( char *outputPath, int outputSize )
|
||||
{
|
||||
outputPath.clear();
|
||||
if ( (outputPath == NULL) || (outputSize <= 0) )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
outputPath[0] = 0;
|
||||
|
||||
#ifdef WIN32
|
||||
char fullPath[2048];
|
||||
|
@ -249,7 +248,8 @@ static int _fceuExecutablePath( std::string &outputPath )
|
|||
GetModuleFileNameA(NULL, fullPath, 2048);
|
||||
_splitpath(fullPath, driveLetter, directory, NULL, NULL);
|
||||
snprintf(finalPath, sizeof(finalPath), "%s%s", driveLetter, directory);
|
||||
outputPath.assign( finalPath );
|
||||
strncpy( outputPath, finalPath, outputSize );
|
||||
outputPath[outputSize-1] = 0;
|
||||
|
||||
return 0;
|
||||
#elif __linux__ || __unix__
|
||||
|
@ -267,7 +267,8 @@ static int _fceuExecutablePath( std::string &outputPath )
|
|||
if ( dir )
|
||||
{
|
||||
//printf("DIR Path: '%s' \n", dir );
|
||||
outputPath.assign( dir );
|
||||
strncpy( outputPath, dir, outputSize );
|
||||
outputPath[outputSize-1] = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -287,7 +288,8 @@ static int _fceuExecutablePath( std::string &outputPath )
|
|||
if ( dir )
|
||||
{
|
||||
//printf("DIR Path: '%s' \n", dir );
|
||||
outputPath.assign( dir );
|
||||
strncpy( outputPath, dir, outputSize );
|
||||
outputPath[outputSize-1] = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -295,15 +297,6 @@ static int _fceuExecutablePath( std::string &outputPath )
|
|||
return -1;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
const char *fceuExecutablePath(void)
|
||||
{
|
||||
if (fceuExecPath.size() == 0)
|
||||
{
|
||||
_fceuExecutablePath( fceuExecPath );
|
||||
}
|
||||
return fceuExecPath.c_str();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int fceuLoadConfigColor( const char *confName, QColor *color )
|
||||
{
|
||||
std::string colorString;
|
||||
|
@ -535,13 +528,13 @@ void fceuDecIntValidtor::setMinMax( long long int min, long long int max)
|
|||
QValidator::State fceuDecIntValidtor::validate(QString &input, int &pos) const
|
||||
{
|
||||
long long int i, v;
|
||||
//printf("Validate: %i '%s'\n", input.size(), input.toLocal8Bit().constData() );
|
||||
//printf("Validate: %i '%s'\n", input.size(), input.toStdString().c_str() );
|
||||
|
||||
if ( input.size() == 0 )
|
||||
{
|
||||
return QValidator::Acceptable;
|
||||
}
|
||||
std::string s = input.toLocal8Bit().constData();
|
||||
std::string s = input.toStdString();
|
||||
i=0;
|
||||
|
||||
if (s[i] == '-')
|
||||
|
@ -602,14 +595,14 @@ void fceuHexIntValidtor::setMinMax( long long int min, long long int max)
|
|||
QValidator::State fceuHexIntValidtor::validate(QString &input, int &pos) const
|
||||
{
|
||||
long long int i, v;
|
||||
//printf("Validate: %i '%s'\n", input.size(), input.toLocal8Bit().constData() );
|
||||
//printf("Validate: %i '%s'\n", input.size(), input.toStdString().c_str() );
|
||||
|
||||
if ( input.size() == 0 )
|
||||
{
|
||||
return QValidator::Acceptable;
|
||||
}
|
||||
input = input.toUpper();
|
||||
std::string s = input.toLocal8Bit().constData();
|
||||
std::string s = input.toStdString();
|
||||
i=0;
|
||||
|
||||
if (s[i] == '-')
|
||||
|
@ -1339,7 +1332,7 @@ QString fceuGetOpcodeToolTip( uint8_t *opcode, int size )
|
|||
|
||||
for (int i=0; i<size; i++)
|
||||
{
|
||||
snprintf(stmp, sizeof(stmp), "$%02X ", opcode[i] );
|
||||
sprintf(stmp, "$%02X ", opcode[i] );
|
||||
|
||||
text.append( stmp );
|
||||
}
|
||||
|
@ -1347,7 +1340,7 @@ QString fceuGetOpcodeToolTip( uint8_t *opcode, int size )
|
|||
text.append( addrMode );
|
||||
|
||||
text.append( "\nCycle Count:\t\t" );
|
||||
snprintf( stmp, sizeof(stmp), "%i", X6502_GetOpcodeCycles( opcode[0] ) );
|
||||
sprintf( stmp, "%i", X6502_GetOpcodeCycles( opcode[0] ) );
|
||||
text.append( stmp );
|
||||
text.append( "\n" );
|
||||
|
||||
|
@ -1382,37 +1375,4 @@ QString fceuGetOpcodeToolTip( uint8_t *opcode, int size )
|
|||
|
||||
return QString::fromStdString( text );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void setCheckBoxFromProperty( QCheckBox *cbx, const char *property )
|
||||
{
|
||||
int pval;
|
||||
g_config->getOption (property, &pval);
|
||||
|
||||
cbx->setCheckState( pval ? Qt::Checked : Qt::Unchecked );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void 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 setComboBoxFromValue( QComboBox *cbx, int pval )
|
||||
{
|
||||
for (int i=0; i<cbx->count(); i++)
|
||||
{
|
||||
if ( pval == cbx->itemData(i).toInt() )
|
||||
{
|
||||
cbx->setCurrentIndex(i); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -2,25 +2,22 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <QColor>
|
||||
#include <QTimer>
|
||||
#include <QValidator>
|
||||
#include <QDialog>
|
||||
#include <QHelpEvent>
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
|
||||
int getDirFromFile( const char *path, std::string &dir );
|
||||
int getDirFromFile( const char *path, char *dir );
|
||||
|
||||
const char *getRomFile( void );
|
||||
|
||||
int getFileBaseName( const char *filepath, char *base, char *suffix = nullptr );
|
||||
int getFileBaseName( const char *filepath, char *base, char *suffix = NULL );
|
||||
|
||||
int parseFilepath( const char *filepath, std::string *dir, std::string *base = nullptr, std::string *suffix = nullptr );
|
||||
int parseFilepath( const char *filepath, char *dir, char *base, char *suffix = NULL );
|
||||
|
||||
const char *fceuExecutablePath(void);
|
||||
int fceuExecutablePath( char *outputPath, int outputSize );
|
||||
|
||||
int fceuLoadConfigColor( const char *confName, QColor *color );
|
||||
|
||||
|
@ -94,8 +91,3 @@ class QCheckBoxRO : public QCheckBox
|
|||
QString fceuGetOpcodeToolTip( uint8_t *opcode, int size );
|
||||
|
||||
QDialog *fceuCustomToolTipShow( const QPoint &globalPos, QDialog *popup );
|
||||
|
||||
//----------------------------------------------------
|
||||
void setCheckBoxFromProperty( QCheckBox *cbx, const char *property );
|
||||
void setComboBoxFromProperty( QComboBox *cbx, const char *property );
|
||||
void setComboBoxFromValue( QComboBox *cbx, int pval );
|
||||
|
|
|
@ -35,10 +35,6 @@
|
|||
#include "Qt/ConsoleVideoConf.h"
|
||||
#include "Qt/nes_shm.h"
|
||||
|
||||
#if defined(WIN32) && (QT_VERSION_MAJOR < 6)
|
||||
#include <QtPlatformHeaders/QWindowsWindowFunctions>
|
||||
#endif
|
||||
|
||||
extern int input_display;
|
||||
extern int frame_display;
|
||||
extern int rerecord_display;
|
||||
|
@ -89,9 +85,8 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
|
|||
|
||||
driverSelect = new QComboBox();
|
||||
|
||||
driverSelect->addItem( tr("OpenGL"), ConsoleViewerBase::VIDEO_DRIVER_OPENGL );
|
||||
driverSelect->addItem( tr("SDL"), ConsoleViewerBase::VIDEO_DRIVER_SDL );
|
||||
driverSelect->addItem( tr("QPainter"), ConsoleViewerBase::VIDEO_DRIVER_QPAINTER );
|
||||
driverSelect->addItem( tr("OpenGL"), 0 );
|
||||
driverSelect->addItem( tr("SDL"), 1 );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
|
||||
|
@ -123,8 +118,8 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
|
|||
|
||||
vbox1->addLayout( hbox1 );
|
||||
|
||||
// Enable Linear Filter Checkbox
|
||||
gl_LF_chkBox = new QCheckBox( tr("Enable Linear Filter") );
|
||||
// Enable OpenGL Linear Filter Checkbox
|
||||
gl_LF_chkBox = new QCheckBox( tr("Enable OpenGL Linear Filter") );
|
||||
|
||||
setCheckBoxFromProperty( gl_LF_chkBox , "SDL.OpenGLip");
|
||||
|
||||
|
@ -132,18 +127,6 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
|
|||
|
||||
vbox1->addWidget( gl_LF_chkBox );
|
||||
|
||||
#if defined(WIN32) && (QT_VERSION_MAJOR < 6)
|
||||
// 1px full screen border - hack fix for QOpenGLWidget fullscreen issues
|
||||
winFullScreenBorderCbx = new QCheckBox( tr("Fullscreen Border (1px)") );
|
||||
winFullScreenBorderCbx->setToolTip(tr("Hack fix for QOpenGLWidget fullscreen issue. May not be needed."));
|
||||
|
||||
setCheckBoxFromProperty( winFullScreenBorderCbx , "SDL.winFullScreenBorder");
|
||||
|
||||
connect(winFullScreenBorderCbx, SIGNAL(stateChanged(int)), this, SLOT(winFullScreenBorderChanged(int)) );
|
||||
|
||||
vbox1->addWidget(winFullScreenBorderCbx);
|
||||
#endif
|
||||
|
||||
// Region Select
|
||||
lbl = new QLabel( tr("Region:") );
|
||||
|
||||
|
@ -249,10 +232,15 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
|
|||
|
||||
if ( consoleWindow )
|
||||
{
|
||||
if ( consoleWindow->viewport_Interface )
|
||||
if ( consoleWindow->viewport_GL )
|
||||
{
|
||||
autoScaleCbx->setChecked( consoleWindow->viewport_Interface->getAutoScaleOpt() );
|
||||
aspectCbx->setChecked( consoleWindow->viewport_Interface->getForceAspectOpt() );
|
||||
autoScaleCbx->setChecked( consoleWindow->viewport_GL->getAutoScaleOpt() );
|
||||
aspectCbx->setChecked( consoleWindow->viewport_GL->getForceAspectOpt() );
|
||||
}
|
||||
else if ( consoleWindow->viewport_SDL )
|
||||
{
|
||||
autoScaleCbx->setChecked( consoleWindow->viewport_SDL->getAutoScaleOpt() );
|
||||
aspectCbx->setChecked( consoleWindow->viewport_SDL->getForceAspectOpt() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,10 +305,15 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
|
|||
|
||||
if ( consoleWindow )
|
||||
{
|
||||
if ( consoleWindow->viewport_Interface )
|
||||
if ( consoleWindow->viewport_GL )
|
||||
{
|
||||
xScaleBox->setValue( consoleWindow->viewport_Interface->getScaleX() );
|
||||
yScaleBox->setValue( consoleWindow->viewport_Interface->getScaleY() );
|
||||
xScaleBox->setValue( consoleWindow->viewport_GL->getScaleX() );
|
||||
yScaleBox->setValue( consoleWindow->viewport_GL->getScaleY() );
|
||||
}
|
||||
else if ( consoleWindow->viewport_SDL )
|
||||
{
|
||||
xScaleBox->setValue( consoleWindow->viewport_SDL->getScaleX() );
|
||||
yScaleBox->setValue( consoleWindow->viewport_SDL->getScaleY() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -518,7 +511,7 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
|
|||
scrRateReadout->setFont( font );
|
||||
scrRateReadout->setReadOnly(true);
|
||||
scrRateReadout->setAlignment(Qt::AlignCenter);
|
||||
snprintf( stmp, sizeof(stmp), "%.3f", consoleWindow->getRefreshRate() );
|
||||
sprintf( stmp, "%.3f", consoleWindow->getRefreshRate() );
|
||||
scrRateReadout->setText( tr(stmp) );
|
||||
|
||||
hbox->addWidget( new QLabel( tr("Refresh Rate (Hz):") ) );
|
||||
|
@ -601,16 +594,20 @@ void ConsoleVideoConfDialog_t::updateReadouts(void)
|
|||
|
||||
w = consoleWindow->size();
|
||||
|
||||
if ( consoleWindow->viewport_Interface )
|
||||
if ( consoleWindow->viewport_GL )
|
||||
{
|
||||
v = consoleWindow->viewport_Interface->size();
|
||||
v = consoleWindow->viewport_GL->size();
|
||||
}
|
||||
else if ( consoleWindow->viewport_SDL )
|
||||
{
|
||||
v = consoleWindow->viewport_SDL->size();
|
||||
}
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%i x %i ", w.width(), w.height() );
|
||||
sprintf( stmp, "%i x %i ", w.width(), w.height() );
|
||||
|
||||
winSizeReadout->setText( tr(stmp) );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "%i x %i ", v.width(), v.height() );
|
||||
sprintf( stmp, "%i x %i ", v.width(), v.height() );
|
||||
|
||||
vpSizeReadout->setText( tr(stmp) );
|
||||
}
|
||||
|
@ -725,31 +722,21 @@ void ConsoleVideoConfDialog_t::openGL_linearFilterChanged( int value )
|
|||
{
|
||||
bool opt = (value != Qt::Unchecked);
|
||||
g_config->setOption("SDL.OpenGLip", opt );
|
||||
g_config->save();
|
||||
g_config->save ();
|
||||
|
||||
if ( consoleWindow != NULL )
|
||||
{
|
||||
if ( consoleWindow->viewport_Interface )
|
||||
if ( consoleWindow->viewport_GL )
|
||||
{
|
||||
consoleWindow->viewport_Interface->setLinearFilterEnable( opt );
|
||||
consoleWindow->viewport_GL->setLinearFilterEnable( opt );
|
||||
}
|
||||
if ( consoleWindow->viewport_SDL )
|
||||
{
|
||||
consoleWindow->viewport_SDL->setLinearFilterEnable( opt );
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------
|
||||
#if defined(WIN32) && (QT_VERSION_MAJOR < 6)
|
||||
void ConsoleVideoConfDialog_t::winFullScreenBorderChanged(int value)
|
||||
{
|
||||
bool opt = (value != Qt::Unchecked);
|
||||
// This function is needed to fix the issue referenced below. It adds a 1-pixel border
|
||||
// around the fullscreen window due to some limitation in windows.
|
||||
// https://doc.qt.io/qt-5/windows-issues.html#fullscreen-opengl-based-windows
|
||||
QWindowsWindowFunctions::setHasBorderInFullScreen( consoleWindow->windowHandle(), opt);
|
||||
|
||||
g_config->setOption("SDL.winFullScreenBorder", opt );
|
||||
g_config->save();
|
||||
}
|
||||
#endif
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::autoScaleChanged( int value )
|
||||
{
|
||||
bool opt = (value != Qt::Unchecked);
|
||||
|
@ -758,9 +745,13 @@ void ConsoleVideoConfDialog_t::autoScaleChanged( int value )
|
|||
|
||||
if ( consoleWindow != NULL )
|
||||
{
|
||||
if ( consoleWindow->viewport_Interface )
|
||||
if ( consoleWindow->viewport_GL )
|
||||
{
|
||||
consoleWindow->viewport_Interface->setAutoScaleOpt( opt );
|
||||
consoleWindow->viewport_GL->setAutoScaleOpt( opt );
|
||||
}
|
||||
if ( consoleWindow->viewport_SDL )
|
||||
{
|
||||
consoleWindow->viewport_SDL->setAutoScaleOpt( opt );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -841,9 +832,9 @@ void ConsoleVideoConfDialog_t::vsync_changed( int value )
|
|||
//consoleWindow->viewport_GL->setVsyncEnable( opt );
|
||||
consoleWindow->loadVideoDriver( 0, true );
|
||||
}
|
||||
else if ( consoleWindow->viewport_Interface )
|
||||
if ( consoleWindow->viewport_SDL )
|
||||
{
|
||||
consoleWindow->viewport_Interface->setVsyncEnable( opt );
|
||||
consoleWindow->viewport_SDL->setVsyncEnable( opt );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1103,10 +1094,15 @@ QSize ConsoleVideoConfDialog_t::calcNewScreenSize(void)
|
|||
|
||||
w = consoleWindow->size();
|
||||
|
||||
if ( consoleWindow->viewport_Interface )
|
||||
if ( consoleWindow->viewport_GL )
|
||||
{
|
||||
v = consoleWindow->viewport_Interface->size();
|
||||
aspectRatio = consoleWindow->viewport_Interface->getAspectRatio();
|
||||
v = consoleWindow->viewport_GL->size();
|
||||
aspectRatio = consoleWindow->viewport_GL->getAspectRatio();
|
||||
}
|
||||
else if ( consoleWindow->viewport_SDL )
|
||||
{
|
||||
v = consoleWindow->viewport_SDL->size();
|
||||
aspectRatio = consoleWindow->viewport_SDL->getAspectRatio();
|
||||
}
|
||||
|
||||
dw = w.width() - v.width();
|
||||
|
@ -1171,13 +1167,21 @@ void ConsoleVideoConfDialog_t::applyChanges( void )
|
|||
g_config->setOption("SDL.WinSizeX", s.width() );
|
||||
g_config->setOption("SDL.WinSizeY", s.height() );
|
||||
|
||||
if ( consoleWindow->viewport_Interface )
|
||||
if ( consoleWindow->viewport_GL )
|
||||
{
|
||||
consoleWindow->viewport_Interface->setLinearFilterEnable( gl_LF_chkBox->isChecked() );
|
||||
consoleWindow->viewport_Interface->setForceAspectOpt( aspectCbx->isChecked() );
|
||||
consoleWindow->viewport_Interface->setAutoScaleOpt( autoScaleCbx->isChecked() );
|
||||
consoleWindow->viewport_Interface->setScaleXY( xscale, yscale );
|
||||
consoleWindow->viewport_Interface->reset();
|
||||
consoleWindow->viewport_GL->setLinearFilterEnable( gl_LF_chkBox->isChecked() );
|
||||
consoleWindow->viewport_GL->setForceAspectOpt( aspectCbx->isChecked() );
|
||||
consoleWindow->viewport_GL->setAutoScaleOpt( autoScaleCbx->isChecked() );
|
||||
consoleWindow->viewport_GL->setScaleXY( xscale, yscale );
|
||||
consoleWindow->viewport_GL->reset();
|
||||
}
|
||||
if ( consoleWindow->viewport_SDL )
|
||||
{
|
||||
consoleWindow->viewport_SDL->setLinearFilterEnable( gl_LF_chkBox->isChecked() );
|
||||
consoleWindow->viewport_SDL->setForceAspectOpt( aspectCbx->isChecked() );
|
||||
consoleWindow->viewport_SDL->setAutoScaleOpt( autoScaleCbx->isChecked() );
|
||||
consoleWindow->viewport_SDL->setScaleXY( xscale, yscale );
|
||||
consoleWindow->viewport_SDL->reset();
|
||||
}
|
||||
|
||||
if ( !consoleWindow->isFullScreen() && !consoleWindow->isMaximized() )
|
||||
|
|
|
@ -55,9 +55,6 @@ class ConsoleVideoConfDialog_t : public QDialog
|
|||
QCheckBox *showFrameCount_cbx;
|
||||
QCheckBox *showLagCount_cbx;
|
||||
QCheckBox *showRerecordCount_cbx;
|
||||
#if defined(WIN32) && (QT_VERSION_MAJOR < 6)
|
||||
QCheckBox *winFullScreenBorderCbx;
|
||||
#endif
|
||||
QDoubleSpinBox *xScaleBox;
|
||||
QDoubleSpinBox *yScaleBox;
|
||||
QLabel *aspectSelectLabel;
|
||||
|
@ -114,9 +111,6 @@ class ConsoleVideoConfDialog_t : public QDialog
|
|||
void ntscEndScanLineChanged(int value);
|
||||
void palStartScanLineChanged(int value);
|
||||
void palEndScanLineChanged(int value);
|
||||
#if defined(WIN32) && (QT_VERSION_MAJOR < 6)
|
||||
void winFullScreenBorderChanged(int value);
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -86,19 +86,13 @@ ConsoleViewGL_t::ConsoleViewGL_t(QWidget *parent)
|
|||
setFocusPolicy(Qt::StrongFocus);
|
||||
//setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
|
||||
drawTimer = new QTimer(this);
|
||||
drawTimer->setInterval(14);
|
||||
drawTimer->setSingleShot(true);
|
||||
drawTimer->setTimerType(Qt::PreciseTimer);
|
||||
connect(drawTimer, &QTimer::timeout, this, &ConsoleViewGL_t::onDrawSignal);
|
||||
|
||||
localBufSize = (4 * GL_NES_WIDTH) * (4 * GL_NES_HEIGHT) * sizeof(uint32_t);
|
||||
|
||||
localBuf = (uint32_t*)malloc( localBufSize );
|
||||
|
||||
if ( localBuf )
|
||||
{
|
||||
memset32( localBuf, alphaMask, localBufSize );
|
||||
memset( localBuf, 0, localBufSize );
|
||||
}
|
||||
|
||||
vsyncEnabled = true;
|
||||
|
@ -142,10 +136,6 @@ ConsoleViewGL_t::ConsoleViewGL_t(QWidget *parent)
|
|||
|
||||
ConsoleViewGL_t::~ConsoleViewGL_t(void)
|
||||
{
|
||||
//printf("Destroying GL Viewport\n");
|
||||
drawTimer->stop();
|
||||
delete drawTimer;
|
||||
|
||||
if ( localBuf )
|
||||
{
|
||||
free( localBuf ); localBuf = NULL;
|
||||
|
@ -512,7 +502,7 @@ void ConsoleViewGL_t::transfer2LocalBuffer(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
copyPixels32( dest, src, cpSize, alphaMask);
|
||||
memcpy( localBuf, src, cpSize );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -574,22 +564,6 @@ void ConsoleViewGL_t::getNormalizedCursorPos( double &x, double &y )
|
|||
void ConsoleViewGL_t::renderFinished(void)
|
||||
{
|
||||
videoBufferSwapMark();
|
||||
|
||||
// Schedule draw timing inline with vsync
|
||||
drawTimer->start();
|
||||
}
|
||||
|
||||
void ConsoleViewGL_t::queueRedraw(void)
|
||||
{
|
||||
if (!drawTimer->isActive())
|
||||
{
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleViewGL_t::onDrawSignal(void)
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
void ConsoleViewGL_t::paintGL(void)
|
||||
|
@ -697,7 +671,7 @@ void ConsoleViewGL_t::paintGL(void)
|
|||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_ONE, GL_ZERO);
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
//glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if ( textureType == GL_TEXTURE_RECTANGLE )
|
||||
|
|
|
@ -10,9 +10,7 @@
|
|||
#include <QOpenGLWidget>
|
||||
#include <QOpenGLFunctions>
|
||||
|
||||
#include "Qt/ConsoleViewerInterface.h"
|
||||
|
||||
class ConsoleViewGL_t : public QOpenGLWidget, protected QOpenGLFunctions, public ConsoleViewerBase
|
||||
class ConsoleViewGL_t : public QOpenGLWidget, protected QOpenGLFunctions
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -22,8 +20,6 @@ class ConsoleViewGL_t : public QOpenGLWidget, protected QOpenGLFunctions, public
|
|||
|
||||
int init(void);
|
||||
void reset(void);
|
||||
void queueRedraw(void);
|
||||
int driver(void){ return VIDEO_DRIVER_OPENGL; };
|
||||
|
||||
void transfer2LocalBuffer(void);
|
||||
|
||||
|
@ -45,13 +41,6 @@ class ConsoleViewGL_t : public QOpenGLWidget, protected QOpenGLFunctions, public
|
|||
|
||||
void screenChanged(QScreen *scr);
|
||||
void setBgColor( QColor &c );
|
||||
void setCursor(const QCursor &c){ QOpenGLWidget::setCursor(c); };
|
||||
void setCursor( Qt::CursorShape s ){ QOpenGLWidget::setCursor(s); };
|
||||
|
||||
QSize size(void){ return QOpenGLWidget::size(); };
|
||||
QCursor cursor(void){ return QOpenGLWidget::cursor(); };
|
||||
void setMinimumSize(const QSize &s){ return QOpenGLWidget::setMinimumSize(s); };
|
||||
void setMaximumSize(const QSize &s){ return QOpenGLWidget::setMaximumSize(s); };
|
||||
|
||||
protected:
|
||||
void initializeGL(void);
|
||||
|
@ -90,7 +79,6 @@ class ConsoleViewGL_t : public QOpenGLWidget, protected QOpenGLFunctions, public
|
|||
unsigned int textureType;
|
||||
unsigned int mouseButtonMask;
|
||||
QColor *bgColor;
|
||||
QTimer *drawTimer;
|
||||
|
||||
uint32_t *localBuf;
|
||||
uint32_t localBufSize;
|
||||
|
@ -98,6 +86,5 @@ class ConsoleViewGL_t : public QOpenGLWidget, protected QOpenGLFunctions, public
|
|||
private slots:
|
||||
void cleanupGL(void);
|
||||
void renderFinished(void);
|
||||
void onDrawSignal();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
// ConsoleViewerInterface.cpp
|
||||
//
|
||||
#include "Qt/ConsoleViewerInterface.h"
|
||||
|
||||
//----------------------------------------------------------
|
||||
void ConsoleViewerBase::memset32( void *buf, uint32_t val, size_t size)
|
||||
{
|
||||
uint32_t *p = static_cast<uint32_t*>(buf);
|
||||
size_t n = size / sizeof(uint32_t);
|
||||
|
||||
for (size_t i=0; i<n; i++)
|
||||
{
|
||||
*p = val; p++;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------
|
||||
void ConsoleViewerBase::copyPixels32( void *dest, void *src, size_t size, uint32_t alphaMask)
|
||||
{
|
||||
uint32_t *d = static_cast<uint32_t*>(dest);
|
||||
uint32_t *s = static_cast<uint32_t*>(src);
|
||||
size_t n = size / sizeof(uint32_t);
|
||||
|
||||
for (size_t i=0; i<n; i++)
|
||||
{
|
||||
*d = *s | alphaMask; d++; s++;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------
|
|
@ -1,56 +0,0 @@
|
|||
// ConsoleViewerInterface.h
|
||||
//
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
#include <QColor>
|
||||
#include <QCursor>
|
||||
#include <QSize>
|
||||
|
||||
class ConsoleViewerBase
|
||||
{
|
||||
public:
|
||||
enum VideoDriver
|
||||
{
|
||||
VIDEO_DRIVER_OPENGL = 0,
|
||||
VIDEO_DRIVER_SDL,
|
||||
VIDEO_DRIVER_QPAINTER
|
||||
};
|
||||
virtual int init(void) = 0;
|
||||
virtual void reset(void) = 0;
|
||||
virtual void queueRedraw(void) = 0;
|
||||
virtual int driver(void) = 0;
|
||||
|
||||
virtual void transfer2LocalBuffer(void) = 0;
|
||||
|
||||
virtual void setVsyncEnable( bool ena ) = 0;
|
||||
virtual void setLinearFilterEnable( bool ena ) = 0;
|
||||
|
||||
virtual bool getForceAspectOpt(void) = 0;
|
||||
virtual void setForceAspectOpt( bool val ) = 0;
|
||||
virtual bool getAutoScaleOpt(void) = 0;
|
||||
virtual void setAutoScaleOpt( bool val ) = 0;
|
||||
virtual double getScaleX(void) = 0;
|
||||
virtual double getScaleY(void) = 0;
|
||||
virtual void setScaleXY( double xs, double ys ) = 0;
|
||||
virtual void getNormalizedCursorPos( double &x, double &y ) = 0;
|
||||
virtual bool getMouseButtonState( unsigned int btn ) = 0;
|
||||
virtual void setAspectXY( double x, double y ) = 0;
|
||||
virtual void getAspectXY( double &x, double &y ) = 0;
|
||||
virtual double getAspectRatio(void) = 0;
|
||||
|
||||
virtual void setCursor(const QCursor &c) = 0;
|
||||
virtual void setCursor( Qt::CursorShape s ) = 0;
|
||||
virtual void setBgColor( QColor &c ) = 0;
|
||||
|
||||
virtual QSize size(void) = 0;
|
||||
virtual QCursor cursor(void) = 0;
|
||||
virtual void setMinimumSize(const QSize &) = 0;
|
||||
virtual void setMaximumSize(const QSize &) = 0;
|
||||
|
||||
static void memset32( void *buf, uint32_t val, size_t size);
|
||||
static void copyPixels32( void *dest, void *src, size_t size, uint32_t alphaMask);
|
||||
|
||||
static constexpr uint32_t alphaMask = 0xff000000;
|
||||
protected:
|
||||
};
|
|
@ -1,505 +0,0 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2020 mjbudd77
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
// GameViewer.cpp
|
||||
//
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
//#include <unistd.h>
|
||||
|
||||
#include "../../profiler.h"
|
||||
#include "Qt/nes_shm.h"
|
||||
#include "Qt/throttle.h"
|
||||
#include "Qt/fceuWrapper.h"
|
||||
#include "Qt/ConsoleViewerQWidget.h"
|
||||
#include "Qt/ConsoleUtilities.h"
|
||||
#include "Qt/ConsoleWindow.h"
|
||||
|
||||
extern unsigned int gui_draw_area_width;
|
||||
extern unsigned int gui_draw_area_height;
|
||||
|
||||
ConsoleViewQWidget_t::ConsoleViewQWidget_t(QWidget *parent)
|
||||
: QWidget( parent )
|
||||
{
|
||||
consoleWin_t *win = qobject_cast <consoleWin_t*>(parent);
|
||||
|
||||
printf("Initializing QPainter Video Driver\n");
|
||||
|
||||
QPalette pal = palette();
|
||||
|
||||
pal.setColor(QPalette::Window, Qt::black);
|
||||
setAutoFillBackground(true);
|
||||
setPalette(pal);
|
||||
|
||||
bgColor = nullptr;
|
||||
|
||||
if ( win )
|
||||
{
|
||||
bgColor = win->getVideoBgColorPtr();
|
||||
bgColor->setRgb( 0, 0, 0 );
|
||||
}
|
||||
|
||||
setMinimumWidth( 256 );
|
||||
setMinimumHeight( 224 );
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
view_width = GL_NES_WIDTH;
|
||||
view_height = GL_NES_HEIGHT;
|
||||
|
||||
sx = sy = 0;
|
||||
rw = view_width;
|
||||
rh = view_height;
|
||||
sdlRendW = 0;
|
||||
sdlRendH = 0;
|
||||
xscale = 2.0;
|
||||
yscale = 2.0;
|
||||
|
||||
devPixRatio = 1.0f;
|
||||
aspectRatio = 1.0f;
|
||||
aspectX = 1.0f;
|
||||
aspectY = 1.0f;
|
||||
|
||||
vsyncEnabled = false;
|
||||
mouseButtonMask = 0;
|
||||
|
||||
localBufSize = (4 * GL_NES_WIDTH) * (4 * GL_NES_HEIGHT) * sizeof(uint32_t);
|
||||
|
||||
localBuf = (uint32_t*)malloc( localBufSize );
|
||||
|
||||
if ( localBuf )
|
||||
{
|
||||
memset32( localBuf, alphaMask, localBufSize );
|
||||
}
|
||||
|
||||
forceAspect = true;
|
||||
autoScaleEna = true;
|
||||
linearFilter = false;
|
||||
|
||||
if ( g_config )
|
||||
{
|
||||
int opt;
|
||||
g_config->getOption("SDL.OpenGLip", &opt );
|
||||
|
||||
linearFilter = (opt) ? true : false;
|
||||
|
||||
g_config->getOption ("SDL.AutoScale", &opt);
|
||||
|
||||
autoScaleEna = (opt) ? true : false;
|
||||
|
||||
g_config->getOption("SDL.XScale", &xscale);
|
||||
g_config->getOption("SDL.YScale", &yscale);
|
||||
|
||||
g_config->getOption ("SDL.ForceAspect", &forceAspect);
|
||||
|
||||
if ( bgColor )
|
||||
{
|
||||
fceuLoadConfigColor( "SDL.VideoBgColor", bgColor );
|
||||
}
|
||||
g_config->getOption ("SDL.VideoVsync", &vsyncEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
ConsoleViewQWidget_t::~ConsoleViewQWidget_t(void)
|
||||
{
|
||||
//printf("Destroying QPainter Viewport\n");
|
||||
|
||||
if ( localBuf )
|
||||
{
|
||||
free( localBuf ); localBuf = nullptr;
|
||||
}
|
||||
cleanup();
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::setBgColor( QColor &c )
|
||||
{
|
||||
if ( bgColor )
|
||||
{
|
||||
*bgColor = c;
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::setVsyncEnable( bool ena )
|
||||
{
|
||||
if ( vsyncEnabled != ena )
|
||||
{
|
||||
vsyncEnabled = ena;
|
||||
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::setLinearFilterEnable( bool ena )
|
||||
{
|
||||
if ( ena != linearFilter )
|
||||
{
|
||||
linearFilter = ena;
|
||||
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::setScaleXY( double xs, double ys )
|
||||
{
|
||||
xscale = xs;
|
||||
yscale = ys;
|
||||
|
||||
if ( forceAspect )
|
||||
{
|
||||
if ( xscale < yscale )
|
||||
{
|
||||
yscale = xscale;
|
||||
}
|
||||
else
|
||||
{
|
||||
xscale = yscale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::setAspectXY( double x, double y )
|
||||
{
|
||||
aspectX = x;
|
||||
aspectY = y;
|
||||
|
||||
aspectRatio = aspectY / aspectX;
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::getAspectXY( double &x, double &y )
|
||||
{
|
||||
x = aspectX;
|
||||
y = aspectY;
|
||||
}
|
||||
|
||||
double ConsoleViewQWidget_t::getAspectRatio(void)
|
||||
{
|
||||
return aspectRatio;
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::transfer2LocalBuffer(void)
|
||||
{
|
||||
int i=0, hq = 0, bufIdx;
|
||||
int numPixels = nes_shm->video.ncol * nes_shm->video.nrow;
|
||||
unsigned int cpSize = numPixels * 4;
|
||||
uint8_t *src, *dest;
|
||||
|
||||
bufIdx = nes_shm->pixBufIdx-1;
|
||||
|
||||
if ( bufIdx < 0 )
|
||||
{
|
||||
bufIdx = NES_VIDEO_BUFLEN-1;
|
||||
}
|
||||
if ( cpSize > localBufSize )
|
||||
{
|
||||
cpSize = localBufSize;
|
||||
}
|
||||
src = (uint8_t*)nes_shm->pixbuf[bufIdx];
|
||||
dest = (uint8_t*)localBuf;
|
||||
|
||||
hq = (nes_shm->video.preScaler == 1) || (nes_shm->video.preScaler == 4); // hq2x and hq3x
|
||||
|
||||
if ( hq )
|
||||
{
|
||||
for (i=0; i<numPixels; i++)
|
||||
{
|
||||
dest[3] = 0xFF;
|
||||
dest[1] = src[1];
|
||||
dest[2] = src[2];
|
||||
dest[0] = src[0];
|
||||
|
||||
src += 4; dest += 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//memcpy( localBuf, src, cpSize );
|
||||
copyPixels32( dest, src, cpSize, alphaMask);
|
||||
}
|
||||
}
|
||||
|
||||
int ConsoleViewQWidget_t::init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::cleanup(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::reset(void)
|
||||
{
|
||||
cleanup();
|
||||
if ( init() == 0 )
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::setCursor(const QCursor &c)
|
||||
{
|
||||
QWidget::setCursor(c);
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::setCursor( Qt::CursorShape s )
|
||||
{
|
||||
QWidget::setCursor(s);
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::showEvent(QShowEvent *event)
|
||||
{
|
||||
//printf("SDL Show: %i x %i \n", width(), height() );
|
||||
|
||||
//view_width = width();
|
||||
//view_height = height();
|
||||
|
||||
//gui_draw_area_width = view_width;
|
||||
//gui_draw_area_height = view_height;
|
||||
|
||||
//reset();
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QSize s;
|
||||
|
||||
s = event->size();
|
||||
view_width = s.width();
|
||||
view_height = s.height();
|
||||
printf("QWidget Resize: %i x %i \n", view_width, view_height);
|
||||
|
||||
gui_draw_area_width = view_width;
|
||||
gui_draw_area_height = view_height;
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::mousePressEvent(QMouseEvent * event)
|
||||
{
|
||||
//printf("Mouse Button Press: (%i,%i) %x %x\n",
|
||||
// event->pos().x(), event->pos().y(), event->button(), event->buttons() );
|
||||
|
||||
mouseButtonMask = event->buttons();
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::mouseReleaseEvent(QMouseEvent * event)
|
||||
{
|
||||
//printf("Mouse Button Release: (%i,%i) %x %x\n",
|
||||
// event->pos().x(), event->pos().y(), event->button(), event->buttons() );
|
||||
|
||||
mouseButtonMask = event->buttons();
|
||||
}
|
||||
|
||||
bool ConsoleViewQWidget_t::getMouseButtonState( unsigned int btn )
|
||||
{
|
||||
bool isPressed = false;
|
||||
|
||||
if ( mouseButtonMask & btn )
|
||||
{
|
||||
isPressed = true;
|
||||
}
|
||||
else
|
||||
{ // Check SDL mouse state just in case SDL is intercepting
|
||||
// mouse events from window system causing Qt not to see them.
|
||||
int x, y;
|
||||
uint32_t b;
|
||||
b = SDL_GetMouseState( &x, &y);
|
||||
|
||||
if ( btn & Qt::LeftButton )
|
||||
{
|
||||
if ( b & SDL_BUTTON(SDL_BUTTON_LEFT) )
|
||||
{
|
||||
isPressed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( btn & Qt::RightButton )
|
||||
{
|
||||
if ( b & SDL_BUTTON(SDL_BUTTON_RIGHT) )
|
||||
{
|
||||
isPressed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( btn & Qt::MiddleButton )
|
||||
{
|
||||
if ( b & SDL_BUTTON(SDL_BUTTON_MIDDLE) )
|
||||
{
|
||||
isPressed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isPressed;
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::getNormalizedCursorPos( double &x, double &y )
|
||||
{
|
||||
QPoint cursor;
|
||||
|
||||
cursor = QCursor::pos();
|
||||
|
||||
//printf("Global Cursor (%i,%i) \n", cursor.x(), cursor.y() );
|
||||
|
||||
cursor = mapFromGlobal( cursor );
|
||||
|
||||
//printf("Window Cursor (%i,%i) \n", cursor.x(), cursor.y() );
|
||||
|
||||
x = (double)(cursor.x() - sx) / (double)rw;
|
||||
y = (double)(cursor.y() - sy) / (double)rh;
|
||||
|
||||
if ( x < 0.0 )
|
||||
{
|
||||
x = 0.0;
|
||||
}
|
||||
else if ( x > 1.0 )
|
||||
{
|
||||
x = 1.0;
|
||||
}
|
||||
if ( y < 0.0 )
|
||||
{
|
||||
y = 0.0;
|
||||
}
|
||||
else if ( y > 1.0 )
|
||||
{
|
||||
y = 1.0;
|
||||
}
|
||||
//printf("Normalized Cursor (%f,%f) \n", x, y );
|
||||
}
|
||||
|
||||
void ConsoleViewQWidget_t::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPainter painter(this);
|
||||
int nesWidth = GL_NES_WIDTH;
|
||||
int nesHeight = GL_NES_HEIGHT;
|
||||
float ixScale = 1.0;
|
||||
float iyScale = 1.0;
|
||||
|
||||
if ( nes_shm != nullptr )
|
||||
{
|
||||
nesWidth = nes_shm->video.ncol;
|
||||
nesHeight = nes_shm->video.nrow;
|
||||
ixScale = (float)nes_shm->video.xscale;
|
||||
iyScale = (float)nes_shm->video.yscale;
|
||||
}
|
||||
//printf(" %i x %i \n", nesWidth, nesHeight );
|
||||
float xscaleTmp = (float)view_width / (float)nesWidth;
|
||||
float yscaleTmp = (float)view_height / (float)nesHeight;
|
||||
|
||||
xscaleTmp *= ixScale;
|
||||
yscaleTmp *= iyScale;
|
||||
|
||||
if ( forceAspect )
|
||||
{
|
||||
if ( xscaleTmp < yscaleTmp )
|
||||
{
|
||||
yscaleTmp = xscaleTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
xscaleTmp = yscaleTmp;
|
||||
}
|
||||
}
|
||||
|
||||
if ( autoScaleEna )
|
||||
{
|
||||
xscale = xscaleTmp;
|
||||
yscale = yscaleTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( xscaleTmp > xscale )
|
||||
{
|
||||
xscaleTmp = xscale;
|
||||
}
|
||||
if ( yscaleTmp > yscale )
|
||||
{
|
||||
yscaleTmp = yscale;
|
||||
}
|
||||
}
|
||||
|
||||
rw=(int)(nesWidth*xscaleTmp/ixScale);
|
||||
rh=(int)(nesHeight*yscaleTmp/iyScale);
|
||||
|
||||
if ( forceAspect )
|
||||
{
|
||||
int iw, ih, ax, ay;
|
||||
|
||||
ax = (int)(aspectX+0.50);
|
||||
ay = (int)(aspectY+0.50);
|
||||
|
||||
iw = rw * ay;
|
||||
ih = rh * ax;
|
||||
|
||||
if ( iw > ih )
|
||||
{
|
||||
rh = (rw * ay) / ax;
|
||||
}
|
||||
else
|
||||
{
|
||||
rw = (rh * ax) / ay;
|
||||
}
|
||||
|
||||
if ( rw > view_width )
|
||||
{
|
||||
rw = view_width;
|
||||
rh = (rw * ay) / ax;
|
||||
}
|
||||
|
||||
if ( rh > view_height )
|
||||
{
|
||||
rh = view_height;
|
||||
rw = (rh * ax) / ay;
|
||||
}
|
||||
}
|
||||
|
||||
if ( rw > view_width ) rw = view_width;
|
||||
if ( rh > view_height) rh = view_height;
|
||||
|
||||
sx=(view_width-rw)/2;
|
||||
sy=(view_height-rh)/2;
|
||||
|
||||
if ( bgColor )
|
||||
{
|
||||
painter.fillRect( 0, 0, view_width, view_height, *bgColor );
|
||||
}
|
||||
else
|
||||
{
|
||||
painter.fillRect( 0, 0, view_width, view_height, Qt::black );
|
||||
}
|
||||
painter.setRenderHint( QPainter::SmoothPixmapTransform, linearFilter );
|
||||
|
||||
int rowPitch = nesWidth * sizeof(uint32_t);
|
||||
|
||||
QImage tmpImage( (const uchar*)localBuf, nesWidth, nesHeight, rowPitch, QImage::Format_ARGB32);
|
||||
|
||||
//SDL_Rect source = {0, 0, nesWidth, nesHeight };
|
||||
QRect dest( sx, sy, rw, rh );
|
||||
|
||||
painter.drawImage( dest, tmpImage );
|
||||
|
||||
videoBufferSwapMark();
|
||||
|
||||
nes_shm->render_count++;
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
// ConsoleViewerQWidget.h
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QColor>
|
||||
#include <QCursor>
|
||||
#include <QImage>
|
||||
#include <QPaintEvent>
|
||||
#include <QResizeEvent>
|
||||
|
||||
#include "Qt/ConsoleViewerInterface.h"
|
||||
|
||||
class ConsoleViewQWidget_t : public QWidget, public ConsoleViewerBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConsoleViewQWidget_t(QWidget *parent = 0);
|
||||
~ConsoleViewQWidget_t(void);
|
||||
|
||||
int init(void);
|
||||
void reset(void);
|
||||
void cleanup(void);
|
||||
void queueRedraw(void){ update(); };
|
||||
int driver(void){ return VIDEO_DRIVER_QPAINTER; };
|
||||
|
||||
void transfer2LocalBuffer(void);
|
||||
|
||||
void setVsyncEnable( bool ena );
|
||||
void setLinearFilterEnable( bool ena );
|
||||
|
||||
bool getForceAspectOpt(void){ return forceAspect; };
|
||||
void setForceAspectOpt( bool val ){ forceAspect = val; return; };
|
||||
bool getAutoScaleOpt(void){ return autoScaleEna; };
|
||||
void setAutoScaleOpt( bool val ){ autoScaleEna = val; return; };
|
||||
double getScaleX(void){ return xscale; };
|
||||
double getScaleY(void){ return yscale; };
|
||||
void setScaleXY( double xs, double ys );
|
||||
void getNormalizedCursorPos( double &x, double &y );
|
||||
bool getMouseButtonState( unsigned int btn );
|
||||
void setAspectXY( double x, double y );
|
||||
void getAspectXY( double &x, double &y );
|
||||
double getAspectRatio(void);
|
||||
|
||||
void setCursor(const QCursor &c);
|
||||
void setCursor( Qt::CursorShape s );
|
||||
void setBgColor( QColor &c );
|
||||
|
||||
QSize size(void){ return QWidget::size(); };
|
||||
QCursor cursor(void){ return QWidget::cursor(); };
|
||||
void setMinimumSize(const QSize &s){ return QWidget::setMinimumSize(s); };
|
||||
void setMaximumSize(const QSize &s){ return QWidget::setMaximumSize(s); };
|
||||
|
||||
protected:
|
||||
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void showEvent(QShowEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void mousePressEvent(QMouseEvent * event);
|
||||
void mouseReleaseEvent(QMouseEvent * event);
|
||||
|
||||
int view_width;
|
||||
int view_height;
|
||||
|
||||
double devPixRatio;
|
||||
double aspectRatio;
|
||||
double aspectX;
|
||||
double aspectY;
|
||||
double xscale;
|
||||
double yscale;
|
||||
int rw;
|
||||
int rh;
|
||||
int sx;
|
||||
int sy;
|
||||
int sdlRendW;
|
||||
int sdlRendH;
|
||||
|
||||
bool vsyncEnabled;
|
||||
bool linearFilter;
|
||||
bool forceAspect;
|
||||
bool autoScaleEna;
|
||||
QColor *bgColor;
|
||||
|
||||
uint32_t *localBuf;
|
||||
uint32_t localBufSize;
|
||||
unsigned int mouseButtonMask;
|
||||
|
||||
private slots:
|
||||
};
|
||||
|
|
@ -82,11 +82,6 @@ ConsoleViewSDL_t::ConsoleViewSDL_t(QWidget *parent)
|
|||
|
||||
vsyncEnabled = false;
|
||||
mouseButtonMask = 0;
|
||||
drawTimer = new QTimer(this);
|
||||
drawTimer->setInterval(14);
|
||||
drawTimer->setSingleShot(true);
|
||||
drawTimer->setTimerType(Qt::PreciseTimer);
|
||||
connect(drawTimer, &QTimer::timeout, this, &ConsoleViewSDL_t::onDrawSignal);
|
||||
|
||||
localBufSize = (4 * GL_NES_WIDTH) * (4 * GL_NES_HEIGHT) * sizeof(uint32_t);
|
||||
|
||||
|
@ -94,7 +89,7 @@ ConsoleViewSDL_t::ConsoleViewSDL_t(QWidget *parent)
|
|||
|
||||
if ( localBuf )
|
||||
{
|
||||
memset32( localBuf, alphaMask, localBufSize );
|
||||
memset( localBuf, 0, localBufSize );
|
||||
}
|
||||
|
||||
forceAspect = true;
|
||||
|
@ -127,10 +122,6 @@ ConsoleViewSDL_t::ConsoleViewSDL_t(QWidget *parent)
|
|||
|
||||
ConsoleViewSDL_t::~ConsoleViewSDL_t(void)
|
||||
{
|
||||
//printf("Destroying SDL Viewport\n");
|
||||
drawTimer->stop();
|
||||
delete drawTimer;
|
||||
|
||||
if ( localBuf )
|
||||
{
|
||||
free( localBuf ); localBuf = NULL;
|
||||
|
@ -249,7 +240,7 @@ void ConsoleViewSDL_t::transfer2LocalBuffer(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
copyPixels32( dest, src, cpSize, alphaMask);
|
||||
memcpy( localBuf, src, cpSize );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -592,19 +583,6 @@ void ConsoleViewSDL_t::getNormalizedCursorPos( double &x, double &y )
|
|||
//printf("Normalized Cursor (%f,%f) \n", x, y );
|
||||
}
|
||||
|
||||
void ConsoleViewSDL_t::queueRedraw(void)
|
||||
{
|
||||
if (!drawTimer->isActive())
|
||||
{
|
||||
render();
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleViewSDL_t::onDrawSignal(void)
|
||||
{
|
||||
render();
|
||||
}
|
||||
|
||||
void ConsoleViewSDL_t::render(void)
|
||||
{
|
||||
int nesWidth = GL_NES_WIDTH;
|
||||
|
@ -727,8 +705,5 @@ void ConsoleViewSDL_t::render(void)
|
|||
|
||||
videoBufferSwapMark();
|
||||
|
||||
// Schedule draw timing inline with vsync
|
||||
drawTimer->start();
|
||||
|
||||
nes_shm->render_count++;
|
||||
}
|
||||
|
|
|
@ -10,9 +10,7 @@
|
|||
#include <QResizeEvent>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "Qt/ConsoleViewerInterface.h"
|
||||
|
||||
class ConsoleViewSDL_t : public QWidget, public ConsoleViewerBase
|
||||
class ConsoleViewSDL_t : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -24,8 +22,6 @@ class ConsoleViewSDL_t : public QWidget, public ConsoleViewerBase
|
|||
void reset(void);
|
||||
void cleanup(void);
|
||||
void render(void);
|
||||
void queueRedraw(void);
|
||||
int driver(void){ return VIDEO_DRIVER_SDL; };
|
||||
|
||||
void transfer2LocalBuffer(void);
|
||||
|
||||
|
@ -48,12 +44,6 @@ class ConsoleViewSDL_t : public QWidget, public ConsoleViewerBase
|
|||
void setCursor(const QCursor &c);
|
||||
void setCursor( Qt::CursorShape s );
|
||||
void setBgColor( QColor &c );
|
||||
|
||||
QSize size(void){ return QWidget::size(); };
|
||||
QCursor cursor(void){ return QWidget::cursor(); };
|
||||
void setMinimumSize(const QSize &s){ return QWidget::setMinimumSize(s); };
|
||||
void setMaximumSize(const QSize &s){ return QWidget::setMaximumSize(s); };
|
||||
|
||||
protected:
|
||||
|
||||
//void paintEvent(QPaintEvent *event);
|
||||
|
@ -83,7 +73,6 @@ class ConsoleViewSDL_t : public QWidget, public ConsoleViewerBase
|
|||
bool forceAspect;
|
||||
bool autoScaleEna;
|
||||
QColor *bgColor;
|
||||
QTimer *drawTimer;
|
||||
|
||||
uint32_t *localBuf;
|
||||
uint32_t localBufSize;
|
||||
|
@ -96,6 +85,5 @@ class ConsoleViewSDL_t : public QWidget, public ConsoleViewerBase
|
|||
//SDL_Rect sdlViewport;
|
||||
|
||||
private slots:
|
||||
void onDrawSignal();
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -23,16 +23,12 @@
|
|||
#include <QCursor>
|
||||
#include <QMutex>
|
||||
#include <QColor>
|
||||
#include <QTemporaryDir>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
|
||||
#include <QRecursiveMutex>
|
||||
#endif
|
||||
|
||||
#include "utils/mutex.h"
|
||||
#include "Qt/ColorMenu.h"
|
||||
#include "Qt/ConsoleViewerGL.h"
|
||||
#include "Qt/ConsoleViewerSDL.h"
|
||||
#include "Qt/ConsoleViewerQWidget.h"
|
||||
#include "Qt/GamePadConf.h"
|
||||
#include "Qt/AviRecord.h"
|
||||
|
||||
|
@ -129,15 +125,16 @@ class consoleWin_t : public QMainWindow
|
|||
consoleWin_t(QWidget *parent = 0);
|
||||
~consoleWin_t(void);
|
||||
|
||||
ConsoleViewGL_t *viewport_GL;
|
||||
ConsoleViewSDL_t *viewport_SDL;
|
||||
ConsoleViewQWidget_t *viewport_QWidget;
|
||||
ConsoleViewerBase *viewport_Interface;
|
||||
ConsoleViewGL_t *viewport_GL;
|
||||
ConsoleViewSDL_t *viewport_SDL;
|
||||
|
||||
void setCyclePeriodms( int ms );
|
||||
|
||||
FCEU::mutex emulatorMutex;
|
||||
FCEU::mutex videoBufferMutex;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
|
||||
QRecursiveMutex *mutex;
|
||||
#else
|
||||
QMutex *mutex;
|
||||
#endif
|
||||
|
||||
int videoInit(void);
|
||||
void videoReset(void);
|
||||
|
@ -157,7 +154,6 @@ class consoleWin_t : public QMainWindow
|
|||
#endif
|
||||
|
||||
int loadVideoDriver( int driverId, bool force = false );
|
||||
int unloadVideoDriver(void);
|
||||
|
||||
double getRefreshRate(void){ return refreshRate; }
|
||||
|
||||
|
@ -179,14 +175,12 @@ class consoleWin_t : public QMainWindow
|
|||
void setContextMenuEnable(bool enable);
|
||||
void setSoundUseGlobalFocus(bool enable);
|
||||
|
||||
void OpenHelpWindow(QString subpage = QString());
|
||||
void OpenHelpWindow(std::string subpage = "");
|
||||
|
||||
int getPeriodicInterval(void);
|
||||
|
||||
QColor *getVideoBgColorPtr(void){ return &videoBgColor; }
|
||||
|
||||
QString getTempDir();
|
||||
|
||||
protected:
|
||||
consoleMenuBar *menubar;
|
||||
|
||||
|
@ -196,7 +190,6 @@ class consoleWin_t : public QMainWindow
|
|||
QMenu *toolsMenu;
|
||||
QMenu *debugMenu;
|
||||
QMenu *movieMenu;
|
||||
QMenu *netPlayMenu;
|
||||
QMenu *helpMenu;
|
||||
QMenu *recentRomMenu;
|
||||
|
||||
|
@ -208,7 +201,6 @@ class consoleWin_t : public QMainWindow
|
|||
QAction *quickLoadAct;
|
||||
QAction *quickSaveAct;
|
||||
QAction *loadLuaAct;
|
||||
QAction *loadJsAct;
|
||||
QAction *scrShotAct;
|
||||
QAction *quitAct;
|
||||
QAction *inputConfig;
|
||||
|
@ -218,7 +210,6 @@ class consoleWin_t : public QMainWindow
|
|||
QAction *hotkeyConfig;
|
||||
QAction *paletteConfig;
|
||||
QAction *guiConfig;
|
||||
QAction *stateRecordConfig;
|
||||
QAction *timingConfig;
|
||||
QAction *movieConfig;
|
||||
QAction *autoResume;
|
||||
|
@ -263,18 +254,11 @@ class consoleWin_t : public QMainWindow
|
|||
QAction *recAsWavAct;
|
||||
QAction *stopWavAct;
|
||||
QAction *tasEditorAct;
|
||||
QAction *netPlayHostAct;
|
||||
QAction *netPlayJoinAct;
|
||||
QAction *netPlayDiscAct;
|
||||
QAction *netPlayHostStatAct;
|
||||
QAction *netPlayClientStatAct;
|
||||
//QAction *aviHudAct;
|
||||
//QAction *aviMsgAct;
|
||||
|
||||
QTimer *gameTimer;
|
||||
QColor videoBgColor;
|
||||
ColorMenuItem *bgColorMenuItem;
|
||||
QTemporaryDir *tempDir;
|
||||
|
||||
std::string errorMsg;
|
||||
bool errorMsgValid;
|
||||
|
@ -288,7 +272,6 @@ class consoleWin_t : public QMainWindow
|
|||
bool contextMenuEnable;
|
||||
bool soundUseGlobalFocus;
|
||||
bool autoHideMenuFullscreen;
|
||||
bool redrawVideoRequest;
|
||||
|
||||
std::list <std::string*> romList;
|
||||
std::vector <autoFireMenuAction*> afActList;
|
||||
|
@ -324,19 +307,10 @@ class consoleWin_t : public QMainWindow
|
|||
void changeState(int slot);
|
||||
void saveState(int slot);
|
||||
void loadState(int slot);
|
||||
void transferVideoBuffer(bool allowRedraw);
|
||||
void transferVideoBuffer(void);
|
||||
void syncAutoFirePatternMenu(void);
|
||||
|
||||
QString findHelpFile(void);
|
||||
|
||||
public:
|
||||
signals:
|
||||
void romLoaded(void);
|
||||
void romUnload(void);
|
||||
void stateLoaded(void);
|
||||
void nesResetOccurred(void);
|
||||
void pauseToggled(bool state);
|
||||
void cheatsChanged(void);
|
||||
std::string findHelpFile(void);
|
||||
|
||||
public slots:
|
||||
void openDebugWindow(void);
|
||||
|
@ -346,7 +320,6 @@ class consoleWin_t : public QMainWindow
|
|||
void toggleMenuVis(void);
|
||||
void recordMovie(void);
|
||||
void winResizeIx(int iScale);
|
||||
void onNetPlayChange(void);
|
||||
private slots:
|
||||
void closeApp(void);
|
||||
void openROMFile(void);
|
||||
|
@ -369,12 +342,7 @@ class consoleWin_t : public QMainWindow
|
|||
void openPaletteConfWin(void);
|
||||
void openGuiConfWin(void);
|
||||
void openTimingConfWin(void);
|
||||
void openStateRecorderConfWin(void);
|
||||
void openPaletteEditorWin(void);
|
||||
void openNetPlayHostWindow(void);
|
||||
void openNetPlayJoinWindow(void);
|
||||
void openNetPlayStatusWindow(void);
|
||||
void closeNetPlaySession(void);
|
||||
void openAviRiffViewer(void);
|
||||
void openTimingStatWin(void);
|
||||
void openMovieOptWin(void);
|
||||
|
@ -396,7 +364,6 @@ class consoleWin_t : public QMainWindow
|
|||
void incrementState(void);
|
||||
void decrementState(void);
|
||||
void loadLua(void);
|
||||
void loadJs(void);
|
||||
void takeScreenShot(void);
|
||||
void prepareScreenShot(void);
|
||||
void powerConsoleCB(void);
|
||||
|
@ -406,7 +373,6 @@ class consoleWin_t : public QMainWindow
|
|||
void toggleGameGenie(bool checked);
|
||||
void loadGameGenieROM(void);
|
||||
void loadMostRecentROM(void);
|
||||
void clearRecentRomMenu(void);
|
||||
void setRegionNTSC(void);
|
||||
void setRegionPAL(void);
|
||||
void setRegionDendy(void);
|
||||
|
@ -437,7 +403,6 @@ class consoleWin_t : public QMainWindow
|
|||
void stopMovie(void);
|
||||
void playMovieFromBeginning(void);
|
||||
void setCustomAutoFire(void);
|
||||
void muteSoundVolume(void);
|
||||
void incrSoundVolume(void);
|
||||
void decrSoundVolume(void);
|
||||
void toggleLagCounterDisplay(void);
|
||||
|
@ -471,8 +436,6 @@ class consoleWin_t : public QMainWindow
|
|||
void loadState7(void);
|
||||
void loadState8(void);
|
||||
void loadState9(void);
|
||||
void loadPrevState(void);
|
||||
void loadNextState(void);
|
||||
void mainMenuOpen(void);
|
||||
void mainMenuClose(void);
|
||||
void warnAmbiguousShortcut( QShortcut*);
|
||||
|
@ -490,10 +453,8 @@ class consoleWin_t : public QMainWindow
|
|||
void winActiveChanged(void);
|
||||
void emuFrameFinish(void);
|
||||
void toggleMenuAutoHide(bool);
|
||||
void toggleUseBgPaletteForVideo(bool);
|
||||
void videoBgColorChanged( QColor &c );
|
||||
void loadRomRequestCB( QString s );
|
||||
void videoDriverDestroyed( QObject *obj );
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -126,6 +126,7 @@ int openFamilyKeyboardDialog(QWidget *parent)
|
|||
{
|
||||
fkbWin->activateWindow();
|
||||
fkbWin->raise();
|
||||
fkbWin->setFocus();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -247,7 +248,7 @@ void FamilyKeyboardWidget::updateHardwareStatus(void)
|
|||
//*********************************************************************************
|
||||
int FamilyKeyboardWidget::getKeyAtPoint( QPoint p )
|
||||
{
|
||||
for (int i=0; i < static_cast<int>(NUM_KEYS); i++)
|
||||
for (int i=0; i<NUM_KEYS; i++)
|
||||
{
|
||||
if ( key[i].rect.contains(p) )
|
||||
{
|
||||
|
@ -616,11 +617,11 @@ FKBConfigDialog::FKBConfigDialog(QWidget *parent)
|
|||
|
||||
if ( strcmp( keyNames[j], keyNames[j+1] ) == 0 )
|
||||
{
|
||||
snprintf( stmp, sizeof(stmp), " %s ", keyNames[j] );
|
||||
sprintf( stmp, " %s ", keyNames[j] );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( stmp, sizeof(stmp), " %s - %s ", keyNames[j], keyNames[j+1] );
|
||||
sprintf( stmp, " %s - %s ", keyNames[j], keyNames[j+1] );
|
||||
}
|
||||
|
||||
item->setText(0, tr(stmp) );
|
||||
|
@ -858,9 +859,9 @@ void FKBConfigDialog::openFontDialog(void)
|
|||
keyboard->setFont( selFont );
|
||||
keyboard->update();
|
||||
|
||||
//printf("Font Changed to: '%s'\n", font.toString().toLocal8Bit().constData() );
|
||||
//printf("Font Changed to: '%s'\n", font.toString().toStdString().c_str() );
|
||||
|
||||
g_config->setOption("SDL.FamilyKeyboardFont", selFont.toString().toLocal8Bit().constData() );
|
||||
g_config->setOption("SDL.FamilyKeyboardFont", selFont.toString().toStdString().c_str() );
|
||||
|
||||
QTimer::singleShot( 100, this, SLOT(keyTreeResizeDone(void)) );
|
||||
}
|
||||
|
@ -1028,7 +1029,7 @@ void FKBConfigDialog::keyTreeItemActivated(QTreeWidgetItem *item, int column)
|
|||
//----------------------------------------------------------------------------
|
||||
int FKBConfigDialog::getButtonIndexFromName( const char *buttonName )
|
||||
{
|
||||
for (int j=0; j < static_cast<int>(FamilyKeyboardWidget::NUM_KEYS); j++)
|
||||
for (int j=0; j<FamilyKeyboardWidget::NUM_KEYS; j++)
|
||||
{
|
||||
if ( strcmp( buttonName, FamilyKeyBoardNames[j] ) == 0 )
|
||||
{
|
||||
|
@ -1189,9 +1190,9 @@ void FKBConfigDialog::mappingLoad(void)
|
|||
{
|
||||
return;
|
||||
}
|
||||
//qDebug() << "selected file path : " << filename.toLocal8Bit();
|
||||
//qDebug() << "selected file path : " << filename.toUtf8();
|
||||
|
||||
mappingLoad( filename.toLocal8Bit().constData() );
|
||||
mappingLoad( filename.toStdString().c_str() );
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1331,26 +1332,26 @@ void FKBConfigDialog::mappingSave(void)
|
|||
}
|
||||
stmp[k] = 0;
|
||||
|
||||
//snprintf(stmp, sizeof(stmp), "k%s", SDL_GetKeyName(bmap[c][i].ButtonNum));
|
||||
//sprintf(stmp, "k%s", SDL_GetKeyName(bmap[c][i].ButtonNum));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fkbmap[i].ButtonNum & 0x2000)
|
||||
{
|
||||
/* Hat "button" */
|
||||
snprintf(stmp, sizeof(stmp), "h%i.%i",
|
||||
sprintf(stmp, "h%i.%i",
|
||||
(fkbmap[i].ButtonNum >> 8) & 0x1F, fkbmap[i].ButtonNum & 0xFF);
|
||||
}
|
||||
else if (fkbmap[i].ButtonNum & 0x8000)
|
||||
{
|
||||
/* Axis "button" */
|
||||
snprintf(stmp, sizeof(stmp), "%ca%i",
|
||||
sprintf(stmp, "%ca%i",
|
||||
(fkbmap[i].ButtonNum & 0x4000) ? '-' : '+', fkbmap[i].ButtonNum & 0x3FFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Button */
|
||||
snprintf(stmp, sizeof(stmp), "b%i", fkbmap[i].ButtonNum);
|
||||
sprintf(stmp, "b%i", fkbmap[i].ButtonNum);
|
||||
}
|
||||
}
|
||||
fprintf( fp, "%s=%s\n", FamilyKeyBoardNames[i], stmp );
|
||||
|
@ -1432,7 +1433,7 @@ void FKBConfigDialog::mappingSaveAs(void)
|
|||
return;
|
||||
}
|
||||
|
||||
saveFileName = filename.toLocal8Bit().constData();
|
||||
saveFileName = filename.toStdString();
|
||||
|
||||
mappingSave();
|
||||
}
|
||||
|
@ -1462,7 +1463,7 @@ FKBKeyMapDialog::FKBKeyMapDialog( int idx, QWidget *parent )
|
|||
|
||||
setLayout( mainLayout );
|
||||
|
||||
snprintf( stmp, sizeof(stmp), "Press a key to set new physical mapping for the '%s' Key", keyNames[idx*2] );
|
||||
sprintf( stmp, "Press a key to set new physical mapping for the '%s' Key", keyNames[idx*2] );
|
||||
|
||||
msgLbl = new QLabel( tr(stmp) );
|
||||
|
||||
|
|
|
@ -89,7 +89,6 @@ FrameTimingDialog_t::FrameTimingDialog_t(QWidget *parent)
|
|||
frameTimeIdlePct = new QTreeWidgetItem();
|
||||
frameLateCount = new QTreeWidgetItem();
|
||||
videoTimeAbs = new QTreeWidgetItem();
|
||||
emuSignalDelay = new QTreeWidgetItem();
|
||||
|
||||
tree->addTopLevelItem(frameTimeAbs);
|
||||
tree->addTopLevelItem(frameTimeDel);
|
||||
|
@ -98,7 +97,6 @@ FrameTimingDialog_t::FrameTimingDialog_t(QWidget *parent)
|
|||
tree->addTopLevelItem(frameTimeWorkPct);
|
||||
tree->addTopLevelItem(frameTimeIdlePct);
|
||||
tree->addTopLevelItem(videoTimeAbs);
|
||||
tree->addTopLevelItem(emuSignalDelay);
|
||||
tree->addTopLevelItem(frameLateCount);
|
||||
|
||||
frameTimeAbs->setFlags(Qt::ItemIsEnabled | Qt::ItemNeverHasChildren);
|
||||
|
@ -111,7 +109,6 @@ FrameTimingDialog_t::FrameTimingDialog_t(QWidget *parent)
|
|||
frameTimeWorkPct->setText(0, tr("Frame Work %"));
|
||||
frameTimeIdlePct->setText(0, tr("Frame Idle %"));
|
||||
frameLateCount->setText(0, tr("Frame Late Count"));
|
||||
emuSignalDelay->setText(0, tr("EMU Signal Delay ms"));
|
||||
videoTimeAbs->setText(0, tr("Video Period ms"));
|
||||
|
||||
frameTimeAbs->setTextAlignment(0, Qt::AlignLeft);
|
||||
|
@ -122,7 +119,6 @@ FrameTimingDialog_t::FrameTimingDialog_t(QWidget *parent)
|
|||
frameTimeIdlePct->setTextAlignment(0, Qt::AlignLeft);
|
||||
frameLateCount->setTextAlignment(0, Qt::AlignLeft);
|
||||
videoTimeAbs->setTextAlignment(0, Qt::AlignLeft);
|
||||
emuSignalDelay->setTextAlignment(0, Qt::AlignLeft);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
@ -134,7 +130,6 @@ FrameTimingDialog_t::FrameTimingDialog_t(QWidget *parent)
|
|||
frameTimeIdlePct->setTextAlignment(i + 1, Qt::AlignCenter);
|
||||
frameLateCount->setTextAlignment(i + 1, Qt::AlignCenter);
|
||||
videoTimeAbs->setTextAlignment(i + 1, Qt::AlignCenter);
|
||||
emuSignalDelay->setTextAlignment(i + 1, Qt::AlignCenter);
|
||||
}
|
||||
|
||||
hbox = new QHBoxLayout();
|
||||
|
@ -209,111 +204,98 @@ void FrameTimingDialog_t::updateTimingStats(void)
|
|||
getFrameTimingStats(&stats);
|
||||
|
||||
// Absolute
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeAbs.tgt * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.frameTimeAbs.tgt * 1e3);
|
||||
frameTimeAbs->setText(1, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeAbs.cur * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.frameTimeAbs.cur * 1e3);
|
||||
frameTimeAbs->setText(2, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeAbs.min * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.frameTimeAbs.min * 1e3);
|
||||
frameTimeAbs->setText(3, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeAbs.max * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.frameTimeAbs.max * 1e3);
|
||||
frameTimeAbs->setText(4, tr(stmp));
|
||||
|
||||
// Delta
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeDel.tgt * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.frameTimeDel.tgt * 1e3);
|
||||
frameTimeDel->setText(1, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeDel.cur * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.frameTimeDel.cur * 1e3);
|
||||
frameTimeDel->setText(2, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeDel.min * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.frameTimeDel.min * 1e3);
|
||||
frameTimeDel->setText(3, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeDel.max * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.frameTimeDel.max * 1e3);
|
||||
frameTimeDel->setText(4, tr(stmp));
|
||||
|
||||
// Work
|
||||
snprintf(stmp, sizeof(stmp), "lt %.3f", stats.frameTimeWork.tgt * 1e3);
|
||||
sprintf(stmp, "lt %.3f", stats.frameTimeWork.tgt * 1e3);
|
||||
frameTimeWork->setText(1, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeWork.cur * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.frameTimeWork.cur * 1e3);
|
||||
frameTimeWork->setText(2, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeWork.min * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.frameTimeWork.min * 1e3);
|
||||
frameTimeWork->setText(3, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeWork.max * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.frameTimeWork.max * 1e3);
|
||||
frameTimeWork->setText(4, tr(stmp));
|
||||
|
||||
// Idle
|
||||
snprintf(stmp, sizeof(stmp), "gt %.3f", stats.frameTimeIdle.tgt * 1e3);
|
||||
sprintf(stmp, "gt %.3f", stats.frameTimeIdle.tgt * 1e3);
|
||||
frameTimeIdle->setText(1, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeIdle.cur * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.frameTimeIdle.cur * 1e3);
|
||||
frameTimeIdle->setText(2, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeIdle.min * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.frameTimeIdle.min * 1e3);
|
||||
frameTimeIdle->setText(3, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.frameTimeIdle.max * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.frameTimeIdle.max * 1e3);
|
||||
frameTimeIdle->setText(4, tr(stmp));
|
||||
|
||||
// Work %
|
||||
snprintf(stmp, sizeof(stmp), "lt %.1f", 100.0 * stats.frameTimeWork.tgt / stats.frameTimeAbs.tgt);
|
||||
sprintf(stmp, "lt %.1f", 100.0 * stats.frameTimeWork.tgt / stats.frameTimeAbs.tgt);
|
||||
frameTimeWorkPct->setText(1, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.1f", 100.0 * stats.frameTimeWork.cur / stats.frameTimeAbs.tgt);
|
||||
sprintf(stmp, "%.1f", 100.0 * stats.frameTimeWork.cur / stats.frameTimeAbs.tgt);
|
||||
frameTimeWorkPct->setText(2, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.1f", 100.0 * stats.frameTimeWork.min / stats.frameTimeAbs.tgt);
|
||||
sprintf(stmp, "%.1f", 100.0 * stats.frameTimeWork.min / stats.frameTimeAbs.tgt);
|
||||
frameTimeWorkPct->setText(3, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.1f", 100.0 * stats.frameTimeWork.max / stats.frameTimeAbs.tgt);
|
||||
sprintf(stmp, "%.1f", 100.0 * stats.frameTimeWork.max / stats.frameTimeAbs.tgt);
|
||||
frameTimeWorkPct->setText(4, tr(stmp));
|
||||
|
||||
// Idle %
|
||||
snprintf(stmp, sizeof(stmp), "gt %.1f", 100.0 * stats.frameTimeIdle.tgt / stats.frameTimeAbs.tgt);
|
||||
sprintf(stmp, "gt %.1f", 100.0 * stats.frameTimeIdle.tgt / stats.frameTimeAbs.tgt);
|
||||
frameTimeIdlePct->setText(1, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.1f", 100.0 * stats.frameTimeIdle.cur / stats.frameTimeAbs.tgt);
|
||||
sprintf(stmp, "%.1f", 100.0 * stats.frameTimeIdle.cur / stats.frameTimeAbs.tgt);
|
||||
frameTimeIdlePct->setText(2, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.1f", 100.0 * stats.frameTimeIdle.min / stats.frameTimeAbs.tgt);
|
||||
sprintf(stmp, "%.1f", 100.0 * stats.frameTimeIdle.min / stats.frameTimeAbs.tgt);
|
||||
frameTimeIdlePct->setText(3, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.1f", 100.0 * stats.frameTimeIdle.max / stats.frameTimeAbs.tgt);
|
||||
sprintf(stmp, "%.1f", 100.0 * stats.frameTimeIdle.max / stats.frameTimeAbs.tgt);
|
||||
frameTimeIdlePct->setText(4, tr(stmp));
|
||||
|
||||
// Video
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.videoTimeDel.tgt * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.videoTimeDel.tgt * 1e3);
|
||||
videoTimeAbs->setText(1, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.videoTimeDel.cur * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.videoTimeDel.cur * 1e3);
|
||||
videoTimeAbs->setText(2, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.videoTimeDel.min * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.videoTimeDel.min * 1e3);
|
||||
videoTimeAbs->setText(3, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.videoTimeDel.max * 1e3);
|
||||
sprintf(stmp, "%.3f", stats.videoTimeDel.max * 1e3);
|
||||
videoTimeAbs->setText(4, tr(stmp));
|
||||
|
||||
// Emulator to GUI Thread Signal Delay
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.emuSignalDelay.tgt * 1e3);
|
||||
emuSignalDelay->setText(1, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.emuSignalDelay.cur * 1e3);
|
||||
emuSignalDelay->setText(2, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.emuSignalDelay.min * 1e3);
|
||||
emuSignalDelay->setText(3, tr(stmp));
|
||||
|
||||
snprintf(stmp, sizeof(stmp), "%.3f", stats.emuSignalDelay.max * 1e3);
|
||||
emuSignalDelay->setText(4, tr(stmp));
|
||||
|
||||
// Late Count
|
||||
snprintf(stmp, sizeof(stmp), "%u", stats.lateCount);
|
||||
sprintf(stmp, "%u", stats.lateCount);
|
||||
frameLateCount->setText(1, tr("0"));
|
||||
frameLateCount->setText(2, tr(stmp));
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue