From cebfc8f8236fff91187c60f4b59cfab4e016e2c8 Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Mon, 4 Dec 2017 15:49:40 +0100 Subject: [PATCH] Merged SDL1 and SDL2 projects --- .gitignore | 2 +- AndroidData/blankdisks.zip | Bin 0 -> 22029 bytes AndroidData/data16092017.zip | Bin 0 -> 384975 bytes Makefile | 156 +- README.md | 22 +- VSLinux/Amiberry.vcxproj | 174 +- VSLinux/Amiberry.vcxproj.filters | 3 - VSLinux/Amiberry.vcxproj.user | 18 +- VSLinux/guisan/guisan.vcxproj | 16 +- VisualGDB/Amiberry.sln | 112 - .../Amiberry/Amiberry-Debug.vgdbsettings | 4 +- .../Amiberry/Amiberry-Release.vgdbsettings | 1 - VisualGDB/Amiberry/Amiberry.vcxproj | 368 +- VisualGDB/genblitter/Readme.txt | 17 - .../genblitter/genblitter-Debug.vgdbsettings | 154 - .../genblitter-Release.vgdbsettings | 142 - VisualGDB/genblitter/genblitter.vcxproj | 71 - .../genblitter/genblitter.vcxproj.filters | 40 - VisualGDB/genblitter/genblitter.vcxproj.user | 4 - VisualGDB/genlinetoscr/Readme.txt | 7 - .../genlinetoscr-Debug.vgdbsettings | 154 - .../genlinetoscr-Release.vgdbsettings | 142 - VisualGDB/genlinetoscr/genlinetoscr.vcxproj | 70 - .../genlinetoscr/genlinetoscr.vcxproj.filters | 37 - .../genlinetoscr/genlinetoscr.vcxproj.user | 4 - nbproject/Readme.md | 32 + nbproject/configurations.xml | 4615 +++++ .../CodeAssistancePathMapper.properties | 1 + nbproject/private/Pi2_Debug.properties | 140 + nbproject/private/Pi3_Debug.properties | 1 + .../private/c_standard_headers_indexer.c | 75 + nbproject/private/configurations.xml | 547 + .../private/cpp_standard_headers_indexer.cpp | 135 + nbproject/private/launcher.properties | 42 + nbproject/private/private.xml | 27 + nbproject/private/timestamps-retropie-pi-22 | 1135 ++ nbproject/private/tools/localhost/GNU/g++ | 23 + nbproject/private/tools/localhost/GNU/gcc | 23 + .../private/tools/pi_cd32.home_22/GNU/g++ | 23 + .../private/tools/pi_cd32.home_22/GNU/gcc | 23 + .../private/tools/pi_retropie_22/GNU/g++ | 18 + .../private/tools/pi_retropie_22/GNU/gcc | 18 + nbproject/project.properties | 1 + nbproject/project.xml | 30 + src/akiko.cpp | 1821 +- src/audio.cpp | 1796 +- src/autoconf.cpp | 519 +- src/blitfunc.cpp | 1088 +- src/blittable.cpp | 4 +- src/blitter.cpp | 1842 +- src/blkdev.cpp | 2905 ++- src/cfgfile.cpp | 7644 +++---- src/cia.cpp | 2530 +-- src/custom.cpp | 10240 ++++------ src/devices.cpp | 40 +- src/disk.cpp | 6137 +++--- src/drawing.cpp | 3738 +--- src/events.cpp | 257 +- src/expansion.cpp | 4251 +--- src/filesys.cpp | 3914 ++-- src/fsdb_unix.cpp | 2 +- src/genblitter.cpp | 361 +- src/gfxboard.cpp | 31 +- src/gfxutil.cpp | 439 +- src/guisan/Makefile | 4 +- src/hardfile.cpp | 2872 ++- src/include/akiko.h | 17 +- src/include/audio.h | 71 +- src/include/autoconf.h | 196 +- src/include/blitter.h | 67 +- src/include/cia.h | 51 +- src/include/custom.h | 179 +- src/include/drawing.h | 302 +- src/include/events.h | 116 +- src/include/filesys.h | 157 +- src/include/gfxboard.h | 85 +- src/include/gui.h | 2 +- src/include/inputdevice.h | 288 +- src/include/keyboard.h | 10 + src/include/keybuf.h | 18 +- src/include/memory.h | 413 +- src/include/native2amiga.h | 32 +- src/include/newcpu.h | 191 +- src/include/options.h | 663 +- src/include/rommgr.h | 108 +- src/include/savestate.h | 92 +- src/include/sysdeps.h | 212 +- src/include/traps.h | 75 +- src/include/xwin.h | 4 +- src/inputdevice.cpp | 6924 +++---- src/jit/compemu.h | 148 +- src/jit/compemu_support.cpp | 934 +- src/linetoscr.cpp | 16519 +--------------- src/machdep/maccess.h | 160 +- src/main.cpp | 1275 +- src/memory.cpp | 3221 +-- src/newcpu.cpp | 1337 +- src/osdep/amiberry.cpp | 1156 +- src/osdep/amiberry_filesys.cpp | 239 +- src/osdep/amiberry_gfx.cpp | 656 +- src/osdep/amiberry_gfx.h | 5 +- src/osdep/amiberry_gui.cpp | 114 +- src/osdep/amiberry_input.cpp | 126 +- src/osdep/amiberry_mem.cpp | 583 +- src/osdep/amiberry_rp9.cpp | 995 +- src/osdep/charset.cpp | 2 +- src/osdep/gui/CreateFilesysHardfile.cpp | 12 +- src/osdep/gui/EditFilesysHardfile.cpp | 8 +- src/osdep/gui/EditFilesysVirtual.cpp | 7 + src/osdep/gui/InGameMessage.cpp | 11 + src/osdep/gui/Navigation.cpp | 33 +- src/osdep/gui/PanelCPU.cpp | 7 + src/osdep/gui/PanelChipset.cpp | 7 + src/osdep/gui/PanelConfig.cpp | 596 +- src/osdep/gui/PanelCustom.cpp | 11 + src/osdep/gui/PanelDisplay.cpp | 232 +- src/osdep/gui/PanelFloppy.cpp | 29 +- src/osdep/gui/PanelHD.cpp | 23 +- src/osdep/gui/PanelInput.cpp | 11 + src/osdep/gui/PanelMisc.cpp | 125 +- src/osdep/gui/PanelPaths.cpp | 19 +- src/osdep/gui/PanelQuickstart.cpp | 7 + src/osdep/gui/PanelRAM.cpp | 234 +- src/osdep/gui/PanelROM.cpp | 7 + src/osdep/gui/PanelSavestate.cpp | 21 +- src/osdep/gui/PanelSound.cpp | 22 +- src/osdep/gui/SelectFile.cpp | 15 +- src/osdep/gui/SelectFolder.cpp | 12 +- src/osdep/gui/SelectorEntry.cpp | 8 +- src/osdep/gui/SelectorEntry.hpp | 7 + src/osdep/gui/ShowHelp.cpp | 12 +- src/osdep/gui/ShowMessage.cpp | 10 +- src/osdep/gui/UaeCheckBox.cpp | 10 +- src/osdep/gui/UaeCheckBox.hpp | 9 +- src/osdep/gui/UaeDropDown.cpp | 17 + src/osdep/gui/UaeDropDown.hpp | 13 +- src/osdep/gui/UaeListBox.cpp | 16 + src/osdep/gui/UaeListBox.hpp | 10 +- src/osdep/gui/UaeRadioButton.cpp | 9 + src/osdep/gui/UaeRadioButton.hpp | 8 + src/osdep/gui/gui_handling.h | 2 + src/osdep/gui/main_window.cpp | 57 +- src/osdep/keyboard.cpp | 2 +- src/osdep/picasso96.cpp | 3605 ++-- src/osdep/picasso96.h | 106 +- src/osdep/sigsegv_handler.cpp | 715 +- src/osdep/sysconfig.h | 191 +- src/osdep/target.h | 163 +- src/osdep/writelog.cpp | 36 +- src/rommgr.cpp | 634 +- src/savestate.cpp | 1287 +- src/threaddep/thread.h | 18 + src/traps.cpp | 877 +- src/uaelib.cpp | 462 +- src/zfile_archive.cpp | 1672 +- 155 files changed, 42610 insertions(+), 67600 deletions(-) create mode 100644 AndroidData/blankdisks.zip create mode 100644 AndroidData/data16092017.zip delete mode 100644 VisualGDB/Amiberry.sln delete mode 100644 VisualGDB/genblitter/Readme.txt delete mode 100644 VisualGDB/genblitter/genblitter-Debug.vgdbsettings delete mode 100644 VisualGDB/genblitter/genblitter-Release.vgdbsettings delete mode 100644 VisualGDB/genblitter/genblitter.vcxproj delete mode 100644 VisualGDB/genblitter/genblitter.vcxproj.filters delete mode 100644 VisualGDB/genblitter/genblitter.vcxproj.user delete mode 100644 VisualGDB/genlinetoscr/Readme.txt delete mode 100644 VisualGDB/genlinetoscr/genlinetoscr-Debug.vgdbsettings delete mode 100644 VisualGDB/genlinetoscr/genlinetoscr-Release.vgdbsettings delete mode 100644 VisualGDB/genlinetoscr/genlinetoscr.vcxproj delete mode 100644 VisualGDB/genlinetoscr/genlinetoscr.vcxproj.filters delete mode 100644 VisualGDB/genlinetoscr/genlinetoscr.vcxproj.user create mode 100644 nbproject/Readme.md create mode 100644 nbproject/configurations.xml create mode 100644 nbproject/private/CodeAssistancePathMapper.properties create mode 100644 nbproject/private/Pi2_Debug.properties create mode 100644 nbproject/private/Pi3_Debug.properties create mode 100644 nbproject/private/c_standard_headers_indexer.c create mode 100644 nbproject/private/configurations.xml create mode 100644 nbproject/private/cpp_standard_headers_indexer.cpp create mode 100644 nbproject/private/launcher.properties create mode 100644 nbproject/private/private.xml create mode 100644 nbproject/private/timestamps-retropie-pi-22 create mode 100644 nbproject/private/tools/localhost/GNU/g++ create mode 100644 nbproject/private/tools/localhost/GNU/gcc create mode 100644 nbproject/private/tools/pi_cd32.home_22/GNU/g++ create mode 100644 nbproject/private/tools/pi_cd32.home_22/GNU/gcc create mode 100644 nbproject/private/tools/pi_retropie_22/GNU/g++ create mode 100644 nbproject/private/tools/pi_retropie_22/GNU/gcc create mode 100644 nbproject/project.properties create mode 100644 nbproject/project.xml diff --git a/.gitignore b/.gitignore index ee446735..18777cc6 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,4 @@ VisualGDB/VisualGDB/Release/gencomp *.tlog VSLinux/obj/ARM/Debug/amiberry-sdl2-dev VisualGDB/VisualGDB/Debug/Amiberry-sdl2-dev -VSLinux/obj/ +VSLinux/obj/ARM/Debug/ diff --git a/AndroidData/blankdisks.zip b/AndroidData/blankdisks.zip new file mode 100644 index 0000000000000000000000000000000000000000..36cded7cf50ec65b3bc4fc4be9e0db94ef9b200a GIT binary patch literal 22029 zcmeI4dpMM7AIHa;F=NLXB05>tp)liom?jo2>yWZaE1UCS8RupkDk4#73X8A~;nD%k zsEHV=rB)6x6RoyUv7(a_La2S;YsT1Tdgpol|6Dzvf99W=@62;w_w}9M{ky;S?dBvV zjzx$f5C~*>v<*T4Sp)*%7w#Jo77!X67HiH4&s)UvZJ zd-h#!I#_V9V;n2+3t%7uz5HGXEqSy)iL&|AwArGK-C?KPhGcu}nA?Ncq#OG`C z0{@Avmt1++N%FZNX(q{VpJrv}hbV&g3yr^7nK!lpB z_4XT$$>aCV-V49-nxp`HDGXFlW_{QkNgTCgZcC2qej4&Lr}LsS=VQL}8pmria>nSw zuE9g(<|hAN3HhX*H5H_^7Vh5%477MLCINWBAeBZ;Qee!j>H&t!g+Qwe&jY5U7$_@@ z0p1voW8PYel1O*z(ff`r(oMhWZe-9hOq72jo9~#v_aUkED`*W23>Q?$$2>||v^Sw> z!{ceQM~wk7`uzFE-U)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(#`OM zhxFWDdHMNM(+ID#LdWwxkk~8072;AyTQ$xll#D<0QBb!464%L0{uI2pD{4_encdIc zQQmU@YSTlpHYwu%Gq|qZGG7A^!2vlSCf~f zskd6sXZI3~3ude`>mM92@I`jNJVd~`^p}4# z2YU-19c?gxUieN?=YLG6`tK+=> zcjA3>JM$ld7YuwIynng*#V9{s%?<%cj-O5c<1>Frs4USBDAd};{AZw3EdLScw`{Iv zn_Yh$7((WT_Raf{{DWCV{GDn3(9zT$X6^7@h`|7Qg8SBuzr-4l=*K%gj{=JR_?0}! zzH=?C?S6$i!T;A#O)|OVq(YuysMmmjkwu*UsV67McccQ;++54l9>xuaTYN3k7_ULi zzeM`)o$dFm;`M<4w84SDZE%0V{(F1*9jn*-9s6sS0RvxmnZF?aZOea0_P_s*{LQ3; zfv+b0FU)^?-`|<9`@S>(*9n7xuTJ=n;9ni^Prvy)IH&(R_@`!mbD#fz6a3pK{LWPv z`oaCpHh_Vzw&9P#e(QpNkJI0w&ci>TzlJLq_&Qww$o#Jf@q_tAln+M0|C|?K;Oo5j p3-I65;& src/filesys_bootrom.cpp + touch src/filesys.cpp diff --git a/README.md b/README.md index fb3627a7..42f3f3a0 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ -Amiga emulator for the Raspberry Pi +# Amiga emulator for the Raspberry Pi ================================= -WARNING: Experimental, unstable, development branch. -Stuff here will most probably break at some places. Don't bother reporting bugs! +Warning: this branch is still Work In Progress - it requires a few extra steps to build and some things may not be finished yet! :) +If you're looking for the latest "stable" version, please use the master branch for now. +Once this branch is complete, it will be merged back to the master and replace it. # History (newest first) -- Updated drawing, custom, events and a few other parts from WinUAE 3.4.1 -- Added GPerfTools for profiling and optimized malloc functions (note: this adds 2 extra dependencies, check below) -- Added an option for choosing Scaling Method (for non-Picasso modes): Auto, Nearest Neighbor (pixelated) or Linear (smooth). Auto will automatically choose between the other two modes on the fly, depending on the Amiga resolution requested and if the native monitor resolution can display it as an exact multiple or not. This vastly improves the sharpness of the resulting image. -- Improved image centering (for non-Picasso modes) -- Ported to SDL2 +- Added Line Doubling mode for Interlace resolutions +- Added multi-threaded drawing routines to improve performance +- Improved emulation accuracy +- [SDL2] Added an option for choosing Scaling Method (for non-Picasso modes): Auto, Nearest Neighbor (pixelated) or Linear (smooth). Auto will automatically choose between the other two modes on the fly, depending on the Amiga resolution requested and if the native monitor resolution can display it as an exact multiple or not. This vastly improves the sharpness of the resulting image. +- [SDL2] Improved image centering (for non-Picasso modes) +- [SDL2] Ported to SDL2 - Added new Picasso resolutions - Added NetBeans project - Added Visual Studio solution using VC++ for Linux @@ -52,8 +54,8 @@ Install the following packages: Clone this repo: cd ~ - git clone https://github.com/midwan/amiberry -b sdl2 amiberry-sdl2 - cd amiberry-sdl2 + git clone https://github.com/midwan/amiberry -b dev amiberry-dev + cd amiberry-dev Then for Raspberry Pi 3: diff --git a/VSLinux/Amiberry.vcxproj b/VSLinux/Amiberry.vcxproj index d698318a..98ea7b34 100644 --- a/VSLinux/Amiberry.vcxproj +++ b/VSLinux/Amiberry.vcxproj @@ -51,20 +51,22 @@ - cd ~/projects/Amiberry-dev; make - cd ~/projects/Amiberry-dev; make clean; make - cd ~/projects/Amiberry-dev; make clean - C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;D:\midwa\Projects\GitHub\amiberry\src\guisan\include;D:\midwa\Projects\GitHub\amiberry\src\threaddep;D:\midwa\Projects\GitHub\amiberry\src\osdep;D:\midwa\Projects\GitHub\amiberry\src;D:\midwa\Projects\GitHub\amiberry\src\include;$(NMakeIncludeSearchPath) - DEBUG;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;CAPSLOCK_DEBIAN_WORKAROUND;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";USE_SDL;_REENTRANT;$(NMakePreprocessorDefinitions) - $(RemoteRootDir)/$(ProjectName)-dev + cd ~/projects/Amiberry-sdl2; make -j3 + cd ~/projects/Amiberry-sdl2; make clean; make -j3 + cd ~/projects/Amiberry-sdl2; make clean + C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\6\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\6;..\src;..\src\include;..\src\osdep;..\src\archivers;..\src\threaddep;..\src\guisan\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;$(NMakeIncludeSearchPath) + DEBUG;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;CPU_arm;CAPSLOCK_DEBIAN_WORKAROUND;USE_SDL;_REENTRANT;$(NMakePreprocessorDefinitions) + + + $(RemoteRootDir)/$(ProjectName)-sdl2 - cd ~/projects/Amiberry-dev; make - cd ~/projects/Amiberry-dev; make clean; make - cd ~/projects/Amiberry-dev; make clean - C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;D:\midwa\Projects\GitHub\amiberry\src\guisan\include;D:\midwa\Projects\GitHub\amiberry\src\threaddep;D:\midwa\Projects\GitHub\amiberry\src\osdep;D:\midwa\Projects\GitHub\amiberry\src;D:\midwa\Projects\GitHub\amiberry\src\include;$(NMakeIncludeSearchPath) - ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;CAPSLOCK_DEBIAN_WORKAROUND;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";USE_SDL;_REENTRANT;$(NMakePreprocessorDefinitions) - $(RemoteRootDir)/$(ProjectName)-dev + C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\6\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\6;..\src;..\src\include;..\src\osdep;..\src\archivers;..\src\threaddep;..\src\guisan\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;$(NMakeIncludeSearchPath) + cd ~/projects/Amiberry-sdl2; make -j3 + cd ~/projects/Amiberry-sdl2; make clean; make -j3 + cd ~/projects/Amiberry-sdl2; make clean + ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;CPU_arm;CAPSLOCK_DEBIAN_WORKAROUND;USE_SDL;_REENTRANT;$(NMakePreprocessorDefinitions) + $(RemoteRootDir)/$(ProjectName)-sdl2 @@ -106,22 +108,16 @@ true - - true - true true - - true - true - + true @@ -135,9 +131,6 @@ - - true - true @@ -161,19 +154,43 @@ false + + - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + @@ -197,6 +214,7 @@ + @@ -235,6 +253,8 @@ false + + false @@ -256,6 +276,8 @@ false + + false @@ -265,6 +287,8 @@ false + + false @@ -280,15 +304,19 @@ false + false false + false + + false @@ -298,15 +326,13 @@ false + false false - - false - false @@ -316,6 +342,8 @@ false + + false @@ -324,6 +352,7 @@ + @@ -375,6 +404,7 @@ + @@ -382,14 +412,14 @@ + - - - + + @@ -403,13 +433,18 @@ false + false + false - + + + + false @@ -430,20 +465,36 @@ + - - - - - + + + + + + + + + + + + + + + + + + + + @@ -458,9 +509,11 @@ + + @@ -469,53 +522,63 @@ + - + - + - + - - + + + + + - - + - + + + + + + + + @@ -526,7 +589,6 @@ - @@ -539,19 +601,33 @@ + + + + + + + + - cp ~/projects/Amiberry-dev/amiberry-sdl2-dev ~/projects/amiberry + cp ~/projects/Amiberry-sdl2/amiberry-sdl2 ~/projects/amiberry/amiberry-sdl2-dev + + + + + Copy binary to launch location - cp ~/projects/Amiberry-dev/amiberry-sdl2-dev ~/projects/amiberry + cp ~/projects/Amiberry-sdl2/amiberry-sdl2 ~/projects/amiberry/amiberry-sdl2-dev + Copy binary to launch location diff --git a/VSLinux/Amiberry.vcxproj.filters b/VSLinux/Amiberry.vcxproj.filters index d72d3cf3..e85b836f 100644 --- a/VSLinux/Amiberry.vcxproj.filters +++ b/VSLinux/Amiberry.vcxproj.filters @@ -264,9 +264,6 @@ src - - src - src diff --git a/VSLinux/Amiberry.vcxproj.user b/VSLinux/Amiberry.vcxproj.user index 14f5d4cc..9c9299c9 100644 --- a/VSLinux/Amiberry.vcxproj.user +++ b/VSLinux/Amiberry.vcxproj.user @@ -1,15 +1,15 @@  - - ~/projects/amiberry - LinuxDebugger - ~/projects/amiberry/amiberry-sdl2-dev - DISPLAY=:0.0 - - ~/projects/amiberry + projects/amiberry/amiberry-sdl2-dev + projects/amiberry LinuxDebugger - ~/projects/amiberry/amiberry-sdl2-dev - DISPLAY=:0.0 + export DEBUG=1 + + + projects/amiberry/amiberry-sdl2-dev + projects/amiberry + LinuxDebugger + export DEBUG=0 \ No newline at end of file diff --git a/VSLinux/guisan/guisan.vcxproj b/VSLinux/guisan/guisan.vcxproj index 4d9ec4ed..3a21fa6f 100644 --- a/VSLinux/guisan/guisan.vcxproj +++ b/VSLinux/guisan/guisan.vcxproj @@ -40,12 +40,12 @@ true Makefile - ~/projects/Amiberry-dev/src + ~/projects/Amiberry-sdl2/src false Makefile - ~/projects/Amiberry-dev/src + ~/projects/Amiberry-sdl2/src true @@ -69,14 +69,14 @@ - cd ~/projects/Amiberry-dev/src/guisan/; make all - cd ~/projects/Amiberry-dev/src/guisan/; make clean - cd ~/projects/Amiberry-dev/src/guisan/; make clean; make all + cd ~/projects/Amiberry-sdl2/src/guisan/; make all + cd ~/projects/Amiberry-sdl2/src/guisan/; make clean + cd ~/projects/Amiberry-sdl2/src/guisan/; make clean; make all - cd ~/projects/Amiberry-dev/src/guisan/; make all - cd ~/projects/Amiberry-dev/src/guisan/; make clean; make all - cd ~/projects/Amiberry-dev/src/guisan/; make clean + cd ~/projects/Amiberry-sdl2/src/guisan/; make all + cd ~/projects/Amiberry-sdl2/src/guisan/; make clean; make all + cd ~/projects/Amiberry-sdl2/src/guisan/; make clean diff --git a/VisualGDB/Amiberry.sln b/VisualGDB/Amiberry.sln deleted file mode 100644 index c293a35c..00000000 --- a/VisualGDB/Amiberry.sln +++ /dev/null @@ -1,112 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26228.9 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Amiberry", "Amiberry\Amiberry.vcxproj", "{D76BB09D-FF2A-4028-A065-421C430CD238}" - ProjectSection(ProjectDependencies) = postProject - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2} = {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "guisan", "guisan\guisan.vcxproj", "{A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genlinetoscr", "genlinetoscr\genlinetoscr.vcxproj", "{883F2A00-8030-429B-AC7F-E930DDF9568F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genblitter", "genblitter\genblitter.vcxproj", "{619EFB8C-E41A-4058-B085-1B8CD22692DD}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|VisualGDB = Debug|VisualGDB - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|VisualGDB = Release|VisualGDB - Release|x64 = Release|x64 - Release|x86 = Release|x86 - Release-rpi1|VisualGDB = Release-rpi1|VisualGDB - Release-rpi1|x64 = Release-rpi1|x64 - Release-rpi1|x86 = Release-rpi1|x86 - Release-rpi2|VisualGDB = Release-rpi2|VisualGDB - Release-rpi2|x64 = Release-rpi2|x64 - Release-rpi2|x86 = Release-rpi2|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D76BB09D-FF2A-4028-A065-421C430CD238}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB - {D76BB09D-FF2A-4028-A065-421C430CD238}.Debug|VisualGDB.Build.0 = Debug|VisualGDB - {D76BB09D-FF2A-4028-A065-421C430CD238}.Debug|x64.ActiveCfg = Debug|VisualGDB - {D76BB09D-FF2A-4028-A065-421C430CD238}.Debug|x86.ActiveCfg = Debug|VisualGDB - {D76BB09D-FF2A-4028-A065-421C430CD238}.Release|VisualGDB.ActiveCfg = Release|VisualGDB - {D76BB09D-FF2A-4028-A065-421C430CD238}.Release|VisualGDB.Build.0 = Release|VisualGDB - {D76BB09D-FF2A-4028-A065-421C430CD238}.Release|x64.ActiveCfg = Release|VisualGDB - {D76BB09D-FF2A-4028-A065-421C430CD238}.Release|x86.ActiveCfg = Release|VisualGDB - {D76BB09D-FF2A-4028-A065-421C430CD238}.Release-rpi1|VisualGDB.ActiveCfg = Release-rpi1|VisualGDB - {D76BB09D-FF2A-4028-A065-421C430CD238}.Release-rpi1|VisualGDB.Build.0 = Release-rpi1|VisualGDB - {D76BB09D-FF2A-4028-A065-421C430CD238}.Release-rpi1|x64.ActiveCfg = Release-rpi1|VisualGDB - {D76BB09D-FF2A-4028-A065-421C430CD238}.Release-rpi1|x86.ActiveCfg = Release-rpi1|VisualGDB - {D76BB09D-FF2A-4028-A065-421C430CD238}.Release-rpi2|VisualGDB.ActiveCfg = Release-rpi2|VisualGDB - {D76BB09D-FF2A-4028-A065-421C430CD238}.Release-rpi2|VisualGDB.Build.0 = Release-rpi2|VisualGDB - {D76BB09D-FF2A-4028-A065-421C430CD238}.Release-rpi2|x64.ActiveCfg = Release-rpi2|VisualGDB - {D76BB09D-FF2A-4028-A065-421C430CD238}.Release-rpi2|x86.ActiveCfg = Release-rpi2|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Debug|VisualGDB.Build.0 = Debug|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Debug|x64.ActiveCfg = Debug|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Debug|x86.ActiveCfg = Debug|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Release|VisualGDB.ActiveCfg = Release|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Release|VisualGDB.Build.0 = Release|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Release|x64.ActiveCfg = Release|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Release|x86.ActiveCfg = Release|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Release-rpi1|VisualGDB.ActiveCfg = Release|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Release-rpi1|VisualGDB.Build.0 = Release|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Release-rpi1|x64.ActiveCfg = Debug|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Release-rpi1|x64.Build.0 = Debug|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Release-rpi1|x86.ActiveCfg = Debug|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Release-rpi1|x86.Build.0 = Debug|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Release-rpi2|VisualGDB.ActiveCfg = Release|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Release-rpi2|VisualGDB.Build.0 = Release|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Release-rpi2|x64.ActiveCfg = Debug|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Release-rpi2|x64.Build.0 = Debug|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Release-rpi2|x86.ActiveCfg = Debug|VisualGDB - {A431BAB9-641E-48D7-8ACE-BC1D5100FBA2}.Release-rpi2|x86.Build.0 = Debug|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Debug|VisualGDB.Build.0 = Debug|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Debug|x64.ActiveCfg = Debug|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Debug|x86.ActiveCfg = Debug|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Release|VisualGDB.ActiveCfg = Release|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Release|VisualGDB.Build.0 = Release|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Release|x64.ActiveCfg = Release|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Release|x86.ActiveCfg = Release|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Release-rpi1|VisualGDB.ActiveCfg = Release|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Release-rpi1|VisualGDB.Build.0 = Release|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Release-rpi1|x64.ActiveCfg = Release|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Release-rpi1|x64.Build.0 = Release|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Release-rpi1|x86.ActiveCfg = Release|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Release-rpi1|x86.Build.0 = Release|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Release-rpi2|VisualGDB.ActiveCfg = Release|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Release-rpi2|VisualGDB.Build.0 = Release|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Release-rpi2|x64.ActiveCfg = Release|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Release-rpi2|x64.Build.0 = Release|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Release-rpi2|x86.ActiveCfg = Release|VisualGDB - {883F2A00-8030-429B-AC7F-E930DDF9568F}.Release-rpi2|x86.Build.0 = Release|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Debug|VisualGDB.Build.0 = Debug|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Debug|x64.ActiveCfg = Debug|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Debug|x86.ActiveCfg = Debug|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Release|VisualGDB.ActiveCfg = Release|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Release|VisualGDB.Build.0 = Release|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Release|x64.ActiveCfg = Release|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Release|x86.ActiveCfg = Release|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Release-rpi1|VisualGDB.ActiveCfg = Release|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Release-rpi1|VisualGDB.Build.0 = Release|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Release-rpi1|x64.ActiveCfg = Release|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Release-rpi1|x64.Build.0 = Release|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Release-rpi1|x86.ActiveCfg = Release|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Release-rpi1|x86.Build.0 = Release|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Release-rpi2|VisualGDB.ActiveCfg = Release|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Release-rpi2|VisualGDB.Build.0 = Release|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Release-rpi2|x64.ActiveCfg = Release|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Release-rpi2|x64.Build.0 = Release|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Release-rpi2|x86.ActiveCfg = Release|VisualGDB - {619EFB8C-E41A-4058-B085-1B8CD22692DD}.Release-rpi2|x86.Build.0 = Release|VisualGDB - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/VisualGDB/Amiberry/Amiberry-Debug.vgdbsettings b/VisualGDB/Amiberry/Amiberry-Debug.vgdbsettings index 04dd1c28..cf45e574 100644 --- a/VisualGDB/Amiberry/Amiberry-Debug.vgdbsettings +++ b/VisualGDB/Amiberry/Amiberry-Debug.vgdbsettings @@ -35,6 +35,7 @@ true true + false true @@ -57,7 +58,6 @@ Amiberry.vcxproj - 1 true @@ -90,7 +90,7 @@ main true false - true + false false 0 diff --git a/VisualGDB/Amiberry/Amiberry-Release.vgdbsettings b/VisualGDB/Amiberry/Amiberry-Release.vgdbsettings index 3e6457b1..37e95198 100644 --- a/VisualGDB/Amiberry/Amiberry-Release.vgdbsettings +++ b/VisualGDB/Amiberry/Amiberry-Release.vgdbsettings @@ -30,7 +30,6 @@ Amiberry.vcxproj - 1 true diff --git a/VisualGDB/Amiberry/Amiberry.vcxproj b/VisualGDB/Amiberry/Amiberry.vcxproj index 49635a19..61ec2d28 100644 --- a/VisualGDB/Amiberry/Amiberry.vcxproj +++ b/VisualGDB/Amiberry/Amiberry.vcxproj @@ -5,23 +5,20 @@ Debug VisualGDB - - Release-rpi1 - VisualGDB - - - Release-rpi2 - VisualGDB - Release VisualGDB - {D76BB09D-FF2A-4028-A065-421C430CD238} + 15.0 + {FDC6BF55-C4BC-44FB-85A9-3369784716E8} + + + + @@ -30,110 +27,72 @@ Debug - C:\SysGCC\raspberry - $(ProjectName)-sdl2-dev + com.visualgdb.raspberry_pi + 6.3.0/7.12/r1 + $(ProjectName)-sdl2 - C:\SysGCC\raspberry - $(ProjectName)-sdl2-dev - - - C:\SysGCC\raspberry - $(ProjectName)-sdl2-dev-rpi2 - - - C:\SysGCC\raspberry - $(ProjectName)-sdl2-dev-rpi1 + com.visualgdb.raspberry_pi + 6.3.0/7.12/r1 + $(ProjectName)-sdl2 GNUPP14 - C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;=/opt/vc/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;=/opt/vc/include/interface/vmcs_host/linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;=/opt/vc/include/interface/vcos/pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;=/usr/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;=/usr/include/SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories) - DEBUG=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;CPU_arm;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions) - -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard -pipe -Wno-write-strings %(AdditionalOptions) + =/usr/local/include/SDL2;=/opt/vc/include;=/opt/vc/include/interface/vmcs_host/linux;=/opt/vc/include/interface/vcos/pthreads;=/usr/include/libxml2;../../src;../../src/osdep;../../src/threaddep;../../src/include;../../src/guisan/include;../../src/archivers;%(ClCompile.AdditionalIncludeDirectories) + DEBUG=1;ARMV6T2;USE_ARMNEON;_REENTRANT;AMIBERRY;CPU_arm;ARMV6_ASSEMBLY;USE_SDL2;%(ClCompile.PreprocessorDefinitions) + -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard %(AdditionalOptions) - ../../src/guisan/lib;=/opt/vc/lib;=/usr/lib/arm-linux-gnueabihf;%(Link.LibrarySearchDirectories) - SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;profiler;tcmalloc;%(Link.AdditionalLibraryNames) + ;%(Link.AdditionalLinkerInputs) + =/opt/vc/lib;=/usr/local/lib;../../src/guisan/lib;%(Link.LibrarySearchDirectories) + bcm_host;vchiq_arm;vcos;lzma;freetype;ogg;m;SDL2;pthread;z;png;rt;xml2;FLAC;mpg123;dl;mpeg2convert;mpeg2;SDL2_image;SDL2_ttf;guisan;%(Link.AdditionalLibraryNames) - -Wl,-gc-sections;%(Link.AdditionalLinkerInputs) GNUPP14 - C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;=/opt/vc/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;=/opt/vc/include/interface/vmcs_host/linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;=/opt/vc/include/interface/vcos/pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;=/usr/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;=/usr/include/SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories) - NDEBUG=1;RELEASE=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;CPU_arm;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions) - -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard -pipe -Wno-write-strings %(AdditionalOptions) - true - true + =/usr/local/include/SDL2;=/opt/vc/include;=/opt/vc/include/interface/vmcs_host/linux;=/opt/vc/include/interface/vcos/pthreads;=/usr/include/libxml2;../../src;../../src/osdep;../../src/threaddep;../../src/include;../../src/guisan/include;../../src/archivers;%(ClCompile.AdditionalIncludeDirectories) + NDEBUG=1;RELEASE=1;ARMV6T2;USE_ARMNEON;_REENTRANT;AMIBERRY;CPU_arm;ARMV6_ASSEMBLY;USE_SDL2;%(ClCompile.PreprocessorDefinitions) + -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard %(AdditionalOptions) - -Wl,-gc-sections;%(Link.AdditionalLinkerInputs) - ../../src/guisan/lib;=/opt/vc/lib;=/usr/lib/arm-linux-gnueabihf;%(Link.LibrarySearchDirectories) - SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;profiler;tcmalloc;%(Link.AdditionalLibraryNames) + ;%(Link.AdditionalLinkerInputs) + =/opt/vc/lib;=/usr/local/lib;../../src/guisan/lib;%(Link.LibrarySearchDirectories) + bcm_host;vchiq_arm;vcos;lzma;freetype;ogg;m;SDL2;pthread;z;png;rt;xml2;FLAC;mpg123;dl;mpeg2convert;mpeg2;SDL2_image;SDL2_ttf;guisan;%(Link.AdditionalLibraryNames) - - - - - GNUPP14 - C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;=/opt/vc/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;=/opt/vc/include/interface/vmcs_host/linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;=/opt/vc/include/interface/vcos/pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;=/usr/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;=/usr/include/SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories) - NDEBUG=1;RELEASE=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;CPU_arm;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions) - -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -pipe -Wno-write-strings %(AdditionalOptions) - true - true - - - -Wl,-gc-sections;%(Link.AdditionalLinkerInputs) - ../../src/guisan/lib;=/opt/vc/lib;=/usr/lib/arm-linux-gnueabihf;%(Link.LibrarySearchDirectories) - SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;profiler;tcmalloc;%(Link.AdditionalLibraryNames) - - - - - - - - - GNUPP14 - C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;=/opt/vc/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;=/opt/vc/include/interface/vmcs_host/linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;=/opt/vc/include/interface/vcos/pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;=/usr/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;=/usr/include/SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories) - NDEBUG=1;RELEASE=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;CPU_arm;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions) - -march=armv6zk -mfpu=vfp -mfloat-abi=hard -pipe -Wno-write-strings %(AdditionalOptions) - true - true - - - -Wl,-gc-sections;%(Link.AdditionalLinkerInputs) - ../../src/guisan/lib;=/opt/vc/lib;=/usr/lib/arm-linux-gnueabihf;%(Link.LibrarySearchDirectories) - SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;profiler;tcmalloc;%(Link.AdditionalLibraryNames) - - - - - - - - - - + + - - - + + + - + + + + + + + + + + + + + @@ -157,6 +116,7 @@ + @@ -170,6 +130,8 @@ + + @@ -177,22 +139,33 @@ + + + + + + + + + + + @@ -205,6 +178,14 @@ + + + + + + + + @@ -218,12 +199,14 @@ + + @@ -231,30 +214,27 @@ + - - - + - - - - - - - + - + + + + + @@ -262,83 +242,37 @@ + + + - - true - - - true - - - true - - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - - - true - - - true - + + + + + - - - - - + + - + + + + + + + + + + @@ -353,140 +287,86 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - + - - + - + - + - - + + + + + - - + - + + + + + + + + - - - - + + @@ -496,14 +376,14 @@ - - + + + + + - - - \ No newline at end of file diff --git a/VisualGDB/genblitter/Readme.txt b/VisualGDB/genblitter/Readme.txt deleted file mode 100644 index 85dd819a..00000000 --- a/VisualGDB/genblitter/Readme.txt +++ /dev/null @@ -1,17 +0,0 @@ -This tool generates the following files: -- blit.h -- blitfunc.cpp -- blitfunc.h -- blittable.cpp - -To use it, compile it for the target platform, then execute it there as follows: - -genblitter.exe i > blit.h - -genblitter.exe f > blitfunc.cpp - -genblitter.exe h > blitfunc.h - -genblitter.exe t > blittable.cpp - -Copy the resulting files back in the "src" directory of Amiberry \ No newline at end of file diff --git a/VisualGDB/genblitter/genblitter-Debug.vgdbsettings b/VisualGDB/genblitter/genblitter-Debug.vgdbsettings deleted file mode 100644 index be31e6ea..00000000 --- a/VisualGDB/genblitter/genblitter-Debug.vgdbsettings +++ /dev/null @@ -1,154 +0,0 @@ - - - Debug - - - - MinGWUnixSlash - - - 192.168.1.152 - SSH - pi - - false - false - false - false - false - $(ProjectDir) - - - - Raspberry PI - com.visualgdb.raspberry_pi - C:\SysGCC\raspberry - false - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-gcc.exe - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-g++.exe - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-gdb.exe - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-ar.exe - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-objcopy.exe - C:\SysGCC\raspberry\bin\make.exe - - C:\SysGCC\raspberry\bin - - true - false - - - MinGWUnixSlash - - - genblitter.vcxproj - - - - LANG - en_US.UTF-8 - - - PATH - C:\SysGCC\raspberry\bin;%PATH% - - - - - 1 - - - - - - false - false - false - false - false - false - false - false - false - - false - false - false - false - false - false - true - false - None - false - false - main - true - false - false - false - - - - - - LANG - en_US.UTF-8 - - - PATH - C:\SysGCC\raspberry\bin;%PATH% - - - - - $(TargetPath) - 2000 - - - false - /home/pi/projects//$(TargetFileName) - Local - false - false - Auto - true - false - - - - - - - - - - - - - Default - - - - true - - - - - False - - - - - true - - Enabled - true - true - true - - - - - - VisualGDB\VisualGDBCache - \ No newline at end of file diff --git a/VisualGDB/genblitter/genblitter-Release.vgdbsettings b/VisualGDB/genblitter/genblitter-Release.vgdbsettings deleted file mode 100644 index d05d7a56..00000000 --- a/VisualGDB/genblitter/genblitter-Release.vgdbsettings +++ /dev/null @@ -1,142 +0,0 @@ - - - Release - - - - MinGWUnixSlash - - - 192.168.1.152 - SSH - pi - - false - false - false - false - false - $(ProjectDir) - - - - Raspberry PI - com.visualgdb.raspberry_pi - C:\SysGCC\raspberry - false - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-gcc.exe - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-g++.exe - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-gdb.exe - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-ar.exe - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-objcopy.exe - C:\SysGCC\raspberry\bin\make.exe - - C:\SysGCC\raspberry\bin - - true - false - - - MinGWUnixSlash - - - genblitter.vcxproj - - - - LANG - en_US.UTF-8 - - - PATH - C:\SysGCC\raspberry\bin;%PATH% - - - - 1 - - - - - - false - false - false - false - false - false - false - false - false - - false - false - false - false - false - false - true - false - None - false - false - main - true - false - false - false - - - - - - LANG - en_US.UTF-8 - - - PATH - C:\SysGCC\raspberry\bin;%PATH% - - - - - $(TargetPath) - 2000 - - - false - /home/pi/projects//$(TargetFileName) - Local - false - false - Auto - true - false - - - - - - - - - - - - - Default - - - - true - - - - - Unknown - - true - - - VisualGDB\VisualGDBCache - \ No newline at end of file diff --git a/VisualGDB/genblitter/genblitter.vcxproj b/VisualGDB/genblitter/genblitter.vcxproj deleted file mode 100644 index a7368611..00000000 --- a/VisualGDB/genblitter/genblitter.vcxproj +++ /dev/null @@ -1,71 +0,0 @@ - - - - - Debug - VisualGDB - - - Release - VisualGDB - - - - 15.0 - {619EFB8C-E41A-4058-B085-1B8CD22692DD} - - - - - - - - - - Debug - C:\SysGCC\raspberry - - - C:\SysGCC\raspberry - - - - GNUPP14 - C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;../../src/include;../../src;../../src/osdep;%(ClCompile.AdditionalIncludeDirectories) - DEBUG=1;%(ClCompile.PreprocessorDefinitions) - - - ;%(Link.AdditionalLinkerInputs) - ;%(Link.LibrarySearchDirectories) - ;%(Link.AdditionalLibraryNames) - - - - - - GNUPP14 - C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;../../src/include;../../src;../../src/osdep;%(ClCompile.AdditionalIncludeDirectories) - NDEBUG=1;RELEASE=1;%(ClCompile.PreprocessorDefinitions) - - - ;%(Link.AdditionalLinkerInputs) - ;%(Link.LibrarySearchDirectories) - ;%(Link.AdditionalLibraryNames) - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/VisualGDB/genblitter/genblitter.vcxproj.filters b/VisualGDB/genblitter/genblitter.vcxproj.filters deleted file mode 100644 index fcb90c62..00000000 --- a/VisualGDB/genblitter/genblitter.vcxproj.filters +++ /dev/null @@ -1,40 +0,0 @@ - - - - - {afe8a49f-0586-4eea-b2ea-cc1c4567db36} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {4718ef87-4582-42a4-8469-11a35b5a4418} - h;hpp;hxx;hm;inl;inc;xsd - - - {e9ba1ae1-6dab-41af-8b75-7c41100a7fc9} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - {c7346196-4f74-4afd-aa85-9da2661c7ab7} - *.vgdbsettings - - - - - VisualGDB settings - - - VisualGDB settings - - - - - Source files - - - Source files - - - - - - \ No newline at end of file diff --git a/VisualGDB/genblitter/genblitter.vcxproj.user b/VisualGDB/genblitter/genblitter.vcxproj.user deleted file mode 100644 index be250787..00000000 --- a/VisualGDB/genblitter/genblitter.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/VisualGDB/genlinetoscr/Readme.txt b/VisualGDB/genlinetoscr/Readme.txt deleted file mode 100644 index ff2f6f3c..00000000 --- a/VisualGDB/genlinetoscr/Readme.txt +++ /dev/null @@ -1,7 +0,0 @@ -This tool generates the "linetoscr.cpp" file. - -Compile it for the target system (e.g. Raspberry) then run it there as: - -genlinetoscr > linetoscr.cpp - -Copy the generated file back into the "src" directory. \ No newline at end of file diff --git a/VisualGDB/genlinetoscr/genlinetoscr-Debug.vgdbsettings b/VisualGDB/genlinetoscr/genlinetoscr-Debug.vgdbsettings deleted file mode 100644 index 9513a9ac..00000000 --- a/VisualGDB/genlinetoscr/genlinetoscr-Debug.vgdbsettings +++ /dev/null @@ -1,154 +0,0 @@ - - - Debug - - - - MinGWUnixSlash - - - 192.168.1.152 - SSH - pi - - false - false - false - false - false - $(ProjectDir) - - - - Raspberry PI - com.visualgdb.raspberry_pi - C:\SysGCC\raspberry - false - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-gcc.exe - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-g++.exe - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-gdb.exe - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-ar.exe - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-objcopy.exe - C:\SysGCC\raspberry\bin\make.exe - - C:\SysGCC\raspberry\bin - - true - false - - - MinGWUnixSlash - - - genlinetoscr.vcxproj - - - - LANG - en_US.UTF-8 - - - PATH - C:\SysGCC\raspberry\bin;%PATH% - - - - - 1 - - - - - - false - false - false - false - false - false - false - false - false - - false - false - false - false - false - false - true - false - None - false - false - main - true - false - false - false - - - - - - LANG - en_US.UTF-8 - - - PATH - C:\SysGCC\raspberry\bin;%PATH% - - - - - $(TargetPath) - 2000 - - - false - /home/pi/projects//$(TargetFileName) - Local - false - false - Auto - true - false - - - - - - - - - - - - - Default - - - - true - - - - - False - - - - - true - - Enabled - true - true - true - - - - - - VisualGDB\VisualGDBCache - \ No newline at end of file diff --git a/VisualGDB/genlinetoscr/genlinetoscr-Release.vgdbsettings b/VisualGDB/genlinetoscr/genlinetoscr-Release.vgdbsettings deleted file mode 100644 index 4427ede4..00000000 --- a/VisualGDB/genlinetoscr/genlinetoscr-Release.vgdbsettings +++ /dev/null @@ -1,142 +0,0 @@ - - - Release - - - - MinGWUnixSlash - - - 192.168.1.152 - SSH - pi - - false - false - false - false - false - $(ProjectDir) - - - - Raspberry PI - com.visualgdb.raspberry_pi - C:\SysGCC\raspberry - false - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-gcc.exe - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-g++.exe - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-gdb.exe - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-ar.exe - C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-objcopy.exe - C:\SysGCC\raspberry\bin\make.exe - - C:\SysGCC\raspberry\bin - - true - false - - - MinGWUnixSlash - - - genlinetoscr.vcxproj - - - - LANG - en_US.UTF-8 - - - PATH - C:\SysGCC\raspberry\bin;%PATH% - - - - 1 - - - - - - false - false - false - false - false - false - false - false - false - - false - false - false - false - false - false - true - false - None - false - false - main - true - false - false - false - - - - - - LANG - en_US.UTF-8 - - - PATH - C:\SysGCC\raspberry\bin;%PATH% - - - - - $(TargetPath) - 2000 - - - false - /home/pi/projects//$(TargetFileName) - Local - false - false - Auto - true - false - - - - - - - - - - - - - Default - - - - true - - - - - Unknown - - true - - - VisualGDB\VisualGDBCache - \ No newline at end of file diff --git a/VisualGDB/genlinetoscr/genlinetoscr.vcxproj b/VisualGDB/genlinetoscr/genlinetoscr.vcxproj deleted file mode 100644 index a7deedd9..00000000 --- a/VisualGDB/genlinetoscr/genlinetoscr.vcxproj +++ /dev/null @@ -1,70 +0,0 @@ - - - - - Debug - VisualGDB - - - Release - VisualGDB - - - - 15.0 - {883F2A00-8030-429B-AC7F-E930DDF9568F} - - - - - - - - - - Debug - C:\SysGCC\raspberry - - - C:\SysGCC\raspberry - - - - GNUPP14 - C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;../../src/include;../../src;../../src/osdep;%(ClCompile.AdditionalIncludeDirectories) - DEBUG=1;%(ClCompile.PreprocessorDefinitions) - - - ;%(Link.AdditionalLinkerInputs) - ;%(Link.LibrarySearchDirectories) - ;%(Link.AdditionalLibraryNames) - - - - - - GNUPP14 - C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;../../src/include;../../src;../../src/osdep;%(ClCompile.AdditionalIncludeDirectories) - NDEBUG=1;RELEASE=1;%(ClCompile.PreprocessorDefinitions) - - - ;%(Link.AdditionalLinkerInputs) - ;%(Link.LibrarySearchDirectories) - ;%(Link.AdditionalLibraryNames) - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/VisualGDB/genlinetoscr/genlinetoscr.vcxproj.filters b/VisualGDB/genlinetoscr/genlinetoscr.vcxproj.filters deleted file mode 100644 index dc1e79f8..00000000 --- a/VisualGDB/genlinetoscr/genlinetoscr.vcxproj.filters +++ /dev/null @@ -1,37 +0,0 @@ - - - - - {19e139ec-d402-45d4-89fc-39f22443a95b} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {0a02e0a2-214b-4e9e-a7c5-0668ebf38e34} - h;hpp;hxx;hm;inl;inc;xsd - - - {30f92ef0-a24c-49e2-9e92-906dcef4d050} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - {20bde34c-9e8e-42ee-83c1-c8c8143c7516} - *.vgdbsettings - - - - - VisualGDB settings - - - VisualGDB settings - - - - - Source files - - - - - - \ No newline at end of file diff --git a/VisualGDB/genlinetoscr/genlinetoscr.vcxproj.user b/VisualGDB/genlinetoscr/genlinetoscr.vcxproj.user deleted file mode 100644 index be250787..00000000 --- a/VisualGDB/genlinetoscr/genlinetoscr.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/nbproject/Readme.md b/nbproject/Readme.md new file mode 100644 index 00000000..711d4a78 --- /dev/null +++ b/nbproject/Readme.md @@ -0,0 +1,32 @@ +## NetBeans Project + +This folder contains the project files to enable remote compiling and debugging of Amiberry. Currently tested on Windows version of the NetBeans IDE. + + +### IDE Setup + +* Download Netbeans C++ IDE from: https://netbeans.org/ +* Download JDK from : http://www.oracle.com/technetwork/java/javase/downloads +* Update Netbeans Shortcut Target to the following provided default paths are used: `"C:\Program Files\NetBeans 8.2\bin\netbeans64.exe" --jdkhome "C:\Program Files\Java\jdk1.8.0_121"` +* Launch NetBeans from the modified shortcut +* Open Project > Navigate to this folder on your local system +* Assumed your RPi has the hostname of `retropie`, if not, add a new C/C++ Build Host under the Services tab, entering Hostname/IP and username/password, leaving the rest as default + + +### Pi Setup +* On the remote RaspberryPi +* Setup a script for executing gdb as root + * `sudo nano /home/pi/debug_script` + * Copy the following in to this new file: +```shell +#!/bin/bash +PROG=$(which gdb) +sudo $PROG "$@" 2>&1 /tmp/error.log +``` +* Set new script as excutable + * `sudo chmod +x /home/pi/debug_script` + + +### Remote Debugging +Make sure the Debug profile is selected in NetBeans to ensure `-g` switch is enabled when compiling. If breakpoints don't hit when you expect them to do a make clean from NetBeans. + diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml new file mode 100644 index 00000000..f0572108 --- /dev/null +++ b/nbproject/configurations.xml @@ -0,0 +1,4615 @@ + + + + + + + + + + 7zAlloc.cpp + 7zAlloc.h + 7zDecode.cpp + 7zDecode.h + 7zExtract.cpp + 7zExtract.h + 7zHeader.cpp + 7zHeader.h + 7zIn.cpp + 7zIn.h + 7zItem.cpp + 7zItem.h + + + 7zBuf.cpp + 7zBuf.h + 7zCrc.cpp + 7zCrc.h + 7zStream.cpp + 7zVersion.h + Bcj2.cpp + Bcj2.h + Bra.cpp + Bra.h + Bra86.cpp + CpuArch.h + LzmaDec.cpp + LzmaDec.h + Types.h + + + cdata.h + crc_csum.cpp + crc_csum.h + getbits.cpp + getbits.h + maketbl.cpp + maketbl.h + pfile.cpp + pfile.h + tables.cpp + tables.h + u_deep.cpp + u_deep.h + u_heavy.cpp + u_heavy.h + u_init.cpp + u_init.h + u_medium.cpp + u_medium.h + u_quick.cpp + u_quick.h + u_rle.cpp + u_rle.h + + + crcio.cpp + dhuf.cpp + header.cpp + huf.cpp + larc.cpp + lha.h + lha_macro.h + lhamaketbl.cpp + lharc.cpp + shuf.cpp + slide.cpp + uae_lha.cpp + util.cpp + + + unlzx.cpp + + + warp.cpp + warp.h + + + unzip.cpp + unzip.h + + + + akiko.h + audio.h + autoconf.h + blit.h + blitfunc.h + blitter.h + blkdev.h + bsdsocket.h + calc.h + cia.h + clipboard.h + commpipe.h + cpu_prefetch.h + cputbl.h + crc32.h + custom.h + debug.h + disk.h + diskutil.h + drawing.h + ersatz.h + events.h + execio.h + execlib.h + filesys.h + flags_arm.h + fpp-ieee-be.h + fpp-unknown.h + fsdb.h + fsusage.h + genblitter.h + gensound.h + gfxboard.h + gui.h + inputdevice.h + keyboard.h + keybuf.h + mackbd.h + memory.h + native2amiga.h + native2amiga_api.h + newcpu.h + options.h + osemu.h + picasso96.h + readcpu.h + rommgr.h + rtgmodes.h + savestate.h + scsi.h + scsidev.h + statusline.h + sysdeps.h + traps.h + uae.h + uaeresource.h + xwin.h + zarchive.h + zfile.h + + + codegen_arm.cpp + codegen_arm.h + compemu.cpp + compemu.h + compemu_fpp.cpp + compemu_midfunc_arm.cpp + compemu_midfunc_arm.h + compemu_midfunc_arm2.cpp + compemu_midfunc_arm2.h + compemu_support.cpp + compstbl.cpp + comptbl.h + gencomp_arm.cpp + + + m68k.h + maccess.h + md-fpp.h + rpt.h + support.cpp + + + gl.cpp + gl.h + gl_platform.cpp + gl_platform.h + gles_gfx.cpp + shader_stuff.cpp + shader_stuff.h + + + + CreateFilesysHardfile.cpp + EditFilesysHardfile.cpp + EditFilesysVirtual.cpp + InGameMessage.cpp + Navigation.cpp + PanelCPU.cpp + PanelChipset.cpp + PanelConfig.cpp + PanelDisplay.cpp + PanelFloppy.cpp + PanelHD.cpp + PanelInput.cpp + PanelMisc.cpp + PanelPaths.cpp + PanelRAM.cpp + PanelROM.cpp + PanelSavestate.cpp + PanelSound.cpp + SelectFile.cpp + SelectFolder.cpp + SelectorEntry.cpp + SelectorEntry.hpp + ShowMessage.cpp + UaeCheckBox.cpp + UaeCheckBox.hpp + UaeDropDown.cpp + UaeDropDown.hpp + UaeListBox.cpp + UaeListBox.hpp + UaeRadioButton.cpp + UaeRadioButton.hpp + gui_handling.h + main_window.cpp + sdltruetypefont.cpp + sdltruetypefont.hpp + + + menu_config.cpp + + arm_helper.s + bsdsocket_host.cpp + cda_play.cpp + cda_play.h + charset.cpp + config.h + fsdb_host.cpp + hardfile_pandora.cpp + keyboard.cpp + mp3decoder.cpp + mp3decoder.h + neon_helper.s + pandora.cpp + pandora_filesys.cpp + pandora_gfx.cpp + pandora_gui.cpp + pandora_input.cpp + pandora_mem.cpp + pandora_rp9.cpp + pandora_rp9.h + picasso96.cpp + rasp_gfx.cpp + sigsegv_handler.cpp + sysconfig.h + target.h + writelog.cpp + + + sound.cpp + sound.h + sound_sdl_new.cpp + + + thread.h + + akiko.cpp + aros.rom.cpp + audio.cpp + autoconf.cpp + blitfunc.cpp + blitops.cpp + blittable.cpp + blitter.cpp + blkdev.cpp + blkdev_cdimage.cpp + bsdsocket.cpp + build68k.cpp + calc.cpp + cdrom.cpp + cfgfile.cpp + cia.cpp + cpudefs.cpp + cpuemu_0.cpp + cpuemu_11.cpp + cpuemu_4.cpp + cpustbl.cpp + crc32.cpp + custom.cpp + disk.cpp + diskutil.cpp + drawing.cpp + events.cpp + expansion.cpp + filesys.asm + filesys.cpp + filesys_bootrom.cpp + fpp.cpp + fsdb.cpp + fsdb_unix.cpp + fsusage.cpp + genblitter.cpp + gencpu.cpp + gfxboard.cpp + gfxutil.cpp + hardfile.cpp + inputdevice.cpp + keybuf.cpp + linetoscr.c + main.cpp + memory.cpp + native2amiga.cpp + newcpu.cpp + newcpu_common.cpp + p96_blit.cpp + readcpu.cpp + rommgr.cpp + savestate.cpp + sinctable.cpp + statusline.cpp + trace.c + traps.cpp + uaelib.cpp + uaeresource.cpp + zfile.cpp + zfile_archive.cpp + + + + Makefile + nbproject/private/launcher.properties + + + ^(nbproject)$ + + . + + Makefile + + + + GNU|GNU + false + false + + + + + + + + + + . + ${MAKE} -f Makefile DEBUG=1 + ${MAKE} -f Makefile clean DEBUG=1 + amiberry + + + src + + + + + . + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + src/od-gles + + + + + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DEBUG + GCCCONSTFUNC=__attribute__((const)) + RASPBERRY + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + src + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + src + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + src + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + src + + + + + + + src + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + src/jit + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + src/jit + + + + + + + src/jit + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + src/jit + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + + + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + /usr/include/libxml2 + /opt/vc/include + /opt/vc/include/interface/vmcs_host/linux + /opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + src/archivers + . + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + DATA_PREFIX="./data/" + PANDORA + PICASSO96 + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + src/osdep + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + src + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + src + + + + + + + src/sounddep + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/SDL + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/usr/include/libxml2 + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vmcs_host/linux + ../../Users/oaing/AppData/Local/NetBeans/Cache/8.2/remote-files/retropie_22_pi/opt/vc/include/interface/vcos/pthreads + src + src/osdep + src/threaddep + src/include + . + + + ARMV6T2 + ARMV6_ASSEMBLY + CAPSLOCK_DEBIAN_WORKAROUND + CPU_arm + DATA_PREFIX="./data/" + DEBUG + GCCCONSTFUNC=__attribute__((const)) + PANDORA + PICASSO96 + RASPBERRY + ROM_PATH_PREFIX="./" + SAVE_PREFIX="./saves/" + USE_ARMNEON + USE_SDL + WITH_INGAME_WARNING + _GNU_SOURCE=1 + _REENTRANT + + + + + + + GNU|GNU + false + false + + + + + + . + ${MAKE} -f Makefile + ${MAKE} -f Makefile clean + amiberry + + + . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/private/CodeAssistancePathMapper.properties b/nbproject/private/CodeAssistancePathMapper.properties new file mode 100644 index 00000000..7f5ded8f --- /dev/null +++ b/nbproject/private/CodeAssistancePathMapper.properties @@ -0,0 +1 @@ +# Automatic path mapper. CRC = 1 diff --git a/nbproject/private/Pi2_Debug.properties b/nbproject/private/Pi2_Debug.properties new file mode 100644 index 00000000..403548f3 --- /dev/null +++ b/nbproject/private/Pi2_Debug.properties @@ -0,0 +1,140 @@ +C:/github/uae4arm-rpi/src/archivers/zip/unzip.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/zip/unzip.o src/archivers/zip/unzip.cpp +C:/github/uae4arm-rpi/src/archivers/7z/Archive/7z/7zHeader.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/7z/Archive/7z/7zHeader.o src/archivers/7z/Archive/7z/7zHeader.cpp +C:/github/uae4arm-rpi/src/archivers/7z/Archive/7z/7zAlloc.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/7z/Archive/7z/7zAlloc.o src/archivers/7z/Archive/7z/7zAlloc.cpp +C:/github/uae4arm-rpi/src/archivers/7z/Archive/7z/7zItem.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/7z/Archive/7z/7zItem.o src/archivers/7z/Archive/7z/7zItem.cpp +C:/github/uae4arm-rpi/src/archivers/7z/Archive/7z/7zIn.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/7z/Archive/7z/7zIn.o src/archivers/7z/Archive/7z/7zIn.cpp +C:/github/uae4arm-rpi/src/archivers/7z/Archive/7z/7zDecode.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/7z/Archive/7z/7zDecode.o src/archivers/7z/Archive/7z/7zDecode.cpp +C:/github/uae4arm-rpi/src/archivers/7z/Archive/7z/7zExtract.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/7z/Archive/7z/7zExtract.o src/archivers/7z/Archive/7z/7zExtract.cpp +C:/github/uae4arm-rpi/src/archivers/7z/Bra.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/7z/Bra.o src/archivers/7z/Bra.cpp +C:/github/uae4arm-rpi/src/archivers/7z/LzmaDec.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/7z/LzmaDec.o src/archivers/7z/LzmaDec.cpp +C:/github/uae4arm-rpi/src/archivers/7z/7zBuf.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/7z/7zBuf.o src/archivers/7z/7zBuf.cpp +C:/github/uae4arm-rpi/src/archivers/7z/7zStream.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/7z/7zStream.o src/archivers/7z/7zStream.cpp +C:/github/uae4arm-rpi/src/archivers/7z/7zCrc.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/7z/7zCrc.o src/archivers/7z/7zCrc.cpp +C:/github/uae4arm-rpi/src/archivers/7z/Bcj2.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/7z/Bcj2.o src/archivers/7z/Bcj2.cpp +C:/github/uae4arm-rpi/src/archivers/7z/Bra86.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/7z/Bra86.o src/archivers/7z/Bra86.cpp +C:/github/uae4arm-rpi/src/archivers/wrp/warp.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/wrp/warp.o src/archivers/wrp/warp.cpp +C:/github/uae4arm-rpi/src/archivers/lha/header.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/lha/header.o src/archivers/lha/header.cpp +C:/github/uae4arm-rpi/src/archivers/lha/lhamaketbl.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/lha/lhamaketbl.o src/archivers/lha/lhamaketbl.cpp +C:/github/uae4arm-rpi/src/archivers/lha/util.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/lha/util.o src/archivers/lha/util.cpp +C:/github/uae4arm-rpi/src/archivers/lha/dhuf.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/lha/dhuf.o src/archivers/lha/dhuf.cpp +C:/github/uae4arm-rpi/src/archivers/lha/huf.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/lha/huf.o src/archivers/lha/huf.cpp +C:/github/uae4arm-rpi/src/archivers/lha/crcio.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/lha/crcio.o src/archivers/lha/crcio.cpp +C:/github/uae4arm-rpi/src/archivers/lha/slide.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/lha/slide.o src/archivers/lha/slide.cpp +C:/github/uae4arm-rpi/src/archivers/lha/lharc.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/lha/lharc.o src/archivers/lha/lharc.cpp +C:/github/uae4arm-rpi/src/archivers/lha/shuf.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/lha/shuf.o src/archivers/lha/shuf.cpp +C:/github/uae4arm-rpi/src/archivers/lha/larc.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/lha/larc.o src/archivers/lha/larc.cpp +C:/github/uae4arm-rpi/src/archivers/lha/uae_lha.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/lha/uae_lha.o src/archivers/lha/uae_lha.cpp +C:/github/uae4arm-rpi/src/archivers/dms/u_heavy.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/dms/u_heavy.o src/archivers/dms/u_heavy.cpp +C:/github/uae4arm-rpi/src/archivers/dms/getbits.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/dms/getbits.o src/archivers/dms/getbits.cpp +C:/github/uae4arm-rpi/src/archivers/dms/u_init.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/dms/u_init.o src/archivers/dms/u_init.cpp +C:/github/uae4arm-rpi/src/archivers/dms/u_rle.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/dms/u_rle.o src/archivers/dms/u_rle.cpp +C:/github/uae4arm-rpi/src/archivers/dms/pfile.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/dms/pfile.o src/archivers/dms/pfile.cpp +C:/github/uae4arm-rpi/src/archivers/dms/u_medium.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/dms/u_medium.o src/archivers/dms/u_medium.cpp +C:/github/uae4arm-rpi/src/archivers/dms/crc_csum.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/dms/crc_csum.o src/archivers/dms/crc_csum.cpp +C:/github/uae4arm-rpi/src/archivers/dms/maketbl.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/dms/maketbl.o src/archivers/dms/maketbl.cpp +C:/github/uae4arm-rpi/src/archivers/dms/u_quick.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/dms/u_quick.o src/archivers/dms/u_quick.cpp +C:/github/uae4arm-rpi/src/archivers/dms/tables.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/dms/tables.o src/archivers/dms/tables.cpp +C:/github/uae4arm-rpi/src/archivers/dms/u_deep.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/dms/u_deep.o src/archivers/dms/u_deep.cpp +C:/github/uae4arm-rpi/src/archivers/lzx/unlzx.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/archivers/lzx/unlzx.o src/archivers/lzx/unlzx.cpp +C:/github/uae4arm-rpi/src/jit/compemu_fpp.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/jit/compemu_fpp.o src/jit/compemu_fpp.cpp +C:/github/uae4arm-rpi/src/jit/compemu_support.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/jit/compemu_support.o src/jit/compemu_support.cpp +C:/github/uae4arm-rpi/src/jit/compstbl.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/jit/compstbl.o src/jit/compstbl.cpp +C:/github/uae4arm-rpi/src/jit/compemu.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/jit/compemu.o src/jit/compemu.cpp +C:/github/uae4arm-rpi/src/machdep/support.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/machdep/support.o src/machdep/support.cpp +C:/github/uae4arm-rpi/src/osdep/gui/UaeListBox.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/UaeListBox.o src/osdep/gui/UaeListBox.cpp +C:/github/uae4arm-rpi/src/osdep/gui/PanelDisplay.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/PanelDisplay.o src/osdep/gui/PanelDisplay.cpp +C:/github/uae4arm-rpi/src/osdep/gui/PanelSound.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/PanelSound.o src/osdep/gui/PanelSound.cpp +C:/github/uae4arm-rpi/src/osdep/gui/EditFilesysVirtual.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/EditFilesysVirtual.o src/osdep/gui/EditFilesysVirtual.cpp +C:/github/uae4arm-rpi/src/osdep/gui/PanelFloppy.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/PanelFloppy.o src/osdep/gui/PanelFloppy.cpp +C:/github/uae4arm-rpi/src/osdep/gui/SelectFolder.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/SelectFolder.o src/osdep/gui/SelectFolder.cpp +C:/github/uae4arm-rpi/src/osdep/gui/PanelSavestate.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/PanelSavestate.o src/osdep/gui/PanelSavestate.cpp +C:/github/uae4arm-rpi/src/osdep/gui/PanelPaths.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/PanelPaths.o src/osdep/gui/PanelPaths.cpp +C:/github/uae4arm-rpi/src/osdep/gui/InGameMessage.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/InGameMessage.o src/osdep/gui/InGameMessage.cpp +C:/github/uae4arm-rpi/src/osdep/gui/UaeRadioButton.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/UaeRadioButton.o src/osdep/gui/UaeRadioButton.cpp +C:/github/uae4arm-rpi/src/osdep/gui/EditFilesysHardfile.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/EditFilesysHardfile.o src/osdep/gui/EditFilesysHardfile.cpp +C:/github/uae4arm-rpi/src/osdep/gui/main_window.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/main_window.o src/osdep/gui/main_window.cpp +C:/github/uae4arm-rpi/src/osdep/gui/PanelHD.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/PanelHD.o src/osdep/gui/PanelHD.cpp +C:/github/uae4arm-rpi/src/osdep/gui/PanelCPU.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/PanelCPU.o src/osdep/gui/PanelCPU.cpp +C:/github/uae4arm-rpi/src/osdep/gui/PanelRAM.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/PanelRAM.o src/osdep/gui/PanelRAM.cpp +C:/github/uae4arm-rpi/src/osdep/gui/SelectorEntry.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/SelectorEntry.o src/osdep/gui/SelectorEntry.cpp +C:/github/uae4arm-rpi/src/osdep/gui/ShowMessage.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/ShowMessage.o src/osdep/gui/ShowMessage.cpp +C:/github/uae4arm-rpi/src/osdep/gui/Navigation.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/Navigation.o src/osdep/gui/Navigation.cpp +C:/github/uae4arm-rpi/src/osdep/gui/UaeDropDown.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/UaeDropDown.o src/osdep/gui/UaeDropDown.cpp +C:/github/uae4arm-rpi/src/osdep/gui/PanelInput.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/PanelInput.o src/osdep/gui/PanelInput.cpp +C:/github/uae4arm-rpi/src/osdep/gui/CreateFilesysHardfile.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/CreateFilesysHardfile.o src/osdep/gui/CreateFilesysHardfile.cpp +C:/github/uae4arm-rpi/src/osdep/gui/SelectFile.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/SelectFile.o src/osdep/gui/SelectFile.cpp +C:/github/uae4arm-rpi/src/osdep/gui/PanelMisc.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/PanelMisc.o src/osdep/gui/PanelMisc.cpp +C:/github/uae4arm-rpi/src/osdep/gui/UaeCheckBox.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/UaeCheckBox.o src/osdep/gui/UaeCheckBox.cpp +C:/github/uae4arm-rpi/src/osdep/gui/PanelConfig.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/PanelConfig.o src/osdep/gui/PanelConfig.cpp +C:/github/uae4arm-rpi/src/osdep/gui/sdltruetypefont.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/sdltruetypefont.o src/osdep/gui/sdltruetypefont.cpp +C:/github/uae4arm-rpi/src/osdep/gui/PanelChipset.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/PanelChipset.o src/osdep/gui/PanelChipset.cpp +C:/github/uae4arm-rpi/src/osdep/gui/PanelROM.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/gui/PanelROM.o src/osdep/gui/PanelROM.cpp +C:/github/uae4arm-rpi/src/osdep/menu/menu_config.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/menu/menu_config.o src/osdep/menu/menu_config.cpp +C:/github/uae4arm-rpi/src/osdep/mp3decoder.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/mp3decoder.o src/osdep/mp3decoder.cpp +C:/github/uae4arm-rpi/src/osdep/hardfile_pandora.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/hardfile_pandora.o src/osdep/hardfile_pandora.cpp +C:/github/uae4arm-rpi/src/osdep/sigsegv_handler.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/sigsegv_handler.o src/osdep/sigsegv_handler.cpp +C:/github/uae4arm-rpi/src/osdep/fsdb_host.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/fsdb_host.o src/osdep/fsdb_host.cpp +C:/github/uae4arm-rpi/src/osdep/pandora.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/pandora.o src/osdep/pandora.cpp +C:/github/uae4arm-rpi/src/osdep/pandora_input.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/pandora_input.o src/osdep/pandora_input.cpp +C:/github/uae4arm-rpi/src/osdep/pandora_filesys.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/pandora_filesys.o src/osdep/pandora_filesys.cpp +C:/github/uae4arm-rpi/src/osdep/rasp_gfx.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/rasp_gfx.o src/osdep/rasp_gfx.cpp +C:/github/uae4arm-rpi/src/osdep/writelog.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/writelog.o src/osdep/writelog.cpp +C:/github/uae4arm-rpi/src/osdep/bsdsocket_host.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/bsdsocket_host.o src/osdep/bsdsocket_host.cpp +C:/github/uae4arm-rpi/src/osdep/keyboard.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/keyboard.o src/osdep/keyboard.cpp +C:/github/uae4arm-rpi/src/osdep/pandora_mem.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/pandora_mem.o src/osdep/pandora_mem.cpp +C:/github/uae4arm-rpi/src/osdep/pandora_gui.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/pandora_gui.o src/osdep/pandora_gui.cpp +C:/github/uae4arm-rpi/src/osdep/cda_play.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/cda_play.o src/osdep/cda_play.cpp +C:/github/uae4arm-rpi/src/osdep/charset.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/charset.o src/osdep/charset.cpp +C:/github/uae4arm-rpi/src/osdep/pandora_rp9.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/pandora_rp9.o src/osdep/pandora_rp9.cpp +C:/github/uae4arm-rpi/src/osdep/picasso96.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/osdep/picasso96.o src/osdep/picasso96.cpp +C:/github/uae4arm-rpi/src/sounddep/sound_sdl_new.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/sounddep/sound_sdl_new.o src/sounddep/sound_sdl_new.cpp +C:/github/uae4arm-rpi/src/cdrom.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/cdrom.o src/cdrom.cpp +C:/github/uae4arm-rpi/src/savestate.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/savestate.o src/savestate.cpp +C:/github/uae4arm-rpi/src/readcpu.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/readcpu.o src/readcpu.cpp +C:/github/uae4arm-rpi/src/fpp.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/fpp.o src/fpp.cpp +C:/github/uae4arm-rpi/src/traps.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/traps.o src/traps.cpp +C:/github/uae4arm-rpi/src/cpustbl.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/cpustbl.o src/cpustbl.cpp +C:/github/uae4arm-rpi/src/blkdev.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/blkdev.o src/blkdev.cpp +C:/github/uae4arm-rpi/src/filesys.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/filesys.o src/filesys.cpp +C:/github/uae4arm-rpi/src/aros.rom.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/aros.rom.o src/aros.rom.cpp +C:/github/uae4arm-rpi/src/blittable.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/blittable.o src/blittable.cpp +C:/github/uae4arm-rpi/src/newcpu.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/newcpu.o src/newcpu.cpp +C:/github/uae4arm-rpi/src/autoconf.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/autoconf.o src/autoconf.cpp +C:/github/uae4arm-rpi/src/diskutil.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/diskutil.o src/diskutil.cpp +C:/github/uae4arm-rpi/src/calc.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/calc.o src/calc.cpp +C:/github/uae4arm-rpi/src/uaeresource.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/uaeresource.o src/uaeresource.cpp +C:/github/uae4arm-rpi/src/fsdb_unix.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/fsdb_unix.o src/fsdb_unix.cpp +C:/github/uae4arm-rpi/src/audio.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/audio.o src/audio.cpp +C:/github/uae4arm-rpi/src/native2amiga.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/native2amiga.o src/native2amiga.cpp +C:/github/uae4arm-rpi/src/fsusage.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/fsusage.o src/fsusage.cpp +C:/github/uae4arm-rpi/src/main.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/main.o src/main.cpp +C:/github/uae4arm-rpi/src/cfgfile.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/cfgfile.o src/cfgfile.cpp +C:/github/uae4arm-rpi/src/keybuf.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/keybuf.o src/keybuf.cpp +C:/github/uae4arm-rpi/src/expansion.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/expansion.o src/expansion.cpp +C:/github/uae4arm-rpi/src/fsdb.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/fsdb.o src/fsdb.cpp +C:/github/uae4arm-rpi/src/disk.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/disk.o src/disk.cpp +C:/github/uae4arm-rpi/src/statusline.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/statusline.o src/statusline.cpp +C:/github/uae4arm-rpi/src/events.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/events.o src/events.cpp +C:/github/uae4arm-rpi/src/gfxutil.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/gfxutil.o src/gfxutil.cpp +C:/github/uae4arm-rpi/src/cpuemu_4.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/cpuemu_4.o src/cpuemu_4.cpp +C:/github/uae4arm-rpi/src/blitter.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/blitter.o src/blitter.cpp +C:/github/uae4arm-rpi/src/akiko.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/akiko.o src/akiko.cpp +C:/github/uae4arm-rpi/src/hardfile.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/hardfile.o src/hardfile.cpp +C:/github/uae4arm-rpi/src/zfile.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/zfile.o src/zfile.cpp +C:/github/uae4arm-rpi/src/bsdsocket.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/bsdsocket.o src/bsdsocket.cpp +C:/github/uae4arm-rpi/src/cpuemu_0.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/cpuemu_0.o src/cpuemu_0.cpp +C:/github/uae4arm-rpi/src/newcpu_common.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/newcpu_common.o src/newcpu_common.cpp +C:/github/uae4arm-rpi/src/zfile_archive.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/zfile_archive.o src/zfile_archive.cpp +C:/github/uae4arm-rpi/src/cia.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/cia.o src/cia.cpp +C:/github/uae4arm-rpi/src/memory.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/memory.o src/memory.cpp +C:/github/uae4arm-rpi/src/gfxboard.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/gfxboard.o src/gfxboard.cpp +C:/github/uae4arm-rpi/src/cpuemu_11.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/cpuemu_11.o src/cpuemu_11.cpp +C:/github/uae4arm-rpi/src/blitfunc.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/blitfunc.o src/blitfunc.cpp +C:/github/uae4arm-rpi/src/custom.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/custom.o src/custom.cpp +C:/github/uae4arm-rpi/src/drawing.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/drawing.o src/drawing.cpp +C:/github/uae4arm-rpi/src/blkdev_cdimage.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/blkdev_cdimage.o src/blkdev_cdimage.cpp +C:/github/uae4arm-rpi/src/rommgr.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/rommgr.o src/rommgr.cpp +C:/github/uae4arm-rpi/src/uaelib.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/uaelib.o src/uaelib.cpp +C:/github/uae4arm-rpi/src/cpudefs.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/cpudefs.o src/cpudefs.cpp +C:/github/uae4arm-rpi/src/inputdevice.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/inputdevice.o src/inputdevice.cpp +C:/github/uae4arm-rpi/src/crc32.cpp=C:/github/uae4arm-rpi#-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DPANDORA -DPICASSO96 -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -fexceptions -fpermissive -g -DDEBUG -Wl,--export-dynamic -c -o src/crc32.o src/crc32.cpp diff --git a/nbproject/private/Pi3_Debug.properties b/nbproject/private/Pi3_Debug.properties new file mode 100644 index 00000000..ac30b1a0 --- /dev/null +++ b/nbproject/private/Pi3_Debug.properties @@ -0,0 +1 @@ +/Users/horaceandthespider/Documents/Geek/Amiberry/amiberry-hats/src/osdep/gui/PanelInput.cpp=/Users/horaceandthespider/Documents/Geek/Amiberry/amiberry-hats#-march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard -I/usr/include/libxml2 -DCPU_arm -DARMV6_ASSEMBLY -DWITH_INGAME_WARNING -DUSE_SDL -DARMV6T2 -DUSE_ARMNEON -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Isrc/archivers -Wno-unused -Wno-format "-DGCCCONSTFUNC=__attribute__((const))" -mstructure-size-boundary=32 -falign-functions=32 -std=gnu++14 -g -rdynamic -funwind-tables -mapcs-frame -DDEBUG -Wl,--export-dynamic -c src/osdep/gui/PanelInput.cpp -o src/osdep/gui/PanelInput.o diff --git a/nbproject/private/c_standard_headers_indexer.c b/nbproject/private/c_standard_headers_indexer.c new file mode 100644 index 00000000..c2548d20 --- /dev/null +++ b/nbproject/private/c_standard_headers_indexer.c @@ -0,0 +1,75 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + */ + +// List of standard headers was taken in http://en.cppreference.com/w/c/header + +#include // Conditionally compiled macro that compares its argument to zero +#include // Functions to determine the type contained in character data +#include // Macros reporting error conditions +#include // Limits of float types +#include // Sizes of basic types +#include // Localization utilities +#include // Common mathematics functions +#include // Nonlocal jumps +#include // Signal handling +#include // Variable arguments +#include // Common macro definitions +#include // Input/output +#include // String handling +#include // General utilities: memory management, program utilities, string conversions, random numbers +#include // Time/date utilities +#include // (since C95) Alternative operator spellings +#include // (since C95) Extended multibyte and wide character utilities +#include // (since C95) Wide character classification and mapping utilities +#ifdef _STDC_C99 +#include // (since C99) Complex number arithmetic +#include // (since C99) Floating-point environment +#include // (since C99) Format conversion of integer types +#include // (since C99) Boolean type +#include // (since C99) Fixed-width integer types +#include // (since C99) Type-generic math (macros wrapping math.h and complex.h) +#endif +#ifdef _STDC_C11 +#include // (since C11) alignas and alignof convenience macros +#include // (since C11) Atomic types +#include // (since C11) noreturn convenience macros +#include // (since C11) Thread library +#include // (since C11) UTF-16 and UTF-32 character utilities +#endif diff --git a/nbproject/private/configurations.xml b/nbproject/private/configurations.xml new file mode 100644 index 00000000..a7361d34 --- /dev/null +++ b/nbproject/private/configurations.xml @@ -0,0 +1,547 @@ + + + + + + + + + + + + + + + + + + + + + + 7zAlloc.cpp + 7zAlloc.h + 7zDecode.cpp + 7zDecode.h + 7zExtract.cpp + 7zExtract.h + 7zHeader.cpp + 7zHeader.h + 7zIn.cpp + 7zIn.h + 7zItem.cpp + 7zItem.h + + + 7z.h + 7zAlloc.cpp + 7zAlloc.h + 7zBuf.cpp + 7zBuf.h + 7zBuf2.c + 7zCrc.cpp + 7zCrc.h + 7zCrcOpt.cpp + 7zDec.cpp + 7zFile.c + 7zFile.h + 7zIn.cpp + 7zStream.cpp + 7zVersion.h + Alloc.c + Alloc.h + Bcj2.cpp + Bcj2.h + Bra.cpp + Bra.h + Bra86.cpp + BraIA64.c + CpuArch.c + CpuArch.h + Delta.c + Delta.h + LzFind.cpp + LzFind.h + LzFindMt.c + LzFindMt.h + LzHash.h + Lzma2Dec.cpp + Lzma2Dec.h + Lzma2Enc.c + Lzma2Enc.h + Lzma86.h + Lzma86Dec.c + Lzma86Enc.c + LzmaDec.cpp + LzmaDec.h + LzmaEnc.cpp + LzmaEnc.h + LzmaLib.c + LzmaLib.h + MtCoder.c + MtCoder.h + Ppmd.h + Ppmd7.c + Ppmd7.h + Ppmd7Dec.c + Ppmd7Enc.c + RotateDefs.h + Sha256.c + Sha256.h + Threads.c + Threads.h + Types.h + Xz.cpp + Xz.h + XzCrc64.c + XzCrc64.h + XzDec.c + XzEnc.c + XzEnc.h + XzIn.c + + + cdata.h + crc_csum.cpp + crc_csum.h + getbits.cpp + getbits.h + maketbl.cpp + maketbl.h + pfile.cpp + pfile.h + tables.cpp + tables.h + u_deep.cpp + u_deep.h + u_heavy.cpp + u_heavy.h + u_init.cpp + u_init.h + u_medium.cpp + u_medium.h + u_quick.cpp + u_quick.h + u_rle.cpp + u_rle.h + + + crcio.cpp + dhuf.cpp + header.cpp + huf.cpp + larc.cpp + lha.h + lha_macro.h + lhamaketbl.cpp + lharc.cpp + shuf.cpp + slide.cpp + uae_lha.cpp + util.cpp + + + unlzx.cpp + + + kjmp2.cpp + kjmp2.h + + + warp.cpp + warp.h + + + unzip.cpp + unzip.h + + + + + attributes.h + cdrom.h + io.h + likely.h + mman.h + string.h + types.h + vm.h + + akiko.h + ar.h + audio.h + autoconf.h + blit.h + blitfunc.h + blitter.h + blkdev.h + bsdsocket.h + calc.h + cd32_fmv.h + cia.h + clipboard.h + commpipe.h + cpu_prefetch.h + cpummu.h + cputbl.h + crc32.h + custom.h + debug.h + devices.h + disk.h + diskutil.h + drawing.h + ersatz.h + events.h + execio.h + execlib.h + fdi2raw.h + filesys.h + flags_arm.h + flashrom.h + fpp-ieee-be.h + fpp-unknown.h + fpp.h + fsdb.h + fsusage.h + gayle.h + genblitter.h + gensound.h + gfxboard.h + gui.h + ide.h + inputdevice.h + keyboard.h + keybuf.h + mackbd.h + memory.h + mmu_common.h + native2amiga.h + native2amiga_api.h + newcpu.h + options.h + osemu.h + picasso96.h + readcpu.h + rommgr.h + rtc.h + rtgmodes.h + savestate.h + scsi.h + scsidev.h + statusline.h + sysdeps.h + traps.h + uae.h + uaeresource.h + xwin.h + zarchive.h + zfile.h + + + codegen_arm.cpp + codegen_arm.h + compemu.cpp + compemu.h + compemu_fpp.cpp + compemu_midfunc_arm.cpp + compemu_midfunc_arm.h + compemu_midfunc_arm2.cpp + compemu_midfunc_arm2.h + compemu_prefs.cpp + compemu_support.cpp + compstbl.cpp + comptbl.h + gencomp_arm.cpp + + + m68k.h + maccess.h + md-fpp.h + rpt.h + support.cpp + + + gl.cpp + gl.h + gl_platform.cpp + gl_platform.h + gles_gfx.cpp + shader_stuff.cpp + shader_stuff.h + + + + CreateFilesysHardfile.cpp + EditFilesysHardfile.cpp + EditFilesysVirtual.cpp + InGameMessage.cpp + Navigation.cpp + PanelCPU.cpp + PanelChipset.cpp + PanelConfig.cpp + PanelCustom.cpp + PanelDisplay.cpp + PanelFloppy.cpp + PanelHD.cpp + PanelInput.cpp + PanelMisc.cpp + PanelPaths.cpp + PanelQuickstart.cpp + PanelRAM.cpp + PanelROM.cpp + PanelSavestate.cpp + PanelSound.cpp + SelectFile.cpp + SelectFolder.cpp + SelectorEntry.cpp + SelectorEntry.hpp + ShowHelp.cpp + ShowMessage.cpp + UaeCheckBox.cpp + UaeCheckBox.hpp + UaeDropDown.cpp + UaeDropDown.hpp + UaeListBox.cpp + UaeListBox.hpp + UaeRadioButton.cpp + UaeRadioButton.hpp + gui_handling.h + main_window.cpp + sdltruetypefont.cpp + sdltruetypefont.hpp + + + menu_config.cpp + + arm_helper.s + bsdsocket_host.cpp + cda_play.cpp + cda_play.h + charset.cpp + config.h + fsdb_host.cpp + hardfile_pandora.cpp + keyboard.cpp + mp3decoder.cpp + mp3decoder.h + neon_helper.s + pandora.cpp + pandora_filesys.cpp + pandora_gfx.cpp + pandora_gui.cpp + pandora_input.cpp + pandora_mem.cpp + pandora_rp9.cpp + pandora_rp9.h + picasso96.cpp + picasso96.h + rasp_gfx.cpp + raspi_input.cpp + sigsegv_handler.cpp + sysconfig.h + target.h + writelog.cpp + + + softfloat-macros.h + softfloat-specialize.h + softfloat.cpp + softfloat.h + softfloat_decimal.cpp + softfloat_fpsp.cpp + softfloat_fpsp_tables.h + + + sound.cpp + sound.h + sound_sdl_new.cpp + + + thread.h + + akiko.cpp + ar.cpp + aros.rom.cpp + audio.cpp + autoconf.cpp + blit.h + blitfunc.cpp + blitfunc.h + blitops.cpp + blittable.cpp + blitter.cpp + blkdev.cpp + blkdev_cdimage.cpp + bsdsocket.cpp + build68k.cpp + calc.cpp + cd32_fmv.cpp + cd32_fmv_genlock.cpp + cdrom.cpp + cfgfile.cpp + cia.cpp + cpudefs.cpp + cpuemu_0.cpp + cpuemu_11.cpp + cpuemu_4.cpp + cpuemu_40.cpp + cpuemu_44.cpp + cpustbl.cpp + cputbl.h + crc32.cpp + custom.cpp + def_icons.cpp + devices.cpp + disk.cpp + diskutil.cpp + drawing.cpp + events.cpp + expansion.cpp + fdi2raw.cpp + filesys.asm + filesys.cpp + filesys_bootrom.cpp + flashrom.cpp + fpp.cpp + fpp_native.cpp + fpp_softfloat.cpp + fsdb.cpp + fsdb_unix.cpp + fsusage.cpp + gayle.cpp + genblitter.cpp + gencpu.cpp + gfxboard.cpp + gfxutil.cpp + hardfile.cpp + hrtmon.rom.cpp + ide.cpp + inputdevice.cpp + inputevents.def + keybuf.cpp + linetoscr.c + linetoscr.cpp + main.cpp + memory.cpp + native2amiga.cpp + newcpu.cpp + newcpu_common.cpp + p96_blit.cpp + readcpu.cpp + rommgr.cpp + rtc.cpp + savestate.cpp + scsi.cpp + sinctable.cpp + statusline.cpp + trace.c + traps.cpp + uaelib.cpp + uaeresource.cpp + zfile.cpp + zfile_archive.cpp + + + + + + + + + + Makefile + + + + pi@cd32.home:22 + 2 + + + + . + ${AUTO_FOLDER} + + ${AUTO_FOLDER} + + ${MAKE} ${ITEM_NAME}.o + ${AUTO_COMPILE} + + ${AUTO_COMPILE} + + + + + + + + + + + + + + + gdb + + + + "${OUTPUT_PATH}" + + "${OUTPUT_PATH}" + . + false + 2 + 0 + 0 + + + + + + + pi@cd32.home:22 + 2 + + + + . + ${AUTO_FOLDER} + + ${AUTO_FOLDER} + + ${MAKE} ${ITEM_NAME}.o + ${AUTO_COMPILE} + + ${AUTO_COMPILE} + + + + + + + + + + + + + + + gdb + + + + "${OUTPUT_PATH}" + + "${OUTPUT_PATH}" + . + false + 0 + 0 + + + + + + diff --git a/nbproject/private/cpp_standard_headers_indexer.cpp b/nbproject/private/cpp_standard_headers_indexer.cpp new file mode 100644 index 00000000..04f6fa66 --- /dev/null +++ b/nbproject/private/cpp_standard_headers_indexer.cpp @@ -0,0 +1,135 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + */ + +// List of standard headers was taken in http://en.cppreference.com/w/cpp/header + +#include // General purpose utilities: program control, dynamic memory allocation, random numbers, sort and search +#include // Functions and macro constants for signal management +#include // Macro (and function) that saves (and jumps) to an execution context +#include // Handling of variable length argument lists +#include // Runtime type information utilities +#include // std::bitset class template +#include // Function objects, designed for use with the standard algorithms +#include // Various utility components +#include // C-style time/date utilites +#include // typedefs for types such as size_t, NULL and others +#include // Low-level memory management utilities +#include // Higher level memory management utilities +#include // limits of integral types +#include // limits of float types +#include // standardized way to query properties of arithmetic types +#include // Exception handling utilities +#include // Standard exception objects +#include // Conditionally compiled macro that compares its argument to zero +#include // Macro containing the last error number +#include // functions to determine the type contained in character data +#include // functions for determining the type of wide character data +#include // various narrow character string handling functions +#include // various wide and multibyte string handling functions +#include // std::basic_string class template +#include // std::vector container +#include // std::deque container +#include // std::list container +#include // std::set and std::multiset associative containers +#include // std::map and std::multimap associative containers +#include // std::stack container adaptor +#include // std::queue and std::priority_queue container adaptors +#include // Algorithms that operate on containers +#include // Container iterators +#include // Common mathematics functions +#include // Complex number type +#include // Class for representing and manipulating arrays of values +#include // Numeric operations on values in containers +#include // forward declarations of all classes in the input/output library +#include // std::ios_base class, std::basic_ios class template and several typedefs +#include // std::basic_istream class template and several typedefs +#include // std::basic_ostream, std::basic_iostream class templates and several typedefs +#include // several standard stream objects +#include // std::basic_fstream, std::basic_ifstream, std::basic_ofstream class templates and several typedefs +#include // std::basic_stringstream, std::basic_istringstream, std::basic_ostringstream class templates and several typedefs +#include // std::strstream, std::istrstream, std::ostrstream(deprecated) +#include // Helper functions to control the format or input and output +#include // std::basic_streambuf class template +#include // C-style input-output functions +#include // Localization utilities +#include // C localization utilities +#include // empty header. The macros that appear in iso646.h in C are keywords in C++ +#if __cplusplus >= 201103L +#include // (since C++11) std::type_index +#include // (since C++11) Compile-time type information +#include // (since C++11) C++ time utilites +#include // (since C++11) std::initializer_list class template +#include // (since C++11) std::tuple class template +#include // (since C++11) Nested allocator class +#include // (since C++11) fixed-size types and limits of other types +#include // (since C++11) formatting macros , intmax_t and uintmax_t math and conversions +#include // (since C++11) defines std::error_code, a platform-dependent error code +#include // (since C++11) C-style Unicode character conversion functions +#include // (since C++11) std::array container +#include // (since C++11) std::forward_list container +#include // (since C++11) std::unordered_set and std::unordered_multiset unordered associative containers +#include // (since C++11) std::unordered_map and std::unordered_multimap unordered associative containers +#include // (since C++11) Random number generators and distributions +#include // (since C++11) Compile-time rational arithmetic +#include // (since C++11) Floating-point environment access functions +#include // (since C++11) Unicode conversion facilities +#include // (since C++11) Classes, algorithms and iterators to support regular expression processing +#include // (since C++11) Atomic operations library +#include // (since C++11)(deprecated in C++17) simply includes the header +#include // (since C++11)(deprecated in C++17) simply includes the headers (until C++17) (since C++17) and : the overloads equivalent to the contents of the C header tgmath.h are already provided by those headers +#include // (since C++11)(deprecated in C++17) defines one compatibility macro constant +#include // (since C++11)(deprecated in C++17) defines one compatibility macro constant +#include // (since C++11) std::thread class and supporting functions +#include // (since C++11) mutual exclusion primitives +#include // (since C++11) primitives for asynchronous computations +#include // (since C++11) thread waiting conditions +#endif +#if __cplusplus >= 201300L +#include // (since C++14) shared mutual exclusion primitives +#endif +#if __cplusplus >= 201500L +#include // (since C++17) std::any class template +#include // (since C++17) std::optional class template +#include // (since C++17) std::variant class template +#include // (since C++17) Polymorphic allocators and memory resources +#include // (since C++17) std::basic_string_view class template +#include // (since C++17) Predefined execution policies for parallel versions of the algorithms +#include // (since C++17) std::path class and supporting functions +#endif diff --git a/nbproject/private/launcher.properties b/nbproject/private/launcher.properties new file mode 100644 index 00000000..3edc2d89 --- /dev/null +++ b/nbproject/private/launcher.properties @@ -0,0 +1,42 @@ +# Launchers File syntax: +# +# [Must-have property line] +# launcher1.runCommand= +# [Optional extra properties] +# launcher1.displayName= +# launcher1.hide= +# launcher1.buildCommand= +# launcher1.runDir= +# launcher1.runInOwnTab= +# launcher1.symbolFiles= +# launcher1.env.= +# (If this value is quoted with ` it is handled as a native command which execution result will become the value) +# [Common launcher properties] +# common.runDir= +# (This value is overwritten by a launcher specific runDir value if the latter exists) +# common.env.= +# (Environment variables from common launcher are merged with launcher specific variables) +# common.symbolFiles= +# (This value is overwritten by a launcher specific symbolFiles value if the latter exists) +# +# In runDir, symbolFiles and env fields you can use these macroses: +# ${PROJECT_DIR} - project directory absolute path +# ${OUTPUT_PATH} - linker output path (relative to project directory path) +# ${OUTPUT_BASENAME}- linker output filename +# ${TESTDIR} - test files directory (relative to project directory path) +# ${OBJECTDIR} - object files directory (relative to project directory path) +# ${CND_DISTDIR} - distribution directory (relative to project directory path) +# ${CND_BUILDDIR} - build directory (relative to project directory path) +# ${CND_PLATFORM} - platform name +# ${CND_CONF} - configuration name +# ${CND_DLIB_EXT} - dynamic library extension +# +# All the project launchers must be listed in the file! +# +# launcher1.runCommand=... +# launcher2.runCommand=... +# ... +# common.runDir=... +# common.env.KEY=VALUE + +# launcher1.runCommand= \ No newline at end of file diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml new file mode 100644 index 00000000..63d0d836 --- /dev/null +++ b/nbproject/private/private.xml @@ -0,0 +1,27 @@ + + + + 0 + 1 + + + + src/osdep/gui/ShowMessage.cpp + + + 98 + + + + + + + file:/Users/horaceandthespider/Documents/Geek/Amiberry/amiberry-hats/src/custom.cpp + file:/Users/horaceandthespider/Documents/Geek/Amiberry/amiberry-hats/src/include/options.h + file:/Users/horaceandthespider/Documents/Geek/Amiberry/amiberry-hats/src/osdep/gui/PanelInput.cpp + file:/Users/horaceandthespider/Documents/Geek/Amiberry/amiberry-hats/src/include/inputdevice.h + file:/Users/horaceandthespider/Documents/Geek/Amiberry/amiberry-hats/src/cfgfile.cpp + file:/Users/horaceandthespider/Documents/Geek/Amiberry/amiberry-hats/src/inputdevice.cpp + + + diff --git a/nbproject/private/timestamps-retropie-pi-22 b/nbproject/private/timestamps-retropie-pi-22 new file mode 100644 index 00000000..a3079665 --- /dev/null +++ b/nbproject/private/timestamps-retropie-pi-22 @@ -0,0 +1,1135 @@ +#Fri Jan 20 17:01:37 GMT 2017 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\events.gcc.rsp=c1484122776878 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\inputdevice.npa00=c1482255473136 +c\:\\github\\uae4arm-rpi\\src\\machdep\\md-fpp.h=c1483975652786 +c\:\\github\\uae4arm-rpi\\.git\\objects\\55\\674c44467f686c6f35bdeef47b173fc74c478d=c1483975584029 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\globalfiletable.001=c1484123460591 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ac\\01598655e686df4edbc75dfcc82d7799a1f468=c1484825696283 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\globalfiletable.000=c1484123394318 +c\:\\github\\uae4arm-rpi\\.git\\logs\\refs\\heads\\sdl2=c1481561903399 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\globalcache\\000\\symbolrefs.dat=c1483653422059 +c\:\\github\\uae4arm-rpi\\.git\\objects\\2f\\7efbeab578c8042531ea7908ee8ffd7589fe46=c1484825696313 +c\:\\github\\uae4arm-rpi\\visualgdb\\amiberry\\amiberry-release-rpi1.vgdbsettings=c1484825696556 +c\:\\github\\uae4arm-rpi\\.git\\logs\\refs\\heads\\netbeans=c1484929381089 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\archive\\7z\\7zheader.cpp=c1481274637740 +c\:\\github\\uae4arm-rpi\\.git\\objects\\f7\\9727271ce34f150d7386a455e09484faef5c00=c1484825696357 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\globalcache\\000\\symbolrefs.dat=c1482264973360 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cdrom.gcc.rsp=c1484122776853 +c\:\\github\\uae4arm-rpi\\.git\\objects\\36\\2492c48cdd112f93f82e2c71a26d0eb86a33ce=c1482400900844 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\pandora_input-00001.rdb=c1484123312587 +c\:\\github\\uae4arm-rpi\\src\\sounddep\\sound.cpp=c1483975653009 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\editfilesyshardfile.dep=c1484122785610 +c\:\\github\\uae4arm-rpi\\.git\\objects\\cc\\3edcce8bd285b3eeb4a479c85487d47c180961=c1482400900408 +c\:\\github\\uae4arm-rpi\\.git\\logs\\refs\\stash=c1484929344225 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\support.gcc.rsp=c1484122776910 +c\:\\github\\uae4arm-rpi\\src\\include\\flags_arm.h=c1483975652674 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\filesys.npa00=c1482270756506 +c\:\\github\\uae4arm-rpi\\_config.yml=c1484825696574 +c\:\\github\\uae4arm-rpi\\.git\\logs\\refs\\heads\\midwan-master=c1483974687739 +c\:\\github\\uae4arm-rpi\\.git\\objects\\77\\4f49c877da9724fbac152d465f7cd5de4dfb6a=c1483975583649 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\sigsegv_handler.npa00=c1482264972018 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zheader.dep=c1484122777618 +c\:\\github\\uae4arm-rpi\\src\\cia.cpp=c1481561902571 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\sound_sdl_new.npa00=c1482270762073 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\drawing.dep=c1484122781306 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\rasp_gfx.gcc.rsp=c1484122777006 +c\:\\github\\uae4arm-rpi\\.git\\objects\\7e\\7bba707a59ff8cc7456f0f60a8c94bbf865f65=c1484825696247 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\tmp00000001.npa00=c1482239101587 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\compemu_fpp.dep=c1484122782525 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\autoconf.dep=c1484122778991 +c\:\\github\\uae4arm-rpi\\data\\sound.ico=c1481274637700 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\pandora.npa00=c1482264972596 +c\:\\github\\uae4arm-rpi\\.git\\objects\\07\\def297e76dedf3ad40b720df7eab6c2d8a8fbe=c1483975586581 +c\:\\github\\uae4arm-rpi\\.git\\objects\\93\\4f7636eac2239f51348514e71b045c58228f51=c1482400900840 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cpustbl.gcc.rsp=c1484122776867 +c\:\\github\\uae4arm-rpi\\.gitignore=c1484825696516 +c\:\\github\\uae4arm-rpi\\src\\expansion.cpp=c1483975652609 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\writelog.dep=c1484122790848 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\sound_sdl_new.npd=c1482270762081 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\crcio.dep=c1484122778399 +c\:\\github\\uae4arm-rpi\\src\\archivers\\lha\\dhuf.cpp=c1483975652472 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zitem.gcc.rsp=c1484122776775 +c\:\\github\\uae4arm-rpi\\.git\\objects\\60\\2d2ceb2e5d028b0f9daf6c4dc920fd3653272c=c1482400900431 +c\:\\github\\uae4arm-rpi\\src\\include\\rtgmodes.h=c1483975652723 +c\:\\github\\uae4arm-rpi\\.git\\objects\\da\\b064daaf0fa5c2d459c6dc50f5683373805014=c1482400900815 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\bra86.dep=c1484122777928 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\inputdevice.rdb=c1483656253836 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ac\\7c3462baa5c6ba17c6ca0212aa29886b20b6fb=c1482225287776 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\header.gcc.rsp=c1484122776808 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\tables.gcc.rsp=c1484122776792 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\fsdb.gcc.rsp=c1484122776886 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zstream.gcc.rsp=c1484122776763 +c\:\\github\\uae4arm-rpi\\src\\fsusage.cpp=c1481561902657 +c\:\\github\\uae4arm-rpi\\src\\cfgfile.cpp=c1483975652585 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\cfgfile.npa01=c1482403727016 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\main_window.cpp=c1483975652929 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\pfile.h=c1481561902438 +c\:\\github\\uae4arm-rpi\\src\\include\\autoconf.h=c1481561902700 +c\:\\github\\uae4arm-rpi\\src\\include\\traps.h=c1483975652735 +c\:\\github\\uae4arm-rpi\\src\\include\\scsi.h=c1483975652730 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry-gles\\globalfiletable.001=c1484123208849 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\slide.dep=c1484122778667 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry-gles\\globalfiletable.000=c1484123274888 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\pandora_input-00001.npa00=c1484123207983 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\uaecheckbox.cpp=c1483975652910 +c\:\\github\\uae4arm-rpi\\screenshots\\dir.txt=c1481274637708 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\blitter.gcc.rsp=c1484122776842 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\blitter.dep=c1484122779326 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\compemu.gcc.rsp=c1484122776899 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\sigsegv_handler.npd=c1482270761626 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\keybuf.gcc.rsp=c1484122776906 +c\:\\github\\uae4arm-rpi\\.git\\objects\\8f\\0af65aa9f2711f4848734ee488290062fdf965=c1481890553786 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\globalcache\\000\\macrorefs.dat=c1483653422063 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\fsdb.dep=c1484122781749 +c\:\\github\\uae4arm-rpi\\.git\\objects\\4b\\17913a8585c5f9e2889d85d934e389ae67640e=c1484825696417 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\akiko.gcc.rsp=c1484122776758 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\263-272-264.psf=c1483653416964 +c\:\\github\\uae4arm-rpi\\.git\\objects\\7f\\59e10f1e86a56e91aacedf7eb5fe0cc59cd9ff=c1484825696258 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\uaeresource.dep=c1484122791692 +c\:\\github\\uae4arm-rpi\\.git\\logs\\refs\\remotes\\midwan\\sdl2=c1481561869312 +c\:\\github\\uae4arm-rpi\\.git\\objects\\9c\\c219492a4fdd64415255f46641b1ecc867021c=c1482400900768 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\142-143-144.psf=c1483653089399 +c\:\\github\\uae4arm-rpi\\src\\inputdevice.cpp=c1483975652748 +c\:\\github\\uae4arm-rpi\\.git\\objects\\1e\\fe1c14888d62da7e80eb35ccb02aac8df52e8b=c1483975586000 +c\:\\github\\uae4arm-rpi\\src\\jit\\compemu_support.cpp=c1481561903122 +c\:\\github\\uae4arm-rpi\\.git\\objects\\f8\\b9e386bdb8e12a27e51b2cbdce192823a90dca=c1481890427962 +c\:\\github\\uae4arm-rpi\\src\\include\\sysdeps.h=c1484825696582 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelinput.gcc.rsp=c1484122776952 +c\:\\github\\uae4arm-rpi\\data\\paths.ico=c1481274637693 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\sigsegv_handler.dep=c1484122790715 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\editfilesysvirtual.dep=c1484122785677 +c\:\\github\\uae4arm-rpi\\visualgdb\\amiberry-gles\\amiberry-gles-debug.vgdbsettings=c1484825696540 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\panelram.cpp=c1483975652891 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\blkdev_cdimage.dep=c1484122779704 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelcpu.gcc.rsp=c1484122776944 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\cfgfile.npd=c1482423936801 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\pandora.gcc.rsp=c1484122776992 +c\:\\github\\uae4arm-rpi\\.git\\logs\\refs\\remotes\\midwan\\master=c1484825696455 +c\:\\github\\uae4arm-rpi\\src\\include\\filesys.h=c1481561902753 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ff\\d6026a6ad5017f019c31b20eb009c90bfef39c=c1483975586323 +c\:\\github\\uae4arm-rpi\\.git\\objects\\7a\\5c36d8d018393bd5461bf0e04f86cb37d21ffb=c1483975586563 +c\:\\github\\uae4arm-rpi\\.git\\objects\\a9\\47d1bdb9fb3710a1763771ac65ce2575821c92=c1483975583993 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\tmp0000000c.npa00=c1482264973786 +c\:\\github\\uae4arm-rpi\\.git\\objects\\e6\\d765bf7dc933b45583db3fc4b59a187f6f2b68=c1482400900399 +c\:\\github\\uae4arm-rpi\\.git\\objects\\c3\\859a1b3e869900ea66909ba5011a5c5a3c5eeb=c1481294222000 +c\:\\github\\uae4arm-rpi\\.git\\objects\\8e\\d306fd085177890aa07f8e7662631aa6ffbad2=c1482400900625 +c\:\\github\\uae4arm-rpi\\.git\\objects\\c8\\f25cd4360b02bf7301b02cdb856da50d84fa66=c1483975583767 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\uae_lha.npa00=c1482264963678 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\archive\\7z\\7zalloc.h=c1481274637729 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\selectfile.gcc.rsp=c1484122776967 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\bsdsocket_host.gcc.rsp=c1484122776921 +c\:\\github\\uae4arm-rpi\\.git\\objects\\8b\\459daab1447ff9afc7ebf5e9693ee74c187fb6=c1483975583670 +c\:\\github\\uae4arm-rpi\\.git\\objects\\14\\04e6328ec04cac77db2358dc0176aeb3970231=c1483975583997 +c\:\\github\\uae4arm-rpi\\data\\35floppy.ico=c1481274637657 +c\:\\github\\uae4arm-rpi\\src\\disk.cpp=c1482225303195 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\drawing.npa00=c1482270756185 +c\:\\github\\uae4arm-rpi\\src\\osdep\\picasso96.cpp=c1483975652977 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\savestate.gcc.rsp=c1484122777016 +c\:\\github\\uae4arm-rpi\\src\\autoconf.cpp=c1481561902533 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\gfxboard.dep=c1484122782044 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\pfile.dep=c1484122778231 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\u_deep.h=c1481274637798 +c\:\\github\\uae4arm-rpi\\.git\\objects\\85\\46f6cf0aa72dcd52ece4823aed6f86a2d7e11b=c1482400900794 +c\:\\github\\uae4arm-rpi\\.git\\refs\\remotes\\midwan\\winuae-3.4.0=c1483975584071 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\neon_helper.dep=c1481893771613 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\u_deep.cpp=c1483975652454 +c\:\\github\\uae4arm-rpi\\.git\\logs\\refs\\remotes\\origin\\cfgfile_cleanup=c1482424248850 +c\:\\github\\uae4arm-rpi\\vslinux\\amiberry.vcxproj=c1484929344356 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelfloppy.gcc.rsp=c1484122776948 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zdecode.dep=c1484122777657 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\blitfunc.dep=c1484122779263 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\createfilesyshardfile.cpp=c1483975652847 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\slide.gcc.rsp=c1484122776820 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\selectorentry.gcc.rsp=c1484122776971 +c\:\\github\\uae4arm-rpi\\src\\newcpu_common.cpp=c1483975652808 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\newcpu.dep=c1484122784619 +c\:\\github\\uae4arm-rpi\\.git\\objects\\1d\\ac34fba4f718158498aabb26a11eac41db3df4=c1482225287813 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\archive\\7z\\7zextract.cpp=c1483975652412 +c\:\\github\\uae4arm-rpi\\src\\blittable.cpp=c1483975652557 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\uaedropdown.dep=c1484122789764 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\uaedropdown.hpp=c1483975652915 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\tmp00000010.npa00=c1482136701488 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\selectorentry.dep=c1484122788952 +c\:\\github\\uae4arm-rpi\\vslinux\\amiberry.vcxproj.user=c1484929344360 +c\:\\github\\uae4arm-rpi\\src\\include\\audio.h=c1483975652640 +c\:\\github\\uae4arm-rpi\\src\\zfile.cpp=c1483975653041 +c\:\\github\\uae4arm-rpi\\.git\\objects\\92\\b0cb5e0be0e1e8f3c51dd6a60f721157e85d89=c1483975586381 +c\:\\github\\uae4arm-rpi\\src\\include\\blitter.h=c1481561902706 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\panelpaths.cpp=c1483975652888 +c\:\\github\\uae4arm-rpi\\src\\include\\fsdb.h=c1481561902766 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\tmp00000005.npa00=c1482239191882 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\larc.gcc.rsp=c1484122776812 +c\:\\github\\uae4arm-rpi\\src\\jit\\compemu_midfunc_arm2.cpp=c1483975652777 +c\:\\github\\uae4arm-rpi\\.git\\objects\\6c\\f7d166eddf187a57299b1b76d0b7d6e3b8d79c=c1482225287766 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\7zstream.cpp=c1483975652400 +c\:\\github\\uae4arm-rpi\\.git\\objects\\29\\c843dbf02e5410ab1b65a61684fdfb339a3181=c1484825696409 +c\:\\github\\uae4arm-rpi\\src\\osdep\\cda_play.h=c1483975652838 +c\:\\github\\uae4arm-rpi\\visualgdb\\amiberry\\amiberry-release-rpi2.vgdbsettings=c1484825696558 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\pandora_input-00001.npd=c1484123207988 +c\:\\github\\uae4arm-rpi\\.git\\objects\\89\\85d80a9af139fe0c14a644b2da9de0ceda7f5c=c1484825696344 +c\:\\github\\uae4arm-rpi\\vslinux\\amiberry.sln=c1484825696525 +c\:\\github\\uae4arm-rpi\\src\\blitops.cpp=c1483975652555 +c\:\\github\\uae4arm-rpi\\data\\mouse.bmp=c1481274637692 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\readcpu.dep=c1484122791362 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\main.npd=c1482264849943 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\uaedropdown.gcc.rsp=c1484122776976 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zextract.gcc.rsp=c1484122776769 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelinput.dep=c1484122788317 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\zfile_archive.dep=c1484122791961 +c\:\\github\\uae4arm-rpi\\src\\include\\statusline.h=c1481561903052 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\hardfile.gcc.rsp=c1484122776895 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\inputdevice-00001.rdb=c1484123421833 +c\:\\github\\uae4arm-rpi\\.git\\objects\\fc\\780d7b7c25bda78b54abeef28b19ab41e86dcb=c1483975586533 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\rommgr.npd=c1482264972415 +c\:\\github\\uae4arm-rpi\\.git\\objects\\39\\59fc9957449bda63df368ef045ed1e85dc4e9c=c1482400900810 +c\:\\github\\uae4arm-rpi\\.git\\objects\\95\\edb4a050240bccf80531303991d54b3f451a24=c1482400900836 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\cfgfile.npd=c1482403727022 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\selectfile.dep=c1484122789527 +c\:\\github\\uae4arm-rpi\\data\\expansion.ico=c1481274637678 +c\:\\github\\uae4arm-rpi\\.git\\objects\\29\\9559364aa9d8a53166ac7648bde76e06da2eab=c1481619410910 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\panelmisc.npd=c1481895596472 +c\:\\github\\uae4arm-rpi\\.git\\objects\\04\\4ff9aea914c1a3deab4c85b3de170fbd1963e1=c1484825696237 +c\:\\github\\uae4arm-rpi\\.git\\objects\\cf\\bdfcaa0ed57b009f167b939326c91b0c8282cd=c1484929344132 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\unzip.gcc.rsp=c1484122776829 +c\:\\github\\uae4arm-rpi\\.git\\objects\\f4\\5a772cea5e4b4c4ecdda93bbf6b88d3fe30269=c1483975583894 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\maketbl.cpp=c1483975652447 +c\:\\github\\uae4arm-rpi\\src\\osdep\\charset.cpp=c1483975652841 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\u_medium.cpp=c1483975652460 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\pandora_gui.npd=c1482264972821 +c\:\\github\\uae4arm-rpi\\.git\\objects\\9e\\c4f290a79270a882165fed92fbde44e2aa0dba=c1483975583757 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\fsdb_host.gcc.rsp=c1484122776927 +c\:\\github\\uae4arm-rpi\\.git\\objects\\da\\a3d44046b4c5b380c22addae80f5405b457c8b=c1482400900415 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\archive\\7z\\7zitem.h=c1483975652424 +c\:\\github\\uae4arm-rpi\\src\\include\\uae.h=c1483975652737 +c\:\\github\\uae4arm-rpi\\src\\osdep\\mp3decoder.cpp=c1483975652944 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\uaelistbox.hpp=c1483975652920 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelcpu.dep=c1484122787326 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\crc_csum.h=c1481274637778 +c\:\\github\\uae4arm-rpi\\.git\\logs\\refs\\remotes\\origin\\joystick_extra=c1481306269227 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zcrc.gcc.rsp=c1484122776762 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\util.gcc.rsp=c1484122776823 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\selectfolder.gcc.rsp=c1484122776969 +c\:\\github\\uae4arm-rpi\\.git\\objects\\68\\0ff0c7f1a5084d3ceeca12bec77d00ceea8054=c1483975586788 +c\:\\github\\uae4arm-rpi\\.git\\objects\\e5\\c713a686185f97badd6fabf7deecb4d68e6a4d=c1481652869600 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\memory.dep=c1484122784168 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\pandora_mem.gcc.rsp=c1484122777000 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\uae_lha.dep=c1484122778696 +c\:\\github\\uae4arm-rpi\\src\\inputevents.def=c1481561903080 +c\:\\github\\uae4arm-rpi\\data\\chip.ico=c1481274637669 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\native2amiga.gcc.rsp=c1484122776915 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\7zbuf.h=c1483975652397 +c\:\\github\\uae4arm-rpi\\.git\\objects\\89\\41464adaa6743295223ff49a1676df02ab776f=c1481619410933 +c\:\\github\\uae4arm-rpi\\.git\\objects\\9a\\aeb99adadfa04d7fcfc96f58d831a6722adae5=c1484825696311 +c\:\\github\\uae4arm-rpi\\.git\\objects\\9d\\5f7a369c7b268349b310a167289ed3b79eec71=c1482400900427 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\getbits.cpp=c1483975652445 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\ingamemessage.cpp=c1483975652855 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\panelinput.npa00=c1482223850485 +c\:\\github\\uae4arm-rpi\\src\\include\\memory.h=c1484858317201 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\aros.rom.gcc.rsp=c1484122776831 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\panelhd.cpp=c1483975652880 +c\:\\github\\uae4arm-rpi\\.git\\objects\\78\\868a906a32065a3f750337065c4f591ca809f7=c1484929343966 +c\:\\github\\uae4arm-rpi\\data\\misc.ico=c1481274637688 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\disk.npd=c1482270756045 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\cia.npd=c1482232745706 +c\:\\github\\uae4arm-rpi\\.git\\objects\\f6\\898c2a098fca2693f7e723927d8c57edd0a38b=c1482225287769 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\rasp_gfx.dep=c1484122790934 +c\:\\github\\uae4arm-rpi\\.git\\objects\\dc\\e2268a46a9001258b919c9eb1041fdf453d47e=c1484825696263 +c\:\\github\\uae4arm-rpi\\src\\include\\fpp-unknown.h=c1483975652680 +c\:\\github\\uae4arm-rpi\\.git\\objects\\db\\17092c550dceaba06e431429571dcd47cf83b1=c1482400900756 +c\:\\github\\uae4arm-rpi\\src\\gfxboard.cpp=c1483975652632 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\mp3decoder.gcc.rsp=c1484122776988 +c\:\\github\\uae4arm-rpi\\.git\\objects\\pack\\pack-8a32f0c3edca12aca66b93580d4f17d71a0d1c53.idx=c1483974687265 +c\:\\github\\uae4arm-rpi\\.git\\refs\\heads\\master=c1481274637576 +c\:\\github\\uae4arm-rpi\\src\\include\\gfxboard.h=c1483975652690 +c\:\\github\\uae4arm-rpi\\src\\osdep\\pandora_rp9.h=c1483975652971 +c\:\\github\\uae4arm-rpi\\.git\\objects\\d5\\1c596f82c33d4bf6532e45760cc119e11dd9f8=c1482400900403 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\u_quick.cpp=c1483975652463 +VERSION=1.3 +c\:\\github\\uae4arm-rpi\\.git\\objects\\9e\\dc46862db23f4533ccdc81d64ea4ed6ab98c11=c1482400900714 +c\:\\github\\uae4arm-rpi\\.git\\objects\\33\\2beae62cb4334d26904e4a5c8c6f44c249d76d=c1483975586730 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\traps.gcc.rsp=c1484122777022 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\newcpu.gcc.rsp=c1484122776917 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\hardfile_pandora.npa00=c1482264971329 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\panelsound.cpp=c1483975652899 +c\:\\github\\uae4arm-rpi\\.git\\objects\\77\\1e7c4ddd75cb5a1b83fece258ffd47339dd240=c1484825696228 +c\:\\github\\uae4arm-rpi\\src\\blitfunc.cpp=c1483975652551 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\codedb.lck=c1484123625749 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\lzmadec.h=c1483975652436 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\gfxutil.gcc.rsp=c1484122776894 +c\:\\github\\uae4arm-rpi\\.git\\objects\\51\\f7f182e3437f214f42fd98c6677289620d008e=c1484825696281 +c\:\\github\\uae4arm-rpi\\src\\include\\cpu_prefetch.h=c1481561902724 +c\:\\github\\uae4arm-rpi\\src\\sounddep\\sound_sdl_new.cpp=c1483975653016 +c\:\\github\\uae4arm-rpi\\vslinux\\.vs\\amiberry\\v14\\.suo=c1484903569539 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelhd.gcc.rsp=c1484122776950 +c\:\\github\\uae4arm-rpi\\.git\\hooks\\pre-applypatch.sample=c1481274630558 +c\:\\github\\uae4arm-rpi\\src\\newcpu.cpp=c1483975652804 +c\:\\github\\uae4arm-rpi\\data\\delete.png=c1481274637673 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\navigation.gcc.rsp=c1484122776938 +c\:\\github\\uae4arm-rpi\\.git\\objects\\a6\\26393d4e6dc740af1177cc95e11b8402b8a91a=c1483975583906 +c\:\\github\\uae4arm-rpi\\.git\\objects\\f8\\188fcd2d5aee9a75bbeea957906bfc6f05ed71=c1483975586523 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\263.ast=c1483653416833 +c\:\\github\\uae4arm-rpi\\src\\include\\akiko.h=c1481561902695 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\expansion.npd=c1482264964667 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\charset.gcc.rsp=c1484122776925 +c\:\\github\\uae4arm-rpi\\.git\\objects\\c8\\89115b1efe143b6e569af5fbbc8e38a0ac641e=c1484825696328 +c\:\\github\\uae4arm-rpi\\.git\\description=c1481274630547 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cpuemu_11.gcc.rsp=c1484122776863 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\charset.dep=c1484122784833 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelram.gcc.rsp=c1484122776958 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\selectfolder.dep=c1484122789541 +c\:\\github\\uae4arm-rpi\\.git\\objects\\c3\\7d866b187d09ad5457016cefa9402bc6294af1=c1484825696242 +c\:\\github\\uae4arm-rpi\\.git\\objects\\e5\\159b4849ad244e3521eb39fab04d38c74148b8=c1481890553000 +c\:\\github\\uae4arm-rpi\\.git\\hooks\\pre-rebase.sample=c1481274630570 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cdrom.dep=c1484122779564 +c\:\\github\\uae4arm-rpi\\.git\\objects\\1b\\29ef0e4df85bb2e3f1cc4491e69025d3f600d5=c1484825696394 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cda_play.dep=c1484122784597 +c\:\\github\\uae4arm-rpi\\.git\\objects\\01\\b9ae18652246cc05d228db871e9111b6c59beb=c1483975583678 +c\:\\github\\uae4arm-rpi\\src\\linetoscr.c=c1481561903140 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\statusline.dep=c1484122791529 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\tmp00000012.rdb=c1482141722737 +c\:\\github\\uae4arm-rpi\\src\\jit\\compemu_midfunc_arm2.h=c1481561903118 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\disk.npa00=c1482264964626 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\expansion.npa00=c1482264964656 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\blittable.gcc.rsp=c1484122776841 +c\:\\github\\uae4arm-rpi\\src\\filesys_bootrom.cpp=c1483975652620 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\tmp00000009.npa01=c1482255010409 +c\:\\github\\uae4arm-rpi\\.git\\objects\\bd\\b0cabc87cf50106df6e15097dff816c8c3eb34=c1484825696273 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\pandora_input-00001.npd=c1484123239828 +c\:\\github\\uae4arm-rpi\\.git\\objects\\05\\33570d7ae796d73741b9db87506a3b813c9926=c1484825696318 +c\:\\github\\uae4arm-rpi\\src\\include\\scsidev.h=c1483975652734 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\uaedropdown.cpp=c1483975652914 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cpuemu_0.dep=c1484122786699 +c\:\\github\\uae4arm-rpi\\src\\build68k.cpp=c1481561902558 +c\:\\github\\uae4arm-rpi\\.git\\objects\\58\\e3c4a66a39a5f1ea1ac492fd081845c04c3b27=c1482424233903 +c\:\\github\\uae4arm-rpi\\visualgdb\\amiberry.vc.db=c1484902928617 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\globalcache\\000\\names.idx=c1482264973387 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelsound.gcc.rsp=c1484122776963 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\custom.dep=c1484122781398 +c\:\\github\\uae4arm-rpi\\.git\\refs\\heads\\controller_config=c1484825696589 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\pfile.npa00=c1482264963489 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\bsdsocket.dep=c1484122779439 +c\:\\github\\uae4arm-rpi\\src\\jit\\compemu_fpp.cpp=c1483975652764 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\archive\\7z\\7zitem.cpp=c1483975652421 +c\:\\github\\uae4arm-rpi\\src\\archivers\\lha\\header.cpp=c1483975652477 +c\:\\github\\uae4arm-rpi\\.git\\refs\\remotes\\origin\\joystick_extra=c1481306269216 +c\:\\github\\uae4arm-rpi\\.git\\objects\\0f\\4103c7148fecff4da8f961e0e281e2753014cf=c1482424233890 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\tmp00000004.npa00=c1483656620105 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\blkdev.gcc.rsp=c1484122776846 +c\:\\github\\uae4arm-rpi\\.git\\objects\\f4\\48c7c3e5b5cf7d81e2ca228ef571af6eee8f7c=c1483975584001 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\savestate.npd=c1482264972497 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\disk.dep=c1484122781227 +c\:\\github\\uae4arm-rpi\\.git\\objects\\99\\6bbc6de9a48df65ec8109bc73a337a2db12509=c1482400900744 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\u_rle.cpp=c1483975652465 +c\:\\github\\uae4arm-rpi\\src\\include\\crc32.h=c1481274638057 +c\:\\github\\uae4arm-rpi\\.git\\objects\\07\\425e3dcd894c54ea977f7b70e8ba560d60432c=c1481652869597 +c\:\\github\\uae4arm-rpi\\.git\\objects\\c7\\2e3306e1657e54483c1a260227d78d5ca7d720=c1481616215277 +c\:\\github\\uae4arm-rpi\\.git\\objects\\fb\\efca33a024ab81763e5b5a9c9c4c4a87503db1=c1484825696342 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\types.h=c1483975652441 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\inputdevice.npd=c1483655330353 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\lharc.gcc.rsp=c1484122776816 +c\:\\github\\uae4arm-rpi\\src\\memory.cpp=c1483975652798 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\createfilesyshardfile.gcc.rsp=c1484122776929 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\huf.dep=c1484122778547 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelmisc.dep=c1484122788250 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zbuf.dep=c1484122777625 +c\:\\github\\uae4arm-rpi\\.git\\objects\\6d\\eab114023b7642f54354eff0ff67d5d6bdc05e=c1484825696288 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\lhamaketbl.gcc.rsp=c1484122776814 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\tables.h=c1481274637795 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\pandora_gui.gcc.rsp=c1484122776996 +c\:\\github\\uae4arm-rpi\\src\\osdep\\fsdb_host.cpp=c1483975652843 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\1003-1004-1024.psf=c1484122873134 +c\:\\github\\uae4arm-rpi\\.git\\objects\\56\\86300b3f033ac66cb30fd79dfbdbc0f81626b8=c1484825696221 +c\:\\github\\uae4arm-rpi\\src\\machdep\\maccess.h=c1483975652783 +c\:\\github\\uae4arm-rpi\\src\\archivers\\lha\\lharc.cpp=c1483975652495 +c\:\\github\\uae4arm-rpi\\.git\\objects\\b5\\696da224a13c5f38329f889ff92617f6bd33be=c1484825696384 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\blitfunc.gcc.rsp=c1484122776837 +c\:\\github\\uae4arm-rpi\\.git\\hooks\\pre-commit.sample=c1481274630562 +c\:\\github\\uae4arm-rpi\\src\\hardfile.cpp=c1483975652636 +c\:\\github\\uae4arm-rpi\\.git\\objects\\8d\\9c4586bc64fac798a465dd9a001ac190a015e2=c1481293058547 +c\:\\github\\uae4arm-rpi\\.git\\objects\\51\\56473be0c0f7784d72b07df290dd599c570744=c1483975586224 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\uaelistbox.cpp=c1483975652918 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zbuf.gcc.rsp=c1484122776760 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ce\\3895622ad9de9ad1df3d6e76db536f0d9d7203=c1484825696291 +c\:\\github\\uae4arm-rpi\\.git\\info\\exclude=c1481274630583 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\panelrom.cpp=c1483975652893 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\u_rle.gcc.rsp=c1484122776803 +c\:\\github\\uae4arm-rpi\\.git\\objects\\fa\\62d5e14b31e29017cde3e1841cd322bf54501b=c1482225287871 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\sound_sdl_new.dep=c1484122791362 +c\:\\github\\uae4arm-rpi\\.git\\objects\\52\\abd8c9f7ec1b0fde3b85d103d0e6d8e16e6078=c1482400900782 +c\:\\github\\uae4arm-rpi\\src\\osdep\\hardfile_pandora.cpp=c1483975652935 +c\:\\github\\uae4arm-rpi\\src\\include\\execio.h=c1483975652671 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cda_play.gcc.rsp=c1484122776923 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\compstbl.dep=c1484122783051 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\pandora_input.dep=c1484123327366 +c\:\\github\\uae4arm-rpi\\.git\\objects\\51\\619f6f388b882f124ac60fa19b24bd357eff7d=c1482400900788 +c\:\\github\\uae4arm-rpi\\.git\\objects\\4b\\4723c36d3a33dda220b27f556358db5c1501c7=c1482400900763 +c\:\\github\\uae4arm-rpi\\.git\\objects\\62\\927b7be9345fbb920ff92da7b78c7318748afd=c1483975586780 +c\:\\github\\uae4arm-rpi\\src\\main.cpp=c1483975652793 +c\:\\github\\uae4arm-rpi\\.git\\objects\\34\\8b9a1672360ae00ee4d737c270dd81d47b7ab0=c1483975584033 +c\:\\github\\uae4arm-rpi\\.git\\objects\\a1\\d09af6b697b29cf4b24e939c3423da73d704a8=c1483975586541 +c\:\\github\\uae4arm-rpi\\.git\\objects\\c8\\a958370c9111465932af2f29b4cdd8946e3536=c1482400900775 +c\:\\github\\uae4arm-rpi\\.git\\objects\\be\\11d7b89a1c77999806fab2f142f218ea86074c=c1483975584026 +c\:\\github\\uae4arm-rpi\\src\\archivers\\lzx\\unlzx.cpp=c1483975652506 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\bra86.cpp=c1483975652431 +c\:\\github\\uae4arm-rpi\\.git\\refs\\heads\\netbeans=c1484929381087 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\readcpu.gcc.rsp=c1484122777011 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\inputdevice.npa00=c1483655330347 +c\:\\github\\uae4arm-rpi\\data\\remapping.bmp=c1481274637695 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\cdata.h=c1483975652442 +c\:\\github\\uae4arm-rpi\\.git\\objects\\44\\90c4c3fdf284e470e65673615fee4158448b5f=c1482225287804 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cpuemu_0.gcc.rsp=c1484122776861 +c\:\\github\\uae4arm-rpi\\src\\machdep\\m68k.h=c1483975652780 +c\:\\github\\uae4arm-rpi\\.git\\objects\\39\\26c00f5d21522a4408586f9e61369598be9148=c1483975584010 +c\:\\github\\uae4arm-rpi\\visualgdb\\amiberry\\amiberry-release.vgdbsettings=c1484825696560 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\unlzx.npd=c1482264963698 +c\:\\github\\uae4arm-rpi\\src\\gencpu.cpp=c1481561902664 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\142-143.psf=c1482401347741 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\amiberry=c1484123328991 +c\:\\github\\uae4arm-rpi\\.git\\objects\\63\\6c1ee8ebca5a2f76d05cab81b6567bd1896628=c1483975583903 +c\:\\github\\uae4arm-rpi\\src\\archivers\\zip\\unzip.cpp=c1483975652515 +c\:\\github\\uae4arm-rpi\\.git\\objects\\e7\\c348a43b4069508379116c7f8446d27d06917e=c1483975586417 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelconfig.dep=c1484122786703 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\gui_handling.h=c1483975652926 +c\:\\github\\uae4arm-rpi\\src\\table68k=c1481561903363 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\panelchipset.cpp=c1483975652866 +c\:\\github\\uae4arm-rpi\\.git\\objects\\89\\546402b86b594e03da98882c4ad7645c0cf9b1=c1482424183598 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\crc32.dep=c1484122780080 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\unzip.dep=c1484122778893 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\pfile.npa00=c1482270754862 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\gfxboard.gcc.rsp=c1484122776892 +c\:\\github\\uae4arm-rpi\\.git\\refs\\remotes\\origin\\head=c1481274637569 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\panelmisc.cpp=c1483975652887 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\shuf.gcc.rsp=c1484122776818 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\main_window.gcc.rsp=c1484122776937 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cpudefs.dep=c1484122779744 +c\:\\github\\uae4arm-rpi\\.git\\objects\\6d\\5532ff08e72b7e1cd55c2bf587fad17a9a77e5=c1483975586359 +c\:\\github\\uae4arm-rpi\\src\\jit\\compemu.cpp=c1481561903096 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\compemu.dep=c1484122792382 +c\:\\github\\uae4arm-rpi\\.git\\objects\\12\\d70f3ced4ee2666f534b9f2fcf461c7af1431f=c1482400900424 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelfloppy.dep=c1484122787811 +c\:\\github\\uae4arm-rpi\\src\\machdep\\rpt.h=c1483975652787 +c\:\\github\\uae4arm-rpi\\.git\\objects\\c4\\d273069aa6c2cbb1d9a994a997467541756592=c1482400900469 +c\:\\github\\uae4arm-rpi\\.git\\objects\\b6\\c75ce7010aa93db4ac7b14300ddbcf1c553a08=c1481619410922 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zdecode.gcc.rsp=c1484122776767 +c\:\\github\\uae4arm-rpi\\.git\\objects\\e4\\2a656fb6214b6b58d68d83d13559811d556369=c1482400900633 +c\:\\github\\uae4arm-rpi\\.git\\objects\\f9\\3463bbed3cacd5aa115e830fe854b2d17ae595=c1484825696307 +c\:\\github\\uae4arm-rpi\\.git\\objects\\a7\\8e6db754809cd7aa064fed680ea45160434ae7=c1482400900821 +c\:\\github\\uae4arm-rpi\\.git\\objects\\18\\f3557c40ddf1bab558e130fabfd0a167bfb33e=c1483975583890 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\hardfile.dep=c1484122782656 +c\:\\github\\uae4arm-rpi\\src\\cpuemu_0.cpp=c1481561902584 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\paneldisplay.dep=c1484122787294 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\maketbl.gcc.rsp=c1484122776788 +c\:\\github\\uae4arm-rpi\\.git\\objects\\28\\ac945aa915f3b1787701bffd0ec5e2aa1db27c=c1484825696316 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\pandora.npa00=c1483653682727 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelconfig.gcc.rsp=c1484122776942 +c\:\\github\\uae4arm-rpi\\src\\osdep\\mp3decoder.h=c1483975652947 +c\:\\github\\uae4arm-rpi\\.git\\objects\\01\\748174c6f0474747777435cd3d2662654f8550=c1481890427974 +c\:\\github\\uae4arm-rpi\\.git\\objects\\fd\\70b9469abf019319cd39893bf3d904d308608a=c1481616215319 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\main.npa00=c1482254347571 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\pandora_input.npa00=c1482264971848 +c\:\\github\\uae4arm-rpi\\.git\\objects\\d9\\c1ba05ecf479d56cf1130182f53d4eac3a84f7=c1483975586000 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\hardfile_pandora.npa00=c1482270760818 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zheader.gcc.rsp=c1484122776771 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\u_heavy.cpp=c1483975652456 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ad\\a3368be44379f8a2834a61c204f44b3bba7343=c1483975586350 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\globalcache\\000\\globaltrees.dat=c1483653422066 +c\:\\github\\uae4arm-rpi\\.git\\objects\\pack\\pack-8a32f0c3edca12aca66b93580d4f17d71a0d1c53.pack=c1483975586000 +c\:\\github\\uae4arm-rpi\\src\\osdep\\menu\\menu_config.cpp=c1483975652943 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\tmp00000003.npa00=c1484123461032 +c\:\\github\\uae4arm-rpi\\src\\custom.cpp=c1484825696578 +c\:\\github\\uae4arm-rpi\\src\\zfile_archive.cpp=c1483975653046 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\pfile.gcc.rsp=c1484122776790 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\newcpu.npd=c1482270757671 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\archive\\7z\\7zin.cpp=c1483975652418 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelpaths.gcc.rsp=c1484122776956 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\unlzx.npd=c1482270755083 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ce\\7a66add66bd9285f2dfbc3d0109c5f55ea0b7c=c1481652869603 +c\:\\github\\uae4arm-rpi\\.git\\objects\\75\\c8045abc63dd61d764f44edd67ae0772acabc3=c1484825696321 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\pfile.npd=c1482264963495 +c\:\\github\\uae4arm-rpi\\src\\archivers\\lha\\lhamaketbl.cpp=c1483975652490 +c\:\\github\\uae4arm-rpi\\src\\jit\\compemu_midfunc_arm.cpp=c1483975652771 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\cpuarch.h=c1481274637764 +c\:\\github\\uae4arm-rpi\\src\\osdep\\pandora_mem.cpp=c1483975652967 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\showmessage.dep=c1484122789926 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\bsdsocket.gcc.rsp=c1484122776849 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\u_medium.gcc.rsp=c1484122776799 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\zfile_archive.npa00=c1482264972706 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\newcpu_common.gcc.rsp=c1484122776919 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\u_init.dep=c1484122778258 +c\:\\github\\uae4arm-rpi\\.git\\objects\\7e\\0105de1547934dc0dea56c1063c5735adcf4c4=c1481616215313 +c\:\\github\\uae4arm-rpi\\data\\joystick.ico=c1481274637686 +c\:\\github\\uae4arm-rpi\\.git\\objects\\8f\\fe4b97b4dace8d94419c04148863b0d585d148=c1482225287636 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ab\\7387d89531a8af20aeef047db44e552d817242=c1481293789012 +c\:\\github\\uae4arm-rpi\\src\\fpp.cpp=c1483975652624 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\crcio.gcc.rsp=c1484122776805 +c\:\\github\\uae4arm-rpi\\.git\\refs\\remotes\\midwan\\master=c1484825696452 +c\:\\github\\uae4arm-rpi\\src\\include\\debug.h=c1483975652660 +c\:\\github\\uae4arm-rpi\\.git\\fetch_head=c1484845367776 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\uae_lha.gcc.rsp=c1484122776821 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\maketbl.dep=c1484122778092 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\inputdevice.dep=c1484122783340 +c\:\\github\\uae4arm-rpi\\src\\osdep\\arm_helper.s=c1483975652829 +c\:\\github\\uae4arm-rpi\\data\\screen.ico=c1481274637698 +c\:\\github\\uae4arm-rpi\\src\\gfxutil.cpp=c1481561902669 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\compemu_support.gcc.rsp=c1484122776902 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\getbits.gcc.rsp=c1484122776787 +c\:\\github\\uae4arm-rpi\\.git\\objects\\55\\6b813dc34632ba97e89f6d13a88327d65fa6c0=c1481619410906 +c\:\\github\\uae4arm-rpi\\.git\\objects\\98\\6e6089175cfef0ffa5c770f75b144b1496c5af=c1482400900441 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\traps.dep=c1484122791721 +c\:\\github\\uae4arm-rpi\\.git\\objects\\5c\\05f8eaffe61003d4236712198341829114293f=c1482400900700 +c\:\\github\\uae4arm-rpi\\src\\sinctable.cpp=c1483975653008 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\263-272.psf=c1483653416916 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\main.npd=c1482254347577 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\zfile.dep=c1484122792142 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\rommgr.gcc.rsp=c1484122777014 +c\:\\github\\uae4arm-rpi\\.git\\objects\\5e\\95fc3951d57e741ce8117c8ff35276bbb994e1=c1484825696261 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\menu_config.dep=c1484122790240 +c\:\\github\\uae4arm-rpi\\amiberry\\.vs\\amiberry\\v14\\.suo=c1484123625669 +c\:\\github\\uae4arm-rpi\\data\\freesans.ttf=c1481274637667 +c\:\\github\\uae4arm-rpi\\src\\include\\native2amiga.h=c1483975652707 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\picasso96.dep=c1484122791351 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\pandora_input.rdb=c1482265058652 +c\:\\github\\uae4arm-rpi\\.git\\logs\\refs\\remotes\\origin\\head=c1481274637567 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\hardfile_pandora.dep=c1484122789859 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ff\\6af9e00f5eaf6f02e2340cfd6dd737470305a7=c1482400900751 +c\:\\github\\uae4arm-rpi\\.git\\objects\\89\\6f5378088f12865c306e94eced73f6be25200a=c1483975586772 +c\:\\github\\uae4arm-rpi\\src\\bsdsocket.cpp=c1483975652570 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\pandora_input.gcc.rsp=c1484123327200 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\crc32.gcc.rsp=c1484122776869 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\pandora.rdb=c1483692092743 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cfgfile.gcc.rsp=c1484122776855 +c\:\\github\\uae4arm-rpi\\.git\\objects\\pack\\pack-efbf07322eb0bd7342e9ac0a787a71a031cf12f3.pack=c1481274637524 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\archive\\7z\\7zdecode.h=c1483975652409 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\getbits.dep=c1484122778083 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ab\\a2094ce39c1711d51c21c4d09a0af92a00ce2e=c1481306261003 +c\:\\github\\uae4arm-rpi\\.git\\objects\\7d\\9bc32e49900a5586510c6a049b439375f747a2=c1481306261018 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\menu_config.gcc.rsp=c1484122776986 +c\:\\github\\uae4arm-rpi\\.git\\objects\\9f\\cb30cc483812f2422b71de22ea49600a0331c8=c1484825696362 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\fsusage.dep=c1484122781984 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\pfile.npd=c1482270754889 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ff\\f6c3da98925d12da29d2589aa8f2e4d9b15f78=c1484825696351 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cfgfile.dep=c1484122780388 +c\:\\github\\uae4arm-rpi\\src\\od-gles\\gles_gfx.cpp=c1483975652818 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\tmp0000000c.npa00=c1482252858460 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\263-272-264.ast=c1483653416956 +c\:\\github\\uae4arm-rpi\\.git\\objects\\pack\\pack-7ad39492489ca079795a64ca1fc4bfa968a6ae5a.idx=c1481561869264 +c\:\\github\\uae4arm-rpi\\.git\\objects\\06\\2d2267572ecf2f353acc130629e0a549bdf1ce=c1483975583653 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\showmessage.gcc.rsp=c1484122776973 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\memory.npd=c1482270757504 +c\:\\github\\uae4arm-rpi\\src\\include\\mackbd.h=c1483975652701 +c\:\\github\\uae4arm-rpi\\visualgdb\\amiberry\\amiberry.vcxproj.filters=c1484825696568 +c\:\\github\\uae4arm-rpi\\.git\\objects\\69\\1a10ff5016143d07fce30ffbcf4000bfbed4b2=c1484825696265 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\panelinput.cpp=c1483975652884 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\uae_lha.npa00=c1482270755075 +c\:\\github\\uae4arm-rpi\\.git\\objects\\a6\\8f0b18f45edc56fe0ef916fec41010b76efbfa=c1481616215316 +c\:\\github\\uae4arm-rpi\\src\\osdep\\pandora_input.cpp=c1484825662958 +c\:\\github\\uae4arm-rpi\\.git\\objects\\4c\\2087005760483e4fb4bb9b8a41978bdcb3367c=c1481890553000 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\u_quick.dep=c1484122778260 +c\:\\github\\uae4arm-rpi\\.git\\objects\\fa\\12997f48f09a2f51a76231d93345209f23e975=c1482225287779 +c\:\\github\\uae4arm-rpi\\.git\\logs\\refs\\remotes\\midwan\\winuae-3.4.0=c1483975584074 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\142-143-144.ast=c1483653089390 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\fpp.gcc.rsp=c1484122776884 +c\:\\github\\uae4arm-rpi\\.git\\objects\\54\\4b691063553e2398dbc779d9b02eef4dd02181=c1481616215322 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\diskutil.gcc.rsp=c1484122776874 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\blkdev_cdimage.gcc.rsp=c1484122776847 +c\:\\github\\uae4arm-rpi\\.git\\objects\\b8\\4b0463a11f8db13ca137fd6aeb2e30cbef705b=c1481890553000 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\142.psf=c1482401347150 +c\:\\github\\uae4arm-rpi\\.git\\objects\\47\\0bc95c5b7012310d76a4b491e800a8c7441e07=c1484929344194 +c\:\\github\\uae4arm-rpi\\src\\archivers\\lha\\crcio.cpp=c1483975652469 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry-gles\\codedb.lck=c1484123625728 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\expansion.gcc.rsp=c1484122776880 +c\:\\github\\uae4arm-rpi\\src\\trace.c=c1483975653021 +c\:\\github\\uae4arm-rpi\\src\\include\\zarchive.h=c1483975652742 +c\:\\github\\uae4arm-rpi\\.git\\objects\\06\\5b3285a9071553a7979a51365d6fae816c1b5b=c1483975583981 +c\:\\github\\uae4arm-rpi\\src\\jit\\compemu.h=c1483975652763 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\fsdb_host.dep=c1484122784848 +c\:\\github\\uae4arm-rpi\\.git\\objects\\e1\\7cb29204159c34e58626f355de2e7891950512=c1483975583635 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\zfile.gcc.rsp=c1484122777027 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\header.dep=c1484122778553 +c\:\\github\\uae4arm-rpi\\src\\events.cpp=c1483975652604 +c\:\\github\\uae4arm-rpi\\src\\include\\execlib.h=c1483975652672 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\crc_csum.dep=c1484122777924 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\sdltruetypefont.dep=c1484122788820 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\blkdev.dep=c1484122779703 +c\:\\github\\uae4arm-rpi\\.git\\logs\\refs\\heads\\master=c1481274637579 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\u_rle.h=c1481274637818 +c\:\\github\\uae4arm-rpi\\src\\filesys.cpp=c1483975652616 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\inputdevice.rdb=c1482255473545 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\bcj2.gcc.rsp=c1484122776777 +c\:\\github\\uae4arm-rpi\\.git\\objects\\6d\\5140a9e1aaa997aef72ba5c219a2321e7cf2cc=c1484825696375 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\uaelib.dep=c1484122791722 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\bcj2.cpp=c1483975652425 +c\:\\github\\uae4arm-rpi\\visualgdb\\amiberry\\amiberry-debug.vgdbsettings=c1484825696554 +c\:\\github\\uae4arm-rpi\\.git\\objects\\eb\\aa207a17eeb9ac5d28d4f1032247c67277cadd=c1483975586342 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\uaeradiobutton.dep=c1484122789996 +c\:\\github\\uae4arm-rpi\\.git\\objects\\3d\\8ede511ca05a78453ab60499180e0c3fb9e3cf=c1481294072231 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\1003-1004-1005.psf=c1484123421483 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ed\\02b120b41a50de1bb60b9089221d1755498779=c1484825696419 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\tables.cpp=c1483975652453 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\autoconf.gcc.rsp=c1484122776835 +c\:\\github\\uae4arm-rpi\\.git\\objects\\26\\aad7a91697af0f0b6daaa89d91ad6a0c4d85d1=c1483975583898 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\savestate.npa00=c1482270762217 +c\:\\github\\uae4arm-rpi\\.git\\objects\\e7\\441ebcaaafe7d0f81cc8398e07277e4f1b9154=c1484825696380 +c\:\\github\\uae4arm-rpi\\vslinux\\amiberry.vcxproj.filters=c1484929344359 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelram.dep=c1484122788356 +c\:\\github\\uae4arm-rpi\\src\\archivers\\lha\\slide.cpp=c1481561902488 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\262.psf=c1481895596734 +c\:\\github\\uae4arm-rpi\\src\\include\\gensound.h=c1483975652687 +c\:\\github\\uae4arm-rpi\\.git\\objects\\fb\\baa20a6930b71859e26b1dc9ab19e32cd181d1=c1484825696382 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zalloc.dep=c1484122777638 +c\:\\github\\uae4arm-rpi\\.git\\objects\\f0\\84c8faed0b70afeaae1ffee3ed9dd93ccd4358=c1484825696232 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\main.dep=c1484122783904 +c\:\\github\\uae4arm-rpi\\.git\\objects\\22\\5e4960c190a2d87dda2e5a526108f1d164a226=c1481294072244 +c\:\\github\\uae4arm-rpi\\.git\\objects\\02\\ccbae6ca95dc6dd4280b90a1a2571eb979d30f=c1483975586507 +c\:\\github\\uae4arm-rpi\\.git\\objects\\bd\\b792c2531ed34ab07e51c94999ef07c81189f9=c1481294220000 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\lzmadec.gcc.rsp=c1484122776783 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\sdltruetypefont.gcc.rsp=c1484122776965 +c\:\\github\\uae4arm-rpi\\src\\include\\custom.h=c1483975652658 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\compstbl.gcc.rsp=c1484122776904 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\filesys.npa00=c1482264965173 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\tmp00000012.npd=c1482141692244 +c\:\\github\\uae4arm-rpi\\src\\include\\gui.h=c1483975652694 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\uaelib.gcc.rsp=c1484122777024 +c\:\\github\\uae4arm-rpi\\.git\\logs\\refs\\heads\\modifierbutton=c1481890553806 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\navigation.dep=c1484122787240 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\u_quick.h=c1481274637815 +c\:\\github\\uae4arm-rpi\\.git\\refs\\remotes\\origin\\cfgfile_cleanup=c1482424248842 +c\:\\github\\uae4arm-rpi\\.git\\objects\\27\\efbf2e03bca225bff4abd48b8afb6f6a0994f2=c1484825696293 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\pandora_input.npa00=c1483652868270 +c\:\\github\\uae4arm-rpi\\.git\\objects\\62\\4ffba348bcba5852deebe93b00a22f2180ce44=c1484825696377 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\zfile_archive.npd=c1482264972712 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\events.dep=c1484122781047 +c\:\\github\\uae4arm-rpi\\readme_pandora.txt=c1481561902364 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\bra.cpp=c1483975652427 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\uaeradiobutton.hpp=c1483975652925 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cia.gcc.rsp=c1484122776857 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\larc.dep=c1484122778529 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\custom.npd=c1482270756061 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\filesys.npd=c1482264965182 +c\:\\github\\uae4arm-rpi\\.git\\objects\\2b\\73d062314d07fc513783421d2ea8efa6af32ac=c1484825696244 +c\:\\github\\uae4arm-rpi\\src\\audio.cpp=c1483975652547 +c\:\\github\\uae4arm-rpi\\.git\\objects\\d1\\744daf2b87b8d3cda01802f9af8b10f1e516c0=c1484825696406 +c\:\\github\\uae4arm-rpi\\.git\\objects\\6d\\e67396274cb09ba133ea40619548b5b9cec1fc=c1481616215265 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\zfile_archive.gcc.rsp=c1484122777029 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\lzmadec.dep=c1484122778074 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\fsusage.gcc.rsp=c1484122776890 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ab\\4ada66669c287b5342a95855edbaa03a677195=c1484825696298 +c\:\\github\\uae4arm-rpi\\src\\threaddep\\thread.h=c1483975653017 +c\:\\github\\uae4arm-rpi\\.git\\objects\\14\\74a6e03526d15f551a64b7c78c52dee5155262=c1484825696254 +c\:\\github\\uae4arm-rpi\\src\\include\\fpp-ieee-be.h=c1483975652676 +c\:\\github\\uae4arm-rpi\\.git\\objects\\pack\\pack-7ad39492489ca079795a64ca1fc4bfa968a6ae5a.pack=c1483975586000 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\tmp00000012.npa00=c1482141692235 +c\:\\github\\uae4arm-rpi\\src\\od-gles\\gl.h=c1483974687555 +c\:\\github\\uae4arm-rpi\\src\\include\\blitfunc.h=c1481274638032 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\uaeresource.gcc.rsp=c1484122777025 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\selectorentry.hpp=c1483975652905 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\blitops.dep=c1484122778940 +c\:\\github\\uae4arm-rpi\\src\\include\\calc.h=c1481561902713 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\huf.gcc.rsp=c1484122776810 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\cfgfile.npa00=c1482423936795 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\rasp_gfx.npa00=c1482264972864 +c\:\\github\\uae4arm-rpi\\src\\archivers\\lha\\uae_lha.cpp=c1483975652498 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\pandora_mem.dep=c1484122790590 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\1003-1004.psf=c1484123207955 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\globalcache\\000\\names.idx=c1483653422085 +c\:\\github\\uae4arm-rpi\\.git\\objects\\37\\20d2a754eaced2c9612752e4ca2ce9579885e8=c1484825696303 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\globalcache\\000\\globaltrees.dat=c1482264973367 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ac\\701b7dda02d4b108c905042475ba8b0b826362=c1484825696364 +c\:\\github\\uae4arm-rpi\\.git\\objects\\cb\\8b975d53506d4361e6962af2b5d624882c8b40=c1482400900832 +c\:\\github\\uae4arm-rpi\\.git\\objects\\75\\2e35e989efe347538a8120195e02bfb6f9f657=c1483975586402 +c\:\\github\\uae4arm-rpi\\visualgdb\\amiberry-gles\\amiberry-gles.vcxproj.filters=c1484825696549 +c\:\\github\\uae4arm-rpi\\.git\\hooks\\applypatch-msg.sample=c1481274630550 +c\:\\github\\uae4arm-rpi\\src\\include\\clipboard.h=c1481561902718 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\sdltruetypefont.hpp=c1483975652932 +c\:\\github\\uae4arm-rpi\\data\\cpu.ico=c1481274637672 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\bra.dep=c1484122777939 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\bcj2.h=c1481274637754 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\archive\\7z\\7zin.h=c1483975652419 +c\:\\github\\uae4arm-rpi\\src\\calc.cpp=c1483975652576 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\cia.npa00=c1482232745698 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\fsdb_unix.dep=c1484122781770 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelsavestate.gcc.rsp=c1484122776961 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\uaeradiobutton.gcc.rsp=c1484122776981 +c\:\\github\\uae4arm-rpi\\.git\\objects\\6c\\ab013464f386ae2a294fb3488c6c48768024e2=c1484825696389 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\tmp00000003.npa00=c1483654168308 +c\:\\github\\uae4arm-rpi\\.git\\objects\\63\\6ab821927d55d81582c871d3975c1bf05adcd7=c1483975583984 +c\:\\github\\uae4arm-rpi\\data\\joystick.bmp=c1481274637683 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\1003.psf=c1484123207854 +c\:\\github\\uae4arm-rpi\\.git\\objects\\f3\\d31d2693d0b3c0f6476b65631ce61bc33ad68f=c1484825696355 +c\:\\github\\uae4arm-rpi\\src\\include\\keyboard.h=c1481561903010 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelhd.dep=c1484122788153 +c\:\\github\\uae4arm-rpi\\src\\osdep\\pandora_rp9.cpp=c1483975652970 +c\:\\github\\uae4arm-rpi\\.git\\objects\\c5\\0ff38dab8ef223835a49e42f396137d1c3354a=c1484825696412 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ee\\398a652262810f96642b2a00cd293b7821ab1d=c1482400900827 +c\:\\github\\uae4arm-rpi\\src\\uaeresource.cpp=c1483975653036 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\support.dep=c1484122783676 +c\:\\github\\uae4arm-rpi\\.git\\objects\\74\\520a612a79ba6eff2c469adfa1b79b06abc992=c1484825696359 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\unlzx.npa00=c1482264963689 +c\:\\github\\uae4arm-rpi\\.git\\objects\\80\\92f51f4e07f3d92d4af726e62f6567c32310ff=c1482400900418 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\pandora_gui.npa00=c1482264972810 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\mp3decoder.dep=c1484122790085 +c\:\\github\\uae4arm-rpi\\src\\include\\xwin.h=c1483975652741 +c\:\\github\\uae4arm-rpi\\src\\blkdev.cpp=c1483975652562 +c\:\\github\\uae4arm-rpi\\.git\\objects\\f8\\ced57c9b61771c78624010da461066634ea937=c1484825696372 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\tmp0000000b.npa00=c1482082595365 +c\:\\github\\uae4arm-rpi\\src\\osdep\\pandora_filesys.cpp=c1483975652955 +c\:\\github\\uae4arm-rpi\\.git\\hooks\\pre-receive.sample=c1481274630573 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\crc_csum.gcc.rsp=c1484122776785 +c\:\\github\\uae4arm-rpi\\src\\uaelib.cpp=c1483975653033 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\sigsegv_handler.npa00=c1482270761618 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\u_heavy.gcc.rsp=c1484122776796 +c\:\\github\\uae4arm-rpi\\.git\\objects\\3e\\724eded297cbccae2ac66faefb5aa514843c33=c1483975583776 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\custom.npa00=c1482264964640 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\7zbuf.cpp=c1483975652393 +c\:\\github\\uae4arm-rpi\\.git\\refs\\heads\\sdl2=c1481561903396 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\selectfolder.cpp=c1483975652903 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\zfile.npa00=c1482264972955 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\bra86.gcc.rsp=c1484122776781 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\filesys.npd=c1482270756515 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\writelog.gcc.rsp=c1484122777009 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ca\\55ad1782107dda12c8726d0b5af3fa4dfd42cc=c1484825696296 +c\:\\github\\uae4arm-rpi\\.git\\objects\\95\\fba815f0f24ba58a0ed0f73340cd29f181a989=c1483975584013 +c\:\\github\\uae4arm-rpi\\src\\include\\drawing.h=c1483975652664 +c\:\\github\\uae4arm-rpi\\src\\akiko.cpp=c1484901522846 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\selectfile.cpp=c1483975652902 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\rommgr.dep=c1484122791687 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelsavestate.dep=c1484122788982 +c\:\\github\\uae4arm-rpi\\.git\\objects\\pack\\pack-efbf07322eb0bd7342e9ac0a787a71a031cf12f3.idx=c1481274637516 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\blitops.gcc.rsp=c1484122776839 +c\:\\github\\uae4arm-rpi\\.git\\objects\\78\\d833afdfa42f1fa049c91d8e1e03a5f33b5acf=c1482400900799 +c\:\\github\\uae4arm-rpi\\data\\savestate.png=c1481274637696 +c\:\\github\\uae4arm-rpi\\.git\\objects\\92\\c03dc3eb6e869cba1b97d7a6f7ac79d5859792=c1483975583989 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\drawing.npa00=c1482264964752 +c\:\\github\\uae4arm-rpi\\src\\keybuf.cpp=c1481561903135 +c\:\\github\\uae4arm-rpi\\src\\drawing.cpp=c1483975652603 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\panelconfig.cpp=c1483975652870 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\u_heavy.dep=c1484122778277 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\u_quick.gcc.rsp=c1484122776801 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ad\\2401a470df04c26270e5935af01af33f72c800=c1484825696252 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\aros.rom.dep=c1484122781862 +c\:\\github\\uae4arm-rpi\\src\\od-gles\\shader_stuff.h=c1483975652826 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\disk.gcc.rsp=c1484122776872 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\native2amiga.dep=c1484122784014 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\pandora_input.rdb=c1483656122949 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\pandora.npd=c1482264972607 +c\:\\github\\uae4arm-rpi\\.git\\objects\\pack\\pack-ad52f26f3aa4306cf3102368106d8667b6757751.pack=c1483975586000 +c\:\\github\\uae4arm-rpi\\src\\include\\keybuf.h=c1481561903012 +c\:\\github\\uae4arm-rpi\\src\\cpustbl.cpp=c1481561902602 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\bra.gcc.rsp=c1484122776779 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\u_deep.gcc.rsp=c1484122776794 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\audio.gcc.rsp=c1484122776833 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\panelfloppy.cpp=c1483975652877 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\newcpu.npa00=c1482264966126 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\main_window.npa00=c1482237112521 +c\:\\github\\uae4arm-rpi\\src\\include\\disk.h=c1481561902736 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\savestate.npd=c1482270762226 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\amiberry.alldeps=c1484123329012 +c\:\\github\\uae4arm-rpi\\src\\include\\commpipe.h=c1483975652654 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\u_init.h=c1481274637807 +c\:\\github\\uae4arm-rpi\\.git\\objects\\50\\52d26925ede742875f4557d474f9cf4e949d3a=c1484825696271 +c\:\\github\\uae4arm-rpi\\nbproject\\private\\tools\\pi_retropie_22\\gnu\\gcc=c1484930192140 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\u_init.gcc.rsp=c1484122776797 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cia.dep=c1484122780127 +c\:\\github\\uae4arm-rpi\\.git\\sourcetreeconfig=c1483975685684 +c\:\\github\\uae4arm-rpi\\src\\archivers\\lha\\huf.cpp=c1483975652481 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\editfilesysvirtual.gcc.rsp=c1484122776933 +c\:\\github\\uae4arm-rpi\\.git\\objects\\a7\\d99bdaf04a2538bf62499bf6749eba07fec655=c1481294222331 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\bra.h=c1481274637759 +c\:\\github\\uae4arm-rpi\\.git\\objects\\e7\\4a06c89d3352fbd83c732a7cf189ef05291ec4=c1484929344090 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\pandora_filesys.gcc.rsp=c1484122776995 +c\:\\github\\uae4arm-rpi\\.git\\objects\\66\\f86df482d182cb20c17d7edba68299fe737484=c1483975583657 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\rasp_gfx.npd=c1482264972873 +c\:\\github\\uae4arm-rpi\\.git\\objects\\3b\\db5b4b127e09cec81d6f0d9f07343f0775bd24=c1483975583911 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelchipset.gcc.rsp=c1484122776940 +c\:\\github\\uae4arm-rpi\\.git\\objects\\b3\\7bb057f3172a5019a7fc0c3034ed288760c23e=c1481306261000 +c\:\\github\\uae4arm-rpi\\.git\\hooks\\update.sample=c1481274630581 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\unlzx.npa00=c1482270755074 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\ingamemessage.dep=c1484122785607 +c\:\\github\\uae4arm-rpi\\.git\\objects\\c8\\a859ed2c444078c2b33606f4c9158b53128d8a=c1484825696366 +c\:\\github\\uae4arm-rpi\\.git\\refs\\stash=c1484929344223 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\7zcrc.h=c1481274637719 +c\:\\github\\uae4arm-rpi\\.git\\objects\\8c\\8e3eece81ebc88cbae81618c405b9641a4a16a=c1482400900436 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\pandora_input-00001.npa00~rf428e017.tmp=c1484122757597 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\keybuf.dep=c1484122783318 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\filesys.gcc.rsp=c1484122776882 +c\:\\github\\uae4arm-rpi\\src\\blitter.cpp=c1481561902544 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\uaeradiobutton.cpp=c1483975652923 +c\:\\github\\uae4arm-rpi\\src\\archivers\\lha\\lha_macro.h=c1481274637836 +c\:\\github\\uae4arm-rpi\\src\\jit\\gencomp_arm.cpp=c1481561903132 +c\:\\github\\uae4arm-rpi\\.git\\objects\\64\\050d2bd619677b5104219c32b4977f1b46c467=c1483975583665 +c\:\\github\\uae4arm-rpi\\.git\\objects\\12\\a5054065814bd45d5c681b4489bbec1596cf7e=c1484929344103 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\drawing.npd=c1482264964761 +c\:\\github\\uae4arm-rpi\\.git\\objects\\cf\\0565e1d973b85ec81bc41a823fbaee710bf1ec=c1481306261009 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\custom.gcc.rsp=c1484122776870 +c\:\\github\\uae4arm-rpi\\.git\\objects\\97\\0d0e7c870e741dadd5bb6711333e5852f4ef84=c1483975583763 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\zfile.npa00=c1482270762685 +c\:\\github\\uae4arm-rpi\\.git\\objects\\20\\884e1277a3af89f185c10e5c927006a53e4257=c1484825696391 +c\:\\github\\uae4arm-rpi\\.git\\objects\\77\\cdaf3c149ac3109202770809399240398f5ed8=c1481890553760 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\showmessage.cpp=c1483975652906 +c\:\\github\\uae4arm-rpi\\src\\osdep\\pandora_gui.cpp=c1483975652962 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\memory.gcc.rsp=c1484122776913 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelrom.gcc.rsp=c1484122776959 +c\:\\github\\uae4arm-rpi\\.git\\objects\\08\\e1d3872db5644ef90418b8f6d94bc6e3adada0=c1483975586332 +c\:\\github\\uae4arm-rpi\\src\\filesys.asm=c1481561902629 +c\:\\github\\uae4arm-rpi\\src\\od-gles\\shader_stuff.cpp=c1483975652822 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\selectorentry.cpp=c1483975652904 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\util.dep=c1484122778770 +c\:\\github\\uae4arm-rpi\\.git\\objects\\09\\b77bd369412b8f1263727280a1508e4eda643a=c1481294048268 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\newcpu.npd=c1482264966149 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\sound_sdl_new.npd=c1482264972423 +c\:\\github\\uae4arm-rpi\\.git\\objects\\11\\a63f29be981f00b21792e9bc4953c40775da71=c1481616215286 +c\:\\github\\uae4arm-rpi\\.git\\objects\\5b\\13a899c7eede42c8e315ad7d8df4795b298d8b=c1482400900847 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\u_rle.dep=c1484122778268 +c\:\\github\\uae4arm-rpi\\visualgdb\\.vs\\amiberry\\v14\\.suo=c1484902928366 +c\:\\github\\uae4arm-rpi\\src\\osdep\\sysconfig.h=c1483975652988 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\pandora_input.npd=c1482264971856 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\1003-1004-1024.ast=c1484122873130 +c\:\\github\\uae4arm-rpi\\.git\\objects\\85\\813a3a646b79ccc1aad280f94c558219bc86bc=c1484825696402 +c\:\\github\\uae4arm-rpi\\src\\include\\diskutil.h=c1481274638065 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\pandora.npd=c1483653682735 +c\:\\github\\uae4arm-rpi\\visualgdb\\amiberry.sln=c1484825696552 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\zfile_archive.npa00=c1482270762351 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\sdltruetypefont.cpp=c1483975652931 +c\:\\github\\uae4arm-rpi\\.git\\objects\\f7\\de2ac4ac1cc78bc9fb3cb73ad4b5050ff210cd=c1482225287806 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\custom.npa00=c1482270756053 +c\:\\github\\uae4arm-rpi\\src\\include\\events.h=c1483975652667 +c\:\\github\\uae4arm-rpi\\.git\\objects\\9c\\aa068476baebc044c82c8a4777678adb7b9642=c1481619410913 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cpuemu_4.dep=c1484122786352 +c\:\\github\\uae4arm-rpi\\data\\file.ico=c1481274637680 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\tmp00000007.npa00=c1483656651303 +c\:\\github\\uae4arm-rpi\\.git\\objects\\78\\960d261bc68c5d08a7d46a7eff0e2f1a073da8=c1483975586243 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\u_deep.dep=c1484122778125 +c\:\\github\\uae4arm-rpi\\src\\osdep\\keyboard.cpp=c1483975652939 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\uaelistbox.gcc.rsp=c1484122776978 +c\:\\github\\uae4arm-rpi\\src\\jit\\codegen_arm.cpp=c1483975652753 +c\:\\github\\uae4arm-rpi\\.git\\config=c1483975685670 +c\:\\github\\uae4arm-rpi\\.git\\orig_head=c1484929399751 +c\:\\github\\uae4arm-rpi\\.git\\objects\\d5\\8dbe631a47e1a9ab8d6915d0059a2d20bf68cc=c1482400900498 +c\:\\github\\uae4arm-rpi\\src\\include\\osemu.h=c1483975652717 +c\:\\github\\uae4arm-rpi\\.git\\logs\\refs\\heads\\controller_config=c1484825696594 +c\:\\github\\uae4arm-rpi\\src\\include\\uaeresource.h=c1481274638157 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\rasp_gfx.npa00=c1482270762565 +c\:\\github\\uae4arm-rpi\\.git\\objects\\fb\\63299b1aaf775efc9b9dcee5e8112d41d53b85=c1483975584022 +c\:\\github\\uae4arm-rpi\\src\\aros.rom.cpp=c1483975652542 +c\:\\github\\uae4arm-rpi\\src\\rommgr.cpp=c1483975652999 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\lharc.dep=c1484122778529 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelrom.dep=c1484122789022 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\142-143.ast=c1482401347731 +c\:\\github\\uae4arm-rpi\\visualgdb\\amiberry\\amiberry.vcxproj=c1484825696564 +c\:\\github\\uae4arm-rpi\\src\\genblitter.cpp=c1483975652629 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\compemu_support.dep=c1484122784420 +c\:\\github\\uae4arm-rpi\\src\\include\\genblitter.h=c1483975652685 +c\:\\github\\uae4arm-rpi\\src\\include\\picasso96.h=c1481561903034 +c\:\\github\\uae4arm-rpi\\.git\\objects\\bf\\554a67186324bd3cc2f178e54541085f35e0e2=c1483975586445 +c\:\\github\\uae4arm-rpi\\.git\\objects\\05\\56a37dade4660e11a0228f71eecd2378b4e71c=c1482424233893 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\paneldisplay.cpp=c1483975652873 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\maketbl.h=c1481274637786 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\pfile.cpp=c1483975652451 +c\:\\github\\uae4arm-rpi\\src\\fsdb_unix.cpp=c1481561902653 +c\:\\github\\uae4arm-rpi\\.git\\objects\\94\\d5256149a0cbb766fd48466caf9bf77209f34b=c1484825696275 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\pandora_gui.npd=c1482270762389 +c\:\\github\\uae4arm-rpi\\readme.md=c1484825696522 +c\:\\github\\uae4arm-rpi\\src\\osdep\\pandora_gfx.cpp=c1483975652959 +c\:\\github\\uae4arm-rpi\\.git\\refs\\remotes\\origin\\quitbutton=c1481619424166 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\newcpu.npa00=c1482270757662 +c\:\\github\\uae4arm-rpi\\src\\machdep\\support.cpp=c1483975652788 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\drawing.npd=c1482270756193 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\expansion.npd=c1482270756059 +c\:\\github\\uae4arm-rpi\\src\\od-gles\\gl_platform.cpp=c1483975652814 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\inputdevice.gcc.rsp=c1484122776897 +c\:\\github\\uae4arm-rpi\\visualgdb\\amiberry-gles\\amiberry-gles.vcxproj=c1484825696546 +c\:\\github\\uae4arm-rpi\\.git\\objects\\2f\\e94a6d27dcc59efc12bc2ff468c4d579afcebb=c1484929344136 +c\:\\github\\uae4arm-rpi\\src\\fsdb.cpp=c1481561902643 +c\:\\github\\uae4arm-rpi\\.git\\objects\\5e\\5f4fe4bf50a69642e8e04313a58f2b1ab3000c=c1483975586692 +c\:\\github\\uae4arm-rpi\\.git\\objects\\b8\\0e0349c23b3ec32f5362b2b6b2d6dda0427172=c1481890427959 +c\:\\github\\uae4arm-rpi\\src\\archivers\\lha\\larc.cpp=c1483975652485 +c\:\\github\\uae4arm-rpi\\src\\include\\readcpu.h=c1481561903037 +c\:\\github\\uae4arm-rpi\\.git\\objects\\27\\dc0419ac1908197ff4d828c8dd08014ec923dc=c1482225287808 +c\:\\github\\uae4arm-rpi\\.git\\index=c1484930424100 +c\:\\github\\uae4arm-rpi\\savestates\\dir.txt=c1481274637706 +c\:\\github\\uae4arm-rpi\\.git\\objects\\0f\\1617abf5fbd8a6f90e2d06ddf00a38aef25a91=c1483975583772 +c\:\\github\\uae4arm-rpi\\.git\\objects\\33\\920199f2216c1f6f5afe880e2d26f293d5d72e=c1481294072234 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\memory.npd=c1482264966115 +c\:\\github\\uae4arm-rpi\\src\\osdep\\writelog.cpp=c1483975652990 +c\:\\github\\uae4arm-rpi\\src\\archivers\\wrp\\warp.h=c1481274637860 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\compemu_fpp.gcc.rsp=c1484122776901 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\inputdevice.npd=c1482255473149 +c\:\\github\\uae4arm-rpi\\.git\\objects\\c8\\9e86d8eb300c9ee247f4dad26b292b77e8b21c=c1483975586194 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\pandora_rp9.dep=c1484122790801 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\zfile.npd=c1482270762697 +c\:\\github\\uae4arm-rpi\\src\\readcpu.cpp=c1481561903339 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\rasp_gfx.npd=c1482270762579 +c\:\\github\\uae4arm-rpi\\src\\p96_blit.cpp=c1483975652994 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\amiberry.link.rsp=c1484123327587 +c\:\\github\\uae4arm-rpi\\.git\\objects\\d2\\294b4cec45fffd6844d4b589ceee9908dd965e=c1483975586165 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zstream.dep=c1484122777653 +c\:\\github\\uae4arm-rpi\\.git\\objects\\22\\8abd4970a29a377a6143765cb12dff4cab141a=c1484825696399 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ce\\ec8305f977d4e76747dc0738a58701656ddf36=c1484825696369 +c\:\\github\\uae4arm-rpi\\src\\include\\blkdev.h=c1483975652647 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\u_medium.h=c1481274637811 +c\:\\github\\uae4arm-rpi\\src\\jit\\compemu_midfunc_arm.h=c1481561903112 +c\:\\github\\uae4arm-rpi\\.git\\objects\\af\\aee542a3ee0579d91da224d4da499b90d75dfb=c1481890553771 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\sigsegv_handler.npd=c1482264972027 +c\:\\github\\uae4arm-rpi\\.git\\objects\\18\\448f75ce78dad4de33111def7b86346977652c=c1484825696278 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\crc_csum.cpp=c1483975652444 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zalloc.gcc.rsp=c1484122776765 +c\:\\github\\uae4arm-rpi\\src\\include\\ersatz.h=c1483975652666 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry.vc.db=c1484123625762 +c\:\\github\\uae4arm-rpi\\.git\\objects\\75\\7a5d23df15c7fdc7a6853d3611df3534f842ee=c1484825696249 +c\:\\github\\uae4arm-rpi\\src\\sounddep\\sound.h=c1483975653012 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\globalcache\\000\\symboldefs.dat=c1483653422055 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\savestate.dep=c1484122791610 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\globalcache\\000\\symboldefs.dat=c1482264973356 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelsound.dep=c1484122789253 +c\:\\github\\uae4arm-rpi\\src\\include\\newcpu.h=c1483975652711 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\panelcpu.cpp=c1483975652863 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\uaecheckbox.dep=c1484122789636 +c\:\\github\\uae4arm-rpi\\src\\osdep\\bsdsocket_host.cpp=c1483975652833 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\globalcache\\000\\files.idx=c1482264973372 +c\:\\github\\uae4arm-rpi\\kickstarts\\dir.txt=c1481274637704 +c\:\\github\\uae4arm-rpi\\.git\\refs\\heads\\midwan-master=c1483974687733 +c\:\\github\\uae4arm-rpi\\.git\\objects\\e2\\2dc6ea1b25c8e4761a818cdc3989f1aaa69ce7=c1483975583884 +c\:\\github\\uae4arm-rpi\\src\\include\\cputbl.h=c1481561902727 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\panelsavestate.cpp=c1483975652896 +c\:\\github\\uae4arm-rpi\\.git\\objects\\1d\\1986b61db22198a467e7df69b4b86e4f4b504d=c1482400900421 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\archive\\7z\\7zextract.h=c1481274637738 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\memory.npa00=c1482264966094 +c\:\\github\\uae4arm-rpi\\src\\native2amiga.cpp=c1483975652800 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\hardfile_pandora.npd=c1482270760842 +c\:\\github\\uae4arm-rpi\\.git\\objects\\b9\\b7256903c97f75fb75d8a11c5b0c9e3511bc63=c1482400900412 +c\:\\github\\uae4arm-rpi\\.git\\objects\\da\\9b6465830e477357b5d1253d7127f7b95c6323=c1484825696225 +c\:\\github\\uae4arm-rpi\\src\\include\\zfile.h=c1481561903072 +c\:\\github\\uae4arm-rpi\\.git\\objects\\7a\\eabfddac4300a1a2641098e3c1c57756004bee=c1481890553764 +c\:\\github\\uae4arm-rpi\\data\\drive.ico=c1481274637675 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\u_heavy.h=c1481274637803 +c\:\\github\\uae4arm-rpi\\src\\cpuemu_4.cpp=c1481561902597 +c\:\\github\\uae4arm-rpi\\.git\\objects\\95\\66c29b51a39be36a5e55e4e1df01669c37a954=c1481890553798 +c\:\\github\\uae4arm-rpi\\.git\\objects\\49\\95cc7c5d3c0d89909f259c651f7388e17915bd=c1481890427965 +c\:\\github\\uae4arm-rpi\\.git\\logs\\refs\\remotes\\origin\\modifierbutton=c1481890577405 +c\:\\github\\uae4arm-rpi\\conf\\dir.txt=c1481274637652 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\lhamaketbl.dep=c1484122778524 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\263-272.ast=c1483653416906 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\main_window.npd=c1482237112535 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cpudefs.gcc.rsp=c1484122776859 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\paneldisplay.gcc.rsp=c1484122776946 +c\:\\github\\uae4arm-rpi\\nbproject\\private\\tools\\pi_retropie_22\\gnu\\g++=c1484930192169 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cpuemu_11.dep=c1484122787246 +c\:\\github\\uae4arm-rpi\\.git\\objects\\fd\\baa781b80ede0f28f85962a51bfc593805a08e=c1483975586484 +c\:\\github\\uae4arm-rpi\\.git\\objects\\3a\\c0a89e87516061ddeb142864af5a244a743bed=c1483975584017 +c\:\\github\\uae4arm-rpi\\.git\\objects\\4a\\eb2d2e29c4e26850ad96b1f9f2486fa18648f8=c1483975583674 +c\:\\github\\uae4arm-rpi\\vslinux\\readme.md=c1484825696537 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\disk.npa00=c1482270756037 +c\:\\github\\uae4arm-rpi\\src\\cdrom.cpp=c1483975652580 +c\:\\github\\uae4arm-rpi\\.git\\objects\\11\\6df30ce7cf67f12be9c24aa9bb77731906ace0=c1481890553768 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\main.npa00=c1482264849936 +c\:\\github\\uae4arm-rpi\\src\\include\\native2amiga_api.h=c1481274638121 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\gfxutil.dep=c1484122782229 +c\:\\github\\uae4arm-rpi\\.git\\objects\\24\\0b6588d90cfefe1349a6e109fcf6aed7714444=c1481890553000 +c\:\\github\\uae4arm-rpi\\.git\\objects\\06\\e2ead465049d93bc3f451aac123b1bd43e589b=c1481890427977 +c\:\\github\\uae4arm-rpi\\.git\\objects\\f2\\851a8b0e5356fe4c0cfcbf389754d280da8c5e=c1483975583752 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\u_init.cpp=c1483975652458 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\audio.dep=c1484122779328 +c\:\\github\\uae4arm-rpi\\.git\\objects\\36\\5e6dba6ddce08826956a7e89539c142666469a=c1482400900804 +c\:\\github\\uae4arm-rpi\\.git\\objects\\53\\e3c3ab38dd009c33089361af8281e8a24531ab=c1482400900643 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\diskutil.dep=c1484122780728 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zcrc.dep=c1484122777623 +c\:\\github\\uae4arm-rpi\\visualgdb\\readme.md=c1484825696573 +c\:\\github\\uae4arm-rpi\\src\\osdep\\sigsegv_handler.cpp=c1483975652985 +c\:\\github\\uae4arm-rpi\\.git\\objects\\5f\\48342c2ad7fe42137ecc2f99246e6d4e73e74e=c1483975584006 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\custom.npd=c1482264964651 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\editfilesyshardfile.gcc.rsp=c1484122776931 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\editfilesyshardfile.cpp=c1483975652850 +c\:\\github\\uae4arm-rpi\\.git\\objects\\dd\\5d5799ad23738e5f8b550c392ccd4b854e0fb7=c1481306261006 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\cfgfile.rdb=c1482423937066 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\keyboard.dep=c1484122790112 +c\:\\github\\uae4arm-rpi\\src\\archivers\\wrp\\warp.cpp=c1483975652510 +c\:\\github\\uae4arm-rpi\\visualgdb\\amiberry-gles\\amiberry-gles-release.vgdbsettings=c1484825696542 +c\:\\github\\uae4arm-rpi\\.git\\objects\\79\\019f8bcdd676b0500cbd9d6a671ea4a16173aa=c1481890553000 +c\:\\github\\uae4arm-rpi\\.git\\objects\\86\\b4a223eef732864a450fdec83bff74ff82677b=c1484825696336 +c\:\\github\\uae4arm-rpi\\.git\\hooks\\prepare-commit-msg.sample=c1481274630576 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\tmp00000011.npa00=c1482137240626 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\pandora_gui.dep=c1484122791372 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\statusline.gcc.rsp=c1484122777020 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelpaths.dep=c1484122788170 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\uae_lha.npd=c1482264963694 +c\:\\github\\uae4arm-rpi\\.git\\refs\\remotes\\midwan\\sdl2=c1481561869310 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\zfile.npd=c1482264972963 +c\:\\github\\uae4arm-rpi\\src\\osdep\\neon_helper.s=c1483975652950 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\tmp00000006.npa00=c1482331066637 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zin.dep=c1484122778089 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\bsdsocket_host.dep=c1484122784684 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\warp.gcc.rsp=c1484122776827 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\dhuf.gcc.rsp=c1484122776807 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\pandora_filesys.dep=c1484122790291 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\amiberry.log=c1484123329019 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\142.ast=c1482401347142 +c\:\\github\\uae4arm-rpi\\.git\\refs\\tags\\v0.4=c1481293789015 +c\:\\github\\uae4arm-rpi\\.git\\objects\\48\\0546251508ff317bc360daf34d44f9d848e659=c1481619410916 +c\:\\github\\uae4arm-rpi\\visualgdb\\amiberry-gles\\amiberry-gles.vcxproj.user=c1484825696550 +c\:\\github\\uae4arm-rpi\\.git\\objects\\63\\423d86995c103edc7960316319552b963f9016=c1483975583661 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\rommgr.npa00=c1482264972404 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\263.psf=c1483653416855 +c\:\\github\\uae4arm-rpi\\.git\\objects\\6c\\4d2cadeb4ba432b7ea39e77d560060d6f52d7c=c1483975586212 +c\:\\github\\uae4arm-rpi\\.git\\hooks\\commit-msg.sample=c1481274630553 +c\:\\github\\uae4arm-rpi\\.git\\objects\\5a\\0a97f5e0a112eda33f142642fccc1a1518be02=c1483975586182 +c\:\\github\\uae4arm-rpi\\.git\\hooks\\pre-push.sample=c1481274630565 +c\:\\github\\uae4arm-rpi\\.git\\objects\\90\\9facfa5b02dc5e76ed452ac0365666f088a4ac=c1484825696396 +c\:\\github\\uae4arm-rpi\\.git\\objects\\21\\de61311998c63180e9fea664f041da02592a8d=c1483975586432 +c\:\\github\\uae4arm-rpi\\.git\\objects\\fc\\68a0cc4f4a6ffd80ef8d51e743c962d8f438c6=c1484825696414 +c\:\\github\\uae4arm-rpi\\.git\\objects\\6a\\eed45ae90e3d9978b6d11c5e83600bbd25a8e2=c1481294222000 +c\:\\github\\uae4arm-rpi\\.git\\objects\\e7\\357981044d793047b3bdcd0653f7f0eb87eab3=c1483975583682 +c\:\\github\\uae4arm-rpi\\src\\od-gles\\gl_platform.h=c1483974687559 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\zfile_archive.npd=c1482270762362 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\sound_sdl_new.npa00=c1482264972415 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\rommgr.npd=c1482270762109 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\keyboard.gcc.rsp=c1484122776985 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\shuf.dep=c1484122778541 +c\:\\github\\uae4arm-rpi\\.git\\objects\\7f\\c543865398ae2c381bb4af761a1cafabda4372=c1484825696223 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\uaelistbox.dep=c1484122789732 +c\:\\github\\uae4arm-rpi\\src\\include\\fsusage.h=c1483975652682 +c\:\\github\\uae4arm-rpi\\.git\\objects\\2d\\6e66dba6ef458fd334a3d4e13d0b94a21fe859=c1481652869593 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\tmp00000002.npa00=c1481892024627 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\1003-1004-1005.ast=c1484123421478 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\expansion.dep=c1484122781441 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\ingamemessage.gcc.rsp=c1484122776935 +c\:\\github\\uae4arm-rpi\\.git\\objects\\86\\94e073d1269716f3148132fe3084386ea5a9d0=c1482400900620 +c\:\\github\\uae4arm-rpi\\.git\\objects\\63\\06e118c8ed2b93cb5ad7e9ffc7a5edebd986ff=c1484825696239 +c\:\\github\\uae4arm-rpi\\.git\\head=c1484929381094 +c\:\\github\\uae4arm-rpi\\src\\blkdev_cdimage.cpp=c1483975652566 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\archive\\7z\\7zalloc.cpp=c1483975652401 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cpustbl.dep=c1484122780383 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\262.ast=c1481895596725 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\unlzx.gcc.rsp=c1484122776825 +c\:\\github\\uae4arm-rpi\\.git\\objects\\98\\0bad2042c8de03c916555123b5e9b9ca492995=c1481890553775 +c\:\\github\\uae4arm-rpi\\src\\include\\inputdevice.h=c1483975652699 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ba\\5fe1113a8bcbfdeea504c1a203feb7d6a9d495=c1481616215331 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zin.gcc.rsp=c1484122776773 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\fpp.dep=c1484122781950 +c\:\\github\\uae4arm-rpi\\.git\\objects\\da\\468f1e2a614cc3ab936b8c0e37d715bcb5b4ab=c1483975583646 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\panelinput.npd=c1482223850495 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\pandora_input.npd=c1483652868274 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\tmp0000000a.npa00=c1482082595187 +c\:\\github\\uae4arm-rpi\\src\\jit\\compstbl.cpp=c1481561903126 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\filesys.dep=c1484122783265 +c\:\\github\\uae4arm-rpi\\src\\archivers\\lha\\util.cpp=c1483975652502 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\pandora_input-00001.rdb=c1484123366270 +c\:\\github\\uae4arm-rpi\\.git\\objects\\c5\\ee61486d5731b9b36b0dd21a75d93daf98b90f=c1482225287773 +c\:\\github\\uae4arm-rpi\\.git\\objects\\eb\\97fd88024bd87689f71f7481800217173754c2=c1481616215311 +c\:\\github\\uae4arm-rpi\\src\\include\\savestate.h=c1483975652727 +c\:\\github\\uae4arm-rpi\\src\\archivers\\zip\\unzip.h=c1483975652520 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\memory.npa00=c1482270757496 +c\:\\github\\uae4arm-rpi\\.git\\hooks\\post-update.sample=c1481274630556 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\sound_sdl_new.gcc.rsp=c1484122777018 +c\:\\github\\uae4arm-rpi\\.git\\objects\\51\\3920c79a44d12c1e9b846ff01b077ba4cc64b0=c1484825696230 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zitem.dep=c1484122777943 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\u_medium.dep=c1484122778256 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\main.rdb=c1482255474030 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\akiko.dep=c1484122778095 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\createfilesyshardfile.dep=c1484122785504 +c\:\\github\\uae4arm-rpi\\.git\\objects\\3e\\83211f15686b5353455d5c2bedfc2344f43773=c1481619410920 +c\:\\github\\uae4arm-rpi\\.git\\refs\\remotes\\origin\\modifierbutton=c1481890577396 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\newcpu_common.dep=c1484122784342 +c\:\\github\\uae4arm-rpi\\src\\include\\options.h=c1483975652716 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\hardfile_pandora.gcc.rsp=c1484122776983 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\calc.dep=c1484122779369 +c\:\\github\\uae4arm-rpi\\.git\\objects\\64\\01a6b981ac587d3c223c5110439398fa18e731=c1484825696234 +c\:\\github\\uae4arm-rpi\\.git\\objects\\f3\\e00f5b0e3d2dd39dfb406dc9c9465fb91d751e=c1483975586497 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\cfgfile.rdb=c1483652340105 +c\:\\github\\uae4arm-rpi\\src\\osdep\\pandora.cpp=c1483975652954 +c\:\\github\\uae4arm-rpi\\.git\\objects\\93\\75378c24c58ab34706166be299df2c195851c2=c1484825696285 +c\:\\github\\uae4arm-rpi\\.git\\objects\\3c\\cf9c9a3cccd67df0fa82cb3a5844ee39609380=c1481890553788 +c\:\\github\\uae4arm-rpi\\src\\statusline.cpp=c1481561903360 +c\:\\github\\uae4arm-rpi\\src\\archivers\\dms\\getbits.h=c1481274637782 +c\:\\github\\uae4arm-rpi\\.git\\objects\\df\\e78fb701c8ce4077b31b2c76a6b4cc631dad1f=c1484825696348 +c\:\\github\\uae4arm-rpi\\.git\\objects\\1d\\598da9f5147e3736323d8c77cd2525b3c41d5d=c1483975586552 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\uae_lha.npd=c1482270755086 +c\:\\github\\uae4arm-rpi\\src\\crc32.cpp=c1483975652589 +c\:\\github\\uae4arm-rpi\\.git\\objects\\pack\\pack-ad52f26f3aa4306cf3102368106d8667b6757751.idx=c1482225303022 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\unlzx.dep=c1484122778860 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\fsdb_unix.gcc.rsp=c1484122776888 +c\:\\github\\uae4arm-rpi\\.git\\objects\\fa\\b0b9cadf08db097ae5939b67813b3ded710a0d=c1483975583639 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\tmp00000009.npa00=c1482264942252 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\globalcache\\000\\files.idx=c1483653422070 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\main_window.dep=c1484122786412 +c\:\\github\\uae4arm-rpi\\.git\\objects\\9c\\37c28f17ce141f3be1040beb52663936e890ac=c1484929344097 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\pandora_input-00001.npa00=c1484123239824 +c\:\\github\\uae4arm-rpi\\.git\\objects\\5c\\273edc4ccb7d122044e842d7bbbb018352c04f=c1483975583642 +c\:\\github\\uae4arm-rpi\\.git\\objects\\b9\\972a4fa763ef66a71bd5c177c3548d6167071b=c1482225287811 +c\:\\github\\uae4arm-rpi\\src\\diskutil.cpp=c1483975652598 +c\:\\github\\uae4arm-rpi\\src\\savestate.cpp=c1483975653004 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\tables.dep=c1484122778083 +c\:\\github\\uae4arm-rpi\\.git\\objects\\07\\c2c1e59df8f2f862d986c60dea1de6480153df=c1484825696256 +c\:\\github\\uae4arm-rpi\\.git\\objects\\2f\\363dae13921e1d74d11eb14d5fb444382bfc7b=c1484825696305 +c\:\\github\\uae4arm-rpi\\src\\archivers\\lha\\shuf.cpp=c1483975652496 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\archive\\7z\\7zheader.h=c1483975652414 +c\:\\github\\uae4arm-rpi\\.git\\logs\\refs\\remotes\\origin\\quitbutton=c1481619424175 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\codedb.lck=c1484123394322 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\uaecheckbox.hpp=c1483975652911 +c\:\\github\\uae4arm-rpi\\.git\\refs\\heads\\modifierbutton=c1481890553801 +c\:\\github\\uae4arm-rpi\\src\\osdep\\target.h=c1483975652989 +c\:\\github\\uae4arm-rpi\\src\\osdep\\rasp_gfx.cpp=c1484825696584 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\pandora_gui.npa00=c1482270762361 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\7zextract.dep=c1484122777630 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\main.gcc.rsp=c1484122776908 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\warp.dep=c1484122778821 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\hardfile_pandora.npd=c1482264971336 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelmisc.gcc.rsp=c1484122776954 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\bcj2.dep=c1484122777930 +c\:\\github\\uae4arm-rpi\\src\\archivers\\lha\\lha.h=c1483975652489 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\disk.npd=c1482264964634 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\savestate.npa00=c1482264972489 +c\:\\github\\uae4arm-rpi\\.git\\objects\\7a\\af93578b5e73581a6d4507dde70bb1b0f3fcc7=c1484825696387 +c\:\\github\\uae4arm-rpi\\vslinux\\amiberry.vc.db=c1484903569587 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\1003-1004.ast=c1484123207946 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\cpuemu_4.gcc.rsp=c1484122776865 +c\:\\github\\uae4arm-rpi\\src\\jit\\codegen_arm.h=c1483975652757 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\sigsegv_handler.gcc.rsp=c1484122777008 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\editfilesysvirtual.cpp=c1483975652854 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\uaecheckbox.gcc.rsp=c1484122776974 +c\:\\github\\uae4arm-rpi\\src\\cpudefs.cpp=c1481561902578 +c\:\\github\\uae4arm-rpi\\.git\\objects\\92\\20218652eae6f4b6d62f1d86a8c0e13ec8ccd2=c1484825696268 +c\:\\github\\uae4arm-rpi\\makefile=c1484825696519 +c\:\\github\\uae4arm-rpi\\.git\\objects\\95\\0e40df906adae123dab383052ebccd003f427c=c1481294222000 +c\:\\github\\uae4arm-rpi\\.git\\logs\\head=c1484929399755 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\rommgr.npa00=c1482270762093 +c\:\\github\\uae4arm-rpi\\src\\jit\\comptbl.h=c1481561903129 +c\:\\github\\uae4arm-rpi\\src\\cpuemu_11.cpp=c1481561902591 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\7zversion.h=c1481274637724 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\tmp0000000d.npa00=c1482265056020 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry.0001\\globalcache\\000\\macrorefs.dat=c1482264973363 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\archive\\7z\\7zdecode.cpp=c1483975652405 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\pandora_rp9.gcc.rsp=c1484122777002 +c\:\\github\\uae4arm-rpi\\.git\\objects\\07\\62bae8751d49250b8e41ee31cf67c99970c459=c1483975586718 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\expansion.npa00=c1482270756052 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\panelmisc.npa00=c1481895596458 +c\:\\github\\uae4arm-rpi\\src\\osdep\\gui\\navigation.cpp=c1483975652860 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\lzmadec.cpp=c1483975652435 +c\:\\github\\uae4arm-rpi\\amiberry\\visualgdb\\debug\\codedb\\amiberry\\autopch\\1003.ast=c1484123207845 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\calc.gcc.rsp=c1484122776851 +c\:\\github\\uae4arm-rpi\\visualgdb\\amiberry\\amiberry.vcxproj.user=c1484825696571 +c\:\\github\\uae4arm-rpi\\.git\\objects\\ce\\e285c781647fa87503a7085fc626ad12c54f5d=c1481890427989 +c\:\\github\\uae4arm-rpi\\.git\\objects\\c6\\b9528422548604c5ffcfb1b5b68560a4b1828c=c1484825696301 +c\:\\github\\uae4arm-rpi\\src\\osdep\\config.h=c1483975652842 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\dhuf.dep=c1484122778429 +c\:\\github\\uae4arm-rpi\\src\\archivers\\7z\\7zcrc.cpp=c1483975652398 +c\:\\github\\uae4arm-rpi\\src\\osdep\\cda_play.cpp=c1483975652837 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\drawing.gcc.rsp=c1484122776876 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\neon_helper.gcc.rsp=c1484122776990 +c\:\\github\\uae4arm-rpi\\.git\\packed-refs=c1481274637562 +c\:\\github\\uae4arm-rpi\\.git\\objects\\d3\\04cdaba0e3eaa2d46335a74046ed014470e425=c1481294072228 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\pandora.dep=c1484122791024 +c\:\\github\\uae4arm-rpi\\.git\\objects\\98\\0cd8a5c02fbad4ba8c974e0f8cff6fcfe7ac5a=c1482400900728 +c\:\\github\\uae4arm-rpi\\src\\od-gles\\gl.cpp=c1483975652812 +c\:\\github\\uae4arm-rpi\\src\\include\\rommgr.h=c1483975652721 +c\:\\github\\uae4arm-rpi\\src\\include\\blit.h=c1483975652645 +c\:\\github\\uae4arm-rpi\\nbproject\\project.xml=c1484931011652 +c\:\\github\\uae4arm-rpi\\.git\\objects\\7a\\8fabaf49121aff70d92ba1e6cb41cf6b04ca09=c1482400900599 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\picasso96.gcc.rsp=c1484122777004 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\panelchipset.dep=c1484122786464 +c\:\\github\\uae4arm-rpi\\.git\\commit_editmsg=c1482424233900 +c\:\\github\\uae4arm-rpi\\.gitattributes=c1484825696514 +c\:\\github\\uae4arm-rpi\\amiberry\\amiberry\\visualgdb\\debug\\blittable.dep=c1484122779088 +c\:\\github\\uae4arm-rpi\\.git\\objects\\3e\\2fd47dc80a8a497b87dfb89361ffad034d2aaa=c1482400900638 +c\:\\github\\uae4arm-rpi\\src\\include\\cia.h=c1483975652652 +c\:\\github\\uae4arm-rpi\\src\\include\\bsdsocket.h=c1483975652651 +c\:\\github\\uae4arm-rpi\\src\\traps.cpp=c1483975653027 diff --git a/nbproject/private/tools/localhost/GNU/g++ b/nbproject/private/tools/localhost/GNU/g++ new file mode 100644 index 00000000..2f5b3437 --- /dev/null +++ b/nbproject/private/tools/localhost/GNU/g++ @@ -0,0 +1,23 @@ +#!/bin/sh +#set -x +real_tool=/usr/bin/g++ +if [ -n "${__CND_BUILD_LOG__}" ]; then + OS=`uname`; + if [ $OS = Darwin -o $OS = FreeBSD ]; then + __CND_TEMP_FILE__=`mktemp -t nbwrapper` + else + __CND_TEMP_FILE__=`mktemp` + fi + echo "called: ${real_tool}" > ${__CND_TEMP_FILE__} + echo "\t`pwd`" >> ${__CND_TEMP_FILE__} + echo "\t${real_tool}" >> ${__CND_TEMP_FILE__} + for opt in "$@"; do + echo "\t${opt}" >> ${__CND_TEMP_FILE__} + done + echo >> ${__CND_TEMP_FILE__} + cat ${__CND_TEMP_FILE__} >> ${__CND_BUILD_LOG__} + rm ${__CND_TEMP_FILE__} +fi +PATH=`dirname "${real_tool}"`:${PATH} +export PATH +exec "${real_tool}" "$@" diff --git a/nbproject/private/tools/localhost/GNU/gcc b/nbproject/private/tools/localhost/GNU/gcc new file mode 100644 index 00000000..920c73a0 --- /dev/null +++ b/nbproject/private/tools/localhost/GNU/gcc @@ -0,0 +1,23 @@ +#!/bin/sh +#set -x +real_tool=/usr/bin/gcc +if [ -n "${__CND_BUILD_LOG__}" ]; then + OS=`uname`; + if [ $OS = Darwin -o $OS = FreeBSD ]; then + __CND_TEMP_FILE__=`mktemp -t nbwrapper` + else + __CND_TEMP_FILE__=`mktemp` + fi + echo "called: ${real_tool}" > ${__CND_TEMP_FILE__} + echo "\t`pwd`" >> ${__CND_TEMP_FILE__} + echo "\t${real_tool}" >> ${__CND_TEMP_FILE__} + for opt in "$@"; do + echo "\t${opt}" >> ${__CND_TEMP_FILE__} + done + echo >> ${__CND_TEMP_FILE__} + cat ${__CND_TEMP_FILE__} >> ${__CND_BUILD_LOG__} + rm ${__CND_TEMP_FILE__} +fi +PATH=`dirname "${real_tool}"`:${PATH} +export PATH +exec "${real_tool}" "$@" diff --git a/nbproject/private/tools/pi_cd32.home_22/GNU/g++ b/nbproject/private/tools/pi_cd32.home_22/GNU/g++ new file mode 100644 index 00000000..2f5b3437 --- /dev/null +++ b/nbproject/private/tools/pi_cd32.home_22/GNU/g++ @@ -0,0 +1,23 @@ +#!/bin/sh +#set -x +real_tool=/usr/bin/g++ +if [ -n "${__CND_BUILD_LOG__}" ]; then + OS=`uname`; + if [ $OS = Darwin -o $OS = FreeBSD ]; then + __CND_TEMP_FILE__=`mktemp -t nbwrapper` + else + __CND_TEMP_FILE__=`mktemp` + fi + echo "called: ${real_tool}" > ${__CND_TEMP_FILE__} + echo "\t`pwd`" >> ${__CND_TEMP_FILE__} + echo "\t${real_tool}" >> ${__CND_TEMP_FILE__} + for opt in "$@"; do + echo "\t${opt}" >> ${__CND_TEMP_FILE__} + done + echo >> ${__CND_TEMP_FILE__} + cat ${__CND_TEMP_FILE__} >> ${__CND_BUILD_LOG__} + rm ${__CND_TEMP_FILE__} +fi +PATH=`dirname "${real_tool}"`:${PATH} +export PATH +exec "${real_tool}" "$@" diff --git a/nbproject/private/tools/pi_cd32.home_22/GNU/gcc b/nbproject/private/tools/pi_cd32.home_22/GNU/gcc new file mode 100644 index 00000000..920c73a0 --- /dev/null +++ b/nbproject/private/tools/pi_cd32.home_22/GNU/gcc @@ -0,0 +1,23 @@ +#!/bin/sh +#set -x +real_tool=/usr/bin/gcc +if [ -n "${__CND_BUILD_LOG__}" ]; then + OS=`uname`; + if [ $OS = Darwin -o $OS = FreeBSD ]; then + __CND_TEMP_FILE__=`mktemp -t nbwrapper` + else + __CND_TEMP_FILE__=`mktemp` + fi + echo "called: ${real_tool}" > ${__CND_TEMP_FILE__} + echo "\t`pwd`" >> ${__CND_TEMP_FILE__} + echo "\t${real_tool}" >> ${__CND_TEMP_FILE__} + for opt in "$@"; do + echo "\t${opt}" >> ${__CND_TEMP_FILE__} + done + echo >> ${__CND_TEMP_FILE__} + cat ${__CND_TEMP_FILE__} >> ${__CND_BUILD_LOG__} + rm ${__CND_TEMP_FILE__} +fi +PATH=`dirname "${real_tool}"`:${PATH} +export PATH +exec "${real_tool}" "$@" diff --git a/nbproject/private/tools/pi_retropie_22/GNU/g++ b/nbproject/private/tools/pi_retropie_22/GNU/g++ new file mode 100644 index 00000000..6dbb5291 --- /dev/null +++ b/nbproject/private/tools/pi_retropie_22/GNU/g++ @@ -0,0 +1,18 @@ +#!/bin/sh +#set -x +real_tool=/usr/bin/g++ +if [ -n "${__CND_BUILD_LOG__}" ]; then + __CND_TEMP_FILE__=`mktemp` + echo "called: ${real_tool}" > ${__CND_TEMP_FILE__} + echo "\t`pwd`" >> ${__CND_TEMP_FILE__} + echo "\t${real_tool}" >> ${__CND_TEMP_FILE__} + for opt in "$@"; do + echo "\t${opt}" >> ${__CND_TEMP_FILE__} + done + echo >> ${__CND_TEMP_FILE__} + cat ${__CND_TEMP_FILE__} >> ${__CND_BUILD_LOG__} + rm ${__CND_TEMP_FILE__} +fi +PATH=`dirname "${real_tool}"`:${PATH} +export PATH +exec "${real_tool}" "$@" diff --git a/nbproject/private/tools/pi_retropie_22/GNU/gcc b/nbproject/private/tools/pi_retropie_22/GNU/gcc new file mode 100644 index 00000000..39a77599 --- /dev/null +++ b/nbproject/private/tools/pi_retropie_22/GNU/gcc @@ -0,0 +1,18 @@ +#!/bin/sh +#set -x +real_tool=/usr/bin/gcc +if [ -n "${__CND_BUILD_LOG__}" ]; then + __CND_TEMP_FILE__=`mktemp` + echo "called: ${real_tool}" > ${__CND_TEMP_FILE__} + echo "\t`pwd`" >> ${__CND_TEMP_FILE__} + echo "\t${real_tool}" >> ${__CND_TEMP_FILE__} + for opt in "$@"; do + echo "\t${opt}" >> ${__CND_TEMP_FILE__} + done + echo >> ${__CND_TEMP_FILE__} + cat ${__CND_TEMP_FILE__} >> ${__CND_BUILD_LOG__} + rm ${__CND_TEMP_FILE__} +fi +PATH=`dirname "${real_tool}"`:${PATH} +export PATH +exec "${real_tool}" "$@" diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 00000000..61b4c6f9 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1 @@ +#Sat Sep 30 18:59:28 BST 2017 diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 00000000..7dea38f2 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,30 @@ + + + org.netbeans.modules.cnd.makeproject + + + amiberry + c + cpp + def,h,hpp + UTF-8 + + + . + + + + Pi3_Debug + 0 + + + Pi3_Release + 0 + + + + false + + + + diff --git a/src/akiko.cpp b/src/akiko.cpp index 7337abc6..40d67724 100644 --- a/src/akiko.cpp +++ b/src/akiko.cpp @@ -7,7 +7,7 @@ * - NVRAM * - CDROM * -* Copyright 2001-2010 Toni Wilen +* Copyright 2001-2016 Toni Wilen * */ @@ -15,9 +15,8 @@ #include "sysdeps.h" #include "options.h" -#include "include/memory.h" +#include "memory.h" #include "newcpu.h" -#include "events.h" #include "savestate.h" #include "blkdev.h" #include "zfile.h" @@ -27,21 +26,15 @@ #include "crc32.h" #include "uae.h" #include "custom.h" - -#define AKIKO_DEBUG_NVRAM 0 -#define AKIKO_DEBUG_IO 0 -#define AKIKO_DEBUG_IO_CMD 0 +#include "flashrom.h" // 43 48 49 4E 4F 4E 20 20 4F 2D 36 35 38 2D 32 20 32 34 #define FIRMWAREVERSION "CHINON O-658-2 24" -static void irq(void) +static void irq (void) { -#if AKIKO_DEBUG_IO > 1 - write_log(_T("Akiko Interrupt\n")); -#endif if (!(intreq & 8)) { - INTREQ_0(0x8000 | 0x0008); + INTREQ_0 (0x8000 | 0x0008); } } @@ -54,234 +47,71 @@ static void irq(void) * 0xb80030: bit 7 = SCL (clock), 6 = SDA (data) * 0xb80032: 0xb80030 data direction register (0 = input, 1 = output) * -* Because I don't have any experience on I2C, following code may be -* unnecessarily complex and not 100% correct.. */ -enum i2c { I2C_WAIT, I2C_START, I2C_DEVICEADDR, I2C_WORDADDR, I2C_DATA }; +static uae_u8 *cd32_nvram; +static void *cd32_eeprom; +static uae_u8 cd32_i2c_direction; +static bool cd32_i2c_data_scl, cd32_i2c_data_sda; +static struct zfile *flashfile; -/* size of EEPROM, don't try to change, -* (hardcoded in Kickstart) -*/ -#define NVRAM_SIZE 1024 -/* max size of one write request */ -#define NVRAM_PAGE_SIZE 16 - -static uae_u8 cd32_nvram[NVRAM_SIZE], nvram_writetmp[NVRAM_PAGE_SIZE]; -static int nvram_address, nvram_writeaddr; -static int nvram_rw; -static int bitcounter = -1, direction = -1; -static uae_u8 nvram_byte; -static int scl_out, scl_in, scl_dir, oscl, sda_out, sda_in, sda_dir, osda; -static int sda_dir_nvram; -static int state = I2C_WAIT; - -static void nvram_write(int offset, int len) +static void nvram_read (void) { - struct zfile *f; - + zfile_fclose(flashfile); + flashfile = NULL; + eeprom_free(cd32_eeprom); + cd32_eeprom = NULL; + cd32_i2c_data_scl = cd32_i2c_data_sda = true; + cd32_i2c_direction = 0; if (!currprefs.cs_cd32nvram) return; - f = zfile_fopen(currprefs.flashfile, _T("rb+"), ZFD_NORMAL); - if (!f) { - f = zfile_fopen(currprefs.flashfile, _T("wb"), 0); - if (!f) return; - zfile_fwrite(cd32_nvram, NVRAM_SIZE, 1, f); + if (!cd32_nvram) + cd32_nvram = xmalloc(uae_u8, currprefs.cs_cd32nvram_size); + memset(cd32_nvram, 0, currprefs.cs_cd32nvram_size); + flashfile = zfile_fopen (currprefs.flashfile, _T("rb+"), ZFD_NORMAL); + if (!flashfile) + flashfile = zfile_fopen (currprefs.flashfile, _T("wb"), 0); + if (flashfile) { + int size = zfile_fread(cd32_nvram, 1, currprefs.cs_cd32nvram_size, flashfile); + if (size < currprefs.cs_cd32nvram_size) + zfile_fwrite(cd32_nvram + size, 1, currprefs.cs_cd32nvram_size - size, flashfile); } - zfile_fseek(f, offset, SEEK_SET); - zfile_fwrite(cd32_nvram + offset, len, 1, f); - zfile_fclose(f); + cd32_eeprom = eeprom_new(cd32_nvram, currprefs.cs_cd32nvram_size, flashfile); } -static void nvram_read(void) +static void akiko_nvram_write (int offset, uae_u32 v) { - struct zfile *f; - - if (!currprefs.cs_cd32nvram) - return; - f = zfile_fopen(currprefs.flashfile, _T("rb"), ZFD_NORMAL); - memset(cd32_nvram, 0, NVRAM_SIZE); - if (!f) return; - zfile_fread(cd32_nvram, NVRAM_SIZE, 1, f); - zfile_fclose(f); -} - -static void i2c_do(void) -{ -#if AKIKO_DEBUG_NVRAM - int i; -#endif - sda_in = 1; - if (!sda_dir_nvram && scl_out && oscl) { - if (!sda_out && osda) { /* START-condition? */ - state = I2C_DEVICEADDR; - bitcounter = 0; - direction = -1; -#if AKIKO_DEBUG_NVRAM - write_log(_T("START\n")); -#endif - return; - } - else if (sda_out && !osda) { /* STOP-condition? */ - state = I2C_WAIT; - bitcounter = -1; -#if AKIKO_DEBUG_NVRAM - write_log(_T("STOP\n")); -#endif - if (direction > 0) { - memcpy(cd32_nvram + (nvram_address & ~(NVRAM_PAGE_SIZE - 1)), nvram_writetmp, NVRAM_PAGE_SIZE); - nvram_write(nvram_address & ~(NVRAM_PAGE_SIZE - 1), NVRAM_PAGE_SIZE); - direction = -1; - gui_flicker_led(LED_MD, 0, 2); -#if AKIKO_DEBUG_NVRAM - write_log(_T("NVRAM write address %04X:"), nvram_address & ~(NVRAM_PAGE_SIZE - 1)); - for (i = 0; i < NVRAM_PAGE_SIZE; i++) - write_log(_T("%02X"), nvram_writetmp[i]); - write_log(_T("\n")); - -#endif - } - return; - } - } - if (bitcounter >= 0) { - if (direction) { - /* Amiga -> NVRAM */ - if (scl_out && !oscl) { - if (bitcounter == 8) { -#if AKIKO_DEBUG_NVRAM - write_log(_T("RB %02X "), nvram_byte, M68K_GETPC); -#endif - sda_in = 0; /* ACK */ - if (direction > 0) { - nvram_writetmp[nvram_writeaddr++] = nvram_byte; - nvram_writeaddr &= 15; - bitcounter = 0; - } - else { - bitcounter = -1; - } - } - else { - //write_log (_T("NVRAM received bit %d, offset %d\n"), sda_out, bitcounter); - nvram_byte <<= 1; - nvram_byte |= sda_out; - bitcounter++; - } - } - } - else { - /* NVRAM -> Amiga */ - if (scl_out && !oscl && bitcounter < 8) { - if (bitcounter == 0) - nvram_byte = cd32_nvram[nvram_address]; - sda_dir_nvram = 1; - sda_in = (nvram_byte & 0x80) ? 1 : 0; - //write_log (_T("NVRAM sent bit %d, offset %d\n"), sda_in, bitcounter); - nvram_byte <<= 1; - bitcounter++; - if (bitcounter == 8) { -#if AKIKO_DEBUG_NVRAM - write_log(_T("NVRAM sent byte %02X address %04X PC=%08X\n"), cd32_nvram[nvram_address], nvram_address, M68K_GETPC); -#endif - nvram_address++; - nvram_address &= NVRAM_SIZE - 1; - sda_dir_nvram = 0; - } - } - if (!sda_out && sda_dir && !scl_out) /* ACK from Amiga */ - bitcounter = 0; - } - if (bitcounter >= 0) return; - } - switch (state) - { - case I2C_DEVICEADDR: - if ((nvram_byte & 0xf0) != 0xa0) { - write_log(_T("WARNING: I2C_DEVICEADDR: device address != 0xA0\n")); - state = I2C_WAIT; - return; - } - nvram_rw = (nvram_byte & 1) ? 0 : 1; - if (nvram_rw) { - /* 2 high address bits, only fetched if WRITE = 1 */ - nvram_address &= 0xff; - nvram_address |= ((nvram_byte >> 1) & 3) << 8; - state = I2C_WORDADDR; - direction = -1; - } - else { - state = I2C_DATA; - direction = 0; - sda_dir_nvram = 1; - } - bitcounter = 0; -#if AKIKO_DEBUG_NVRAM - write_log(_T("I2C_DEVICEADDR: rw %d, address %02Xxx PC=%08X\n"), nvram_rw, nvram_address >> 8, M68K_GETPC); -#endif - break; - case I2C_WORDADDR: - nvram_address &= 0x300; - nvram_address |= nvram_byte; -#if AKIKO_DEBUG_NVRAM - write_log(_T("I2C_WORDADDR: address %04X PC=%08X\n"), nvram_address, M68K_GETPC); -#endif - if (direction < 0) { - memcpy(nvram_writetmp, cd32_nvram + (nvram_address & ~(NVRAM_PAGE_SIZE - 1)), NVRAM_PAGE_SIZE); - nvram_writeaddr = nvram_address & (NVRAM_PAGE_SIZE - 1); - gui_flicker_led(LED_MD, 0, 1); - } - state = I2C_DATA; - bitcounter = 0; - direction = 1; - break; - } -} - -static void akiko_nvram_write(int offset, uae_u32 v) -{ - int sda; switch (offset) { case 0: - oscl = scl_out; - scl_out = (v & 0x80) ? 1 : 0; - osda = sda_out; - sda_out = (v & 0x40) ? 1 : 0; + if (cd32_i2c_direction & 0x80) + cd32_i2c_data_scl = (v & 0x80) != 0; + else + cd32_i2c_data_scl = true; + eeprom_i2c_set(cd32_eeprom, BITBANG_I2C_SCL, cd32_i2c_data_scl); + if (cd32_i2c_direction & 0x40) + cd32_i2c_data_sda = (v & 0x40) != 0; + else + cd32_i2c_data_sda = true; + eeprom_i2c_set(cd32_eeprom, BITBANG_I2C_SDA, cd32_i2c_data_sda); break; case 2: - scl_dir = (v & 0x80) ? 1 : 0; - sda_dir = (v & 0x40) ? 1 : 0; + cd32_i2c_direction = v; break; - default: - return; - } - sda = sda_out; - if (oscl != scl_out || osda != sda) { - i2c_do(); - oscl = scl_out; - osda = sda; } } -static uae_u32 akiko_nvram_read(int offset) +static uae_u32 akiko_nvram_read (int offset) { uae_u32 v = 0; switch (offset) { case 0: - if (!scl_dir) - v |= scl_in ? 0x80 : 0x00; - else - v |= scl_out ? 0x80 : 0x00; - if (!sda_dir) - v |= sda_in ? 0x40 : 0x00; - else - v |= sda_out ? 0x40 : 0x00; + v |= eeprom_i2c_set(cd32_eeprom, BITBANG_I2C_SCL, cd32_i2c_data_scl) ? 0x80 : 0x00; + v |= eeprom_i2c_set(cd32_eeprom, BITBANG_I2C_SDA, cd32_i2c_data_sda) ? 0x40 : 0x00; break; case 2: - v |= scl_dir ? 0x80 : 0x00; - v |= sda_dir ? 0x40 : 0x00; + v = cd32_i2c_direction; break; } return v; @@ -296,99 +126,82 @@ static uae_u32 akiko_buffer[8]; static int akiko_read_offset, akiko_write_offset; static uae_u32 akiko_result[8]; -#if 0 -static void akiko_c2p_do(void) -{ - int i; - - for (i = 0; i < 8; i++) - akiko_result[i] = 0; - /* FIXME: better c2p algoritm than this piece of crap.... */ - for (i = 0; i < 8 * 32; i++) { - if (akiko_buffer[7 - (i >> 5)] & (1 << (i & 31))) - akiko_result[i & 7] |= 1 << (i >> 3); - } -} -#else /* Optimised Chunky-to-Planar algorithm by Mequa */ static uae_u32 akiko_precalc_shift[32]; static uae_u32 akiko_precalc_bytenum[32][8]; -static void akiko_precalculate(void) +static void akiko_precalculate (void) { uae_u32 i, j; for (i = 0; i < 32; i++) { - akiko_precalc_shift[(int)i] = 1 << i; + akiko_precalc_shift [(int)i] = 1 << i; for (j = 0; j < 8; j++) { akiko_precalc_bytenum[(int)i][(int)j] = (i >> 3) + ((7 - j) << 2); } } } -static void akiko_c2p_do(void) +static void akiko_c2p_do (void) { int i; for (i = 0; i < 8; i++) { - akiko_result[i] = (((akiko_buffer[0] & akiko_precalc_shift[i]) != 0) << (akiko_precalc_bytenum[i][0])) - | (((akiko_buffer[1] & akiko_precalc_shift[i]) != 0) << (akiko_precalc_bytenum[i][1])) - | (((akiko_buffer[2] & akiko_precalc_shift[i]) != 0) << (akiko_precalc_bytenum[i][2])) - | (((akiko_buffer[3] & akiko_precalc_shift[i]) != 0) << (akiko_precalc_bytenum[i][3])) - | (((akiko_buffer[4] & akiko_precalc_shift[i]) != 0) << (akiko_precalc_bytenum[i][4])) - | (((akiko_buffer[5] & akiko_precalc_shift[i]) != 0) << (akiko_precalc_bytenum[i][5])) - | (((akiko_buffer[6] & akiko_precalc_shift[i]) != 0) << (akiko_precalc_bytenum[i][6])) - | (((akiko_buffer[7] & akiko_precalc_shift[i]) != 0) << (akiko_precalc_bytenum[i][7])) - | (((akiko_buffer[0] & akiko_precalc_shift[i + 8]) != 0) << (akiko_precalc_bytenum[i + 8][0])) - | (((akiko_buffer[1] & akiko_precalc_shift[i + 8]) != 0) << (akiko_precalc_bytenum[i + 8][1])) - | (((akiko_buffer[2] & akiko_precalc_shift[i + 8]) != 0) << (akiko_precalc_bytenum[i + 8][2])) - | (((akiko_buffer[3] & akiko_precalc_shift[i + 8]) != 0) << (akiko_precalc_bytenum[i + 8][3])) - | (((akiko_buffer[4] & akiko_precalc_shift[i + 8]) != 0) << (akiko_precalc_bytenum[i + 8][4])) - | (((akiko_buffer[5] & akiko_precalc_shift[i + 8]) != 0) << (akiko_precalc_bytenum[i + 8][5])) - | (((akiko_buffer[6] & akiko_precalc_shift[i + 8]) != 0) << (akiko_precalc_bytenum[i + 8][6])) - | (((akiko_buffer[7] & akiko_precalc_shift[i + 8]) != 0) << (akiko_precalc_bytenum[i + 8][7])) - | (((akiko_buffer[0] & akiko_precalc_shift[i + 16]) != 0) << (akiko_precalc_bytenum[i + 16][0])) - | (((akiko_buffer[1] & akiko_precalc_shift[i + 16]) != 0) << (akiko_precalc_bytenum[i + 16][1])) - | (((akiko_buffer[2] & akiko_precalc_shift[i + 16]) != 0) << (akiko_precalc_bytenum[i + 16][2])) - | (((akiko_buffer[3] & akiko_precalc_shift[i + 16]) != 0) << (akiko_precalc_bytenum[i + 16][3])) - | (((akiko_buffer[4] & akiko_precalc_shift[i + 16]) != 0) << (akiko_precalc_bytenum[i + 16][4])) - | (((akiko_buffer[5] & akiko_precalc_shift[i + 16]) != 0) << (akiko_precalc_bytenum[i + 16][5])) - | (((akiko_buffer[6] & akiko_precalc_shift[i + 16]) != 0) << (akiko_precalc_bytenum[i + 16][6])) - | (((akiko_buffer[7] & akiko_precalc_shift[i + 16]) != 0) << (akiko_precalc_bytenum[i + 16][7])) - | (((akiko_buffer[0] & akiko_precalc_shift[i + 24]) != 0) << (akiko_precalc_bytenum[i + 24][0])) - | (((akiko_buffer[1] & akiko_precalc_shift[i + 24]) != 0) << (akiko_precalc_bytenum[i + 24][1])) - | (((akiko_buffer[2] & akiko_precalc_shift[i + 24]) != 0) << (akiko_precalc_bytenum[i + 24][2])) - | (((akiko_buffer[3] & akiko_precalc_shift[i + 24]) != 0) << (akiko_precalc_bytenum[i + 24][3])) - | (((akiko_buffer[4] & akiko_precalc_shift[i + 24]) != 0) << (akiko_precalc_bytenum[i + 24][4])) - | (((akiko_buffer[5] & akiko_precalc_shift[i + 24]) != 0) << (akiko_precalc_bytenum[i + 24][5])) - | (((akiko_buffer[6] & akiko_precalc_shift[i + 24]) != 0) << (akiko_precalc_bytenum[i + 24][6])) - | (((akiko_buffer[7] & akiko_precalc_shift[i + 24]) != 0) << (akiko_precalc_bytenum[i + 24][7])); + akiko_result[i] = (((akiko_buffer[0] & akiko_precalc_shift[i]) != 0) << (akiko_precalc_bytenum[i][0]) ) + | (((akiko_buffer[1] & akiko_precalc_shift[i]) != 0) << (akiko_precalc_bytenum[i][1]) ) + | (((akiko_buffer[2] & akiko_precalc_shift[i]) != 0) << (akiko_precalc_bytenum[i][2]) ) + | (((akiko_buffer[3] & akiko_precalc_shift[i]) != 0) << (akiko_precalc_bytenum[i][3]) ) + | (((akiko_buffer[4] & akiko_precalc_shift[i]) != 0) << (akiko_precalc_bytenum[i][4]) ) + | (((akiko_buffer[5] & akiko_precalc_shift[i]) != 0) << (akiko_precalc_bytenum[i][5]) ) + | (((akiko_buffer[6] & akiko_precalc_shift[i]) != 0) << (akiko_precalc_bytenum[i][6]) ) + | (((akiko_buffer[7] & akiko_precalc_shift[i]) != 0) << (akiko_precalc_bytenum[i][7]) ) + | (((akiko_buffer[0] & akiko_precalc_shift[i+8]) != 0) << (akiko_precalc_bytenum[i+8][0]) ) + | (((akiko_buffer[1] & akiko_precalc_shift[i+8]) != 0) << (akiko_precalc_bytenum[i+8][1]) ) + | (((akiko_buffer[2] & akiko_precalc_shift[i+8]) != 0) << (akiko_precalc_bytenum[i+8][2]) ) + | (((akiko_buffer[3] & akiko_precalc_shift[i+8]) != 0) << (akiko_precalc_bytenum[i+8][3]) ) + | (((akiko_buffer[4] & akiko_precalc_shift[i+8]) != 0) << (akiko_precalc_bytenum[i+8][4]) ) + | (((akiko_buffer[5] & akiko_precalc_shift[i+8]) != 0) << (akiko_precalc_bytenum[i+8][5]) ) + | (((akiko_buffer[6] & akiko_precalc_shift[i+8]) != 0) << (akiko_precalc_bytenum[i+8][6]) ) + | (((akiko_buffer[7] & akiko_precalc_shift[i+8]) != 0) << (akiko_precalc_bytenum[i+8][7]) ) + | (((akiko_buffer[0] & akiko_precalc_shift[i+16]) != 0) << (akiko_precalc_bytenum[i+16][0])) + | (((akiko_buffer[1] & akiko_precalc_shift[i+16]) != 0) << (akiko_precalc_bytenum[i+16][1])) + | (((akiko_buffer[2] & akiko_precalc_shift[i+16]) != 0) << (akiko_precalc_bytenum[i+16][2])) + | (((akiko_buffer[3] & akiko_precalc_shift[i+16]) != 0) << (akiko_precalc_bytenum[i+16][3])) + | (((akiko_buffer[4] & akiko_precalc_shift[i+16]) != 0) << (akiko_precalc_bytenum[i+16][4])) + | (((akiko_buffer[5] & akiko_precalc_shift[i+16]) != 0) << (akiko_precalc_bytenum[i+16][5])) + | (((akiko_buffer[6] & akiko_precalc_shift[i+16]) != 0) << (akiko_precalc_bytenum[i+16][6])) + | (((akiko_buffer[7] & akiko_precalc_shift[i+16]) != 0) << (akiko_precalc_bytenum[i+16][7])) + | (((akiko_buffer[0] & akiko_precalc_shift[i+24]) != 0) << (akiko_precalc_bytenum[i+24][0])) + | (((akiko_buffer[1] & akiko_precalc_shift[i+24]) != 0) << (akiko_precalc_bytenum[i+24][1])) + | (((akiko_buffer[2] & akiko_precalc_shift[i+24]) != 0) << (akiko_precalc_bytenum[i+24][2])) + | (((akiko_buffer[3] & akiko_precalc_shift[i+24]) != 0) << (akiko_precalc_bytenum[i+24][3])) + | (((akiko_buffer[4] & akiko_precalc_shift[i+24]) != 0) << (akiko_precalc_bytenum[i+24][4])) + | (((akiko_buffer[5] & akiko_precalc_shift[i+24]) != 0) << (akiko_precalc_bytenum[i+24][5])) + | (((akiko_buffer[6] & akiko_precalc_shift[i+24]) != 0) << (akiko_precalc_bytenum[i+24][6])) + | (((akiko_buffer[7] & akiko_precalc_shift[i+24]) != 0) << (akiko_precalc_bytenum[i+24][7])); } } -#endif -static void akiko_c2p_write(int offset, uae_u32 v) +static void akiko_c2p_write (int offset, uae_u32 v) { if (offset == 3) akiko_buffer[akiko_write_offset] = 0; - akiko_buffer[akiko_write_offset] |= v << (8 * (3 - offset)); + akiko_buffer[akiko_write_offset] |= v << ( 8 * (3 - offset)); if (offset == 0) { akiko_write_offset++; akiko_write_offset &= 7; } - akiko_read_offset = 0; + akiko_read_offset = -1; } -static uae_u32 akiko_c2p_read(int offset) +static uae_u32 akiko_c2p_read (int offset) { uae_u32 v; - if (akiko_read_offset == 0 && offset == 3) - akiko_c2p_do(); + if (akiko_read_offset < 0) { + akiko_c2p_do (); + akiko_read_offset = 0; + } akiko_write_offset = 0; v = akiko_result[akiko_read_offset]; - if (offset == 0) { - akiko_read_offset++; - akiko_read_offset &= 7; - } return v >> (8 * (3 - offset)); } @@ -454,6 +267,7 @@ static uae_u8 cdcomrxcmp; /* 0x1f */ static uae_u8 cdrom_result_buffer[32]; static uae_u8 cdrom_command_buffer[32]; static uae_u8 cdrom_command; +static uae_u8 cdrom_last_rx; static int cdrom_toc_counter; static uae_u32 cdrom_toc_crc; @@ -468,13 +282,12 @@ static int cdrom_command_length; static int cdrom_checksum_error, cdrom_unknown_command; static int cdrom_data_offset, cdrom_speed, cdrom_sector_counter; static int cdrom_current_sector, cdrom_seek_delay; -static int cdrom_data_end; static int cdrom_audiotimeout; static int cdrom_led; static int cdrom_receive_length, cdrom_receive_offset; static int cdrom_muted; static int cd_initialized; -static int cdrom_tx_dma_delay; +static int cdrom_tx_dma_delay, cdrom_rx_dma_delay; static uae_u8 *sector_buffer_1, *sector_buffer_2; static int sector_buffer_sector_1, sector_buffer_sector_2; @@ -482,82 +295,72 @@ static int sector_buffer_sector_1, sector_buffer_sector_2; static uae_u8 *sector_buffer_info_1, *sector_buffer_info_2; static int unitnum = -1; +static uae_u8 cdrom_door = 1; static bool akiko_inited; static volatile int mediachanged, mediacheckcounter; static volatile int frame2counter; static smp_comm_pipe requests; static volatile int akiko_thread_running; -static uae_sem_t akiko_sem, sub_sem; +static uae_sem_t akiko_sem = 0, sub_sem = 0; -static void checkint(void) +static void checkint (void) { - if (cdrom_intreq & cdrom_intena) - irq(); + if (cdrom_intreq & cdrom_intena) { + irq (); + } } -static void set_status(uae_u32 status) +static void set_status (uae_u32 status) { -#if AKIKO_DEBUG_IO - if (!(cdrom_intreq & status)) - write_log(_T("Akiko INTREQ %08x (%08x)\n"), status, cdrom_intreq | status); -#endif cdrom_intreq |= status; - checkint(); + checkint (); cdrom_led ^= LED_CD_ACTIVE2; } -void rethink_akiko(void) +void rethink_akiko (void) { - checkint(); + checkint (); } -static void cdaudiostop_do(void) +static void cdaudiostop_do (void) { qcode_valid = 0; if (unitnum < 0) return; - sys_command_cd_pause(unitnum, 0); - sys_command_cd_stop(unitnum); + sys_command_cd_pause (unitnum, 0); + sys_command_cd_stop (unitnum); } -static void cdaudiostop(void) +static void cdaudiostop (void) { cdrom_audiostatus = 0; cdrom_audiotimeout = 0; cdrom_paused = 0; cdrom_playing = 0; - write_comm_pipe_u32(&requests, 0x0104, 1); + write_comm_pipe_u32 (&requests, 0x0104, 1); } -static void subfunc(uae_u8 *data, int cnt) +static void subfunc (uae_u8 *data, int cnt) { if (!(cdrom_flags & CDFLAG_SUBCODE)) return; - uae_sem_wait(&sub_sem); -#if 0 - int total = 0; - for (int i = 0; i < MAX_SUBCODEBUFFER; i++) { - if (subcodebufferinuse[i]) - total++; - } - write_log(_T("%d "), total); -#endif + uae_sem_wait (&sub_sem); if (subcodebufferinuse[subcodebufferoffsetw]) { - memset(subcodebufferinuse, 0, sizeof(subcodebufferinuse)); + memset (subcodebufferinuse, 0,sizeof (subcodebufferinuse)); subcodebufferoffsetw = subcodebufferoffset = 0; - uae_sem_post(&sub_sem); + uae_sem_post (&sub_sem); //write_log (_T("CD32: subcode buffer overflow 1\n")); return; } int offset = subcodebufferoffsetw; while (cnt > 0) { if (subcodebufferinuse[offset]) { - write_log(_T("CD32: subcode buffer overflow 2\n")); + write_log (_T("CD32: subcode buffer overflow 2\n")); break; } subcodebufferinuse[offset] = 1; - memcpy(&subcodebuffer[offset * SUB_CHANNEL_SIZE], data, SUB_CHANNEL_SIZE); + memcpy (&subcodebuffer[offset * SUB_CHANNEL_SIZE], data, SUB_CHANNEL_SIZE); data += SUB_CHANNEL_SIZE; offset++; if (offset >= MAX_SUBCODEBUFFER) @@ -565,16 +368,15 @@ static void subfunc(uae_u8 *data, int cnt) cnt--; } subcodebufferoffsetw = offset; - uae_sem_post(&sub_sem); + uae_sem_post (&sub_sem); } -static int statusfunc(int status) +static int statusfunc (int status, int playpos) { if (status == -1) return 0; if (status == -2) return 10; -#if 1 if (cdrom_audiostatus != status) { if (status == AUDIO_STATUS_IN_PROGRESS) { cdrom_playing = 1; @@ -585,23 +387,22 @@ static int statusfunc(int status) } } cdrom_audiostatus = status; -#endif return 0; } -static void cdaudioplay_do(void) +static void cdaudioplay_do (void) { - uae_u32 startlsn = read_comm_pipe_u32_blocking(&requests); - uae_u32 endlsn = read_comm_pipe_u32_blocking(&requests); - uae_u32 scan = read_comm_pipe_u32_blocking(&requests); + uae_u32 startlsn = read_comm_pipe_u32_blocking (&requests); + uae_u32 endlsn = read_comm_pipe_u32_blocking (&requests); + uae_u32 scan = read_comm_pipe_u32_blocking (&requests); qcode_valid = 0; if (unitnum < 0) return; - sys_command_cd_pause(unitnum, 0); - sys_command_cd_play(unitnum, startlsn, endlsn, scan, statusfunc, subfunc); + sys_command_cd_pause (unitnum, 0); + sys_command_cd_play (unitnum, startlsn, endlsn, scan, statusfunc, subfunc); } -static bool isaudiotrack(int startlsn) +static bool isaudiotrack (int startlsn) { struct cd_toc *s = NULL; uae_u32 addr; @@ -617,15 +418,15 @@ static bool isaudiotrack(int startlsn) s++; } if (s && (s->control & 0x0c) == 0x04) { - write_log(_T("tried to play data track %d!\n"), s->track); + write_log (_T("CD32: tried to play data track %d!\n"), s->track); return false; } return true; } -static struct cd_toc *get_track(int startlsn) +static struct cd_toc *get_track (int startlsn) { - for (int i = cdrom_toc_cd_buffer.first_track_offset + 1; i <= cdrom_toc_cd_buffer.last_track_offset; i++) { + for (int i = cdrom_toc_cd_buffer.first_track_offset + 1; i <= cdrom_toc_cd_buffer.last_track_offset + 1; i++) { struct cd_toc *s = &cdrom_toc_cd_buffer.toc[i]; uae_u32 addr = s->paddress; if (startlsn < addr) @@ -635,17 +436,17 @@ static struct cd_toc *get_track(int startlsn) } static int last_play_end; -static int cd_play_audio(int startlsn, int endlsn, int scan) +static int cd_play_audio (int startlsn, int endlsn, int scan) { struct cd_toc *s = NULL; if (!cdrom_toc_cd_buffer.points) return 0; - s = get_track(startlsn); + s = get_track (startlsn); if (s && (s->control & 0x0c) == 0x04) { - s = get_track(startlsn + 150); + s = get_track (startlsn + 150); if (s && (s->control & 0x0c) == 0x04) { - write_log(_T("tried to play data track %d!\n"), s->track); + write_log (_T("CD32: tried to play data track %d!\n"), s->track); s++; startlsn = s->paddress; s++; @@ -657,22 +458,22 @@ static int cd_play_audio(int startlsn, int endlsn, int scan) last_play_end = endlsn; cdrom_audiotimeout = 10; cdrom_paused = 0; - write_comm_pipe_u32(&requests, 0x0110, 0); - write_comm_pipe_u32(&requests, startlsn, 0); - write_comm_pipe_u32(&requests, endlsn, 0); - write_comm_pipe_u32(&requests, scan, 1); + write_comm_pipe_u32 (&requests, 0x0110, 0); + write_comm_pipe_u32 (&requests, startlsn, 0); + write_comm_pipe_u32 (&requests, endlsn, 0); + write_comm_pipe_u32 (&requests, scan, 1); return 1; } /* read qcode */ static int last_play_pos; -static int cd_qcode(uae_u8 *d) +static int cd_qcode (uae_u8 *d) { uae_u8 *buf, *s, as; if (d) - memset(d, 0, 11); + memset (d, 0, 11); last_play_pos = 0; buf = qcode_buf; as = buf[1]; @@ -682,7 +483,7 @@ static int cd_qcode(uae_u8 *d) if (cdrom_audiostatus != AUDIO_STATUS_IN_PROGRESS && cdrom_audiostatus != AUDIO_STATUS_PAUSED) return 0; s = buf + 4; - last_play_pos = msf2lsn(fromlongbcd(s + 7)); + last_play_pos = msf2lsn (fromlongbcd (s + 7)); if (!d) return 0; buf[2] = 0; @@ -707,88 +508,103 @@ static int cd_qcode(uae_u8 *d) /* Make sure end of disc position is not missed. */ if (last_play_pos >= cdrom_toc_cd_buffer.lastaddress || cdrom_toc_cd_buffer.lastaddress - last_play_pos < 10) { - int msf = lsn2msf(cdrom_toc_cd_buffer.lastaddress); - d[8] = tobcd((uae_u8)(msf >> 16)); - d[9] = tobcd((uae_u8)(msf >> 8)); - d[10] = tobcd((uae_u8)(msf >> 0)); + int msf = lsn2msf (cdrom_toc_cd_buffer.lastaddress); + d[8] = tobcd ((uae_u8)(msf >> 16)); + d[9] = tobcd ((uae_u8)(msf >> 8)); + d[10] = tobcd ((uae_u8)(msf >> 0)); } } -// write_log (_T("%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X\n"), -// d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11]); return 0; } /* read toc */ -static int get_cdrom_toc(void) +static int get_cdrom_toc (void) { int j; int datatrack = 0, secondtrack = 0; cdrom_toc_counter = -1; - if (!sys_command_cd_toc(unitnum, &cdrom_toc_cd_buffer)) + if (!sys_command_cd_toc (unitnum, &cdrom_toc_cd_buffer)) return 1; - memset(cdrom_toc_buffer, 0, MAX_TOC_ENTRIES * 13); - cdrom_data_end = -1; + memset (cdrom_toc_buffer, 0, MAX_TOC_ENTRIES * 13); for (j = 0; j < cdrom_toc_cd_buffer.points; j++) { struct cd_toc *s = &cdrom_toc_cd_buffer.toc[j]; uae_u8 *d = &cdrom_toc_buffer[j * 13]; int addr = s->paddress; - int msf = lsn2msf(addr); + int msf = lsn2msf (addr); if (s->point == 0xa0 || s->point == 0xa1) msf = s->track << 16; d[1] = (s->adr << 0) | (s->control << 4); - d[3] = s->point < 100 ? tobcd(s->point) : s->point; - d[8] = tobcd((msf >> 16) & 0xff); - d[9] = tobcd((msf >> 8) & 0xff); - d[10] = tobcd((msf >> 0) & 0xff); + d[3] = s->point < 100 ? tobcd (s->point) : s->point; + d[8] = tobcd ((msf >> 16) & 0xff); + d[9] = tobcd ((msf >> 8) & 0xff); + d[10] = tobcd ((msf >> 0) & 0xff); if (s->point == 1 && (s->control & 0x0c) == 0x04) datatrack = 1; - if (s->point == 2) + if (s->point >= 2 && s->point < 100 && (s->control & 0x0c) != 0x04 && !secondtrack) secondtrack = addr; } - cdrom_toc_crc = get_crc32(cdrom_toc_buffer, cdrom_toc_cd_buffer.points * 13); - if (datatrack) { - if (secondtrack) - cdrom_data_end = secondtrack; - else - cdrom_data_end = cdrom_toc_cd_buffer.lastaddress; - } + cdrom_toc_crc = get_crc32 (cdrom_toc_buffer, cdrom_toc_cd_buffer.points * 13); return 0; } +static bool is_valid_data_sector(int sector) +{ + for (int i = 0; i < cdrom_toc_cd_buffer.points; i++) { + struct cd_toc *s = &cdrom_toc_cd_buffer.toc[i]; + if (s->point < 1 || s->point > 99) + continue; + if ((s->control & 0x0c) != 4) + continue; + if (sector >= s->paddress && (sector < s[1].paddress || s[1].point >= 0xa1)) + return true; + } + return false; +} /* open device */ -static int sys_cddev_open(void) +static int sys_cddev_open (void) { - struct device_info di; - unitnum = get_standard_cd_unit(CD_STANDARD_UNIT_CD32); - sys_command_info(unitnum, &di, 0); - write_log(_T("using drive %s (unit %d, media %d)\n"), di.label, unitnum, di.media_inserted); + struct device_info di = { 0 }; + unitnum = get_standard_cd_unit (CD_STANDARD_UNIT_CD32); + sys_command_info (unitnum, &di, 0); + write_log (_T("CD32: using drive %s (unit %d, media %d)\n"), di.label, unitnum, di.media_inserted); /* make sure CD audio is not playing */ - cdaudiostop_do(); + cdaudiostop_do (); return 0; } /* close device */ -static void sys_cddev_close(void) +static void sys_cddev_close (void) { if (unitnum >= 0) { - cdaudiostop_do(); - sys_command_close(unitnum); + cdaudiostop_do (); + sys_command_close (unitnum); } unitnum = -1; } -static int command_lengths[] = { 1, 2, 1, 1, 12, 2, 1, 1, 4, 1, 2, -1, -1, -1, -1, -1 }; - -static int cdrom_start_return_data(int len) +static bool cdrom_can_return_data(void) { if (cdrom_receive_length > 0) + return false; + return true; +} + +static int cdrom_start_return_data (int len) +{ + if (!cdrom_can_return_data()) return 0; if (len <= 0) return -1; cdrom_receive_length = len; - cdrom_receive_offset = -1; + uae_u8 checksum = 0xff; + for (int i = 0; i < cdrom_receive_length; i++) { + checksum -= cdrom_result_buffer[i]; + } + cdrom_result_buffer[cdrom_receive_length++] = checksum; + cdrom_receive_offset = 0; + set_status(CDINTERRUPT_DRIVERECV); return 1; } @@ -800,11 +616,9 @@ static int cdrom_start_return_data(int len) more data available) when cdcomrxinx matches cdcomrxcmp */ -static void cdrom_return_data(void) +static void cdrom_return_data (void) { uae_u32 cmd_buf = cdrx_address; - int i; - uae_u8 checksum; if (!cdrom_receive_length) return; @@ -812,54 +626,35 @@ static void cdrom_return_data(void) return; if (cdcomrxinx == cdcomrxcmp) return; + if (cdrom_rx_dma_delay > 0) + return; -#if AKIKO_DEBUG_IO - write_log(_T("OUT IDX=0x%02X-0x%02X LEN=%d,%08x:"), cdcomrxinx, cdcomrxcmp, cdrom_receive_length, cmd_buf); -#endif - - if (cdrom_receive_offset < 0) { - checksum = 0xff; - for (i = 0; i < cdrom_receive_length; i++) { - checksum -= cdrom_result_buffer[i]; -#if AKIKO_DEBUG_IO - write_log(_T("%02X "), cdrom_result_buffer[i]); -#endif - } -#if AKIKO_DEBUG_IO - write_log(_T("(%02X)\n"), checksum); -#endif - cdrom_result_buffer[cdrom_receive_length++] = checksum; - cdrom_receive_offset = 0; - } - else { -#if AKIKO_DEBUG_IO - write_log(_T("\n")); -#endif - } - while (cdrom_receive_offset < cdrom_receive_length && cdcomrxinx != cdcomrxcmp) { - put_byte(cmd_buf + cdcomrxinx, cdrom_result_buffer[cdrom_receive_offset]); + while (cdrom_receive_offset < cdrom_receive_length) { + cdrom_last_rx = cdrom_result_buffer[cdrom_receive_offset]; + put_byte (cmd_buf + cdcomrxinx, cdrom_last_rx); cdcomrxinx++; cdrom_receive_offset++; + if (cdcomrxinx == cdcomrxcmp) { + set_status(CDINTERRUPT_RXDMADONE); + break; + } } - if (cdcomrxinx == cdcomrxcmp) { - set_status(CDINTERRUPT_RXDMADONE); -#if AKIKO_DEBUG_IO - write_log(_T("RXDMADONE %d/%d\n"), cdrom_receive_offset, cdrom_receive_length); -#endif - } - - if (cdrom_receive_offset == cdrom_receive_length) + if (cdrom_receive_offset == cdrom_receive_length) { cdrom_receive_length = 0; + cdrom_receive_offset = 0; + cdrom_intreq &= ~CDINTERRUPT_DRIVERECV; + set_status(CDINTERRUPT_DRIVEXMIT); + } } -static int cdrom_command_led(void) +static int cdrom_command_led (void) { int v = cdrom_command_buffer[1]; int old = cdrom_led; cdrom_led &= ~LED_CD_ACTIVE; cdrom_led |= (v & 1) ? LED_CD_ACTIVE : 0; if (cdrom_led != old) - gui_flicker_led(LED_CD, 0, cdrom_led); + gui_flicker_led (LED_CD, 0, cdrom_led); if (v & 0x80) { // result wanted? cdrom_result_buffer[0] = cdrom_command; cdrom_result_buffer[1] = (cdrom_led & LED_CD_ACTIVE) ? 1 : 0; @@ -868,122 +663,116 @@ static int cdrom_command_led(void) return 0; } -static int cdrom_command_idle_status(void) +static int cdrom_command_idle_status (void) { cdrom_result_buffer[0] = 0x0a; cdrom_result_buffer[1] = 0x70; return 2; } -static int cdrom_command_media_status(void) +static int cdrom_command_media_status (void) { cdrom_result_buffer[0] = 0x0a; - cdrom_result_buffer[1] = sys_command_ismedia(unitnum, 0) > 0 ? 0x83 : 0x80; + cdrom_result_buffer[1] = sys_command_ismedia (unitnum, 0) > 0 ? 0x01: 0x00; return 2; } /* check if cd drive door is open or closed, return firmware info */ -static int cdrom_command_status(void) +static int cdrom_command_status (void) { - cdrom_result_buffer[1] = 0x01; - //cdrom_result_buffer[1] = 0x80; door open + cdrom_result_buffer[1] = cdrom_door; if (unitnum >= 0) - get_cdrom_toc(); + get_cdrom_toc (); /* firmware info */ - memcpy(cdrom_result_buffer + 2, FIRMWAREVERSION, sizeof FIRMWAREVERSION); + memcpy (cdrom_result_buffer + 2, FIRMWAREVERSION, sizeof FIRMWAREVERSION); cdrom_result_buffer[0] = cdrom_command; - cd_initialized = 1; + cd_initialized = 2; return 20; } /* return one TOC entry, each TOC entry repeats 3 times */ #define TOC_REPEAT 3 -static int cdrom_return_toc_entry(void) +static int cdrom_return_toc_entry (void) { cdrom_result_buffer[0] = 6; -#if AKIKO_DEBUG_IO_CMD - write_log(_T("CD32: TOC entry %d/%d\n"), cdrom_toc_counter / TOC_REPEAT, cdrom_toc_cd_buffer.points); -#endif if (cdrom_toc_cd_buffer.points == 0) { - cdrom_result_buffer[1] = CDS_ERROR; + cdrom_result_buffer[1] = CDS_ERROR | cdrom_door; return 15; } - cdrom_result_buffer[1] = 0; - memcpy(cdrom_result_buffer + 2, cdrom_toc_buffer + (cdrom_toc_counter / TOC_REPEAT) * 13, 13); + cdrom_result_buffer[1] = 0x0a; // unknown but real CD32 sets it + memcpy (cdrom_result_buffer + 2, cdrom_toc_buffer + (cdrom_toc_counter / TOC_REPEAT) * 13, 13); + cdrom_result_buffer[6] = tobcd(99); + cdrom_result_buffer[7] = tobcd(24 + cdrom_toc_counter / 75); + cdrom_result_buffer[8] = tobcd(cdrom_toc_counter % 75); cdrom_toc_counter++; if (cdrom_toc_counter / TOC_REPEAT >= cdrom_toc_cd_buffer.points) cdrom_toc_counter = -1; return 15; } -static int checkerr(void) +static int checkerr (void) { if (!cdrom_disk) { - cdrom_result_buffer[1] = CH_ERR_NODISK; + cdrom_result_buffer[1] = CH_ERR_NODISK | cdrom_door; return 1; } return 0; } -static int cdrom_command_stop(void) +static int cdrom_command_stop (void) { cdrom_audiotimeout = 0; cdrom_result_buffer[0] = cdrom_command; - if (checkerr()) + if (checkerr ()) return 2; cdrom_result_buffer[1] = 0; - cdaudiostop(); + cdaudiostop (); return 2; } /* pause CD audio */ -static int cdrom_command_pause(void) +static int cdrom_command_pause (void) { -#if AKIKO_DEBUG_IO_CMD - write_log(_T("CD32: pause: %d, %d\n"), cdrom_paused, cdrom_playing); -#endif cdrom_audiotimeout = 0; cdrom_toc_counter = -1; cdrom_result_buffer[0] = cdrom_command; - if (checkerr()) + if (checkerr ()) return 2; - cdrom_result_buffer[1] = cdrom_playing ? CDS_PLAYING : 0; + cdrom_result_buffer[1] = (cdrom_playing ? CDS_PLAYING : 0) | cdrom_door; if (cdrom_paused) return 2; cdrom_paused = 1; if (!cdrom_playing) return 2; - write_comm_pipe_u32(&requests, 0x0102, 1); + write_comm_pipe_u32 (&requests, 0x0102, 1); return 2; } /* unpause CD audio */ -static int cdrom_command_unpause(void) +static int cdrom_command_unpause (void) { -#if AKIKO_DEBUG_IO_CMD - write_log(_T("CD32: unpause: %d, %d\n"), cdrom_paused, cdrom_playing); -#endif cdrom_result_buffer[0] = cdrom_command; - if (checkerr()) + if (checkerr ()) return 2; - cdrom_result_buffer[1] = cdrom_playing ? CDS_PLAYING : 0; + cdrom_result_buffer[1] = (cdrom_playing ? CDS_PLAYING : 0) | cdrom_door; if (!cdrom_paused) return 2; cdrom_paused = 0; if (!cdrom_playing) return 2; - write_comm_pipe_u32(&requests, 0x0103, 1); + write_comm_pipe_u32 (&requests, 0x0103, 1); return 2; } /* seek head/play CD audio/read data sectors */ -static int cdrom_command_multi(void) +static int cdrom_command_multi (void) { - int seekpos = msf2lsn(fromlongbcd(cdrom_command_buffer + 1)); - int endpos = msf2lsn(fromlongbcd(cdrom_command_buffer + 4)); + int seekpos = msf2lsn (fromlongbcd (cdrom_command_buffer + 1)); + int endpos = msf2lsn (fromlongbcd (cdrom_command_buffer + 4)); if (cdrom_playing) - cdaudiostop(); + cdaudiostop (); + cdrom_paused = 0; cdrom_speed = (cdrom_command_buffer[8] & 0x40) ? 2 : 1; cdrom_result_buffer[0] = cdrom_command; cdrom_result_buffer[1] = 0; @@ -992,86 +781,90 @@ static int cdrom_command_multi(void) return 2; } - if (cdrom_command_buffer[7] == 0x80) { /* data read */ -#if AKIKO_DEBUG_IO_CMD - int cdrom_data_offset_end = endpos; -#endif + if (cdrom_command_buffer[7] & 0x80) { /* data read */ cdrom_data_offset = seekpos; - cdrom_seek_delay = abs(cdrom_current_sector - cdrom_data_offset); - if (cdrom_seek_delay < 100) { + cdrom_seek_delay = abs (cdrom_current_sector - cdrom_data_offset); + if (cdrom_seek_delay < 100 || currprefs.cd_speed == 0) { cdrom_seek_delay = 1; - } - else { + } else { cdrom_seek_delay /= 1000; cdrom_seek_delay += 10; if (cdrom_seek_delay > 100) cdrom_seek_delay = 100; } -#if AKIKO_DEBUG_IO_CMD - write_log(_T("READ DATA %06X (%d) - %06X (%d) SPD=%dx PC=%08X\n"), - seekpos, - cdrom_data_offset, - endpos, - cdrom_data_offset_end, - cdrom_speed, - M68K_GETPC); -#endif cdrom_result_buffer[1] |= 0x02; - } - else if (cdrom_command_buffer[10] & 4) { /* play audio */ -#if AKIKO_DEBUG_IO_CMD - int scan = 0; - if (cdrom_command_buffer[7] & 0x04) - scan = 1; - else if (cdrom_command_buffer[7] & 0x08) - scan = -1; - write_log(_T("PLAY FROM %06X (%d) to %06X (%d) SCAN=%d\n"), - seekpos, - msf2lsn(seekpos), - endpos, - msf2lsn(endpos), - scan); -#endif - //cdrom_result_buffer[1] |= CDS_PLAYING; - cdrom_playing = 1; - if (!cd_play_audio(seekpos, endpos, 0)) { - // play didn't start, report it in next status packet - cdrom_audiotimeout = -3; - } - } - else { -#if AKIKO_DEBUG_IO_CMD - write_log(_T("SEEKTO %06X\n"), seekpos); -#endif - if (seekpos < 150) + } else { /* play audio */ + // offset 10, bit 2 set: don't send subchannel data + if (seekpos < 0) { cdrom_toc_counter = 0; - else + } else { cdrom_toc_counter = -1; + cdrom_result_buffer[1] = 0x42; // play command starting? + cdrom_playing = 1; + if (!cd_play_audio (seekpos, endpos, 0)) { + // play didn't start, report it in next status packet + cdrom_audiotimeout = -3; + } + } } return 2; } -static int cdrom_playend_notify(int status) +static int cdrom_playend_notify (int status) { cdrom_result_buffer[0] = 4; if (status < 0) - cdrom_result_buffer[1] = 0x80; // error + cdrom_result_buffer[1] = CDS_ERROR; // error else if (status == 0) - cdrom_result_buffer[1] = 0x08; // play started + cdrom_result_buffer[1] = CDS_PLAYING | 2; // play started else - cdrom_result_buffer[1] = 0x00; // play ended + cdrom_result_buffer[1] = CDS_PLAYEND; // play ended + cdrom_result_buffer[1] |= cdrom_door; return 2; } /* return subq entry */ -static int cdrom_command_subq(void) +static int cdrom_command_subq (void) { cdrom_result_buffer[0] = cdrom_command; cdrom_result_buffer[1] = 0; - cd_qcode(cdrom_result_buffer + 2); + cd_qcode (cdrom_result_buffer + 2); return 15; } +static const int command_lengths[] = { 1, 2, 1, 1, 12, 2, 1, 1, 4, 1, 2, -1, -1, -1, -1, -1 }; + +static bool cdrom_add_command_byte(uae_u8 b) +{ + cdrom_command_buffer[cdrom_command_length++] = b; + cdrom_command = cdrom_command_buffer[0]; + int cmd_len = command_lengths[cdrom_command & 0x0f]; + + cdrom_checksum_error = 0; + cdrom_unknown_command = 0; + + if (cmd_len < 0) { + cdrom_unknown_command = 1; + cdrom_command_active = 1; + return true; + } + + if (cmd_len + 1 > cdrom_command_length) + return false; + + uae_u8 checksum = 0; + + for (int i = 0; i < cmd_len + 1; i++) { + checksum += cdrom_command_buffer[i]; + } + if (checksum != 0xff) { + cdrom_checksum_error = 1; + } + cdrom_command_active = 1; + cdrom_command_length = cmd_len; + return true; +} + /* TX DMA reads bytes from memory and sends them to CDROM hardware if TX DMA enabled, CDROM data transfer @@ -1080,93 +873,56 @@ static int cdrom_command_subq(void) CDINTERRUPT_TXDMADONE triggered when cdromtxinx matches cdcomtx. */ -static void cdrom_run_command(void) +static bool can_send_command(void) { - int i, cmd_len; - uae_u8 checksum; -#if 0 - uae_u8 *pp = get_real_address(cdtx_address); -#endif + if (!cd_initialized) + return false; + if (cdrom_command_active) + return false; + if (cdrom_receive_length) + return false; + return true; +} +static void cdrom_run_command (void) +{ if (!(cdrom_flags & CDFLAG_TXD)) return; - if ((cdrom_flags & CDFLAG_ENABLE)) - return; - if (cdrom_command_active) - return; - if (cdrom_receive_length) + if (cdrom_flags & CDFLAG_ENABLE) return; if (cdcomtxinx == cdcomtxcmp) return; if (cdrom_tx_dma_delay > 0) return; - - cdrom_command = get_byte(cdtx_address + cdcomtxinx); - - if (cdrom_command == 0) { - cdcomtxinx++; + if (!can_send_command()) return; - } - cdrom_checksum_error = 0; - cdrom_unknown_command = 0; + uae_u8 b = get_byte(cdtx_address + cdcomtxinx); + cdrom_add_command_byte(b); + cdcomtxinx++; - cmd_len = command_lengths[cdrom_command & 0x0f]; - if (cmd_len < 0) { -#if AKIKO_DEBUG_IO_CMD - write_log(_T("unknown command %x\n"), cdrom_command & 0x0f); -#endif - cdrom_unknown_command = 1; - cdrom_command_active = 1; - cdrom_command_length = 1; + if (cdcomtxinx == cdcomtxcmp) { set_status(CDINTERRUPT_TXDMADONE); - return; } - -#if AKIKO_DEBUG_IO_CMD - write_log(_T("IN CMD=%02X IDX=0x%02X-0x%02X LEN=%d:"), cdrom_command & 0x0f, cdcomtxinx, cdcomtxcmp, cmd_len); -#endif - checksum = 0; - for (i = 0; i < cmd_len + 1; i++) { - cdrom_command_buffer[i] = get_byte(cdtx_address + ((cdcomtxinx + i) & 0xff)); - checksum += cdrom_command_buffer[i]; -#if AKIKO_DEBUG_IO_CMD - if (i == cmd_len) - write_log(_T("(%02X) "), cdrom_command_buffer[i]); // checksum - else - write_log(_T("%02X "), cdrom_command_buffer[i]); -#endif - } - if (checksum != 0xff) { -#if AKIKO_DEBUG_IO_CMD - write_log(_T(" checksum error")); -#endif - cdrom_checksum_error = 1; - //activate_debugger (); - } -#if AKIKO_DEBUG_IO_CMD - write_log(_T("\n")); -#endif - cdrom_command_active = 1; - cdrom_command_length = cmd_len; - set_status(CDINTERRUPT_TXDMADONE); } -static void cdrom_run_command_run(void) +static void cdrom_run_command_run (void) { int len; - cdcomtxinx = cdcomtxinx + cdrom_command_length + 1; - memset(cdrom_result_buffer, 0, sizeof(cdrom_result_buffer)); + cdrom_command_length = 0; + cdrom_command_active = 0; + + memset (cdrom_result_buffer, 0, sizeof (cdrom_result_buffer)); if (cdrom_checksum_error || cdrom_unknown_command) { cdrom_result_buffer[0] = (cdrom_command & 0xf0) | 5; if (cdrom_checksum_error) - cdrom_result_buffer[1] |= CH_ERR_CHECKSUM; + cdrom_result_buffer[1] |= CH_ERR_CHECKSUM | cdrom_door; else if (cdrom_unknown_command) - cdrom_result_buffer[1] |= CH_ERR_BADCOMMAND; + cdrom_result_buffer[1] |= CH_ERR_BADCOMMAND | cdrom_door; len = 2; - cdrom_start_return_data(len); + cdrom_start_return_data (len); return; } @@ -1177,37 +933,39 @@ static void cdrom_run_command_run(void) cdrom_result_buffer[0] = cdrom_command; break; case 1: - len = cdrom_command_stop(); + len = cdrom_command_stop (); break; case 2: - len = cdrom_command_pause(); + len = cdrom_command_pause (); break; case 3: - len = cdrom_command_unpause(); + len = cdrom_command_unpause (); break; case 4: - len = cdrom_command_multi(); + len = cdrom_command_multi (); break; case 5: - len = cdrom_command_led(); + len = cdrom_command_led (); break; case 6: - len = cdrom_command_subq(); + len = cdrom_command_subq (); break; case 7: - len = cdrom_command_status(); + len = cdrom_command_status (); break; default: len = 0; break; } - if (len == 0) + if (len == 0) { + set_status(CDINTERRUPT_DRIVEXMIT); return; - cdrom_start_return_data(len); + } + cdrom_start_return_data (len); } /* DMA transfer one CD sector */ -static void cdrom_run_read(void) +static void cdrom_run_read (void) { int i, sector, inc; int sec; @@ -1215,10 +973,8 @@ static void cdrom_run_read(void) if (!(cdrom_flags & CDFLAG_ENABLE)) return; - if (!cdrom_pbx) { - set_status(CDINTERRUPT_OVERFLOW); + if (!cdrom_pbx) return; - } if (!(cdrom_flags & CDFLAG_PBX)) return; if (cdrom_data_offset < 0) @@ -1238,35 +994,44 @@ static void cdrom_run_read(void) if (sector_buffer_info_1[sec] != 0xff && sector_buffer_info_1[sec] != 0) { uae_u8 buf[2352]; - memcpy(buf, sector_buffer_1 + sec * 2352, 2352); + memcpy (buf, sector_buffer_1 + sec * 2352, 2352); buf[0] = 0; buf[1] = 0; buf[2] = 0; buf[3] = cdrom_sector_counter & 31; for (i = 0; i < 2352; i++) - put_byte(cdrom_addressdata + seccnt * 4096 + i, buf[i]); + put_byte (cdrom_addressdata + seccnt * 4096 + i, buf[i]); for (i = 0; i < 73 * 2; i++) - put_byte(cdrom_addressdata + seccnt * 4096 + 0xc00 + i, 0); + put_byte (cdrom_addressdata + seccnt * 4096 + 0xc00 + i, 0); cdrom_pbx &= ~(1 << seccnt); - set_status(CDINTERRUPT_PBX); - } - else { + set_status (CDINTERRUPT_PBX); + + if ((cdrom_flags & CDFLAG_RAW) || !(cdrom_flags & CDFLAG_CAS)) + write_log(_T("CD32: Akiko warning: Flags = %08x!\n"), cdrom_flags); + + if (cdrom_flags & CDFLAG_SUBCODE) { + uae_u8 subbuf[SUB_CHANNEL_SIZE] = { 0 }; + uae_u8 subbuf2[SUB_CHANNEL_SIZE]; + if (sys_command_cd_qcode(unitnum, subbuf2, sector, true)) + sub_to_interleaved(subbuf2, subbuf); + if (cdrom_subcodeoffset >= 128) + cdrom_subcodeoffset = 0; + else + cdrom_subcodeoffset = 128; + // 96 byte subchannel data + for (int i = 0; i < SUB_CHANNEL_SIZE; i++) + put_byte(subcode_address + cdrom_subcodeoffset + i, subbuf[i]); + put_long(subcode_address + cdrom_subcodeoffset + SUB_CHANNEL_SIZE, 0xffff0000); + cdrom_subcodeoffset += 100; + set_status(CDINTERRUPT_SUBCODE); + } + + } else { inc = 0; } if (sector_buffer_info_1[sec] != 0xff) sector_buffer_info_1[sec]--; -#if AKIKO_DEBUG_IO_CMD - write_log(_T("pbx=%04x sec=%d, scnt=%d -> %d. %d (%04x) %08X\n"), - cdrom_pbx, - cdrom_data_offset, - cdrom_sector_counter, - sector, - seccnt, - 1 << seccnt, - cdrom_addressdata + seccnt * 4096); -#endif - } - else { + } else { inc = 0; } if (inc) @@ -1275,73 +1040,86 @@ static void cdrom_run_read(void) static int lastmediastate = 0; -static void akiko_handler(bool framesync) +static void akiko_handler (bool framesync) { if (unitnum < 0) return; - if (!cd_initialized || cdrom_receive_length) + + if (cdrom_receive_length) + return; + + if (!cd_initialized) { + // first status is always 0x0a if booted with CD inserted + if (sys_command_ismedia(unitnum, 0) > 0) + cdrom_start_return_data(cdrom_command_media_status()); + cd_initialized = 1; + return; + } + + if (cd_initialized < 2) return; if (mediachanged) { - if (cdrom_start_return_data(0) < 0) { - cdrom_start_return_data(cdrom_command_media_status()); + if (cdrom_can_return_data()) { + cdrom_start_return_data (cdrom_command_media_status ()); mediachanged = 0; - get_cdrom_toc(); + get_cdrom_toc (); /* do not remove! first try may fail */ - get_cdrom_toc(); + get_cdrom_toc (); } return; } if (cdrom_audiotimeout > 1) cdrom_audiotimeout--; - if (cdrom_audiotimeout == 1) { // play start - cdrom_playing = 1; - //cdrom_start_return_data (cdrom_playend_notify (0)); + if (cdrom_audiotimeout == 1 && cdrom_can_return_data()) { // play start + if (!cdrom_playing) + cdrom_playing = 1; + if (cdrom_playing == 1) + cdrom_start_return_data (cdrom_playend_notify (0)); + cdrom_playing = 2; cdrom_audiotimeout = 0; } if (cdrom_audiotimeout == -1) { // play finished (or disk end) if (cdrom_playing) { - cdaudiostop(); + cdaudiostop (); cdrom_audiotimeout = -2; - } - else { + } else { cdrom_audiotimeout = 0; } } - if (cdrom_audiotimeout == -2) { // play end notification - cdrom_start_return_data(cdrom_playend_notify(1)); + if (cdrom_audiotimeout == -2 && cdrom_can_return_data()) { // play end notification + cdrom_start_return_data (cdrom_playend_notify (1)); cdrom_audiotimeout = 0; } // play didn't start notification (illegal address) - if (cdrom_audiotimeout == -3) { // return error status - cdrom_start_return_data(cdrom_playend_notify(-1)); + if (cdrom_audiotimeout == -3 && cdrom_can_return_data()) { // return error status + cdrom_start_return_data (cdrom_playend_notify (-1)); cdrom_audiotimeout = 0; } /* one toc entry / frame */ - if (cdrom_toc_counter >= 0 && !cdrom_command_active && framesync) { - if (cdrom_start_return_data(-1)) { - cdrom_start_return_data(cdrom_return_toc_entry()); - } + if (cdrom_toc_counter >= 0 && !cdrom_command_active && framesync && cdrom_can_return_data()) { + cdrom_start_return_data (cdrom_return_toc_entry ()); } } -static void akiko_internal(void) +static void akiko_internal (void) { if (!currprefs.cs_cd32cd) return; - cdrom_return_data(); - cdrom_run_command(); + cdrom_return_data (); + cdrom_run_command (); if (cdrom_command_active > 0) { cdrom_command_active--; if (!cdrom_command_active) - cdrom_run_command_run(); + cdrom_run_command_run (); } } -void AKIKO_hsync_handler(void) +void AKIKO_hsync_handler (void) { bool framesync = false; + if (!currprefs.cs_cd32cd || !akiko_inited) return; @@ -1349,22 +1127,25 @@ void AKIKO_hsync_handler(void) framecounter--; if (framecounter <= 0) { if (cdrom_seek_delay <= 0) { - cdrom_run_read(); - } - else { + cdrom_run_read (); + } else { cdrom_seek_delay--; } framecounter += (float)maxvpos * vblank_hz / (75.0 * cdrom_speed); + if (currprefs.cd_speed == 0) + framecounter = 1; framesync = true; } if (cdrom_tx_dma_delay > 0) cdrom_tx_dma_delay--; + if (cdrom_rx_dma_delay > 0) + cdrom_rx_dma_delay--; subcodecounter--; if (subcodecounter <= 0) { if ((cdrom_flags & CDFLAG_SUBCODE) && cdrom_playing && subcodebufferoffset != subcodebufferoffsetw) { - uae_sem_wait(&sub_sem); + uae_sem_wait (&sub_sem); if (subcodebufferinuse[subcodebufferoffset]) { if (cdrom_subcodeoffset >= 128) cdrom_subcodeoffset = 0; @@ -1372,17 +1153,17 @@ void AKIKO_hsync_handler(void) cdrom_subcodeoffset = 128; // 96 byte subchannel data for (int i = 0; i < SUB_CHANNEL_SIZE; i++) - put_byte(subcode_address + cdrom_subcodeoffset + i, subcodebuffer[subcodebufferoffset * SUB_CHANNEL_SIZE + i]); - put_long(subcode_address + cdrom_subcodeoffset + SUB_CHANNEL_SIZE, 0xffffffff); + put_byte (subcode_address + cdrom_subcodeoffset + i, subcodebuffer[subcodebufferoffset * SUB_CHANNEL_SIZE + i]); + put_long (subcode_address + cdrom_subcodeoffset + SUB_CHANNEL_SIZE, 0xffff0000); subcodebufferinuse[subcodebufferoffset] = 0; cdrom_subcodeoffset += 100; subcodebufferoffset++; if (subcodebufferoffset >= MAX_SUBCODEBUFFER) subcodebufferoffset -= MAX_SUBCODEBUFFER; - set_status(CDINTERRUPT_SUBCODE); + set_status (CDINTERRUPT_SUBCODE); //write_log (_T("*")); } - uae_sem_post(&sub_sem); + uae_sem_post (&sub_sem); } subcodecounter = maxvpos * vblank_hz / (75 * cdrom_speed) - 5; } @@ -1392,12 +1173,12 @@ void AKIKO_hsync_handler(void) if (mediacheckcounter > 0) mediacheckcounter--; - akiko_internal(); - akiko_handler(framesync); + akiko_internal (); + akiko_handler (framesync); } /* cdrom data buffering thread */ -static void *akiko_thread(void *null) +static void *akiko_thread (void *null) { int i; uae_u8 *tmp1; @@ -1405,144 +1186,149 @@ static void *akiko_thread(void *null) int tmp3; int sector; - while (akiko_thread_running || comm_pipe_has_data(&requests)) { + while (akiko_thread_running || comm_pipe_has_data (&requests)) { - if (comm_pipe_has_data(&requests)) { - uae_u32 b = read_comm_pipe_u32_blocking(&requests); + if (comm_pipe_has_data (&requests)) { + uae_u32 b = read_comm_pipe_u32_blocking (&requests); switch (b) { case 0x0102: // pause - sys_command_cd_pause(unitnum, 1); + sys_command_cd_pause (unitnum, 1); break; case 0x0103: // unpause - sys_command_cd_pause(unitnum, 0); + sys_command_cd_pause (unitnum, 0); break; case 0x0104: // stop - cdaudiostop_do(); + cdaudiostop_do (); break; case 0x0105: // mute change - sys_command_cd_volume(unitnum, cdrom_muted ? 0 : 0x7fff, cdrom_muted ? 0 : 0x7fff); + sys_command_cd_volume (unitnum, cdrom_muted ? 0 : 0x7fff, cdrom_muted ? 0 : 0x7fff); break; case 0x0110: // do_play! - sys_command_cd_volume(unitnum, cdrom_muted ? 0 : 0x7fff, cdrom_muted ? 0 : 0x7fff); - cdaudioplay_do(); + sys_command_cd_volume (unitnum, cdrom_muted ? 0 : 0x7fff, cdrom_muted ? 0 : 0x7fff); + cdaudioplay_do (); break; } } if (frame2counter <= 0) { frame2counter = 312 * 50 / 2; - if (unitnum >= 0 && sys_command_cd_qcode(unitnum, qcode_buf)) { + if (unitnum >= 0 && sys_command_cd_qcode (unitnum, qcode_buf, -1, false)) { qcode_valid = 1; } } if (mediacheckcounter <= 0) { mediacheckcounter = 312 * 50 * 2; - int media = sys_command_ismedia(unitnum, 1); + int media = sys_command_ismedia (unitnum, 1); if (media < 0) { - write_log(_T("CD32: device unit %d lost\n"), unitnum); + write_log (_T("CD32: device unit %d lost\n"), unitnum); media = lastmediastate = cdrom_disk = 0; mediachanged = 1; - cdaudiostop_do(); - } - else if (media != lastmediastate) { + cdaudiostop_do (); + } else if (media != lastmediastate) { if (!media && lastmediastate > 1) { // ignore missing media if statefile restored with cd present if (lastmediastate == 2) - write_log(_T("CD32: CD missing but statefile was stored with CD inserted: faking media present\n")); + write_log (_T("CD32: CD missing but statefile was stored with CD inserted: faking media present\n")); lastmediastate = 3; - } - else { - write_log(_T("CD32: media changed = %d\n"), media); + } else { + write_log (_T("CD32: media changed = %d\n"), media); lastmediastate = cdrom_disk = media; mediachanged = 1; - cdaudiostop_do(); + cdaudiostop_do (); } } } - uae_sem_wait(&akiko_sem); + uae_sem_wait (&akiko_sem); sector = cdrom_current_sector; for (i = 0; i < SECTOR_BUFFER_SIZE; i++) { if (sector_buffer_info_1[i] == 0xff) break; } - if (cdrom_data_end > 0 && sector >= 0 && + if (sector >= 0 && is_valid_data_sector(sector) && (sector_buffer_sector_1 < 0 || sector < sector_buffer_sector_1 || sector >= sector_buffer_sector_1 + SECTOR_BUFFER_SIZE * 2 / 3 || i != SECTOR_BUFFER_SIZE)) { int blocks; - memset(sector_buffer_info_2, 0, SECTOR_BUFFER_SIZE); -#if AKIKO_DEBUG_IO_CMD - write_log(_T("filling buffer sector=%d (max=%d)\n"), sector, cdrom_data_end); -#endif + memset (sector_buffer_info_2, 0, SECTOR_BUFFER_SIZE); sector_buffer_sector_2 = sector; - if (sector + SECTOR_BUFFER_SIZE >= cdrom_data_end) - blocks = cdrom_data_end - sector; - else - blocks = SECTOR_BUFFER_SIZE; - int ok = sys_command_cd_rawread(unitnum, sector_buffer_2, sector, blocks, 2352); - if (!ok) { - int offset = 0; - while (offset < SECTOR_BUFFER_SIZE) { - int ok = 0; - if (sector < cdrom_data_end) - ok = sys_command_cd_rawread(unitnum, sector_buffer_2 + offset * 2352, sector, 1, 2352); - sector_buffer_info_2[offset] = ok ? 3 : 0; - offset++; - sector++; + if (!is_valid_data_sector(sector + SECTOR_BUFFER_SIZE)) { + for (blocks = SECTOR_BUFFER_SIZE; blocks > 0; blocks--) { + if (is_valid_data_sector(sector + blocks)) + break; } + } else { + blocks = SECTOR_BUFFER_SIZE; } - else { - for (int i = 0; i < SECTOR_BUFFER_SIZE; i++) - sector_buffer_info_2[i] = i < blocks ? 3 : 0; + if (blocks) { + int ok = sys_command_cd_rawread (unitnum, sector_buffer_2, sector, blocks, 2352); + if (!ok) { + int offset = 0; + while (offset < SECTOR_BUFFER_SIZE) { + int ok = 0; + if (is_valid_data_sector(sector)) + ok = sys_command_cd_rawread (unitnum, sector_buffer_2 + offset * 2352, sector, 1, 2352); + sector_buffer_info_2[offset] = ok ? 3 : 0; + offset++; + sector++; + } + } else { + for (int i = 0; i < SECTOR_BUFFER_SIZE; i++) + sector_buffer_info_2[i] = i < blocks ? 3 : 0; + } + tmp1 = sector_buffer_info_1; + sector_buffer_info_1 = sector_buffer_info_2; + sector_buffer_info_2 = tmp1; + tmp2 = sector_buffer_1; + sector_buffer_1 = sector_buffer_2; + sector_buffer_2 = tmp2; + tmp3 = sector_buffer_sector_1; + sector_buffer_sector_1 = sector_buffer_sector_2; + sector_buffer_sector_2 = tmp3; } - tmp1 = sector_buffer_info_1; - sector_buffer_info_1 = sector_buffer_info_2; - sector_buffer_info_2 = tmp1; - tmp2 = sector_buffer_1; - sector_buffer_1 = sector_buffer_2; - sector_buffer_2 = tmp2; - tmp3 = sector_buffer_sector_1; - sector_buffer_sector_1 = sector_buffer_sector_2; - sector_buffer_sector_2 = tmp3; } - uae_sem_post(&akiko_sem); - sleep_millis(10); + uae_sem_post (&akiko_sem); + sleep_millis (10); } akiko_thread_running = -1; return 0; } -STATIC_INLINE uae_u8 akiko_get_long(uae_u32 v, int offset) +STATIC_INLINE uae_u8 akiko_get_long (uae_u32 v, int offset) { return v >> ((3 - offset) * 8); } -STATIC_INLINE void akiko_put_long(uae_u32 *p, int offset, int v) +STATIC_INLINE void akiko_put_long (uae_u32 *p, int offset, int v) { *p &= ~(0xff << ((3 - offset) * 8)); *p |= v << ((3 - offset) * 8); } -static uae_u32 REGPARAM3 akiko_lget(uaecptr) REGPARAM; -static uae_u32 REGPARAM3 akiko_wget(uaecptr) REGPARAM; -static uae_u32 REGPARAM3 akiko_bget(uaecptr) REGPARAM; -static uae_u32 REGPARAM3 akiko_lgeti(uaecptr) REGPARAM; -static uae_u32 REGPARAM3 akiko_wgeti(uaecptr) REGPARAM; -static void REGPARAM3 akiko_lput(uaecptr, uae_u32) REGPARAM; -static void REGPARAM3 akiko_wput(uaecptr, uae_u32) REGPARAM; -static void REGPARAM3 akiko_bput(uaecptr, uae_u32) REGPARAM; +static uae_u32 REGPARAM3 akiko_lget (uaecptr) REGPARAM; +static uae_u32 REGPARAM3 akiko_wget (uaecptr) REGPARAM; +static uae_u32 REGPARAM3 akiko_bget (uaecptr) REGPARAM; +static uae_u32 REGPARAM3 akiko_lgeti (uaecptr) REGPARAM; +static uae_u32 REGPARAM3 akiko_wgeti (uaecptr) REGPARAM; +static void REGPARAM3 akiko_lput (uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 akiko_wput (uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 akiko_bput (uaecptr, uae_u32) REGPARAM; -static uae_u32 akiko_bget2(uaecptr addr, int msg) +static uae_u32 akiko_bget2 (uaecptr addr, int msg) { uae_u8 v = 0; - addr &= 0xffff; + addr &= 0x3f; switch (addr) { - /* "CAFE" = Akiko identification. - * Kickstart ignores Akiko C2P if this ID isn't correct */ + /* "C0CACAFE" = Akiko identification. + * Kickstart Akiko C2P support requires $CAFE at $B80002.W + * $B80000 $C0CA is not checked. + */ + case 0x00: + return 0xC0; + case 0x01: case 0x02: return 0xCA; case 0x03: @@ -1553,30 +1339,30 @@ static uae_u32 akiko_bget2(uaecptr addr, int msg) case 0x32: case 0x33: if (currprefs.cs_cd32nvram) - v = akiko_nvram_read(addr - 0x30); + v = akiko_nvram_read (addr - 0x30); return v; - /* C2P */ case 0x38: case 0x39: case 0x3a: case 0x3b: if (currprefs.cs_cd32c2p) - v = akiko_c2p_read(addr - 0x38); + v = akiko_c2p_read (addr - 0x38); return v; } + if (!currprefs.cs_cd32cd) + return v; - uae_sem_wait(&akiko_sem); + uae_sem_wait (&akiko_sem); switch (addr) { - if (currprefs.cs_cd32cd) { - /* CDROM control */ + /* CDROM control */ case 0x04: case 0x05: case 0x06: case 0x07: - v = akiko_get_long(cdrom_intreq, addr - 0x04); + v = akiko_get_long (cdrom_intreq, addr - 0x04); break; case 0x08: case 0x09: @@ -1584,111 +1370,129 @@ static uae_u32 akiko_bget2(uaecptr addr, int msg) case 0x0b: v = akiko_get_long(cdrom_intena, addr - 0x08); break; - case 0x10: - case 0x11: - case 0x12: - case 0x13: - v = akiko_get_long(cdrom_addressdata, addr - 0x10); - break; - case 0x14: - case 0x15: - case 0x16: - case 0x17: - v = akiko_get_long(cdrom_addressmisc, addr - 0x14); + case 0x0c: + case 0x0d: + case 0x0e: + case 0x0f: + // read only duplicate of intena + v = akiko_get_long(cdrom_intena, addr - 0x0c); break; + + // 0x18-0x1b are mirrored to 0x10, 0x14 and 0x1c case 0x18: + case 0x10: + case 0x14: + case 0x1c: v = cdrom_subcodeoffset; break; case 0x19: + case 0x11: + case 0x15: + case 0x1d: v = cdcomtxinx; break; case 0x1a: + case 0x12: + case 0x16: + case 0x1e: v = cdcomrxinx; break; + case 0x1b: + + case 0x13: + case 0x17: case 0x1f: - v = cdcomrxcmp; + v = 0; break; + case 0x20: case 0x21: - v = akiko_get_long(cdrom_pbx, addr - 0x20 + 2); + v = akiko_get_long (cdrom_pbx, addr - 0x20 + 2); break; case 0x24: case 0x25: case 0x26: case 0x27: - v = akiko_get_long(cdrom_flags, addr - 0x24); + v = akiko_get_long (cdrom_flags, addr - 0x24); break; - } - else if (addr < 0x30) { - break; - } - default: - write_log(_T("akiko_bget: unknown address %08X PC=%08X\n"), addr, M68K_GETPC); - v = 0; - break; + case 0x28: + if (!(cdrom_flags & CDFLAG_RXD) && cdrom_receive_offset < cdrom_receive_length) { + cdrom_last_rx = cdrom_result_buffer[cdrom_receive_offset++]; + if (cdrom_receive_offset == cdrom_receive_length) { + cdrom_intreq &= ~CDINTERRUPT_DRIVERECV; + cdrom_receive_length = 0; + set_status(CDINTERRUPT_DRIVEXMIT); + } + } else { + cdrom_intreq &= ~CDINTERRUPT_DRIVERECV; + } + v = cdrom_last_rx; + break; + + default: + write_log (_T("akiko_bget: unknown address %08X PC=%08X\n"), addr, M68K_GETPC); + v = 0; + break; } - akiko_internal(); - uae_sem_post(&akiko_sem); - if (msg && addr < 0x30 && AKIKO_DEBUG_IO) - write_log(_T("akiko_bget %08X: %08X %02X\n"), M68K_GETPC, addr, v & 0xff); + akiko_internal (); + uae_sem_post (&akiko_sem); return v; } -static uae_u32 REGPARAM2 akiko_bget(uaecptr addr) +static void check_read_c2p(uaecptr addr) { -#ifdef JIT - special_mem |= S_READ; -#endif - return akiko_bget2(addr, 1); + if (addr < 0x38 || addr >= 0x3c) + return; + akiko_read_offset++; + akiko_read_offset &= 7; } -static uae_u32 REGPARAM2 akiko_wget(uaecptr addr) +static uae_u32 REGPARAM2 akiko_bget (uaecptr addr) +{ + uae_u8 v; + addr &= 0xffff; + if (addr >= 0x8000) + return 0; + v = akiko_bget2 (addr, 1); + check_read_c2p(addr); + return v; +} + +static uae_u32 REGPARAM2 akiko_wget (uaecptr addr) { uae_u16 v; -#ifdef JIT - special_mem |= S_READ; -#endif addr &= 0xffff; - v = akiko_bget2(addr + 1, 0); - v |= akiko_bget2(addr + 0, 0) << 8; - if (addr < 0x30 && AKIKO_DEBUG_IO) - write_log(_T("akiko_wget %08X: %08X %04X\n"), M68K_GETPC, addr, v & 0xffff); + if (addr >= 0x8000) + return 0; + v = akiko_bget2 (addr + 1, 0); + v |= akiko_bget2 (addr + 0, 0) << 8; + check_read_c2p(addr); return v; } -static uae_u32 REGPARAM2 akiko_lget(uaecptr addr) +static uae_u32 REGPARAM2 akiko_lget (uaecptr addr) { uae_u32 v; -#ifdef JIT - special_mem |= S_READ; -#endif addr &= 0xffff; - v = akiko_bget2(addr + 3, 0); - v |= akiko_bget2(addr + 2, 0) << 8; - v |= akiko_bget2(addr + 1, 0) << 16; - v |= akiko_bget2(addr + 0, 0) << 24; - if (addr < 0x30 && (addr != 4 && addr != 8) && AKIKO_DEBUG_IO) - write_log(_T("akiko_lget %08X: %08X %08X\n"), M68K_GETPC, addr, v); + if (addr >= 0x8000) + return 0; + v = akiko_bget2 (addr + 3, 0); + v |= akiko_bget2 (addr + 2, 0) << 8; + v |= akiko_bget2 (addr + 1, 0) << 16; + v |= akiko_bget2 (addr + 0, 0) << 24; + check_read_c2p(addr); return v; } -bool akiko_ntscmode(void) -{ - return (cdrom_flags & CDFLAG_NTSC) != 0; -} - -static void akiko_bput2(uaecptr addr, uae_u32 v, int msg) +static void akiko_bput2 (uaecptr addr, uae_u32 v, int msg) { uae_u32 tmp; - addr &= 0xffff; + addr &= 0x3f; v &= 0xff; - if (msg && addr < 0x30 && AKIKO_DEBUG_IO) - write_log(_T("akiko_bput %08X: %08X=%02X\n"), M68K_GETPC, addr, v & 0xff); - switch (addr) { case 0x30: @@ -1696,7 +1500,7 @@ static void akiko_bput2(uaecptr addr, uae_u32 v, int msg) case 0x32: case 0x33: if (currprefs.cs_cd32nvram) - akiko_nvram_write(addr - 0x30, v); + akiko_nvram_write (addr - 0x30, v); return; case 0x38: @@ -1704,129 +1508,136 @@ static void akiko_bput2(uaecptr addr, uae_u32 v, int msg) case 0x3a: case 0x3b: if (currprefs.cs_cd32c2p) - akiko_c2p_write(addr - 0x38, v); + akiko_c2p_write (addr - 0x38, v); return; } - uae_sem_wait(&akiko_sem); + if (!currprefs.cs_cd32cd) + return; + + uae_sem_wait (&akiko_sem); switch (addr) { - if (currprefs.cs_cd32cd) { - case 0x04: - case 0x05: - case 0x06: - case 0x07: - akiko_put_long(&cdrom_intreq, addr - 0x04, v); - break; - case 0x08: - case 0x09: - case 0x0a: - case 0x0b: - akiko_put_long(&cdrom_intena, addr - 0x08, v); - if (addr == 8) - cdrom_intreq &= cdrom_intena; - break; - case 0x10: - case 0x11: - case 0x12: - case 0x13: - akiko_put_long(&cdrom_addressdata, addr - 0x10, v); - cdrom_addressdata &= 0x00fff000; - break; - case 0x14: - case 0x15: - case 0x16: - case 0x17: - akiko_put_long(&cdrom_addressmisc, addr - 0x14, v); - cdrom_addressmisc &= 0x00fffc00; - subcode_address = cdrom_addressmisc | 0x100; - cdrx_address = cdrom_addressmisc; - cdtx_address = cdrom_addressmisc | 0x200; - break; - case 0x18: - cdrom_intreq &= ~CDINTERRUPT_SUBCODE; - break; - case 0x1d: - cdrom_intreq &= ~CDINTERRUPT_TXDMADONE; - cdcomtxcmp = v; - cdrom_tx_dma_delay = 5; - break; - case 0x1f: - cdrom_intreq &= ~CDINTERRUPT_RXDMADONE; - cdcomrxcmp = v; - break; - case 0x20: - case 0x21: - tmp = cdrom_pbx; - akiko_put_long(&cdrom_pbx, addr - 0x20 + 2, v); - cdrom_pbx |= tmp; - cdrom_pbx &= 0xffff; - cdrom_intreq &= ~CDINTERRUPT_PBX; - break; - case 0x24: - case 0x25: - case 0x26: - case 0x27: - tmp = cdrom_flags; - akiko_put_long(&cdrom_flags, addr - 0x24, v); - if ((cdrom_flags & CDFLAG_ENABLE) && !(tmp & CDFLAG_ENABLE)) - cdrom_sector_counter = 0; - if (!(cdrom_flags & CDFLAG_PBX) && (tmp & CDFLAG_PBX)) - cdrom_pbx = 0; - if ((cdrom_flags & CDFLAG_SUBCODE) && !(tmp & CDFLAG_SUBCODE)) { - uae_sem_wait(&sub_sem); - memset(subcodebufferinuse, 0, sizeof subcodebufferinuse); - subcodebufferoffset = subcodebufferoffsetw = 0; - uae_sem_post(&sub_sem); + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + akiko_put_long (&cdrom_intena, addr - 0x08, v); + cdrom_intena &= 0xff000000; + break; + case 0x10: + case 0x11: + case 0x12: + case 0x13: + akiko_put_long (&cdrom_addressdata, addr - 0x10, v); + cdrom_addressdata &= 0x00fff000; + break; + case 0x14: + case 0x15: + case 0x16: + case 0x17: + akiko_put_long (&cdrom_addressmisc, addr - 0x14, v); + cdrom_addressmisc &= 0x00fffc00; + subcode_address = cdrom_addressmisc | 0x100; + cdrx_address = cdrom_addressmisc; + cdtx_address = cdrom_addressmisc | 0x200; + break; + case 0x18: + cdrom_intreq &= ~CDINTERRUPT_SUBCODE; + break; + case 0x1d: + cdrom_intreq &= ~CDINTERRUPT_TXDMADONE; + cdcomtxcmp = v; + cdrom_tx_dma_delay = 3; + break; + case 0x1f: + cdrom_intreq &= ~CDINTERRUPT_RXDMADONE; + cdcomrxcmp = v; + cdrom_rx_dma_delay = 3; + break; + case 0x20: + case 0x21: + tmp = cdrom_pbx; + akiko_put_long (&cdrom_pbx, addr - 0x20 + 2, v); + cdrom_pbx |= tmp; + cdrom_pbx &= 0xffff; + // cdrom_pbx stays zeroed if disabled. + if (!(cdrom_flags & CDFLAG_PBX)) + cdrom_pbx = 0x0000; + cdrom_intreq &= ~CDINTERRUPT_PBX; + break; + case 0x24: + case 0x25: + case 0x26: + case 0x27: + tmp = cdrom_flags; + akiko_put_long (&cdrom_flags, addr - 0x24, v); + if ((cdrom_flags & CDFLAG_ENABLE) && !(tmp & CDFLAG_ENABLE)) { + cdrom_sector_counter = 0; + cdrom_intreq &= ~CDINTERRUPT_OVERFLOW; + } + if (!(cdrom_flags & CDFLAG_PBX)) { + cdrom_pbx = 0x0000; + } + if ((cdrom_flags & CDFLAG_SUBCODE) && !(tmp & CDFLAG_SUBCODE)) { + uae_sem_wait (&sub_sem); + memset (subcodebufferinuse, 0, sizeof subcodebufferinuse); + subcodebufferoffset = subcodebufferoffsetw = 0; + uae_sem_post (&sub_sem); + } + cdrom_flags &= 0xff800000; + break; + case 0x28: + if (!(cdrom_flags & CDFLAG_TXD)) { + cdrom_intreq &= ~CDINTERRUPT_DRIVEXMIT; + if (can_send_command()) { + cdrom_add_command_byte(v); + if (can_send_command()) { + set_status(CDINTERRUPT_DRIVEXMIT); + } } - break; - } - else if (addr < 0x30) { - break; } + break; default: - write_log(_T("akiko_bput: unknown address %08X=%02X PC=%08X\n"), addr, v & 0xff, M68K_GETPC); + write_log (_T("akiko_bput: unknown address %08X=%02X PC=%08X\n"), addr, v & 0xff, M68K_GETPC); break; } - akiko_internal(); - uae_sem_post(&akiko_sem); + akiko_internal (); + uae_sem_post (&akiko_sem); } -static void REGPARAM2 akiko_bput(uaecptr addr, uae_u32 v) +bool akiko_ntscmode(void) +{ + return (cdrom_flags & CDFLAG_NTSC) != 0; +} + +static void REGPARAM2 akiko_bput (uaecptr addr, uae_u32 v) { addr &= 0xffff; if (addr >= 0x8000) return; - akiko_bput2(addr, v, 1); + akiko_bput2 (addr, v, 1); } -static void REGPARAM2 akiko_wput(uaecptr addr, uae_u32 v) +static void REGPARAM2 akiko_wput (uaecptr addr, uae_u32 v) { addr &= 0xfff; if (addr >= 0x8000) return; - if ((addr < 0x30 && AKIKO_DEBUG_IO)) { - //if (log_cd32 > 1) - // write_log(_T("akiko_wput %08X: %08X=%04X\n"), M68K_GETPC, addr, v & 0xffff); - } - akiko_bput2(addr + 1, v & 0xff, 0); - akiko_bput2(addr + 0, v >> 8, 0); + akiko_bput2 (addr + 1, v & 0xff, 0); + akiko_bput2 (addr + 0, v >> 8, 0); } -static void REGPARAM2 akiko_lput(uaecptr addr, uae_u32 v) +static void REGPARAM2 akiko_lput (uaecptr addr, uae_u32 v) { addr &= 0xffff; if (addr >= 0x8000) return; - if (addr < 0x30 && AKIKO_DEBUG_IO) { - //if (log_cd32 > 1) - // write_log(_T("akiko_lput %08X: %08X=%08X\n"), M68K_GETPC, addr, v); - } - akiko_bput2(addr + 3, (v >> 0) & 0xff, 0); - akiko_bput2(addr + 2, (v >> 8) & 0xff, 0); - akiko_bput2(addr + 1, (v >> 16) & 0xff, 0); - akiko_bput2(addr + 0, (v >> 24) & 0xff, 0); + akiko_bput2 (addr + 3, (v >> 0) & 0xff, 0); + akiko_bput2 (addr + 2, (v >> 8) & 0xff, 0); + akiko_bput2 (addr + 1, (v >> 16) & 0xff, 0); + akiko_bput2 (addr + 0, (v >> 24) & 0xff, 0); } addrbank akiko_bank = { @@ -1837,48 +1648,48 @@ addrbank akiko_bank = { ABFLAG_IO | ABFLAG_SAFE, S_READ, S_WRITE }; -static const uae_u8 patchdata[] = { 0x0c, 0x82, 0x00, 0x00, 0x03, 0xe8, 0x64, 0x00, 0x00, 0x46 }; -static void patchrom(void) +static const uae_u8 patchdata[]={0x0c,0x82,0x00,0x00,0x03,0xe8,0x64,0x00,0x00,0x46}; +static void patchrom (void) { - int i; + int i; if (currprefs.cpu_model > 68020 || currprefs.cachesize || currprefs.m68k_speed != 0) { uae_u8 *p = extendedkickmem_bank.baseaddr; - for (i = 0; i < 524288 - sizeof(patchdata); i++) { - if (!memcmp(p + i, patchdata, sizeof(patchdata))) { - protect_roms(false); - p[i + 6] = 0x4e; - p[i + 7] = 0x71; - p[i + 8] = 0x4e; - p[i + 9] = 0x71; - protect_roms(true); - write_log(_T("extended rom delay loop patched at 0x%p\n"), i + 6 + 0xe00000); - return; + if (p) { + for (i = 0; i < 524288 - sizeof (patchdata); i++) { + if (!memcmp (p + i, patchdata, sizeof(patchdata))) { + protect_roms (false); + p[i + 6] = 0x4e; + p[i + 7] = 0x71; + p[i + 8] = 0x4e; + p[i + 9] = 0x71; + protect_roms (true); + write_log (_T("CD32: extended rom delay loop patched at 0x%08x\n"), i + 6 + 0xe00000); + return; + } } + write_log (_T("CD32: couldn't patch extended rom\n")); } - write_log(_T("couldn't patch extended rom\n")); } } -static void akiko_cdrom_free(void) +static void akiko_cdrom_free (void) { - sys_cddev_close(); - xfree(sector_buffer_1); - xfree(sector_buffer_2); - xfree(sector_buffer_info_1); - xfree(sector_buffer_info_2); + sys_cddev_close (); + xfree (sector_buffer_1); + xfree (sector_buffer_2); + xfree (sector_buffer_info_1); + xfree (sector_buffer_info_2); sector_buffer_1 = 0; sector_buffer_2 = 0; sector_buffer_info_1 = 0; sector_buffer_info_2 = 0; } -void akiko_reset(void) +void akiko_reset (void) { - cdaudiostop_do(); - nvram_read(); - state = I2C_WAIT; - bitcounter = -1; - direction = -1; + cdaudiostop_do (); + nvram_read (); + eeprom_reset(cd32_eeprom); cdrom_speed = 1; cdrom_current_sector = -1; @@ -1887,6 +1698,10 @@ void akiko_reset(void) cdcomrxinx = 0; cdcomtxcmp = 0; lastmediastate = -1; + cdrom_last_rx = 0; + cdrom_intreq = CDINTERRUPT_SUBCODE; + cdrom_subcodeoffset = 0xc2; + cdrom_intena = 0; } cdrom_led = 0; cdrom_receive_length = 0; @@ -1894,58 +1709,70 @@ void akiko_reset(void) cd_initialized = 0; if (akiko_thread_running > 0) { - cdaudiostop(); + cdaudiostop (); akiko_thread_running = 0; - while (akiko_thread_running == 0) - sleep_millis(10); + while(akiko_thread_running == 0) + sleep_millis (10); + destroy_comm_pipe(&requests); akiko_thread_running = 0; } - akiko_cdrom_free(); + akiko_cdrom_free (); mediacheckcounter = 0; akiko_inited = false; } - -void akiko_free(void) +void akiko_free (void) { - akiko_reset(); - akiko_cdrom_free(); + akiko_reset (); + akiko_cdrom_free (); + if(akiko_sem != 0) + uae_sem_destroy(&akiko_sem); + akiko_sem = 0; + if(sub_sem != 0) + uae_sem_destroy(&sub_sem); + sub_sem = 0; } -int akiko_init(void) +int akiko_init (void) { if (!currprefs.cs_cd32cd) return 0; - akiko_free(); - akiko_precalculate(); + akiko_free (); + akiko_precalculate (); unitnum = -1; - sys_cddev_open(); - sector_buffer_1 = xmalloc(uae_u8, SECTOR_BUFFER_SIZE * 2352); - sector_buffer_2 = xmalloc(uae_u8, SECTOR_BUFFER_SIZE * 2352); - sector_buffer_info_1 = xmalloc(uae_u8, SECTOR_BUFFER_SIZE); - sector_buffer_info_2 = xmalloc(uae_u8, SECTOR_BUFFER_SIZE); + sys_cddev_open (); + sector_buffer_1 = xmalloc (uae_u8, SECTOR_BUFFER_SIZE * 2352); + sector_buffer_2 = xmalloc (uae_u8, SECTOR_BUFFER_SIZE * 2352); + sector_buffer_info_1 = xmalloc (uae_u8, SECTOR_BUFFER_SIZE); + sector_buffer_info_2 = xmalloc (uae_u8, SECTOR_BUFFER_SIZE); sector_buffer_sector_1 = -1; sector_buffer_sector_2 = -1; - uae_sem_init(&akiko_sem, 0, 1); - uae_sem_init(&sub_sem, 0, 1); + if(akiko_sem != 0) + uae_sem_destroy(&akiko_sem); + akiko_sem = 0; + uae_sem_init (&akiko_sem, 0, 1); + if(sub_sem != 0) + uae_sem_destroy(&sub_sem); + sub_sem = 0; + uae_sem_init (&sub_sem, 0, 1); if (!savestate_state) { cdrom_playing = cdrom_paused = 0; cdrom_data_offset = -1; } - patchrom(); + patchrom (); if (!akiko_thread_running) { akiko_thread_running = 1; - init_comm_pipe(&requests, 100, 1); - uae_start_thread(_T("akiko"), akiko_thread, 0, NULL); + init_comm_pipe (&requests, 100, 1); + uae_start_thread (_T("akiko"), akiko_thread, 0, NULL); } - gui_flicker_led(LED_HD, 0, -1); + gui_flicker_led (LED_HD, 0, -1); akiko_inited = true; return 1; } #ifdef SAVESTATE -uae_u8 *save_akiko(int *len, uae_u8 *dstptr) +uae_u8 *save_akiko (int *len, uae_u8 *dstptr) { uae_u8 *dstbak, *dst; int i; @@ -1956,102 +1783,101 @@ uae_u8 *save_akiko(int *len, uae_u8 *dstptr) if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = xmalloc(uae_u8, 1000); - save_u16(0); - save_u16(0xCAFE); - save_u32(cdrom_intreq); - save_u32(cdrom_intena); - save_u32(0); - save_u32(cdrom_addressdata); - save_u32(cdrom_addressmisc); - save_u8(cdrom_subcodeoffset); - save_u8(cdcomtxinx); - save_u8(cdcomrxinx); - save_u8(0); - save_u8(0); - save_u8(cdcomtxcmp); - save_u8(0); - save_u8(cdcomrxcmp); - save_u16((uae_u16)cdrom_pbx); - save_u16(0); - save_u32(cdrom_flags); - save_u32(0); - save_u32(0); - save_u32((scl_dir ? 0x8000 : 0) | (sda_dir ? 0x4000 : 0)); - save_u32(0); - save_u32(0); + dstbak = dst = xmalloc (uae_u8, 1000); + save_u16 (0); + save_u16 (0xCAFE); + save_u32 (cdrom_intreq); + save_u32 (cdrom_intena); + save_u32 (0); + save_u32 (cdrom_addressdata); + save_u32 (cdrom_addressmisc); + save_u8 (cdrom_subcodeoffset); + save_u8 (cdcomtxinx); + save_u8 (cdcomrxinx); + save_u8 (0); + save_u8 (0); + save_u8 (cdcomtxcmp); + save_u8 (0); + save_u8 (cdcomrxcmp); + save_u16 ((uae_u16)cdrom_pbx); + save_u16 (0); + save_u32 (cdrom_flags); + save_u32 (0); + save_u32 (0); + save_u32 (cd32_i2c_direction << 8); + save_u32 (0); + save_u32 (0); for (i = 0; i < 8; i++) - save_u32(akiko_buffer[i]); - save_u8((uae_u8)akiko_read_offset); - save_u8((uae_u8)akiko_write_offset); + save_u32 (akiko_buffer[i]); + save_u8 ((uae_u8)akiko_read_offset); + save_u8 ((uae_u8)akiko_write_offset); - save_u32((cdrom_playing ? 1 : 0) | (cdrom_paused ? 2 : 0) | (cdrom_disk ? 4 : 0)); + save_u32 ((cdrom_playing ? 1 : 0) | (cdrom_paused ? 2 : 0) | (cdrom_disk ? 4 : 0)); if (cdrom_playing) - cd_qcode(0); - save_u32(lsn2msf(last_play_pos)); - save_u32(lsn2msf(last_play_end)); - save_u8((uae_u8)cdrom_toc_counter); + cd_qcode (0); + save_u32 (lsn2msf (last_play_pos)); + save_u32 (lsn2msf (last_play_end)); + save_u8 ((uae_u8)cdrom_toc_counter); - save_u8(cdrom_speed); - save_u8(cdrom_current_sector); + save_u8 (cdrom_speed); + save_u8 (cdrom_current_sector); - save_u32(cdrom_toc_crc); - save_u8(cdrom_toc_cd_buffer.points); - save_u32(cdrom_toc_cd_buffer.lastaddress); + save_u32 (cdrom_toc_crc); + save_u8 (cdrom_toc_cd_buffer.points); + save_u32 (cdrom_toc_cd_buffer.lastaddress); *len = dst - dstbak; return dstbak; } -uae_u8 *restore_akiko(uae_u8 *src) +uae_u8 *restore_akiko (uae_u8 *src) { uae_u32 v; int i; - akiko_free(); + akiko_free (); if (!currprefs.cs_cd32cd) { changed_prefs.cs_cd32c2p = changed_prefs.cs_cd32cd = changed_prefs.cs_cd32nvram = true; currprefs.cs_cd32c2p = currprefs.cs_cd32cd = currprefs.cs_cd32nvram = true; - akiko_init(); + akiko_init (); } - restore_u16(); - restore_u16(); - cdrom_intreq = restore_u32(); - cdrom_intena = restore_u32(); - restore_u32(); - cdrom_addressdata = restore_u32(); - cdrom_addressmisc = restore_u32(); + restore_u16 (); + restore_u16 (); + cdrom_intreq = restore_u32 (); + cdrom_intena = restore_u32 (); + restore_u32 (); + cdrom_addressdata = restore_u32 (); + cdrom_addressmisc = restore_u32 (); subcode_address = cdrom_addressmisc | 0x100; cdrx_address = cdrom_addressmisc; cdtx_address = cdrom_addressmisc | 0x200; - cdrom_subcodeoffset = restore_u8(); - cdcomtxinx = restore_u8(); - cdcomrxinx = restore_u8(); - restore_u8(); - restore_u8(); - cdcomtxcmp = restore_u8(); - restore_u8(); - cdcomrxcmp = restore_u8(); - cdrom_pbx = restore_u16(); - restore_u16(); - cdrom_flags = restore_u32(); - restore_u32(); - restore_u32(); - v = restore_u32(); - scl_dir = (v & 0x8000) ? 1 : 0; - sda_dir = (v & 0x4000) ? 1 : 0; - restore_u32(); - restore_u32(); + cdrom_subcodeoffset = restore_u8 (); + cdcomtxinx = restore_u8 (); + cdcomrxinx = restore_u8 (); + restore_u8 (); + restore_u8 (); + cdcomtxcmp = restore_u8 (); + restore_u8 (); + cdcomrxcmp = restore_u8 (); + cdrom_pbx = restore_u16 (); + restore_u16 (); + cdrom_flags = restore_u32 (); + restore_u32 (); + restore_u32 (); + v = restore_u32 (); + cd32_i2c_direction = v >> 8; + restore_u32 (); + restore_u32 (); for (i = 0; i < 8; i++) - akiko_buffer[i] = restore_u32(); - akiko_read_offset = restore_u8(); - akiko_write_offset = restore_u8(); + akiko_buffer[i] = restore_u32 (); + akiko_read_offset = restore_u8 (); + akiko_write_offset = restore_u8 (); cdrom_playing = cdrom_paused = cdrom_disk = 0; - v = restore_u32(); + v = restore_u32 (); if (v & 1) cdrom_playing = 1; if (v & 2) @@ -2060,45 +1886,46 @@ uae_u8 *restore_akiko(uae_u8 *src) cdrom_disk = 1; lastmediastate = cdrom_disk ? 2 : 0; - last_play_pos = msf2lsn(restore_u32()); - last_play_end = msf2lsn(restore_u32()); - cdrom_toc_counter = (uae_s8)restore_u8(); - cdrom_speed = restore_u8(); - cdrom_current_sector = (uae_s8)restore_u8(); + last_play_pos = msf2lsn (restore_u32 ()); + last_play_end = msf2lsn (restore_u32 ()); + cdrom_toc_counter = (uae_s8)restore_u8 (); + cdrom_speed = restore_u8 (); + cdrom_current_sector = (uae_s8)restore_u8 (); - restore_u32(); - restore_u8(); - restore_u32(); + restore_u32 (); + restore_u8 (); + restore_u32 (); return src; } -void restore_akiko_finish(void) +void restore_akiko_finish (void) { if (!currprefs.cs_cd32cd) return; - sys_cddev_close(); - akiko_init(); - akiko_c2p_do(); - get_cdrom_toc(); - write_comm_pipe_u32(&requests, 0x0102, 1); // pause - write_comm_pipe_u32(&requests, 0x0104, 1); // stop - write_comm_pipe_u32(&requests, 0x0103, 1); // unpause - if (cdrom_playing && isaudiotrack(last_play_pos)) { - write_comm_pipe_u32(&requests, 0x0103, 1); // unpause - write_comm_pipe_u32(&requests, 0x0110, 0); // play - write_comm_pipe_u32(&requests, last_play_pos, 0); - write_comm_pipe_u32(&requests, last_play_end, 0); - write_comm_pipe_u32(&requests, 0, 1); + sys_cddev_close (); + akiko_init (); + akiko_c2p_do (); + get_cdrom_toc (); + write_comm_pipe_u32 (&requests, 0x0102, 1); // pause + write_comm_pipe_u32 (&requests, 0x0104, 1); // stop + write_comm_pipe_u32 (&requests, 0x0103, 1); // unpause + if (cdrom_playing && isaudiotrack (last_play_pos)) { + write_comm_pipe_u32 (&requests, 0x0103, 1); // unpause + write_comm_pipe_u32 (&requests, 0x0110, 0); // play + write_comm_pipe_u32 (&requests, last_play_pos, 0); + write_comm_pipe_u32 (&requests, last_play_end, 0); + write_comm_pipe_u32 (&requests, 0, 1); } - cd_initialized = 1; + cd_initialized = 2; } #endif -void akiko_mute(int muted) +void akiko_mute (int muted) { cdrom_muted = muted; if (unitnum >= 0) - write_comm_pipe_u32(&requests, 0x0105, 1); + write_comm_pipe_u32 (&requests, 0x0105, 1); } + diff --git a/src/audio.cpp b/src/audio.cpp index 8271223f..0467a4af 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -16,30 +16,27 @@ #include "sysdeps.h" #include "options.h" -#include "include/memory.h" +#include "memory.h" #include "custom.h" #include "newcpu.h" #include "autoconf.h" #include "gensound.h" #include "audio.h" #include "sounddep/sound.h" -#include "events.h" #include "savestate.h" #include "gui.h" #include -#define MAX_EV ~0u - #define PERIOD_MIN 4 #define PERIOD_MIN_NONCE 60 STATIC_INLINE bool isaudio(void) { - return currprefs.produce_sound != 0; + return currprefs.produce_sound != 0; } -STATIC_INLINE bool usehacks(void) +STATIC_INLINE bool usehacks (void) { return currprefs.cpu_model >= 68020 || currprefs.m68k_speed != 0; } @@ -55,56 +52,63 @@ typedef struct { int time, output; } sinc_queue_t; -struct audio_channel_data { - unsigned int adk_mask; - unsigned int evtime; +struct audio_channel_data2 +{ + int current_sample, last_sample; + int sample_accum, sample_accum_time; + int sinc_output_state; + sinc_queue_t sinc_queue[SINC_QUEUE_LENGTH]; + int sinc_queue_time; + int sinc_queue_head; + int vol; + unsigned int adk_mask; +}; + +struct audio_channel_data +{ + unsigned int evtime; bool dmaenstore; bool intreq2; bool dr; bool dsr; bool pbufldl; bool dat_written; - uaecptr lc, pt; - int current_sample, last_sample; - int state; - int per; - int vol; - int len, wlen; - uae_u16 dat, dat2; - int sample_accum, sample_accum_time; - int sinc_output_state; - sinc_queue_t sinc_queue[SINC_QUEUE_LENGTH]; - int sinc_queue_time; - int sinc_queue_head; - /* too fast cpu fixes */ + uaecptr lc, pt; + int state; + int per; + int len, wlen; + uae_u16 dat, dat2; + struct audio_channel_data2 data; + /* too fast cpu fixes */ uaecptr ptx; bool ptx_written; bool ptx_tofetch; int dmaofftime_active; }; -static struct audio_channel_data audio_channel[4]; +static struct audio_channel_data audio_channel[AUDIO_CHANNELS_PAULA]; +static struct audio_channel_data2 *audio_data[AUDIO_CHANNELS_PAULA]; int sound_available = 0; -void(*sample_handler)(void); -static void(*sample_prehandler)(unsigned long best_evtime); +void (*sample_handler) (void); +static void (*sample_prehandler) (unsigned long best_evtime); -float scaled_sample_evtime; +unsigned long scaled_sample_evtime; + +int sound_cd_volume[2]; static unsigned long last_cycles; -static float next_sample_evtime; +static unsigned long next_sample_evtime; typedef uae_s8 sample8_t; -#define DO_CHANNEL_1(v, c) do { (v) *= audio_channel[c].vol; } while (0) +#define DO_CHANNEL_1(v, c) do { (v) *= audio_channel[c].data.vol; } while (0) -STATIC_INLINE int FINISH_DATA(int data, int bits) +STATIC_INLINE int FINISH_DATA (int data, int bits) { if (bits == 16) { return data; - } - else if (bits - 16 > 0) { + } else if (bits - 16 > 0) { data >>= bits - 16; - } - else { + } else { int shift = 16 - bits; data <<= shift; } @@ -124,7 +128,7 @@ static int led_filter_forced, sound_use_filter, sound_use_filter_sinc, led_filte #define DENORMAL_OFFSET (1E-10) static struct filter_state { - float rc1, rc2, rc3, rc4, rc5; + float rc1, rc2, rc3, rc4, rc5; } sound_filter_state[2]; static float a500e_filter1_a0; @@ -132,9 +136,9 @@ static float a500e_filter2_a0; static float filter_a0; /* a500 and a1200 use the same */ enum { - FILTER_NONE = 0, - FILTER_MODEL_A500, - FILTER_MODEL_A1200 + FILTER_NONE = 0, + FILTER_MODEL_A500, + FILTER_MODEL_A1200 }; /* Amiga has two separate filtering circuits per channel, a static RC filter @@ -155,191 +159,190 @@ enum { static int filter(int input, struct filter_state *fs) { - int o; - float normal_output, led_output; + int o; + float normal_output, led_output; - input = (uae_s16)input; - switch (sound_use_filter) { + input = (uae_s16)input; + switch (sound_use_filter) { - case FILTER_MODEL_A500: - fs->rc1 = a500e_filter1_a0 * input + (1 - a500e_filter1_a0) * fs->rc1 + DENORMAL_OFFSET; - fs->rc2 = a500e_filter2_a0 * fs->rc1 + (1 - a500e_filter2_a0) * fs->rc2; - normal_output = fs->rc2; + case FILTER_MODEL_A500: + fs->rc1 = a500e_filter1_a0 * input + (1 - a500e_filter1_a0) * fs->rc1 + DENORMAL_OFFSET; + fs->rc2 = a500e_filter2_a0 * fs->rc1 + (1-a500e_filter2_a0) * fs->rc2; + normal_output = fs->rc2; - fs->rc3 = filter_a0 * normal_output + (1 - filter_a0) * fs->rc3; - fs->rc4 = filter_a0 * fs->rc3 + (1 - filter_a0) * fs->rc4; - fs->rc5 = filter_a0 * fs->rc4 + (1 - filter_a0) * fs->rc5; + fs->rc3 = filter_a0 * normal_output + (1 - filter_a0) * fs->rc3; + fs->rc4 = filter_a0 * fs->rc3 + (1 - filter_a0) * fs->rc4; + fs->rc5 = filter_a0 * fs->rc4 + (1 - filter_a0) * fs->rc5; - led_output = fs->rc5; - break; + led_output = fs->rc5; + break; - case FILTER_MODEL_A1200: - normal_output = input; + case FILTER_MODEL_A1200: + normal_output = input; - fs->rc2 = filter_a0 * normal_output + (1 - filter_a0) * fs->rc2 + DENORMAL_OFFSET; - fs->rc3 = filter_a0 * fs->rc2 + (1 - filter_a0) * fs->rc3; - fs->rc4 = filter_a0 * fs->rc3 + (1 - filter_a0) * fs->rc4; + fs->rc2 = filter_a0 * normal_output + (1 - filter_a0) * fs->rc2 + DENORMAL_OFFSET; + fs->rc3 = filter_a0 * fs->rc2 + (1 - filter_a0) * fs->rc3; + fs->rc4 = filter_a0 * fs->rc3 + (1 - filter_a0) * fs->rc4; - led_output = fs->rc4; - break; - case FILTER_NONE: - default: - return input; + led_output = fs->rc4; + break; - } + case FILTER_NONE: + default: + return input; - if (led_filter_on) - o = led_output; - else - o = normal_output; + } - if (o > 32767) - o = 32767; - else if (o < -32768) - o = -32768; + if (led_filter_on) + o = led_output; + else + o = normal_output; - return o; + if (o > 32767) + o = 32767; + else if (o < -32768) + o = -32768; + + return o; } /* Always put the right word before the left word. */ -static void(*put_sound_word_mono_func)(uae_u32 w); -static void(*put_sound_word_stereo_func)(uae_u32 left, uae_u32 right); +static void (*put_sound_word_mono_func)(uae_u32 w); +static void (*put_sound_word_stereo_func)(uae_u32 left, uae_u32 right); -static void put_sound_word_stereo_func_filter_mixed(uae_u32 left, uae_u32 right) +static void put_sound_word_stereo_func_filter_mixed(uae_u32 lnew, uae_u32 rnew) { uae_u32 rold, lold, tmp; - left = filter(left, &sound_filter_state[0]); - right = filter(right, &sound_filter_state[1]); + lnew = filter (lnew, &sound_filter_state[0]); + rnew = filter (rnew, &sound_filter_state[1]); - left_word_saved[saved_ptr] = left; - right_word_saved[saved_ptr] = right; + left_word_saved[saved_ptr] = lnew; + right_word_saved[saved_ptr] = rnew; - saved_ptr = (saved_ptr + 1) & mixed_stereo_size; + saved_ptr = (saved_ptr + 1) & mixed_stereo_size; - lold = left_word_saved[saved_ptr]; - tmp = (right * mixed_mul2 + lold * mixed_mul1) / MIXED_STEREO_SCALE; + lold = left_word_saved[saved_ptr]; + tmp = (rnew * mixed_mul2 + lold * mixed_mul1) / MIXED_STEREO_SCALE; - rold = right_word_saved[saved_ptr]; - left = (left * mixed_mul2 + rold * mixed_mul1) / MIXED_STEREO_SCALE; + rold = right_word_saved[saved_ptr]; + lnew = (lnew * mixed_mul2 + rold * mixed_mul1) / MIXED_STEREO_SCALE; - PUT_SOUND_WORD_STEREO(left, tmp); + PUT_SOUND_WORD_STEREO(lnew, tmp); } static void put_sound_word_stereo_func_filter_notmixed(uae_u32 left, uae_u32 right) { - left = filter(left, &sound_filter_state[0]); - right = filter(right, &sound_filter_state[1]); - PUT_SOUND_WORD_STEREO(left, right); + left = filter (left, &sound_filter_state[0]); + right = filter (right, &sound_filter_state[1]); + PUT_SOUND_WORD_STEREO(left, right); } -static void put_sound_word_stereo_func_nofilter_mixed(uae_u32 left, uae_u32 right) +static void put_sound_word_stereo_func_nofilter_mixed(uae_u32 lnew, uae_u32 rnew) { uae_u32 rold, lold, tmp; - left_word_saved[saved_ptr] = left; - right_word_saved[saved_ptr] = right; + left_word_saved[saved_ptr] = lnew; + right_word_saved[saved_ptr] = rnew; - saved_ptr = (saved_ptr + 1) & mixed_stereo_size; + saved_ptr = (saved_ptr + 1) & mixed_stereo_size; - lold = left_word_saved[saved_ptr]; - tmp = (right * mixed_mul2 + lold * mixed_mul1) / MIXED_STEREO_SCALE; + lold = left_word_saved[saved_ptr]; + tmp = (rnew * mixed_mul2 + lold * mixed_mul1) / MIXED_STEREO_SCALE; - rold = right_word_saved[saved_ptr]; - left = (left * mixed_mul2 + rold * mixed_mul1) / MIXED_STEREO_SCALE; + rold = right_word_saved[saved_ptr]; + lnew = (lnew * mixed_mul2 + rold * mixed_mul1) / MIXED_STEREO_SCALE; - PUT_SOUND_WORD_STEREO(left, tmp); + PUT_SOUND_WORD_STEREO(lnew, tmp); } static void put_sound_word_stereo_func_nofilter_notmixed(uae_u32 left, uae_u32 right) { - PUT_SOUND_WORD_STEREO(left, right); + PUT_SOUND_WORD_STEREO(left, right); } static void put_sound_word_mono_func_filter(uae_u32 data) { - data = filter(data, &sound_filter_state[0]); - PUT_SOUND_WORD(data); + data = filter (data, &sound_filter_state[0]); + PUT_SOUND_WORD(data); } static void put_sound_word_mono_func_nofilter(uae_u32 data) { - PUT_SOUND_WORD(data); + PUT_SOUND_WORD(data); } - static void anti_prehandler(unsigned long best_evtime) { - int i, output; - struct audio_channel_data *acd; + int i, output; + struct audio_channel_data2 *acd; - /* Handle accumulator antialiasiation */ - for (i = 0; i < 4; i++) { - acd = &audio_channel[i]; - output = (acd->current_sample * acd->vol) & acd->adk_mask; - acd->sample_accum += output * best_evtime; - acd->sample_accum_time += best_evtime; - } + /* Handle accumulator antialiasiation */ + for (i = 0; i < AUDIO_CHANNELS_PAULA; i++) { + acd = audio_data[i]; + output = (acd->current_sample * acd->vol) & acd->adk_mask; + acd->sample_accum += output * best_evtime; + acd->sample_accum_time += best_evtime; + } } -STATIC_INLINE void samplexx_anti_handler(int *datasp) +STATIC_INLINE void samplexx_anti_handler (int *datasp) { - int i; - for (i = 0; i < 4; i++) { - datasp[i] = audio_channel[i].sample_accum_time ? (audio_channel[i].sample_accum / audio_channel[i].sample_accum_time) : 0; - audio_channel[i].sample_accum = 0; - audio_channel[i].sample_accum_time = 0; - } + int i; + for (i = 0; i < AUDIO_CHANNELS_PAULA; i++) { + struct audio_channel_data2 *acd = audio_data[i]; + datasp[i] = acd->sample_accum_time ? (acd->sample_accum / acd->sample_accum_time) : 0; + acd->sample_accum = 0; + acd->sample_accum_time = 0; + } } -static void sinc_prehandler(unsigned long best_evtime) +static void sinc_prehandler_paula (unsigned long best_evtime) { int i, output; - struct audio_channel_data *acd; + struct audio_channel_data2 *acd; - for (i = 0; i < 4; i++) { - acd = &audio_channel[i]; + for (i = 0; i < AUDIO_CHANNELS_PAULA; i++) { + acd = audio_data[i]; int vol = acd->vol; output = (acd->current_sample * vol) & acd->adk_mask; /* if output state changes, record the state change and also * write data into sinc queue for mixing in the BLEP */ - if (acd->sinc_output_state != output) { + if (acd->sinc_output_state != output) { acd->sinc_queue_head = (acd->sinc_queue_head - 1) & (SINC_QUEUE_LENGTH - 1); acd->sinc_queue[acd->sinc_queue_head].time = acd->sinc_queue_time; acd->sinc_queue[acd->sinc_queue_head].output = output - acd->sinc_output_state; - acd->sinc_output_state = output; - } + acd->sinc_output_state = output; + } acd->sinc_queue_time += best_evtime; - } + } } - /* this interpolator performs BLEP mixing (bleps are shaped like integrated sinc * functions) with a type of BLEP that matches the filtering configuration. */ -STATIC_INLINE void samplexx_sinc_handler(int *datasp) +STATIC_INLINE void samplexx_sinc_handler (int *datasp) { - int i, n; - int const *winsinc; + int n, i; + int const *winsinc; - if (sound_use_filter_sinc) { - n = (sound_use_filter_sinc == FILTER_MODEL_A500) ? 0 : 2; - if (led_filter_on) - n += 1; - } - else { - n = 4; - } - winsinc = winsinc_integral[n]; + if (sound_use_filter_sinc) { + n = (sound_use_filter_sinc == FILTER_MODEL_A500) ? 0 : 2; + if (led_filter_on) + n += 1; + } else { + n = 4; + } + winsinc = winsinc_integral[n]; - for (i = 0; i < 4; i += 1) { - int j, v; - struct audio_channel_data *acd = &audio_channel[i]; - /* The sum rings with harmonic components up to infinity... */ - int sum = acd->sinc_output_state << 17; - /* ...but we cancel them through mixing in BLEPs instead */ + for (i = 0; i < AUDIO_CHANNELS_PAULA; i++) { + int j, v; + struct audio_channel_data2 *acd = audio_data[i]; + /* The sum rings with harmonic components up to infinity... */ + int sum = acd->sinc_output_state << 17; + /* ...but we cancel them through mixing in BLEPs instead */ int offsetpos = acd->sinc_queue_head & (SINC_QUEUE_LENGTH - 1); for (j = 0; j < SINC_QUEUE_LENGTH; j += 1) { int age = acd->sinc_queue_time - acd->sinc_queue[offsetpos].time; @@ -349,182 +352,187 @@ STATIC_INLINE void samplexx_sinc_handler(int *datasp) offsetpos = (offsetpos + 1) & (SINC_QUEUE_LENGTH - 1); } v = sum >> 15; - if (v > 32767) - v = 32767; - else if (v < -32768) - v = -32768; - datasp[i] = v; - } + if (v > 32767) + v = 32767; + else if (v < -32768) + v = -32768; + datasp[i] = v; + } } -static void sample16i_sinc_handler(void) +static void sample16i_sinc_handler (void) { - int datas[4], data1; + int datas[AUDIO_CHANNELS_PAULA], data1; - samplexx_sinc_handler(datas); - data1 = datas[0] + datas[3] + datas[1] + datas[2]; - data1 = FINISH_DATA(data1, 18); - set_sound_buffers(); - PUT_SOUND_WORD_MONO(data1); - check_sound_buffers(); + samplexx_sinc_handler (datas); + data1 = datas[0] + datas[3] + datas[1] + datas[2]; + data1 = FINISH_DATA (data1, 18); + + set_sound_buffers (); + put_sound_word_mono_func (data1); + check_sound_buffers (); } -void sample16_handler(void) +void sample16_handler (void) { - uae_u32 data; - if (audio_channel[0].adk_mask) - data = audio_channel[0].current_sample * audio_channel[0].vol; - else - data = 0; - if (audio_channel[1].adk_mask) - data += audio_channel[1].current_sample * audio_channel[1].vol; - if (audio_channel[2].adk_mask) - data += audio_channel[2].current_sample * audio_channel[2].vol; - if (audio_channel[3].adk_mask) - data += audio_channel[3].current_sample * audio_channel[3].vol; + int data; + if(audio_channel[0].data.adk_mask) + data = audio_channel[0].data.current_sample * audio_channel[0].data.vol; + else + data = 0; + if(audio_channel[1].data.adk_mask) + data += audio_channel[1].data.current_sample * audio_channel[1].data.vol; + if(audio_channel[2].data.adk_mask) + data += audio_channel[2].data.current_sample * audio_channel[2].data.vol; + if(audio_channel[3].data.adk_mask) + data += audio_channel[3].data.current_sample * audio_channel[3].data.vol; - data = FINISH_DATA(data, 16); - set_sound_buffers(); - PUT_SOUND_WORD_MONO(data); - check_sound_buffers(); + data = FINISH_DATA (data, 16); + + set_sound_buffers (); + put_sound_word_mono_func (data); + check_sound_buffers (); } /* This interpolator examines sample points when Paula switches the output * voltage and computes the average of Paula's output */ -static void sample16i_anti_handler(void) +static void sample16i_anti_handler (void) { - int datas[4], data1; + int datas[AUDIO_CHANNELS_PAULA], data1; - samplexx_anti_handler(datas); - data1 = datas[0] + datas[3] + datas[1] + datas[2]; - data1 = FINISH_DATA(data1, 16); - set_sound_buffers(); - PUT_SOUND_WORD_MONO(data1); - check_sound_buffers(); + samplexx_anti_handler (datas); + data1 = datas[0] + datas[3] + datas[1] + datas[2]; + data1 = FINISH_DATA (data1, 16); + + set_sound_buffers (); + put_sound_word_mono_func (data1); + check_sound_buffers (); } -static void sample16i_rh_handler(void) +static void sample16i_rh_handler (void) { - unsigned long delta, ratio; + unsigned long delta, ratio; - uae_u32 data0 = audio_channel[0].current_sample; - uae_u32 data1 = audio_channel[1].current_sample; - uae_u32 data2 = audio_channel[2].current_sample; - uae_u32 data3 = audio_channel[3].current_sample; - uae_u32 data0p = audio_channel[0].last_sample; - uae_u32 data1p = audio_channel[1].last_sample; - uae_u32 data2p = audio_channel[2].last_sample; - uae_u32 data3p = audio_channel[3].last_sample; - uae_u32 data; + int data0 = audio_channel[0].data.current_sample; + int data1 = audio_channel[1].data.current_sample; + int data2 = audio_channel[2].data.current_sample; + int data3 = audio_channel[3].data.current_sample; + int data0p = audio_channel[0].data.last_sample; + int data1p = audio_channel[1].data.last_sample; + int data2p = audio_channel[2].data.last_sample; + int data3p = audio_channel[3].data.last_sample; + int data; - DO_CHANNEL_1(data0, 0); - DO_CHANNEL_1(data1, 1); - DO_CHANNEL_1(data2, 2); - DO_CHANNEL_1(data3, 3); - DO_CHANNEL_1(data0p, 0); - DO_CHANNEL_1(data1p, 1); - DO_CHANNEL_1(data2p, 2); - DO_CHANNEL_1(data3p, 3); + DO_CHANNEL_1 (data0, 0); + DO_CHANNEL_1 (data1, 1); + DO_CHANNEL_1 (data2, 2); + DO_CHANNEL_1 (data3, 3); + DO_CHANNEL_1 (data0p, 0); + DO_CHANNEL_1 (data1p, 1); + DO_CHANNEL_1 (data2p, 2); + DO_CHANNEL_1 (data3p, 3); - data0 &= audio_channel[0].adk_mask; - data0p &= audio_channel[0].adk_mask; - data1 &= audio_channel[1].adk_mask; - data1p &= audio_channel[1].adk_mask; - data2 &= audio_channel[2].adk_mask; - data2p &= audio_channel[2].adk_mask; - data3 &= audio_channel[3].adk_mask; - data3p &= audio_channel[3].adk_mask; + data0 &= audio_channel[0].data.adk_mask; + data0p &= audio_channel[0].data.adk_mask; + data1 &= audio_channel[1].data.adk_mask; + data1p &= audio_channel[1].data.adk_mask; + data2 &= audio_channel[2].data.adk_mask; + data2p &= audio_channel[2].data.adk_mask; + data3 &= audio_channel[3].data.adk_mask; + data3p &= audio_channel[3].data.adk_mask; - /* linear interpolation and summing up... */ - delta = audio_channel[0].per; - ratio = ((audio_channel[0].evtime % delta) << 8) / delta; - data0 = (data0 * (256 - ratio) + data0p * ratio) >> 8; - delta = audio_channel[1].per; - ratio = ((audio_channel[1].evtime % delta) << 8) / delta; - data0 += (data1 * (256 - ratio) + data1p * ratio) >> 8; - delta = audio_channel[2].per; - ratio = ((audio_channel[2].evtime % delta) << 8) / delta; - data0 += (data2 * (256 - ratio) + data2p * ratio) >> 8; - delta = audio_channel[3].per; - ratio = ((audio_channel[3].evtime % delta) << 8) / delta; - data0 += (data3 * (256 - ratio) + data3p * ratio) >> 8; + /* linear interpolation and summing up... */ + delta = audio_channel[0].per; + ratio = ((audio_channel[0].evtime % delta) << 8) / delta; + data0 = (data0 * (256 - ratio) + data0p * ratio) >> 8; + delta = audio_channel[1].per; + ratio = ((audio_channel[1].evtime % delta) << 8) / delta; + data0 += (data1 * (256 - ratio) + data1p * ratio) >> 8; + delta = audio_channel[2].per; + ratio = ((audio_channel[2].evtime % delta) << 8) / delta; + data0 += (data2 * (256 - ratio) + data2p * ratio) >> 8; + delta = audio_channel[3].per; + ratio = ((audio_channel[3].evtime % delta) << 8) / delta; + data0 += (data3 * (256 - ratio) + data3p * ratio) >> 8; data = data0; - data = FINISH_DATA(data, 16); - set_sound_buffers(); - PUT_SOUND_WORD_MONO(data); - check_sound_buffers(); + data = FINISH_DATA (data, 16); + + set_sound_buffers (); + put_sound_word_mono_func (data); + check_sound_buffers(); } -static void sample16i_crux_handler(void) +static void sample16i_crux_handler (void) { - uae_u32 data0 = audio_channel[0].current_sample; - uae_u32 data1 = audio_channel[1].current_sample; - uae_u32 data2 = audio_channel[2].current_sample; - uae_u32 data3 = audio_channel[3].current_sample; - uae_u32 data0p = audio_channel[0].last_sample; - uae_u32 data1p = audio_channel[1].last_sample; - uae_u32 data2p = audio_channel[2].last_sample; - uae_u32 data3p = audio_channel[3].last_sample; - uae_u32 data; + int data0 = audio_channel[0].data.current_sample; + int data1 = audio_channel[1].data.current_sample; + int data2 = audio_channel[2].data.current_sample; + int data3 = audio_channel[3].data.current_sample; + int data0p = audio_channel[0].data.last_sample; + int data1p = audio_channel[1].data.last_sample; + int data2p = audio_channel[2].data.last_sample; + int data3p = audio_channel[3].data.last_sample; + int data; - DO_CHANNEL_1(data0, 0); - DO_CHANNEL_1(data1, 1); - DO_CHANNEL_1(data2, 2); - DO_CHANNEL_1(data3, 3); - DO_CHANNEL_1(data0p, 0); - DO_CHANNEL_1(data1p, 1); - DO_CHANNEL_1(data2p, 2); - DO_CHANNEL_1(data3p, 3); + DO_CHANNEL_1 (data0, 0); + DO_CHANNEL_1 (data1, 1); + DO_CHANNEL_1 (data2, 2); + DO_CHANNEL_1 (data3, 3); + DO_CHANNEL_1 (data0p, 0); + DO_CHANNEL_1 (data1p, 1); + DO_CHANNEL_1 (data2p, 2); + DO_CHANNEL_1 (data3p, 3); - data0 &= audio_channel[0].adk_mask; - data0p &= audio_channel[0].adk_mask; - data1 &= audio_channel[1].adk_mask; - data1p &= audio_channel[1].adk_mask; - data2 &= audio_channel[2].adk_mask; - data2p &= audio_channel[2].adk_mask; - data3 &= audio_channel[3].adk_mask; - data3p &= audio_channel[3].adk_mask; + data0 &= audio_channel[0].data.adk_mask; + data0p &= audio_channel[0].data.adk_mask; + data1 &= audio_channel[1].data.adk_mask; + data1p &= audio_channel[1].data.adk_mask; + data2 &= audio_channel[2].data.adk_mask; + data2p &= audio_channel[2].data.adk_mask; + data3 &= audio_channel[3].data.adk_mask; + data3p &= audio_channel[3].data.adk_mask; - { - struct audio_channel_data *cdp; - unsigned long ratio, ratio1; + { + struct audio_channel_data *cdp; + unsigned long ratio, ratio1; #define INTERVAL (scaled_sample_evtime * 3) - cdp = audio_channel + 0; - ratio1 = cdp->per - cdp->evtime; - ratio = (ratio1 << 12) / INTERVAL; - if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) - ratio = 4096; - data0 = (data0 * ratio + data0p * (4096 - ratio)) >> 12; + cdp = audio_channel + 0; + ratio1 = cdp->per - cdp->evtime; + ratio = (ratio1 << 12) / INTERVAL; + if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) + ratio = 4096; + data0 = (data0 * ratio + data0p * (4096 - ratio)) >> 12; - cdp = audio_channel + 1; - ratio1 = cdp->per - cdp->evtime; - ratio = (ratio1 << 12) / INTERVAL; - if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) - ratio = 4096; - data1 = (data1 * ratio + data1p * (4096 - ratio)) >> 12; + cdp = audio_channel + 1; + ratio1 = cdp->per - cdp->evtime; + ratio = (ratio1 << 12) / INTERVAL; + if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) + ratio = 4096; + data1 = (data1 * ratio + data1p * (4096 - ratio)) >> 12; - cdp = audio_channel + 2; - ratio1 = cdp->per - cdp->evtime; - ratio = (ratio1 << 12) / INTERVAL; - if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) - ratio = 4096; - data2 = (data2 * ratio + data2p * (4096 - ratio)) >> 12; + cdp = audio_channel + 2; + ratio1 = cdp->per - cdp->evtime; + ratio = (ratio1 << 12) / INTERVAL; + if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) + ratio = 4096; + data2 = (data2 * ratio + data2p * (4096 - ratio)) >> 12; - cdp = audio_channel + 3; - ratio1 = cdp->per - cdp->evtime; - ratio = (ratio1 << 12) / INTERVAL; - if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) - ratio = 4096; - data3 = (data3 * ratio + data3p * (4096 - ratio)) >> 12; - } - data1 += data2; - data0 += data3; - data0 += data1; + cdp = audio_channel + 3; + ratio1 = cdp->per - cdp->evtime; + ratio = (ratio1 << 12) / INTERVAL; + if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) + ratio = 4096; + data3 = (data3 * ratio + data3p * (4096 - ratio)) >> 12; + } + data1 += data2; + data0 += data3; + data0 += data1; data = data0; - data = FINISH_DATA(data, 16); - set_sound_buffers(); - PUT_SOUND_WORD_MONO(data); - check_sound_buffers(); + data = FINISH_DATA (data, 16); + + set_sound_buffers (); + put_sound_word_mono_func (data); + check_sound_buffers (); } #ifdef HAVE_STEREO_SUPPORT @@ -532,261 +540,276 @@ static void sample16i_crux_handler(void) /* This interpolator examines sample points when Paula switches the output * voltage and computes the average of Paula's output */ -static void sample16si_anti_handler(void) +static void sample16si_anti_handler (void) { - int datas[4], data1, data2; + int datas[AUDIO_CHANNELS_PAULA], data1, data2; - samplexx_anti_handler(datas); - data1 = datas[0] + datas[3]; - data2 = datas[1] + datas[2]; - data1 = FINISH_DATA(data1, 15); - data2 = FINISH_DATA(data2, 15); - set_sound_buffers(); - put_sound_word_stereo_func(data1, data2); - check_sound_buffers(); + samplexx_anti_handler (datas); + data1 = datas[0] + datas[3]; + data2 = datas[1] + datas[2]; + data1 = FINISH_DATA (data1, 15); + data2 = FINISH_DATA (data2, 15); + + set_sound_buffers (); + put_sound_word_stereo_func(data1, data2); + check_sound_buffers (); } -static void sample16si_sinc_handler(void) +static void sample16si_sinc_handler (void) { - int datas[4], data1, data2; + int datas[AUDIO_CHANNELS_PAULA], data1, data2; - samplexx_sinc_handler(datas); - data1 = datas[0] + datas[3]; - data2 = datas[1] + datas[2]; - data1 = FINISH_DATA(data1, 17); - data2 = FINISH_DATA(data2, 17); - set_sound_buffers(); - put_sound_word_stereo_func(data1, data2); - check_sound_buffers(); + samplexx_sinc_handler (datas); + data1 = datas[0] + datas[3]; + data2 = datas[1] + datas[2]; + data1 = FINISH_DATA (data1, 17); + data2 = FINISH_DATA (data2, 17); + + set_sound_buffers (); + put_sound_word_stereo_func(data1, data2); + check_sound_buffers (); } -void sample16s_handler(void) +void sample16s_handler (void) { - uae_u32 data_l = audio_channel[0].adk_mask ? audio_channel[0].current_sample * audio_channel[0].vol : 0; - uae_u32 data_r = audio_channel[1].adk_mask ? audio_channel[1].current_sample * audio_channel[1].vol : 0; - if (audio_channel[2].adk_mask) - data_r += audio_channel[2].current_sample * audio_channel[2].vol; - if (audio_channel[3].adk_mask) - data_l += audio_channel[3].current_sample * audio_channel[3].vol; - data_l = FINISH_DATA(data_l, 15); - data_r = FINISH_DATA(data_r, 15); + int data_l = audio_channel[0].data.adk_mask ? audio_channel[0].data.current_sample * audio_channel[0].data.vol : 0; + int data_r = audio_channel[1].data.adk_mask ? audio_channel[1].data.current_sample * audio_channel[1].data.vol : 0; + if(audio_channel[2].data.adk_mask) + data_r += audio_channel[2].data.current_sample * audio_channel[2].data.vol; + if(audio_channel[3].data.adk_mask) + data_l += audio_channel[3].data.current_sample * audio_channel[3].data.vol; + data_l = FINISH_DATA(data_l, 15); + data_r = FINISH_DATA(data_r, 15); - set_sound_buffers(); - put_sound_word_stereo_func(data_l, data_r); - check_sound_buffers(); + set_sound_buffers (); + put_sound_word_stereo_func(data_l, data_r); + check_sound_buffers(); } -static void sample16si_crux_handler(void) +static void sample16si_crux_handler (void) { - uae_u32 data0 = audio_channel[0].current_sample; - uae_u32 data1 = audio_channel[1].current_sample; - uae_u32 data2 = audio_channel[2].current_sample; - uae_u32 data3 = audio_channel[3].current_sample; - uae_u32 data0p = audio_channel[0].last_sample; - uae_u32 data1p = audio_channel[1].last_sample; - uae_u32 data2p = audio_channel[2].last_sample; - uae_u32 data3p = audio_channel[3].last_sample; + int data0 = audio_channel[0].data.current_sample; + int data1 = audio_channel[1].data.current_sample; + int data2 = audio_channel[2].data.current_sample; + int data3 = audio_channel[3].data.current_sample; + int data0p = audio_channel[0].data.last_sample; + int data1p = audio_channel[1].data.last_sample; + int data2p = audio_channel[2].data.last_sample; + int data3p = audio_channel[3].data.last_sample; - DO_CHANNEL_1(data0, 0); - DO_CHANNEL_1(data1, 1); - DO_CHANNEL_1(data2, 2); - DO_CHANNEL_1(data3, 3); - DO_CHANNEL_1(data0p, 0); - DO_CHANNEL_1(data1p, 1); - DO_CHANNEL_1(data2p, 2); - DO_CHANNEL_1(data3p, 3); + DO_CHANNEL_1 (data0, 0); + DO_CHANNEL_1 (data1, 1); + DO_CHANNEL_1 (data2, 2); + DO_CHANNEL_1 (data3, 3); + DO_CHANNEL_1 (data0p, 0); + DO_CHANNEL_1 (data1p, 1); + DO_CHANNEL_1 (data2p, 2); + DO_CHANNEL_1 (data3p, 3); - data0 &= audio_channel[0].adk_mask; - data0p &= audio_channel[0].adk_mask; - data1 &= audio_channel[1].adk_mask; - data1p &= audio_channel[1].adk_mask; - data2 &= audio_channel[2].adk_mask; - data2p &= audio_channel[2].adk_mask; - data3 &= audio_channel[3].adk_mask; - data3p &= audio_channel[3].adk_mask; + data0 &= audio_channel[0].data.adk_mask; + data0p &= audio_channel[0].data.adk_mask; + data1 &= audio_channel[1].data.adk_mask; + data1p &= audio_channel[1].data.adk_mask; + data2 &= audio_channel[2].data.adk_mask; + data2p &= audio_channel[2].data.adk_mask; + data3 &= audio_channel[3].data.adk_mask; + data3p &= audio_channel[3].data.adk_mask; - { - struct audio_channel_data *cdp; - unsigned long ratio, ratio1; + { + struct audio_channel_data *cdp; + unsigned long ratio, ratio1; #define INTERVAL (scaled_sample_evtime * 3) - cdp = audio_channel + 0; - ratio1 = cdp->per - cdp->evtime; - ratio = (ratio1 << 12) / INTERVAL; - if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) - ratio = 4096; - data0 = (data0 * ratio + data0p * (4096 - ratio)) >> 12; + cdp = audio_channel + 0; + ratio1 = cdp->per - cdp->evtime; + ratio = (ratio1 << 12) / INTERVAL; + if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) + ratio = 4096; + data0 = (data0 * ratio + data0p * (4096 - ratio)) >> 12; - cdp = audio_channel + 1; - ratio1 = cdp->per - cdp->evtime; - ratio = (ratio1 << 12) / INTERVAL; - if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) - ratio = 4096; - data1 = (data1 * ratio + data1p * (4096 - ratio)) >> 12; + cdp = audio_channel + 1; + ratio1 = cdp->per - cdp->evtime; + ratio = (ratio1 << 12) / INTERVAL; + if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) + ratio = 4096; + data1 = (data1 * ratio + data1p * (4096 - ratio)) >> 12; - cdp = audio_channel + 2; - ratio1 = cdp->per - cdp->evtime; - ratio = (ratio1 << 12) / INTERVAL; - if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) - ratio = 4096; - data2 = (data2 * ratio + data2p * (4096 - ratio)) >> 12; + cdp = audio_channel + 2; + ratio1 = cdp->per - cdp->evtime; + ratio = (ratio1 << 12) / INTERVAL; + if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) + ratio = 4096; + data2 = (data2 * ratio + data2p * (4096 - ratio)) >> 12; - cdp = audio_channel + 3; - ratio1 = cdp->per - cdp->evtime; - ratio = (ratio1 << 12) / INTERVAL; - if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) - ratio = 4096; - data3 = (data3 * ratio + data3p * (4096 - ratio)) >> 12; - } - data1 += data2; - data0 += data3; - data0 = FINISH_DATA(data0, 15); - data1 = FINISH_DATA(data1, 15); - set_sound_buffers(); - put_sound_word_stereo_func(data0, data1); - check_sound_buffers(); + cdp = audio_channel + 3; + ratio1 = cdp->per - cdp->evtime; + ratio = (ratio1 << 12) / INTERVAL; + if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) + ratio = 4096; + data3 = (data3 * ratio + data3p * (4096 - ratio)) >> 12; + } + data1 += data2; + data0 += data3; + data0 = FINISH_DATA (data0, 15); + data1 = FINISH_DATA (data1, 15); + + set_sound_buffers (); + put_sound_word_stereo_func(data0, data1); + check_sound_buffers (); } -static void sample16si_rh_handler(void) +static void sample16si_rh_handler (void) { - unsigned long delta, ratio; + unsigned long delta, ratio; - uae_u32 data0 = audio_channel[0].current_sample; - uae_u32 data1 = audio_channel[1].current_sample; - uae_u32 data2 = audio_channel[2].current_sample; - uae_u32 data3 = audio_channel[3].current_sample; - uae_u32 data0p = audio_channel[0].last_sample; - uae_u32 data1p = audio_channel[1].last_sample; - uae_u32 data2p = audio_channel[2].last_sample; - uae_u32 data3p = audio_channel[3].last_sample; + int data0 = audio_channel[0].data.current_sample; + int data1 = audio_channel[1].data.current_sample; + int data2 = audio_channel[2].data.current_sample; + int data3 = audio_channel[3].data.current_sample; + int data0p = audio_channel[0].data.last_sample; + int data1p = audio_channel[1].data.last_sample; + int data2p = audio_channel[2].data.last_sample; + int data3p = audio_channel[3].data.last_sample; - DO_CHANNEL_1(data0, 0); - DO_CHANNEL_1(data1, 1); - DO_CHANNEL_1(data2, 2); - DO_CHANNEL_1(data3, 3); - DO_CHANNEL_1(data0p, 0); - DO_CHANNEL_1(data1p, 1); - DO_CHANNEL_1(data2p, 2); - DO_CHANNEL_1(data3p, 3); + DO_CHANNEL_1 (data0, 0); + DO_CHANNEL_1 (data1, 1); + DO_CHANNEL_1 (data2, 2); + DO_CHANNEL_1 (data3, 3); + DO_CHANNEL_1 (data0p, 0); + DO_CHANNEL_1 (data1p, 1); + DO_CHANNEL_1 (data2p, 2); + DO_CHANNEL_1 (data3p, 3); - data0 &= audio_channel[0].adk_mask; - data0p &= audio_channel[0].adk_mask; - data1 &= audio_channel[1].adk_mask; - data1p &= audio_channel[1].adk_mask; - data2 &= audio_channel[2].adk_mask; - data2p &= audio_channel[2].adk_mask; - data3 &= audio_channel[3].adk_mask; - data3p &= audio_channel[3].adk_mask; + data0 &= audio_channel[0].data.adk_mask; + data0p &= audio_channel[0].data.adk_mask; + data1 &= audio_channel[1].data.adk_mask; + data1p &= audio_channel[1].data.adk_mask; + data2 &= audio_channel[2].data.adk_mask; + data2p &= audio_channel[2].data.adk_mask; + data3 &= audio_channel[3].data.adk_mask; + data3p &= audio_channel[3].data.adk_mask; - /* linear interpolation and summing up... */ - delta = audio_channel[0].per; - ratio = ((audio_channel[0].evtime % delta) << 8) / delta; - data0 = (data0 * (256 - ratio) + data0p * ratio) >> 8; - delta = audio_channel[1].per; - ratio = ((audio_channel[1].evtime % delta) << 8) / delta; - data1 = (data1 * (256 - ratio) + data1p * ratio) >> 8; - delta = audio_channel[2].per; - ratio = ((audio_channel[2].evtime % delta) << 8) / delta; - data1 += (data2 * (256 - ratio) + data2p * ratio) >> 8; - delta = audio_channel[3].per; - ratio = ((audio_channel[3].evtime % delta) << 8) / delta; - data0 += (data3 * (256 - ratio) + data3p * ratio) >> 8; - data0 = FINISH_DATA(data0, 15); - data1 = FINISH_DATA(data1, 15); - set_sound_buffers(); - put_sound_word_stereo_func(data0, data1); - check_sound_buffers(); + /* linear interpolation and summing up... */ + delta = audio_channel[0].per; + ratio = ((audio_channel[0].evtime % delta) << 8) / delta; + data0 = (data0 * (256 - ratio) + data0p * ratio) >> 8; + delta = audio_channel[1].per; + ratio = ((audio_channel[1].evtime % delta) << 8) / delta; + data1 = (data1 * (256 - ratio) + data1p * ratio) >> 8; + delta = audio_channel[2].per; + ratio = ((audio_channel[2].evtime % delta) << 8) / delta; + data1 += (data2 * (256 - ratio) + data2p * ratio) >> 8; + delta = audio_channel[3].per; + ratio = ((audio_channel[3].evtime % delta) << 8) / delta; + data0 += (data3 * (256 - ratio) + data3p * ratio) >> 8; + data0 = FINISH_DATA (data0, 15); + data1 = FINISH_DATA (data1, 15); + + set_sound_buffers (); + put_sound_word_stereo_func(data0, data1); + check_sound_buffers (); } #else -void sample16s_handler(void) +void sample16s_handler (void) { - sample16_handler(); + sample16_handler (); } -static void sample16si_crux_handler(void) +static void sample16si_crux_handler (void) { - sample16i_crux_handler(); + sample16i_crux_handler (); } -static void sample16si_rh_handler(void) +static void sample16si_rh_handler (void) { - sample16i_rh_handler(); + sample16i_rh_handler (); } #endif static int audio_work_to_do; -static void zerostate(int nr) +static void zerostate (int nr) { struct audio_channel_data *cdp = audio_channel + nr; - cdp->state = 0; - cdp->evtime = MAX_EV; + cdp->state = 0; + cdp->evtime = MAX_EV; cdp->intreq2 = 0; cdp->dmaenstore = false; cdp->dmaofftime_active = 0; } -static void schedule_audio(void) +static void schedule_audio (void) { unsigned long best = MAX_EV; - int i; + int i; eventtab[ev_audio].active = 0; - for (i = 0; i < 4; i++) { - struct audio_channel_data *cdp = audio_channel + i; + for (i = 0; i < AUDIO_CHANNELS_PAULA; i++) { + struct audio_channel_data *cdp = audio_channel + i; if (cdp->evtime != MAX_EV) { if (best > cdp->evtime) { best = cdp->evtime; - eventtab[ev_audio].active = 1; - } - } - } - - eventtab[ev_audio].evtime = get_cycles() + best; + eventtab[ev_audio].active = 1; + } + } + } + eventtab[ev_audio].evtime = get_cycles () + best; } -static void audio_event_reset(void) +static void audio_event_reset (void) { int i; - last_cycles = get_cycles(); + last_cycles = get_cycles (); next_sample_evtime = scaled_sample_evtime; - if (!isrestore()) { - for (i = 0; i < 4; i++) - zerostate(i); + if (!isrestore ()) { + for (i = 0; i < AUDIO_CHANNELS_PAULA; i++) + zerostate (i); } - schedule_audio(); - events_schedule(); + schedule_audio (); + events_schedule (); } void audio_deactivate(void) { - gui_data.sndbuf_status = 3; - gui_data.sndbuf = 0; + gui_data.sndbuf_status = 3; + gui_data.sndbuf = 0; audio_work_to_do = 0; - pause_sound_buffer(); - clear_sound_buffers(); - audio_event_reset(); + pause_sound_buffer (); + clear_sound_buffers(); + audio_event_reset(); } int audio_activate(void) { - int ret = 0; - if (!audio_work_to_do) { - restart_sound_buffer(); - ret = 1; - audio_event_reset(); - } - audio_work_to_do = 4 * maxvpos_nom * 50; - return ret; -} -STATIC_INLINE int is_audio_active(void) -{ - return audio_work_to_do; + int ret = 0; + + if (!audio_work_to_do) { + restart_sound_buffer(); + ret = 1; + audio_event_reset(); + } + audio_work_to_do = 4 * maxvpos_nom * 50; + return ret; } -uae_u16 audio_dmal(void) +STATIC_INLINE int is_audio_active(void) +{ + return audio_work_to_do; +} + +STATIC_INLINE void update_volume(int nr, uae_u16 v) +{ + struct audio_channel_data *cdp = audio_channel + nr; + // 7 bit register in Paula. + v &= 127; + if (v > 64) + v = 64; + cdp->data.vol = v; +} + +uae_u16 audio_dmal (void) { uae_u16 dmal = 0; - for (int nr = 0; nr < 4; nr++) { + for (int nr = 0; nr < AUDIO_CHANNELS_PAULA; nr++) { struct audio_channel_data *cdp = audio_channel + nr; if (cdp->dr) dmal |= 1 << (nr * 2); @@ -797,24 +820,24 @@ uae_u16 audio_dmal(void) return dmal; } -static int isirq(int nr) +static int isirq (int nr) { - return INTREQR() & (0x80 << nr); + return INTREQR() & (0x80 << nr); } -static void setirq(int nr, int which) +static void setirq (int nr, int which) { - INTREQ_0(0x8000 | (0x80 << nr)); + INTREQ_0 (0x8000 | (0x80 << nr)); } -static void newsample(int nr, sample8_t sample) +static void newsample (int nr, sample8_t sample) { struct audio_channel_data *cdp = audio_channel + nr; - cdp->last_sample = cdp->current_sample; - cdp->current_sample = sample; + cdp->data.last_sample = cdp->data.current_sample; + cdp->data.current_sample = sample; } -STATIC_INLINE void setdr(int nr) +STATIC_INLINE void setdr (int nr) { struct audio_channel_data *cdp = audio_channel + nr; cdp->dr = true; @@ -823,7 +846,7 @@ STATIC_INLINE void setdr(int nr) } } -static void loaddat(int nr, bool modper) +static void loaddat (int nr, bool modper) { struct audio_channel_data *cdp = audio_channel + nr; int audav = adkcon & (0x01 << nr); @@ -833,39 +856,34 @@ static void loaddat(int nr, bool modper) return; if (modper && audap) { if (cdp->dat == 0) - cdp[1].per = PERIOD_MAX; + cdp[1].per = 65536 * CYCLE_UNIT; else if (cdp->dat > PERIOD_MIN) cdp[1].per = cdp->dat * CYCLE_UNIT; else cdp[1].per = PERIOD_MIN * CYCLE_UNIT; + } else if (audav) { + update_volume(nr + 1, cdp->dat); } - else if (audav) { - cdp[1].vol = cdp->dat; - cdp[1].vol &= 127; - if (cdp[1].vol > 64) - cdp[1].vol = 64; - } - } - else { + } else { cdp->dat2 = cdp->dat; } } -static void loaddat(int nr) +static void loaddat (int nr) { - loaddat(nr, false); + loaddat (nr, false); } -STATIC_INLINE void loadper(int nr) +STATIC_INLINE void loadper (int nr) { struct audio_channel_data *cdp = audio_channel + nr; cdp->evtime = cdp->per; if (cdp->evtime < CYCLE_UNIT) - write_log(_T("LOADPER%d bug %d\n"), nr, cdp->evtime); + write_log (_T("LOADPER%d bug %d\n"), nr, cdp->evtime); } -static void audio_state_channel2(int nr, bool perfin) +static void audio_state_channel2 (int nr, bool perfin) { struct audio_channel_data *cdp = audio_channel + nr; bool chan_ena = (dmacon & DMA_MASTER) && (dmacon & (1 << nr)); @@ -873,29 +891,27 @@ static void audio_state_channel2(int nr, bool perfin) int audav = adkcon & (0x01 << nr); int audap = adkcon & (0x10 << nr); int napnav = (!audav && !audap) || audav; - int hpos = current_hpos(); + int hpos = current_hpos (); cdp->dmaenstore = chan_ena; if (currprefs.produce_sound == 0) { - zerostate(nr); + zerostate (nr); return; } - audio_activate(); + audio_activate (); if ((cdp->state == 2 || cdp->state == 3) && usehacks()) { - if (!chan_ena && old_dma) { - // DMA switched off, state=2/3 and "too fast CPU": set flag + if (!chan_ena && old_dma) { + // DMA switched off, state=2/3 and "too fast CPU": set flag cdp->dmaofftime_active = true; } if (cdp->dmaofftime_active && !old_dma && chan_ena) { // We are still in state=2/3 and program is going to re-enable // DMA. Force state to zero to prevent CPU timed DMA wait // routines in common tracker players to lose notes. - newsample(nr, (cdp->dat2 >> 0) & 0xff); - // if (napnav) - // setirq (nr, 91); - zerostate(nr); + newsample (nr, (cdp->dat2 >> 0) & 0xff); + zerostate (nr); } } @@ -914,35 +930,32 @@ static void audio_state_channel2(int nr, bool perfin) if (cdp->wlen > 2) cdp->ptx_tofetch = true; cdp->dsr = true; - } - else if (cdp->dat_written && !isirq(nr)) { + } else if (cdp->dat_written && !isirq (nr)) { cdp->state = 2; - setirq(nr, 0); - loaddat(nr); + setirq (nr, 0); + loaddat (nr); if (usehacks() && cdp->per < 10 * CYCLE_UNIT) { // make sure audio.device AUDxDAT startup returns to idle state before DMA is enabled - newsample(nr, (cdp->dat2 >> 0) & 0xff); - zerostate(nr); - } - else { + newsample (nr, (cdp->dat2 >> 0) & 0xff); + zerostate (nr); + } else { cdp->pbufldl = true; - audio_state_channel2(nr, false); + audio_state_channel2 (nr, false); } - } - else { - zerostate(nr); + } else { + zerostate (nr); } break; case 1: cdp->evtime = MAX_EV; if (!chan_ena) { - zerostate(nr); + zerostate (nr); return; } if (!cdp->dat_written) return; - setirq(nr, 10); - setdr(nr); + setirq (nr, 10); + setdr (nr); if (cdp->wlen != 1) cdp->wlen = (cdp->wlen - 1) & 0xffff; cdp->state = 5; @@ -950,7 +963,7 @@ static void audio_state_channel2(int nr, bool perfin) case 5: cdp->evtime = MAX_EV; if (!chan_ena) { - zerostate(nr); + zerostate (nr); return; } if (!cdp->dat_written) @@ -959,130 +972,132 @@ static void audio_state_channel2(int nr, bool perfin) cdp->ptx_written = 0; cdp->lc = cdp->ptx; } - loaddat(nr); + loaddat (nr); if (napnav) - setdr(nr); + setdr (nr); cdp->state = 2; - loadper(nr); + loadper (nr); cdp->pbufldl = true; cdp->intreq2 = 0; - audio_state_channel2(nr, false); + audio_state_channel2 (nr, false); break; case 2: if (cdp->pbufldl) { - newsample(nr, (cdp->dat2 >> 8) & 0xff); - loadper(nr); + newsample (nr, (cdp->dat2 >> 8) & 0xff); + loadper (nr); cdp->pbufldl = false; } if (!perfin) return; if (audap) - loaddat(nr, true); + loaddat (nr, true); if (chan_ena) { if (audap) - setdr(nr); + setdr (nr); if (cdp->intreq2 && audap) - setirq(nr, 21); - } - else { + setirq (nr, 21); + } else { if (audap) - setirq(nr, 22); + setirq (nr, 22); } cdp->pbufldl = true; cdp->state = 3; - audio_state_channel2(nr, false); + audio_state_channel2 (nr, false); break; case 3: if (cdp->pbufldl) { - newsample(nr, (cdp->dat2 >> 0) & 0xff); - loadper(nr); + newsample (nr, (cdp->dat2 >> 0) & 0xff); + loadper (nr); cdp->pbufldl = false; } if (!perfin) return; if (chan_ena) { - loaddat(nr); + loaddat (nr); if (cdp->intreq2 && napnav) - setirq(nr, 31); + setirq (nr, 31); if (napnav) - setdr(nr); - } - else { - if (isirq(nr)) { - zerostate(nr); + setdr (nr); + } else { + if (isirq (nr)) { + zerostate (nr); return; } - loaddat(nr); + loaddat (nr); if (napnav) - setirq(nr, 32); + setirq (nr, 32); } cdp->intreq2 = 0; cdp->pbufldl = true; cdp->state = 2; - audio_state_channel2(nr, false); + audio_state_channel2 (nr, false); break; } } -static void audio_state_channel(int nr, bool perfin) +static void audio_state_channel (int nr, bool perfin) { struct audio_channel_data *cdp = audio_channel + nr; - audio_state_channel2(nr, perfin); - cdp->dat_written = false; + audio_state_channel2 (nr, perfin); + cdp->dat_written = false; } -void audio_state_machine(void) +void audio_state_machine (void) { - update_audio(); - for (int nr = 0; nr < 4; nr++) { + update_audio (); + for (int nr = 0; nr < AUDIO_CHANNELS_PAULA; nr++) { struct audio_channel_data *cdp = audio_channel + nr; - audio_state_channel2(nr, false); + audio_state_channel2 (nr, false); cdp->dat_written = false; } - schedule_audio(); - events_schedule(); + schedule_audio (); + events_schedule (); } -void audio_reset(void) +void audio_reset (void) { - int i; - struct audio_channel_data *cdp; + int i; + struct audio_channel_data *cdp; - reset_sound(); - memset(sound_filter_state, 0, sizeof sound_filter_state); - if (!isrestore()) { - for (i = 0; i < 4; i++) { - cdp = &audio_channel[i]; - memset(cdp, 0, sizeof *audio_channel); - cdp->per = PERIOD_MAX - 1; - cdp->vol = 0; - cdp->evtime = MAX_EV; - } - } + reset_sound (); + memset(sound_filter_state, 0, sizeof sound_filter_state); + if (!isrestore ()) { + for (i = 0; i < AUDIO_CHANNELS_PAULA; i++) { + cdp = &audio_channel[i]; + memset (cdp, 0, sizeof *audio_channel); + cdp->per = PERIOD_MAX - 1; + cdp->data.vol = 0; + cdp->evtime = MAX_EV; + } + } - last_cycles = get_cycles(); - next_sample_evtime = scaled_sample_evtime; - - schedule_audio(); - events_schedule(); + last_cycles = get_cycles (); + next_sample_evtime = scaled_sample_evtime; + schedule_audio (); + events_schedule (); } -static int sound_prefs_changed(void) +static int sound_prefs_changed (void) { - if (changed_prefs.produce_sound != currprefs.produce_sound - || changed_prefs.sound_stereo != currprefs.sound_stereo - || changed_prefs.sound_freq != currprefs.sound_freq) - return 1; + if (!config_changed) + return 0; + if (changed_prefs.produce_sound != currprefs.produce_sound + || changed_prefs.sound_stereo != currprefs.sound_stereo + || changed_prefs.sound_freq != currprefs.sound_freq) + return 1; - if (changed_prefs.sound_stereo_separation != currprefs.sound_stereo_separation - || changed_prefs.sound_mixed_stereo_delay != currprefs.sound_mixed_stereo_delay - || changed_prefs.sound_interpol != currprefs.sound_interpol - || changed_prefs.sound_filter != currprefs.sound_filter - || changed_prefs.sound_filter_type != currprefs.sound_filter_type) - return -1; - return 0; + if (changed_prefs.sound_stereo_separation != currprefs.sound_stereo_separation + || changed_prefs.sound_mixed_stereo_delay != currprefs.sound_mixed_stereo_delay + || changed_prefs.sound_interpol != currprefs.sound_interpol + || changed_prefs.sound_volume_cd != currprefs.sound_volume_cd + || changed_prefs.sound_filter != currprefs.sound_filter + || changed_prefs.sound_filter_type != currprefs.sound_filter_type) + return -1; + return 0; } +double softfloat_tan(double v); + /* This computes the 1st order low-pass filter term b0. * The a1 term is 1.0 - b0. The center frequency marks the -3 dB point. */ #ifndef M_PI @@ -1090,358 +1105,332 @@ static int sound_prefs_changed(void) #endif static float rc_calculate_a0(int sample_rate, int cutoff_freq) { - float omega; - /* The BLT correction formula below blows up if the cutoff is above nyquist. */ - if (cutoff_freq >= sample_rate / 2) - return 1.0; + float omega; + /* The BLT correction formula below blows up if the cutoff is above nyquist. */ + if (cutoff_freq >= sample_rate / 2) + return 1.0; - omega = 2 * M_PI * cutoff_freq / sample_rate; - /* Compensate for the bilinear transformation. This allows us to specify the - * stop frequency more exactly, but the filter becomes less steep further - * from stopband. */ - omega = tan(omega / 2) * 2; - return 1 / (1 + 1 / omega); + omega = 2 * M_PI * cutoff_freq / sample_rate; + /* Compensate for the bilinear transformation. This allows us to specify the + * stop frequency more exactly, but the filter becomes less steep further + * from stopband. */ + omega = softfloat_tan (omega / 2.0) * 2.0; + float out = 1.0 / (1.0 + 1.0 / omega); + return out; } -void check_prefs_changed_audio(void) +void check_prefs_changed_audio (void) { - int ch; + int ch; - if (sound_available) { - ch = sound_prefs_changed(); + if (sound_available) { + ch = sound_prefs_changed (); if (ch > 0) { - clear_sound_buffers(); + clear_sound_buffers (); } if (ch) { - set_audio(); - audio_activate(); + set_audio (); + audio_activate (); } } } void set_audio(void) { - int old_mixed_size = mixed_stereo_size; - int sep, delay; - int ch; + int old_mixed_size = mixed_stereo_size; + int sep, delay; + int ch; - ch = sound_prefs_changed(); - if (ch >= 0) - close_sound(); + ch = sound_prefs_changed (); + if (ch >= 0) + close_sound (); currprefs.produce_sound = changed_prefs.produce_sound; currprefs.sound_stereo = changed_prefs.sound_stereo; currprefs.sound_freq = changed_prefs.sound_freq; - currprefs.sound_stereo_separation = changed_prefs.sound_stereo_separation; - currprefs.sound_mixed_stereo_delay = changed_prefs.sound_mixed_stereo_delay; + currprefs.sound_stereo_separation = changed_prefs.sound_stereo_separation; + currprefs.sound_mixed_stereo_delay = changed_prefs.sound_mixed_stereo_delay; currprefs.sound_interpol = changed_prefs.sound_interpol; - currprefs.sound_filter = changed_prefs.sound_filter; - currprefs.sound_filter_type = changed_prefs.sound_filter_type; + currprefs.sound_filter = changed_prefs.sound_filter; + currprefs.sound_filter_type = changed_prefs.sound_filter_type; + currprefs.sound_volume_cd = changed_prefs.sound_volume_cd; - if (ch >= 0) { - if (currprefs.produce_sound >= 2) { - if (!init_audio()) { - if (!sound_available) { - write_log(_T("Sound is not supported.\n")); - } - else { - write_log(_T("Sorry, can't initialize sound.\n")); - currprefs.produce_sound = 1; - /* So we don't do this every frame */ - changed_prefs.produce_sound = 1; - } - } - } - next_sample_evtime = scaled_sample_evtime; - last_cycles = get_cycles(); - compute_vsynctime(); - } - else { - sound_volume(0); - } + sound_cd_volume[0] = sound_cd_volume[1] = (100 - (currprefs.sound_volume_cd < 0 ? 0 : currprefs.sound_volume_cd)) * 32768 / 100; - sep = (currprefs.sound_stereo_separation = changed_prefs.sound_stereo_separation) * 3 / 2; - if (sep >= 15) - sep = 16; - delay = currprefs.sound_mixed_stereo_delay = changed_prefs.sound_mixed_stereo_delay; - mixed_mul1 = MIXED_STEREO_SCALE / 2 - sep; - mixed_mul2 = MIXED_STEREO_SCALE / 2 + sep; + if (ch >= 0) { + if (currprefs.produce_sound >= 2) { + if (!init_audio ()) { + if (! sound_available) { + write_log (_T("Sound is not supported.\n")); + } else { + write_log (_T("Sorry, can't initialize sound.\n")); + currprefs.produce_sound = 1; + /* So we don't do this every frame */ + changed_prefs.produce_sound = 1; + } + } + } + next_sample_evtime = scaled_sample_evtime; + last_cycles = get_cycles (); + compute_vsynctime (); + } else { + sound_volume (0); + } + + sep = (currprefs.sound_stereo_separation = changed_prefs.sound_stereo_separation) * 3 / 2; + if (sep >= 15) + sep = 16; + delay = currprefs.sound_mixed_stereo_delay = changed_prefs.sound_mixed_stereo_delay; + mixed_mul1 = MIXED_STEREO_SCALE / 2 - sep; + mixed_mul2 = MIXED_STEREO_SCALE / 2 + sep; mixed_stereo_size = delay > 0 ? (1 << delay) - 1 : 0; mixed_on = sep < MIXED_STEREO_MAX || mixed_stereo_size > 0; - if (mixed_on && old_mixed_size != mixed_stereo_size) { - saved_ptr = 0; - memset(right_word_saved, 0, sizeof right_word_saved); - } + if (mixed_on && old_mixed_size != mixed_stereo_size) { + saved_ptr = 0; + memset (right_word_saved, 0, sizeof right_word_saved); + } - led_filter_forced = -1; // always off - sound_use_filter = sound_use_filter_sinc = 0; - if (currprefs.sound_filter) { - if (currprefs.sound_filter == FILTER_SOUND_ON) - led_filter_forced = 1; - if (currprefs.sound_filter == FILTER_SOUND_EMUL) - led_filter_forced = 0; - if (currprefs.sound_filter_type == FILTER_SOUND_TYPE_A500) - sound_use_filter = FILTER_MODEL_A500; - else if (currprefs.sound_filter_type == FILTER_SOUND_TYPE_A1200) - sound_use_filter = FILTER_MODEL_A1200; - } - a500e_filter1_a0 = rc_calculate_a0(currprefs.sound_freq, 6200); - a500e_filter2_a0 = rc_calculate_a0(currprefs.sound_freq, 20000); - filter_a0 = rc_calculate_a0(currprefs.sound_freq, 7000); - led_filter_audio(); + led_filter_forced = -1; // always off + sound_use_filter = sound_use_filter_sinc = 0; + if (currprefs.sound_filter) { + if (currprefs.sound_filter == FILTER_SOUND_ON) + led_filter_forced = 1; + if (currprefs.sound_filter == FILTER_SOUND_EMUL) + led_filter_forced = 0; + if (currprefs.sound_filter_type == FILTER_SOUND_TYPE_A500) + sound_use_filter = FILTER_MODEL_A500; + else if (currprefs.sound_filter_type == FILTER_SOUND_TYPE_A1200) + sound_use_filter = FILTER_MODEL_A1200; + } + a500e_filter1_a0 = rc_calculate_a0(currprefs.sound_freq, 6200); + a500e_filter2_a0 = rc_calculate_a0(currprefs.sound_freq, 20000); + filter_a0 = rc_calculate_a0(currprefs.sound_freq, 7000); + memset (sound_filter_state, 0, sizeof sound_filter_state); + led_filter_audio(); - /* Select the right interpolation method. */ - if (sample_handler == sample16_handler - || sample_handler == sample16i_crux_handler - || sample_handler == sample16i_rh_handler - || sample_handler == sample16i_sinc_handler - || sample_handler == sample16i_anti_handler) + /* Select the right interpolation method. */ + if (sample_handler == sample16_handler + || sample_handler == sample16i_crux_handler + || sample_handler == sample16i_rh_handler + || sample_handler == sample16i_sinc_handler + || sample_handler == sample16i_anti_handler) { - sample_handler = (currprefs.sound_interpol == 0 ? sample16_handler - : currprefs.sound_interpol == 3 ? sample16i_rh_handler - : currprefs.sound_interpol == 4 ? sample16i_crux_handler - : currprefs.sound_interpol == 2 ? sample16i_sinc_handler - : sample16i_anti_handler); - } - else if (sample_handler == sample16s_handler - || sample_handler == sample16si_crux_handler - || sample_handler == sample16si_rh_handler - || sample_handler == sample16si_sinc_handler - || sample_handler == sample16si_anti_handler) - { - sample_handler = (currprefs.sound_interpol == 0 ? sample16s_handler - : currprefs.sound_interpol == 3 ? sample16si_rh_handler - : currprefs.sound_interpol == 4 ? sample16si_crux_handler - : currprefs.sound_interpol == 2 ? sample16si_sinc_handler - : sample16si_anti_handler); - } - sample_prehandler = NULL; - if (sample_handler == sample16si_sinc_handler || sample_handler == sample16i_sinc_handler) { - sample_prehandler = sinc_prehandler; - sound_use_filter_sinc = sound_use_filter; - sound_use_filter = 0; - } - else if (sample_handler == sample16si_anti_handler || sample_handler == sample16i_anti_handler) { - sample_prehandler = anti_prehandler; + sample_handler = (currprefs.sound_interpol == 0 ? sample16_handler + : currprefs.sound_interpol == 3 ? sample16i_rh_handler + : currprefs.sound_interpol == 4 ? sample16i_crux_handler + : currprefs.sound_interpol == 2 ? sample16i_sinc_handler + : sample16i_anti_handler); + } else if (sample_handler == sample16s_handler + || sample_handler == sample16si_crux_handler + || sample_handler == sample16si_rh_handler + || sample_handler == sample16si_sinc_handler + || sample_handler == sample16si_anti_handler) + { + sample_handler = (currprefs.sound_interpol == 0 ? sample16s_handler + : currprefs.sound_interpol == 3 ? sample16si_rh_handler + : currprefs.sound_interpol == 4 ? sample16si_crux_handler + : currprefs.sound_interpol == 2 ? sample16si_sinc_handler + : sample16si_anti_handler); + } + sample_prehandler = NULL; + if (sample_handler == sample16si_sinc_handler || sample_handler == sample16i_sinc_handler) { + sample_prehandler = sinc_prehandler_paula; + sound_use_filter_sinc = sound_use_filter; + sound_use_filter = 0; + } else if (sample_handler == sample16si_anti_handler || sample_handler == sample16i_anti_handler) { + sample_prehandler = anti_prehandler; + } + for (int i = 0; i < AUDIO_CHANNELS_PAULA; i++) { + audio_data[i] = &audio_channel[i].data; } - if (currprefs.sound_stereo) { - if (currprefs.sound_filter) { - if (mixed_on) - put_sound_word_stereo_func = put_sound_word_stereo_func_filter_mixed; - else - put_sound_word_stereo_func = put_sound_word_stereo_func_filter_notmixed; - } - else { - if (mixed_on) - put_sound_word_stereo_func = put_sound_word_stereo_func_nofilter_mixed; - else - put_sound_word_stereo_func = put_sound_word_stereo_func_nofilter_notmixed; - } - } - else { - if (currprefs.sound_filter) { - put_sound_word_mono_func = put_sound_word_mono_func_filter; - } - else { - put_sound_word_mono_func = put_sound_word_mono_func_nofilter; - } - } - - if (currprefs.produce_sound == 0) { - eventtab[ev_audio].active = 0; - events_schedule(); - } - else { - audio_activate(); - schedule_audio(); - events_schedule(); - } + if(currprefs.sound_stereo) { + if(currprefs.sound_filter) { + if(mixed_on) + put_sound_word_stereo_func = put_sound_word_stereo_func_filter_mixed; + else + put_sound_word_stereo_func = put_sound_word_stereo_func_filter_notmixed; + } + else { + if(mixed_on) + put_sound_word_stereo_func = put_sound_word_stereo_func_nofilter_mixed; + else + put_sound_word_stereo_func = put_sound_word_stereo_func_nofilter_notmixed; + } + } + else { + if(currprefs.sound_filter) { + put_sound_word_mono_func = put_sound_word_mono_func_filter; + } + else { + put_sound_word_mono_func = put_sound_word_mono_func_nofilter; + } + } + + if (currprefs.produce_sound == 0) { + eventtab[ev_audio].active = 0; + events_schedule (); + } else { + audio_activate (); + schedule_audio (); + events_schedule (); + } + set_config_changed (); } -void update_audio(void) +void update_audio (void) { - unsigned long int n_cycles = 0; + unsigned long int n_cycles = 0; - if (!isaudio()) - goto end; - if (isrestore()) - goto end; - if (!is_audio_active()) - goto end; + if (!isaudio()) + goto end; + if (isrestore ()) + goto end; + if (!is_audio_active()) + goto end; - n_cycles = get_cycles() - last_cycles; - while (n_cycles > 0) { + n_cycles = get_cycles () - last_cycles; + while (n_cycles > 0) { unsigned long int best_evtime = n_cycles; - unsigned long rounded; - int i; + unsigned long rounded; + int i; - for (i = 0; i < 4; i++) { - if (audio_channel[i].evtime != MAX_EV && best_evtime > audio_channel[i].evtime) - best_evtime = audio_channel[i].evtime; - } + for (i = 0; i < AUDIO_CHANNELS_PAULA; i++) { + if (audio_channel[i].evtime != MAX_EV && best_evtime > audio_channel[i].evtime) + best_evtime = audio_channel[i].evtime; + } - rounded = next_sample_evtime; + rounded = next_sample_evtime; - if (currprefs.produce_sound > 1 && best_evtime > rounded) - best_evtime = rounded; + if (currprefs.produce_sound > 1 && best_evtime > rounded) + best_evtime = rounded; - /* Decrease time-to-wait counters */ - next_sample_evtime -= best_evtime; + /* Decrease time-to-wait counters */ + next_sample_evtime -= best_evtime; - if (sample_prehandler && (currprefs.produce_sound > 1)) { - sample_prehandler(best_evtime / CYCLE_UNIT); - } + if (sample_prehandler && (currprefs.produce_sound > 1)) { + sample_prehandler(best_evtime / CYCLE_UNIT); + } - for (i = 0; i < 4; i++) { - if (audio_channel[i].evtime != MAX_EV) - audio_channel[i].evtime -= best_evtime; - } + for (i = 0; i < AUDIO_CHANNELS_PAULA; i++) { + if (audio_channel[i].evtime != MAX_EV) + audio_channel[i].evtime -= best_evtime; + } - n_cycles -= best_evtime; + n_cycles -= best_evtime; - /* Test if new sample needs to be outputted */ - if ((rounded == best_evtime) && (currprefs.produce_sound > 1)) { - next_sample_evtime += scaled_sample_evtime; - (*sample_handler)(); - } + /* Test if new sample needs to be outputted */ + if ((rounded == best_evtime) && (currprefs.produce_sound > 1)) { + next_sample_evtime += scaled_sample_evtime; + (*sample_handler) (); + } - for (i = 0; i < 4; i++) { + for (i = 0; i < AUDIO_CHANNELS_PAULA; i++) { if (audio_channel[i].evtime == 0) { - audio_state_channel(i, true); - if (audio_channel[i].evtime == 0) { - write_log(_T("evtime==0 sound bug channel %d\n"), i); - audio_channel[i].evtime = MAX_EV; - } + audio_state_channel (i, true); } - } + } } end: - last_cycles = get_cycles() - n_cycles; + last_cycles = get_cycles () - n_cycles; } -void audio_evhandler(void) +void audio_evhandler (void) { - update_audio(); - schedule_audio(); + update_audio (); + schedule_audio (); } -void audio_hsync(void) +void audio_hsync (void) { - if (!isaudio()) - return; + if (!isaudio()) + return; if (audio_work_to_do > 0) { - audio_work_to_do--; - if (audio_work_to_do == 0) - audio_deactivate(); - } - - update_audio(); + audio_work_to_do--; + if (audio_work_to_do == 0) + audio_deactivate(); + } + update_audio(); } -void AUDxDAT(int nr, uae_u16 v, uaecptr addr) +void AUDxDAT (int nr, uae_u16 v) { struct audio_channel_data *cdp = audio_channel + nr; int chan_ena = (dmacon & DMA_MASTER) && (dmacon & (1 << nr)); -#if DEBUG_AUDIO > 0 - if (debugchannel(nr) && (DEBUG_AUDIO > 1 || (!chan_ena || addr == 0xffffffff || (cdp->state != 2 && cdp->state != 3)))) { - write_log(_T("AUD%dDAT: %04X ADDR=%08X LEN=%d/%d %d,%d,%d %06X\n"), nr, - v, addr, cdp->wlen, cdp->len, cdp->state, chan_ena, isirq(nr) ? 1 : 0, M68K_GETPC); - } -#endif cdp->dat = v; cdp->dat_written = true; -#if TEST_AUDIO > 0 - if (debugchannel(nr) && cdp->have_dat) - write_log(_T("%d: audxdat 1=%04x 2=%04x but old dat not yet used\n"), nr, cdp->dat, cdp->dat2); - cdp->have_dat = true; -#endif if (cdp->state == 2 || cdp->state == 3) { if (chan_ena) { if (cdp->wlen == 1) { cdp->wlen = cdp->len; cdp->intreq2 = true; - //if (sampleripper_enabled) - // do_samplerip(cdp); -#if DEBUG_AUDIO > 0 - if (debugchannel(nr) && cdp->wlen > 1) - write_log(_T("AUD%d looped, IRQ=%d, LC=%08X LEN=%d\n"), nr, isirq(nr) ? 1 : 0, cdp->pt, cdp->wlen); -#endif - } - else { + } else { cdp->wlen = (cdp->wlen - 1) & 0xffff; } } - } - else { - audio_activate(); - update_audio(); - audio_state_channel(nr, false); - schedule_audio(); - events_schedule(); + } else { + audio_activate (); + update_audio (); + audio_state_channel (nr, false); + schedule_audio (); + events_schedule (); } cdp->dat_written = false; } -void AUDxDAT(int nr, uae_u16 v) -{ - AUDxDAT(nr, v, 0xffffffff); -} -uaecptr audio_getpt(int nr, bool reset) +void audio_dmal_do (int nr, bool reset) { struct audio_channel_data *cdp = audio_channel + nr; - uaecptr p = cdp->pt; - cdp->pt += 2; + uae_u16 dat = chipmem_wget_indirect (cdp->pt); + cdp->pt += 2; if (reset) cdp->pt = cdp->lc; cdp->ptx_tofetch = false; - return p; + AUDxDAT (nr, dat); } -void AUDxLCH(int nr, uae_u16 v) +void AUDxLCH (int nr, uae_u16 v) { struct audio_channel_data *cdp = audio_channel + nr; - audio_activate(); - update_audio(); + audio_activate(); + update_audio (); - // someone wants to update PT but DSR has not yet been processed. - // too fast CPU and some tracker players: enable DMA, CPU delay, update AUDxPT with loop position + // someone wants to update PT but DSR has not yet been processed. + // too fast CPU and some tracker players: enable DMA, CPU delay, update AUDxPT with loop position if (usehacks() && ((cdp->ptx_tofetch && cdp->state == 1) || cdp->ptx_written)) { cdp->ptx = cdp->lc; cdp->ptx_written = true; - } - else { - cdp->lc = (cdp->lc & 0xffff) | ((uae_u32)v << 16); - } + } else { + cdp->lc = (cdp->lc & 0xffff) | ((uae_u32)v << 16); + } } -void AUDxLCL(int nr, uae_u16 v) +void AUDxLCL (int nr, uae_u16 v) { struct audio_channel_data *cdp = audio_channel + nr; - audio_activate(); - update_audio(); + audio_activate(); + update_audio (); if (usehacks() && ((cdp->ptx_tofetch && cdp->state == 1) || cdp->ptx_written)) { cdp->ptx = cdp->lc; cdp->ptx_written = true; - } - else { - cdp->lc = (cdp->lc & ~0xffff) | (v & 0xFFFE); - } + } else { + cdp->lc = (cdp->lc & ~0xffff) | (v & 0xFFFE); + } } -void AUDxPER(int nr, uae_u16 v) +void AUDxPER (int nr, uae_u16 v) { struct audio_channel_data *cdp = audio_channel + nr; unsigned long per; - audio_activate(); - update_audio(); + audio_activate(); + update_audio (); per = v * CYCLE_UNIT; - if (per == 0) - per = PERIOD_MAX - 1; + if (per == 0) + per = PERIOD_MAX - 1; if (per < PERIOD_MIN * CYCLE_UNIT) { /* smaller values would cause extremely high cpu usage */ @@ -1454,116 +1443,113 @@ void AUDxPER(int nr, uae_u16 v) per = PERIOD_MIN_NONCE * CYCLE_UNIT; } - if (cdp->per == PERIOD_MAX - 1 && per != PERIOD_MAX - 1) { - cdp->evtime = CYCLE_UNIT; - if (isaudio()) { - schedule_audio(); - events_schedule(); - } - } - cdp->per = per; + if (cdp->per == PERIOD_MAX - 1 && per != PERIOD_MAX - 1) { + cdp->evtime = CYCLE_UNIT; + if (isaudio()) { + schedule_audio (); + events_schedule (); + } + } + cdp->per = per; } -void AUDxLEN(int nr, uae_u16 v) +void AUDxLEN (int nr, uae_u16 v) { struct audio_channel_data *cdp = audio_channel + nr; - audio_activate(); - update_audio(); - cdp->len = v; + audio_activate(); + update_audio (); + cdp->len = v; } -void AUDxVOL(int nr, uae_u16 v) +void AUDxVOL (int nr, uae_u16 v) { struct audio_channel_data *cdp = audio_channel + nr; - // 7 bit register in Paula. - v &= 127; - if (v > 64) - v = 64; - audio_activate(); - update_audio(); - cdp->vol = v; + + audio_activate(); + update_audio (); + update_volume(nr, v); } -void audio_update_adkmasks(void) +void audio_update_adkmasks (void) { - static int prevcon = -1; - unsigned long t = adkcon | (adkcon >> 4); + static int prevcon = -1; + unsigned long t = adkcon | (adkcon >> 4); - audio_channel[0].adk_mask = (((t >> 0) & 1) - 1); - audio_channel[1].adk_mask = (((t >> 1) & 1) - 1); - audio_channel[2].adk_mask = (((t >> 2) & 1) - 1); - audio_channel[3].adk_mask = (((t >> 3) & 1) - 1); - if ((prevcon & 0xff) != (adkcon & 0xff)) { - audio_activate(); - prevcon = adkcon; - } + audio_channel[0].data.adk_mask = (((t >> 0) & 1) - 1); + audio_channel[1].data.adk_mask = (((t >> 1) & 1) - 1); + audio_channel[2].data.adk_mask = (((t >> 2) & 1) - 1); + audio_channel[3].data.adk_mask = (((t >> 3) & 1) - 1); + if ((prevcon & 0xff) != (adkcon & 0xff)) { + audio_activate(); + prevcon = adkcon; + } } -int init_audio(void) +int init_audio (void) { - return init_sound(); + return init_sound (); } -void led_filter_audio(void) +void led_filter_audio (void) { - led_filter_on = 0; - if (led_filter_forced > 0 || (gui_data.powerled && led_filter_forced >= 0)) - led_filter_on = 1; + led_filter_on = 0; + if (led_filter_forced > 0 || (gui_data.powerled && led_filter_forced >= 0)) + led_filter_on = 1; } -void restore_audio_finish(void) +void restore_audio_finish (void) { - last_cycles = get_cycles(); - schedule_audio(); - events_schedule(); + last_cycles = get_cycles (); + schedule_audio (); + events_schedule (); } -uae_u8 *restore_audio(int nr, uae_u8 *src) +uae_u8 *restore_audio (int nr, uae_u8 *src) { - struct audio_channel_data *acd = audio_channel + nr; + struct audio_channel_data *acd = audio_channel + nr; - zerostate(nr); - acd->state = restore_u8(); - acd->vol = restore_u8(); - acd->intreq2 = restore_u8() ? true : false; - uae_u8 flags = restore_u8(); + zerostate (nr); + acd->state = restore_u8 (); + acd->data.vol = restore_u8 (); + acd->intreq2 = restore_u8 () ? true : false; + uae_u8 flags = restore_u8 (); acd->dr = acd->dsr = false; if (flags & 1) acd->dr = true; if (flags & 2) acd->dsr = true; - acd->len = restore_u16(); - acd->wlen = restore_u16(); - uae_u16 p = restore_u16(); - acd->per = p ? p * CYCLE_UNIT : PERIOD_MAX; - acd->dat = acd->dat2 = restore_u16(); - acd->lc = restore_u32(); - acd->pt = restore_u32(); - acd->evtime = restore_u32(); + acd->len = restore_u16 (); + acd->wlen = restore_u16 (); + uae_u16 p = restore_u16 (); + acd->per = p ? p * CYCLE_UNIT : PERIOD_MAX; + acd->dat = acd->dat2 = restore_u16 (); + acd->lc = restore_u32 (); + acd->pt = restore_u32 (); + acd->evtime = restore_u32 (); acd->dmaenstore = (dmacon & DMA_MASTER) && (dmacon & (1 << nr)); - return src; + return src; } -uae_u8 *save_audio(int nr, int *len, uae_u8 *dstptr) +uae_u8 *save_audio (int nr, int *len, uae_u8 *dstptr) { struct audio_channel_data *acd = audio_channel + nr; - uae_u8 *dst, *dstbak; + uae_u8 *dst, *dstbak; - if (dstptr) - dstbak = dst = dstptr; - else - dstbak = dst = xmalloc(uae_u8, 100); - save_u8(acd->state); - save_u8(acd->vol); - save_u8(acd->intreq2); - save_u8((acd->dr ? 1 : 0) | (acd->dsr ? 2 : 0) | 0x80); - save_u16(acd->len); - save_u16(acd->wlen); - save_u16(acd->per == PERIOD_MAX ? 0 : acd->per / CYCLE_UNIT); - save_u16(acd->dat); - save_u32(acd->lc); - save_u32(acd->pt); - save_u32(acd->evtime); - *len = dst - dstbak; - return dstbak; -} \ No newline at end of file + if (dstptr) + dstbak = dst = dstptr; + else + dstbak = dst = xmalloc (uae_u8, 100); + save_u8 (acd->state); + save_u8 (acd->data.vol); + save_u8 (acd->intreq2); + save_u8 ((acd->dr ? 1 : 0) | (acd->dsr ? 2 : 0) | 0x80); + save_u16 (acd->len); + save_u16 (acd->wlen); + save_u16 (acd->per == PERIOD_MAX ? 0 : acd->per / CYCLE_UNIT); + save_u16 (acd->dat); + save_u32 (acd->lc); + save_u32 (acd->pt); + save_u32 (acd->evtime); + *len = dst - dstbak; + return dstbak; +} diff --git a/src/autoconf.cpp b/src/autoconf.cpp index b5219bb9..576f4e16 100644 --- a/src/autoconf.cpp +++ b/src/autoconf.cpp @@ -1,30 +1,23 @@ -/* -* UAE - The Un*x Amiga Emulator -* -* AutoConfig devices -* -* Copyright 1995, 1996 Bernd Schmidt -* Copyright 1996 Ed Hanway -*/ + /* + * UAE - The Un*x Amiga Emulator + * + * AutoConfig devices + * + * Copyright 1995, 1996 Bernd Schmidt + * Copyright 1996 Ed Hanway + */ #include "sysconfig.h" #include "sysdeps.h" -#define NEW_TRAP_DEBUG 0 - #include "options.h" #include "uae.h" #include "memory.h" #include "custom.h" -#include "events.h" #include "newcpu.h" #include "autoconf.h" #include "traps.h" -#include "debug.h" -#include "threaddep/thread.h" -#include "native2amiga.h" #include "inputdevice.h" -//#include "uae/ppc.h" /* Commonly used autoconfig strings */ @@ -35,83 +28,33 @@ uaecptr EXPANSION_bootcode, EXPANSION_nullfunc; /* ROM tag area memory access */ uaecptr rtarea_base = RTAREA_DEFAULT; -uae_sem_t hardware_trap_event[RTAREA_TRAP_DATA_SIZE / RTAREA_TRAP_DATA_SLOT_SIZE]; -uae_sem_t hardware_trap_event2[RTAREA_TRAP_DATA_SIZE / RTAREA_TRAP_DATA_SLOT_SIZE]; - -static uaecptr rt_trampoline_ptr, trap_entry; -static bool rtarea_write_enabled; -extern volatile uae_atomic hwtrap_waiting; -extern volatile int trap_mode; DECLARE_MEMORY_FUNCTIONS(rtarea); addrbank rtarea_bank = { - rtarea_lget, rtarea_wget, rtarea_bget, - rtarea_lput, rtarea_wput, rtarea_bput, + rtarea_lget, rtarea_wget, rtarea_bget, + rtarea_lput, rtarea_wput, rtarea_bput, rtarea_xlate, rtarea_check, NULL, _T("rtarea"), _T("UAE Boot ROM"), rtarea_lget, rtarea_wget, - ABFLAG_ROMIN | ABFLAG_PPCIOSPACE, S_READ, S_WRITE + ABFLAG_ROMIN, S_READ, S_WRITE }; -#define MAX_ABSOLUTE_ROM_ADDRESS 1024 - -static int absolute_rom_address; -static uaecptr absolute_rom_addresses[MAX_ABSOLUTE_ROM_ADDRESS]; -static uaecptr rombase_new; - -static bool istrapwait(void) -{ - for (int i = 0; i < RTAREA_TRAP_DATA_NUM + RTAREA_TRAP_DATA_SEND_NUM; i++) { - uae_u8 *data = rtarea_bank.baseaddr + RTAREA_TRAP_DATA + i * RTAREA_TRAP_DATA_SLOT_SIZE; - uae_u8 *status = rtarea_bank.baseaddr + RTAREA_TRAP_STATUS + i * RTAREA_TRAP_STATUS_SIZE; - if (get_long_host(data + RTAREA_TRAP_DATA_TASKWAIT) && status[3] && status[2] >= 0x80) { - return true; - } - } - return false; -} - #define RTAREA_WRITEOFFSET 0xfff0 -static bool rtarea_trap_data(uaecptr addr) +static uae_u8 *REGPARAM2 rtarea_xlate (uaecptr addr) { - if (currprefs.uaeboard < 2) - return false; - if (addr >= RTAREA_TRAP_DATA && addr < RTAREA_TRAP_DATA + (RTAREA_TRAP_DATA_NUM + RTAREA_TRAP_DATA_SEND_NUM) * RTAREA_TRAP_DATA_SLOT_SIZE) - return true; - return false; -} -static bool rtarea_trap_status(uaecptr addr) -{ - if (currprefs.uaeboard < 2) - return false; - if (addr >= RTAREA_TRAP_STATUS && addr < RTAREA_TRAP_STATUS + (RTAREA_TRAP_DATA_NUM + RTAREA_TRAP_DATA_SEND_NUM) * RTAREA_TRAP_STATUS_SIZE) - return true; - return false; -} -static bool rtarea_trap_status_extra(uaecptr addr) -{ - if (currprefs.uaeboard < 2) - return false; - if (addr >= RTAREA_TRAP_STATUS + 0x100 && addr < RTAREA_TRAP_STATUS + 0x100 + (RTAREA_TRAP_DATA_NUM + RTAREA_TRAP_DATA_SEND_NUM) * RTAREA_TRAP_STATUS_SIZE) - return true; - return false; -} - -static uae_u8 *REGPARAM2 rtarea_xlate(uaecptr addr) -{ - addr &= 0xFFFF; + addr &= 0xFFFF; return rtarea_bank.baseaddr + addr; } -static int REGPARAM2 rtarea_check(uaecptr addr, uae_u32 size) +static int REGPARAM2 rtarea_check (uaecptr addr, uae_u32 size) { - addr &= 0xFFFF; - return (addr + size) <= 0xFFFF; + addr &= 0xFFFF; + return (addr + size) <= 0xFFFF; } -static uae_u32 REGPARAM2 rtarea_lget(uaecptr addr) +static uae_u32 REGPARAM2 rtarea_lget (uaecptr addr) { - addr &= 0xFFFF; + addr &= 0xFFFF; if (addr & 1) return 0; if (addr >= 0xfffd) @@ -119,96 +62,114 @@ static uae_u32 REGPARAM2 rtarea_lget(uaecptr addr) return (rtarea_bank.baseaddr[addr + 0] << 24) | (rtarea_bank.baseaddr[addr + 1] << 16) | (rtarea_bank.baseaddr[addr + 2] << 8) | (rtarea_bank.baseaddr[addr + 3] << 0); } -static uae_u32 REGPARAM2 rtarea_wget(uaecptr addr) +static uae_u32 REGPARAM2 rtarea_wget (uaecptr addr) { - addr &= 0xFFFF; + addr &= 0xFFFF; if (addr & 1) return 0; - uaecptr addr2 = addr - RTAREA_TRAP_STATUS; - - if (rtarea_trap_status(addr)) { - int trap_offset = addr2 & (RTAREA_TRAP_STATUS_SIZE - 1); - int trap_slot = addr2 / RTAREA_TRAP_STATUS_SIZE; - // lock attempt - if (trap_offset == 2) { - if (rtarea_bank.baseaddr[addr + 1] & 0x80) { - return rtarea_bank.baseaddr[addr + 1]; - } - rtarea_bank.baseaddr[addr + 1] |= 0x80; - rtarea_bank.baseaddr[addr + 0] = 0; - return 0; - } - } return (rtarea_bank.baseaddr[addr] << 8) + rtarea_bank.baseaddr[addr + 1]; } -static uae_u32 REGPARAM2 rtarea_bget(uaecptr addr) +static uae_u32 REGPARAM2 rtarea_bget (uaecptr addr) { - addr &= 0xFFFF; - return rtarea_bank.baseaddr[addr]; + addr &= 0xFFFF; + + if (addr == RTAREA_INTREQ + 0) { + rtarea_bank.baseaddr[addr] = atomic_bit_test_and_reset(&uae_int_requested, 0); + //write_log(rtarea_bank.baseaddr[addr] ? _T("+") : _T("-")); + } else if (addr == RTAREA_INTREQ + 1) { + rtarea_bank.baseaddr[addr] = 0; + } else if (addr == RTAREA_INTREQ + 2) { + rtarea_bank.baseaddr[addr] = 0; + } + return rtarea_bank.baseaddr[addr]; } static bool rtarea_write(uaecptr addr) { - if (rtarea_write_enabled) - return true; if (addr >= RTAREA_WRITEOFFSET) return true; if (addr >= RTAREA_SYSBASE && addr < RTAREA_SYSBASE + 4) return true; - return rtarea_trap_data(addr) || rtarea_trap_status(addr) || rtarea_trap_status_extra(addr); + return false; } -static void REGPARAM2 rtarea_bput(uaecptr addr, uae_u32 value) +static void REGPARAM2 rtarea_bput (uaecptr addr, uae_u32 value) { addr &= 0xffff; if (!rtarea_write(addr)) return; rtarea_bank.baseaddr[addr] = value; + if (addr == RTAREA_INTREQ + 3) { + mousehack_wakeup(); + } } -static void REGPARAM2 rtarea_wput(uaecptr addr, uae_u32 value) +static void REGPARAM2 rtarea_wput (uaecptr addr, uae_u32 value) { addr &= 0xffff; - if (addr < RTAREA_WRITEOFFSET) + value &= 0xffff; + + if (addr & 1) return; - rtarea_bput(addr, value >> 8); - rtarea_bput(addr + 1, value & 0xff); + + if (!rtarea_write(addr)) + return; + + rtarea_bank.baseaddr[addr + 0] = value >> 8; + rtarea_bank.baseaddr[addr + 1] = (uae_u8)value; } -static void REGPARAM2 rtarea_lput(uaecptr addr, uae_u32 value) +static void REGPARAM2 rtarea_lput (uaecptr addr, uae_u32 value) { addr &= 0xffff; - if (addr < RTAREA_WRITEOFFSET) + if (addr & 1) return; - rtarea_wput(addr, value >> 16); - rtarea_wput(addr + 2, value & 0xffff); + if (addr >= 0xfffd) + return; + if (!rtarea_write(addr)) + return; + rtarea_bank.baseaddr[addr + 0] = value >> 24; + rtarea_bank.baseaddr[addr + 1] = value >> 16; + rtarea_bank.baseaddr[addr + 2] = value >> 8; + rtarea_bank.baseaddr[addr + 3] = value >> 0; +} + +void rtarea_reset(void) +{ + uae_u8 *p = rtarea_bank.baseaddr; + if (p) { + memset(p + RTAREA_TRAP_DATA, 0, RTAREA_TRAP_DATA_SLOT_SIZE * (RTAREA_TRAP_DATA_NUM + RTAREA_TRAP_DATA_SEND_NUM)); + memset(p + RTAREA_TRAP_STATUS, 0, RTAREA_TRAP_STATUS_SIZE * (RTAREA_TRAP_DATA_NUM + RTAREA_TRAP_DATA_SEND_NUM)); + memset(p + RTAREA_HEARTBEAT, 0, 0x10000 - RTAREA_HEARTBEAT); + memset(p + RTAREA_VARIABLES, 0, RTAREA_VARIABLES_SIZE); + } } /* some quick & dirty code to fill in the rt area and save me a lot of -* scratch paper -*/ + * scratch paper + */ static int rt_addr; static int rt_straddr; -uae_u32 addr(int ptr) +uae_u32 addr (int ptr) { - return (uae_u32)ptr + rtarea_base; + return (uae_u32)ptr + rtarea_base; } -void db(uae_u8 data) +void db (uae_u8 data) { rtarea_bank.baseaddr[rt_addr++] = data; } -void dw(uae_u16 data) +void dw (uae_u16 data) { rtarea_bank.baseaddr[rt_addr++] = (uae_u8)(data >> 8); rtarea_bank.baseaddr[rt_addr++] = (uae_u8)data; } -void dl(uae_u32 data) +void dl (uae_u32 data) { rtarea_bank.baseaddr[rt_addr++] = data >> 24; rtarea_bank.baseaddr[rt_addr++] = data >> 16; @@ -216,198 +177,102 @@ void dl(uae_u32 data) rtarea_bank.baseaddr[rt_addr++] = data; } -uae_u8 dbg(uaecptr addr) +uae_u8 dbg (uaecptr addr) { - addr -= rtarea_base; + addr -= rtarea_base; return rtarea_bank.baseaddr[addr]; } /* store strings starting at the end of the rt area and working -* backward. store pointer at current address -*/ + * backward. store pointer at current address + */ -uae_u32 ds_ansi(const uae_char *str) +uae_u32 ds_ansi (const uae_char *str) { - int len; + int len; - if (!str) - return addr(rt_straddr); - len = strlen(str) + 1; - rt_straddr -= len; - strcpy((uae_char*)rtarea_bank.baseaddr + rt_straddr, str); - return addr(rt_straddr); + if (!str) + return addr (rt_straddr); + len = strlen (str) + 1; + rt_straddr -= len; + strcpy ((uae_char*)rtarea_bank.baseaddr + rt_straddr, str); + return addr (rt_straddr); } -uae_u32 ds(const TCHAR *str) +uae_u32 ds (const TCHAR *str) { - char *s = ua(str); - uae_u32 v = ds_ansi(s); - xfree(s); + char *s = ua (str); + uae_u32 v = ds_ansi (s); + xfree (s); return v; } -uae_u32 ds_bstr_ansi(const uae_char *str) +uae_u32 ds_bstr_ansi (const uae_char *str) { int len; - - len = strlen(str) + 2; + + len = strlen (str) + 2; rt_straddr -= len; while (rt_straddr & 3) rt_straddr--; rtarea_bank.baseaddr[rt_straddr] = len - 2; - strcpy((uae_char*)rtarea_bank.baseaddr + rt_straddr + 1, str); - return addr(rt_straddr) >> 2; + strcpy ((uae_char*)rtarea_bank.baseaddr + rt_straddr + 1, str); + return addr (rt_straddr) >> 2; } -void save_rom_absolute(uaecptr addr) +void calltrap (uae_u32 n) { - if (rombase_new) - return; - if (absolute_rom_address >= MAX_ABSOLUTE_ROM_ADDRESS) { - write_log(_T("MAX_ABSOLUTE_ROM_ADDRESS is too low!")); - abort(); - } - for (int i = 0; i < absolute_rom_address; i++) { - if (absolute_rom_addresses[i] == addr) { - write_log(_T("Address %08x already added\n"), addr); - return; - } - } - absolute_rom_addresses[absolute_rom_address++] = addr; + dw (0xA000 + n); } -void add_rom_absolute(uaecptr addr) +void org (uae_u32 a) { - uaecptr h = here(); - dl(addr); - save_rom_absolute(h); + if ( ((a & 0xffff0000) != 0x00f00000) && ((a & 0xffff0000) != rtarea_base) ) + write_log (_T("ORG: corrupt address! %08X"), a); + rt_addr = a & 0xffff; } -uae_u32 boot_rom_copy(TrapContext *ctx, uaecptr rombase, int mode) +uae_u32 here (void) { - uaecptr reloc = 0; - if (currprefs.uaeboard < 3) - return 0; - if (!mode) { - rtarea_write_enabled = true; - protect_roms(false); - rombase_new = rombase; - int size = 4 + 2 + 4; - for (int i = 0; i < absolute_rom_address; i++) { - uae_u32 a = absolute_rom_addresses[i]; - if (a >= rtarea_base && a < rtarea_base + 0x10000) { - size += 2; - } - else { - size += 4; - } - } - reloc = uaeboard_alloc_ram(size); - uae_u8 *p = uaeboard_map_ram(reloc); - put_long_host(p, rtarea_base); - p += 4; - for (int i = 0; i < absolute_rom_address; i++) { - uae_u32 a = absolute_rom_addresses[i]; - if (a >= rtarea_base && a < rtarea_base + 0x10000) { - put_word_host(p, a & 0xffff); - p += 2; - } - } - put_word_host(p, 0); - p += 2; - for (int i = 0; i < absolute_rom_address; i++) { - uae_u32 a = absolute_rom_addresses[i]; - if (a < rtarea_base || a >= rtarea_base + 0x10000) { - put_long_host(p, a); - p += 4; - } - } - put_long_host(p, 0); - write_log(_T("ROMBASE %08x RAMBASE %08x RELOC %08x (%d)\n"), rtarea_base, rombase, reloc, absolute_rom_address); - } - else { - rtarea_write_enabled = false; - protect_roms(true); - write_log(_T("ROMBASE changed.\n"), absolute_rom_address); - reloc = 1; - } - return reloc; + return addr (rt_addr); } -void calltrap(uae_u32 n) +void align (int b) { - if (currprefs.uaeboard > 2) { - dw(0x4eb9); // JSR rt_trampoline_ptr - add_rom_absolute(rt_trampoline_ptr); - uaecptr a = here(); - org(rt_trampoline_ptr); - dw(0x3f3c); // MOVE.W #n,-(SP) - dw(n); - dw(0x4ef9); // JMP rt_trampoline_entry - add_rom_absolute(trap_entry); - org(a); - rt_trampoline_ptr += 3 * 2 + 1 * 4; - } - else { - dw(0xA000 + n); - } -} - -void org(uae_u32 a) -{ - if (((a & 0xffff0000) != 0x00f00000) && ((a & 0xffff0000) != rtarea_base)) - write_log(_T("ORG: corrupt address! %08X"), a); - rt_addr = a & 0xffff; -} - -uae_u32 here(void) -{ - return addr(rt_addr); -} - -void align(int b) -{ - rt_addr = (rt_addr + b - 1) & ~(b - 1); + rt_addr = (rt_addr + b - 1) & ~(b - 1); } static uae_u32 REGPARAM2 nullfunc(TrapContext *ctx) { - write_log(_T("Null function called\n")); - return 0; + write_log (_T("Null function called\n")); + return 0; } -static uae_u32 REGPARAM2 getchipmemsize(TrapContext *ctx) +static uae_u32 REGPARAM2 getchipmemsize (TrapContext *ctx) { - m68k_dreg(regs, 1) = z3chipmem_bank.allocated_size; - m68k_dreg(regs, 1) = z3chipmem_bank.start; - return chipmem_bank.allocated_size; + trap_set_dreg(ctx, 1, 0); + trap_set_areg(ctx, 1, 0); + return chipmem_bank.allocated_size; } -static uae_u32 REGPARAM2 uae_puts(TrapContext *ctx) +static uae_u32 REGPARAM2 uae_puts (TrapContext *ctx) { uae_char buf[MAX_DPATH]; - //trap_get_string(ctx, buf, trap_get_areg(ctx, 0), sizeof uae_char); - TCHAR *s = au(buf); - write_log(_T("%s"), s); - xfree(s); - return 0; + trap_get_string(ctx, buf, trap_get_areg(ctx, 0), sizeof (uae_char)); + write_log(_T("%s"), buf); + return 0; } -void rtarea_init_mem(void) +void rtarea_init_mem (void) { - if (need_uae_boot_rom(&currprefs)) { - rtarea_bank.flags &= ~ABFLAG_ALLOCINDIRECT; - } - else { - // not enabled and something else may use same address space - rtarea_bank.flags |= ABFLAG_ALLOCINDIRECT; - } rtarea_bank.reserved_size = RTAREA_SIZE; rtarea_bank.start = rtarea_base; - if (!mapped_malloc(&rtarea_bank)) { - write_log(_T("virtual memory exhausted (rtarea)!\n")); - abort(); - } + if (!mapped_malloc (&rtarea_bank)) { + write_log (_T("virtual memory exhausted (rtarea)!\n")); + target_startup_msg(_T("Internal error"), _T("Virtual memory exhausted (rtarea).")); + uae_restart(1, NULL); + return; + } } void rtarea_free(void) @@ -415,106 +280,102 @@ void rtarea_free(void) mapped_free(&rtarea_bank); } -void rtarea_init(void) +void rtarea_init (void) { - uae_u32 a; - TCHAR uaever[100]; + uae_u32 a; + TCHAR uaever[100]; - rt_straddr = 0xFF00 - 2; - rt_addr = 0; + rt_straddr = 0xFF00 - 2; + rt_addr = 0; - rt_trampoline_ptr = rtarea_base + RTAREA_TRAMPOLINE; - trap_entry = 0; - absolute_rom_address = 0; - rombase_new = 0; + init_traps (); - init_traps(); + rtarea_init_mem (); + memset (rtarea_bank.baseaddr, 0, RTAREA_SIZE); - rtarea_init_mem(); - memset(rtarea_bank.baseaddr, 0, RTAREA_SIZE); + _stprintf (uaever, _T("uae-%d.%d.%d"), UAEMAJOR, UAEMINOR, UAESUBREV); - _stprintf(uaever, _T("uae-%d.%d.%d"), UAEMAJOR, UAEMINOR, UAESUBREV); + EXPANSION_uaeversion = ds (uaever); + EXPANSION_explibname = ds (_T("expansion.library")); + EXPANSION_doslibname = ds (_T("dos.library")); + EXPANSION_uaedevname = ds (_T("uae.device")); - EXPANSION_uaeversion = ds(uaever); - EXPANSION_explibname = ds(_T("expansion.library")); - EXPANSION_doslibname = ds(_T("dos.library")); - EXPANSION_uaedevname = ds(_T("uae.device")); - - dw(0); - dw(0); + dw (0); + dw (0); #ifdef FILESYS - filesys_install_code(); + filesys_install_code (); #endif - deftrap(NULL); /* Generic emulator trap */ + deftrap (NULL); /* Generic emulator trap */ - a = here(); - /* Dummy trap - removing this breaks the filesys emulation. */ - org(rtarea_base + 0xFF00); - calltrap(deftrap2(nullfunc, TRAPFLAG_NO_RETVAL, _T(""))); + a = here(); + /* Dummy trap - removing this breaks the filesys emulation. */ + org (rtarea_base + 0xFF00); + calltrap (deftrap2 (nullfunc, TRAPFLAG_NO_RETVAL, _T(""))); - org(rtarea_base + 0xFF80); - calltrap(deftrapres(getchipmemsize, TRAPFLAG_DORET, _T("getchipmemsize"))); + org (rtarea_base + 0xFF80); + calltrap (deftrapres (getchipmemsize, TRAPFLAG_DORET, _T("getchipmemsize"))); dw(RTS); - org(rtarea_base + 0xFF10); - calltrap(deftrapres(uae_puts, TRAPFLAG_NO_RETVAL, _T("uae_puts"))); - dw(RTS); + org (rtarea_base + 0xFF10); + calltrap (deftrapres (uae_puts, TRAPFLAG_NO_RETVAL, _T("uae_puts"))); + dw (RTS); - org(a); - - uae_boot_rom_size = here() - rtarea_base; + org (a); + + uae_boot_rom_size = here () - rtarea_base; if (uae_boot_rom_size >= RTAREA_TRAPS) { - write_log(_T("RTAREA_TRAPS needs to be increased!")); - abort(); + write_log (_T("RTAREA_TRAPS needs to be increased!")); + target_startup_msg(_T("Internal error"), _T("RTAREA_TRAPS needs to be increased.")); + uae_restart(1, NULL); + return; } #ifdef PICASSO96 - uaegfx_install_code(rtarea_base + RTAREA_RTG); + uaegfx_install_code (rtarea_base + RTAREA_RTG); #endif - org(RTAREA_TRAPS | rtarea_base); - init_extended_traps(); + org (RTAREA_TRAPS | rtarea_base); + init_extended_traps(); } -volatile int uae_int_requested = 0; +volatile uae_atomic uae_int_requested = 0; void rtarea_setup(void) { - uaecptr base = need_uae_boot_rom(&currprefs); - if (base) { - write_log(_T("RTAREA located at %08X\n"), base); - rtarea_base = base; - } + uaecptr base = need_uae_boot_rom (&currprefs); + if (base) { + write_log (_T("RTAREA located at %08X\n"), base); + rtarea_base = base; + } } -uaecptr makedatatable(uaecptr resid, uaecptr resname, uae_u8 type, uae_s8 priority, uae_u16 ver, uae_u16 rev) +uaecptr makedatatable (uaecptr resid, uaecptr resname, uae_u8 type, uae_s8 priority, uae_u16 ver, uae_u16 rev) { - uaecptr datatable = here(); + uaecptr datatable = here (); - dw(0xE000); /* INITBYTE */ - dw(0x0008); /* LN_TYPE */ - dw(type << 8); - dw(0xE000); /* INITBYTE */ - dw(0x0009); /* LN_PRI */ - dw(priority << 8); - dw(0xC000); /* INITLONG */ - dw(0x000A); /* LN_NAME */ - dl(resname); - dw(0xE000); /* INITBYTE */ - dw(0x000E); /* LIB_FLAGS */ - dw(0x0600); /* LIBF_SUMUSED | LIBF_CHANGED */ - dw(0xD000); /* INITWORD */ - dw(0x0014); /* LIB_VERSION */ - dw(ver); - dw(0xD000); /* INITWORD */ - dw(0x0016); /* LIB_REVISION */ - dw(rev); - dw(0xC000); /* INITLONG */ - dw(0x0018); /* LIB_IDSTRING */ - dl(resid); - dw(0x0000); /* end of table */ - return datatable; + dw (0xE000); /* INITBYTE */ + dw (0x0008); /* LN_TYPE */ + dw (type << 8); + dw (0xE000); /* INITBYTE */ + dw (0x0009); /* LN_PRI */ + dw (priority << 8); + dw (0xC000); /* INITLONG */ + dw (0x000A); /* LN_NAME */ + dl (resname); + dw (0xE000); /* INITBYTE */ + dw (0x000E); /* LIB_FLAGS */ + dw (0x0600); /* LIBF_SUMUSED | LIBF_CHANGED */ + dw (0xD000); /* INITWORD */ + dw (0x0014); /* LIB_VERSION */ + dw (ver); + dw (0xD000); /* INITWORD */ + dw (0x0016); /* LIB_REVISION */ + dw (rev); + dw (0xC000); /* INITLONG */ + dw (0x0018); /* LIB_IDSTRING */ + dl (resid); + dw (0x0000); /* end of table */ + return datatable; } - diff --git a/src/blitfunc.cpp b/src/blitfunc.cpp index 468ffb61..4c3330fc 100644 --- a/src/blitfunc.cpp +++ b/src/blitfunc.cpp @@ -1,8 +1,10 @@ #include "sysconfig.h" #include "sysdeps.h" #include "options.h" -#include "custom.h" #include "include/memory.h" +#include "newcpu.h" +#include "custom.h" +#include "savestate.h" #include "blitter.h" #include "blitfunc.h" @@ -16,15 +18,17 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = (0) & 0xFFFF; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = (0); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } if (ptd) ptd += b->bltdmod; } - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; + if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_0 (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { @@ -35,21 +39,22 @@ uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = (0) & 0xFFFF; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = (0); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } if (ptd) ptd -= b->bltdmod; } - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; + if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_a (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; uae_u32 srcc = b->bltcdat; uae_u32 dstd=0; uaecptr dstp = 0; @@ -57,13 +62,14 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = ((uae_u32(preva) << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((~srca & srcc)) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((~srca & srcc)); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -72,27 +78,28 @@ for (j = 0; j < b->vblitsize; j++) { if (ptd) ptd += b->bltdmod; } b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_a (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; uae_u32 srcc = b->bltcdat; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = ((uae_u32(bltadat) << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((~srca & srcc)) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((~srca & srcc)); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -101,15 +108,15 @@ for (j = 0; j < b->vblitsize; j++) { if (ptd) ptd -= b->bltdmod; } b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_2a (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; uae_u32 dstd=0; uaecptr dstp = 0; @@ -117,18 +124,19 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = ((uae_u32(prevb) << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = ((uae_u32(preva) << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc & ~(srca & srcb))) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc & ~(srca & srcb))); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -139,33 +147,34 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_2a (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = ((uae_u32(bltadat) << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc & ~(srca & srcb))) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc & ~(srca & srcb))); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -176,15 +185,15 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_30 (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { @@ -192,16 +201,17 @@ for (j = 0; j < b->vblitsize; j++) { uae_u32 bltadat, srca; if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = ((uae_u32(prevb) << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = ((uae_u32(preva) << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srca & ~srcb)) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srca & ~srcb)); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -210,31 +220,32 @@ for (j = 0; j < b->vblitsize; j++) { if (ptd) ptd += b->bltdmod; } b->bltbhold = srcb; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_30 (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; -uae_u32 dstd = 0; +uae_u32 srcb = b->bltbhold; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = ((uae_u32(bltadat) << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srca & ~srcb)) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srca & ~srcb)); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -243,15 +254,15 @@ for (j = 0; j < b->vblitsize; j++) { if (ptd) ptd -= b->bltdmod; } b->bltbhold = srcb; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_3a (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; uae_u32 dstd=0; uaecptr dstp = 0; @@ -259,18 +270,19 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = ((uae_u32(prevb) << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = ((uae_u32(preva) << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcb ^ (srca | (srcb ^ srcc)))) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcb ^ (srca | (srcb ^ srcc)))); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -281,33 +293,34 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_3a (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcb ^ (srca | (srcb ^ srcc)))) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcb ^ (srca | (srcb ^ srcc)))); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -318,15 +331,15 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_3c (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { @@ -334,16 +347,17 @@ for (j = 0; j < b->vblitsize; j++) { uae_u32 bltadat, srca; if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = (((uae_u32)prevb << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)preva << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srca ^ srcb)) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srca ^ srcb)); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -352,31 +366,32 @@ for (j = 0; j < b->vblitsize; j++) { if (ptd) ptd += b->bltdmod; } b->bltbhold = srcb; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_3c (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; -uae_u32 dstd = 0; +uae_u32 srcb = b->bltbhold; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srca ^ srcb)) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srca ^ srcb)); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -385,15 +400,15 @@ for (j = 0; j < b->vblitsize; j++) { if (ptd) ptd -= b->bltdmod; } b->bltbhold = srcb; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_4a (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; uae_u32 dstd=0; uaecptr dstp = 0; @@ -401,18 +416,19 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = (((uae_u32)prevb << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)preva << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc ^ (srca & (srcb | srcc)))) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc ^ (srca & (srcb | srcc)))); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -423,33 +439,34 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_4a (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc ^ (srca & (srcb | srcc)))) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc ^ (srca & (srcb | srcc)))); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -460,15 +477,15 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_6a (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; uae_u32 dstd=0; uaecptr dstp = 0; @@ -476,18 +493,19 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = (((uae_u32)prevb << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)preva << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc ^ (srca & srcb))) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc ^ (srca & srcb))); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -498,33 +516,34 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_6a (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc ^ (srca & srcb))) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc ^ (srca & srcb))); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -535,15 +554,15 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_8a (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; uae_u32 dstd=0; uaecptr dstp = 0; @@ -551,18 +570,19 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = (((uae_u32)prevb << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)preva << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc & (~srca | srcb))) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc & (~srca | srcb))); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -573,33 +593,34 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_8a (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc & (~srca | srcb))) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc & (~srca | srcb))); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -610,15 +631,15 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_8c (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; uae_u32 dstd=0; uaecptr dstp = 0; @@ -626,18 +647,19 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = (((uae_u32)prevb << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)preva << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcb & (~srca | srcc))) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcb & (~srca | srcc))); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -648,33 +670,34 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_8c (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcb & (~srca | srcc))) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcb & (~srca | srcc))); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -685,15 +708,15 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_9a (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; uae_u32 dstd=0; uaecptr dstp = 0; @@ -701,18 +724,19 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = (((uae_u32)prevb << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)preva << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc ^ (srca & ~srcb))) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc ^ (srca & ~srcb))); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -723,33 +747,34 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_9a (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc ^ (srca & ~srcb))) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc ^ (srca & ~srcb))); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -760,15 +785,15 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_a8 (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; uae_u32 dstd=0; uaecptr dstp = 0; @@ -776,18 +801,19 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = (((uae_u32)prevb << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)preva << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc & (srca | srcb))) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc & (srca | srcb))); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -798,33 +824,34 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_a8 (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc & (srca | srcb))) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc & (srca | srcb))); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -835,8 +862,9 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_aa (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { @@ -849,9 +877,10 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; } - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = (srcc) & 0xFFFF; + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; } + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = (srcc); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -859,22 +888,24 @@ for (j = 0; j < b->vblitsize; j++) { if (ptd) ptd += b->bltdmod; } b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_aa (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; uae_u32 srcc = b->bltcdat; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; } - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = (srcc) & 0xFFFF; + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; } + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = (srcc); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -882,15 +913,15 @@ for (j = 0; j < b->vblitsize; j++) { if (ptd) ptd -= b->bltdmod; } b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_b1 (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; uae_u32 dstd=0; uaecptr dstp = 0; @@ -898,18 +929,19 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = (((uae_u32)prevb << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)preva << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = (~(srca ^ (srcc | (srca ^ srcb)))) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = (~(srca ^ (srcc | (srca ^ srcb)))); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -920,33 +952,34 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_b1 (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = (~(srca ^ (srcc | (srca ^ srcb)))) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = (~(srca ^ (srcc | (srca ^ srcb)))); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -957,15 +990,15 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_ca (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; uae_u32 dstd=0; uaecptr dstp = 0; @@ -973,18 +1006,19 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = (((uae_u32)prevb << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)preva << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc ^ (srca & (srcb ^ srcc)))) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc ^ (srca & (srcb ^ srcc)))); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -995,33 +1029,34 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_ca (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc ^ (srca & (srcb ^ srcc)))) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc ^ (srca & (srcb ^ srcc)))); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -1032,14 +1067,15 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_cc (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { @@ -1047,12 +1083,13 @@ for (j = 0; j < b->vblitsize; j++) { uae_u32 bltadat, srca; if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = (((uae_u32)prevb << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = (srcb) & 0xFFFF; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = (srcb); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -1060,26 +1097,28 @@ for (j = 0; j < b->vblitsize; j++) { if (ptd) ptd += b->bltdmod; } b->bltbhold = srcb; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_cc (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 prevb = 0, srcb = b->bltbhold; -uae_u32 dstd = 0; +uae_u32 srcb = b->bltbhold; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = (srcb) & 0xFFFF; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = (srcb); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -1087,15 +1126,15 @@ for (j = 0; j < b->vblitsize; j++) { if (ptd) ptd -= b->bltdmod; } b->bltbhold = srcb; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_d8 (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; uae_u32 dstd=0; uaecptr dstp = 0; @@ -1103,18 +1142,19 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = (((uae_u32)prevb << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)preva << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srca ^ (srcc & (srca ^ srcb)))) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srca ^ (srcc & (srca ^ srcb)))); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -1125,33 +1165,34 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_d8 (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srca ^ (srcc & (srca ^ srcb)))) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srca ^ (srcc & (srca ^ srcb)))); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -1162,15 +1203,15 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_e2 (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; uae_u32 dstd=0; uaecptr dstp = 0; @@ -1178,18 +1219,19 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = (((uae_u32)prevb << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)preva << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc ^ (srcb & (srca ^ srcc)))) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc ^ (srcb & (srca ^ srcc)))); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -1200,33 +1242,34 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_e2 (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc ^ (srcb & (srca ^ srcc)))) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc ^ (srcb & (srca ^ srcc)))); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -1237,15 +1280,15 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_ea (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; uae_u32 dstd=0; uaecptr dstp = 0; @@ -1253,18 +1296,19 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = (((uae_u32)prevb << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)preva << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc | (srca & srcb))) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc | (srca & srcb))); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -1275,33 +1319,34 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_ea (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 srcc = b->bltcdat; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; } if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srcc | (srca & srcb))) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srcc | (srca & srcb))); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -1312,65 +1357,67 @@ for (j = 0; j < b->vblitsize; j++) { } b->bltbhold = srcb; b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_f0 (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)preva << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = (srca) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = (srca); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } if (pta) pta += b->bltamod; if (ptd) ptd += b->bltdmod; } - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_f0 (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = (srca) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = (srca); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } if (pta) pta -= b->bltamod; if (ptd) ptd -= b->bltdmod; } - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_fa (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; uae_u32 srcc = b->bltcdat; uae_u32 dstd=0; uaecptr dstp = 0; @@ -1378,13 +1425,14 @@ for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)preva << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srca | srcc)) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srca | srcc)); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -1393,27 +1441,28 @@ for (j = 0; j < b->vblitsize; j++) { if (ptd) ptd += b->bltdmod; } b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_fa (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; uae_u32 srcc = b->bltcdat; -uae_u32 dstd = 0; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; - if (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srca | srcc)) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srca | srcc)); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -1422,15 +1471,15 @@ for (j = 0; j < b->vblitsize; j++) { if (ptd) ptd -= b->bltdmod; } b->bltcdat = srcc; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_fc (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { int i,j; uae_u32 totald = 0; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; +uae_u32 srcb = b->bltbhold; uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { @@ -1438,16 +1487,17 @@ for (j = 0; j < b->vblitsize; j++) { uae_u32 bltadat, srca; if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2; - srcb = (((uae_u32)prevb << 16) | bltbdat) >> b->blitbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2; + srcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)preva << 16) | bltadat) >> b->blitashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srca | srcb)) & 0xFFFF; + srca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srca | srcb)); totald |= dstd; if (ptd) { dstp = ptd; ptd += 2; } } @@ -1456,31 +1506,32 @@ for (j = 0; j < b->vblitsize; j++) { if (ptd) ptd += b->bltdmod; } b->bltbhold = srcb; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } void blitdofast_desc_fc (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b) { uae_u32 totald = 0; int i,j; -uae_u32 preva = 0; -uae_u32 prevb = 0, srcb = b->bltbhold; -uae_u32 dstd = 0; +uae_u32 srcb = b->bltbhold; +uae_u32 dstd=0; uaecptr dstp = 0; for (j = 0; j < b->vblitsize; j++) { for (i = 0; i < b->hblitsize; i++) { uae_u32 bltadat, srca; if (ptb) { - uae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2; - srcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift; - prevb = bltbdat; + uae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2; + srcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift; + b->bltbold = bltbdat; } - if (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; } + if (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; } bltadat &= blit_masktable[i]; - srca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift; - preva = bltadat; - if (dstp) chipmem_wput_indirect (dstp, dstd); - dstd = ((srca | srcb)) & 0xFFFF; + srca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift; + b->bltaold = bltadat; + if (dstp) + chipmem_wput_indirect (dstp, dstd); + dstd = ((srca | srcb)); totald |= dstd; if (ptd) { dstp = ptd; ptd -= 2; } } @@ -1489,6 +1540,7 @@ for (j = 0; j < b->vblitsize; j++) { if (ptd) ptd -= b->bltdmod; } b->bltbhold = srcb; - if (dstp) chipmem_wput_indirect (dstp, dstd); -if (totald != 0) b->blitzero = 0; +if (dstp) + chipmem_wput_indirect (dstp, dstd); +if ((totald<<16) != 0) b->blitzero = 0; } diff --git a/src/blittable.cpp b/src/blittable.cpp index 32ad76bc..1c47b0ba 100644 --- a/src/blittable.cpp +++ b/src/blittable.cpp @@ -1,8 +1,10 @@ #include "sysconfig.h" #include "sysdeps.h" #include "options.h" -#include "custom.h" #include "include/memory.h" +#include "newcpu.h" +#include "custom.h" +#include "savestate.h" #include "blitter.h" #include "blitfunc.h" diff --git a/src/blitter.cpp b/src/blitter.cpp index 8cdaadfa..31e8942e 100644 --- a/src/blitter.cpp +++ b/src/blitter.cpp @@ -7,94 +7,51 @@ * (c) 2002 - 2005 Toni Wilen */ -#define SPEEDUP 1 - #include "sysconfig.h" #include "sysdeps.h" #include "options.h" #include "uae.h" -#include "include/memory.h" -#include "newcpu.h" +#include "memory.h" #include "custom.h" -#include "events.h" +#include "newcpu.h" #include "savestate.h" #include "blitter.h" #include "blit.h" - // 1 = logging - // 2 = no wait detection - // 4 = no D - // 8 = instant - // 16 = activate debugger if weird things - // 32 = logging (no line) - -#if BLITTER_DEBUG -int log_blitter = 1 | 16; -#else -int log_blitter = 0; -#endif - -/* we must not change ce-mode while blitter is running.. */ -static int blitter_cycle_exact, immediate_blits; -static int blt_statefile_type; +static int immediate_blits; uae_u16 bltcon0, bltcon1; uae_u32 bltapt, bltbpt, bltcpt, bltdpt; -uae_u32 bltptx; -int bltptxpos, bltptxc; -int blitter_nasty; -// blitter is active and D may write to visible bitplane addresses -int blitter_dangerous_bpl; -static int original_ch, original_fill, original_line; +static int original_ch; static int blinea_shift; static uae_u16 blinea, blineb; static int blitline, blitfc, blitfill, blitife, blitsing, blitdesc; static int blitline_started; -static int blitonedot, blitsign, blitlinepixel; -static int blit_add; -static int blit_modadda, blit_modaddb, blit_modaddc, blit_modaddd; +static int blitonedot, blitsign; static int blit_ch; -static int blitter_dontdo; -static int blitter_delayed_debug; -#ifdef BLITTER_SLOWDOWNDEBUG -static int blitter_slowdowndebug; -#endif - struct bltinfo blt_info; static uae_u8 blit_filltable[256][4][2]; uae_u32 blit_masktable[BLITTER_MAX_WORDS]; enum blitter_states bltstate; -static int blit_cyclecounter, blit_waitcyclecounter; -static int blit_maxcyclecounter, blit_slowdown, blit_totalcyclecounter; -static int blit_startcycles, blit_misscyclecounter; - -#ifdef CPUEMU_13 -extern uae_u8 cycle_line[256]; -#endif +static int blit_cyclecounter; +static int blit_slowdown; static long blit_firstline_cycles; static long blit_first_cycle; static int blit_last_cycle, blit_dmacount, blit_dmacount2; -static int blit_linecycles, blit_extracycles, blit_nod; +static int blit_nod; static const int *blit_diag; -static int blit_frozen, blit_faulty; -static int blit_final; -static int blt_delayed_irq; -static uae_u16 ddat1, ddat2; -static int ddat1use, ddat2use; +static int blit_faulty; +static int ddat1use; int blit_interrupt; -static int last_blitter_hpos; - -#define BLITTER_STARTUP_CYCLES 2 - /* Blitter Idle Cycle: @@ -200,7 +157,7 @@ static const int blit_cycle_diagram_finalld[] = 2, 0,0, 0,0 }; -static int get_cycle_diagram_type(const int *diag) +static int get_cycle_diagram_type (const int *diag) { for (int i = 0; i < 16; i++) { if (diag == &blit_cycle_diagram[i][0]) @@ -216,8 +173,7 @@ static int get_cycle_diagram_type(const int *diag) return 0x82; return 0xff; } - -static const int *set_cycle_diagram_type(uae_u8 diag) +static const int *set_cycle_diagram_type (uae_u8 diag) { if (diag >= 0x00 && diag <= 0x0f) return &blit_cycle_diagram[diag][0]; @@ -229,10 +185,10 @@ static const int *set_cycle_diagram_type(uae_u8 diag) return blit_cycle_diagram_finald; if (diag == 0x82) return blit_cycle_diagram_finalld; - return nullptr; + return NULL; } -void build_blitfilltable(void) +void build_blitfilltable (void) { unsigned int d, fillmask; int i; @@ -260,147 +216,13 @@ void build_blitfilltable(void) } } -STATIC_INLINE void record_dma_blit(uae_u16 reg, uae_u16 dat, uae_u32 addr, int hpos) +STATIC_INLINE int channel_state (int cycles) { -#ifdef DEBUGGER - int type; - - if (blitline) - type = DMARECORD_BLITTER_LINE; - else if (blitfill) - type = DMARECORD_BLITTER_FILL; - else - type = DMARECORD_BLITTER; - if (debug_dma) - record_dma(reg, dat, addr, hpos, vpos, type); - if (memwatch_enabled) { - if (reg == 0) { - uae_u32 mask = MW_MASK_BLITTER_D_N; - if (blitfill) - mask = MW_MASK_BLITTER_D_F; - if (blitline) - mask = MW_MASK_BLITTER_D_L; - debug_wputpeekdma_chipram(addr, dat, mask, reg); - } - else if (reg == 0x70) { - debug_wgetpeekdma_chipram(addr, dat, MW_MASK_BLITTER_C, reg); - } - else if (reg == 0x72) { - debug_wgetpeekdma_chipram(addr, dat, MW_MASK_BLITTER_B, reg); - } - else if (reg == 0x74) { - debug_wgetpeekdma_chipram(addr, dat, MW_MASK_BLITTER_A, reg); - } - } -#endif -} - -//static void blitter_dump(void) -//{ -// int chipsize = currprefs.chipmem_size; -// write_log(_T("PT A=%08X B=%08X C=%08X D=%08X\n"), bltapt, bltbpt, bltcpt, bltdpt); -// write_log(_T("CON0=%04X CON1=%04X DAT A=%04X B=%04X C=%04X\n"), -// bltcon0, bltcon1, blt_info.bltadat, blt_info.bltbdat, blt_info.bltcdat); -// write_log(_T("AFWM=%04X ALWM=%04X MOD A=%04X B=%04X C=%04X D=%04X\n"), -// blt_info.bltafwm, blt_info.bltalwm, -// blt_info.bltamod & 0xffff, blt_info.bltbmod & 0xffff, blt_info.bltcmod & 0xffff, blt_info.bltdmod & 0xffff); -// write_log(_T("PC=%08X DMA=%d\n"), m68k_getpc(), dmaen(DMA_BLITTER)); -// -// if (((bltcon0 & 0x800) && bltapt >= chipsize) || ((bltcon0 & 0x400) && bltbpt >= chipsize) || -// ((bltcon0 & 0x200) && bltcpt >= chipsize) || ((bltcon0 & 0x100) && bltdpt >= chipsize)) -// write_log(_T("PT outside of chipram\n")); -//} - -STATIC_INLINE const int *get_ch(void) -{ - if (blit_faulty) - return &blit_diag[0]; - if (blit_final) - return blitline || blit_nod ? blit_cycle_diagram_finalld : blit_cycle_diagram_finald; - return blit_diag; -} - -STATIC_INLINE int channel_state(int cycles) -{ - const int *diag; - if (cycles < 0) - return 0; - diag = get_ch(); - if (cycles < diag[0]) - return diag[1 + cycles]; - cycles -= diag[0]; - cycles %= diag[0]; - return diag[1 + diag[0] + cycles]; -} -STATIC_INLINE int channel_pos(int cycles) -{ - const int *diag; - if (cycles < 0) - return 0; - diag = get_ch(); - if (cycles < diag[0]) - return cycles; - cycles -= diag[0]; - cycles %= diag[0]; - return cycles; -} - -int blitter_channel_state(void) -{ - return channel_state(blit_cyclecounter); -} - -STATIC_INLINE int canblit(int hpos) -{ - if (!dmaen(DMA_BLITTER)) - return -1; - if (is_bitplane_dma(hpos)) - return 0; -#ifdef CPUEMU_13 - if (cycle_line[hpos] & CYCLE_MASK) { - return 0; - } -#endif - return 1; -} - -static void markidlecycle(int hpos) -{ - //if (debug_dma) - // record_dma_event(DMA_EVENT_BLITSTARTFINISH, hpos, vpos); -} - -static void reset_channel_mods(void) -{ - if (bltptxpos < 0) - return; - bltptxpos = -1; - switch (bltptxc) - { - case 1: - bltapt = bltptx; - break; - case 2: - bltbpt = bltptx; - break; - case 3: - bltcpt = bltptx; - break; - case 4: - bltdpt = bltptx; - break; - } -} - -static void check_channel_mods(int hpos, int ch) -{ - if (bltptxpos != hpos) - return; - if (ch == bltptxc) { - bltptxpos = -1; - //write_log(_T("BLITTER: %08X write to %cPT ignored! %08x\n"), bltptx, ch + 'A' - 1, m68k_getpc()); - //activate_debugger(); - } + if (cycles < blit_diag[0]) + return blit_diag[1 + cycles]; + cycles -= blit_diag[0]; + cycles %= blit_diag[0]; + return blit_diag[1 + blit_diag[0] + cycles]; } // blitter interrupt is set (and busy bit cleared) when @@ -412,255 +234,221 @@ static void check_channel_mods(int hpos, int ch) // (or cycle where last D write would have been if // ONEDOT was active) -static void blitter_interrupt(int hpos, int done) +static void blitter_interrupt (void) { if (blit_interrupt) return; - if (!done && (!blitter_cycle_exact || immediate_blits || currprefs.cpu_model >= 68030 || currprefs.cachesize || currprefs.m68k_speed < 0)) - return; blit_interrupt = 1; - send_interrupt(6, 4 * CYCLE_UNIT); - //if (debug_dma) - // record_dma_event(DMA_EVENT_BLITIRQ, hpos, vpos); + send_interrupt (6); } -static void blitter_done(int hpos) +static void blitter_done (void) { - ddat1use = ddat2use = 0; - bltstate = blit_startcycles == 0 || !blitter_cycle_exact || immediate_blits ? BLT_done : BLT_init; - blitter_interrupt(hpos, 1); - blitter_done_notify(hpos); - markidlecycle(hpos); - event2_remevent(ev2_blitter); - unset_special(SPCFLAG_BLTNASTY); - if (log_blitter & 1) - write_log(_T("cycles %d, missed %d, total %d\n"), - blit_totalcyclecounter, blit_misscyclecounter, blit_totalcyclecounter + blit_misscyclecounter); - blitter_dangerous_bpl = 0; + ddat1use = 0; + bltstate = BLT_done; + blitter_interrupt (); + blitter_done_notify (); + event_remevent(ev_blitter); + unset_special (SPCFLAG_BLTNASTY); } -STATIC_INLINE void chipmem_agnus_wput2(uaecptr addr, uae_u32 w) +STATIC_INLINE void chipmem_agnus_wput2 (uaecptr addr, uae_u32 w) { - //last_custom_value1 = w; blitter writes are not stored - if (!(log_blitter & 4)) { - chipmem_wput_indirect(addr, w); - //debug_wputpeekdma_chipram(addr, w, MW_MASK_BLITTER_D_N, 0x000); - } + chipmem_wput_indirect (addr, w); } static void blitter_dofast(void) { - int i, j; - uaecptr bltadatptr = 0, bltbdatptr = 0, bltcdatptr = 0, bltddatptr = 0; - uae_u8 mt = bltcon0 & 0xFF; + int i,j; + uaecptr bltadatptr = 0, bltbdatptr = 0, bltcdatptr = 0, bltddatptr = 0; + uae_u8 mt = bltcon0 & 0xFF; blit_masktable[0] = blt_info.bltafwm; blit_masktable[blt_info.hblitsize - 1] &= blt_info.bltalwm; - if (bltcon0 & 0x800) { - bltadatptr = bltapt; - bltapt += (blt_info.hblitsize * 2 + blt_info.bltamod) * blt_info.vblitsize; - } - if (bltcon0 & 0x400) { - bltbdatptr = bltbpt; - bltbpt += (blt_info.hblitsize * 2 + blt_info.bltbmod) * blt_info.vblitsize; - } - if (bltcon0 & 0x200) { - bltcdatptr = bltcpt; - bltcpt += (blt_info.hblitsize * 2 + blt_info.bltcmod) * blt_info.vblitsize; - } - if (bltcon0 & 0x100) { - bltddatptr = bltdpt; - bltdpt += (blt_info.hblitsize * 2 + blt_info.bltdmod) * blt_info.vblitsize; - } + if (bltcon0 & 0x800) { + bltadatptr = (uaecptr)&chipmem_bank.baseaddr[bltapt & chipmem_full_mask]; + bltapt += (blt_info.hblitsize * 2 + blt_info.bltamod) * blt_info.vblitsize; + } + if (bltcon0 & 0x400) { + bltbdatptr = (uaecptr)&chipmem_bank.baseaddr[bltbpt & chipmem_full_mask]; + bltbpt += (blt_info.hblitsize * 2 + blt_info.bltbmod) * blt_info.vblitsize; + } + if (bltcon0 & 0x200) { + bltcdatptr = (uaecptr)&chipmem_bank.baseaddr[bltcpt & chipmem_full_mask]; + bltcpt += (blt_info.hblitsize * 2 + blt_info.bltcmod) * blt_info.vblitsize; + } + if (bltcon0 & 0x100) { + bltddatptr = bltdpt; + bltdpt += (blt_info.hblitsize * 2 + blt_info.bltdmod) * blt_info.vblitsize; + } -#if SPEEDUP - if (blitfunc_dofast[mt] && !blitfill) { - (*blitfunc_dofast[mt])(bltadatptr, bltbdatptr, bltcdatptr, bltddatptr, &blt_info); - } - else -#endif - { - uae_u32 blitbhold = blt_info.bltbhold; - uae_u32 preva = 0, prevb = 0; - uaecptr dstp = 0; - int dodst = 0; + if (blitfunc_dofast[mt] && !blitfill) { + (*blitfunc_dofast[mt])(bltadatptr, bltbdatptr, bltcdatptr, bltddatptr, &blt_info); + } else { + uae_u32 blitbhold = blt_info.bltbhold; + uaecptr dstp = 0; for (j = 0; j < blt_info.vblitsize; j++) { - blitfc = !!(bltcon1 & 0x4); + blitfc = !!(bltcon1 & 0x4); for (i = 0; i < blt_info.hblitsize; i++) { - uae_u32 bltadat, blitahold; - uae_u16 bltbdat; - if (bltadatptr) { - blt_info.bltadat = bltadat = chipmem_wget_indirect(bltadatptr); - bltadatptr += 2; - } - else - bltadat = blt_info.bltadat; - bltadat &= blit_masktable[i]; - blitahold = ((uae_u32(preva) << 16) | bltadat) >> blt_info.blitashift; - preva = bltadat; + uae_u32 bltadat, blitahold; + if (bltadatptr) { + blt_info.bltadat = bltadat = do_get_mem_word ((uae_u16 *)bltadatptr); + bltadatptr += 2; + } else + bltadat = blt_info.bltadat; + bltadat &= blit_masktable[i]; + blitahold = (((uae_u32)blt_info.bltaold << 16) | bltadat) >> blt_info.blitashift; + blt_info.bltaold = bltadat; - if (bltbdatptr) { - blt_info.bltbdat = bltbdat = chipmem_wget_indirect(bltbdatptr); - bltbdatptr += 2; - blitbhold = ((uae_u32(prevb) << 16) | bltbdat) >> blt_info.blitbshift; - prevb = bltbdat; - } + if (bltbdatptr) { + uae_u16 bltbdat = do_get_mem_word ((uae_u16 *)bltbdatptr);; + bltbdatptr += 2; + blitbhold = (((uae_u32)blt_info.bltbold << 16) | bltbdat) >> blt_info.blitbshift; + blt_info.bltbold = bltbdat; + blt_info.bltbdat = bltbdat; + } - if (bltcdatptr) { - blt_info.bltcdat = chipmem_wget_indirect(bltcdatptr); - bltcdatptr += 2; - } - if (dodst) - chipmem_agnus_wput2(dstp, blt_info.bltddat); - blt_info.bltddat = blit_func(blitahold, blitbhold, blt_info.bltcdat, mt) & 0xFFFF; - if (blitfill) { - uae_u16 d = blt_info.bltddat; - int ifemode = blitife ? 2 : 0; - int fc1 = blit_filltable[d & 255][ifemode + blitfc][1]; - blt_info.bltddat = (blit_filltable[d & 255][ifemode + blitfc][0] - + (blit_filltable[d >> 8][ifemode + fc1][0] << 8)); - blitfc = blit_filltable[d >> 8][ifemode + fc1][1]; - } - if (blt_info.bltddat) - blt_info.blitzero = 0; - if (bltddatptr) { - dodst = 1; - dstp = bltddatptr; - bltddatptr += 2; - } - } - if (bltadatptr) - bltadatptr += blt_info.bltamod; - if (bltbdatptr) - bltbdatptr += blt_info.bltbmod; - if (bltcdatptr) - bltcdatptr += blt_info.bltcmod; - if (bltddatptr) - bltddatptr += blt_info.bltdmod; - } - if (dodst) - chipmem_agnus_wput2(dstp, blt_info.bltddat); - blt_info.bltbhold = blitbhold; - } + if (bltcdatptr) { + blt_info.bltcdat = do_get_mem_word ((uae_u16 *)bltcdatptr); + bltcdatptr += 2; + } + if (dstp) + chipmem_agnus_wput2 (dstp, blt_info.bltddat); + blt_info.bltddat = blit_func (blitahold, blitbhold, blt_info.bltcdat, mt); + if (blitfill) { + uae_u16 d = blt_info.bltddat; + int ifemode = blitife ? 2 : 0; + int fc1 = blit_filltable[d & 255][ifemode + blitfc][1]; + blt_info.bltddat = (blit_filltable[d & 255][ifemode + blitfc][0] + + (blit_filltable[d >> 8][ifemode + fc1][0] << 8)); + blitfc = blit_filltable[d >> 8][ifemode + fc1][1]; + } + if (blt_info.bltddat) + blt_info.blitzero = 0; + if (bltddatptr) { + dstp = bltddatptr; + bltddatptr += 2; + } + } + if (bltadatptr) + bltadatptr += blt_info.bltamod; + if (bltbdatptr) + bltbdatptr += blt_info.bltbmod; + if (bltcdatptr) + bltcdatptr += blt_info.bltcmod; + if (bltddatptr) + bltddatptr += blt_info.bltdmod; + } + if (dstp) + chipmem_agnus_wput2 (dstp, blt_info.bltddat); + blt_info.bltbhold = blitbhold; + } blit_masktable[0] = 0xFFFF; blit_masktable[blt_info.hblitsize - 1] = 0xFFFF; - bltstate = BLT_done; + bltstate = BLT_done; } static void blitter_dofast_desc(void) { - int i, j; - uaecptr bltadatptr = 0, bltbdatptr = 0, bltcdatptr = 0, bltddatptr = 0; - uae_u8 mt = bltcon0 & 0xFF; + int i,j; + uaecptr bltadatptr = 0, bltbdatptr = 0, bltcdatptr = 0, bltddatptr = 0; + uae_u8 mt = bltcon0 & 0xFF; blit_masktable[0] = blt_info.bltafwm; blit_masktable[blt_info.hblitsize - 1] &= blt_info.bltalwm; - if (bltcon0 & 0x800) { - bltadatptr = bltapt; - bltapt -= (blt_info.hblitsize * 2 + blt_info.bltamod) * blt_info.vblitsize; - } - if (bltcon0 & 0x400) { - bltbdatptr = bltbpt; - bltbpt -= (blt_info.hblitsize * 2 + blt_info.bltbmod) * blt_info.vblitsize; - } - if (bltcon0 & 0x200) { - bltcdatptr = bltcpt; - bltcpt -= (blt_info.hblitsize * 2 + blt_info.bltcmod) * blt_info.vblitsize; - } - if (bltcon0 & 0x100) { - bltddatptr = bltdpt; - bltdpt -= (blt_info.hblitsize * 2 + blt_info.bltdmod) * blt_info.vblitsize; - } -#if SPEEDUP - if (blitfunc_dofast_desc[mt] && !blitfill) { + if (bltcon0 & 0x800) { + bltadatptr = (uaecptr)&chipmem_bank.baseaddr[bltapt & chipmem_full_mask]; + bltapt -= (blt_info.hblitsize * 2 + blt_info.bltamod) * blt_info.vblitsize; + } + if (bltcon0 & 0x400) { + bltbdatptr = (uaecptr)&chipmem_bank.baseaddr[bltbpt & chipmem_full_mask]; + bltbpt -= (blt_info.hblitsize * 2 + blt_info.bltbmod) * blt_info.vblitsize; + } + if (bltcon0 & 0x200) { + bltcdatptr = (uaecptr)&chipmem_bank.baseaddr[bltcpt & chipmem_full_mask]; + bltcpt -= (blt_info.hblitsize * 2 + blt_info.bltcmod) * blt_info.vblitsize; + } + if (bltcon0 & 0x100) { + bltddatptr = bltdpt; + bltdpt -= (blt_info.hblitsize * 2 + blt_info.bltdmod) * blt_info.vblitsize; + } + if (blitfunc_dofast_desc[mt] && !blitfill) { (*blitfunc_dofast_desc[mt])(bltadatptr, bltbdatptr, bltcdatptr, bltddatptr, &blt_info); - } - else -#endif - { - uae_u32 blitbhold = blt_info.bltbhold; - uae_u32 preva = 0, prevb = 0; - uaecptr dstp = 0; - int dodst = 0; + } else { + uae_u32 blitbhold = blt_info.bltbhold; + uaecptr dstp = 0; for (j = 0; j < blt_info.vblitsize; j++) { blitfc = !!(bltcon1 & 0x4); for (i = 0; i < blt_info.hblitsize; i++) { uae_u32 bltadat, blitahold; - uae_u16 bltbdat; if (bltadatptr) { - bltadat = blt_info.bltadat = chipmem_wget_indirect(bltadatptr); + bltadat = blt_info.bltadat = do_get_mem_word ((uae_u16 *)bltadatptr); bltadatptr -= 2; - } - else + } else bltadat = blt_info.bltadat; bltadat &= blit_masktable[i]; - blitahold = ((uae_u32(bltadat) << 16) | preva) >> blt_info.blitdownashift; - preva = bltadat; + blitahold = (((uae_u32)bltadat << 16) | blt_info.bltaold) >> blt_info.blitdownashift; + blt_info.bltaold = bltadat; if (bltbdatptr) { - blt_info.bltbdat = bltbdat = chipmem_wget_indirect(bltbdatptr); - bltbdatptr -= 2; - blitbhold = ((uae_u32(bltbdat) << 16) | prevb) >> blt_info.blitdownbshift; - prevb = bltbdat; - } + uae_u16 bltbdat = do_get_mem_word ((uae_u16 *)bltbdatptr); + bltbdatptr -= 2; + blitbhold = (((uae_u32)bltbdat << 16) | blt_info.bltbold) >> blt_info.blitdownbshift; + blt_info.bltbold = bltbdat; + blt_info.bltbdat = bltbdat; + } - if (bltcdatptr) { - blt_info.bltcdat = blt_info.bltbdat = chipmem_wget_indirect(bltcdatptr); - bltcdatptr -= 2; - } - if (dodst) - chipmem_agnus_wput2(dstp, blt_info.bltddat); - blt_info.bltddat = blit_func(blitahold, blitbhold, blt_info.bltcdat, mt) & 0xFFFF; - if (blitfill) { - uae_u16 d = blt_info.bltddat; - int ifemode = blitife ? 2 : 0; - int fc1 = blit_filltable[d & 255][ifemode + blitfc][1]; - blt_info.bltddat = (blit_filltable[d & 255][ifemode + blitfc][0] - + (blit_filltable[d >> 8][ifemode + fc1][0] << 8)); - blitfc = blit_filltable[d >> 8][ifemode + fc1][1]; - } - if (blt_info.bltddat) - blt_info.blitzero = 0; - if (bltddatptr) { - dstp = bltddatptr; - dodst = 1; - bltddatptr -= 2; - } - } - if (bltadatptr) - bltadatptr -= blt_info.bltamod; - if (bltbdatptr) - bltbdatptr -= blt_info.bltbmod; - if (bltcdatptr) - bltcdatptr -= blt_info.bltcmod; - if (bltddatptr) - bltddatptr -= blt_info.bltdmod; - } - if (dodst) - chipmem_agnus_wput2(dstp, blt_info.bltddat); + if (bltcdatptr) { + blt_info.bltcdat = blt_info.bltbdat = do_get_mem_word ((uae_u16 *)bltcdatptr); + bltcdatptr -= 2; + } + if (dstp) + chipmem_agnus_wput2 (dstp, blt_info.bltddat); + blt_info.bltddat = blit_func (blitahold, blitbhold, blt_info.bltcdat, mt); + if (blitfill) { + uae_u16 d = blt_info.bltddat; + int ifemode = blitife ? 2 : 0; + int fc1 = blit_filltable[d & 255][ifemode + blitfc][1]; + blt_info.bltddat = (blit_filltable[d & 255][ifemode + blitfc][0] + + (blit_filltable[d >> 8][ifemode + fc1][0] << 8)); + blitfc = blit_filltable[d >> 8][ifemode + fc1][1]; + } + if (blt_info.bltddat) + blt_info.blitzero = 0; + if (bltddatptr) { + dstp = bltddatptr; + bltddatptr -= 2; + } + } + if (bltadatptr) + bltadatptr -= blt_info.bltamod; + if (bltbdatptr) + bltbdatptr -= blt_info.bltbmod; + if (bltcdatptr) + bltcdatptr -= blt_info.bltcmod; + if (bltddatptr) + bltddatptr -= blt_info.bltdmod; + } + if (dstp) + chipmem_agnus_wput2 (dstp, blt_info.bltddat); blt_info.bltbhold = blitbhold; } blit_masktable[0] = 0xFFFF; blit_masktable[blt_info.hblitsize - 1] = 0xFFFF; - bltstate = BLT_done; + bltstate = BLT_done; } STATIC_INLINE void blitter_read(void) { if (bltcon0 & 0x200) { - if (!dmaen(DMA_BLITTER)) - return; - blt_info.bltcdat = chipmem_wget_indirect(bltcpt); - //debug_wgetpeekdma_chipram(bltcpt, blt_info.bltcdat, MW_MASK_BLITTER_C, 0x070); - last_custom_value1 = blt_info.bltcdat; + blt_info.bltcdat = chipmem_wget_indirect(bltcpt); } - bltstate = BLT_work; } STATIC_INLINE void blitter_write(void) @@ -669,655 +457,185 @@ STATIC_INLINE void blitter_write(void) blt_info.blitzero = 0; /* D-channel state has no effect on linedraw, but C must be enabled or nothing is drawn! */ if (bltcon0 & 0x200) { - if (!dmaen(DMA_BLITTER)) - return; - //last_custom_value1 = blt_info.bltddat; blitter writes are not stored - chipmem_wput_indirect(bltdpt, blt_info.bltddat); - //debug_wputpeekdma_chipram(bltdpt, blt_info.bltddat, MW_MASK_BLITTER_D_N, 0x000); + chipmem_wput_indirect (bltdpt, blt_info.bltddat); } - bltstate = BLT_next; } STATIC_INLINE void blitter_line_incx(void) { - if (++blinea_shift == 16) { - blinea_shift = 0; - bltcpt += 2; - } + if (++blinea_shift == 16) { + blinea_shift = 0; + bltcpt += 2; + } } STATIC_INLINE void blitter_line_decx(void) { - if (blinea_shift-- == 0) { - blinea_shift = 15; - bltcpt -= 2; - } + if (blinea_shift-- == 0) { + blinea_shift = 15; + bltcpt -= 2; + } } STATIC_INLINE void blitter_line_decy(void) { - bltcpt -= blt_info.bltcmod; - blitonedot = 0; + bltcpt -= blt_info.bltcmod; + blitonedot = 0; } STATIC_INLINE void blitter_line_incy(void) { - bltcpt += blt_info.bltcmod; - blitonedot = 0; + bltcpt += blt_info.bltcmod; + blitonedot = 0; } -static void blitter_line(void) +static int blitter_line(void) { uae_u16 blitahold = (blinea & blt_info.bltafwm) >> blinea_shift; uae_u16 blitchold = blt_info.bltcdat; blt_info.bltbhold = (blineb & 1) ? 0xFFFF : 0; - blitlinepixel = !blitsing || (blitsing && !blitonedot); - blt_info.bltddat = blit_func(blitahold, blt_info.bltbhold, blitchold, bltcon0 & 0xFF); + int blitlinepixel = !blitsing || (blitsing && !blitonedot); + blt_info.bltddat = blit_func (blitahold, blt_info.bltbhold, blitchold, bltcon0 & 0xFF); blitonedot++; -} -static void blitter_line_proc(void) -{ if (bltcon0 & 0x800) { if (blitsign) - bltapt += uae_s16(blt_info.bltbmod); + bltapt += (uae_s16)blt_info.bltbmod; else - bltapt += uae_s16(blt_info.bltamod); + bltapt += (uae_s16)blt_info.bltamod; } if (!blitsign) { if (bltcon1 & 0x10) { if (bltcon1 & 0x8) - blitter_line_decy(); + blitter_line_decy (); else - blitter_line_incy(); - } - else { + blitter_line_incy (); + } else { if (bltcon1 & 0x8) - blitter_line_decx(); + blitter_line_decx (); else - blitter_line_incx(); + blitter_line_incx (); } } if (bltcon1 & 0x10) { if (bltcon1 & 0x4) - blitter_line_decx(); + blitter_line_decx (); else - blitter_line_incx(); - } - else { + blitter_line_incx (); + } else { if (bltcon1 & 0x4) - blitter_line_decy(); + blitter_line_decy (); else - blitter_line_incy(); + blitter_line_incy (); } - blitsign = 0 > uae_s16(bltapt); - bltstate = BLT_write; + blitsign = 0 > (uae_s16)bltapt; + return blitlinepixel; } - - STATIC_INLINE void blitter_nxline(void) { blineb = (blineb << 1) | (blineb >> 15); blt_info.vblitsize--; - bltstate = BLT_read; } -#ifdef CPUEMU_13 - -static int blitter_cyclecounter; -static int blitter_hcounter1, blitter_hcounter2; -static int blitter_vcounter1, blitter_vcounter2; - -static void decide_blitter_line(int hsync, int hpos) -{ - if (blit_final && blt_info.vblitsize) - blit_final = 0; - while (last_blitter_hpos < hpos) { - int c = channel_state(blit_cyclecounter); - - for (;;) { - int v = canblit(last_blitter_hpos); - - if (blit_waitcyclecounter) { - blit_waitcyclecounter = 0; - break; - } - - // final 2 idle cycles? does not need free bus - if (blit_final) { - blit_cyclecounter++; - blit_totalcyclecounter++; - if (blit_cyclecounter >= 2) { - blitter_done(last_blitter_hpos); - return; - } - break; - } - - if (v <= 0) { - blit_misscyclecounter++; - blitter_nasty++; - break; - } - - blit_cyclecounter++; - blit_totalcyclecounter++; - - check_channel_mods(last_blitter_hpos, c); - - if (c == 3) { - - blitter_read(); - alloc_cycle_blitter(last_blitter_hpos, &bltcpt, 3); - record_dma_blit(0x70, blt_info.bltcdat, bltcpt, last_blitter_hpos); - blitter_nasty++; - - } - else if (c == 5) { - - if (ddat1use) { - bltdpt = bltcpt; - } - ddat1use = 1; - blitter_line(); - blitter_line_proc(); - blitter_nxline(); - - } - else if (c == 4) { - - /* onedot mode and no pixel = bus write access is skipped */ - if (blitlinepixel) { - blitter_write(); - alloc_cycle_blitter(last_blitter_hpos, &bltdpt, 4); - record_dma_blit(0x00, blt_info.bltddat, bltdpt, last_blitter_hpos); - blitlinepixel = 0; - blitter_nasty++; - } - if (blt_info.vblitsize == 0) { - bltdpt = bltcpt; - blit_final = 1; - blit_cyclecounter = 0; - blit_waitcyclecounter = 0; - // blit finished bit is set and interrupt triggered - // immediately after last D write - blitter_interrupt(last_blitter_hpos, 0); - break; - } - - } - - break; - } - last_blitter_hpos++; - } - if (hsync) - last_blitter_hpos = 0; - reset_channel_mods(); -} - -#endif - static void actually_do_blit(void) { - if (blitline) { - do { - blitter_read(); + if (blitline) { + do { + blitter_read (); if (ddat1use) bltdpt = bltcpt; ddat1use = 1; - blitter_line(); - blitter_line_proc(); - blitter_nxline(); - if (blitlinepixel) { - blitter_write(); - blitlinepixel = 0; + if (blitter_line ()) { + blitter_write (); } + blitter_nxline (); if (blt_info.vblitsize == 0) bltstate = BLT_done; } while (bltstate != BLT_done); - bltdpt = bltcpt; - } - else { + bltdpt = bltcpt; + last_custom_value1 = blt_info.bltcdat; + } else { if (blitdesc) - blitter_dofast_desc(); + blitter_dofast_desc (); else - blitter_dofast(); + blitter_dofast (); bltstate = BLT_done; } } -static void blitter_doit(void) +static void blitter_doit (void) { if (blt_info.vblitsize == 0 || (blitline && blt_info.hblitsize != 2)) { - blitter_done(current_hpos()); + blitter_done (); return; } - if (log_blitter) { - if (!blitter_dontdo) - actually_do_blit(); - else - bltstate = BLT_done; - } - else { - actually_do_blit(); - } - blitter_done(current_hpos()); + actually_do_blit (); + blitter_done (); } -void blitter_handler(uae_u32 data) +void blitter_handler(void) { static int blitter_stuck; - if (!dmaen(DMA_BLITTER)) { - event2_newevent(ev2_blitter, 10, 0); + if (!dmaen (DMA_BLITTER)) { + event_newevent (ev_blitter, 10); blitter_stuck++; if (blitter_stuck < 20000 || !immediate_blits) return; /* gotta come back later. */ - /* "free" blitter in immediate mode if it has been "stuck" ~3 frames - * fixes some JIT game incompatibilities - */ - //debugtest(DEBUGTEST_BLITTER, _T("force-unstuck!\n")); + /* "free" blitter in immediate mode if it has been "stuck" ~3 frames + * fixes some JIT game incompatibilities + */ } blitter_stuck = 0; if (blit_slowdown > 0 && !immediate_blits) { - event2_newevent(ev2_blitter, blit_slowdown, 0); + event_newevent (ev_blitter, blit_slowdown); blit_slowdown = -1; return; } - blitter_doit(); + blitter_doit (); } -#ifdef CPUEMU_13 - -static uae_u32 preva, prevb; -STATIC_INLINE uae_u16 blitter_doblit(void) +static void blitter_force_finish (void) { - uae_u32 blitahold; - uae_u16 bltadat, ddat; - uae_u8 mt = bltcon0 & 0xFF; - - bltadat = blt_info.bltadat; - if (blitter_hcounter1 == 0) - bltadat &= blt_info.bltafwm; - if (blitter_hcounter1 == blt_info.hblitsize - 1) - bltadat &= blt_info.bltalwm; - if (blitdesc) - blitahold = (((uae_u32)bltadat << 16) | preva) >> blt_info.blitdownashift; - else - blitahold = (((uae_u32)preva << 16) | bltadat) >> blt_info.blitashift; - preva = bltadat; - - ddat = blit_func(blitahold, blt_info.bltbhold, blt_info.bltcdat, mt) & 0xFFFF; - - if ((bltcon1 & 0x18)) { - uae_u16 d = ddat; - int ifemode = blitife ? 2 : 0; - int fc1 = blit_filltable[d & 255][ifemode + blitfc][1]; - ddat = (blit_filltable[d & 255][ifemode + blitfc][0] - + (blit_filltable[d >> 8][ifemode + fc1][0] << 8)); - blitfc = blit_filltable[d >> 8][ifemode + fc1][1]; - } - - if (ddat) - blt_info.blitzero = 0; - - return ddat; + uae_u16 odmacon; + if (bltstate == BLT_done) + return; + if (bltstate != BLT_done) { + /* blitter is currently running + * force finish (no blitter state support yet) + */ + odmacon = dmacon; + dmacon |= DMA_MASTER | DMA_BLITTER; + actually_do_blit (); + blitter_done (); + dmacon = odmacon; + } } - -STATIC_INLINE void blitter_doddma(int hpos) -{ - uae_u16 d; - - if (blit_dmacount2 == 0) { - d = blitter_doblit(); - } - else if (ddat2use) { - d = ddat2; - ddat2use = 0; - } - else if (ddat1use) { - d = ddat1; - ddat1use = 0; - } - else { - static int warn = 10; - if (warn > 0) { - warn--; - write_log(_T("BLITTER: D-channel without nothing to do?\n")); - } - return; - } - record_dma_blit(0x00, d, bltdpt, hpos); - //last_custom_value1 = d; blitter writes are not stored - chipmem_agnus_wput2(bltdpt, d); - alloc_cycle_blitter(hpos, &bltdpt, 4); - bltdpt += blit_add; - blitter_hcounter2++; - if (blitter_hcounter2 == blt_info.hblitsize) { - blitter_hcounter2 = 0; - bltdpt += blit_modaddd; - blitter_vcounter2++; - if (blit_dmacount2 == 0) // d-only - blitter_vcounter1++; - if (blitter_vcounter2 > blitter_vcounter1) - blitter_vcounter1 = blitter_vcounter2; - } - if (blit_ch == 1) - blitter_hcounter1 = blitter_hcounter2; -} - -STATIC_INLINE void blitter_dodma(int ch, int hpos) -{ - uae_u16 dat, reg; - uae_u32 addr; - - switch (ch) - { - case 1: - blt_info.bltadat = dat = chipmem_wget_indirect(bltapt); - last_custom_value1 = blt_info.bltadat; - addr = bltapt; - bltapt += blit_add; - reg = 0x74; - alloc_cycle_blitter(hpos, &bltapt, 1); - break; - case 2: - blt_info.bltbdat = dat = chipmem_wget_indirect(bltbpt); - last_custom_value1 = blt_info.bltbdat; - addr = bltbpt; - bltbpt += blit_add; - if (blitdesc) - blt_info.bltbhold = (((uae_u32)blt_info.bltbdat << 16) | prevb) >> blt_info.blitdownbshift; - else - blt_info.bltbhold = (((uae_u32)prevb << 16) | blt_info.bltbdat) >> blt_info.blitbshift; - prevb = blt_info.bltbdat; - reg = 0x72; - alloc_cycle_blitter(hpos, &bltbpt, 2); - break; - case 3: - blt_info.bltcdat = dat = chipmem_wget_indirect(bltcpt); - last_custom_value1 = blt_info.bltcdat; - addr = bltcpt; - bltcpt += blit_add; - reg = 0x70; - alloc_cycle_blitter(hpos, &bltcpt, 3); - break; - default: - abort(); - } - - blitter_cyclecounter++; - if (blitter_cyclecounter >= blit_dmacount2) { - blitter_cyclecounter = 0; - ddat2 = ddat1; - ddat2use = ddat1use; - ddat1use = 0; - ddat1 = blitter_doblit(); - if (bltcon0 & 0x100) - ddat1use = 1; - blitter_hcounter1++; - if (blitter_hcounter1 == blt_info.hblitsize) { - blitter_hcounter1 = 0; - if (bltcon0 & 0x800) - bltapt += blit_modadda; - if (bltcon0 & 0x400) - bltbpt += blit_modaddb; - if (bltcon0 & 0x200) - bltcpt += blit_modaddc; - blitter_vcounter1++; - blitfc = !!(bltcon1 & 0x4); - } - } - record_dma_blit(reg, dat, addr, hpos); -} - -int blitter_need(int hpos) -{ - int c; - if (bltstate == BLT_done) - return 0; - if (!dmaen(DMA_BLITTER)) - return 0; - c = channel_state(blit_cyclecounter); - return c; -} - -static void do_startcycles(int hpos) -{ - int vhpos = last_blitter_hpos; - while (vhpos < hpos) { - int v = canblit(vhpos); - vhpos++; - if (v > 0) { - blit_startcycles--; - if (blit_startcycles == 0) { - if (blit_faulty) - blit_faulty = -1; - bltstate = BLT_done; - blit_final = 0; - do_blitter(vhpos, 0); - blit_startcycles = 0; - blit_cyclecounter = 0; - blit_waitcyclecounter = 0; - if (blit_faulty) - blit_faulty = 1; - return; - } - } - else { - markidlecycle(hpos); - } - } -} - -void decide_blitter(int hpos) -{ - int hsync = hpos < 0; - - if (hsync && blt_delayed_irq) { - if (blt_delayed_irq > 0) - blt_delayed_irq--; - if (blt_delayed_irq <= 0) { - blt_delayed_irq = 0; - send_interrupt(6, 2 * CYCLE_UNIT); - } - } - - if (immediate_blits) { - if (bltstate == BLT_done) - return; - if (dmaen(DMA_BLITTER)) - blitter_doit(); - return; - } - - if (blit_startcycles > 0) - do_startcycles(hpos); - - if (bltstate == BLT_done) - return; - - if (log_blitter && blitter_delayed_debug) { - blitter_delayed_debug = 0; - blitter_dump(); - } - - if (!blitter_cycle_exact) - return; - - if (hpos < 0) - hpos = maxhpos; - - if (blitline) { - blt_info.got_cycle = 1; - decide_blitter_line(hsync, hpos); - return; - } - - while (last_blitter_hpos < hpos) { - int c; - - c = channel_state(blit_cyclecounter); - - for (;;) { - int v; - - v = canblit(last_blitter_hpos); - - // copper bltsize write needs one cycle (any cycle) delay - if (blit_waitcyclecounter) { - blit_waitcyclecounter = 0; - markidlecycle(last_blitter_hpos); - break; - } - // idle cycles require free bus. - // Final empty cycle does not, unless it is fill mode that requires extra idle cycle - // (CPU can still use this cycle) -#if 1 - if ((blit_cyclecounter < 0 || !blit_final || (blitfill && blit_cycle_diagram_fill[blit_ch][0])) && ((c == 0 && v == 0) || v < 0)) { - blit_misscyclecounter++; - blitter_nasty++; - break; - } -#else - if ((c == 0 && v == 0) || v < 0) { - if (blit_cyclecounter < 0 || !blit_final) { - blit_misscyclecounter++; - break; - } - if (blitfill && blit_cycle_diagram_fill[blit_ch][0]) { - blit_misscyclecounter++; - blitter_nasty++; - break; - } - } -#endif - if (blit_frozen) { - blit_misscyclecounter++; - break; - } - - if (c == 0) { - blt_info.got_cycle = 1; - blit_cyclecounter++; - if (blit_cyclecounter == 0) - blit_final = 0; - blit_totalcyclecounter++; - /* check if blit with zero channels has ended */ - if (blit_ch == 0 && blit_cyclecounter >= blit_maxcyclecounter) { - blitter_done(last_blitter_hpos); - return; - } - markidlecycle(last_blitter_hpos); - break; - } - - blitter_nasty++; - - if (v <= 0) { - blit_misscyclecounter++; - break; - } - - blt_info.got_cycle = 1; - if (c == 4) { - blitter_doddma(last_blitter_hpos); - blit_cyclecounter++; - blit_totalcyclecounter++; - } - else { - if (blitter_vcounter1 < blt_info.vblitsize) { - blitter_dodma(c, last_blitter_hpos); - } - blit_cyclecounter++; - blit_totalcyclecounter++; - } - - if (blitter_vcounter1 >= blt_info.vblitsize && blitter_vcounter2 >= blt_info.vblitsize) { - if (!ddat1use && !ddat2use) { - blitter_done(last_blitter_hpos); - return; - } - } - // check this after end check because last D write won't cause any problems. - check_channel_mods(last_blitter_hpos, c); - break; - } - - if (dmaen(DMA_BLITTER) && !blit_final && (blitter_vcounter1 == blt_info.vblitsize || (blitter_vcounter1 == blt_info.vblitsize - 1 && blitter_hcounter1 == blt_info.hblitsize - 1 && blit_dmacount2 == 0))) { - if (channel_pos(blit_cyclecounter - 1) == blit_diag[0] - 1) { - blitter_interrupt(last_blitter_hpos, 0); - blit_cyclecounter = 0; - blit_final = 1; - } - } - last_blitter_hpos++; - } - reset_channel_mods(); - if (hsync) - last_blitter_hpos = 0; -} -#else -void decide_blitter(int hpos) { } -#endif - -static void blitter_force_finish(void) -{ - uae_u16 odmacon; - if (bltstate == BLT_done) - return; - if (bltstate != BLT_done) { - /* blitter is currently running - * force finish (no blitter state support yet) - */ - odmacon = dmacon; - dmacon |= DMA_MASTER | DMA_BLITTER; - write_log(_T("forcing blitter finish\n")); - if (blitter_cycle_exact && !immediate_blits) { - int rounds = 10000; - while (bltstate != BLT_done && rounds > 0) { -#ifdef CPUEMU_13 - memset(cycle_line, 0, sizeof cycle_line); -#endif - decide_blitter(-1); - rounds--; - } - if (rounds == 0) - write_log(_T("blitter froze!?\n")); - blit_startcycles = 0; - } - else { - actually_do_blit(); - } - blitter_done(current_hpos()); - dmacon = odmacon; - } -} - -static bool invstate(void) +static bool invstate (void) { return bltstate != BLT_done && bltstate != BLT_init; } -static void blit_bltset(int con) +static void blit_bltset (int con) { int i; - const int *olddiag = blit_diag; if (con & 2) { blitdesc = bltcon1 & 2; blt_info.blitbshift = bltcon1 >> 12; blt_info.blitdownbshift = 16 - blt_info.blitbshift; if ((bltcon1 & 1) && !blitline_started) { - write_log(_T("BLITTER: linedraw enabled after starting normal blit! %08x\n"), M68K_GETPC); + write_log (_T("BLITTER: linedraw enabled after starting normal blit! %08x\n"), M68K_GETPC); return; } + if (bltstate != BLT_done) { + return; + } } if (con & 1) { @@ -1334,87 +652,25 @@ static void blit_bltset(int con) blitline = 0; bltstate = BLT_done; blit_interrupt = 1; - write_log(_T("BLITTER: register modification during linedraw! %08x\n"), M68K_GETPC); - //if (log_blitter & 16) - // activate_debugger(); + write_log (_T("BLITTER: register modification during linedraw! %08x\n"), M68K_GETPC); } if (blitline) { - //if (blt_info.hblitsize != 2) { - //debugtest(DEBUGTEST_BLITTER, _T("weird blt_info.hblitsize in linemode: %d vsize=%d\n"), - // blt_info.hblitsize, blt_info.vblitsize); - //if (log_blitter & 16) - // activate_debugger(); - //} blit_diag = blit_cycle_diagram_line; - } - else { + } else { if (con & 2) { blitfc = !!(bltcon1 & 0x4); blitife = !!(bltcon1 & 0x8); if ((bltcon1 & 0x18) == 0x18) { - //debugtest(DEBUGTEST_BLITTER, _T("weird fill mode\n")); blitife = 0; } } - //if (blitfill && !blitdesc) { - //debugtest(DEBUGTEST_BLITTER, _T("fill without desc\n")); - //if (log_blitter & 16) - // activate_debugger(); - //} blit_diag = blitfill && blit_cycle_diagram_fill[blit_ch][0] ? blit_cycle_diagram_fill[blit_ch] : blit_cycle_diagram[blit_ch]; } - //if ((bltcon1 & 0x80) && (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) { - //debugtest(DEBUGTEST_BLITTER, _T("ECS BLTCON1 DOFF-bit set\n")); - //if (log_blitter & 16) - // activate_debugger(); - //} - - // on the fly switching fillmode from extra cycle to non-extra: blitter freezes - // non-extra cycle to extra cycle: does not freeze but cycle diagram goes weird, - // extra free cycle changes to another D write.. - // (Absolute Inebriation vector cube inside semi-filled vector object requires freezing blitter.) - if (!savestate_state && invstate()) { - static int freezes = 10; - int isen = blit_diag >= &blit_cycle_diagram_fill[0][0] && blit_diag <= &blit_cycle_diagram_fill[15][0]; - int iseo = olddiag >= &blit_cycle_diagram_fill[0][0] && olddiag <= &blit_cycle_diagram_fill[15][0]; - if (iseo != isen) { - if (freezes > 0) { - write_log(_T("BLITTER: on the fly %d (%d) -> %d (%d) switch! PC=%08x\n"), original_ch, iseo, blit_ch, isen, M68K_GETPC); - freezes--; - } - } - if (original_fill == isen) { - blit_frozen = 0; // switched back to original fill mode? unfreeze - } - else if (iseo && !isen) { - blit_frozen = 1; - write_log(_T("BLITTER: frozen! %d (%d) -> %d (%d) %08X\n"), original_ch, iseo, blit_ch, isen, M68K_GETPC); - //if (log_blitter & 16) - // activate_debugger(); - } - else if (!iseo && isen) { - if (!dmaen(DMA_BLITTER)) // subtle shades / nuance bootblock bug - blit_frozen = 1; - if (log_blitter) - write_log(_T("BLITTER: on the fly %d (%d) -> %d (%d) switch\n"), original_ch, iseo, blit_ch, isen); - } - } // on the fly switching from CH=1 to CH=D -> blitter stops writing (Rampage/TEK) // currently just switch to no-channels mode, better than crashing the demo.. - if (!savestate_state && invstate()) { - static uae_u8 changetable[32 * 32]; - int o = original_ch + (original_fill ? 16 : 0); - int n = blit_ch + (blitfill ? 16 : 0); - if (o != n) { - if (changetable[o * 32 + n] < 10) { - changetable[o * 32 + n]++; - write_log(_T("BLITTER: channel mode changed while active (%02X->%02X) PC=%08x\n"), o, n, M68K_GETPC); - //if (log_blitter & 16) - // activate_debugger(); - } - } + if (!savestate_state && invstate ()) { if (blit_ch == 13 && original_ch == 1) { blit_faulty = 1; } @@ -1437,331 +693,164 @@ static void blit_bltset(int con) blit_nod = 0; } if (blit_dmacount2 == 0) { - ddat2use = 0; ddat1use = 0; } } -static void blit_modset(void) +void reset_blit (int bltcon) { - int mult; - - blit_add = blitdesc ? -2 : 2; - mult = blitdesc ? -1 : 1; - blit_modadda = mult * blt_info.bltamod; - blit_modaddb = mult * blt_info.bltbmod; - blit_modaddc = mult * blt_info.bltcmod; - blit_modaddd = mult * blt_info.bltdmod; + if (bltstate == BLT_done) + return; + blit_bltset (bltcon); } -void reset_blit(int bltcon) +static bool waitingblits (void) { - if (bltcon & 1) - blinea_shift = bltcon0 >> 12; - if (bltcon & 2) - blitsign = bltcon1 & 0x40; - if (bltstate == BLT_done) - return; - if (bltcon) - blit_bltset(bltcon); - blit_modset(); -} - -static bool waitingblits(void) -{ - //static int warned = 10; - - //bool waited = false; - while (bltstate != BLT_done && dmaen(DMA_BLITTER)) { - //waited = true; - x_do_cycles(8 * CYCLE_UNIT); + while (bltstate != BLT_done && dmaen (DMA_BLITTER)) { + x_do_cycles (8 * CYCLE_UNIT); } - //if (warned && waited) { - // warned--; - // write_log(_T("waiting_blits detected PC=%08x\n"), M68K_GETPC); - //} if (bltstate == BLT_done) return true; return false; } -static void blitter_start_init(void) +static void blitter_start_init (void) { blt_info.blitzero = 1; -#ifdef CPUEMU_13 - preva = 0; - prevb = 0; -#endif - blit_frozen = 0; blitline_started = bltcon1 & 1; - blit_bltset(1 | 2); - blit_modset(); - ddat1use = ddat2use = 0; + blit_bltset (1 | 2); + ddat1use = 0; blit_interrupt = 0; + blt_info.bltaold = 0; + blt_info.bltbold = 0; + if (blitline) { + blinea_shift = bltcon0 >> 12; blinea = blt_info.bltadat; blineb = (blt_info.bltbdat >> blt_info.blitbshift) | (blt_info.bltbdat << (16 - blt_info.blitbshift)); blitonedot = 0; - blitlinepixel = 0; blitsing = bltcon1 & 0x2; + blitsign = bltcon1 & 0x40; } } -static void do_blitter2(int hpos, int copper) +void do_blitter () { int cycles; int cleanstart; - //if ((log_blitter & 2)) { - // if (bltstate != BLT_done) { - // if (blit_final) { - // write_log(_T("blitter was already active! PC=%08x\n"), M68K_GETPC); - // //activate_debugger(); - // } - // } - //} - cleanstart = 0; if (bltstate == BLT_done) { - if (blit_faulty > 0) - blit_faulty = 0; + blit_faulty = 0; cleanstart = 1; } bltstate = BLT_done; - blitter_cycle_exact = currprefs.blitter_cycle_exact; immediate_blits = currprefs.immediate_blits; - blt_info.got_cycle = 0; - last_blitter_hpos = hpos + 1; - blit_firstline_cycles = blit_first_cycle = get_cycles(); - blit_misscyclecounter = 0; + blit_firstline_cycles = blit_first_cycle = get_cycles (); blit_last_cycle = 0; - blit_maxcyclecounter = 0; blit_cyclecounter = 0; - blit_totalcyclecounter = 0; - blitter_start_init(); + blitter_start_init (); if (blitline) { cycles = blt_info.vblitsize; - } - else { + } else { cycles = blt_info.vblitsize * blt_info.hblitsize; blit_firstline_cycles = blit_first_cycle + (blit_diag[0] * blt_info.hblitsize) * CYCLE_UNIT + cpu_cycles; } if (cleanstart) { original_ch = blit_ch; - original_fill = blitfill; - original_line = blitline; } - //if ((log_blitter & 1) || ((log_blitter & 32) && !blitline)) { - // blitter_dontdo = 0; - // if (1) { - // int ch = 0; - // if (blit_ch & 1) - // ch++; - // if (blit_ch & 2) - // ch++; - // if (blit_ch & 4) - // ch++; - // if (blit_ch & 8) - // ch++; - // write_log(_T("blitstart: %dx%d ch=%d %d*%d=%d d=%d f=%02x n=%d pc=%08x l=%d dma=%04x %s\n"), - // blt_info.hblitsize, blt_info.vblitsize, ch, blit_diag[0], cycles, blit_diag[0] * cycles, - // blitdesc ? 1 : 0, blitfill, dmaen(DMA_BLITPRI) ? 1 : 0, M68K_GETPC, blitline, - // dmacon, ((dmacon & (DMA_MASTER | DMA_BLITTER)) == (DMA_MASTER | DMA_BLITTER)) ? _T("") : _T(" off!")); - // blitter_dump(); - // } - //} - - bltstate = BLT_init; + bltstate = BLT_init; blit_slowdown = 0; - if (dmaen(DMA_BLITPRI)) - set_special(SPCFLAG_BLTNASTY); - else - unset_special(SPCFLAG_BLTNASTY); - - if (dmaen(DMA_BLITTER)) - bltstate = BLT_work; - - blit_maxcyclecounter = 0x7fffffff; - blit_waitcyclecounter = 0; - - if (blitter_cycle_exact) { - if (immediate_blits) { - if (dmaen(DMA_BLITTER)) - blitter_doit(); - return; - } - if (log_blitter & 8) { - blitter_handler(0); - } - else { -#ifdef CPUEMU_13 - blitter_hcounter1 = blitter_hcounter2 = 0; - blitter_vcounter1 = blitter_vcounter2 = 0; - if (blit_nod) - blitter_vcounter2 = blt_info.vblitsize; -#endif - blit_cyclecounter = -BLITTER_STARTUP_CYCLES; - blit_waitcyclecounter = copper; - blit_startcycles = 0; - blit_maxcyclecounter = blt_info.hblitsize * blt_info.vblitsize + 2; - } - return; - } + if (dmaen(DMA_BLITPRI)) + set_special (SPCFLAG_BLTNASTY); + else + unset_special (SPCFLAG_BLTNASTY); if (blt_info.vblitsize == 0 || (blitline && blt_info.hblitsize != 2)) { - if (dmaen(DMA_BLITTER)) - blitter_done(hpos); + if (dmaen (DMA_BLITTER)) + blitter_done (); return; } - if (dmaen(DMA_BLITTER)) { - blt_info.got_cycle = 1; - } + blit_cyclecounter = cycles * (blit_dmacount2 + (blit_nod ? 0 : 1)); + if (!dmaen (DMA_BLITTER)) + return; + + bltstate = BLT_work; if (immediate_blits) { - if (dmaen(DMA_BLITTER)) - blitter_doit(); - return; + blitter_doit (); + return; } - blit_cyclecounter = cycles * (blit_dmacount2 + (blit_nod ? 0 : 1)); - event2_newevent(ev2_blitter, blit_cyclecounter, 0); + event_newevent(ev_blitter, blit_cyclecounter); - if (dmaen(DMA_BLITTER) && (currprefs.cpu_model >= 68020 || !currprefs.cpu_memory_cycle_exact)) { + if (dmaen (DMA_BLITTER)) { if (currprefs.waiting_blits) { // wait immediately if all cycles in use and blitter nastry if (blit_dmacount == blit_diag[0] && (regs.spcflags & SPCFLAG_BLTNASTY)) { - waitingblits(); + waitingblits (); } } } } -void blitter_check_start(void) +void blitter_check_start (void) { - if (bltstate != BLT_init) - return; - blitter_start_init(); + blitter_start_init (); bltstate = BLT_work; + if (immediate_blits) { - blitter_doit(); - } + blitter_doit (); + } else { + event_newevent(ev_blitter, blit_cyclecounter); + } } -void do_blitter(int hpos, int copper) +void maybe_blit2 (int hack) { - if (bltstate == BLT_done || !blitter_cycle_exact) { - do_blitter2(hpos, copper); - return; - } - if (!dmaen(DMA_BLITTER) || !blt_info.got_cycle) - return; - // previous blit may have last write cycle left - // and we must let it finish - blit_startcycles = BLITTER_STARTUP_CYCLES; - blit_waitcyclecounter = copper; -} - -void maybe_blit(int hpos, int hack) -{ - static int warned = 10; - - reset_channel_mods(); - - if (bltstate == BLT_done) - return; - - if (savestate_state) - return; - - if (dmaen(DMA_BLITTER) && (currprefs.cpu_model >= 68020 || !currprefs.cpu_memory_cycle_exact)) { + if (dmaen (DMA_BLITTER)) { bool doit = false; - if (currprefs.waiting_blits == 3) { // always - doit = true; - } - else if (currprefs.waiting_blits == 2) { // noidle - if (blit_dmacount == blit_diag[0] && (regs.spcflags & SPCFLAG_BLTNASTY)) - doit = true; - } - else if (currprefs.waiting_blits == 1) { // automatic + if (currprefs.waiting_blits) { // automatic if (blit_dmacount == blit_diag[0] && (regs.spcflags & SPCFLAG_BLTNASTY)) doit = true; else if (currprefs.m68k_speed < 0) doit = true; } if (doit) { - if (waitingblits()) + if (waitingblits ()) return; } } - if (warned && dmaen(DMA_BLITTER) && blt_info.got_cycle) { - warned--; - //debugtest(DEBUGTEST_BLITTER, _T("program does not wait for blitter tc=%d\n"), blit_cyclecounter); - if (log_blitter) - warned = 0; - if (log_blitter & 2) { - warned = 10; - write_log(_T("program does not wait for blitter PC=%08x\n"), M68K_GETPC); - } - } + if (hack == 1 && (int)get_cycles() - (int)blit_firstline_cycles < 0) + return; - if (blitter_cycle_exact) { - decide_blitter(hpos); - goto end; - } - - if (hack == 1 && int(get_cycles()) - int(blit_firstline_cycles) < 0) - goto end; - - blitter_handler(0); -end:; - if (log_blitter) - blitter_delayed_debug = 1; + blitter_handler (); } -void check_is_blit_dangerous(uaecptr *bplpt, int planes, int words) -{ - blitter_dangerous_bpl = 0; - if (bltstate == BLT_done || !blitter_cycle_exact) - return; - // too simple but better than nothing - for (int i = 0; i < planes; i++) { - uaecptr bpl = bplpt[i]; - uaecptr dpt = bltdpt & chipmem_bank.mask; - if (dpt >= bpl - 2 * words && dpt < bpl + 2 * words) { - blitter_dangerous_bpl = 1; - return; - } - } -} - -int blitnasty(void) +int blitnasty (void) { int cycles, ccnt; if (bltstate == BLT_done) return 0; - if (!dmaen(DMA_BLITTER)) + if (!dmaen (DMA_BLITTER)) return 0; - if (blitter_cycle_exact) { - blitter_force_finish(); - return -1; - } if (blit_last_cycle >= blit_diag[0] && blit_dmacount == blit_diag[0]) return 0; - cycles = (get_cycles() - blit_first_cycle) / CYCLE_UNIT; + cycles = (get_cycles () - blit_first_cycle) / CYCLE_UNIT; ccnt = 0; while (blit_last_cycle < cycles) { - int c = channel_state(blit_last_cycle++); + int c = channel_state (blit_last_cycle++); if (!c) ccnt++; } @@ -1769,266 +858,171 @@ int blitnasty(void) } /* very approximate emulation of blitter slowdown caused by bitplane DMA */ -void blitter_slowdown(int ddfstrt, int ddfstop, int totalcycles, int freecycles) +void blitter_slowdown (int ddfstrt, int ddfstop, int totalcycles, int freecycles) { - static int oddfstrt, oddfstop, ototal, ofree; - static int slow; + static int oddfstrt, oddfstop, ototal, ofree; + static int slow; - if (!totalcycles || ddfstrt < 0 || ddfstop < 0) - return; - if (ddfstrt != oddfstrt || ddfstop != oddfstop || totalcycles != ototal || ofree != freecycles) { - int linecycles = ((ddfstop - ddfstrt + totalcycles - 1) / totalcycles) * totalcycles; - int freelinecycles = ((ddfstop - ddfstrt + totalcycles - 1) / totalcycles) * freecycles; - int dmacycles = (linecycles * blit_dmacount) / blit_diag[0]; - oddfstrt = ddfstrt; - oddfstop = ddfstop; - ototal = totalcycles; - ofree = freecycles; - slow = 0; - if (dmacycles > freelinecycles) - slow = dmacycles - freelinecycles; - } - if (blit_slowdown < 0 || blitline) - return; - blit_slowdown += slow; - blit_misscyclecounter += slow; -} - -void blitter_reset(void) -{ - bltptxpos = -1; + if (!totalcycles || ddfstrt < 0 || ddfstop < 0) + return; + if (ddfstrt != oddfstrt || ddfstop != oddfstop || totalcycles != ototal || ofree != freecycles) { + int linecycles = ((ddfstop - ddfstrt + totalcycles - 1) / totalcycles) * totalcycles; + int freelinecycles = ((ddfstop - ddfstrt + totalcycles - 1) / totalcycles) * freecycles; + int dmacycles = (linecycles * blit_dmacount) / blit_diag[0]; + oddfstrt = ddfstrt; + oddfstop = ddfstop; + ototal = totalcycles; + ofree = freecycles; + slow = 0; + if (dmacycles > freelinecycles) + slow = dmacycles - freelinecycles; + } + if (blit_slowdown < 0 || blitline) + return; + blit_slowdown += slow; } #ifdef SAVESTATE -void restore_blitter_finish(void) +uae_u8 *restore_blitter (uae_u8 *src) { - //record_dma_reset(); - //record_dma_reset(); - if (blt_statefile_type == 0) { - blit_interrupt = 1; - if (bltstate == BLT_init) { - write_log(_T("blitter was started but DMA was inactive during save\n")); - //do_blitter (0); - } - if (blt_delayed_irq < 0) { - if (intreq & 0x0040) - blt_delayed_irq = 3; - intreq &= ~0x0040; - } - } - else { - last_blitter_hpos = 0; - blit_modset(); - } -} + uae_u32 flags = restore_u32(); -uae_u8 *restore_blitter(uae_u8 *src) -{ - uae_u32 flags = restore_u32(); - - blt_statefile_type = 0; - blt_delayed_irq = 0; bltstate = BLT_done; if (flags & 4) { - bltstate = (flags & 1) ? BLT_done : BLT_init; - } - if (flags & 2) { - write_log(_T("blitter was force-finished when this statefile was saved\n")); - write_log(_T("contact the author if restored program freezes\n")); - // there is a problem. if system ks vblank is active, we must not activate - // "old" blit's intreq until vblank is handled or ks 1.x thinks it was blitter - // interrupt.. - blt_delayed_irq = -1; - } - return src; + bltstate = (flags & 1) ? BLT_done : BLT_init; + } + return src; } -uae_u8 *save_blitter(int *len, uae_u8 *dstptr) +uae_u8 *save_blitter (int *len, uae_u8 *dstptr) { - uae_u8 *dstbak, *dst; - int forced; - - forced = 0; - if (bltstate != BLT_done && bltstate != BLT_init) { - write_log(_T("blitter is active, forcing immediate finish\n")); - /* blitter is active just now but we don't have blitter state support yet */ - blitter_force_finish(); - forced = 2; - } - if (dstptr) - dstbak = dst = dstptr; - else - dstbak = dst = xmalloc(uae_u8, 16); - save_u32(((bltstate != BLT_done) ? 0 : 1) | forced | 4); - *len = dst - dstbak; - return dstbak; + uae_u8 *dstbak,*dst; + int forced; + forced = 0; + if (bltstate != BLT_done && bltstate != BLT_init) { + write_log (_T("blitter is active, forcing immediate finish\n")); + /* blitter is active just now but we don't have blitter state support yet */ + blitter_force_finish (); + forced = 2; + } + if (dstptr) + dstbak = dst = dstptr; + else + dstbak = dst = xmalloc (uae_u8, 16); + save_u32(((bltstate != BLT_done) ? 0 : 1) | forced | 4); + *len = dst - dstbak; + return dstbak; } // totally non-real-blitter-like state save but better than nothing.. -uae_u8 *restore_blitter_new(uae_u8 *src) +uae_u8 *restore_blitter_new (uae_u8 *src) { uae_u8 state; - blt_statefile_type = 1; - blitter_cycle_exact = restore_u8(); - state = restore_u8(); + state = restore_u8 (); - blit_first_cycle = restore_u32(); - blit_last_cycle = restore_u32(); - blit_waitcyclecounter = restore_u32(); - blit_startcycles = restore_u32(); - blit_maxcyclecounter = restore_u32(); - blit_firstline_cycles = restore_u32(); - blit_cyclecounter = restore_u32(); - blit_slowdown = restore_u32(); - blit_misscyclecounter = restore_u32(); -#ifdef CPUEMU_13 - blitter_hcounter1 = restore_u16(); - blitter_hcounter2 = restore_u16(); - blitter_vcounter1 = restore_u16(); - blitter_vcounter2 = restore_u16(); -#endif - blit_ch = restore_u8(); - blit_dmacount = restore_u8(); - blit_dmacount2 = restore_u8(); - blit_nod = restore_u8(); - blit_final = restore_u8(); - blitfc = restore_u8(); - blitife = restore_u8(); + blit_first_cycle = restore_u32 (); + blit_last_cycle = restore_u32 (); + blit_firstline_cycles = restore_u32 (); + blit_cyclecounter = restore_u32 (); + blit_slowdown = restore_u32 (); - blt_info.blitbshift = restore_u8(); - blt_info.blitdownbshift = restore_u8(); - blt_info.blitashift = restore_u8(); - blt_info.blitdownashift = restore_u8(); + blit_ch = restore_u8 (); + blit_dmacount = restore_u8 (); + blit_dmacount2 = restore_u8 (); + blit_nod = restore_u8 (); + blitfc = restore_u8 (); + blitife = restore_u8 (); - ddat1use = restore_u8(); - ddat2use = restore_u8(); - ddat1 = restore_u16(); - ddat2 = restore_u16(); + blt_info.blitbshift = restore_u8 (); + blt_info.blitdownbshift = restore_u8 (); + blt_info.blitashift = restore_u8 (); + blt_info.blitdownashift = restore_u8 (); - blitline = restore_u8(); - blitfill = restore_u8(); - blinea = restore_u16(); - blineb = restore_u16(); - blinea_shift = restore_u8(); - blitonedot = restore_u8(); - blitlinepixel = restore_u8(); - blitsing = restore_u8(); - blitlinepixel = restore_u8(); - blit_interrupt = restore_u8(); - blt_delayed_irq = restore_u8(); - blt_info.blitzero = restore_u8(); - blt_info.got_cycle = restore_u8(); + ddat1use = restore_u8 (); - blit_frozen = restore_u8(); - blit_faulty = restore_u8(); - original_ch = restore_u8(); - original_fill = restore_u8(); - original_line = restore_u8(); + blitline = restore_u8 (); + blitfill = restore_u8 (); + blinea = restore_u16 (); + blineb = restore_u16 (); + blinea_shift = restore_u8 (); + blitonedot = restore_u8 (); + blitsing = restore_u8 (); + blit_interrupt = restore_u8 (); + blt_info.blitzero = restore_u8 (); - blit_diag = set_cycle_diagram_type(restore_u8()); + blit_faulty = restore_u8 (); + original_ch = restore_u8 (); - if (restore_u16() != 0x1234) - write_log(_T("error\n")); + blit_diag = set_cycle_diagram_type (restore_u8 ()); - blitter_nasty = restore_u8(); + if (restore_u16 () != 0x1234) + write_log (_T("error\n")); bltstate = BLT_done; - if (!blitter_cycle_exact) { - if (state > 0) - do_blitter(0, 0); - } - else { - if (state == 1) - bltstate = BLT_init; - else if (state == 2) - bltstate = BLT_work; - } + if (state > 0) + do_blitter (); return src; } -uae_u8 *save_blitter_new(int *len, uae_u8 *dstptr) +uae_u8 *save_blitter_new (int *len, uae_u8 *dstptr) { - uae_u8 *dstbak, *dst; + uae_u8 *dstbak,*dst; if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = xmalloc(uae_u8, 1000); + dstbak = dst = xmalloc (uae_u8, 1000); uae_u8 state; - save_u8(blitter_cycle_exact ? 1 : 0); if (bltstate == BLT_done) state = 0; else if (bltstate == BLT_init) state = 1; else state = 2; - save_u8(state); + save_u8 (state); if (bltstate != BLT_done) { - //write_log(_T("BLITTER active while saving state\n")); - //blitter_dump(); + write_log (_T("BLITTER active while saving state\n")); } - save_u32(blit_first_cycle); - save_u32(blit_last_cycle); - save_u32(blit_waitcyclecounter); - save_u32(blit_startcycles); - save_u32(blit_maxcyclecounter); - save_u32(blit_firstline_cycles); - save_u32(blit_cyclecounter); - save_u32(blit_slowdown); - save_u32(blit_misscyclecounter); -#ifdef CPUEMU_13 - save_u16(blitter_hcounter1); - save_u16(blitter_hcounter2); - save_u16(blitter_vcounter1); - save_u16(blitter_vcounter2); -#endif - save_u8(blit_ch); - save_u8(blit_dmacount); - save_u8(blit_dmacount2); - save_u8(blit_nod); - save_u8(blit_final); - save_u8(blitfc); - save_u8(blitife); + save_u32 (blit_first_cycle); + save_u32 (blit_last_cycle); + save_u32 (blit_firstline_cycles); + save_u32 (blit_cyclecounter); + save_u32 (blit_slowdown); - save_u8(blt_info.blitbshift); - save_u8(blt_info.blitdownbshift); - save_u8(blt_info.blitashift); - save_u8(blt_info.blitdownashift); + save_u8 (blit_ch); + save_u8 (blit_dmacount); + save_u8 (blit_dmacount2); + save_u8 (blit_nod); + save_u8 (blitfc); + save_u8 (blitife); - save_u8(ddat1use); - save_u8(ddat2use); - save_u16(ddat1); - save_u16(ddat2); + save_u8 (blt_info.blitbshift); + save_u8 (blt_info.blitdownbshift); + save_u8 (blt_info.blitashift); + save_u8 (blt_info.blitdownashift); - save_u8(blitline); - save_u8(blitfill); - save_u16(blinea); - save_u16(blineb); - save_u8(blinea_shift); - save_u8(blitonedot); - save_u8(blitlinepixel); - save_u8(blitsing); - save_u8(blitlinepixel); - save_u8(blit_interrupt); - save_u8(blt_delayed_irq); - save_u8(blt_info.blitzero); - save_u8(blt_info.got_cycle); + save_u8 (ddat1use); - save_u8(blit_frozen); - save_u8(blit_faulty); - save_u8(original_ch); - save_u8(original_fill); - save_u8(original_line); - save_u8(get_cycle_diagram_type(blit_diag)); + save_u8 (blitline); + save_u8 (blitfill); + save_u16 (blinea); + save_u16 (blineb); + save_u8 (blinea_shift); + save_u8 (blitonedot); + save_u8 (blitsing); + save_u8 (blit_interrupt); + save_u8 (blt_info.blitzero); + + save_u8 (blit_faulty); + save_u8 (original_ch); + save_u8 (get_cycle_diagram_type (blit_diag)); - save_u16(0x1234); - - save_u8(blitter_nasty); + save_u16 (0x1234); *len = dst - dstbak; return dstbak; diff --git a/src/blkdev.cpp b/src/blkdev.cpp index 1f30fad0..986a297b 100644 --- a/src/blkdev.cpp +++ b/src/blkdev.cpp @@ -10,21 +10,16 @@ #include "sysconfig.h" #include "sysdeps.h" #include "options.h" -#include "include/memory.h" +#include "memory.h" +#include "traps.h" #include "blkdev.h" -#include "scsidev.h" #include "savestate.h" #include "crc32.h" #include "threaddep/thread.h" #include "execio.h" #include "zfile.h" -#include "scsi.h" -#ifdef RETROPLATFORM -#include "rp.h" -#endif - -int log_scsiemu = 0; +#include "fsdb.h" #define PRE_INSERT_DELAY (3 * (currprefs.ntscmode ? 60 : 50)) @@ -50,29 +45,10 @@ struct blkdevstate struct blkdevstate state[MAX_TOTAL_SCSI_DEVICES]; -#if 0 -static int scsiemu[MAX_TOTAL_SCSI_DEVICES]; - -static struct device_functions *device_func[MAX_TOTAL_SCSI_DEVICES]; -static int openlist[MAX_TOTAL_SCSI_DEVICES]; -static int waspaused[MAX_TOTAL_SCSI_DEVICES]; -static int delayed[MAX_TOTAL_SCSI_DEVICES]; -static uae_sem_t unitsem[MAX_TOTAL_SCSI_DEVICES]; -static int unitsem_cnt[MAX_TOTAL_SCSI_DEVICES]; - -static int play_end_pos[MAX_TOTAL_SCSI_DEVICES]; -static uae_u8 play_qcode[MAX_TOTAL_SCSI_DEVICES][SUBQ_SIZE]; - -static TCHAR newimagefiles[MAX_TOTAL_SCSI_DEVICES][256]; -static int imagechangetime[MAX_TOTAL_SCSI_DEVICES]; -static bool cdimagefileinuse[MAX_TOTAL_SCSI_DEVICES]; -static int wasopen[MAX_TOTAL_SCSI_DEVICES]; -#endif - static bool dev_init; /* convert minutes, seconds and frames -> logical sector number */ -int msf2lsn(int msf) +int msf2lsn (int msf) { int sector = (((msf >> 16) & 0xff) * 60 * 75 + ((msf >> 8) & 0xff) * 75 + ((msf >> 0) & 0xff)); sector -= 150; @@ -80,7 +56,7 @@ int msf2lsn(int msf) } /* convert logical sector number -> minutes, seconds and frames */ -int lsn2msf(int sectors) +int lsn2msf (int sectors) { int msf; sectors += 150; @@ -90,72 +66,65 @@ int lsn2msf(int sectors) return msf; } -uae_u8 frombcd(uae_u8 v) +uae_u8 frombcd (uae_u8 v) { return (v >> 4) * 10 + (v & 15); } -uae_u8 tobcd(uae_u8 v) +uae_u8 tobcd (uae_u8 v) { return ((v / 10) << 4) | (v % 10); } -int fromlongbcd(uae_u8 *p) +int fromlongbcd (uae_u8 *p) { - return (frombcd(p[0]) << 16) | (frombcd(p[1]) << 8) | (frombcd(p[2]) << 0); + return (frombcd (p[0]) << 16) | (frombcd (p[1]) << 8) | (frombcd (p[2]) << 0); } -void tolongbcd(uae_u8 *p, int v) +void tolongbcd (uae_u8 *p, int v) { - p[0] = tobcd((v >> 16) & 0xff); - p[1] = tobcd((v >> 8) & 0xff); - p[2] = tobcd((v >> 0) & 0xff); + p[0] = tobcd ((v >> 16) & 0xff); + p[1] = tobcd ((v >> 8) & 0xff); + p[2] = tobcd ((v >> 0) & 0xff); } -static struct cd_toc *gettoc(struct cd_toc_head *th, int block) +static struct cd_toc *gettoc (int unitnum, struct cd_toc_head *th, int block) { + if (th->lastaddress == 0) { + if (unitnum < 0) + return NULL; + if (!sys_command_cd_toc(unitnum, th)) + return NULL; + } for (int i = th->first_track_offset + 1; i <= th->last_track_offset; i++) { struct cd_toc *t = &th->toc[i]; if (block < t->paddress) - return t - 1; + return t - 1; } return &th->toc[th->last_track_offset]; } -int isaudiotrack(struct cd_toc_head *th, int block) +int isaudiotrack (struct cd_toc_head *th, int block) { - struct cd_toc *t = gettoc(th, block); + struct cd_toc *t = gettoc (-1, th, block); if (!t) return 0; return (t->control & 0x0c) != 4; } -int isdatatrack(struct cd_toc_head *th, int block) +int isdatatrack (struct cd_toc_head *th, int block) { - return !isaudiotrack(th, block); + return !isaudiotrack (th, block); } static int cdscsidevicetype[MAX_TOTAL_SCSI_DEVICES]; -//#ifdef _WIN32 -// -//#include "od-win32/win32.h" -// -//extern struct device_functions devicefunc_win32_spti; -//extern struct device_functions devicefunc_win32_ioctl; -// -//#endif - -extern struct device_functions devicefunc_cdimage; - static struct device_functions *devicetable[] = { NULL, &devicefunc_cdimage, -//#ifdef _WIN32 -// &devicefunc_win32_ioctl, -// &devicefunc_win32_spti, -//#endif - NULL + NULL, + NULL, }; -static int driver_installed[6]; +#define NUM_DEVICE_TABLE_ENTRIES 4 +static int driver_installed[NUM_DEVICE_TABLE_ENTRIES]; -static void install_driver(int flags) +static void install_driver (int flags) { for (int i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { struct blkdevstate *st = &state[i]; @@ -166,30 +135,49 @@ static void install_driver(int flags) if (flags > 0) { state[0].device_func = devicetable[flags]; state[0].scsiemu = true; - } - else { + } else { for (int i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { struct blkdevstate *st = &state[i]; st->scsiemu = false; st->device_func = NULL; switch (cdscsidevicetype[i]) { - case SCSI_UNIT_IMAGE: - st->device_func = devicetable[SCSI_UNIT_IMAGE]; - st->scsiemu = true; - break; + case SCSI_UNIT_IMAGE: + st->device_func = devicetable[SCSI_UNIT_IMAGE]; + st->scsiemu = true; + break; } - } + // do not default to image mode if unit 1+ and automount + if (i == 0) { + // use image mode if driver disabled + for (int j = 1; j < NUM_DEVICE_TABLE_ENTRIES; j++) { + if (devicetable[j] == st->device_func && driver_installed[j] < 0) { + st->device_func = devicetable[SCSI_UNIT_IMAGE]; + st->scsiemu = true; + } + } + } + } } - for (int j = 1; devicetable[j]; j++) { + for (int j = 1; j < NUM_DEVICE_TABLE_ENTRIES; j++) { + if (devicetable[j] == NULL) { + continue; + } if (!driver_installed[j]) { for (int i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { struct blkdevstate *st = &state[i]; if (st->device_func == devicetable[j]) { - int ok = st->device_func->openbus(0); - driver_installed[j] = 1; - write_log(_T("%s driver installed, ok=%d\n"), st->device_func->name, ok); + int ok = st->device_func->openbus (0); + if (!ok && st->device_func != devicetable[SCSI_UNIT_IMAGE]) { + st->device_func = devicetable[SCSI_UNIT_IMAGE]; + st->scsiemu = true; + write_log (_T("Fallback to image mode, unit %d.\n"), i); + driver_installed[j] = -1; + } else { + driver_installed[j] = 1; + } + write_log (_T("%s driver installed, ok=%d\n"), st->device_func->name, ok); break; } } @@ -198,17 +186,18 @@ static void install_driver(int flags) } -void blkdev_default_prefs(struct uae_prefs *p) +void blkdev_default_prefs (struct uae_prefs *p) { for (int i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { p->cdslots[i].name[0] = 0; p->cdslots[i].inuse = false; p->cdslots[i].type = SCSI_UNIT_DEFAULT; + p->cdslots[i].temporary = false; cdscsidevicetype[i] = SCSI_UNIT_DEFAULT; } } -void blkdev_fix_prefs(struct uae_prefs *p) +void blkdev_fix_prefs (struct uae_prefs *p) { for (int i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { cdscsidevicetype[i] = p->cdslots[i].type; @@ -226,149 +215,148 @@ void blkdev_fix_prefs(struct uae_prefs *p) } -static bool getsem(int unitnum, bool dowait) +static bool getsem (int unitnum, bool dowait) { struct blkdevstate *st = &state[unitnum]; if (st->sema == NULL) - uae_sem_init(&st->sema, 0, 1); + uae_sem_init (&st->sema, 0, 1); bool gotit = false; if (dowait) { - uae_sem_wait(&st->sema); + uae_sem_wait (&st->sema); gotit = true; - } - else { - gotit = uae_sem_trywait(&st->sema) == 0; + } else { + gotit = uae_sem_trywait (&st->sema) == 0; } if (gotit) st->sema_cnt++; if (st->sema_cnt > 1) - write_log(_T("CD: unitsem%d acquire mismatch! cnt=%d\n"), unitnum, st->sema_cnt); + write_log (_T("CD: unitsem%d acquire mismatch! cnt=%d\n"), unitnum, st->sema_cnt); return gotit; } -static bool getsem(int unitnum) +static bool getsem (int unitnum) { - return getsem(unitnum, false); + return getsem (unitnum, false); } -static void freesem(int unitnum) +static void freesem (int unitnum) { struct blkdevstate *st = &state[unitnum]; st->sema_cnt--; if (st->sema_cnt < 0) - write_log(_T("CD: unitsem%d release mismatch! cnt=%d\n"), unitnum, st->sema_cnt); - uae_sem_post(&st->sema); + write_log (_T("CD: unitsem%d release mismatch! cnt=%d\n"), unitnum, st->sema_cnt); + uae_sem_post (&st->sema); } -static void sys_command_close_internal(int unitnum) +static void sys_command_close_internal (int unitnum) { struct blkdevstate *st = &state[unitnum]; - getsem(unitnum, true); + getsem (unitnum, true); st->waspaused = 0; if (st->isopen <= 0) - write_log(_T("BUG unit %d close: opencnt=%d!\n"), unitnum, st->isopen); + write_log (_T("BUG unit %d close: opencnt=%d!\n"), unitnum, st->isopen); if (st->device_func) { - state[unitnum].device_func->closedev(unitnum); + state[unitnum].device_func->closedev (unitnum); if (st->isopen > 0) st->isopen--; } - freesem(unitnum); + freesem (unitnum); if (st->isopen == 0) { - uae_sem_destroy(&st->sema); + uae_sem_destroy (&st->sema); st->sema = NULL; } } -static int sys_command_open_internal(int unitnum, const TCHAR *ident, cd_standard_unit csu) +static int sys_command_open_internal (int unitnum, const TCHAR *ident, cd_standard_unit csu) { struct blkdevstate *st = &state[unitnum]; int ret = 0; if (st->sema == NULL) - uae_sem_init(&st->sema, 0, 1); - getsem(unitnum, true); + uae_sem_init (&st->sema, 0, 1); + getsem (unitnum, true); if (st->isopen) - write_log(_T("BUG unit %d open: opencnt=%d!\n"), unitnum, st->isopen); + write_log (_T("BUG unit %d open: opencnt=%d!\n"), unitnum, st->isopen); if (st->device_func) { - ret = state[unitnum].device_func->opendev(unitnum, ident, csu != CD_STANDARD_UNIT_DEFAULT); + ret = state[unitnum].device_func->opendev (unitnum, ident, csu != CD_STANDARD_UNIT_DEFAULT); if (ret) st->isopen++; } - freesem(unitnum); + freesem (unitnum); return ret; } -static int getunitinfo(int unitnum, int drive, cd_standard_unit csu, int *isaudio) +static int getunitinfo (int unitnum, int drive, cd_standard_unit csu, int *isaudio) { struct device_info di; - if (sys_command_info(unitnum, &di, 0)) { - write_log(_T("Scanning drive %s: "), di.label); + if (sys_command_info (unitnum, &di, 0)) { + write_log (_T("Scanning drive %s: "), di.label); if (di.media_inserted) { - if (isaudiotrack(&di.toc, 0)) { + if (isaudiotrack (&di.toc, 0)) { if (*isaudio == 0) *isaudio = drive; - write_log(_T("CDA")); + write_log (_T("CDA")); } uae_u8 buffer[2048]; - if (sys_command_cd_read(unitnum, buffer, 16, 1)) { - if (!memcmp(buffer + 8, "CDTV", 4) || !memcmp(buffer + 8, "CD32", 4) || !memcmp(buffer + 8, "COMM", 4)) { + if (sys_command_cd_read (unitnum, buffer, 16, 1)) { + if (!memcmp (buffer + 8, "CDTV", 4) || !memcmp (buffer + 8, "CD32", 4) || !memcmp (buffer + 8, "COMM", 4)) { uae_u32 crc; - write_log(_T("CD32 or CDTV")); - if (sys_command_cd_read(unitnum, buffer, 21, 1)) { - crc = get_crc32(buffer, sizeof buffer); + write_log (_T("CD32 or CDTV")); + if (sys_command_cd_read (unitnum, buffer, 21, 1)) { + crc = get_crc32 (buffer, sizeof buffer); if (crc == 0xe56c340f) { - write_log(_T(" [CD32.TM]")); + write_log (_T(" [CD32.TM]")); if (csu == CD_STANDARD_UNIT_CD32) { - write_log(_T("\n")); + write_log (_T("\n")); return 1; } } } if (csu == CD_STANDARD_UNIT_CDTV || csu == CD_STANDARD_UNIT_CD32) { - write_log(_T("\n")); + write_log (_T("\n")); return 1; } } } - } - else { - write_log(_T("no media")); + } else { + write_log (_T("no media")); } } - write_log(_T("\n")); + write_log (_T("\n")); return 0; } -static int get_standard_cd_unit2(struct uae_prefs *p, cd_standard_unit csu) +static int get_standard_cd_unit2 (struct uae_prefs *p, cd_standard_unit csu) { int unitnum = 0; int isaudio = 0; if (p->cdslots[unitnum].name[0] || p->cdslots[unitnum].inuse) { if (p->cdslots[unitnum].name[0]) { - device_func_init(SCSI_UNIT_IMAGE); - if (!sys_command_open_internal(unitnum, p->cdslots[unitnum].name, csu)) + device_func_init (SCSI_UNIT_IMAGE); + if (!sys_command_open_internal (unitnum, p->cdslots[unitnum].name, csu)) goto fallback; - } - else { + } else { goto fallback; } return unitnum; } - + if (isaudio) { + TCHAR vol[100]; + _stprintf (vol, _T("%c:\\"), isaudio); + if (sys_command_open_internal (unitnum, vol, csu)) + return unitnum; + } fallback: - device_func_init(SCSI_UNIT_IMAGE); - if (!sys_command_open_internal(unitnum, _T(""), csu)) { - write_log(_T("image mounter failed to open as empty!?\n")); + device_func_init (SCSI_UNIT_IMAGE); + if (!sys_command_open_internal (unitnum, _T(""), csu)) { + write_log (_T("image mounter failed to open as empty!?\n")); return -1; } return unitnum; } -int get_standard_cd_unit(cd_standard_unit csu) +int get_standard_cd_unit (cd_standard_unit csu) { - int unitnum = get_standard_cd_unit2(&currprefs, csu); + int unitnum = get_standard_cd_unit2 (&currprefs, csu); if (unitnum < 0) return -1; struct blkdevstate *st = &state[unitnum]; -#ifdef RETROPLATFORM - rp_cd_device_enable(unitnum, true); -#endif st->delayed = 0; if (currprefs.cdslots[unitnum].delayed) { st->delayed = PRE_INSERT_DELAY; @@ -376,24 +364,23 @@ int get_standard_cd_unit(cd_standard_unit csu) return unitnum; } -void close_standard_cd_unit(int unitnum) +void close_standard_cd_unit (int unitnum) { - sys_command_close(unitnum); + sys_command_close (unitnum); } -int sys_command_isopen(int unitnum) +int sys_command_isopen (int unitnum) { struct blkdevstate *st = &state[unitnum]; return st->isopen; } -int sys_command_open(int unitnum) +int sys_command_open (int unitnum) { struct blkdevstate *st = &state[unitnum]; - blkdev_fix_prefs(&currprefs); + blkdev_fix_prefs (&currprefs); if (!dev_init) { - device_func_init(0); - dev_init = true; + device_func_init (0); } if (st->isopen) { @@ -401,38 +388,29 @@ int sys_command_open(int unitnum) return -1; } st->waspaused = 0; - int v = sys_command_open_internal(unitnum, currprefs.cdslots[unitnum].name[0] ? currprefs.cdslots[unitnum].name : NULL, CD_STANDARD_UNIT_DEFAULT); + int v = sys_command_open_internal (unitnum, currprefs.cdslots[unitnum].name[0] ? currprefs.cdslots[unitnum].name : NULL, CD_STANDARD_UNIT_DEFAULT); if (!v) return 0; -#ifdef RETROPLATFORM - rp_cd_device_enable(unitnum, true); -#endif return v; } -void sys_command_close(int unitnum) +void sys_command_close (int unitnum) { struct blkdevstate *st = &state[unitnum]; if (st->isopen > 1) { st->isopen--; return; } -#ifdef RETROPLATFORM - rp_cd_device_enable(unitnum, false); -#endif - sys_command_close_internal(unitnum); + sys_command_close_internal (unitnum); } -void blkdev_cd_change(int unitnum, const TCHAR *name) +void blkdev_cd_change (int unitnum, const TCHAR *name) { struct device_info di; - sys_command_info(unitnum, &di, 1); -#ifdef RETROPLATFORM - rp_cd_image_change(unitnum, name); -#endif + sys_command_info (unitnum, &di, 1); } -void device_func_reset(void) +void device_func_reset (void) { for (int i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { struct blkdevstate *st = &state[i]; @@ -443,65 +421,68 @@ void device_func_reset(void) st->cdimagefileinuse = false; st->newimagefile[0] = 0; } + dev_init = false; } -int device_func_init(int flags) +int device_func_init (int flags) { - blkdev_fix_prefs(&currprefs); - install_driver(flags); + blkdev_fix_prefs (&currprefs); + install_driver (flags); + dev_init = true; return 1; } -bool blkdev_get_info(struct uae_prefs *p, int unitnum, struct device_info *di) +bool blkdev_get_info (struct uae_prefs *p, int unitnum, struct device_info *di) { bool open = true, opened = false, ok = false; struct blkdevstate *st = &state[unitnum]; if (!st->isopen) { - blkdev_fix_prefs(p); - install_driver(0); + blkdev_fix_prefs (p); + install_driver (0); opened = true; - open = sys_command_open_internal(unitnum, p->cdslots[unitnum].name[0] ? p->cdslots[unitnum].name : NULL, CD_STANDARD_UNIT_DEFAULT) != 0; + open = sys_command_open_internal (unitnum, p->cdslots[unitnum].name[0] ? p->cdslots[unitnum].name : NULL, CD_STANDARD_UNIT_DEFAULT) != 0; } if (open) { - ok = sys_command_info(unitnum, di, true) != 0; + ok = sys_command_info (unitnum, di, true) != 0; } if (open && opened) - sys_command_close_internal(unitnum); + sys_command_close_internal (unitnum); return ok; } -void blkdev_entergui(void) +void blkdev_entergui (void) { for (int i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { struct blkdevstate *st = &state[i]; st->waspaused = 0; struct device_info di; - if (sys_command_info(i, &di, 1)) { - if (sys_command_cd_pause(i, 1) == 0) + if (sys_command_info (i, &di, 1)) { + if (sys_command_cd_pause (i, 1) == 0) st->waspaused = 1; } } } -void blkdev_exitgui(void) +void blkdev_exitgui (void) { for (int i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { struct blkdevstate *st = &state[i]; if (st->waspaused) { struct device_info di; - if (sys_command_info(i, &di, 1)) { - sys_command_cd_pause(i, 0); + if (sys_command_info (i, &di, 1)) { + sys_command_cd_pause (i, 0); } } st->waspaused = 0; } } -void check_prefs_changed_cd(void) +void check_prefs_changed_cd (void) { - currprefs.sound_volume_cd = changed_prefs.sound_volume_cd; + if (!config_changed) + return; } -static void check_changes(int unitnum) +static void check_changes (int unitnum) { struct blkdevstate *st = &state[unitnum]; bool changed = false; @@ -513,39 +494,36 @@ static void check_changes(int unitnum) if (st->delayed) { st->delayed--; if (st->delayed == 0) - write_log(_T("CD: startup delayed insert '%s'\n"), currprefs.cdslots[unitnum].name[0] ? currprefs.cdslots[unitnum].name : _T("")); + write_log (_T("CD: startup delayed insert '%s'\n"), currprefs.cdslots[unitnum].name[0] ? currprefs.cdslots[unitnum].name : _T("")); return; } - if (_tcscmp(changed_prefs.cdslots[unitnum].name, currprefs.cdslots[unitnum].name) != 0) + if (_tcscmp (changed_prefs.cdslots[unitnum].name, currprefs.cdslots[unitnum].name) != 0) changed = true; if (!changed && changed_prefs.cdslots[unitnum].name[0] == 0 && changed_prefs.cdslots[unitnum].inuse != currprefs.cdslots[unitnum].inuse) changed = true; if (changed) { - bool wasimage = currprefs.cdslots[unitnum].name[0] != 0; if (st->sema) - gotsem = getsem(unitnum, true); + gotsem = getsem (unitnum, true); st->cdimagefileinuse = changed_prefs.cdslots[unitnum].inuse; - _tcscpy(st->newimagefile, changed_prefs.cdslots[unitnum].name); + _tcscpy (st->newimagefile, changed_prefs.cdslots[unitnum].name); changed_prefs.cdslots[unitnum].name[0] = currprefs.cdslots[unitnum].name[0] = 0; currprefs.cdslots[unitnum].inuse = changed_prefs.cdslots[unitnum].inuse; int pollmode = 0; st->imagechangetime = 3 * 50; struct device_info di; - st->device_func->info(unitnum, &di, 0, -1); + st->device_func->info (unitnum, &di, 0, -1); if (st->wasopen >= 0) st->wasopen = di.open ? 1 : 0; if (st->wasopen) { - st->device_func->closedev(unitnum); + st->device_func->closedev (unitnum); st->wasopen = -1; } - write_log(_T("CD: eject (%s) open=%d\n"), pollmode ? _T("slow") : _T("fast"), st->wasopen ? 1 : 0); -#ifdef RETROPLATFORM - rp_cd_image_change(unitnum, NULL); -#endif + write_log (_T("CD: eject (%s) open=%d\n"), pollmode ? _T("slow") : _T("fast"), st->wasopen ? 1 : 0); + if (gotsem) { - freesem(unitnum); + freesem (unitnum); gotsem = false; } } @@ -555,53 +533,51 @@ static void check_changes(int unitnum) if (st->imagechangetime > 0) return; if (st->sema) - gotsem = getsem(unitnum, true); - _tcscpy(currprefs.cdslots[unitnum].name, st->newimagefile); - _tcscpy(changed_prefs.cdslots[unitnum].name, st->newimagefile); + gotsem = getsem (unitnum, true); + _tcscpy (currprefs.cdslots[unitnum].name, st->newimagefile); + _tcscpy (changed_prefs.cdslots[unitnum].name, st->newimagefile); currprefs.cdslots[unitnum].inuse = changed_prefs.cdslots[unitnum].inuse = st->cdimagefileinuse; st->newimagefile[0] = 0; - write_log(_T("CD: delayed insert '%s' (open=%d,unit=%d)\n"), currprefs.cdslots[unitnum].name[0] ? currprefs.cdslots[unitnum].name : _T(""), st->wasopen ? 1 : 0, unitnum); - device_func_init(0); + write_log (_T("CD: delayed insert '%s' (open=%d,unit=%d)\n"), currprefs.cdslots[unitnum].name[0] ? currprefs.cdslots[unitnum].name : _T(""), st->wasopen ? 1 : 0, unitnum); + device_func_init (0); if (st->wasopen) { - if (!st->device_func->opendev(unitnum, currprefs.cdslots[unitnum].name, 0)) { - write_log(_T("-> device open failed\n")); + if (!st->device_func->opendev (unitnum, currprefs.cdslots[unitnum].name, 0)) { + write_log (_T("-> device open failed\n")); st->wasopen = 0; - } - else { + } else { st->wasopen = 1; - write_log(_T("-> device reopened\n")); + write_log (_T("-> device reopened\n")); } } st->mediawaschanged = true; -#ifdef RETROPLATFORM - rp_cd_image_change(unitnum, currprefs.cdslots[unitnum].name); -#endif if (gotsem) { - freesem(unitnum); + freesem (unitnum); gotsem = false; } + + set_config_changed (); } -void blkdev_vsync(void) +void blkdev_vsync (void) { for (int i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) - check_changes(i); + check_changes (i); } -static int do_scsi(int unitnum, uae_u8 *cmd, int cmdlen) +static int do_scsi (int unitnum, uae_u8 *cmd, int cmdlen) { - uae_u8 *p = state[unitnum].device_func->exec_out(unitnum, cmd, cmdlen); + uae_u8 *p = state[unitnum].device_func->exec_out (unitnum, cmd, cmdlen); return p != NULL; } -static int do_scsi(int unitnum, uae_u8 *cmd, int cmdlen, uae_u8 *out, int outsize) +static int do_scsi (int unitnum, uae_u8 *cmd, int cmdlen, uae_u8 *out, int outsize) { - uae_u8 *p = state[unitnum].device_func->exec_in(unitnum, cmd, cmdlen, &outsize); + uae_u8 *p = state[unitnum].device_func->exec_in (unitnum, cmd, cmdlen, &outsize); if (p) - memcpy(out, p, outsize); + memcpy (out, p, outsize); return p != NULL; } -static int failunit(int unitnum) +static int failunit (int unitnum) { if (unitnum < 0 || unitnum >= MAX_TOTAL_SCSI_DEVICES) return 1; @@ -610,70 +586,68 @@ static int failunit(int unitnum) return 0; } -static int audiostatus(int unitnum) +static int audiostatus (int unitnum) { - if (!getsem(unitnum)) + if (!getsem (unitnum)) return 0; - uae_u8 cmd[10] = { 0x42, 2, 0x40, 1, 0, 0, 0, (uae_u8)(DEVICE_SCSI_BUFSIZE >> 8), (uae_u8)(DEVICE_SCSI_BUFSIZE & 0xff), 0 }; - uae_u8 *p = state[unitnum].device_func->exec_in(unitnum, cmd, sizeof(cmd), 0); - freesem(unitnum); + uae_u8 cmd[10] = {0x42,2,0x40,1,0,0,0,(uae_u8)(DEVICE_SCSI_BUFSIZE>>8),(uae_u8)(DEVICE_SCSI_BUFSIZE&0xff),0}; + uae_u8 *p = state[unitnum].device_func->exec_in (unitnum, cmd, sizeof (cmd), 0); + freesem (unitnum); if (!p) return 0; return p[1]; } /* pause/unpause CD audio */ -int sys_command_cd_pause(int unitnum, int paused) +int sys_command_cd_pause (int unitnum, int paused) { - if (failunit(unitnum)) + if (failunit (unitnum)) return -1; - if (!getsem(unitnum)) + if (!getsem (unitnum)) return 0; int v; if (state[unitnum].device_func->pause == NULL) { - int as = audiostatus(unitnum); - uae_u8 cmd[10] = { 0x4b, 0, 0, 0, 0, 0, 0, 0, paused ? static_cast(0) : static_cast(1), 0 }; - do_scsi(unitnum, cmd, sizeof cmd); + int as = audiostatus (unitnum); + uae_u8 cmd[10] = {0x4b,0,0,0,0,0,0,0,(uae_u8)(paused?0:1),0}; + do_scsi (unitnum, cmd, sizeof cmd); v = as == AUDIO_STATUS_PAUSED; + } else { + v = state[unitnum].device_func->pause (unitnum, paused); } - else { - v = state[unitnum].device_func->pause(unitnum, paused); - } - freesem(unitnum); + freesem (unitnum); return v; } /* stop CD audio */ -void sys_command_cd_stop(int unitnum) +void sys_command_cd_stop (int unitnum) { - if (failunit(unitnum)) + if (failunit (unitnum)) return; - if (!getsem(unitnum)) + if (!getsem (unitnum)) return; if (state[unitnum].device_func->stop == NULL) { - int as = audiostatus(unitnum); - uae_u8 cmd[6] = { 0x4e, 0, 0, 0, 0, 0 }; - do_scsi(unitnum, cmd, sizeof cmd); + int as = audiostatus (unitnum); + uae_u8 cmd[6] = {0x4e,0,0,0,0,0}; + do_scsi (unitnum, cmd, sizeof cmd); + } else { + state[unitnum].device_func->stop (unitnum); } - else { - state[unitnum].device_func->stop(unitnum); - } - freesem(unitnum); + freesem (unitnum); } /* play CD audio */ -int sys_command_cd_play(int unitnum, int startlsn, int endlsn, int scan) +int sys_command_cd_play (int unitnum, int startlsn, int endlsn, int scan) { int v; - if (failunit(unitnum)) + if (failunit (unitnum)) return 0; - if (!getsem(unitnum)) + if (!getsem (unitnum)) return 0; state[unitnum].play_end_pos = endlsn; if (state[unitnum].device_func->play == NULL) { - uae_u8 cmd[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int startmsf = lsn2msf(startlsn); - int endmsf = lsn2msf(endlsn); + uae_u8 cmd[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; + int startmsf = lsn2msf (startlsn); + int endmsf = lsn2msf (endlsn); cmd[0] = 0x47; cmd[3] = (uae_u8)(startmsf >> 16); cmd[4] = (uae_u8)(startmsf >> 8); @@ -681,234 +655,242 @@ int sys_command_cd_play(int unitnum, int startlsn, int endlsn, int scan) cmd[6] = (uae_u8)(endmsf >> 16); cmd[7] = (uae_u8)(endmsf >> 8); cmd[8] = (uae_u8)(endmsf >> 0); - v = do_scsi(unitnum, cmd, sizeof cmd) ? 0 : 1; + v = do_scsi (unitnum, cmd, sizeof cmd) ? 0 : 1; + } else { + v = state[unitnum].device_func->play (unitnum, startlsn, endlsn, scan, NULL, NULL); } - else { - v = state[unitnum].device_func->play(unitnum, startlsn, endlsn, scan, NULL, NULL); - } - freesem(unitnum); + freesem (unitnum); return v; } /* play CD audio with subchannels */ -int sys_command_cd_play(int unitnum, int startlsn, int endlsn, int scan, play_status_callback statusfunc, play_subchannel_callback subfunc) +int sys_command_cd_play (int unitnum, int startlsn, int endlsn, int scan, play_status_callback statusfunc, play_subchannel_callback subfunc) { int v; - if (failunit(unitnum)) + if (failunit (unitnum)) return 0; - if (!getsem(unitnum)) + if (!getsem (unitnum)) return 0; + state[unitnum].play_end_pos = endlsn; if (state[unitnum].device_func->play == NULL) - v = sys_command_cd_play(unitnum, startlsn, endlsn, scan); + v = sys_command_cd_play (unitnum, startlsn, endlsn, scan); else - v = state[unitnum].device_func->play(unitnum, startlsn, endlsn, scan, statusfunc, subfunc); - freesem(unitnum); + v = state[unitnum].device_func->play (unitnum, startlsn, endlsn, scan, statusfunc, subfunc); + freesem (unitnum); return v; } /* set CD audio volume */ -uae_u32 sys_command_cd_volume(int unitnum, uae_u16 volume_left, uae_u16 volume_right) +uae_u32 sys_command_cd_volume (int unitnum, uae_u16 volume_left, uae_u16 volume_right) { int v; - if (failunit(unitnum)) + if (failunit (unitnum)) return 0; - if (!getsem(unitnum)) + if (!getsem (unitnum)) return 0; if (state[unitnum].device_func->volume == NULL) v = -1; else - v = state[unitnum].device_func->volume(unitnum, volume_left, volume_right); - freesem(unitnum); + v = state[unitnum].device_func->volume (unitnum, volume_left, volume_right); + freesem (unitnum); return v; } /* read qcode */ -int sys_command_cd_qcode(int unitnum, uae_u8 *buf) +int sys_command_cd_qcode (int unitnum, uae_u8 *buf, int sector, bool all) { int v; - if (failunit(unitnum)) + if (failunit (unitnum)) return 0; - if (!getsem(unitnum)) + if (!getsem (unitnum)) return 0; if (state[unitnum].device_func->qcode == NULL) { - uae_u8 cmd[10] = { 0x42, 2, 0x40, 1, 0, 0, 0, (uae_u8)(SUBQ_SIZE >> 8), (uae_u8)(SUBQ_SIZE & 0xff), 0 }; - v = do_scsi(unitnum, cmd, sizeof cmd, buf, SUBQ_SIZE); + if (all) { + v = 0; + } else { + uae_u8 cmd[10] = {0x42,2,0x40,1,0,0,0,(uae_u8)(SUBQ_SIZE>>8),(uae_u8)(SUBQ_SIZE&0xff),0}; + v = do_scsi (unitnum, cmd, sizeof cmd, buf, SUBQ_SIZE); + } + } else { + v = state[unitnum].device_func->qcode (unitnum, buf, sector, all); } - else { - v = state[unitnum].device_func->qcode(unitnum, buf, -1); - } - freesem(unitnum); + freesem (unitnum); return v; -} -; +}; /* read table of contents */ -int sys_command_cd_toc(int unitnum, struct cd_toc_head *toc) +int sys_command_cd_toc (int unitnum, struct cd_toc_head *toc) { int v; - if (failunit(unitnum)) + if (failunit (unitnum)) return 0; - if (!getsem(unitnum)) + if (!getsem (unitnum)) return 0; if (state[unitnum].device_func->toc == NULL) { uae_u8 buf[4 + 8 * 103]; int size = sizeof buf; - uae_u8 cmd[10] = { 0x43, 0, 2, 0, 0, 0, 0, (uae_u8)(size >> 8), (uae_u8)(size & 0xff), 0 }; - if (do_scsi(unitnum, cmd, sizeof cmd, buf, size)) { + uae_u8 cmd [10] = { 0x43,0,2,0,0,0,0,(uae_u8)(size>>8),(uae_u8)(size&0xff),0}; + if (do_scsi (unitnum, cmd, sizeof cmd, buf, size)) { // toc parse to do v = 0; } v = 0; + } else { + v = state[unitnum].device_func->toc (unitnum, toc); } - else { - v = state[unitnum].device_func->toc(unitnum, toc); - } - freesem(unitnum); + freesem (unitnum); return v; } /* read one cd sector */ -int sys_command_cd_read(int unitnum, uae_u8 *data, int block, int size) +int sys_command_cd_read (int unitnum, uae_u8 *data, int block, int size) { int v; - if (failunit(unitnum)) + if (failunit (unitnum)) return 0; - if (!getsem(unitnum)) + if (!getsem (unitnum)) return 0; if (state[unitnum].device_func->read == NULL) { - - uae_u8 cmd1[12] = { 0x28, 0, static_cast(block >> 24), static_cast(block >> 16), static_cast(block >> 8), static_cast(block >> 0), 0, static_cast(size >> 8), static_cast(size >> 0), 0, 0, 0 }; - v = do_scsi(unitnum, cmd1, sizeof cmd1, data, size * 2048); -#if 0 - if (!v) { - uae_u8 cmd2[12] = { 0xbe, 0, block >> 24, block >> 16, block >> 8, block >> 0, size >> 16, size >> 8, size >> 0, 0x10, 0, 0 }; - v = do_scsi(unitnum, cmd2, sizeof cmd2, data, size * 2048); - } -#endif + uae_u8 cmd1[12] = { 0x28, 0, (uae_u8)(block >> 24), (uae_u8)(block >> 16), (uae_u8)(block >> 8), (uae_u8)(block >> 0), 0, (uae_u8)(size >> 8), (uae_u8)(size >> 0), 0, 0, 0 }; + v = do_scsi (unitnum, cmd1, sizeof cmd1, data, size * 2048); + } else { + v = state[unitnum].device_func->read (unitnum, data, block, size); } - else { - v = state[unitnum].device_func->read(unitnum, data, block, size); - } - freesem(unitnum); + freesem (unitnum); return v; } -int sys_command_cd_rawread(int unitnum, uae_u8 *data, int block, int size, int sectorsize) +int sys_command_cd_rawread (int unitnum, uae_u8 *data, int block, int size, int sectorsize) { int v; - if (failunit(unitnum)) + if (failunit (unitnum)) return -1; - if (!getsem(unitnum)) + if (!getsem (unitnum)) return 0; if (state[unitnum].device_func->rawread == NULL) { - uae_u8 cmd[12] = { 0xbe, 0, static_cast(block >> 24), static_cast(block >> 16), static_cast(block >> 8), static_cast(block >> 0), static_cast(size >> 16), static_cast(size >> 8), static_cast(size >> 0), 0x10, 0, 0}; - v = do_scsi(unitnum, cmd, sizeof cmd, data, size * sectorsize); + uae_u8 cmd[12] = { 0xbe, 0, (uae_u8)(block >> 24), (uae_u8)(block >> 16), (uae_u8)(block >> 8), (uae_u8)(block >> 0), (uae_u8)(size >> 16), (uae_u8)(size >> 8), (uae_u8)(size >> 0), 0x10, 0, 0 }; + v = do_scsi (unitnum, cmd, sizeof cmd, data, size * sectorsize); + } else { + v = state[unitnum].device_func->rawread (unitnum, data, block, size, sectorsize, 0xffffffff); } - else { - v = state[unitnum].device_func->rawread(unitnum, data, block, size, sectorsize, 0xffffffff); - } - freesem(unitnum); + freesem (unitnum); return v; } -int sys_command_cd_rawread(int unitnum, uae_u8 *data, int block, int size, int sectorsize, uae_u8 sectortype, uae_u8 scsicmd9, uae_u8 subs) +int sys_command_cd_rawread (int unitnum, uae_u8 *data, int block, int size, int sectorsize, uae_u8 sectortype, uae_u8 scsicmd9, uae_u8 subs) { int v; - if (failunit(unitnum)) + if (failunit (unitnum)) return -1; - if (!getsem(unitnum)) + if (!getsem (unitnum)) return 0; if (state[unitnum].device_func->rawread == NULL) { - uae_u8 cmd[12] = { 0xbe, 0, static_cast(block >> 24), static_cast(block >> 16), static_cast(block >> 8), static_cast(block >> 0), static_cast(size >> 16), static_cast(size >> 8), static_cast(size >> 0), 0x10, 0, 0}; - v = do_scsi(unitnum, cmd, sizeof cmd, data, size * sectorsize); + uae_u8 cmd[12] = { 0xbe, 0, (uae_u8)(block >> 24), (uae_u8)(block >> 16), (uae_u8)(block >> 8), (uae_u8)(block >> 0), (uae_u8)(size >> 16), (uae_u8)(size >> 8), (uae_u8)(size >> 0), 0x10, 0, 0 }; + v = do_scsi (unitnum, cmd, sizeof cmd, data, size * sectorsize); + } else { + v = state[unitnum].device_func->rawread (unitnum, data, block, size, sectorsize, (sectortype << 16) | (scsicmd9 << 8) | subs); } - else { - v = state[unitnum].device_func->rawread(unitnum, data, block, size, sectorsize, (sectortype << 16) | (scsicmd9 << 8) | subs); - } - freesem(unitnum); + freesem (unitnum); return v; } /* read block */ -int sys_command_read(int unitnum, uae_u8 *data, int block, int size) +int sys_command_read (int unitnum, uae_u8 *data, int block, int size) { int v; - if (failunit(unitnum)) + if (failunit (unitnum)) return 0; - if (!getsem(unitnum)) + if (!getsem (unitnum)) return 0; if (state[unitnum].device_func->read == NULL) { - uae_u8 cmd[12] = { 0xa8, 0, 0, 0, 0, 0, static_cast(size >> 24), static_cast(size >> 16), static_cast(size >> 8), static_cast(size >> 0), 0, 0}; + uae_u8 cmd[12] = { 0xa8, 0, 0, 0, 0, 0, (uae_u8)(size >> 24), (uae_u8)(size >> 16), (uae_u8)(size >> 8), (uae_u8)(size >> 0), 0, 0 }; cmd[2] = (uae_u8)(block >> 24); cmd[3] = (uae_u8)(block >> 16); cmd[4] = (uae_u8)(block >> 8); cmd[5] = (uae_u8)(block >> 0); - v = do_scsi(unitnum, cmd, sizeof cmd, data, size * 2048); + v = do_scsi (unitnum, cmd, sizeof cmd, data, size * 2048); + } else { + v = state[unitnum].device_func->read (unitnum, data, block, size); } - else { - v = state[unitnum].device_func->read(unitnum, data, block, size); - } - freesem(unitnum); + freesem (unitnum); return v; } /* write block */ -int sys_command_write(int unitnum, uae_u8 *data, int offset, int size) +int sys_command_write (int unitnum, uae_u8 *data, int offset, int size) { int v; - if (failunit(unitnum)) + if (failunit (unitnum)) return 0; - if (!getsem(unitnum)) + if (!getsem (unitnum)) return 0; if (state[unitnum].device_func->write == NULL) { v = 0; + } else { + v = state[unitnum].device_func->write (unitnum, data, offset, size); } - else { - v = state[unitnum].device_func->write(unitnum, data, offset, size); - } - freesem(unitnum); + freesem (unitnum); return v; } -int sys_command_ismedia(int unitnum, int quick) +int sys_command_ismedia (int unitnum, int quick) { int v; struct blkdevstate *st = &state[unitnum]; - if (failunit(unitnum)) + if (failunit (unitnum)) return -1; if (st->delayed) return 0; - if (!getsem(unitnum)) + if (!getsem (unitnum)) return 0; if (state[unitnum].device_func->ismedia == NULL) { uae_u8 cmd[6] = { 0, 0, 0, 0, 0, 0 }; - v = do_scsi(unitnum, cmd, sizeof cmd); + v = do_scsi (unitnum, cmd, sizeof cmd); + } else { + v = state[unitnum].device_func->ismedia (unitnum, quick); } - else { - v = state[unitnum].device_func->ismedia(unitnum, quick); - } - freesem(unitnum); + freesem (unitnum); return v; } -struct device_info *sys_command_info_session(int unitnum, struct device_info *di, int quick, int session) +struct device_info *sys_command_info_session (int unitnum, struct device_info *di, int quick, int session) { struct blkdevstate *st = &state[unitnum]; - if (failunit(unitnum)) + if (failunit (unitnum)) return NULL; - if (!getsem(unitnum)) + if (!getsem (unitnum)) return 0; if (st->device_func->info == NULL) return 0; - struct device_info *di2 = st->device_func->info(unitnum, di, quick, -1); + struct device_info *di2 = st->device_func->info (unitnum, di, quick, -1); if (di2) st->type = di2->type; if (di2 && st->delayed) di2->media_inserted = 0; - freesem(unitnum); + freesem (unitnum); return di2; } -struct device_info *sys_command_info(int unitnum, struct device_info *di, int quick) +struct device_info *sys_command_info (int unitnum, struct device_info *di, int quick) { - return sys_command_info_session(unitnum, di, quick, -1) ; + struct device_info *dix; + + dix = sys_command_info_session (unitnum, di, quick, -1); + if (dix && dix->media_inserted && !quick && !dix->audio_playing) { + TCHAR *name = NULL; + uae_u8 buf[2048]; + if (sys_command_cd_read(unitnum, buf, 16, 1)) { + if ((buf[0] == 1 || buf[0] == 2) && !memcmp(buf + 1, "CD001", 5)) { + TCHAR *p; + au_copy(dix->volume_id, 32, (uae_char*)buf + 40); + au_copy(dix->system_id, 32, (uae_char*)buf + 8); + p = dix->volume_id + _tcslen(dix->volume_id) - 1; + while (p > dix->volume_id && *p == ' ') + *p-- = 0; + p = dix->system_id + _tcslen(dix->system_id) - 1; + while (p > dix->system_id && *p == ' ') + *p-- = 0; + } + } + } + return dix; } #define MODE_SELECT_6 0x15 @@ -916,1239 +898,1206 @@ struct device_info *sys_command_info(int unitnum, struct device_info *di, int qu #define MODE_SELECT_10 0x55 #define MODE_SENSE_10 0x5a -void scsi_atapi_fixup_pre(uae_u8 *scsi_cmd, int *len, uae_u8 **datap, int *datalenp, int *parm) +void scsi_atapi_fixup_pre (uae_u8 *scsi_cmd, int *len, uae_u8 **datap, int *datalenp, int *parm) { - uae_u8 cmd, - *p, - *data = *datap ; - int l, - datalen = *datalenp ; + uae_u8 cmd, *p, *data = *datap; + int l, datalen = *datalenp; - *parm = 0 ; - cmd = scsi_cmd[0] ; - if(cmd != MODE_SELECT_6 && cmd != MODE_SENSE_6) - return ; - l = scsi_cmd[4] ; - if(l > 4) - l += 4 ; - scsi_cmd[7] = l >> 8 ; - scsi_cmd[8] = l ; - if(cmd == MODE_SELECT_6) { - scsi_cmd[0] = MODE_SELECT_10 ; - scsi_cmd[9] = scsi_cmd[5] ; - scsi_cmd[2] = scsi_cmd[3] = scsi_cmd[4] = scsi_cmd[5] = scsi_cmd[6] = 0 ; - *len = 10 ; - p = xmalloc(uae_u8, 8 + datalen + 4) ; - if(datalen > 4) - memcpy(p + 8, data + 4, datalen - 4) ; -p[0] = 0 ; -p[1] = data[0] ; -p[2] = data[1] ; -p[3] = data[2] ; -p[4] = p[5] = p[6] = 0 ; -p[7] = data[3] ; -if(l > 8) - datalen += 4 ; -*parm = MODE_SELECT_10 ; -*datap = p ; -} else { - scsi_cmd[0] = MODE_SENSE_10 ; - scsi_cmd[9] = scsi_cmd[5] ; - scsi_cmd[3] = scsi_cmd[4] = scsi_cmd[5] = scsi_cmd[6] = 0 ; - if(l > 8) - datalen += 4 ; -*datap = xmalloc(uae_u8, datalen) ; -*len = 10 ; -*parm = MODE_SENSE_10 ; -} -*datalenp = datalen ; + *parm = 0; + cmd = scsi_cmd[0]; + if (cmd != MODE_SELECT_6 && cmd != MODE_SENSE_6) + return; + l = scsi_cmd[4]; + if (l > 4) + l += 4; + scsi_cmd[7] = l >> 8; + scsi_cmd[8] = l; + if (cmd == MODE_SELECT_6) { + scsi_cmd[0] = MODE_SELECT_10; + scsi_cmd[9] = scsi_cmd[5]; + scsi_cmd[2] = scsi_cmd[3] = scsi_cmd[4] = scsi_cmd[5] = scsi_cmd[6] = 0; + *len = 10; + p = xmalloc (uae_u8, 8 + datalen + 4); + if (datalen > 4) + memcpy (p + 8, data + 4, datalen - 4); + p[0] = 0; + p[1] = data[0]; + p[2] = data[1]; + p[3] = data[2]; + p[4] = p[5] = p[6] = 0; + p[7] = data[3]; + if (l > 8) + datalen += 4; + *parm = MODE_SELECT_10; + *datap = p; + } else { + scsi_cmd[0] = MODE_SENSE_10; + scsi_cmd[9] = scsi_cmd[5]; + scsi_cmd[3] = scsi_cmd[4] = scsi_cmd[5] = scsi_cmd[6] = 0; + if (l > 8) + datalen += 4; + *datap = xmalloc (uae_u8, datalen); + *len = 10; + *parm = MODE_SENSE_10; + } + *datalenp = datalen; } -void scsi_atapi_fixup_post(uae_u8 *scsi_cmd, int len, uae_u8 *olddata, uae_u8 *data, int *datalenp, int parm) +void scsi_atapi_fixup_post (uae_u8 *scsi_cmd, int len, uae_u8 *olddata, uae_u8 *data, int *datalenp, int parm) { - int datalen = *datalenp ; - if(!data || !datalen) - return ; - if(parm == MODE_SENSE_10) { - olddata[0] = data[1] ; - olddata[1] = data[2] ; - olddata[2] = data[3] ; - olddata[3] = data[7] ; - datalen -= 4 ; - if(datalen > 4) - memcpy(olddata + 4, data + 8, datalen - 4) ; -*datalenp = datalen ; -} + int datalen = *datalenp; + if (!data || !datalen) + return; + if (parm == MODE_SENSE_10) { + olddata[0] = data[1]; + olddata[1] = data[2]; + olddata[2] = data[3]; + olddata[3] = data[7]; + datalen -= 4; + if (datalen > 4) + memcpy (olddata + 4, data + 8, datalen - 4); + *datalenp = datalen; + } } -static void scsi_atapi_fixup_inquiry(struct amigascsi *as) +static void scsi_atapi_fixup_inquiry (struct amigascsi *as) { - uae_u8 *scsi_data = as->data ; - uae_u32 scsi_len = as->len ; - uae_u8 *scsi_cmd = as->cmd ; - uae_u8 cmd ; + uae_u8 *scsi_data = as->data; + uae_u32 scsi_len = as->len; + uae_u8 *scsi_cmd = as->cmd; + uae_u8 cmd; - cmd = scsi_cmd[0] ; + cmd = scsi_cmd[0]; /* CDROM INQUIRY: most Amiga programs expect ANSI version == 2 * (ATAPI normally responds with zero) */ - if(cmd == 0x12 && scsi_len > 2 && scsi_data) { - uae_u8 per = scsi_data[0] ; - uae_u8 b = scsi_data[2] ; - /* CDROM and ANSI version == 0 ? */ - if((per & 31) == 5 && (b & 7) == 0) { - b |= 2 ; - scsi_data[2] = b ; -} -} + if (cmd == 0x12 && scsi_len > 2 && scsi_data) { + uae_u8 per = scsi_data[0]; + uae_u8 b = scsi_data[2]; + /* CDROM and ANSI version == 0 ? */ + if ((per & 31) == 5 && (b & 7) == 0) { + b |= 2; + scsi_data[2] = b; + } + } } -void scsi_log_before(uae_u8 *cdb, int cdblen, uae_u8 *data, int datalen) +void scsi_log_before (uae_u8 *cdb, int cdblen, uae_u8 *data, int datalen) { - int i ; - for(i = 0 ; i < cdblen ; i++) { - write_log(_T("%s%02X"), i > 0 ? _T(".") : _T(""), cdb[i]) ; -} -write_log(_T("\n")) ; -if(data) { - write_log(_T("DATAOUT: %d\n"), datalen) ; - for(i = 0 ; i < datalen && i < 100 ; i++) - write_log(_T("%s%02X"), i > 0 ? _T(".") : _T(""), data[i]) ; -if(datalen > 0) - write_log(_T("\n")) ; -} + int i; + for (i = 0; i < cdblen; i++) { + write_log (_T("%s%02X"), i > 0 ? _T(".") : _T(""), cdb[i]); + } + write_log (_T("\n")); + if (data) { + write_log (_T("DATAOUT: %d\n"), datalen); + for (i = 0; i < datalen && i < 100; i++) + write_log (_T("%s%02X"), i > 0 ? _T(".") : _T(""), data[i]); + if (datalen > 0) + write_log (_T("\n")); + } } -void scsi_log_after(uae_u8 *data, int datalen, uae_u8 *sense, int senselen) +void scsi_log_after (uae_u8 *data, int datalen, uae_u8 *sense, int senselen) { - int i ; - write_log(_T("DATAIN: %d\n"), datalen) ; - for(i = 0 ; i < datalen && i < 100 && data ; i++) - write_log(_T("%s%02X"), i > 0 ? _T(".") : _T(""), data[i]) ; - if(data && datalen > 0) - write_log(_T("\n")) ; - if(senselen > 0) { - write_log(_T("SENSE: %d,"), senselen) ; - for(i = 0 ; i < senselen && i < 32 ; i++) { - write_log(_T("%s%02X"), i > 0 ? _T(".") : _T(""), sense[i]) ; -} -write_log(_T("\n")) ; -} + int i; + write_log (_T("DATAIN: %d\n"), datalen); + for (i = 0; i < datalen && i < 100 && data; i++) + write_log (_T("%s%02X"), i > 0 ? _T(".") : _T(""), data[i]); + if (data && datalen > 0) + write_log (_T("\n")); + if (senselen > 0) { + write_log (_T("SENSE: %d,"), senselen); + for (i = 0; i < senselen && i < 32; i++) { + write_log (_T("%s%02X"), i > 0 ? _T(".") : _T(""), sense[i]); + } + write_log (_T("\n")); + } } -static bool nodisk(struct device_info *di) +static bool nodisk (struct device_info *di) { - return di->media_inserted == 0 ; + return di->media_inserted == 0; } -static int cmd_readx(int unitnum, uae_u8 *dataptr, int offset, int len) +static int cmd_readx (int unitnum, uae_u8 *dataptr, int offset, int len) { - if(!getsem(unitnum)) - return 0 ; - int v = state[unitnum].device_func->read(unitnum, dataptr, offset, len) ; - freesem(unitnum) ; - if(v >= 0) - return len ; - return v ; + if (!getsem (unitnum)) + return 0; + int v = state[unitnum].device_func->read (unitnum, dataptr, offset, len); + freesem (unitnum); + if (v >= 0) + return len; + return v; } -static void wl(uae_u8 *p, int v) +static void wl (uae_u8 *p, int v) { - p[0] = v >> 24 ; - p[1] = v >> 16 ; - p[2] = v >> 8 ; - p[3] = v ; + p[0] = v >> 24; + p[1] = v >> 16; + p[2] = v >> 8; + p[3] = v; } -static void ww(uae_u8 *p, int v) +static void ww (uae_u8 *p, int v) { - p[0] = v >> 8 ; - p[1] = v ; + p[0] = v >> 8; + p[1] = v; } -static int rl(uae_u8 *p) +static int rl (uae_u8 *p) { - return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3]) ; + return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3]); } -static int rw(uae_u8 *p) +static int rw (uae_u8 *p) { - return (p[0] << 8) | (p[1]) ; + return (p[0] << 8) | (p[1]); } -static void stopplay(int unitnum) +static void stopplay (int unitnum) { - sys_command_cd_stop(unitnum) ; + sys_command_cd_stop (unitnum); } -static int addtocentry(uae_u8 **dstp, int *len, int point, int newpoint, int msf, uae_u8 *head, struct cd_toc_head *th) +static int addtocentry (uae_u8 **dstp, int *len, int point, int newpoint, int msf, uae_u8 *head, struct cd_toc_head *th) { - uae_u8 *dst = *dstp ; + uae_u8 *dst = *dstp; - for(int i = 0 ; i < th->points ; i++) { - struct cd_toc *t = &th->toc[i] ; - if(t->point == point) { - if(*len < 8) - return 0 ; - int addr = t->paddress ; - if(msf) - addr = lsn2msf(addr) ; - dst[0] = 0 ; - dst[1] = (t->adr << 4) | t->control ; - dst[2] = newpoint >= 0 ? newpoint : point ; - dst[3] = 0 ; - dst[4] = addr >> 24 ; - dst[5] = addr >> 16 ; - dst[6] = addr >> 8 ; - dst[7] = addr >> 0 ; + for (int i = 0; i < th->points; i++) { + struct cd_toc *t = &th->toc[i]; + if (t->point == point) { + if (*len < 8) + return 0; + int addr = t->paddress; + if (msf) + addr = lsn2msf (addr); + dst[0] = 0; + dst[1] = (t->adr << 4) | t->control; + dst[2] = newpoint >= 0 ? newpoint : point; + dst[3] = 0; + dst[4] = addr >> 24; + dst[5] = addr >> 16; + dst[6] = addr >> 8; + dst[7] = addr >> 0; - if(point >= 1 && point <= 99) { - if(head[2] == 0) - head[2] = point ; - head[3] = point ; + if (point >= 1 && point <= 99) { + if (head[2] == 0) + head[2] = point; + head[3] = point; + } + + *len -= 8; + *dstp = dst + 8; + return 1; + } + } + return -1; } - *len -= 8 ; - *dstp = dst + 8 ; - return 1 ; -} -} -return - 1 ; -} - -static int scsiemudrv(int unitnum, uae_u8 *cmd) +static int scsiemudrv (int unitnum, uae_u8 *cmd) { - if(failunit(unitnum)) - return - 1 ; - if(!getsem(unitnum)) - return 0 ; - int v = 0 ; - if(state[unitnum].device_func->scsiemu) - v = state[unitnum].device_func->scsiemu(unitnum, cmd) ; - freesem(unitnum) ; - return v ; + if (failunit (unitnum)) + return -1; + if (!getsem (unitnum)) + return 0; + int v = 0; + if (state[unitnum].device_func->scsiemu) + v = state[unitnum].device_func->scsiemu (unitnum, cmd); + freesem (unitnum); + return v; } -static int scsi_read_cd(int unitnum, uae_u8 *cmd, uae_u8 *data, struct device_info *di) +static int scsi_read_cd (int unitnum, uae_u8 *cmd, uae_u8 *data, struct device_info *di) { - struct blkdevstate *st = &state[unitnum] ; - int msf = cmd[0] == 0xb9 ; - int start = msf ? msf2lsn(rl(cmd + 2) & 0x00ffffff) : rl(cmd + 2) ; - int len = rl(cmd + 5) & 0x00ffffff ; - if(msf) { - int end = msf2lsn(len) ; - len = end - start ; - if(len < 0) - return - 1 ; -} -int subs = cmd[10] & 7 ; -if(len == 0) - return 0 ; -int v = sys_command_cd_rawread(unitnum, data, start, len, 0, (cmd[1] >> 2) & 7, cmd[9], subs) ; -if(v > 0) - st->current_pos = start + len ; -return v ; + struct blkdevstate *st = &state[unitnum]; + int msf = cmd[0] == 0xb9; + int start = msf ? msf2lsn (rl (cmd + 2) & 0x00ffffff) : rl (cmd + 2); + int len = rl (cmd + 5) & 0x00ffffff; + if (msf) { + int end = msf2lsn (len); + len = end - start; + if (len < 0) + return -1; + } + int subs = cmd[10] & 7; + if (len == 0) + return 0; + int v = sys_command_cd_rawread (unitnum, data, start, len, 0, (cmd[1] >> 2) & 7, cmd[9], subs); + if (v > 0) + st->current_pos = start + len; + return v; } -static int scsi_read_cd_data(int unitnum, uae_u8 *scsi_data, uae_u32 offset, uae_u32 len, struct device_info *di, int *scsi_len) +static int scsi_read_cd_data (int unitnum, uae_u8 *scsi_data, uae_u32 offset, uae_u32 len, struct device_info *di, int *scsi_len, struct cd_toc *t) { - struct blkdevstate *st = &state[unitnum] ; - if(len == 0) { - if(offset >= di->sectorspertrack * di->cylinders * di->trackspercylinder) - return - 1 ; -*scsi_len = 0 ; -return 0 ; -} else { - if(len * di->bytespersector > SCSI_DATA_BUFFER_SIZE) - return - 3 ; -if(offset >= di->sectorspertrack * di->cylinders * di->trackspercylinder) - return - 1 ; -int v = cmd_readx(unitnum, scsi_data, offset, len) * di->bytespersector ; -if(v > 0) { - st->current_pos = offset + len ; - *scsi_len = v ; - return 0 ; -} -return - 2 ; -} + struct blkdevstate *st = &state[unitnum]; + int end = t[1].paddress; + + if (len == 0) { + if (offset >= end) + return -1; + *scsi_len = 0; + return 0; + } else { + if (offset >= end) + return -1; + int v = cmd_readx (unitnum, scsi_data, offset, len) * di->bytespersector; + if (v > 0) { + st->current_pos = offset + len; + *scsi_len = v; + return 0; + } + return -2; + } } -int scsi_cd_emulate(int unitnum, - uae_u8 *cmdbuf, - int scsi_cmd_len, - uae_u8 *scsi_data, - int *data_len, - uae_u8 *r, - int *reply_len, - uae_u8 *s, - int *sense_len, - bool atapi) +int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len, + uae_u8 *scsi_data, int *data_len, uae_u8 *r, int *reply_len, uae_u8 *s, int *sense_len, bool atapi) { - struct blkdevstate *st = &state[unitnum] ; - uae_u32 len, - offset ; - int lr = 0, - ls = 0 ; - int scsi_len = -1 ; - int v ; - int status = 0 ; - struct device_info di ; - uae_u8 cmd = cmdbuf[0] ; - int dlen ; + struct blkdevstate *st = &state[unitnum]; + uae_u32 len, offset; + int lr = 0, ls = 0; + int scsi_len = -1; + int v; + int status = 0; + struct device_info di; + uae_u8 cmd; + int dlen, lun; - if(cmd == 0x03) { /* REQUEST SENSE */ - st->mediawaschanged = false ; - return 0 ; -} + if (cmdbuf == NULL) { + if (st->mediawaschanged) { + st->mediawaschanged = false; + return (0x28 << 8) | (0x00); + } + return 0; + } + + cmd = cmdbuf[0]; + + if (cmd == 0x03) { + return 0; + } -dlen = *data_len ; -*reply_len = *sense_len = 0 ; + dlen = *data_len; + *reply_len = *sense_len = 0; - sys_command_info(unitnum, &di, 1) ; + lun = cmdbuf[1] >> 5; + if (cmdbuf[0] != 0x03 && cmdbuf[0] != 0x12 && lun) { + status = 2; /* CHECK CONDITION */ + s[0] = 0x70; + s[2] = 5; /* ILLEGAL REQUEST */ + s[12] = 0x25; /* INVALID LUN */ + ls = 0x12; + write_log (_T("CD SCSIEMU %d: CMD=%02X LUN=%d ignored\n"), unitnum, cmdbuf[0], lun); + goto end; + } - if(log_scsiemu) { - write_log(_T("SCSIEMU %d: %02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X CMDLEN=%d DATA=%08X LEN=%d\n"), - unitnum, - cmdbuf[0], - cmdbuf[1], - cmdbuf[2], - cmdbuf[3], - cmdbuf[4], - cmdbuf[5], - cmdbuf[6], - cmdbuf[7], - cmdbuf[8], - cmdbuf[9], - cmdbuf[10], - cmdbuf[11], - scsi_cmd_len, - scsi_data, - dlen) ; -} + sys_command_info (unitnum, &di, 1); - // media changed and not inquiry - if(st->mediawaschanged && cmd != 0x12) { - if(log_scsiemu) { - write_log(_T("SCSIEMU %d: MEDIUM MAY HAVE CHANGED STATE\n")) ; -} -lr = -1 ; -status = 2 ; /* CHECK CONDITION */ -s[0] = 0x70 ; -s[2] = 6 ; /* UNIT ATTENTION */ -s[12] = 0x28 ; /* MEDIUM MAY HAVE CHANGED */ -ls = 0x12 ; -if(cmd == 0x00) - st->mediawaschanged = false ; -goto end ; -} + switch (cmdbuf[0]) + { + case 0x00: /* TEST UNIT READY */ + if (nodisk (&di)) + goto nodisk; + scsi_len = 0; + break; + case 0x1e: /* PREVENT/ALLOW MEDIUM REMOVAL */ + scsi_len = 0; + break; + case 0xbd: /* MECHANISM STATUS */ + len = (cmdbuf[8] << 8) | cmdbuf[9]; + if (len > 8) + len = 8; + scsi_len = len; + r[2] = st->current_pos >> 16; + r[3] = st->current_pos >> 8; + r[4] = st->current_pos >> 0; + break; + case 0x12: /* INQUIRY */ + { + if ((cmdbuf[1] & 1) || cmdbuf[2] != 0) + goto err; + len = cmdbuf[4]; + if (cmdbuf[1] >> 5) { + r[0] = 0x7f; + } else { + r[0] = 5; // CDROM + } + r[1] |= 0x80; // removable + r[2] = 2; /* supports SCSI-2 */ + r[3] = 2; /* response data format */ + if (atapi) + r[3] |= 3 << 5; // atapi transport version + r[4] = 32; /* additional length */ + r[7] = 0; + scsi_len = lr = len < 36 ? len : 36; + r[2] = 2; + r[3] = 2; + char *s = ua (di.vendorid); + memcpy (r + 8, s, strlen (s)); + xfree (s); + s = ua (di.productid); + memcpy (r + 16, s, strlen (s)); + xfree (s); + s = ua (di.revision); + memcpy (r + 32, s, strlen (s)); + xfree (s); + for (int i = 8; i < 36; i++) { + if (r[i] == 0) + r[i] = 32; + } + } + break; + case 0xbe: // READ CD + case 0xb9: // READ CD MSF + if (nodisk (&di)) + goto nodisk; + scsi_len = scsi_read_cd (unitnum, cmdbuf, scsi_data, &di); + if (scsi_len == -2) + goto notdatatrack; + if (scsi_len == -1) + goto errreq; + break; + case 0x55: // MODE SELECT(10) + case 0x15: // MODE SELECT(6) + { + uae_u8 *p; + bool mode10 = cmdbuf[0] == 0x55; + p = scsi_data + 4; + if (mode10) + p += 4; + int pcode = p[0] & 0x3f; + if (pcode == 14) { // CD audio control + uae_u16 vol_left = (p[9] << 7) | (p[9] >> 1); + uae_u16 vol_right = (p[11] << 7) | (p[11] >> 1); + sys_command_cd_volume (unitnum, vol_left, vol_right); + scsi_len = 0; + } else { + goto errreq; + } + } + break; + case 0x5a: // MODE SENSE(10) + case 0x1a: /* MODE SENSE(6) */ + { + uae_u8 *p; + int maxlen; + bool pcodeloop = false; + bool sense10 = cmdbuf[0] == 0x5a; + int psize, totalsize, bdsize; + int pc = cmdbuf[2] >> 6; + int pcode = cmdbuf[2] & 0x3f; + int dbd = cmdbuf[1] & 8; - switch(cmdbuf[0]) -{ - case 0x00 : /* TEST UNIT READY */ - if(nodisk(&di)) - goto nodisk ; - scsi_len = 0 ; - break ; - case 0x1e : /* PREVENT/ALLOW MEDIUM REMOVAL */ - scsi_len = 0 ; - break ; - case 0xbd : /* MECHANISM STATUS */ - len = (cmdbuf[8] << 8) | cmdbuf[9] ; - if(len > 8) - len = 8 ; - scsi_len = len ; - r[2] = st->current_pos >> 16 ; - r[3] = st->current_pos >> 8 ; - r[4] = st->current_pos >> 0 ; - break ; - case 0x12 : /* INQUIRY */ -{ - if((cmdbuf[1] & 1) || cmdbuf[2] != 0) - goto err ; -len = cmdbuf[4] ; -if(cmdbuf[1] >> 5) { - r[0] = 0x7f ; -} else { - r[0] = 5 ; // CDROM -} -r[1] |= 0x80 ; // removable -r[2] = 2 ; /* supports SCSI-2 */ -r[3] = 2 ; /* response data format */ -if(atapi) - r[3] |= 3 << 5 ; // atapi transport version -r[4] = 32 ; /* additional length */ -r[7] = 0 ; -scsi_len = lr = len < 36 ? len : 36 ; -r[2] = 2 ; -r[3] = 2 ; -char *s = ua(di.vendorid) ; -memcpy(r + 8, s, strlen(s)) ; -xfree(s) ; -s = ua(di.productid) ; -memcpy(r + 16, s, strlen(s)) ; -xfree(s) ; -s = ua(di.revision) ; -memcpy(r + 32, s, strlen(s)) ; -xfree(s) ; -for(int i = 8 ; i < 36 ; i++) { - if(r[i] == 0) - r[i] = 32 ; -} -} -break ; -case 0xbe : // READ CD -case 0xb9 : // READ CD MSF - if(nodisk(&di)) - goto nodisk ; -scsi_len = scsi_read_cd(unitnum, cmdbuf, scsi_data, &di) ; -if(scsi_len == -2) - goto notdatatrack ; -if(scsi_len == -1) - goto errreq ; -break ; -case 0x55 : // MODE SELECT(10) -case 0x15 : // MODE SELECT(6) -{ - uae_u8 *p ; - bool mode10 = cmdbuf[0] == 0x55 ; - p = scsi_data + 4 ; - if(mode10) - p += 4 ; -int pcode = p[0] & 0x3f ; -if(pcode == 14) { // CD audio control - uae_u16 vol_left = (p[9] << 7) | (p[9] >> 1) ; - uae_u16 vol_right = (p[11] << 7) | (p[11] >> 1) ; - sys_command_cd_volume(unitnum, vol_left, vol_right) ; - scsi_len = 0 ; -} else { - if(log_scsiemu) - write_log(_T("MODE SELECT PC=%d not supported\n"), pcode) ; - goto errreq ; -} -} -break ; -case 0x5a : // MODE SENSE(10) -case 0x1a : /* MODE SENSE(6) */ -{ - uae_u8 *p ; - int maxlen ; - bool pcodeloop = false ; - bool sense10 = cmdbuf[0] == 0x5a ; - int psize, - totalsize, - bdsize ; - int pc = cmdbuf[2] >> 6 ; - int pcode = cmdbuf[2] & 0x3f ; - int dbd = cmdbuf[1] & 8 ; + if (atapi) { + if (!sense10) + goto err; + dbd = 1; + } + p = r; + if (sense10) { + totalsize = 8 - 2; + maxlen = (cmdbuf[7] << 8) | cmdbuf[8]; + p[2] = 0; + p[3] = 0; + p[4] = 0; + p[5] = 0; + p[6] = 0; + p[7] = 0; + p += 8; + } else { + totalsize = 4 - 1; + maxlen = cmdbuf[4]; + p[1] = 0; + p[2] = 0; + p[3] = 0; + p += 4; + } + bdsize = 0; + if (!dbd) { + wl(p + 0, 0); + wl(p + 4, di.bytespersector); + bdsize = 8; + p += bdsize; + } + if (pcode == 0x3f) { + pcode = 1; // page = 0 must be last + pcodeloop = true; + } + for (;;) { + psize = 0; + if (pcode == 0) { + p[0] = 0; + p[1] = 0; + p[2] = 0x20; + p[3] = 0; + psize = 4; + } else if (pcode == 14) { // CD audio control + uae_u32 vol = sys_command_cd_volume (unitnum, 0xffff, 0xffff); + p[0] = 0x0e; + p[1] = 0x0e; + p[2] = 4|1; + p[3] = 4; + p[6] = 0; + p[7] = 75; + p[8] = 1; + p[9] = pc == 0 ? (vol >> 7) & 0xff : 0xff; + p[10] = 2; + p[11] = pc == 0 ? (vol >> (16 + 7)) & 0xff : 0xff; + psize = p[1] + 2; + } else if (pcode == 0x2a) { // cd/dvd capabilities + p[0] = 0x2a; + p[1] = 0x18; + p[2] = 1; // | 0x10 | 0x20; // read: CD-R/DVD-ROM/DVD-R + p[3] = 0; // write: nothing + p[4] = 0x40 | 0x20 | 0x10 | 0x01; + p[5] = 0x08 | 0x04 | 0x02 | 0x01; + p[6] = (1 << 5) | 0x10; // type = tray, eject supported + p[7] = 3; // separate channel mute and volume + p[8] = 2; p[9] = 0; + p[10] = 0xff; p[11] = 0xff; // number of volume levels + p[12] = 4; p[13] = 0; // "1M buffer" + p[14] = 2; p[15] = 0; + p[16] = 0; + p[17] = 0; + p[18] = p[19] = 0; + p[20] = p[21] = 0; + p[22] = p[23] = 0; + psize = p[1] + 2; + } else { + if (!pcodeloop) + goto err; + } + totalsize += psize; + p += psize; + if (!pcodeloop) + break; + if (pcode == 0) + break; + pcode++; + if (pcode == 0x3f) + pcode = 0; + } + if (sense10) { + totalsize += bdsize; + r[6] = bdsize >> 8; + r[7] = bdsize & 0xff; + r[0] = totalsize >> 8; + r[1] = totalsize & 0xff; + } else { + totalsize += bdsize; + r[3] = bdsize & 0xff; + r[0] = totalsize & 0xff; + } + scsi_len = totalsize + 1; + if (scsi_len > maxlen) + scsi_len = maxlen; + lr = scsi_len; + } + break; + case 0x01: /* REZERO UNIT */ + scsi_len = 0; + break; + case 0x1d: /* SEND DIAGNOSTICS */ + scsi_len = 0; + break; + case 0x25: /* READ CAPACITY */ + { + int pmi = cmdbuf[8] & 1; + uae_u32 lba = (cmdbuf[2] << 24) | (cmdbuf[3] << 16) | (cmdbuf[4] << 8) | cmdbuf[5]; + int cyl, cylsec, head, tracksec; + if (nodisk (&di)) + goto nodisk; + uae_u32 blocks = di.sectorspertrack * di.cylinders * di.trackspercylinder - 1; + cyl = di.cylinders; + head = 1; + cylsec = tracksec = di.trackspercylinder; + if (pmi == 0 && lba != 0) + goto errreq; + if (pmi) { + lba += tracksec * head; + lba /= tracksec * head; + lba *= tracksec * head; + if (lba > blocks) + lba = blocks; + blocks = lba; + } + wl (r, blocks); + wl (r + 4, di.bytespersector); + scsi_len = lr = 8; + } + break; + case 0x0b: /* SEEK (6) */ + { + if (nodisk (&di)) + goto nodisk; + stopplay (unitnum); + offset = ((cmdbuf[1] & 31) << 16) | (cmdbuf[2] << 8) | cmdbuf[3]; + struct cd_toc *t = gettoc (unitnum, &di.toc, offset); + if (!t) + goto readerr; + v = scsi_read_cd_data (unitnum, scsi_data, offset, 0, &di, &scsi_len, t); + if (v == -1) + goto outofbounds; + } + break; + case 0x08: /* READ (6) */ + { + if (nodisk (&di)) + goto nodisk; + stopplay (unitnum); + offset = ((cmdbuf[1] & 31) << 16) | (cmdbuf[2] << 8) | cmdbuf[3]; + struct cd_toc *t = gettoc (unitnum, &di.toc, offset); + if (!t) + goto readerr; + if ((t->control & 0x0c) == 0x04) { + len = cmdbuf[4]; + if (!len) + len = 256; + v = scsi_read_cd_data (unitnum, scsi_data, offset, len, &di, &scsi_len, t); + if (v == -1) + goto outofbounds; + if (v == -2) + goto readerr; + } else { + goto notdatatrack; + } + } + break; + case 0x0a: /* WRITE (6) */ + goto readprot; + case 0x2b: /* SEEK (10) */ + { + if (nodisk (&di)) + goto nodisk; + stopplay (unitnum); + offset = rl (cmdbuf + 2); + struct cd_toc *t = gettoc (unitnum, &di.toc, offset); + if (!t) + goto readerr; + v = scsi_read_cd_data (unitnum, scsi_data, offset, 0, &di, &scsi_len, t); + if (v == -1) + goto outofbounds; + } + break; + case 0x28: /* READ (10) */ + { + if (nodisk (&di)) + goto nodisk; + stopplay (unitnum); + offset = rl (cmdbuf + 2); + struct cd_toc *t = gettoc (unitnum, &di.toc, offset); + if (!t) + goto readerr; + if ((t->control & 0x0c) == 0x04) { + len = rl (cmdbuf + 7 - 2) & 0xffff; + v = scsi_read_cd_data (unitnum, scsi_data, offset, len, &di, &scsi_len, t); + if (v == -1) + goto outofbounds; + if (v == -2) + goto readerr; + } else { + goto notdatatrack; + } + } + break; + case 0x2a: /* WRITE (10) */ + goto readprot; + case 0xa8: /* READ (12) */ + { + if (nodisk (&di)) + goto nodisk; + stopplay (unitnum); + offset = rl (cmdbuf + 2); + struct cd_toc *t = gettoc (unitnum, &di.toc, offset); + if (!t) + goto readerr; + if ((t->control & 0x0c) == 0x04) { + len = rl (cmdbuf + 6); + v = scsi_read_cd_data (unitnum, scsi_data, offset, len, &di, &scsi_len, t); + if (v == -1) + goto outofbounds; + if (v == -2) + goto readerr; + } else { + goto notdatatrack; + } + } + break; + case 0xaa: /* WRITE (12) */ + goto readprot; + case 0x51: /* READ DISC INFORMATION */ + { + struct cd_toc_head ttoc; + int maxlen = (cmdbuf[7] << 8) | cmdbuf[8]; + if (nodisk (&di)) + goto nodisk; + if (!sys_command_cd_toc (unitnum, &ttoc)) + goto readerr; + struct cd_toc_head *toc = &ttoc; + uae_u8 *p = scsi_data; + p[0] = 0; + p[1] = 34 - 2; + p[2] = 2 | (3 << 2); // complete cd rom, last session is complete + p[3] = toc->first_track; + p[4] = 1; + p[5] = toc->first_track; + p[6] = toc->last_track; + wl (p + 16, lsn2msf (toc->lastaddress)); + wl (p + 20, 0x00ffffff); + scsi_len = p[1] + 2; + if (scsi_len > maxlen) + scsi_len = maxlen; + } + break; + case 0x52: /* READ TRACK INFORMATION */ + { + struct cd_toc_head ttoc; + int maxlen = (cmdbuf[7] << 8) | cmdbuf[8]; + if (nodisk (&di)) + goto nodisk; + if (!sys_command_cd_toc (unitnum, &ttoc)) + goto readerr; + struct cd_toc_head *toc = &ttoc; + uae_u8 *p = scsi_data; + int lsn; + if (cmdbuf[1] & 1) { + int track = cmdbuf[5]; + lsn = toc->toc[track].address; + } else { + lsn = rl (p + 2); + } + struct cd_toc *t = gettoc (unitnum, toc, lsn); + if (!t) + goto readerr; + p[0] = 0; + p[1] = 28 - 2; + p[2] = t->track; + p[3] = 1; + p[5] = t->control; + p[6] = 0; // data mode, fixme + wl (p + 8, t->address); + wl (p + 24, t[1].address - t->address); + scsi_len = p[1] + 2; + if (scsi_len > maxlen) + scsi_len = maxlen; + } + break; + case 0x43: // READ TOC + { + if (nodisk (&di)) + goto nodisk; + uae_u8 *p = scsi_data; + int strack = cmdbuf[6]; + int msf = cmdbuf[1] & 2; + int format = cmdbuf[2] & 7; + if (format >= 3) + goto errreq; + int maxlen = (cmdbuf[7] << 8) | cmdbuf[8]; + int maxlen2 = maxlen; + struct cd_toc_head ttoc; + if (!sys_command_cd_toc (unitnum, &ttoc)) + goto readerr; + struct cd_toc_head *toc = &ttoc; + if (format == 1) { + p[0] = 0; + p[1] = 2 + 8; + p[2] = 1; + p[3] = 1; + p[4] = 0; + p[5] = (toc->toc[0].adr << 4) | toc->toc[0].control; + p[6] = toc->first_track; + p[7] = 0; + if (msf) + wl (p + 8, lsn2msf (toc->toc[0].address)); + else + wl (p + 8 , toc->toc[0].address); + scsi_len = 12; + } else if (format == 2 || format == 0) { + if (format == 2 && !msf) + goto errreq; + if (strack == 0) + strack = toc->first_track; + if (format == 0 && strack >= 100 && strack != 0xaa) + goto errreq; + uae_u8 *p2 = p + 4; + p[2] = 0; + p[3] = 0; + maxlen -= 4; + if (format == 2) { + if (!addtocentry (&p2, &maxlen, 0xa0, -1, msf, p, toc)) + break; + if (!addtocentry (&p2, &maxlen, 0xa1, -1, msf, p, toc)) + break; + if (!addtocentry (&p2, &maxlen, 0xa2, -1, msf, p, toc)) + break; + } + while (strack < 100) { + if (!addtocentry (&p2, &maxlen, strack, -1, msf, p, toc)) + break; + strack++; + } + addtocentry (&p2, &maxlen, 0xa2, 0xaa, msf, p, toc); + int tlen = p2 - (p + 2); + p[0] = tlen >> 8; + p[1] = tlen >> 0; + scsi_len = tlen + 2; + } + if (scsi_len > maxlen2) + scsi_len = maxlen2; + } + break; + case 0x42: // READ SUB-CHANNEL + { + int msf = cmdbuf[1] & 2; + int subq = cmdbuf[2] & 0x40; + int format = cmdbuf[3]; + int track = cmdbuf[6]; + int maxlen = rw(cmdbuf + 7); + uae_u8 buf[SUBQ_SIZE] = { 0 }; - if(atapi) { - if(!sense10) - goto err ; - dbd = 1 ; -} -if(log_scsiemu) - write_log(_T("MODE SENSE PC=%d CODE=%d DBD=%d\n"), pc, pcode, dbd) ; -p = r ; -if(sense10) { - totalsize = 8 - 2 ; - maxlen = (cmdbuf[7] << 8) | cmdbuf[8] ; - p[2] = 0 ; - p[3] = 0 ; - p[4] = 0 ; - p[5] = 0 ; - p[6] = 0 ; - p[7] = 0 ; - p += 8 ; -} else { - totalsize = 4 - 1 ; - maxlen = cmdbuf[4] ; - p[1] = 0 ; - p[2] = 0 ; - p[3] = 0 ; - p += 4 ; -} -bdsize = 0 ; -if(!dbd) { - wl(p + 0, 0) ; - wl(p + 4, di.bytespersector) ; - bdsize = 8 ; - p += bdsize ; -} -if(pcode == 0x3f) { - pcode = 1 ; // page = 0 must be last - pcodeloop = true ; -} -for(; ;) { - psize = 0 ; - if(pcode == 0) { - p[0] = 0 ; - p[1] = 0 ; - p[2] = 0x20 ; - p[3] = 0 ; - psize = 4 ; -} else if(pcode == 14) { // CD audio control - uae_u32 vol = sys_command_cd_volume(unitnum, 0xffff, 0xffff) ; - p[0] = 0x0e ; - p[1] = 0x0e ; - p[2] = 4 | 1 ; - p[3] = 4 ; - p[6] = 0 ; - p[7] = 75 ; - p[8] = 1 ; - p[9] = pc == 0 ? (vol >> 7) & 0xff : 0xff ; - p[10] = 2 ; - p[11] = pc == 0 ? (vol >> (16 + 7)) & 0xff : 0xff ; - psize = p[1] + 2 ; -} else if(pcode == 0x2a) { // cd/dvd capabilities - p[0] = 0x2a ; - p[1] = 0x18 ; - p[2] = 1 ; // | 0x10 | 0x20; // read: CD-R/DVD-ROM/DVD-R - p[3] = 0 ; // write: nothing - p[4] = 0x40 | 0x20 | 0x10 | 0x01 ; - p[5] = 0x08 | 0x04 | 0x02 | 0x01 ; - p[6] = (1 << 5) | 0x10 ; // type = tray, eject supported - p[7] = 3 ; // separate channel mute and volume - p[8] = 2 ; p[9] = 0 ; - p[10] = 0xff ; p[11] = 0xff ; // number of volume levels - p[12] = 4 ; p[13] = 0 ; // "1M buffer" - p[14] = 2 ; p[15] = 0 ; - p[16] = 0 ; - p[17] = 0 ; - p[18] = p[19] = 0 ; - p[20] = p[21] = 0 ; - p[22] = p[23] = 0 ; - psize = p[1] + 2 ; -} else { - if(!pcodeloop) - goto err ; -} - totalsize += psize ; - p += psize ; - if(!pcodeloop) - break ; -if(pcode == 0) - break ; -pcode++ ; -if(pcode == 0x3f) - pcode = 0 ; -} - if(sense10) { - totalsize += bdsize ; - r[6] = bdsize >> 8 ; - r[7] = bdsize & 0xff ; - r[0] = totalsize >> 8 ; - r[1] = totalsize & 0xff ; -} else { - totalsize += bdsize ; - r[3] = bdsize & 0xff ; - r[0] = totalsize & 0xff ; -} -scsi_len = totalsize + 1 ; -if(scsi_len > maxlen) - scsi_len = maxlen ; -lr = scsi_len ; -} -break ; -case 0x01 : /* REZERO UNIT */ - scsi_len = 0 ; -break ; -case 0x1d : /* SEND DIAGNOSTICS */ - scsi_len = 0 ; - break ; -case 0x25 : /* READ CAPACITY */ -{ - int pmi = cmdbuf[8] & 1 ; - uae_u32 lba = (cmdbuf[2] << 24) | (cmdbuf[3] << 16) | (cmdbuf[4] << 8) | cmdbuf[5] ; - int cyl, - cylsec, - head, - tracksec ; - if(nodisk(&di)) - goto nodisk ; - uae_u32 blocks = di.sectorspertrack * di.cylinders * di.trackspercylinder - 1 ; - cyl = di.cylinders ; - head = 1 ; - cylsec = tracksec = di.trackspercylinder ; - if(pmi == 0 && lba != 0) - goto errreq ; - if(pmi) { - lba += tracksec * head ; - lba /= tracksec * head ; - lba *= tracksec * head ; - if(lba > blocks) - lba = blocks ; - blocks = lba ; -} -wl(r, blocks) ; -wl(r + 4, di.bytespersector) ; -scsi_len = lr = 8 ; -} -break ; -case 0x0b : /* SEEK (6) */ -{ - if(nodisk(&di)) - goto nodisk ; - stopplay(unitnum) ; - offset = ((cmdbuf[1] & 31) << 16) | (cmdbuf[2] << 8) | cmdbuf[3] ; - struct cd_toc *t = gettoc(&di.toc, offset) ; - v = scsi_read_cd_data(unitnum, scsi_data, offset, 0, &di, &scsi_len) ; - if(v == -1) - goto outofbounds ; -} -break ; -case 0x08 : /* READ (6) */ -{ - if(nodisk(&di)) - goto nodisk ; -stopplay(unitnum) ; -offset = ((cmdbuf[1] & 31) << 16) | (cmdbuf[2] << 8) | cmdbuf[3] ; -struct cd_toc *t = gettoc(&di.toc, offset) ; -if((t->control & 0x0c) == 0x04) { - len = cmdbuf[4] ; - if(!len) - len = 256 ; - v = scsi_read_cd_data(unitnum, scsi_data, offset, len, &di, &scsi_len) ; - if(v == -1) - goto outofbounds ; - if(v == -2) - goto readerr ; - if(v == -3) - goto toolarge ; -} else { - goto notdatatrack ; -} -} -break ; -case 0x0a : /* WRITE (6) */ - goto readprot ; -case 0x2b : /* SEEK (10) */ -{ - if(nodisk(&di)) - goto nodisk ; - stopplay(unitnum) ; - offset = rl(cmdbuf + 2) ; - struct cd_toc *t = gettoc(&di.toc, offset) ; - v = scsi_read_cd_data(unitnum, scsi_data, offset, 0, &di, &scsi_len) ; - if(v == -1) - goto outofbounds ; -} -break ; -case 0x28 : /* READ (10) */ -{ - if(nodisk(&di)) - goto nodisk ; -stopplay(unitnum) ; -offset = rl(cmdbuf + 2) ; -struct cd_toc *t = gettoc(&di.toc, offset) ; -if((t->control & 0x0c) == 0x04) { - len = rl(cmdbuf + 7 - 2) & 0xffff ; - v = scsi_read_cd_data(unitnum, scsi_data, offset, len, &di, &scsi_len) ; - if(v == -1) - goto outofbounds ; - if(v == -2) - goto readerr ; - if(v == -3) - goto toolarge ; -} else { - goto notdatatrack ; -} -} -break ; -case 0x2a : /* WRITE (10) */ - goto readprot ; -case 0xa8 : /* READ (12) */ -{ - if(nodisk(&di)) - goto nodisk ; -stopplay(unitnum) ; -offset = rl(cmdbuf + 2) ; -struct cd_toc *t = gettoc(&di.toc, offset) ; -if((t->control & 0x0c) == 0x04) { - len = rl(cmdbuf + 6) ; - v = scsi_read_cd_data(unitnum, scsi_data, offset, len, &di, &scsi_len) ; - if(v == -1) - goto outofbounds ; - if(v == -2) - goto readerr ; - if(v == -3) - goto toolarge ; -} else { - goto notdatatrack ; -} -} -break ; -case 0xaa : /* WRITE (12) */ - goto readprot ; -case 0x51 : /* READ DISC INFORMATION */ -{ - struct cd_toc_head ttoc ; - int maxlen = (cmdbuf[7] << 8) | cmdbuf[8] ; - if(nodisk(&di)) - goto nodisk ; - if(!sys_command_cd_toc(unitnum, &ttoc)) - goto readerr ; - struct cd_toc_head *toc = &ttoc ; - uae_u8 *p = scsi_data ; - p[0] = 0 ; - p[1] = 34 - 2 ; - p[2] = 2 | (3 << 2) ; // complete cd rom, last session is complete - p[3] = toc->first_track ; - p[4] = 1 ; - p[5] = toc->first_track ; - p[6] = toc->last_track ; - wl(p + 16, lsn2msf(toc->lastaddress)) ; - wl(p + 20, 0x00ffffff) ; - scsi_len = p[1] + 2 ; - if(scsi_len > maxlen) - scsi_len = maxlen ; -} -break ; -case 0x52 : /* READ TRACK INFORMATION */ -{ - struct cd_toc_head ttoc ; - int maxlen = (cmdbuf[7] << 8) | cmdbuf[8] ; - if(nodisk(&di)) - goto nodisk ; - if(!sys_command_cd_toc(unitnum, &ttoc)) - goto readerr ; - struct cd_toc_head *toc = &ttoc ; - uae_u8 *p = scsi_data ; - int lsn ; - if(cmdbuf[1] & 1) { - int track = cmdbuf[5] ; - lsn = toc->toc[track].address ; -} else { - lsn = rl(p + 2) ; -} -struct cd_toc *t = gettoc(toc, lsn) ; -p[0] = 0 ; -p[1] = 28 - 2 ; -p[2] = t->track ; -p[3] = 1 ; -p[5] = t->control ; -p[6] = 0 ; // data mode, fixme -wl(p + 8, t->address) ; -wl(p + 24, t[1].address - t->address) ; -scsi_len = p[1] + 2 ; -if(scsi_len > maxlen) - scsi_len = maxlen ; -} -break ; -case 0x43 : // READ TOC -{ - if(nodisk(&di)) - goto nodisk ; - uae_u8 *p = scsi_data ; - int strack = cmdbuf[6] ; - int msf = cmdbuf[1] & 2 ; - int format = cmdbuf[2] & 7 ; - if(format >= 3) - goto errreq ; - int maxlen = (cmdbuf[7] << 8) | cmdbuf[8] ; - int maxlen2 = maxlen ; - struct cd_toc_head ttoc ; - if(!sys_command_cd_toc(unitnum, &ttoc)) - goto readerr ; - struct cd_toc_head *toc = &ttoc ; - if(maxlen < 4) - goto errreq ; - if(format == 1) { - p[0] = 0 ; - p[1] = 2 + 8 ; - p[2] = 1 ; - p[3] = 1 ; - p[4] = 0 ; - p[5] = (toc->toc[0].adr << 4) | toc->toc[0].control ; - p[6] = toc->first_track ; - p[7] = 0 ; - if(msf) - wl(p + 8, lsn2msf(toc->toc[0].address)) ; - else - wl(p + 8, toc->toc[0].address) ; - scsi_len = 12 ; -} else if(format == 2 || format == 0) { - if(format == 2 && !msf) - goto errreq ; - if(strack == 0) - strack = toc->first_track ; - if(format == 0 && strack >= 100 && strack != 0xaa) - goto errreq ; - uae_u8 *p2 = p + 4 ; - p[2] = 0 ; - p[3] = 0 ; - maxlen -= 4 ; - if(format == 2) { - if(!addtocentry(&p2, &maxlen, 0xa0, -1, msf, p, toc)) - break ; - if(!addtocentry(&p2, &maxlen, 0xa1, -1, msf, p, toc)) - break ; - if(!addtocentry(&p2, &maxlen, 0xa2, -1, msf, p, toc)) - break ; -} -while(strack < 100) { - if(!addtocentry(&p2, &maxlen, strack, -1, msf, p, toc)) - break ; - strack++ ; -} -addtocentry(&p2, &maxlen, 0xa2, 0xaa, msf, p, toc) ; -int tlen = p2 - (p + 2) ; -p[0] = tlen >> 8 ; -p[1] = tlen >> 0 ; -scsi_len = tlen + 2 ; -if(scsi_len > maxlen2) - scsi_len = maxlen2 ; -} -} -break ; -case 0x42 : // READ SUB-CHANNEL -{ - int msf = cmdbuf[1] & 2 ; - int subq = cmdbuf[2] & 0x40 ; - int format = cmdbuf[3] ; - int track = cmdbuf[6] ; - int len = rw(cmdbuf + 7) ; - uae_u8 buf[SUBQ_SIZE] = { 0 } ; + if (nodisk (&di)) + goto nodisk; + sys_command_cd_qcode (unitnum, buf, -1, false); + scsi_len = 4; + scsi_data[0] = 0; + scsi_data[1] = buf[1]; + if (subq && format == 1) { + scsi_data[2] = 0; + scsi_data[3] = 12; + scsi_len += 12; + scsi_data[4] = 1; + scsi_data[5] = (buf[4 + 0] << 4) | (buf[4 + 0] >> 4); + scsi_data[6] = frombcd (buf[4 + 1]); // track + scsi_data[7] = frombcd (buf[4 + 2]); // index + int reladdr = fromlongbcd (&buf[4 + 3]); + int absaddr = fromlongbcd (&buf[4 + 7]); + if (!msf) { + reladdr = msf2lsn (reladdr); + absaddr = msf2lsn (absaddr); + } + wl (scsi_data + 8, absaddr); + wl (scsi_data + 12, reladdr); + } else { + scsi_data[2] = 0; + scsi_data[3] = 0; + } + if (scsi_len > maxlen) + scsi_len = maxlen; + } + break; + case 0x1b: // START/STOP + sys_command_cd_stop (unitnum); + scsiemudrv (unitnum, cmdbuf); + scsi_len = 0; + break; + case 0x4e: // STOP PLAY/SCAN + if (nodisk (&di)) + goto nodisk; + sys_command_cd_stop (unitnum); + scsi_len = 0; + break; + case 0xba: // SCAN + { + if (nodisk (&di)) + goto nodisk; + struct cd_toc_head ttoc; + if (!sys_command_cd_toc (unitnum, &ttoc)) + goto readerr; + struct cd_toc_head *toc = &ttoc; + int scan = (cmdbuf[1] & 0x10) ? -1 : 1; + int start = rl (cmdbuf + 1) & 0x00ffffff; + int end = scan > 0 ? toc->lastaddress : toc->toc[toc->first_track_offset].paddress; + int type = cmdbuf[9] >> 6; + if (type == 1) + start = lsn2msf (start); + if (type == 3) + goto errreq; + if (type == 2) { + if (toc->first_track_offset + start >= toc->last_track_offset) + goto errreq; + start = toc->toc[toc->first_track_offset + start].paddress; + } + sys_command_cd_pause (unitnum, 0); + sys_command_cd_play (unitnum, start, end, scan); + scsi_len = 0; + } + break; + case 0x48: // PLAY AUDIO TRACK/INDEX + { + if (nodisk (&di)) + goto nodisk; + int strack = cmdbuf[4]; + int etrack = cmdbuf[7]; + struct cd_toc_head ttoc; + if (!sys_command_cd_toc (unitnum, &ttoc)) + goto readerr; + struct cd_toc_head *toc = &ttoc; + if (strack < toc->first_track || strack > toc->last_track || + etrack < toc->first_track || etrack > toc->last_track || + strack > etrack) + goto errreq; + int start = toc->toc[toc->first_track_offset + strack - 1].paddress; + int end = etrack == toc->last_track ? toc->lastaddress : toc->toc[toc->first_track_offset + etrack - 1 + 1].paddress; + sys_command_cd_pause (unitnum, 0); + if (!sys_command_cd_play (unitnum, start, end, 0)) + goto notdatatrack; + scsi_len = 0; + } + break; + case 0x49: // PLAY AUDIO TRACK RELATIVE (10) + case 0xa9: // PLAY AUDIO TRACK RELATIVE (12) + { + if (nodisk (&di)) + goto nodisk; + int len = cmd == 0xa9 ? rl (cmdbuf + 6) : rw (cmdbuf + 7); + int track = cmd == 0xa9 ? cmdbuf[10] : cmdbuf[6]; + if (track < di.toc.first_track || track > di.toc.last_track) + goto errreq; + int start = di.toc.toc[di.toc.first_track_offset + track - 1].paddress; + int rel = rl (cmdbuf + 2); + start += rel; + int end = start + len; + if (end > di.toc.lastaddress) + end = di.toc.lastaddress; + if (len > 0) { + sys_command_cd_pause (unitnum, 0); + if (!sys_command_cd_play (unitnum, start, start + len, 0)) + goto notdatatrack; + } + scsi_len = 0; + } + break; + case 0x47: // PLAY AUDIO MSF + { + if (nodisk (&di)) + goto nodisk; + int start = rl (cmdbuf + 2) & 0x00ffffff; + if (start == 0x00ffffff) { + uae_u8 buf[SUBQ_SIZE] = { 0 }; + sys_command_cd_qcode (unitnum, buf, -1, false); + start = fromlongbcd (buf + 4 + 7); + } + int end = msf2lsn (rl (cmdbuf + 5) & 0x00ffffff); + if (end > di.toc.lastaddress) + end = di.toc.lastaddress; + start = msf2lsn (start); + if (start > end) + goto errreq; + if (start < end) + sys_command_cd_pause (unitnum, 0); + if (!sys_command_cd_play (unitnum, start, end, 0)) + goto notdatatrack; + scsi_len = 0; + } + break; + case 0x45: // PLAY AUDIO (10) + case 0xa5: // PLAY AUDIO (12) + { + if (nodisk (&di)) + goto nodisk; + int start = rl (cmdbuf + 2); + int len; + if (cmd == 0xa5) + len = rl (cmdbuf + 6); + else + len = rw (cmdbuf + 7); + if (len > 0) { + if (start == -1) { + uae_u8 buf[SUBQ_SIZE] = { 0 }; + sys_command_cd_qcode (unitnum, buf, -1, false); + start = msf2lsn (fromlongbcd (buf + 4 + 7)); + } + int end = start + len; + if (end > di.toc.lastaddress) + end = di.toc.lastaddress; + sys_command_cd_pause (unitnum, 0); + if (!sys_command_cd_play (unitnum, start, end, 0)) + goto notdatatrack; + } + scsi_len = 0; + } + break; + case 0xbc: // PLAY CD + { + if (nodisk (&di)) + goto nodisk; + int start = -1; + int end = -1; + if (cmdbuf[1] & 2) { + start = msf2lsn (rl (cmdbuf + 2) & 0x00ffffff); + end = msf2lsn (rl (cmdbuf + 5) & 0x00ffffff); + } else { + start = rl (cmdbuf + 2); + end = start + rl (cmdbuf + 6); + } + if (end > di.toc.lastaddress) + end = di.toc.lastaddress; + if (start > end) + goto errreq; + if (start < end) { + sys_command_cd_pause (unitnum, 0); + if (!sys_command_cd_play (unitnum, start, end, 0)) + goto notdatatrack; + } + } + break; + case 0x4b: // PAUSE/RESUME + { + if (nodisk (&di)) + goto nodisk; + uae_u8 buf[SUBQ_SIZE] = { 0 }; + int resume = cmdbuf[8] & 1; + sys_command_cd_qcode (unitnum, buf, -1, false); + if (buf[1] != AUDIO_STATUS_IN_PROGRESS && buf[1] != AUDIO_STATUS_PAUSED) + goto errreq; + sys_command_cd_pause (unitnum, resume ? 0 : 1); + scsi_len = 0; + } + break; + case 0x35: /* SYNCRONIZE CACHE (10) */ + scsi_len = 0; + break; - if(nodisk(&di)) - goto nodisk ; - sys_command_cd_qcode(unitnum, buf) ; - if(len < 4) - goto errreq ; -scsi_len = 4 ; -scsi_data[0] = 0 ; -scsi_data[1] = buf[1] ; -if(subq && format == 1) { - if(len < 4 + 12) - goto errreq ; - scsi_data[2] = 0 ; - scsi_data[3] = 12 ; - scsi_len += 12 ; - scsi_data[4] = 1 ; - scsi_data[5] = (buf[4 + 0] << 4) | (buf[4 + 0] >> 4) ; - scsi_data[6] = frombcd(buf[4 + 1]) ; // track - scsi_data[7] = frombcd(buf[4 + 2]) ; // index - int reladdr = fromlongbcd(&buf[4 + 3]) ; - int absaddr = fromlongbcd(&buf[4 + 7]) ; - if(!msf) { - reladdr = msf2lsn(reladdr) ; - absaddr = msf2lsn(absaddr) ; -} -wl(scsi_data + 8, absaddr) ; -wl(scsi_data + 12, reladdr) ; -} else { - scsi_data[2] = 0 ; - scsi_data[3] = 0 ; -} -} -break ; -case 0x1b : // START/STOP - sys_command_cd_stop(unitnum) ; - scsiemudrv(unitnum, cmdbuf) ; - scsi_len = 0 ; -break ; -case 0x4e : // STOP PLAY/SCAN - if(nodisk(&di)) - goto nodisk ; - sys_command_cd_stop(unitnum) ; - scsi_len = 0 ; -break ; -case 0xba : // SCAN -{ - if(nodisk(&di)) - goto nodisk ; - struct cd_toc_head ttoc ; - if(!sys_command_cd_toc(unitnum, &ttoc)) - goto readerr ; - struct cd_toc_head *toc = &ttoc ; - int scan = (cmdbuf[1] & 0x10) ? -1 : 1 ; - int start = rl(cmdbuf + 1) & 0x00ffffff ; - int end = scan > 0 ? toc->lastaddress : toc->toc[toc->first_track_offset].paddress ; - int type = cmdbuf[9] >> 6 ; - if(type == 1) - start = lsn2msf(start) ; - if(type == 3) - goto errreq ; - if(type == 2) { - if(toc->first_track_offset + start >= toc->last_track_offset) - goto errreq ; - start = toc->toc[toc->first_track_offset + start].paddress ; -} -sys_command_cd_pause(unitnum, 0) ; -sys_command_cd_play(unitnum, start, end, scan) ; -scsi_len = 0 ; -} -break ; -case 0x48 : // PLAY AUDIO TRACK/INDEX -{ - if(nodisk(&di)) - goto nodisk ; - int strack = cmdbuf[4] ; - int etrack = cmdbuf[7] ; - struct cd_toc_head ttoc ; - if(!sys_command_cd_toc(unitnum, &ttoc)) - goto readerr ; - struct cd_toc_head *toc = &ttoc ; - if(strack < toc->first_track || strack > toc->last_track || - etrack < toc->first_track || etrack > toc->last_track || - strack > etrack) - goto errreq ; - int start = toc->toc[toc->first_track_offset + strack - 1].paddress ; - int end = etrack == toc->last_track ? toc->lastaddress : toc->toc[toc->first_track_offset + etrack - 1 + 1].paddress ; - sys_command_cd_pause(unitnum, 0) ; - if(!sys_command_cd_play(unitnum, start, end, 0)) - goto notdatatrack ; - scsi_len = 0 ; -} -break ; -case 0x49 : // PLAY AUDIO TRACK RELATIVE (10) -case 0xa9 : // PLAY AUDIO TRACK RELATIVE (12) -{ - if(nodisk(&di)) - goto nodisk ; - int len = cmd == 0xa9 ? rl(cmdbuf + 6) : rw(cmdbuf + 7) ; - int track = cmd == 0xa9 ? cmdbuf[10] : cmdbuf[6] ; - if(track < di.toc.first_track || track > di.toc.last_track) - goto errreq ; - int start = di.toc.toc[di.toc.first_track_offset + track - 1].paddress ; - int rel = rl(cmdbuf + 2) ; - start += rel ; - int end = start + len ; - if(end > di.toc.lastaddress) - end = di.toc.lastaddress ; - if(len > 0) { - sys_command_cd_pause(unitnum, 0) ; - if(!sys_command_cd_play(unitnum, start, start + len, 0)) - goto notdatatrack ; -} -scsi_len = 0 ; -} -break ; -case 0x47 : // PLAY AUDIO MSF -{ - if(nodisk(&di)) - goto nodisk ; - int start = rl(cmdbuf + 2) & 0x00ffffff ; - if(start == 0x00ffffff) { - uae_u8 buf[SUBQ_SIZE] = { 0 } ; - sys_command_cd_qcode(unitnum, buf) ; - start = fromlongbcd(buf + 4 + 7) ; -} -int end = msf2lsn(rl(cmdbuf + 5) & 0x00ffffff) ; -if(end > di.toc.lastaddress) - end = di.toc.lastaddress ; -start = msf2lsn(start) ; -if(start > end) - goto errreq ; -if(start < end) - sys_command_cd_pause(unitnum, 0) ; - if(!sys_command_cd_play(unitnum, start, end, 0)) - goto notdatatrack ; -scsi_len = 0 ; -} -break ; -case 0x45 : // PLAY AUDIO (10) -case 0xa5 : // PLAY AUDIO (12) -{ - if(nodisk(&di)) - goto nodisk ; - int start = rl(cmdbuf + 2) ; - int len ; - if(cmd == 0xa5) - len = rl(cmdbuf + 6) ; - else - len = rw(cmdbuf + 7) ; - if(len > 0) { - if(start == -1) { - uae_u8 buf[SUBQ_SIZE] = { 0 } ; - sys_command_cd_qcode(unitnum, buf) ; - start = msf2lsn(fromlongbcd(buf + 4 + 7)) ; -} -int end = start + len ; -if(end > di.toc.lastaddress) - end = di.toc.lastaddress ; -sys_command_cd_pause(unitnum, 0) ; -if(!sys_command_cd_play(unitnum, start, end, 0)) - goto notdatatrack ; -} -scsi_len = 0 ; -} -break ; -case 0xbc : // PLAY CD -{ - if(nodisk(&di)) - goto nodisk ; - int start = -1 ; - int end = -1 ; - if(cmdbuf[1] & 2) { - start = msf2lsn(rl(cmdbuf + 2) & 0x00ffffff) ; - end = msf2lsn(rl(cmdbuf + 5) & 0x00ffffff) ; -} else { - start = rl(cmdbuf + 2) ; - end = start + rl(cmdbuf + 6) ; -} -if(end > di.toc.lastaddress) - end = di.toc.lastaddress ; -if(start > end) - goto errreq ; -if(start < end) { - sys_command_cd_pause(unitnum, 0) ; - if(!sys_command_cd_play(unitnum, start, end, 0)) - goto notdatatrack ; -} -} -break ; -case 0x4b : // PAUSE/RESUME -{ - if(nodisk(&di)) - goto nodisk ; - uae_u8 buf[SUBQ_SIZE] = { 0 } ; - int resume = cmdbuf[8] & 1 ; - sys_command_cd_qcode(unitnum, buf) ; - if(buf[1] != AUDIO_STATUS_IN_PROGRESS && buf[1] != AUDIO_STATUS_PAUSED) - goto errreq ; - sys_command_cd_pause(unitnum, resume ? 0 : 1) ; - scsi_len = 0 ; -} -break ; -case 0x35 : /* SYNCRONIZE CACHE (10) */ - scsi_len = 0 ; -break ; - - default : -err : - write_log(_T("CDEMU: unsupported scsi command 0x%02X\n"), cmdbuf[0]) ; -readprot : - status = 2 ; /* CHECK CONDITION */ - s[0] = 0x70 ; - s[2] = 5 ; - s[12] = 0x20 ; /* INVALID COMMAND */ - ls = 0x12 ; - break ; -nodisk : - status = 2 ; /* CHECK CONDITION */ - s[0] = 0x70 ; - s[2] = 2 ; /* NOT READY */ - s[12] = 0x3A ; /* MEDIUM NOT PRESENT */ - ls = 0x12 ; - break ; -readerr : - status = 2 ; /* CHECK CONDITION */ - s[0] = 0x70 ; - s[2] = 2 ; /* NOT READY */ - s[12] = 0x11 ; /* UNRECOVERED READ ERROR */ - ls = 0x12 ; - break ; -notdatatrack : - status = 2 ; - s[0] = 0x70 ; - s[2] = 5 ; - s[12] = 0x64 ; /* ILLEGAL MODE FOR THIS TRACK */ - ls = 0x12 ; - break ; -outofbounds : - status = 2 ; /* CHECK CONDITION */ - s[0] = 0x70 ; - s[2] = 5 ; /* ILLEGAL REQUEST */ - s[12] = 0x21 ; /* LOGICAL BLOCK OUT OF RANGE */ - ls = 0x12 ; - break ; -toolarge : - write_log(_T("CDEMU: too large scsi data tranfer %d > %d\n"), len, dlen) ; - status = 2 ; /* CHECK CONDITION */ - s[0] = 0x70 ; - s[2] = 2 ; /* NOT READY */ - s[12] = 0x11 ; /* UNRECOVERED READ ERROR */ - ls = 0x12 ; - break ; -errreq : - lr = -1 ; - status = 2 ; /* CHECK CONDITION */ - s[0] = 0x70 ; - s[2] = 5 ; /* ILLEGAL REQUEST */ - s[12] = 0x24 ; /* ILLEGAL FIELD IN CDB */ - ls = 0x12 ; - break ; -} -end : - *data_len = scsi_len ; - *reply_len = lr ; - *sense_len = ls ; - if(ls) { + default: +err: + write_log (_T("CD SCSIEMU: unsupported scsi command 0x%02X\n"), cmdbuf[0]); +readprot: + status = 2; /* CHECK CONDITION */ + s[0] = 0x70; + s[2] = 5; + s[12] = 0x20; /* INVALID COMMAND */ + ls = 0x12; + break; +nodisk: + status = 2; /* CHECK CONDITION */ + s[0] = 0x70; + s[2] = 2; /* NOT READY */ + s[12] = 0x3A; /* MEDIUM NOT PRESENT */ + ls = 0x12; + break; +readerr: + status = 2; /* CHECK CONDITION */ + s[0] = 0x70; + s[2] = 2; /* NOT READY */ + s[12] = 0x11; /* UNRECOVERED READ ERROR */ + ls = 0x12; + break; +notdatatrack: + status = 2; + s[0] = 0x70; + s[2] = 5; + s[12] = 0x64; /* ILLEGAL MODE FOR THIS TRACK */ + ls = 0x12; + break; +outofbounds: + status = 2; /* CHECK CONDITION */ + s[0] = 0x70; + s[2] = 5; /* ILLEGAL REQUEST */ + s[12] = 0x21; /* LOGICAL BLOCK OUT OF RANGE */ + ls = 0x12; + break; +errreq: + lr = -1; + status = 2; /* CHECK CONDITION */ + s[0] = 0x70; + s[2] = 5; /* ILLEGAL REQUEST */ + s[12] = 0x24; /* ILLEGAL FIELD IN CDB */ + ls = 0x12; + break; + } +end: + *data_len = scsi_len; + *reply_len = lr; + *sense_len = ls; + if (ls) { //s[0] |= 0x80; - s[7] = ls - 7 ; // additional sense length - if(log_scsiemu) { - write_log(_T("-> SENSE STATUS: KEY=%d ASC=%02X ASCQ=%02X\n"), s[2], s[12], s[13]) ; -} -} -if(cmdbuf[0] && log_scsiemu) - write_log(_T("-> DATAOUT=%d ST=%d SENSELEN=%d\n"), scsi_len, status, ls) ; -return status ; + if (ls > 7) + s[7] = ls - 8; // additional sense length + } + return status; } -static int execscsicmd_direct(int unitnum, int type, struct amigascsi *as) +static int execscsicmd_direct (int unitnum, int type, struct amigascsi *as) { - int io_error = 0 ; - uae_u8 *scsi_datap, - *scsi_datap_org ; - uae_u32 scsi_cmd_len_orig = as->cmd_len ; - uae_u8 cmd[16] = { 0 } ; - uae_u8 replydata[256] = { 0 } ; - int datalen = as->len ; - int senselen = as->sense_len ; - int replylen = 0 ; + int io_error = 0; + uae_u8 *scsi_datap, *scsi_datap_org; + uae_u32 scsi_cmd_len_orig = as->cmd_len; + uae_u8 cmd[16] = { 0 }; + uae_u8 replydata[256] = { 0 }; + int datalen = as->len; + int senselen = as->sense_len; + int replylen = 0; - memcpy(cmd, as->cmd, as->cmd_len) ; - scsi_datap = scsi_datap_org = as->len ? as->data : 0 ; - if(as->sense_len > 32) - as->sense_len = 32 ; + memcpy (cmd, as->cmd, as->cmd_len); + scsi_datap = scsi_datap_org = as->len ? as->data : 0; + if (as->sense_len > 32) + as->sense_len = 32; /* never report media change state if uaescsi.device */ - state[unitnum].mediawaschanged = false ; + state[unitnum].mediawaschanged = false; - switch(type) + switch (type) + { + case INQ_ROMD: + as->status = scsi_cd_emulate (unitnum, cmd, as->cmd_len, scsi_datap, &datalen, replydata, &replylen, as->sensedata, &senselen, false); + break; + default: + as->status = 2; + break; + } + + as->cmdactual = as->status != 0 ? 0 : as->cmd_len; /* fake scsi_CmdActual */ + if (as->status) { + io_error = IOERR_BadStatus; + as->sactual = senselen; + as->actual = 0; /* scsi_Actual */ + } else { + int i; + if (replylen > 0) { + for (int i = 0; i < replylen; i++) { + scsi_datap[i] = replydata[i]; + } + datalen = replylen; + } + for (i = 0; i < as->sense_len; i++) + as->sensedata[i] = 0; + if (datalen < 0) { + io_error = IOERR_NotSpecified; + as->actual = 0; /* scsi_Actual */ + } else { + as->len = datalen; + io_error = 0; + as->actual = as->len; /* scsi_Actual */ + } + } + + return io_error; +} + +int sys_command_scsi_direct_native (int unitnum, int type, struct amigascsi *as) { - case INQ_ROMD : - as->status = scsi_cd_emulate(unitnum, cmd, as->cmd_len, scsi_datap, &datalen, replydata, &replylen, as->sensedata, &senselen, false) ; - break ; - default : - as->status = 2 ; - break ; + struct blkdevstate *st = &state[unitnum]; + if (st->scsiemu || (type >= 0 && st->type != type)) { + return execscsicmd_direct (unitnum, type, as); + } else { + if (!st->device_func->exec_direct) + return -1; + } + int ret = st->device_func->exec_direct (unitnum, as); + if (!ret && st->device_func->isatapi(unitnum)) + scsi_atapi_fixup_inquiry (as); + return ret; } - as->cmdactual = as->status != 0 ? 0 : as->cmd_len ; /* fake scsi_CmdActual */ - if(as->status) { - io_error = IOERR_BadStatus ; - as->sactual = senselen ; - as->actual = 0 ; /* scsi_Actual */ -} else { - int i ; - if(replylen > 0) { - for(i = 0 ; i < replylen ; i++) - scsi_datap[i] = replydata[i] ; - datalen = replylen ; -} -for(i = 0 ; i < as->sense_len ; i++) - as->sensedata[i] = 0 ; -if(datalen < 0) { - io_error = IOERR_NotSpecified ; - as->actual = 0 ; /* scsi_Actual */ -} else { - as->len = datalen ; - io_error = 0 ; - as->actual = as->len ; /* scsi_Actual */ -} -} - - return io_error ; -} - -int sys_command_scsi_direct_native(int unitnum, int type, struct amigascsi *as) +int sys_command_scsi_direct(TrapContext *ctx, int unitnum, int type, uaecptr acmd) { - struct blkdevstate *st = &state[unitnum] ; - if(st->scsiemu || (type >= 0 && st->type != type)) { - return execscsicmd_direct(unitnum, type, as) ; -} else { - if(!st->device_func->exec_direct) - return - 1 ; -} -int ret = st->device_func->exec_direct(unitnum, as) ; -if(!ret && st->device_func->isatapi(unitnum)) - scsi_atapi_fixup_inquiry(as) ; -return ret ; -} + int ret; + struct amigascsi as = { 0 }; + uaecptr ap; + addrbank *bank; + uae_u8 scsicmd[30]; -int sys_command_scsi_direct(int unitnum, int type, uaecptr acmd) -{ - int ret, - i ; - struct amigascsi as = { 0 } ; - uaecptr ap ; - addrbank *bank ; + trap_get_bytes(ctx, scsicmd, acmd, sizeof scsicmd); - ap = get_long(acmd + 0) ; - as.len = get_long(acmd + 4) ; + as.cmd_len = get_word_host(scsicmd + 16); + if (as.cmd_len > sizeof as.cmd) + return IOERR_BADLENGTH; + as.flags = get_byte_host(scsicmd + 20); + ap = get_long_host(scsicmd + 0); + as.len = get_long_host(scsicmd + 4); - bank = &get_mem_bank(ap) ; - if(!bank || !bank->check(ap, as.len)) - return IOERR_BADADDRESS ; - as.data = bank->xlateaddr(ap) ; + bank = &get_mem_bank (ap); + if (!bank || !bank->check(ap, as.len)) + return IOERR_BADADDRESS; + as.data = bank->xlateaddr (ap); - ap = get_long(acmd + 12) ; - as.cmd_len = get_word(acmd + 16) ; - if(as.cmd_len > sizeof as.cmd) - return IOERR_BADLENGTH ; - for(i = 0 ; i < as.cmd_len ; i++) - as.cmd[i] = get_byte(ap++) ; - while(i < sizeof as.cmd) - as.cmd[i++] = 0 ; - as.flags = get_byte(acmd + 20) ; - as.sense_len = get_word(acmd + 26) ; + ap = get_long_host(scsicmd + 12); + trap_get_bytes(ctx, as.cmd, ap, as.cmd_len); + as.sense_len = get_word_host(scsicmd + 26); - ret = sys_command_scsi_direct_native(unitnum, type, &as) ; + ret = sys_command_scsi_direct_native (unitnum, type, &as); - put_long(acmd + 8, as.actual) ; - put_word(acmd + 18, as.cmdactual) ; - put_byte(acmd + 21, as.status) ; - put_word(acmd + 28, as.sactual) ; + put_long_host(scsicmd + 8, as.actual); + put_word_host(scsicmd + 18, as.cmdactual); + put_byte_host(scsicmd + 21, as.status); + put_word_host(scsicmd + 28, as.sactual); - if(as.flags & (2 | 4)) { // autosense - ap = get_long(acmd + 22) ; - for(i = 0 ; i < as.sactual && i < as.sense_len ; i++) - put_byte(ap + i, as.sensedata[i]) ; -} + if (as.flags & (2 | 4)) { // autosense + ap = get_long_host(scsicmd + 22); + if (as.sactual) + trap_put_bytes(ctx, as.sensedata, ap, as.sactual > as.sense_len ? as.sense_len : as.sactual); + if (as.sense_len > as.sactual) + trap_set_bytes(ctx, ap + as.sactual, 0, as.sense_len - as.sactual); + } - return ret ; + trap_put_bytes(ctx, scsicmd, acmd, sizeof scsicmd); + + return ret; } #ifdef SAVESTATE -uae_u8 *save_cd(int num, int *len) +void restore_blkdev_start(void) { - struct blkdevstate *st = &state[num] ; - uae_u8 *dstbak, - *dst ; - - memset(st->play_qcode, 0, SUBQ_SIZE) ; - if(!currprefs.cdslots[num].inuse || num >= MAX_TOTAL_SCSI_DEVICES) - return NULL ; - if(!currprefs.cs_cd32cd) - return NULL ; - dstbak = dst = xmalloc(uae_u8, 4 + 256 + 4 + 4) ; - save_u32(4 | 8) ; - save_path(currprefs.cdslots[num].name, SAVESTATE_PATH_CD) ; - save_u32(currprefs.cdslots[num].type) ; - save_u32(0) ; - save_u32(0) ; - sys_command_cd_qcode(num, st->play_qcode) ; - for(int i = 0 ; i < SUBQ_SIZE ; i++) - save_u8(st->play_qcode[i]) ; - save_u32(st->play_end_pos) ; - *len = dst - dstbak ; - return dstbak ; + for (int i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { + struct cdslot *cd = &currprefs.cdslots[i]; + if (cd->temporary) { + memset(cd, 0, sizeof(struct cdslot)); + memset(&changed_prefs.cdslots[i], 0, sizeof(struct cdslot)); + } + } } -uae_u8 *restore_cd(int num, uae_u8 *src) +uae_u8 *save_cd (int num, int *len) { - struct blkdevstate *st = &state[num] ; - uae_u32 flags ; - TCHAR *s ; + struct blkdevstate *st = &state[num]; + uae_u8 *dstbak, *dst; - if(num >= MAX_TOTAL_SCSI_DEVICES) - return NULL ; - flags = restore_u32() ; - s = restore_path(SAVESTATE_PATH_CD) ; - int type = restore_u32() ; - restore_u32() ; - if(flags & 4) { - if(currprefs.cdslots[num].name[0] == 0 || zfile_exists(s)) { - _tcscpy(changed_prefs.cdslots[num].name, s) ; - _tcscpy(currprefs.cdslots[num].name, s) ; + memset(st->play_qcode, 0, SUBQ_SIZE); + if (!currprefs.cdslots[num].inuse || num >= MAX_TOTAL_SCSI_DEVICES) + return NULL; + if (!currprefs.cs_cd32cd) + return NULL; + dstbak = dst = xmalloc (uae_u8, 4 + 256 + 4 + 4); + save_u32 (4 | 8); + save_path (currprefs.cdslots[num].name, SAVESTATE_PATH_CD); + save_u32 (currprefs.cdslots[num].type); + save_u32 (0); + save_u32 (0); + sys_command_cd_qcode (num, st->play_qcode, -1, false); + for (int i = 0; i < SUBQ_SIZE; i++) + save_u8 (st->play_qcode[i]); + save_u32 (st->play_end_pos); + *len = dst - dstbak; + return dstbak; } -changed_prefs.cdslots[num].type = currprefs.cdslots[num].type = type ; -} -if(flags & 8) { - restore_u32() ; - for(int i = 0 ; i < SUBQ_SIZE ; i++) - st->play_qcode[i] = restore_u8() ; -st->play_end_pos = restore_u32() ; -} -return src ; + +uae_u8 *restore_cd (int num, uae_u8 *src) +{ + struct blkdevstate *st = &state[num]; + uae_u32 flags; + TCHAR *s; + + if (num >= MAX_TOTAL_SCSI_DEVICES) + return NULL; + flags = restore_u32 (); + s = restore_path (SAVESTATE_PATH_CD); + int type = restore_u32 (); + restore_u32 (); + if (flags & 4) { + if (currprefs.cdslots[num].name[0] == 0 || zfile_exists (s)) { + _tcscpy (changed_prefs.cdslots[num].name, s); + _tcscpy (currprefs.cdslots[num].name, s); + } + changed_prefs.cdslots[num].type = currprefs.cdslots[num].type = type; + changed_prefs.cdslots[num].temporary = currprefs.cdslots[num].temporary = true; + } + if (flags & 8) { + restore_u32 (); + for (int i = 0; i < SUBQ_SIZE; i++) + st->play_qcode[i] = restore_u8 (); + st->play_end_pos = restore_u32 (); + } + return src; } #endif + diff --git a/src/cfgfile.cpp b/src/cfgfile.cpp index 1d9c41de..623f1808 100644 --- a/src/cfgfile.cpp +++ b/src/cfgfile.cpp @@ -1,4 +1,4 @@ -/* + /* * UAE - The Un*x Amiga Emulator * * Config file handling @@ -15,11 +15,11 @@ #include "options.h" #include "uae.h" #include "audio.h" -#include "autoconf.h" #include "custom.h" #include "inputdevice.h" #include "savestate.h" #include "include/memory.h" +#include "autoconf.h" #include "rommgr.h" #include "gui.h" #include "newcpu.h" @@ -28,97 +28,28 @@ #include "fsdb.h" #include "disk.h" #include "blkdev.h" -#include "statusline.h" #include "calc.h" #include "gfxboard.h" +#include "native2amiga_api.h" #define cfgfile_warning write_log #define cfgfile_warning_obsolete write_log +#ifdef USE_SDL1 +#include "SDL_keysym.h" +#endif + static int config_newfilesystem; static struct strlist *temp_lines; static struct strlist *error_lines; static struct zfile *default_file, *configstore; static int uaeconfig; -static int unicode_config = 0; /* @@@ need to get rid of this... just cut part of the manual and print that * as a help text. */ struct cfg_lines { - const TCHAR *config_label, *config_help; -}; - -static const struct cfg_lines opttable[] = -{ - { _T("help"), _T("Prints this help") }, - { _T("config_description"), _T("") }, - { _T("config_info"), _T("") }, - { _T("use_gui"), _T("Enable the GUI? If no, then goes straight to emulator") }, - { _T("use_debugger"), _T("Enable the debugger?") }, - { _T("cpu_speed"), _T("can be max, real, or a number between 1 and 20") }, - { _T("cpu_model"), _T("Can be 68000, 68010, 68020, 68030, 68040, 68060") }, - { _T("fpu_model"), _T("Can be 68881, 68882, 68040, 68060") }, - { _T("cpu_compatible"), _T("yes enables compatibility-mode") }, - { _T("cpu_24bit_addressing"), _T("must be set to 'no' in order for Z3mem or P96mem to work") }, - { _T("autoconfig"), _T("yes = add filesystems and extra ram") }, - { _T("log_illegal_mem"), _T("print illegal memory access by Amiga software?") }, - { _T("fastmem_size"), _T("Size in megabytes of fast-memory") }, - { _T("chipmem_size"), _T("Size in megabytes of chip-memory") }, - { _T("bogomem_size"), _T("Size in megabytes of bogo-memory at 0xC00000") }, - { _T("a3000mem_size"), _T("Size in megabytes of A3000 memory") }, - { _T("gfxcard_size"), _T("Size in megabytes of Picasso96 graphics-card memory") }, - { _T("z3mem_size"), _T("Size in megabytes of Zorro-III expansion memory") }, - { _T("gfx_test_speed"), _T("Test graphics speed?") }, - { _T("gfx_framerate"), _T("Print every nth frame") }, - { _T("gfx_width"), _T("Screen width") }, - { _T("gfx_height"), _T("Screen height") }, - { _T("gfx_refreshrate"), _T("Fullscreen refresh rate") }, - { _T("gfx_vsync"), _T("Sync screen refresh to refresh rate") }, - { _T("gfx_lores"), _T("Treat display as lo-res?") }, - { _T("gfx_linemode"), _T("Can be none, double, or scanlines") }, - { _T("gfx_fullscreen_amiga"), _T("Amiga screens are fullscreen?") }, - { _T("gfx_fullscreen_picasso"), _T("Picasso screens are fullscreen?") }, - { _T("gfx_center_horizontal"), _T("Center display horizontally?") }, - { _T("gfx_center_vertical"), _T("Center display vertically?") }, - { _T("gfx_colour_mode"), _T("") }, - { _T("32bit_blits"), _T("Enable 32 bit blitter emulation") }, - { _T("immediate_blits"), _T("Perform blits immediately") }, - { _T("show_leds"), _T("LED display") }, - { _T("keyboard_leds"), _T("Keyboard LEDs") }, - { _T("gfxlib_replacement"), _T("Use graphics.library replacement?") }, - { _T("sound_output"), _T("") }, - { _T("sound_frequency"), _T("") }, - { _T("sound_bits"), _T("") }, - { _T("sound_channels"), _T("") }, - { _T("sound_max_buff"), _T("") }, - { _T("comp_trustbyte"), _T("How to access bytes in compiler (direct/indirect/indirectKS/afterPic") }, - { _T("comp_trustword"), _T("How to access words in compiler (direct/indirect/indirectKS/afterPic") }, - { _T("comp_trustlong"), _T("How to access longs in compiler (direct/indirect/indirectKS/afterPic") }, - { _T("comp_nf"), _T("Whether to optimize away flag generation where possible") }, - { _T("comp_fpu"), _T("Whether to provide JIT FPU emulation") }, - { _T("cachesize"), _T("How many MB to use to buffer translated instructions") }, - { _T("override_dga_address"),_T("Address from which to map the frame buffer (upper 16 bits) (DANGEROUS!)") }, - { _T("avoid_dga"), _T("Set to yes if the use of DGA extension creates problems") }, - { _T("avoid_vid"), _T("Set to yes if the use of the Vidmode extension creates problems") }, - { _T("parallel_on_demand"), _T("") }, - { _T("serial_on_demand"), _T("") }, - { _T("scsi"), _T("scsi.device emulation") }, - { _T("joyport0"), _T("") }, - { _T("joyport1"), _T("") }, - { _T("pci_devices"), _T("List of PCI devices to make visible to the emulated Amiga") }, - { _T("kickstart_rom_file"), _T("Kickstart ROM image, (C) Copyright Amiga, Inc.") }, - { _T("kickstart_ext_rom_file"), _T("Extended Kickstart ROM image, (C) Copyright Amiga, Inc.") }, - { _T("kickstart_key_file"), _T("Key-file for encrypted ROM images (from Cloanto's Amiga Forever)") }, - { _T("flash_ram_file"), _T("Flash/battery backed RAM image file.") }, - { _T("cart_file"), _T("Freezer cartridge ROM image file.") }, - { _T("floppy0"), _T("Diskfile for drive 0") }, - { _T("floppy1"), _T("Diskfile for drive 1") }, - { _T("floppy2"), _T("Diskfile for drive 2") }, - { _T("floppy3"), _T("Diskfile for drive 3") }, - { _T("hardfile"), _T("access,sectors, surfaces, reserved, blocksize, path format") }, - { _T("filesystem"), _T("access,'Amiga volume-name':'host directory path' - where 'access' can be 'read-only' or 'read-write'") }, - { _T("catweasel"), _T("Catweasel board io base address") } + const TCHAR *config_label, *config_help; }; static const TCHAR *guimode1[] = { _T("no"), _T("yes"), _T("nowait"), 0 }; @@ -132,101 +63,87 @@ static const TCHAR *linemode[] = { _T("double3"), _T("scanlines3"), _T("scanlines3p2"), _T("scanlines3p3"), 0 }; static const TCHAR *speedmode[] = { _T("max"), _T("real"), 0 }; -static const TCHAR *colormode1[] = { _T("8bit"), _T("15bit"), _T("16bit"), _T("8bit_dither"), _T("4bit_dither"), _T("32bit"), 0 }; -static const TCHAR *colormode2[] = { _T("8"), _T("15"), _T("16"), _T("8d"), _T("4d"), _T("32"), 0 }; static const TCHAR *soundmode1[] = { _T("none"), _T("interrupts"), _T("normal"), _T("exact"), 0 }; static const TCHAR *soundmode2[] = { _T("none"), _T("interrupts"), _T("good"), _T("best"), 0 }; -static const TCHAR *centermode1[] = { _T("none"), _T("simple"), _T("smart"), 0 }; -static const TCHAR *centermode2[] = { _T("false"), _T("true"), _T("smart"), 0 }; static const TCHAR *stereomode[] = { _T("mono"), _T("stereo"), _T("clonedstereo"), _T("4ch"), _T("clonedstereo6ch"), _T("6ch"), _T("mixed"), 0 }; static const TCHAR *interpolmode[] = { _T("none"), _T("anti"), _T("sinc"), _T("rh"), _T("crux"), 0 }; static const TCHAR *collmode[] = { _T("none"), _T("sprites"), _T("playfields"), _T("full"), 0 }; -static const TCHAR *compmode[] = { _T("direct"), _T("indirect"), _T("indirectKS"), _T("afterPic"), 0 }; -static const TCHAR *flushmode[] = { _T("soft"), _T("hard"), 0 }; -static const TCHAR *kbleds[] = { _T("none"), _T("POWER"), _T("DF0"), _T("DF1"), _T("DF2"), _T("DF3"), _T("HD"), _T("CD"), _T("DFx"), 0 }; -static const TCHAR *onscreenleds[] = { _T("false"), _T("true"), _T("rtg"), _T("both"), 0 }; static const TCHAR *soundfiltermode1[] = { _T("off"), _T("emulated"), _T("on"), 0 }; static const TCHAR *soundfiltermode2[] = { _T("standard"), _T("enhanced"), 0 }; static const TCHAR *lorestype1[] = { _T("lores"), _T("hires"), _T("superhires"), 0 }; static const TCHAR *lorestype2[] = { _T("true"), _T("false"), 0 }; -static const TCHAR *loresmode[] = { _T("normal"), _T("filtered"), 0 }; -static const TCHAR *horizmode[] = { _T("vertical"), _T("lores"), _T("hires"), _T("superhires"), 0 }; -static const TCHAR *vertmode[] = { _T("horizontal"), _T("single"), _T("double"), _T("quadruple"), 0 }; -#ifdef GFXFILTER -static const TCHAR *filtermode2[] = { _T("1x"), _T("2x"), _T("3x"), _T("4x"), 0 }; -#endif static const TCHAR *cartsmode[] = { _T("none"), _T("hrtmon"), 0 }; static const TCHAR *idemode[] = { _T("none"), _T("a600/a1200"), _T("a4000"), 0 }; static const TCHAR *rtctype[] = { _T("none"), _T("MSM6242B"), _T("RP5C01A"), _T("MSM6242B_A2000"), 0 }; static const TCHAR *ciaatodmode[] = { _T("vblank"), _T("50hz"), _T("60hz"), 0 }; -static const TCHAR *ksmirrortype[] = { _T("none"), _T("e0"), _T("a8+e0"), 0 }; static const TCHAR *cscompa[] = { - _T("-"), _T("Generic"), _T("CDTV"), _T("CDTV-CR"), _T("CD32"), _T("A500"), _T("A500+"), _T("A600"), - _T("A1000"), _T("A1200"), _T("A2000"), _T("A3000"), _T("A3000T"), _T("A4000"), _T("A4000T"), - _T("Velvet"), + _T("-"), _T("Generic"), _T("CD32"), _T("A500"), _T("A500+"), _T("A600"), + _T("A1200"), _T("A2000"), _T("A4000"), NULL }; static const TCHAR *qsmodes[] = { - _T("A500"), _T("A500+"), _T("A600"), _T("A1000"), _T("A1200"), _T("A3000"), _T("A4000"), _T(""), _T("CD32"), _T("CDTV"), _T("CDTV-CR"), _T("ARCADIA"), NULL }; -/* 3-state boolean! */ -static const TCHAR *fullmodes[] = { _T("false"), _T("true"), /* "FILE_NOT_FOUND", */ _T("fullwindow"), 0 }; -/* bleh for compatibility */ -static const TCHAR *scsimode[] = { _T("false"), _T("true"), _T("scsi"), 0 }; -static const TCHAR *maxhoriz[] = { _T("lores"), _T("hires"), _T("superhires"), 0 }; -static const TCHAR *maxvert[] = { _T("nointerlace"), _T("interlace"), 0 }; + _T("A500"), _T("A500+"), _T("A600"), _T("A1200"), _T("A4000"), _T("CD32"), NULL }; static const TCHAR *abspointers[] = { _T("none"), _T("mousehack"), _T("tablet"), 0 }; -static const TCHAR *magiccursors[] = { _T("both"), _T("native"), _T("host"), 0 }; -static const TCHAR *autoscale[] = { _T("none"), _T("auto"), _T("standard"), _T("max"), _T("scale"), _T("resize"), _T("center"), _T("manual"), -_T("integer"), _T("integer_auto"), _T("separator"), _T("overscan_blanking"), 0 }; -static const TCHAR *autoscale_rtg[] = { _T("resize"), _T("scale"), _T("center"), _T("integer"), 0 }; -static const TCHAR *autoscalelimit[] = { _T("1/1"), _T("1/2"), _T("1/4"), _T("1/8"), 0 }; -static const TCHAR *joyportmodes[] = { _T(""), _T("mouse"), _T("mousenowheel"), _T("djoy"), _T("gamepad"), _T("ajoy"), _T("cdtvjoy"), _T("cd32joy"), _T("lightpen"), 0 }; +static const TCHAR *joyportmodes[] = { _T(""), _T("mouse"), _T("mousenowheel"), _T("djoy"), _T("gamepad"), _T("ajoy"), _T("cdtvjoy"), _T("cd32joy"), 0 }; +static const TCHAR *mousemaps[] = { _T(""), _T("left"), _T("right"), _T("both"), 0 }; static const TCHAR *joyaf[] = { _T("none"), _T("normal"), _T("toggle"), _T("always"), 0 }; -static const TCHAR *epsonprinter[] = { _T("none"), _T("ascii"), _T("epson_matrix_9pin"), _T("epson_matrix_24pin"), _T("epson_matrix_48pin"), 0 }; -static const TCHAR *aspects[] = { _T("none"), _T("vga"), _T("tv"), 0 }; static const TCHAR *vsyncmodes[] = { _T("adaptive"), _T("false"), _T("true"), _T("autoswitch"), 0 }; -static const TCHAR *vsyncmodes2[] = { _T("normal"), _T("busywait"), 0 }; -static const TCHAR *filterapi[] = { _T("directdraw"), _T("direct3d"), 0 }; -static const TCHAR *dongles[] = -{ - _T("none"), - _T("robocop 3"), _T("leaderboard"), _T("b.a.t. ii"), _T("italy'90 soccer"), _T("dames grand maitre"), - _T("rugby coach"), _T("cricket captain"), _T("leviathan"), - NULL -}; static const TCHAR *cdmodes[] = { _T("disabled"), _T(""), _T("image"), _T("ioctl"), _T("spti"), _T("aspi"), 0 }; static const TCHAR *cdconmodes[] = { _T(""), _T("uae"), _T("ide"), _T("scsi"), _T("cdtv"), _T("cd32"), 0 }; -static const TCHAR *specialmonitors[] = { _T("none"), _T("autodetect"), _T("a2024"), _T("graffiti"), -_T("ham_e"), _T("ham_e_plus"), _T("videodac18"), _T("avideo12"), _T("avideo24"), _T("firecracker24"), _T("dctv"), _T("opalvision"), _T("colorburst"), 0 }; -static const TCHAR *genlockmodes[] = { _T("none"), _T("noise"), _T("testcard"), _T("image"), _T("video"), _T("stream"), _T("ld"), _T("sony_ld"), _T("pioneer_ld"), NULL }; -static const TCHAR *ppc_implementations[] = { - _T("auto"), - _T("dummy"), - _T("pearpc"), - _T("qemu"), - NULL -}; -static const TCHAR *ppc_cpu_idle[] = { - _T("disabled"), - _T("1"), - _T("2"), - _T("3"), - _T("4"), - _T("5"), - _T("6"), - _T("7"), - _T("8"), - _T("9"), - _T("max"), - NULL -}; static const TCHAR *waitblits[] = { _T("disabled"), _T("automatic"), _T("noidleonly"), _T("always"), 0 }; static const TCHAR *autoext2[] = { _T("disabled"), _T("copy"), _T("replace"), 0 }; -static const TCHAR *leds[] = { _T("power"), _T("df0"), _T("df1"), _T("df2"), _T("df3"), _T("hd"), _T("cd"), _T("fps"), _T("cpu"), _T("snd"), _T("md"), 0 }; -static const int leds_order[] = { 3, 6, 7, 8, 9, 4, 5, 2, 1, 0, 9 }; -static const TCHAR *lacer[] = { _T("off"), _T("i"), _T("p"), 0 }; -/* another boolean to choice update.. */ -static const TCHAR *cycleexact[] = { _T("false"), _T("memory"), _T("true"), 0 }; + +static const TCHAR *button_remap_name[] = {_T("dpad_up"), _T("dpad_down") , _T("dpad_left"), _T("dpad_right"), + _T("select"), _T("left_shoulder"), _T("left_stick"), + _T("north"), _T("south"), _T("east"), _T("west"), + _T("start"), _T("right_shoulder"), _T("right_stick") ,0 }; + + + + +const TCHAR* find_inputevent_name(int key) +{ + int index = -1; + const struct inputevent *tempevent; + + const TCHAR* output; + + for(int i=0; iname); + break; + } + else + {output = "None";} + } + return output; + } + +static int find_inputevent(TCHAR* key) +{ + int index = -1; + const struct inputevent *tempevent; + char tmp1[255], tmp2[255]; + + for(int i=0; iname); + snprintf(tmp2, 255, "%s", key); + + if(!_tcscmp (tmp1, tmp2)) + { + index=i; + break; + } + } + return index; + } + struct hdcontrollerconfig { @@ -236,15 +153,9 @@ struct hdcontrollerconfig static const struct hdcontrollerconfig hdcontrollers[] = { { _T("uae"), 0 }, - { _T("ide%d"), 0 }, { _T("ide%d_mainboard"), ROMTYPE_MB_IDE }, - { _T("scsi%d"), 0 }, - { _T("scsi%d_a3000"), ROMTYPE_SCSI_A3000 }, - { _T("scsi%d_a4000t"), ROMTYPE_SCSI_A4000T }, - { _T("scsi%d_cdtv"), ROMTYPE_CDTVSCSI }, - { NULL } }; static const TCHAR *z3mapping[] = { @@ -253,14 +164,9 @@ static const TCHAR *z3mapping[] = { _T("real"), NULL }; -static const TCHAR *uaescsidevmodes[] = { - _T("original"), - _T("rename_scsi"), - NULL -}; static const TCHAR *uaebootrom[] = { _T("automatic"), - _T("disabled"), + _T("disabled"), _T("min"), _T("full"), NULL @@ -273,57 +179,30 @@ static const TCHAR *uaeboard[] = { NULL }; -static const TCHAR *serialcrlf[] = { - _T("disabled"), - _T("crlf_cr"), - NULL -}; -static const TCHAR *threebitcolors[] = { - _T("disabled"), - _T("3to4to8bit"), - _T("3to4bit"), - _T("3to8bit"), - NULL -}; - static const TCHAR *obsolete[] = { _T("accuracy"), _T("gfx_opengl"), _T("gfx_32bit_blits"), _T("32bit_blits"), _T("gfx_immediate_blits"), _T("gfx_ntsc"), _T("win32"), _T("gfx_filter_bits"), _T("sound_pri_cutoff"), _T("sound_pri_time"), _T("sound_min_buff"), _T("sound_bits"), _T("gfx_test_speed"), _T("gfxlib_replacement"), _T("enforcer"), _T("catweasel_io"), - _T("kickstart_key_file"), _T("fast_copper"), _T("sound_adjust"), _T("sound_latency"), + _T("kickstart_key_file"), _T("sound_adjust"), _T("sound_latency"), _T("serial_hardware_dtrdsr"), _T("gfx_filter_upscale"), - _T("gfx_correct_aspect"), _T("gfx_autoscale"), _T("parallel_sampler"), _T("parallel_ascii_emulation"), + _T("gfx_autoscale"), _T("parallel_sampler"), _T("parallel_ascii_emulation"), _T("avoid_vid"), _T("avoid_dga"), _T("z3chipmem_size"), _T("state_replay_buffer"), _T("state_replay"), _T("z3realmapping"), _T("force_0x10000000_z3"), - + _T("fpu_arithmetic_exceptions"), _T("gfx_filter_vert_zoom"),_T("gfx_filter_horiz_zoom"), _T("gfx_filter_vert_zoom_mult"), _T("gfx_filter_horiz_zoom_mult"), _T("gfx_filter_vert_offset"), _T("gfx_filter_horiz_offset"), - - // created by some buggy beta - _T("uaehf0%s,%s"), - _T("uaehf1%s,%s"), - _T("uaehf2%s,%s"), - _T("uaehf3%s,%s"), - _T("uaehf4%s,%s"), - _T("uaehf5%s,%s"), - _T("uaehf6%s,%s"), - _T("uaehf7%s,%s"), - _T("pcibridge_rom_file"), _T("pcibridge_rom_options"), - _T("cpuboard_ext_rom_file"), _T("uaeboard_mode"), - _T("comp_oldsegv"), _T("comp_midopt"), _T("comp_lowopt"), _T("avoid_cmov"), _T("compforcesettings"), - - NULL + NULL }; #define UNEXPANDED _T("$(FILE_PATH)") @@ -347,7 +226,7 @@ static TCHAR *cfgfile_option_find_it(const TCHAR *s, const TCHAR *option, bool c if (tmpp2) *tmpp2++ = 0; } - if (!strcasecmp(p, option)) { + if (!_tcsicmp(p, option)) { if (checkequals && tmpp2) return tmpp2; return p; @@ -366,25 +245,25 @@ static TCHAR *cfgfile_option_get(const TCHAR *s, const TCHAR *option) return cfgfile_option_find_it(s, option, true); } -static void trimwsa(char *s) +static void trimwsa (char *s) { - /* Delete trailing whitespace. */ - int len = strlen(s); - while (len > 0 && strcspn(s + len - 1, "\t \r\n") == 0) - s[--len] = '\0'; + /* Delete trailing whitespace. */ + int len = strlen (s); + while (len > 0 && strcspn (s + len - 1, "\t \r\n") == 0) + s[--len] = '\0'; } -static int match_string(const TCHAR *table[], const TCHAR *str) +static int match_string (const TCHAR *table[], const TCHAR *str) { - int i; - for (i = 0; table[i] != 0; i++) - if (strcasecmp(table[i], str) == 0) - return i; - return -1; + int i; + for (i = 0; table[i] != 0; i++) + if (_tcsicmp (table[i], str) == 0) + return i; + return -1; } // escape config file separators and control characters -static TCHAR *cfgfile_escape(const TCHAR *s, const TCHAR *escstr, bool quote) +static TCHAR *cfgfile_escape (const TCHAR *s, const TCHAR *escstr, bool quote) { bool doquote = false; int cnt = 0; @@ -405,7 +284,9 @@ static TCHAR *cfgfile_escape(const TCHAR *s, const TCHAR *escstr, bool quote) } } } - TCHAR *s2 = xmalloc(TCHAR, _tcslen(s) + cnt * 4 + 1); + if (escstr == NULL && quote) + doquote = true; + TCHAR *s2 = xmalloc (TCHAR, _tcslen (s) + cnt * 4 + 1); TCHAR *p = s2; if (doquote) *p++ = '\"'; @@ -416,8 +297,7 @@ static TCHAR *cfgfile_escape(const TCHAR *s, const TCHAR *escstr, bool quote) if (c == '\\' || c == '\"' || c == '\'') { *p++ = '\\'; *p++ = c; - } - else if (c >= 32 && !quote) { + } else if (c >= 32 && !quote) { bool escaped = false; for (int j = 0; escstr && escstr[j]; j++) { if (c == escstr[j]) { @@ -429,28 +309,26 @@ static TCHAR *cfgfile_escape(const TCHAR *s, const TCHAR *escstr, bool quote) } if (!escaped) *p++ = c; - } - else if (c < 32) { + } else if (c < 32) { *p++ = '\\'; switch (c) { - case '\t': + case '\t': *p++ = 't'; break; - case '\n': + case '\n': *p++ = 'n'; break; - case '\r': + case '\r': *p++ = 'r'; break; - default: + default: *p++ = 'x'; *p++ = (c >> 4) >= 10 ? (c >> 4) + 'a' : (c >> 4) + '0'; *p++ = (c & 15) >= 10 ? (c & 15) + 'a' : (c & 15) + '0'; break; } - } - else { + } else { *p++ = c; } } @@ -459,10 +337,23 @@ static TCHAR *cfgfile_escape(const TCHAR *s, const TCHAR *escstr, bool quote) *p = 0; return s2; } -static TCHAR *cfgfile_unescape(const TCHAR *s, const TCHAR **endpos, TCHAR separator) + +// escape only , and " +static TCHAR *cfgfile_escape_min(const TCHAR *s) +{ + for (int i = 0; s[i]; i++) { + TCHAR c = s[i]; + if (c == ',' || c == '\"') { + return cfgfile_escape(s, _T(","), true); + } + } + return my_strdup(s); +} + +static TCHAR *cfgfile_unescape (const TCHAR *s, const TCHAR **endpos, TCHAR separator) { bool quoted = false; - TCHAR *s2 = xmalloc(TCHAR, _tcslen(s) + 1); + TCHAR *s2 = xmalloc (TCHAR, _tcslen (s) + 1); TCHAR *p = s2; if (s[0] == '\"') { s++; @@ -485,28 +376,27 @@ static TCHAR *cfgfile_unescape(const TCHAR *s, const TCHAR **endpos, TCHAR separ c = s[i + 1]; switch (c) { - case 'X': - case 'x': - c2 = _totupper(s[i + 2]); + case 'X': + case 'x': + c2 = _totupper (s[i + 2]); v = ((c2 >= 'A') ? c2 - 'A' : c2 - '0') << 4; - c2 = _totupper(s[i + 3]); + c2 = _totupper (s[i + 3]); v |= (c2 >= 'A') ? c2 - 'A' : c2 - '0'; *p++ = c2; i += 2; break; - case 'r': + case 'r': *p++ = '\r'; break; - case '\n': + case '\n': *p++ = '\n'; break; - default: + default: *p++ = c; break; } i++; - } - else { + } else { *p++ = c; } } @@ -515,388 +405,308 @@ static TCHAR *cfgfile_unescape(const TCHAR *s, const TCHAR **endpos, TCHAR separ *endpos = &s[i]; return s2; } -static TCHAR *cfgfile_unescape(const TCHAR *s, const TCHAR **endpos) +static TCHAR *cfgfile_unescape (const TCHAR *s, const TCHAR **endpos) { - return cfgfile_unescape(s, endpos, 0); + return cfgfile_unescape (s, endpos, 0); } -static TCHAR *getnextentry(const TCHAR **valuep, const TCHAR separator) +static TCHAR *getnextentry (const TCHAR **valuep, const TCHAR separator) { TCHAR *s; const TCHAR *value = *valuep; if (value[0] == '\"') { - s = cfgfile_unescape(value, valuep); + s = cfgfile_unescape (value, valuep); value = *valuep; if (*value != 0 && *value != separator) { - xfree(s); + xfree (s); return NULL; } value++; *valuep = value; - } - else { - s = cfgfile_unescape(value, valuep, separator); + } else { + s = cfgfile_unescape (value, valuep, separator); } return s; } -static TCHAR *cfgfile_subst_path2(const TCHAR *path, const TCHAR *subst, const TCHAR *file) +static TCHAR *cfgfile_subst_path2 (const TCHAR *path, const TCHAR *subst, const TCHAR *file) { - /* @@@ use strcasecmp for some targets. */ - if (_tcslen(path) > 0 && _tcsncmp(file, path, _tcslen(path)) == 0) { - int l; - TCHAR *p2, *p = xmalloc(TCHAR, _tcslen(file) + _tcslen(subst) + 2); - _tcscpy(p, subst); - l = _tcslen(p); - while (l > 0 && p[l - 1] == '/') - p[--l] = '\0'; - l = _tcslen(path); - while (file[l] == '/') - l++; - _tcscat(p, _T("/")); - _tcscat(p, file + l); - p2 = target_expand_environment(p); - xfree(p); - return p2; - } + /* @@@ use strcasecmp for some targets. */ + if (_tcslen (path) > 0 && _tcsncmp (file, path, _tcslen (path)) == 0) { + int l; + TCHAR *p2, *p = xmalloc (TCHAR, _tcslen (file) + _tcslen (subst) + 2); + _tcscpy (p, subst); + l = _tcslen (p); + while (l > 0 && p[l - 1] == '/') + p[--l] = '\0'; + l = _tcslen (path); + while (file[l] == '/') + l++; + _tcscat (p, _T("/")); + _tcscat (p, file + l); + p2 = target_expand_environment (p, NULL, 0); + xfree (p); + return p2; + } return NULL; } -TCHAR* cfgfile_subst_path(const TCHAR* path, const TCHAR* subst, const TCHAR* file) +TCHAR *cfgfile_subst_path (const TCHAR *path, const TCHAR *subst, const TCHAR *file) { - TCHAR* s = cfgfile_subst_path2(path, subst, file); + TCHAR *s = cfgfile_subst_path2 (path, subst, file); if (s) return s; - s = target_expand_environment(file); + s = target_expand_environment (file, NULL, 0); return s; } -static TCHAR *cfgfile_get_multipath2(struct multipath *mp, const TCHAR *path, const TCHAR *file, bool dir) +static bool isdefault (const TCHAR *s) { - for (int i = 0; i < MAX_PATHS; i++) { - if (mp->path[i][0] && _tcscmp(mp->path[i], _T(".\\")) != 0 && _tcscmp(mp->path[i], _T("./")) != 0 && (file[0] != '/' && file[0] != '\\' && !_tcschr(file, ':'))) { - TCHAR *s = NULL; - if (path) - s = cfgfile_subst_path2(path, mp->path[i], file); - if (!s) { - TCHAR np[MAX_DPATH]; - _tcscpy(np, mp->path[i]); - fixtrailing(np); - _tcscat(np, file); - s = target_expand_environment(np); - } - if (dir) { - if (my_existsdir(s)) - return s; - } - else { - if (zfile_exists(s)) - return s; - } - xfree(s); - } - } - return NULL; + TCHAR tmp[MAX_DPATH]; + if (!default_file || uaeconfig) + return false; + zfile_fseek (default_file, 0, SEEK_SET); + while (zfile_fgets (tmp, sizeof tmp / sizeof (TCHAR), default_file)) { + if (tmp[0] && tmp[_tcslen (tmp) - 1] == '\n') + tmp[_tcslen (tmp) - 1] = 0; + if (!_tcscmp (tmp, s)) + return true; + } + return false; } -static TCHAR *cfgfile_get_multipath(struct multipath *mp, const TCHAR *path, const TCHAR *file, bool dir) +static size_t cfg_write (const void *b, struct zfile *z) { - TCHAR *s = cfgfile_get_multipath2(mp, path, file, dir); - if (s) - return s; - return my_strdup(file); -} - -static TCHAR *cfgfile_put_multipath(struct multipath *mp, const TCHAR *s) -{ - for (int i = 0; i < MAX_PATHS; i++) { - if (mp->path[i][0] && _tcscmp(mp->path[i], _T(".\\")) != 0 && _tcscmp(mp->path[i], _T("./")) != 0) { - if (_tcsnicmp(mp->path[i], s, _tcslen(mp->path[i])) == 0) { - return my_strdup(s + _tcslen(mp->path[i])); - } - } - } - return my_strdup(s); -} - -static TCHAR *cfgfile_subst_path_load(const TCHAR *path, struct multipath *mp, const TCHAR *file, bool dir) -{ - TCHAR *s = cfgfile_get_multipath2(mp, path, file, dir); - if (s) - return s; - return cfgfile_subst_path(path, mp->path[0], file); -} - -static bool isdefault(const TCHAR *s) -{ - TCHAR tmp[MAX_DPATH]; - if (!default_file || uaeconfig) - return false; - zfile_fseek(default_file, 0, SEEK_SET); - while (zfile_fgets(tmp, sizeof tmp / sizeof(TCHAR), default_file)) { - if (tmp[0] && tmp[_tcslen(tmp) - 1] == '\n') - tmp[_tcslen(tmp) - 1] = 0; - if (!_tcscmp(tmp, s)) - return true; - } - return false; -} - -static size_t cfg_write(const void* b, struct zfile* z) -{ - size_t v; - TCHAR lf = 10; - v = zfile_fwrite(b, _tcslen((TCHAR*)b), sizeof(TCHAR), z); - zfile_fwrite(&lf, 1, 1, z); - return v; + size_t v; + TCHAR lf = 10; + v = zfile_fwrite (b, _tcslen ((TCHAR*)b), sizeof (TCHAR), z); + zfile_fwrite (&lf, 1, 1, z); + return v; } #define UTF8NAME _T(".utf8") -static void cfg_dowrite(struct zfile* f, const TCHAR* option, const TCHAR* optionext, const TCHAR* value, int d, int target) +static void cfg_dowrite (struct zfile *f, const TCHAR *option, const TCHAR *optionext, const TCHAR *value, int d, int target) { - TCHAR tmp[CONFIG_BLEN], tmpext[CONFIG_BLEN]; - const TCHAR* optionp; + TCHAR tmp[CONFIG_BLEN], tmpext[CONFIG_BLEN]; + const TCHAR *optionp; if (value == NULL) return; - - if (optionext) - { - _tcscpy(tmpext, option); - _tcscat(tmpext, optionext); + if (optionext) { + _tcscpy (tmpext, option); + _tcscat (tmpext, optionext); optionp = tmpext; - } - else - { + } else { optionp = option; } - if (target) - _stprintf(tmp, _T("%s.%s=%s"), TARGET_NAME, optionp, value); - else - _stprintf(tmp, _T("%s=%s"), optionp, value); - - if (d && isdefault(tmp)) - return; - - cfg_write(tmp, f); + if (target) + _stprintf (tmp, _T("%s.%s=%s"), TARGET_NAME, optionp, value); + else + _stprintf (tmp, _T("%s=%s"), optionp, value); + if (d && isdefault (tmp)) + return; + cfg_write (tmp, f); } -static void cfg_dowrite(struct zfile *f, const TCHAR *option, const TCHAR *value, int d, int target) +static void cfg_dowrite (struct zfile *f, const TCHAR *option, const TCHAR *value, int d, int target) { - cfg_dowrite(f, option, NULL, value, d, target); + cfg_dowrite (f, option, NULL, value, d, target); } -void cfgfile_write_bool(struct zfile *f, const TCHAR *option, bool b) +void cfgfile_write_bool (struct zfile *f, const TCHAR *option, bool b) { - cfg_dowrite(f, option, b ? _T("true") : _T("false"), 0, 0); + cfg_dowrite (f, option, b ? _T("true") : _T("false"), 0, 0); } -void cfgfile_dwrite_bool(struct zfile *f, const TCHAR *option, bool b) +void cfgfile_dwrite_bool (struct zfile *f, const TCHAR *option, bool b) { - cfg_dowrite(f, option, b ? _T("true") : _T("false"), 1, 0); + cfg_dowrite (f, option, b ? _T("true") : _T("false"), 1, 0); } -void cfgfile_dwrite_bool(struct zfile *f, const TCHAR *option, const TCHAR *optionext, bool b) +static void cfgfile_dwrite_bool (struct zfile *f, const TCHAR *option, const TCHAR *optionext, bool b) { - cfg_dowrite(f, option, optionext, b ? _T("true") : _T("false"), 1, 0); + cfg_dowrite (f, option, optionext, b ? _T("true") : _T("false"), 1, 0); } -void cfgfile_dwrite_bool(struct zfile *f, const TCHAR *option, int b) +static void cfgfile_dwrite_bool (struct zfile *f, const TCHAR *option, int b) { - cfgfile_dwrite_bool(f, option, b != 0); + cfgfile_dwrite_bool (f, option, b != 0); } -void cfgfile_write_str(struct zfile *f, const TCHAR *option, const TCHAR *value) +void cfgfile_write_str (struct zfile *f, const TCHAR *option, const TCHAR *value) { - cfg_dowrite(f, option, value, 0, 0); + cfg_dowrite (f, option, value, 0, 0); } -void cfgfile_write_str(struct zfile *f, const TCHAR *option, const TCHAR *optionext, const TCHAR *value) +static void cfgfile_write_str (struct zfile *f, const TCHAR *option, const TCHAR *optionext, const TCHAR *value) { - cfg_dowrite(f, option, optionext, value, 0, 0); + cfg_dowrite (f, option, optionext, value, 0, 0); } -void cfgfile_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *value) +void cfgfile_dwrite_str (struct zfile *f, const TCHAR *option, const TCHAR *value) { - cfg_dowrite(f, option, value, 1, 0); + cfg_dowrite (f, option, value, 1, 0); } -void cfgfile_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *optionext, const TCHAR *value) +static void cfgfile_dwrite_str (struct zfile *f, const TCHAR *option, const TCHAR *optionext, const TCHAR *value) { - cfg_dowrite(f, option, optionext, value, 1, 0); + cfg_dowrite (f, option, optionext, value, 1, 0); } -void cfgfile_target_write_bool(struct zfile *f, const TCHAR *option, bool b) +void cfgfile_target_write_bool (struct zfile *f, const TCHAR *option, bool b) { - cfg_dowrite(f, option, b ? _T("true") : _T("false"), 0, 1); + cfg_dowrite (f, option, b ? _T("true") : _T("false"), 0, 1); } -void cfgfile_target_dwrite_bool(struct zfile *f, const TCHAR *option, bool b) +void cfgfile_target_dwrite_bool (struct zfile *f, const TCHAR *option, bool b) { - cfg_dowrite(f, option, b ? _T("true") : _T("false"), 1, 1); + cfg_dowrite (f, option, b ? _T("true") : _T("false"), 1, 1); } -void cfgfile_target_write_str(struct zfile *f, const TCHAR *option, const TCHAR *value) +void cfgfile_target_write_str (struct zfile *f, const TCHAR *option, const TCHAR *value) { - cfg_dowrite(f, option, value, 0, 1); + cfg_dowrite (f, option, value, 0, 1); } -void cfgfile_target_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *value) +void cfgfile_target_dwrite_str (struct zfile *f, const TCHAR *option, const TCHAR *value) { - cfg_dowrite(f, option, value, 1, 1); + cfg_dowrite (f, option, value, 1, 1); } -void cfgfile_write_ext(struct zfile* f, const TCHAR* option, const TCHAR* optionext, const TCHAR* format, ...) +static void cfgfile_write_ext (struct zfile *f, const TCHAR *option, const TCHAR *optionext, const TCHAR *format,...) { va_list parms; TCHAR tmp[CONFIG_BLEN], tmp2[CONFIG_BLEN]; - if (optionext) - { - _tcscpy(tmp2, option); - _tcscat(tmp2, optionext); + if (optionext) { + _tcscpy (tmp2, option); + _tcscat (tmp2, optionext); } - - va_start(parms, format); - _vsntprintf(tmp, CONFIG_BLEN, format, parms); - cfg_dowrite(f, optionext ? tmp2 : option, tmp, 0, 0); - va_end(parms); + va_start (parms, format); + _vsntprintf (tmp, CONFIG_BLEN, format, parms); + cfg_dowrite (f, optionext ? tmp2 : option, tmp, 0, 0); + va_end (parms); } - -void cfgfile_write(struct zfile* f, const TCHAR* option, const TCHAR* format, ...) +void cfgfile_write (struct zfile *f, const TCHAR *option, const TCHAR *format,...) { - va_list parms; - TCHAR tmp[CONFIG_BLEN]; - va_start(parms, format); - _vsntprintf(tmp, CONFIG_BLEN, format, parms); - cfg_dowrite(f, option, tmp, 0, 0); - va_end(parms); + va_list parms; + TCHAR tmp[CONFIG_BLEN]; + + va_start (parms, format); + _vsntprintf (tmp, CONFIG_BLEN, format, parms); + cfg_dowrite (f, option, tmp, 0, 0); + va_end (parms); } -void cfgfile_dwrite_ext(struct zfile* f, const TCHAR* option, const TCHAR* optionext, const TCHAR* format, ...) +static void cfgfile_dwrite_ext (struct zfile *f, const TCHAR *option, const TCHAR *optionext, const TCHAR *format,...) { va_list parms; TCHAR tmp[CONFIG_BLEN], tmp2[CONFIG_BLEN]; - if (optionext) - { - _tcscpy(tmp2, option); - _tcscat(tmp2, optionext); + if (optionext) { + _tcscpy (tmp2, option); + _tcscat (tmp2, optionext); } + va_start (parms, format); + _vsntprintf (tmp, CONFIG_BLEN, format, parms); + cfg_dowrite (f, optionext ? tmp2 : option, tmp, 1, 0); + va_end (parms); +} +void cfgfile_dwrite (struct zfile *f, const TCHAR *option, const TCHAR *format,...) +{ + va_list parms; + TCHAR tmp[CONFIG_BLEN]; - va_start(parms, format); - _vsntprintf(tmp, CONFIG_BLEN, format, parms); - cfg_dowrite(f, optionext ? tmp2 : option, tmp, 1, 0); - va_end(parms); + va_start (parms, format); + _vsntprintf (tmp, CONFIG_BLEN, format, parms); + cfg_dowrite (f, option, tmp, 1, 0); + va_end (parms); +} +void cfgfile_target_write (struct zfile *f, const TCHAR *option, const TCHAR *format,...) +{ + va_list parms; + TCHAR tmp[CONFIG_BLEN]; + + va_start (parms, format); + _vsntprintf (tmp, CONFIG_BLEN, format, parms); + cfg_dowrite (f, option, tmp, 0, 1); + va_end (parms); +} +void cfgfile_target_dwrite (struct zfile *f, const TCHAR *option, const TCHAR *format,...) +{ + va_list parms; + TCHAR tmp[CONFIG_BLEN]; + + va_start (parms, format); + _vsntprintf (tmp, CONFIG_BLEN, format, parms); + cfg_dowrite (f, option, tmp, 1, 1); + va_end (parms); } -void cfgfile_dwrite(struct zfile* f, const TCHAR* option, const TCHAR* format, ...) +static void cfgfile_write_rom (struct zfile *f, const TCHAR *path, const TCHAR *romfile, const TCHAR *name) { - va_list parms; - TCHAR tmp[CONFIG_BLEN]; - va_start(parms, format); - _vsntprintf(tmp, CONFIG_BLEN, format, parms); - cfg_dowrite(f, option, tmp, 1, 0); - va_end(parms); -} - -void cfgfile_target_write(struct zfile* f, const TCHAR* option, const TCHAR* format, ...) -{ - va_list parms; - TCHAR tmp[CONFIG_BLEN]; - va_start(parms, format); - _vsntprintf(tmp, CONFIG_BLEN, format, parms); - cfg_dowrite(f, option, tmp, 0, 1); - va_end(parms); -} - -void cfgfile_target_dwrite(struct zfile* f, const TCHAR* option, const TCHAR* format, ...) -{ - va_list parms; - TCHAR tmp[CONFIG_BLEN]; - va_start(parms, format); - _vsntprintf(tmp, CONFIG_BLEN, format, parms); - cfg_dowrite(f, option, tmp, 1, 1); - va_end(parms); -} - -static void cfgfile_write_rom(struct zfile *f, struct multipath *mp, const TCHAR *romfile, const TCHAR *name) -{ - TCHAR *str = cfgfile_subst_path(mp->path[0], UNEXPANDED, romfile); - str = cfgfile_put_multipath(mp, str); - cfgfile_write_str(f, name, str); - struct zfile *zf = zfile_fopen(str, _T("rb"), ZFD_ALL); + TCHAR *str = cfgfile_subst_path (path, UNEXPANDED, romfile); + cfgfile_write_str (f, name, str); + struct zfile *zf = zfile_fopen (str, _T("rb"), ZFD_ALL); if (zf) { - struct romdata *rd = getromdatabyzfile(zf); + struct romdata *rd = getromdatabyzfile (zf); if (rd) { TCHAR name2[MAX_DPATH], str2[MAX_DPATH]; - _tcscpy(name2, name); - _tcscat(name2, _T("_id")); - _stprintf(str2, _T("%08X,%s"), rd->crc32, rd->name); - cfgfile_write_str(f, name2, str2); + _tcscpy (name2, name); + _tcscat (name2, _T("_id")); + _stprintf (str2, _T("%08X,%s"), rd->crc32, rd->name); + cfgfile_write_str (f, name2, str2); } - zfile_fclose(zf); + zfile_fclose (zf); } - xfree(str); + xfree (str); } -static void cfgfile_write_path(struct zfile *f, struct multipath *mp, const TCHAR *option, const TCHAR *value) +static void cfgfile_write_path (struct zfile *f, const TCHAR *path, const TCHAR *option, const TCHAR *value) { - TCHAR *s = cfgfile_put_multipath(mp, value); - cfgfile_write_str(f, option, s); - xfree(s); + TCHAR *s = cfgfile_subst_path (path, UNEXPANDED, value); + cfgfile_write_str (f, option, s); + xfree (s); } -static void cfgfile_dwrite_path(struct zfile *f, struct multipath *mp, const TCHAR *option, const TCHAR *value) -{ - TCHAR *s = cfgfile_put_multipath(mp, value); - cfgfile_dwrite_str(f, option, s); - xfree(s); -} - -static void write_filesys_config(struct uae_prefs *p, struct zfile *f) +static void write_filesys_config (struct uae_prefs *p, const TCHAR *unexpanded, + const TCHAR *default_path, struct zfile *f) { TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH], tmp3[MAX_DPATH], hdcs[MAX_DPATH]; - for (int i = 0; i < p->mountitems; i++) { - struct uaedev_config_data *uci = &p->mountconfig[i]; + for (int i = 0; i < p->mountitems; i++) { + struct uaedev_config_data *uci = &p->mountconfig[i]; struct uaedev_config_info *ci = &uci->ci; - TCHAR *str1, *str1b, *str2b; + TCHAR *str1, *str1b, *str1c, *str2b; const TCHAR *str2; - int bp = ci->bootpri; + int bp = ci->bootpri; str2 = _T(""); if (ci->rootdir[0] == ':') { TCHAR *ptr; // separate harddrive names - str1 = my_strdup(ci->rootdir); - ptr = _tcschr(str1 + 1, ':'); + str1 = my_strdup (ci->rootdir); + ptr = _tcschr (str1 + 1, ':'); if (ptr) { *ptr++ = 0; str2 = ptr; - ptr = (TCHAR *)_tcschr(str2, ','); + ptr = (TCHAR *) _tcschr (str2, ','); if (ptr) *ptr = 0; } - } - else { - str1 = cfgfile_put_multipath(&p->path_hardfile, ci->rootdir); - } + } else { + str1 = cfgfile_subst_path (default_path, unexpanded, ci->rootdir); + } int ct = ci->controller_type; int romtype = 0; if (ct >= HD_CONTROLLER_TYPE_SCSI_EXPANSION_FIRST && ct <= HD_CONTROLLER_TYPE_SCSI_LAST) { _stprintf(hdcs, _T("scsi%d_%s"), ci->controller_unit, expansionroms[ct - HD_CONTROLLER_TYPE_SCSI_EXPANSION_FIRST].name); romtype = expansionroms[ct - HD_CONTROLLER_TYPE_SCSI_EXPANSION_FIRST].romtype; - } - else if (ct >= HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST && ct <= HD_CONTROLLER_TYPE_IDE_LAST) { + } else if (ct >= HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST && ct <= HD_CONTROLLER_TYPE_IDE_LAST) { _stprintf(hdcs, _T("ide%d_%s"), ci->controller_unit, expansionroms[ct - HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST].name); romtype = expansionroms[ct - HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST].romtype; - } - else if (ct == HD_CONTROLLER_TYPE_SCSI_AUTO) { + } else if (ct == HD_CONTROLLER_TYPE_SCSI_AUTO) { _stprintf(hdcs, _T("scsi%d"), ci->controller_unit); - } - else if (ct == HD_CONTROLLER_TYPE_IDE_AUTO) { + } else if (ct == HD_CONTROLLER_TYPE_IDE_AUTO) { _stprintf(hdcs, _T("ide%d"), ci->controller_unit); - } - else if (ct == HD_CONTROLLER_TYPE_PCMCIA) { + } else if (ct == HD_CONTROLLER_TYPE_PCMCIA) { if (ci->controller_type_unit == 0) _tcscpy(hdcs, _T("scsram")); else _tcscpy(hdcs, _T("scide")); - } - else if (ct == HD_CONTROLLER_TYPE_UAE) { + } else if (ct == HD_CONTROLLER_TYPE_UAE) { _tcscpy(hdcs, _T("uae")); } if (romtype) { @@ -910,64 +720,44 @@ static void write_filesys_config(struct uae_prefs *p, struct zfile *f) if (ci->controller_type_unit > 0 && ct != HD_CONTROLLER_TYPE_PCMCIA) _stprintf(hdcs + _tcslen(hdcs), _T("-%d"), ci->controller_type_unit + 1); - str1b = cfgfile_escape(str1, _T(":,"), true); - str2b = cfgfile_escape(str2, _T(":,"), true); - if (ci->type == UAEDEV_DIR) { - _stprintf(tmp, _T("%s,%s:%s:%s,%d"), ci->readonly ? _T("ro") : _T("rw"), - ci->devname ? ci->devname : _T(""), ci->volname, str1, bp); - cfgfile_write_str(f, _T("filesystem2"), tmp); - _tcscpy(tmp3, tmp); -#if 0 - _stprintf(tmp2, _T("filesystem=%s,%s:%s"), uci->readonly ? _T("ro") : _T("rw"), - uci->volname, str); - zfile_fputs(f, tmp2); -#endif - } - else if (ci->type == UAEDEV_HDF || ci->type == UAEDEV_CD || ci->type == UAEDEV_TAPE) { - _stprintf(tmp, _T("%s,%s:%s,%d,%d,%d,%d,%d,%s,%s"), - ci->readonly ? _T("ro") : _T("rw"), - ci->devname ? ci->devname : _T(""), str1, + str1b = cfgfile_escape (str1, _T(":,"), true); + str1c = cfgfile_escape_min(str1); + str2b = cfgfile_escape (str2, _T(":,"), true); + if (ci->type == UAEDEV_DIR) { + _stprintf (tmp, _T("%s,%s:%s:%s,%d"), ci->readonly ? _T("ro") : _T("rw"), + ci->devname ? ci->devname : _T(""), ci->volname, str1c, bp); + cfgfile_write_str (f, _T("filesystem2"), tmp); + _tcscpy (tmp3, tmp); + } else if (ci->type == UAEDEV_HDF || ci->type == UAEDEV_CD) { + _stprintf (tmp, _T("%s,%s:%s,%d,%d,%d,%d,%d,%s,%s"), + ci->readonly ? _T("ro") : _T("rw"), + ci->devname ? ci->devname : _T(""), str1c, ci->sectors, ci->surfaces, ci->reserved, ci->blocksize, bp, ci->filesys ? ci->filesys : _T(""), hdcs); - _stprintf(tmp3, _T("%s,%s:%s%s%s,%d,%d,%d,%d,%d,%s,%s"), + _stprintf (tmp3, _T("%s,%s:%s%s%s,%d,%d,%d,%d,%d,%s,%s"), ci->readonly ? _T("ro") : _T("rw"), ci->devname ? ci->devname : _T(""), str1b, str2b[0] ? _T(":") : _T(""), str2b, - ci->sectors, ci->surfaces, ci->reserved, ci->blocksize, + ci->sectors, ci->surfaces, ci->reserved, ci->blocksize, bp, ci->filesys ? ci->filesys : _T(""), hdcs); if (ci->highcyl || ci->physical_geometry) { - TCHAR *s = tmp + _tcslen(tmp); + TCHAR *s = tmp + _tcslen (tmp); TCHAR *s2 = s; - _stprintf(s2, _T(",%d"), ci->highcyl); + _stprintf (s2, _T(",%d"), ci->highcyl); if (ci->physical_geometry && ci->pheads && ci->psecs) { - TCHAR *s = tmp + _tcslen(tmp); - _stprintf(s, _T(",%d/%d/%d"), ci->pcyls, ci->pheads, ci->psecs); + TCHAR *s = tmp + _tcslen (tmp); + _stprintf (s, _T(",%d/%d/%d"), ci->pcyls, ci->pheads, ci->psecs); } - _tcscat(tmp3, s2); + _tcscat (tmp3, s2); } if (ci->controller_media_type) { _tcscat(tmp, _T(",CF")); _tcscat(tmp3, _T(",CF")); } const TCHAR *extras = NULL; - if (ct >= HD_CONTROLLER_TYPE_SCSI_FIRST && ct <= HD_CONTROLLER_TYPE_SCSI_LAST) { - if (ci->unit_feature_level == HD_LEVEL_SCSI_1) { - extras = _T("SCSI1"); - } - else if (ci->unit_feature_level == HD_LEVEL_SASI) { - extras = _T("SASI"); - } - else if (ci->unit_feature_level == HD_LEVEL_SASI_ENHANCED) { - extras = _T("SASIE"); - } - else if (ci->unit_feature_level == HD_LEVEL_SASI_CHS) { - extras = _T("SASI_CHS"); - } - } - else if (ct >= HD_CONTROLLER_TYPE_IDE_FIRST && ct <= HD_CONTROLLER_TYPE_IDE_LAST) { + if (ct >= HD_CONTROLLER_TYPE_IDE_FIRST && ct <= HD_CONTROLLER_TYPE_IDE_LAST) { if (ci->unit_feature_level == HD_LEVEL_ATA_1) { extras = _T("ATA1"); - } - else if (ci->unit_feature_level == HD_LEVEL_ATA_2S) { + } else if (ci->unit_feature_level == HD_LEVEL_ATA_2S) { extras = _T("ATA2+S"); } } @@ -989,23 +779,13 @@ static void write_filesys_config(struct uae_prefs *p, struct zfile *f) } if (ci->type == UAEDEV_HDF) - cfgfile_write_str(f, _T("hardfile2"), tmp); -#if 0 - _stprintf(tmp2, _T("hardfile=%s,%d,%d,%d,%d,%s"), - uci->readonly ? "ro" : "rw", uci->sectors, - uci->surfaces, uci->reserved, uci->blocksize, str); - zfile_fputs(f, tmp2); -#endif - } - _stprintf(tmp2, _T("uaehf%d"), i); + cfgfile_write_str (f, _T("hardfile2"), tmp); + } + _stprintf (tmp2, _T("uaehf%d"), i); if (ci->type == UAEDEV_CD) { - cfgfile_write(f, tmp2, _T("cd%d,%s"), ci->device_emu_unit, tmp); - } - else if (ci->type == UAEDEV_TAPE) { - cfgfile_write(f, tmp2, _T("tape%d,%s"), ci->device_emu_unit, tmp); - } - else { - cfgfile_write(f, tmp2, _T("%s,%s"), ci->type == UAEDEV_HDF ? _T("hdf") : _T("dir"), tmp3); + cfgfile_write (f, tmp2, _T("cd%d,%s"), ci->device_emu_unit, tmp); + } else { + cfgfile_write (f, tmp2, _T("%s,%s"), ci->type == UAEDEV_HDF ? _T("hdf") : _T("dir"), tmp3); } if (ci->type == UAEDEV_DIR) { bool add_extra = false; @@ -1017,66 +797,36 @@ static void write_filesys_config(struct uae_prefs *p, struct zfile *f) cfgfile_write(f, _T("filesystem_extra"), tmp2); } } - xfree(str1b); - xfree(str2b); - xfree(str1); - - } + xfree (str1b); + xfree (str1c); + xfree (str2b); + xfree (str1); + } } static void write_compatibility_cpu(struct zfile *f, struct uae_prefs *p) { - TCHAR tmp[100]; - int model; + TCHAR tmp[100]; + int model; - model = p->cpu_model; - if (model == 68030) - model = 68020; - if (model == 68060) - model = 68040; - if (p->address_space_24 && model == 68020) - _tcscpy(tmp, _T("68ec020")); - else - _stprintf(tmp, _T("%d"), model); - if (model == 68020 && (p->fpu_model == 68881 || p->fpu_model == 68882)) - _tcscat(tmp, _T("/68881")); - cfgfile_write(f, _T("cpu_type"), tmp); + model = p->cpu_model; + if (model == 68030) + model = 68020; + if (model == 68060) + model = 68040; + if (p->address_space_24 && model == 68020) + _tcscpy (tmp, _T("68ec020")); + else + _stprintf(tmp, _T("%d"), model); + if (model == 68020 && (p->fpu_model == 68881 || p->fpu_model == 68882)) + _tcscat(tmp, _T("/68881")); + cfgfile_write (f, _T("cpu_type"), tmp); } -static void write_leds(struct zfile *f, const TCHAR *name, int mask) +static void write_resolution (struct zfile *f, const TCHAR *ws, const TCHAR *hs, struct wh *wh) { - TCHAR tmp[MAX_DPATH]; - tmp[0] = 0; - for (int i = 0; leds[i]; i++) { - bool got = false; - for (int j = 0; leds[j]; j++) { - if (leds_order[j] == i) { - if (mask & (1 << j)) { - if (got) - _tcscat(tmp, _T(":")); - _tcscat(tmp, leds[j]); - got = true; - } - } - } - if (leds[i + 1] && got) - _tcscat(tmp, _T(",")); - } - while (tmp[0] && tmp[_tcslen(tmp) - 1] == ',') - tmp[_tcslen(tmp) - 1] = 0; - cfgfile_dwrite_str(f, name, tmp); -} - -static void write_resolution(struct zfile *f, const TCHAR *ws, const TCHAR *hs, struct wh *wh) -{ - if (wh->width <= 0 || wh->height <= 0 || wh->special == WH_NATIVE) { - cfgfile_write_str(f, ws, _T("native")); - cfgfile_write_str(f, hs, _T("native")); - } - else { - cfgfile_write(f, ws, _T("%d"), wh->width); - cfgfile_write(f, hs, _T("%d"), wh->height); - } + cfgfile_write (f, ws, _T("%d"), wh->width); + cfgfile_write (f, hs, _T("%d"), wh->height); } static int cfgfile_read_rom_settings(const struct expansionboardsettings *ebs, const TCHAR *buf, TCHAR *configtext) @@ -1089,7 +839,6 @@ static int cfgfile_read_rom_settings(const struct expansionboardsettings *ebs, c TCHAR *ct = configtext; for (int i = 0; ebs[i].name; i++) { const struct expansionboardsettings *eb = &ebs[i]; - bitcnt += eb->bitshift; if (eb->type == EXPANSIONBOARD_STRING) { const TCHAR *p = cfgfile_option_get(buf, eb->configname); if (p) { @@ -1097,8 +846,7 @@ static int cfgfile_read_rom_settings(const struct expansionboardsettings *ebs, c ct += _tcslen(ct); } *ct++ = 0; - } - else if (eb->type == EXPANSIONBOARD_MULTI) { + } else if (eb->type == EXPANSIONBOARD_MULTI) { int itemcnt = -1; int itemfound = 0; const TCHAR *p = eb->configname; @@ -1126,8 +874,7 @@ static int cfgfile_read_rom_settings(const struct expansionboardsettings *ebs, c itemfound &= multimask; settings |= itemfound << bitcnt; bitcnt += bits; - } - else { + } else { int mask = 1 << bitcnt; if (cfgfile_option_find(buf, eb->configname)) { settings |= mask; @@ -1146,7 +893,6 @@ static void cfgfile_write_rom_settings(const struct expansionboardsettings *ebs, int sstr = 0; for (int j = 0; ebs[j].name; j++) { const struct expansionboardsettings *eb = &ebs[j]; - bitcnt += eb->bitshift; if (eb->type == EXPANSIONBOARD_STRING) { if (settingstring) { const TCHAR *p = settingstring; @@ -1158,8 +904,7 @@ static void cfgfile_write_rom_settings(const struct expansionboardsettings *ebs, _stprintf(buf, _T("%s=%s"), eb->configname, p); sstr++; } - } - else if (eb->type == EXPANSIONBOARD_MULTI) { + } else if (eb->type == EXPANSIONBOARD_MULTI) { int itemcnt = -1; const TCHAR *p = eb->configname; while (p[0]) { @@ -1189,8 +934,7 @@ static void cfgfile_write_rom_settings(const struct expansionboardsettings *ebs, _tcscat(buf, _T(",")); _tcscat(buf, p); bitcnt += bits; - } - else { + } else { int value = settings; if (eb->invert) value ^= 0x7fffffff; @@ -1204,12 +948,12 @@ static void cfgfile_write_rom_settings(const struct expansionboardsettings *ebs, } } -static void cfgfile_write_board_rom(struct uae_prefs *prefs, struct zfile *f, struct multipath *mp, struct boardromconfig *br) +static void cfgfile_write_board_rom(struct uae_prefs *prefs, struct zfile *f, const TCHAR *path, struct boardromconfig *br) { TCHAR buf[256]; TCHAR name[256]; const struct expansionromtype *ert; - + if (br->device_type == 0) return; ert = get_device_expansion_rom(br->device_type); @@ -1222,47 +966,26 @@ static void cfgfile_write_board_rom(struct uae_prefs *prefs, struct zfile *f, st _stprintf(name, _T("%s-%d"), ert->name, br->device_num + 1); if (i == 0 || _tcslen(br->roms[i].romfile)) { _stprintf(buf, _T("%s%s_rom_file"), name, i ? _T("_ext") : _T("")); - cfgfile_write_rom(f, mp, br->roms[i].romfile, buf); + cfgfile_write_rom (f, path, br->roms[i].romfile, buf); if (br->roms[i].romident[0]) { _stprintf(buf, _T("%s%s_rom"), name, i ? _T("_ext") : _T("")); - cfgfile_dwrite_str(f, buf, br->roms[i].romident); + cfgfile_dwrite_str (f, buf, br->roms[i].romident); } - if (br->roms[i].autoboot_disabled || ert->subtypes || ert->settings || ert->id_jumper || br->device_order > 0) { + if (br->roms[i].autoboot_disabled || ert->settings || br->device_order > 0) { TCHAR buf2[256], *p; buf2[0] = 0; p = buf2; _stprintf(buf, _T("%s%s_rom_options"), name, i ? _T("_ext") : _T("")); - if (ert->subtypes) { - const struct expansionsubromtype *srt = ert->subtypes; - int k = br->roms[i].subtype; - while (k && srt[1].name) { - srt++; - k--; - } - _stprintf(p, _T("subtype=%s"), srt->configname); - } - if (br->device_order > 0 && prefs->autoconfig_custom_sort) { - if (buf2[0]) - _tcscat(buf2, _T(",")); - _stprintf(buf2, _T("order=%d"), br->device_order); - } if (br->roms[i].autoboot_disabled) { if (buf2[0]) _tcscat(buf2, _T(",")); _tcscat(buf2, _T("autoboot_disabled=true")); } - if (ert->id_jumper) { - TCHAR tmp[256]; - _stprintf(tmp, _T("id=%d"), br->roms[i].device_id); - if (buf2[0]) - _tcscat(buf2, _T(",")); - _tcscat(buf2, tmp); - } if (br->roms[i].device_settings && ert->settings) { cfgfile_write_rom_settings(ert->settings, buf2, br->roms[i].device_settings, br->roms[i].configtext); } if (buf2[0]) - cfgfile_dwrite_str(f, buf, buf2); + cfgfile_dwrite_str (f, buf, buf2); } if (br->roms[i].board_ram_size) { @@ -1304,52 +1027,20 @@ static bool cfgfile_readramboard(const TCHAR *option, const TCHAR *value, const else _stprintf(tmp1, _T("%s_options"), name); if (!_tcsicmp(option, tmp1)) { - TCHAR *s, *s1, *s2; + TCHAR *s; s = cfgfile_option_get(value, _T("order")); if (s) rb->device_order = _tstol(s); s = cfgfile_option_get(value, _T("mid")); if (s) - rb->manufacturer = _tstol(s); + rb->manufacturer = (uae_u16)_tstol(s); s = cfgfile_option_get(value, _T("pid")); if (s) - rb->product = _tstol(s); - s = cfgfile_option_get(value, _T("no_reset_unmap")); - if (s) - rb->no_reset_unmap = true; - s = cfgfile_option_get(value, _T("data")); - if (s && _tcslen(s) >= 3 * 16 - 1) { - rb->autoconfig_inuse = true; - for (int i = 0; i < sizeof rb->autoconfig; i++) { - TCHAR *s2 = &s[i * 3]; - if (i + 1 < sizeof rb->autoconfig && s2[2] != '.') - break; - TCHAR *endptr; - s[2] = 0; - rb->autoconfig[i] = (uae_u8)_tcstol(s2, &endptr, 16); - } - } - s1 = cfgfile_option_get(value, _T("start")); - s2 = cfgfile_option_get(value, _T("end")); - if (s1 && s2) { - TCHAR *endptr; - rb->start_address = _tcstol(s1, &endptr, 16); - rb->end_address = _tcstol(s2, &endptr, 16); - if (rb->start_address && rb->end_address > rb->start_address) { - rb->manual_config = true; - rb->autoconfig_inuse = false; - } - } - s1 = cfgfile_option_get(value, _T("write_address")); - if (s1) { - TCHAR *endptr; - rb->write_address = _tcstol(s1, &endptr, 16); - } - + rb->product = (uae_u8)_tstol(s); return true; } - } - return false; + } + return false; } static void cfgfile_writeramboard(struct uae_prefs *prefs, struct zfile *f, const TCHAR *name, int num, struct ramboard *rb) @@ -1361,679 +1052,195 @@ static void cfgfile_writeramboard(struct uae_prefs *prefs, struct zfile *f, cons _stprintf(tmp1, _T("%s_options"), name); tmp2[0] = 0; TCHAR *p = tmp2; - if (rb->device_order > 0 && prefs->autoconfig_custom_sort) { - if (tmp2[0]) - *p++ = ','; - _stprintf(p, _T("order=%d"), rb->device_order); - p += _tcslen(p); - } if (rb->manufacturer) { if (tmp2[0]) *p++ = ','; _stprintf(p, _T("mid=%u,pid=%u"), rb->manufacturer, rb->product); p += _tcslen(p); } - if (rb->no_reset_unmap) { - if (tmp2[0]) - *p++ = ','; - _tcscpy(p, _T("no_reset_unmap=true")); - p += _tcslen(p); - } - if (rb->autoconfig_inuse) { - uae_u8 *ac = rb->autoconfig; - if (tmp2[0]) - *p++ = ','; - _stprintf(p, _T("data=%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x"), - ac[0], ac[1], ac[2], ac[3], ac[4], ac[5], ac[6], ac[7], - ac[8], ac[9], ac[10], ac[11], ac[12], ac[13], ac[14], ac[15]); - p += _tcslen(p); - } - if (rb->manual_config && rb->start_address && rb->end_address) { - if (tmp2[0]) - *p++ = ','; - _stprintf(p, _T("start=%08x,end=%08x"), rb->start_address, rb->end_address); - p += _tcslen(p); - } - if (rb->write_address) { - _stprintf(p, _T(",write_address=%08x"), rb->write_address); - p += _tcslen(p); - } if (tmp2[0]) { cfgfile_write(f, tmp1, tmp2); } } -void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type) +void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) { - struct strlist *sl; - TCHAR tmp[MAX_DPATH]; - int i; + struct strlist *sl; + TCHAR tmp[MAX_DPATH]; + int i; - cfgfile_write_str(f, _T("config_description"), p->description); - cfgfile_write_bool(f, _T("config_hardware"), type & CONFIG_TYPE_HARDWARE); - cfgfile_write_bool(f, _T("config_host"), !!(type & CONFIG_TYPE_HOST)); - if (p->info[0]) - cfgfile_write(f, _T("config_info"), p->info); - cfgfile_write(f, _T("config_version"), _T("%d.%d.%d"), UAEMAJOR, UAEMINOR, UAESUBREV); - cfgfile_write_str(f, _T("config_hardware_path"), p->config_hardware_path); - cfgfile_write_str(f, _T("config_host_path"), p->config_host_path); - cfgfile_write_str(f, _T("config_all_path"), p->config_all_path); - if (p->config_window_title[0]) - cfgfile_write_str(f, _T("config_window_title"), p->config_window_title); - - for (sl = p->all_lines; sl; sl = sl->next) { - if (sl->unknown) { + cfgfile_write_str (f, _T("config_description"), p->description); + cfgfile_write_bool (f, _T("config_hardware"), type & CONFIG_TYPE_HARDWARE); + cfgfile_write_bool (f, _T("config_host"), !!(type & CONFIG_TYPE_HOST)); + if (p->info[0]) + cfgfile_write (f, _T("config_info"), p->info); + cfgfile_write (f, _T("config_version"), _T("%d.%d.%d"), UAEMAJOR, UAEMINOR, UAESUBREV); + + for (sl = p->all_lines; sl; sl = sl->next) { + if (sl->unknown) { if (sl->option) - cfgfile_write_str(f, sl->option, sl->value); - } - } + cfgfile_write_str (f, sl->option, sl->value); + } + } - for (i = 0; i < MAX_PATHS; i++) { - if (p->path_rom.path[i][0]) { - _stprintf(tmp, _T("%s.rom_path"), TARGET_NAME); - cfgfile_write_str(f, tmp, p->path_rom.path[i]); - } - } - for (i = 0; i < MAX_PATHS; i++) { - if (p->path_floppy.path[i][0]) { - _stprintf(tmp, _T("%s.floppy_path"), TARGET_NAME); - cfgfile_write_str(f, tmp, p->path_floppy.path[i]); - } - } - for (i = 0; i < MAX_PATHS; i++) { - if (p->path_hardfile.path[i][0]) { - _stprintf(tmp, _T("%s.hardfile_path"), TARGET_NAME); - cfgfile_write_str(f, tmp, p->path_hardfile.path[i]); - } - } - for (i = 0; i < MAX_PATHS; i++) { - if (p->path_cd.path[i][0]) { - _stprintf(tmp, _T("%s.cd_path"), TARGET_NAME); - cfgfile_write_str(f, tmp, p->path_cd.path[i]); - } - } + _stprintf (tmp, _T("%s.rom_path"), TARGET_NAME); + cfgfile_write_str (f, tmp, p->path_rom); + _stprintf (tmp, _T("%s.floppy_path"), TARGET_NAME); + cfgfile_write_str (f, tmp, p->path_floppy); + _stprintf (tmp, _T("%s.hardfile_path"), TARGET_NAME); + cfgfile_write_str (f, tmp, p->path_hardfile); + _stprintf (tmp, _T("%s.cd_path"), TARGET_NAME); + cfgfile_write_str (f, tmp, p->path_cd); - cfg_write(_T("; host-specific"), f); - - target_save_options(f, p); - - cfg_write(_T("; common"), f); - - cfgfile_write_str(f, _T("use_gui"), guimode1[p->start_gui]); - cfgfile_write_bool(f, _T("use_debugger"), p->start_debugger); - - cfgfile_write_rom(f, &p->path_rom, p->romfile, _T("kickstart_rom_file")); - cfgfile_write_rom(f, &p->path_rom, p->romextfile, _T("kickstart_ext_rom_file")); - if (p->romextfile2addr) { - cfgfile_write(f, _T("kickstart_ext_rom_file2_address"), _T("%x"), p->romextfile2addr); - cfgfile_write_rom(f, &p->path_rom, p->romextfile2, _T("kickstart_ext_rom_file2")); - } - if (p->romident[0]) - cfgfile_dwrite_str(f, _T("kickstart_rom"), p->romident); - if (p->romextident[0]) - cfgfile_write_str(f, _T("kickstart_ext_rom="), p->romextident); - - for (int i = 0; i < MAX_EXPANSION_BOARDS; i++) { - cfgfile_write_board_rom(p, f, &p->path_rom, &p->expansionboard[i]); - } - - cfgfile_write_path(f, &p->path_rom, _T("flash_file"), p->flashfile); - cfgfile_write_path(f, &p->path_rom, _T("cart_file"), p->cartfile); - cfgfile_write_path(f, &p->path_rom, _T("rtc_file"), p->rtcfile); - if (p->cartident[0]) - cfgfile_write_str(f, _T("cart"), p->cartident); - cfgfile_dwrite_path(f, &p->path_rom, _T("picassoiv_rom_file"), p->picassoivromfile); - - cfgfile_write_bool(f, _T("kickshifter"), p->kickshifter); - cfgfile_dwrite_bool(f, _T("ks_write_enabled"), p->rom_readwrite); - - cfgfile_write(f, _T("floppy_volume"), _T("%d"), p->dfxclickvolume_disk[0]); - - p->nr_floppies = 4; - for (i = 0; i < 4; i++) { - _stprintf(tmp, _T("floppy%d"), i); - cfgfile_write_path(f, &p->path_floppy, tmp, p->floppyslots[i].df); - _stprintf(tmp, _T("floppy%dwp"), i); - cfgfile_dwrite_bool(f, tmp, p->floppyslots[i].forcedwriteprotect); - _stprintf(tmp, _T("floppy%dtype"), i); - cfgfile_dwrite(f, tmp, _T("%d"), p->floppyslots[i].dfxtype); - _stprintf(tmp, _T("floppy%dsound"), i); - cfgfile_dwrite(f, tmp, _T("%d"), p->floppyslots[i].dfxclick); - if (p->floppyslots[i].dfxclick < 0 && p->floppyslots[i].dfxclickexternal[0]) { - _stprintf(tmp, _T("floppy%dsoundext"), i); - cfgfile_dwrite(f, tmp, p->floppyslots[i].dfxclickexternal); - } - if (p->floppyslots[i].dfxclick) { - _stprintf(tmp, _T("floppy%dsoundvolume_disk"), i); - cfgfile_write(f, tmp, _T("%d"), p->dfxclickvolume_disk[i]); - _stprintf(tmp, _T("floppy%dsoundvolume_empty"), i); - cfgfile_write(f, tmp, _T("%d"), p->dfxclickvolume_empty[i]); - } - if (p->floppyslots[i].dfxtype < 0 && p->nr_floppies > i) - p->nr_floppies = i; - } - for (i = 0; i < MAX_SPARE_DRIVES; i++) { - if (p->dfxlist[i][0]) { - _stprintf(tmp, _T("diskimage%d"), i); - cfgfile_dwrite_path(f, &p->path_floppy, tmp, p->dfxlist[i]); - } - } - - for (i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { - if (p->cdslots[i].name[0] || p->cdslots[i].inuse) { - TCHAR tmp2[MAX_DPATH]; - _stprintf(tmp, _T("cdimage%d"), i); - TCHAR *s = cfgfile_put_multipath(&p->path_cd, p->cdslots[i].name); - _tcscpy(tmp2, s); - xfree(s); - if (p->cdslots[i].type != SCSI_UNIT_DEFAULT || _tcschr(p->cdslots[i].name, ',') || p->cdslots[i].delayed) { - _tcscat(tmp2, _T(",")); - if (p->cdslots[i].delayed) { - _tcscat(tmp2, _T("delay")); - _tcscat(tmp2, _T(":")); - } - if (p->cdslots[i].type != SCSI_UNIT_DEFAULT) { - _tcscat(tmp2, cdmodes[p->cdslots[i].type + 1]); - } - } - cfgfile_write_str(f, tmp, tmp2); - } - } - - for (i = 0; i < MAX_LUA_STATES; i++) { - if (p->luafiles[i][0]) { - cfgfile_write_str(f, _T("lua"), p->luafiles[i]); - } - } - - if (p->statefile[0]) - cfgfile_write_str(f, _T("statefile"), p->statefile); - if (p->quitstatefile[0]) - cfgfile_write_str(f, _T("statefile_quit"), p->quitstatefile); - - cfgfile_write(f, _T("nr_floppies"), _T("%d"), p->nr_floppies); - cfgfile_dwrite_bool(f, _T("floppy_write_protect"), p->floppy_read_only); - cfgfile_write(f, _T("floppy_speed"), _T("%d"), p->floppy_speed); - cfgfile_dwrite(f, _T("floppy_channel_mask"), _T("0x%x"), p->dfxclickchannelmask); - cfgfile_write(f, _T("cd_speed"), _T("%d"), p->cd_speed); - cfgfile_write_bool(f, _T("parallel_on_demand"), p->parallel_demand); - cfgfile_write_bool(f, _T("serial_on_demand"), p->serial_demand); - cfgfile_write_bool(f, _T("serial_hardware_ctsrts"), p->serial_hwctsrts); - cfgfile_write_bool(f, _T("serial_direct"), p->serial_direct); - cfgfile_dwrite(f, _T("serial_stopbits"), _T("%d"), p->serial_stopbits); - cfgfile_dwrite_str(f, _T("serial_translate"), serialcrlf[p->serial_crlf]); - cfgfile_write_str(f, _T("scsi"), scsimode[p->scsi]); - cfgfile_write_bool(f, _T("uaeserial"), p->uaeserial); - cfgfile_write_bool(f, _T("sana2"), p->sana2); - - cfgfile_write_str(f, _T("sound_output"), soundmode1[p->produce_sound]); - cfgfile_write_str(f, _T("sound_channels"), stereomode[p->sound_stereo]); - cfgfile_write(f, _T("sound_stereo_separation"), _T("%d"), p->sound_stereo_separation); - cfgfile_write(f, _T("sound_stereo_mixing_delay"), _T("%d"), p->sound_mixed_stereo_delay >= 0 ? p->sound_mixed_stereo_delay : 0); - cfgfile_write(f, _T("sound_max_buff"), _T("%d"), p->sound_maxbsiz); - cfgfile_write(f, _T("sound_frequency"), _T("%d"), p->sound_freq); - cfgfile_write_str(f, _T("sound_interpol"), interpolmode[p->sound_interpol]); - cfgfile_write_str(f, _T("sound_filter"), soundfiltermode1[p->sound_filter]); - cfgfile_write_str(f, _T("sound_filter_type"), soundfiltermode2[p->sound_filter_type]); - cfgfile_write(f, _T("sound_volume"), _T("%d"), p->sound_volume_master); - cfgfile_write(f, _T("sound_volume_paula"), _T("%d"), p->sound_volume_paula); - if (p->sound_volume_cd >= 0) - cfgfile_write(f, _T("sound_volume_cd"), _T("%d"), p->sound_volume_cd); - if (p->sound_volume_board >= 0) - cfgfile_write(f, _T("sound_volume_ahi"), _T("%d"), p->sound_volume_board); - if (p->sound_volume_midi >= 0) - cfgfile_write(f, _T("sound_volume_midi"), _T("%d"), p->sound_volume_midi); - if (p->sound_volume_genlock >= 0) - cfgfile_write(f, _T("sound_volume_genlock"), _T("%d"), p->sound_volume_genlock); - cfgfile_write_bool(f, _T("sound_auto"), p->sound_auto); - cfgfile_write_bool(f, _T("sound_cdaudio"), p->sound_cdaudio); - cfgfile_write_bool(f, _T("sound_stereo_swap_paula"), p->sound_stereo_swap_paula); - cfgfile_write_bool(f, _T("sound_stereo_swap_ahi"), p->sound_stereo_swap_ahi); - cfgfile_dwrite(f, _T("sampler_frequency"), _T("%d"), p->sampler_freq); - cfgfile_dwrite(f, _T("sampler_buffer"), _T("%d"), p->sampler_buffer); - cfgfile_dwrite_bool(f, _T("sampler_stereo"), p->sampler_stereo); - - cfgfile_write_str(f, _T("comp_trustbyte"), compmode[p->comptrustbyte]); - cfgfile_write_str(f, _T("comp_trustword"), compmode[p->comptrustword]); - cfgfile_write_str(f, _T("comp_trustlong"), compmode[p->comptrustlong]); - cfgfile_write_str(f, _T("comp_trustnaddr"), compmode[p->comptrustnaddr]); - cfgfile_write_bool(f, _T("comp_nf"), p->compnf); - cfgfile_write_bool(f, _T("comp_constjump"), p->comp_constjump); - cfgfile_write_str(f, _T("comp_flushmode"), flushmode[p->comp_hardflush]); -#ifdef USE_JIT_FPU - cfgfile_write_bool(f, _T("compfpu"), p->compfpu); -#endif - cfgfile_write(f, _T("cachesize"), _T("%d"), p->cachesize); - - for (i = 0; i < MAX_JPORTS; i++) { + + cfg_write (_T("; "), f); + cfg_write (_T("; *** Controller/Input Configuration"), f); + cfg_write (_T("; "), f); + + for (i = 0; i < MAX_JPORTS; i++) { struct jport *jp = &p->jports[i]; int v = jp->id; TCHAR tmp1[MAX_DPATH], tmp2[MAX_DPATH]; if (v == JPORT_NONE) { - _tcscpy(tmp2, _T("none")); - } - else if (v < JSEM_CUSTOM) { + _tcscpy (tmp2, _T("none")); + } else if (v < JSEM_CUSTOM) { _stprintf(tmp2, _T("kbd%d"), v + 1); - } - else if (v < JSEM_JOYS) { + } else if (v < JSEM_JOYS) { _stprintf(tmp2, _T("custom%d"), v - JSEM_CUSTOM); - } - else if (v < JSEM_MICE) { - _stprintf(tmp2, _T("joy%d"), v - JSEM_JOYS); - } - else { - _tcscpy(tmp2, _T("mouse")); + } else if (v < JSEM_MICE) { + _stprintf (tmp2, _T("joy%d"), v - JSEM_JOYS); + } else { + _tcscpy (tmp2, _T("mouse")); if (v - JSEM_MICE > 0) - _stprintf(tmp2, _T("mouse%d"), v - JSEM_MICE); + _stprintf (tmp2, _T("mouse%d"), v - JSEM_MICE); } if (i < 2 || jp->id >= 0) { - _stprintf(tmp1, _T("joyport%d"), i); - cfgfile_write(f, tmp1, tmp2); - _stprintf(tmp1, _T("joyport%dautofire"), i); - cfgfile_write(f, tmp1, joyaf[jp->autofire]); - if (i < 2 && jp->mode > 0) { - _stprintf(tmp1, _T("joyport%dmode"), i); - cfgfile_write(f, tmp1, joyportmodes[jp->mode]); + _stprintf (tmp1, _T("joyport%d"), i); + cfgfile_write (f, tmp1, tmp2); + + _stprintf (tmp1, _T("joyport%d_autofire"), i); + cfgfile_write (f, tmp1, joyaf[jp->autofire]); + + if (jp->mode > 0) { + _stprintf (tmp1, _T("joyport%d_mode"), i); + cfgfile_dwrite_str (f, tmp1, joyportmodes[jp->mode]); } +#ifndef PANDORA + if (jp->mousemap > 0) { + _stprintf (tmp1, _T("joyport%d_mousemap"), i); + cfgfile_dwrite_str (f, tmp1, mousemaps[jp->mousemap]); + } +#endif if (jp->idc.name[0]) { - _stprintf(tmp1, _T("joyportfriendlyname%d"), i); - cfgfile_write(f, tmp1, jp->idc.name); + _stprintf (tmp1, _T("joyport%d_friendlyname"), i); + cfgfile_write (f, tmp1, jp->idc.name); } + if (jp->idc.configname[0]) { - _stprintf(tmp1, _T("joyportname%d"), i); - cfgfile_write(f, tmp1, jp->idc.configname); + _stprintf (tmp1, _T("joyport%d_name"), i); + cfgfile_write (f, tmp1, jp->idc.configname); } + if (jp->nokeyboardoverride) { - _stprintf(tmp1, _T("joyport%dkeyboardoverride"), i); - cfgfile_write_bool(f, tmp1, !jp->nokeyboardoverride); - } - } - } - for (i = 0; i < MAX_JPORTS_CUSTOM; i++) { - struct jport_custom *jp = &p->jports_custom[i]; - if (jp->custom[0]) { - TCHAR tmp1[MAX_DPATH]; - _stprintf(tmp1, _T("joyportcustom%d"), i); - cfgfile_write(f, tmp1, jp->custom); - } + _stprintf (tmp1, _T("joyport%d_keyboardoverride"), i); + cfgfile_write_bool (f, tmp1, !jp->nokeyboardoverride); + } + } + +#ifndef PANDORA + // custom options SAVING + if (i < 4 ) { + + struct joypad_map_layout tempcustom; + const TCHAR *namecustom; + + // this allows us to go through the available function keys + // currently only 'none' and 'hotkey' + for (int m=0; m<2 ; ++m) + { + + switch (m) { + case 0: + { tempcustom = jp->amiberry_custom_none; + namecustom = _T("_amiberry_custom_none_"); + break; } + case 1: + { tempcustom = jp->amiberry_custom_hotkey; + namecustom = _T("_amiberry_custom_hotkey_"); + break; } + } + + // get all of the custom actions + for (int n=0; n < 14; ++n) // loop through all buttons + { + int b = 0; + switch (n) + { + case 0: {b = tempcustom.dpad_up_action; break;} + case 1: {b = tempcustom.dpad_down_action; break;} + case 2: {b = tempcustom.dpad_left_action; break;} + case 3: {b = tempcustom.dpad_right_action; break;} + case 4: {b = tempcustom.select_action; break;} + case 5: {b = tempcustom.left_shoulder_action; break;} + case 6: {b = tempcustom.lstick_select_action; break;} + case 7: {b = tempcustom.north_action; break;} + case 8: {b = tempcustom.south_action; break;} + case 9: {b = tempcustom.east_action; break;} + case 10: {b = tempcustom.west_action; break;} + case 11: {b = tempcustom.start_action; break;} + case 12: {b = tempcustom.right_shoulder_action; break;} + case 13: {b = tempcustom.rstick_select_action; break;} + } + + if ( b > 0) {_tcscpy (tmp2, _T(find_inputevent_name(b)));} + else {snprintf(tmp2, 1, "%s", "");} + + _stprintf (tmp1, "joyport%d%s%s",i, namecustom , button_remap_name[n]); + + // cfgfile_write (f, tmp1, tmp2); } + cfgfile_dwrite_str (f, tmp1, tmp2); } + } + } +#endif + cfg_write (_T("; "), f); + } + + cfgfile_dwrite_str (f, _T("absolute_mouse"), abspointers[p->input_tablet]); + + write_inputdevice_config (p, f); + + cfgfile_write_str (f, _T("kbd_lang"), (p->keyboard_lang == KBD_LANG_DE ? _T("de") + : p->keyboard_lang == KBD_LANG_DK ? _T("dk") + : p->keyboard_lang == KBD_LANG_ES ? _T("es") + : p->keyboard_lang == KBD_LANG_US ? _T("us") + : p->keyboard_lang == KBD_LANG_SE ? _T("se") + : p->keyboard_lang == KBD_LANG_FR ? _T("fr") + : p->keyboard_lang == KBD_LANG_IT ? _T("it") + : _T("FOO"))); + + + cfg_write (_T("; "), f); + cfg_write (_T("; *** Host-Specific"), f); + cfg_write (_T("; "), f); + + target_save_options (f, p); + + cfg_write (_T("; "), f); + cfg_write (_T("; *** Common / Paths"), f); + cfg_write (_T("; "), f); + + cfgfile_write_str (f, _T("use_gui"), guimode1[p->start_gui]); + cfgfile_dwrite_bool (f, _T("show_leds"), p->leds_on_screen); + + cfgfile_write_rom (f, p->path_rom, p->romfile, _T("kickstart_rom_file")); + cfgfile_write_rom (f, p->path_rom, p->romextfile, _T("kickstart_ext_rom_file")); + + for (int i = 0; i < MAX_EXPANSION_BOARDS; i++) { + cfgfile_write_board_rom(p, f, p->path_rom, &p->expansionboard[i]); } - if (p->dongle) { - if (p->dongle + 1 >= sizeof(dongles) / sizeof(TCHAR*)) - cfgfile_write(f, _T("dongle"), _T("%d"), p->dongle); - else - cfgfile_write_str(f, _T("dongle"), dongles[p->dongle]); - } - - cfgfile_write_bool(f, _T("bsdsocket_emu"), p->socket_emu); - - //{ - // // backwards compatibility - // const TCHAR *name; - // struct romconfig *rc; - // rc = get_device_romconfig(p, ROMTYPE_A2065, 0); - // if (rc) { - // name = ethernet_getselectionname(rc ? rc->device_settings : 0); - // cfgfile_write_str(f, _T("a2065"), name); - // } - // rc = get_device_romconfig(p, ROMTYPE_NE2KPCMCIA, 0); - // if (rc) { - // name = ethernet_getselectionname(rc ? rc->device_settings : 0); - // cfgfile_write_str(f, _T("ne2000_pcmcia"), name); - // } - // rc = get_device_romconfig(p, ROMTYPE_NE2KPCI, 0); - // if (rc) { - // name = ethernet_getselectionname(rc ? rc->device_settings : 0); - // cfgfile_write_str(f, _T("ne2000_pci"), name); - // } - //} - -#ifdef WITH_SLIRP - tmp[0] = 0; - for (i = 0; i < MAX_SLIRP_REDIRS; i++) { - struct slirp_redir *sr = &p->slirp_redirs[i]; - if (sr->proto && !sr->srcport) { - TCHAR *p = tmp + _tcslen(tmp); - if (p > tmp) - *p++ = ','; - _stprintf(p, _T("%d"), sr->dstport); - } - } - if (tmp[0]) - cfgfile_write_str(f, _T("slirp_ports"), tmp); - for (i = 0; i < MAX_SLIRP_REDIRS; i++) { - struct slirp_redir *sr = &p->slirp_redirs[i]; - if (sr->proto && sr->srcport) { - uae_u32 v = htonl(sr->addr); - if (v) { - _stprintf(tmp, _T("%s:%d:%d:%d.%d.%d.%d"), - sr->proto == 1 ? _T("tcp") : _T("udp"), - sr->dstport, sr->srcport, - (v >> 24) & 0xff, (v >> 16) & 0xff, (v >> 8) & 0xff, v & 0xff); - } - else { - _stprintf(tmp, _T("%s:%d:%d"), - sr->proto == 1 ? _T("tcp") : _T("udp"), - sr->dstport, sr->srcport); - } - cfgfile_write_str(f, _T("slirp_redir"), tmp); - } - } -#endif /* WITH_SLIRP */ - - cfgfile_write_bool(f, _T("synchronize_clock"), p->tod_hack); - cfgfile_write(f, _T("maprom"), _T("0x%x"), p->maprom); - cfgfile_dwrite_str(f, _T("boot_rom_uae"), uaebootrom[p->boot_rom]); - cfgfile_dwrite_str(f, _T("uaeboard"), uaeboard[p->uaeboard]); - if (p->autoconfig_custom_sort) - cfgfile_dwrite(f, _T("uaeboard_options"), _T("order=%d"), p->uaeboard_order); - cfgfile_dwrite_str(f, _T("parallel_matrix_emulation"), epsonprinter[p->parallel_matrix_emulation]); - cfgfile_write_bool(f, _T("parallel_postscript_emulation"), p->parallel_postscript_emulation); - cfgfile_write_bool(f, _T("parallel_postscript_detection"), p->parallel_postscript_detection); - cfgfile_write_str(f, _T("ghostscript_parameters"), p->ghostscript_parameters); - cfgfile_write(f, _T("parallel_autoflush"), _T("%d"), p->parallel_autoflush_time); - cfgfile_dwrite(f, _T("uae_hide"), _T("%d"), p->uae_hide); - cfgfile_dwrite_bool(f, _T("uae_hide_autoconfig"), p->uae_hide_autoconfig); - cfgfile_dwrite_bool(f, _T("magic_mouse"), (p->input_mouse_untrap & MOUSEUNTRAP_MAGIC) != 0); - cfgfile_dwrite_str(f, _T("magic_mousecursor"), magiccursors[p->input_magic_mouse_cursor]); - cfgfile_dwrite_str(f, _T("absolute_mouse"), abspointers[p->input_tablet]); - cfgfile_dwrite_bool(f, _T("tablet_library"), p->tablet_library); - cfgfile_dwrite_bool(f, _T("clipboard_sharing"), p->clipboard_sharing); - cfgfile_dwrite_bool(f, _T("native_code"), p->native_code); - - cfgfile_write(f, _T("gfx_display"), _T("%d"), p->gfx_apmode[APMODE_NATIVE].gfx_display); - cfgfile_write_str(f, _T("gfx_display_friendlyname"), target_get_display_name(p->gfx_apmode[APMODE_NATIVE].gfx_display, true)); - cfgfile_write_str(f, _T("gfx_display_name"), target_get_display_name(p->gfx_apmode[APMODE_NATIVE].gfx_display, false)); - cfgfile_write(f, _T("gfx_display_rtg"), _T("%d"), p->gfx_apmode[APMODE_RTG].gfx_display); - cfgfile_write_str(f, _T("gfx_display_friendlyname_rtg"), target_get_display_name(p->gfx_apmode[APMODE_RTG].gfx_display, true)); - cfgfile_write_str(f, _T("gfx_display_name_rtg"), target_get_display_name(p->gfx_apmode[APMODE_RTG].gfx_display, false)); - - cfgfile_write(f, _T("gfx_framerate"), _T("%d"), p->gfx_framerate); - write_resolution(f, _T("gfx_width"), _T("gfx_height"), &p->gfx_size_win); /* compatibility with old versions */ - cfgfile_write(f, _T("gfx_top_windowed"), _T("%d"), p->gfx_size_win.x); - cfgfile_write(f, _T("gfx_left_windowed"), _T("%d"), p->gfx_size_win.y); - write_resolution(f, _T("gfx_width_windowed"), _T("gfx_height_windowed"), &p->gfx_size_win); - write_resolution(f, _T("gfx_width_fullscreen"), _T("gfx_height_fullscreen"), &p->gfx_size_fs); - cfgfile_write(f, _T("gfx_refreshrate"), _T("%d"), p->gfx_apmode[0].gfx_refreshrate); - cfgfile_dwrite(f, _T("gfx_refreshrate_rtg"), _T("%d"), p->gfx_apmode[1].gfx_refreshrate); - cfgfile_write(f, _T("gfx_autoresolution"), _T("%d"), p->gfx_autoresolution); - cfgfile_dwrite(f, _T("gfx_autoresolution_delay"), _T("%d"), p->gfx_autoresolution_delay); - cfgfile_dwrite(f, _T("gfx_autoresolution_min_vertical"), vertmode[p->gfx_autoresolution_minv + 1]); - cfgfile_dwrite(f, _T("gfx_autoresolution_min_horizontal"), horizmode[p->gfx_autoresolution_minh + 1]); - cfgfile_write_bool(f, _T("gfx_autoresolution_vga"), p->gfx_autoresolution_vga); - - cfgfile_write(f, _T("gfx_backbuffers"), _T("%d"), p->gfx_apmode[0].gfx_backbuffers); - cfgfile_write(f, _T("gfx_backbuffers_rtg"), _T("%d"), p->gfx_apmode[1].gfx_backbuffers); - if (p->gfx_apmode[APMODE_NATIVE].gfx_interlaced) - cfgfile_write_bool(f, _T("gfx_interlace"), p->gfx_apmode[APMODE_NATIVE].gfx_interlaced); - cfgfile_write_str(f, _T("gfx_vsync"), vsyncmodes[p->gfx_apmode[0].gfx_vsync + 1]); - cfgfile_write_str(f, _T("gfx_vsyncmode"), vsyncmodes2[p->gfx_apmode[0].gfx_vsyncmode]); - cfgfile_write_str(f, _T("gfx_vsync_picasso"), vsyncmodes[p->gfx_apmode[1].gfx_vsync + 1]); - cfgfile_write_str(f, _T("gfx_vsyncmode_picasso"), vsyncmodes2[p->gfx_apmode[1].gfx_vsyncmode]); - cfgfile_write_bool(f, _T("gfx_lores"), p->gfx_resolution == 0); - cfgfile_write_str(f, _T("gfx_resolution"), lorestype1[p->gfx_resolution]); - cfgfile_write_str(f, _T("gfx_lores_mode"), loresmode[p->gfx_lores_mode]); - cfgfile_write_bool(f, _T("gfx_flickerfixer"), p->gfx_scandoubler); - cfgfile_write_str(f, _T("gfx_linemode"), p->gfx_vresolution > 0 ? linemode[p->gfx_iscanlines * 4 + p->gfx_pscanlines + 1] : linemode[0]); - cfgfile_write_str(f, _T("gfx_fullscreen_amiga"), fullmodes[p->gfx_apmode[0].gfx_fullscreen]); - cfgfile_write_str(f, _T("gfx_fullscreen_picasso"), fullmodes[p->gfx_apmode[1].gfx_fullscreen]); - cfgfile_write_str(f, _T("gfx_center_horizontal"), centermode1[p->gfx_xcenter]); - cfgfile_write_str(f, _T("gfx_center_vertical"), centermode1[p->gfx_ycenter]); - cfgfile_write_str(f, _T("gfx_colour_mode"), colormode1[p->color_mode]); - cfgfile_write_bool(f, _T("gfx_blacker_than_black"), p->gfx_blackerthanblack); - cfgfile_dwrite_bool(f, _T("gfx_monochrome"), p->gfx_grayscale); - cfgfile_dwrite_str(f, _T("gfx_atari_palette_fix"), threebitcolors[p->gfx_threebitcolors]); - cfgfile_dwrite_bool(f, _T("gfx_black_frame_insertion"), p->lightboost_strobo); - cfgfile_dwrite(f, _T("gfx_black_frame_insertion_ratio"), _T("%d"), p->lightboost_strobo_ratio); - cfgfile_write_str(f, _T("gfx_api"), filterapi[p->gfx_api]); - cfgfile_dwrite(f, _T("gfx_horizontal_tweak"), _T("%d"), p->gfx_extrawidth); - -#ifdef GFXFILTER - for (int j = 0; j < 2; j++) { - struct gfx_filterdata *gf = &p->gf[j]; - const TCHAR *ext = j == 0 ? NULL : _T("_rtg"); - for (int i = 0; i gfx_filtershader[i][0]) - cfgfile_write_ext(f, _T("gfx_filter_pre"), ext, _T("D3D:%s"), gf->gfx_filtershader[i]); - if (gf->gfx_filtermask[i][0]) - cfgfile_write_str(f, _T("gfx_filtermask_pre"), ext, gf->gfx_filtermask[i]); - } - for (int i = 0; i < MAX_FILTERSHADERS; i++) { - if (gf->gfx_filtershader[i + MAX_FILTERSHADERS][0]) - cfgfile_write_ext(f, _T("gfx_filter_post"), ext, _T("D3D:%s"), gf->gfx_filtershader[i + MAX_FILTERSHADERS]); - if (gf->gfx_filtermask[i + MAX_FILTERSHADERS][0]) - cfgfile_write_str(f, _T("gfx_filtermask_post"), ext, gf->gfx_filtermask[i + MAX_FILTERSHADERS]); - } - cfgfile_dwrite_str(f, _T("gfx_filter_mask"), ext, gf->gfx_filtermask[2 * MAX_FILTERSHADERS]); - { - bool d3dfound = false; - if (gf->gfx_filtershader[2 * MAX_FILTERSHADERS][0] && p->gfx_api) { - cfgfile_dwrite_ext(f, _T("gfx_filter"), ext, _T("D3D:%s"), gf->gfx_filtershader[2 * MAX_FILTERSHADERS]); - d3dfound = true; - } - if (!d3dfound) { - if (gf->gfx_filter > 0) { - int i = 0; - struct uae_filter *uf; - while (uaefilters[i].name) { - uf = &uaefilters[i]; - if (uf->type == gf->gfx_filter) { - cfgfile_dwrite_str(f, _T("gfx_filter"), ext, uf->cfgname); - } - i++; - } - } - else { - cfgfile_dwrite_ext(f, _T("gfx_filter"), ext, _T("no")); - } - } - } - cfgfile_dwrite_str(f, _T("gfx_filter_mode"), ext, filtermode2[gf->gfx_filter_filtermode]); - cfgfile_dwrite_ext(f, _T("gfx_filter_vert_zoomf"), ext, _T("%f"), gf->gfx_filter_vert_zoom); - cfgfile_dwrite_ext(f, _T("gfx_filter_horiz_zoomf"), ext, _T("%f"), gf->gfx_filter_horiz_zoom); - cfgfile_dwrite_ext(f, _T("gfx_filter_vert_zoom_multf"), ext, _T("%f"), gf->gfx_filter_vert_zoom_mult); - cfgfile_dwrite_ext(f, _T("gfx_filter_horiz_zoom_multf"), ext, _T("%f"), gf->gfx_filter_horiz_zoom_mult); - cfgfile_dwrite_ext(f, _T("gfx_filter_vert_offsetf"), ext, _T("%f"), gf->gfx_filter_vert_offset); - cfgfile_dwrite_ext(f, _T("gfx_filter_horiz_offsetf"), ext, _T("%f"), gf->gfx_filter_horiz_offset); - - cfgfile_dwrite_ext(f, _T("gfx_filter_left_border"), ext, _T("%d"), gf->gfx_filter_left_border); - cfgfile_dwrite_ext(f, _T("gfx_filter_right_border"), ext, _T("%d"), gf->gfx_filter_right_border); - cfgfile_dwrite_ext(f, _T("gfx_filter_top_border"), ext, _T("%d"), gf->gfx_filter_top_border); - cfgfile_dwrite_ext(f, _T("gfx_filter_bottom_border"), ext, _T("%d"), gf->gfx_filter_bottom_border); - - cfgfile_dwrite_ext(f, _T("gfx_filter_scanlines"), ext, _T("%d"), gf->gfx_filter_scanlines); - cfgfile_dwrite_ext(f, _T("gfx_filter_scanlinelevel"), ext, _T("%d"), gf->gfx_filter_scanlinelevel); - cfgfile_dwrite_ext(f, _T("gfx_filter_scanlineratio"), ext, _T("%d"), gf->gfx_filter_scanlineratio); - - cfgfile_dwrite_ext(f, _T("gfx_filter_luminance"), ext, _T("%d"), gf->gfx_filter_luminance); - cfgfile_dwrite_ext(f, _T("gfx_filter_contrast"), ext, _T("%d"), gf->gfx_filter_contrast); - cfgfile_dwrite_ext(f, _T("gfx_filter_saturation"), ext, _T("%d"), gf->gfx_filter_saturation); - cfgfile_dwrite_ext(f, _T("gfx_filter_gamma"), ext, _T("%d"), gf->gfx_filter_gamma); - cfgfile_dwrite_ext(f, _T("gfx_filter_gamma_r"), ext, _T("%d"), gf->gfx_filter_gamma_ch[0]); - cfgfile_dwrite_ext(f, _T("gfx_filter_gamma_g"), ext, _T("%d"), gf->gfx_filter_gamma_ch[1]); - cfgfile_dwrite_ext(f, _T("gfx_filter_gamma_b"), ext, _T("%d"), gf->gfx_filter_gamma_ch[2]); - - cfgfile_dwrite_ext(f, _T("gfx_filter_blur"), ext, _T("%d"), gf->gfx_filter_blur); - cfgfile_dwrite_ext(f, _T("gfx_filter_noise"), ext, _T("%d"), gf->gfx_filter_noise); - cfgfile_dwrite_bool(f, _T("gfx_filter_bilinear"), ext, gf->gfx_filter_bilinear != 0); - - cfgfile_dwrite_ext(f, _T("gfx_filter_keep_autoscale_aspect"), ext, _T("%d"), gf->gfx_filter_keep_autoscale_aspect); - cfgfile_dwrite_str(f, _T("gfx_filter_keep_aspect"), ext, aspects[gf->gfx_filter_keep_aspect]); - cfgfile_dwrite_str(f, _T("gfx_filter_autoscale"), ext, ext == NULL ? autoscale[gf->gfx_filter_autoscale] : autoscale_rtg[gf->gfx_filter_autoscale]); - cfgfile_dwrite_str(f, _T("gfx_filter_autoscale_limit"), ext, autoscalelimit[gf->gfx_filter_integerscalelimit]); - cfgfile_dwrite_ext(f, _T("gfx_filter_aspect_ratio"), ext, _T("%d:%d"), - gf->gfx_filter_aspect >= 0 ? (gf->gfx_filter_aspect / ASPECTMULT) : -1, - gf->gfx_filter_aspect >= 0 ? (gf->gfx_filter_aspect & (ASPECTMULT - 1)) : -1); - if (gf->gfx_filteroverlay[0]) { - cfgfile_dwrite_ext(f, _T("gfx_filter_overlay"), ext, _T("%s%s"), - gf->gfx_filteroverlay, _tcschr(gf->gfx_filteroverlay, ',') ? _T(",") : _T("")); - } - } - cfgfile_dwrite(f, _T("gfx_luminance"), _T("%d"), p->gfx_luminance); - cfgfile_dwrite(f, _T("gfx_contrast"), _T("%d"), p->gfx_contrast); - cfgfile_dwrite(f, _T("gfx_gamma"), _T("%d"), p->gfx_gamma); - cfgfile_dwrite(f, _T("gfx_gamma_r"), _T("%d"), p->gfx_gamma_ch[0]); - cfgfile_dwrite(f, _T("gfx_gamma_g"), _T("%d"), p->gfx_gamma_ch[1]); - cfgfile_dwrite(f, _T("gfx_gamma_b"), _T("%d"), p->gfx_gamma_ch[2]); - - cfgfile_dwrite(f, _T("gfx_center_horizontal_position"), _T("%d"), p->gfx_xcenter_pos); - cfgfile_dwrite(f, _T("gfx_center_vertical_position"), _T("%d"), p->gfx_ycenter_pos); - cfgfile_dwrite(f, _T("gfx_center_horizontal_size"), _T("%d"), p->gfx_xcenter_size); - cfgfile_dwrite(f, _T("gfx_center_vertical_size"), _T("%d"), p->gfx_ycenter_size); - - cfgfile_dwrite(f, _T("rtg_vert_zoom_multf"), _T("%.f"), p->rtg_vert_zoom_mult); - cfgfile_dwrite(f, _T("rtg_horiz_zoom_multf"), _T("%.f"), p->rtg_horiz_zoom_mult); - -#endif - - cfgfile_write_bool(f, _T("immediate_blits"), p->immediate_blits); - cfgfile_dwrite_str(f, _T("waiting_blits"), waitblits[p->waiting_blits]); - cfgfile_write_bool(f, _T("ntsc"), p->ntscmode); - cfgfile_write_bool(f, _T("genlock"), p->genlock); - cfgfile_dwrite_bool(f, _T("genlock_alpha"), p->genlock_alpha); - cfgfile_dwrite_bool(f, _T("genlock_aspect"), p->genlock_aspect); - cfgfile_dwrite_str(f, _T("genlockmode"), genlockmodes[p->genlock_image]); - cfgfile_dwrite_str(f, _T("genlock_image"), p->genlock_image_file); - cfgfile_dwrite_str(f, _T("genlock_video"), p->genlock_video_file); - cfgfile_dwrite(f, _T("genlock_mix"), _T("%d"), p->genlock_mix); - cfgfile_dwrite(f, _T("genlock_scale"), _T("%d"), p->genlock_scale); - cfgfile_dwrite_str(f, _T("monitoremu"), specialmonitors[p->monitoremu]); - - cfgfile_dwrite_bool(f, _T("show_leds"), !!(p->leds_on_screen & STATUSLINE_CHIPSET)); - cfgfile_dwrite_bool(f, _T("show_leds_rtg"), !!(p->leds_on_screen & STATUSLINE_RTG)); - write_leds(f, _T("show_leds_enabled"), p->leds_on_screen_mask[0]); - write_leds(f, _T("show_leds_enabled_rtg"), p->leds_on_screen_mask[1]); - cfgfile_dwrite_bool(f, _T("show_refresh_indicator"), p->refresh_indicator); - - if (p->osd_pos.y || p->osd_pos.x) { - cfgfile_dwrite(f, _T("osd_position"), _T("%.1f%s:%.1f%s"), - p->osd_pos.x >= 20000 ? (p->osd_pos.x - 30000) / 10.0 : (float)p->osd_pos.x, p->osd_pos.x >= 20000 ? _T("%") : _T(""), - p->osd_pos.y >= 20000 ? (p->osd_pos.y - 30000) / 10.0 : (float)p->osd_pos.y, p->osd_pos.y >= 20000 ? _T("%") : _T("")); - } - cfgfile_dwrite(f, _T("keyboard_leds"), _T("numlock:%s,capslock:%s,scrolllock:%s"), - kbleds[p->keyboard_leds[0]], kbleds[p->keyboard_leds[1]], kbleds[p->keyboard_leds[2]]); - if (p->chipset_mask & CSMASK_AGA) - cfgfile_write(f, _T("chipset"), _T("aga")); - else if ((p->chipset_mask & CSMASK_ECS_AGNUS) && (p->chipset_mask & CSMASK_ECS_DENISE)) - cfgfile_write(f, _T("chipset"), _T("ecs")); - else if (p->chipset_mask & CSMASK_ECS_AGNUS) - cfgfile_write(f, _T("chipset"), _T("ecs_agnus")); - else if (p->chipset_mask & CSMASK_ECS_DENISE) - cfgfile_write(f, _T("chipset"), _T("ecs_denise")); - else - cfgfile_write(f, _T("chipset"), _T("ocs")); - if (p->chipset_refreshrate > 0) - cfgfile_write(f, _T("chipset_refreshrate"), _T("%f"), p->chipset_refreshrate); - - for (int i = 0; i < MAX_CHIPSET_REFRESH_TOTAL; i++) { - struct chipset_refresh *cr = &p->cr[i]; - if (!cr->inuse) - continue; - cr->index = i; - if (cr->rate == 0) - _tcscpy(tmp, _T("0")); - else - _stprintf(tmp, _T("%f"), cr->rate); - TCHAR *s = tmp + _tcslen(tmp); - if (cr->label[0] > 0 && i < MAX_CHIPSET_REFRESH) - s += _stprintf(s, _T(",t=%s"), cr->label); - if (cr->horiz > 0) - s += _stprintf(s, _T(",h=%d"), cr->horiz); - if (cr->vert > 0) - s += _stprintf(s, _T(",v=%d"), cr->vert); - if (cr->locked) - _tcscat(s, _T(",locked")); - if (cr->ntsc == 1) - _tcscat(s, _T(",ntsc")); - else if (cr->ntsc == 0) - _tcscat(s, _T(",pal")); - else if (cr->ntsc == 2) - _tcscat(s, _T(",custom")); - if (cr->lace > 0) - _tcscat(s, _T(",lace")); - else if (cr->lace == 0) - _tcscat(s, _T(",nlace")); - if ((cr->resolution & 7) != 7) { - if (cr->resolution & 1) - _tcscat(s, _T(",lores")); - if (cr->resolution & 2) - _tcscat(s, _T(",hires")); - if (cr->resolution & 4) - _tcscat(s, _T(",shres")); - if (cr->resolution_pct > 0 && cr->resolution_pct < 100) - s += _stprintf(s, _T("rpct=%d"), cr->resolution_pct); - } - if (cr->framelength > 0) - _tcscat(s, _T(",lof")); - else if (cr->framelength == 0) - _tcscat(s, _T(",shf")); - if (cr->vsync > 0) - _tcscat(s, _T(",vsync")); - else if (cr->vsync == 0) - _tcscat(s, _T(",nvsync")); - if (cr->rtg) - _tcscat(s, _T(",rtg")); - if (cr->exit) - _tcscat(s, _T(",exit")); - if (cr->defaultdata) - _tcscat(s, _T(",default")); - if (cr->filterprofile[0]) { - TCHAR *se = cfgfile_escape(cr->filterprofile, _T(","), true); - s += _stprintf(s, _T(",filter=%s"), cr->filterprofile); - xfree(se); - } - if (cr->commands[0]) { - _tcscat(s, _T(",cmd=")); - _tcscat(s, cr->commands); - for (int j = 0; j < _tcslen(s); j++) { - if (s[j] == '\n') - s[j] = ','; - } - s[_tcslen(s) - 1] = 0; - } - if (i == CHIPSET_REFRESH_PAL) { - if (cr->locked) - cfgfile_dwrite(f, _T("displaydata_pal"), tmp); - } - else if (i == CHIPSET_REFRESH_NTSC) { - if (cr->locked) - cfgfile_dwrite(f, _T("displaydata_ntsc"), tmp); - } - else { - cfgfile_dwrite(f, _T("displaydata"), tmp); - } - } - - cfgfile_write_str(f, _T("collision_level"), collmode[p->collision_level]); - - cfgfile_write_str(f, _T("chipset_compatible"), cscompa[p->cs_compatible]); - cfgfile_dwrite_str(f, _T("ciaatod"), ciaatodmode[p->cs_ciaatod]); - cfgfile_dwrite_str(f, _T("rtc"), rtctype[p->cs_rtc]); - //cfgfile_dwrite (f, _T("chipset_rtc_adjust"), _T("%d"), p->cs_rtc_adjust); - cfgfile_dwrite_bool(f, _T("ksmirror_e0"), p->cs_ksmirror_e0); - cfgfile_dwrite_bool(f, _T("ksmirror_a8"), p->cs_ksmirror_a8); - cfgfile_dwrite_bool(f, _T("cd32cd"), p->cs_cd32cd); - cfgfile_dwrite_bool(f, _T("cd32c2p"), p->cs_cd32c2p); - cfgfile_dwrite_bool(f, _T("cd32nvram"), p->cs_cd32nvram); - cfgfile_dwrite(f, _T("cd32nvram_size"), _T("%d"), p->cs_cd32nvram_size / 1024); - cfgfile_dwrite_bool(f, _T("cdtvcd"), p->cs_cdtvcd); - cfgfile_dwrite_bool(f, _T("cdtv-cr"), p->cs_cdtvcr); - cfgfile_dwrite_bool(f, _T("cdtvram"), p->cs_cdtvram); - cfgfile_dwrite(f, _T("cdtvramcard"), _T("%d"), p->cs_cdtvcard); - cfgfile_dwrite_bool(f, _T("a1000ram"), p->cs_a1000ram); - cfgfile_dwrite(f, _T("fatgary"), _T("%d"), p->cs_fatgaryrev); - cfgfile_dwrite(f, _T("ramsey"), _T("%d"), p->cs_ramseyrev); - cfgfile_dwrite_bool(f, _T("pcmcia"), p->cs_pcmcia); - cfgfile_dwrite_bool(f, _T("bogomem_fast"), p->cs_slowmemisfast); - cfgfile_dwrite_bool(f, _T("resetwarning"), p->cs_resetwarning); - cfgfile_dwrite_bool(f, _T("denise_noehb"), p->cs_denisenoehb); - cfgfile_dwrite_bool(f, _T("agnus_bltbusybug"), p->cs_agnusbltbusybug); - cfgfile_dwrite_bool(f, _T("ics_agnus"), p->cs_dipagnus); - cfgfile_dwrite_bool(f, _T("cia_todbug"), p->cs_ciatodbug); - cfgfile_dwrite_bool(f, _T("z3_autoconfig"), p->cs_z3autoconfig); - cfgfile_dwrite_bool(f, _T("1mchipjumper"), p->cs_1mchipjumper); - cfgfile_dwrite_bool(f, _T("color_burst"), p->cs_color_burst); - cfgfile_dwrite(f, _T("chipset_hacks"), _T("0x%x"), p->cs_hacks); + cfgfile_write_str (f, _T("flash_file"), p->flashfile); + cfgfile_write_str (f, _T("cart_file"), p->cartfile); if (is_board_enabled(p, ROMTYPE_CD32CART, 0)) { cfgfile_dwrite_bool(f, _T("cd32fmv"), true); @@ -2044,38 +1251,145 @@ void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type) if (is_board_enabled(p, ROMTYPE_MB_IDE, 0) && p->cs_ide == 2) { cfgfile_dwrite_str(f, _T("ide"), _T("a4000")); } - if (is_board_enabled(p, ROMTYPE_CDTVSCSI, 0)) { - cfgfile_dwrite_bool(f, _T("scsi_cdtv"), true); - } - if (is_board_enabled(p, ROMTYPE_SCSI_A3000, 0)) { - cfgfile_dwrite_bool(f, _T("scsi_a3000"), true); - } - if (is_board_enabled(p, ROMTYPE_SCSI_A4000T, 0)) { - cfgfile_dwrite_bool(f, _T("scsi_a4000t"), true); - } + + cfg_write (_T("; "), f); + cfg_write (_T("; *** Floppy Drives"), f); + cfg_write (_T("; "), f); + + p->nr_floppies = 4; + for (i = 0; i < 4; i++) { + _stprintf (tmp, _T("floppy%d"), i); + cfgfile_write_path(f, p->path_floppy, tmp, p->floppyslots[i].df); + _stprintf (tmp, _T("floppy%dwp"), i); + cfgfile_dwrite_bool (f, tmp, p->floppyslots[i].forcedwriteprotect); + _stprintf (tmp, _T("floppy%dtype"), i); + cfgfile_dwrite (f, tmp, _T("%d"), p->floppyslots[i].dfxtype); + if (p->floppyslots[i].dfxtype < 0 && p->nr_floppies > i) + p->nr_floppies = i; + } - cfgfile_dwrite_str(f, _T("z3mapping"), z3mapping[p->z3_mapping_mode]); - cfgfile_dwrite_bool(f, _T("board_custom_order"), p->autoconfig_custom_sort); + + cfgfile_write (f, _T("nr_floppies"), _T("%d"), p->nr_floppies); + cfgfile_dwrite_bool (f, _T("floppy_write_protect"), p->floppy_read_only); + cfgfile_write (f, _T("floppy_speed"), _T("%d"), p->floppy_speed); + + cfg_write (_T("; "), f); + cfg_write (_T("; *** Hard Drives"), f); + cfg_write (_T("; "), f); + + #ifdef FILESYS + write_filesys_config (p, UNEXPANDED, p->path_hardfile, f); + cfgfile_dwrite (f, _T("filesys_max_size"), _T("%d"), p->filesys_limit); + cfgfile_dwrite (f, _T("filesys_max_name_length"), _T("%d"), p->filesys_max_name); + cfgfile_dwrite_bool (f, _T("filesys_inject_icons"), p->filesys_inject_icons); + cfgfile_dwrite_str (f, _T("filesys_inject_icons_drawer"), p->filesys_inject_icons_drawer); + cfgfile_dwrite_str (f, _T("filesys_inject_icons_project"), p->filesys_inject_icons_project); + cfgfile_dwrite_str (f, _T("filesys_inject_icons_tool"), p->filesys_inject_icons_tool); +#endif + cfgfile_dwrite_bool(f, _T("harddrive_write_protect"), p->harddrive_read_only); + + + cfg_write (_T("; "), f); + cfg_write (_T("; *** CD / CD32"), f); + cfg_write (_T("; "), f); + + cfgfile_write (f, _T("cd_speed"), _T("%d"), p->cd_speed); + cfgfile_dwrite_bool (f, _T("cd32cd"), p->cs_cd32cd); + cfgfile_dwrite_bool (f, _T("cd32c2p"), p->cs_cd32c2p); + cfgfile_dwrite_bool (f, _T("cd32nvram"), p->cs_cd32nvram); + cfgfile_dwrite (f, _T("cd32nvram_size"), _T("%d"), p->cs_cd32nvram_size / 1024); + + for (i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { + if (p->cdslots[i].name[0] || p->cdslots[i].inuse) { + TCHAR tmp2[MAX_DPATH]; + _stprintf (tmp, _T("cdimage%d"), i); + TCHAR *s = cfgfile_subst_path (p->path_cd, UNEXPANDED, p->cdslots[i].name); + _tcscpy (tmp2, s); + xfree (s); + if (p->cdslots[i].type != SCSI_UNIT_DEFAULT || _tcschr (p->cdslots[i].name, ',') || p->cdslots[i].delayed) { + _tcscat (tmp2, _T(",")); + if (p->cdslots[i].delayed) { + _tcscat (tmp2, _T("delay")); + _tcscat (tmp2, _T(":")); + } + if (p->cdslots[i].type != SCSI_UNIT_DEFAULT) { + _tcscat (tmp2, cdmodes[p->cdslots[i].type + 1]); + } + } + cfgfile_write_str (f, tmp, tmp2); + } + } + + + cfg_write (_T("; "), f); + cfg_write (_T("; *** Display / Screen Setup"), f); + cfg_write (_T("; "), f); + + cfgfile_write (f, _T("gfx_framerate"), _T("%d"), p->gfx_framerate); + write_resolution (f, _T("gfx_width"), _T("gfx_height"), &p->gfx_size); /* compatibility with old versions */ + cfgfile_write (f, _T("gfx_refreshrate"), _T("%d"), p->gfx_apmode[0].gfx_refreshrate); + cfgfile_dwrite (f, _T("gfx_refreshrate_rtg"), _T("%d"), p->gfx_apmode[1].gfx_refreshrate); + + cfgfile_write_str (f, _T("gfx_vsync"), vsyncmodes[p->gfx_apmode[0].gfx_vsync + 1]); + cfgfile_write_str (f, _T("gfx_vsync_picasso"), vsyncmodes[p->gfx_apmode[1].gfx_vsync + 1]); + cfgfile_write_bool (f, _T("gfx_lores"), p->gfx_resolution == 0); + cfgfile_write_str (f, _T("gfx_resolution"), lorestype1[p->gfx_resolution]); + cfgfile_write_str(f, _T("gfx_linemode"), p->gfx_vresolution > 0 ? linemode[1] : linemode[0]); + + cfgfile_write_bool(f, _T("ntsc"), p->ntscmode); + + cfg_write (_T("; "), f); + cfg_write (_T("; *** CPU options"), f); + cfg_write (_T("; "), f); + + if (p->m68k_speed > 0) { + cfgfile_write (f, _T("finegrain_cpu_speed"), _T("%d"), p->m68k_speed); + } else { + cfgfile_write_str (f, _T("cpu_speed"), p->m68k_speed < 0 ? _T("max") : _T("real")); + } + + /* do not reorder start */ + write_compatibility_cpu(f, p); + cfgfile_write (f, _T("cpu_model"), _T("%d"), p->cpu_model); + if (p->fpu_model) + cfgfile_write (f, _T("fpu_model"), _T("%d"), p->fpu_model); + cfgfile_write_bool (f, _T("cpu_compatible"), p->cpu_compatible); + cfgfile_write_bool (f, _T("cpu_24bit_addressing"), p->address_space_24); + /* do not reorder end */ + + cfgfile_dwrite_bool (f, _T("fpu_no_unimplemented"), p->fpu_no_unimplemented); + cfgfile_write_bool (f, _T("fpu_strict"), p->fpu_strict); + cfgfile_dwrite_bool (f, _T("fpu_softfloat"), p->fpu_softfloat); + + cfgfile_write (f, _T("cachesize"), _T("%d"), p->cachesize); + + cfg_write (_T("; "), f); + cfg_write (_T("; *** Memory"), f); + cfg_write (_T("; "), f); + + cfgfile_write (f, _T("chipmem_size"), _T("%d"), p->chipmem_size == 0x20000 ? -1 : (p->chipmem_size == 0x40000 ? 0 : p->chipmem_size / 0x80000)); + + + cfgfile_dwrite_bool(f, _T("z3_autoconfig"), p->cs_z3autoconfig); + cfgfile_dwrite_str (f, _T("z3mapping"), z3mapping[p->z3_mapping_mode]); for (int i = 0; i < MAX_RAM_BOARDS; i++) { - if (p->fastmem[i].size < 0x100000 && p->fastmem[i].size) { + if (p->fastmem[i].size < 0x100000 && p->fastmem[i].size) { if (i > 0) _stprintf(tmp, _T("fastmem%d_size_k"), i + 1); else _tcscpy(tmp, _T("fastmem_size_k")); - cfgfile_write(f, tmp, _T("%d"), p->fastmem[i].size / 1024); - } - else if (p->fastmem[i].size || i == 0) { - if (i > 0) + cfgfile_write (f, tmp, _T("%d"), p->fastmem[i].size / 1024); + } else if (p->fastmem[i].size || i == 0) { + if (i > 0) _stprintf(tmp, _T("fastmem%d_size"), i + 1); else _tcscpy(tmp, _T("fastmem_size")); cfgfile_write(f, tmp, _T("%d"), p->fastmem[i].size / 0x100000); - } + } cfgfile_writeramboard(p, f, _T("fastmem"), i, &p->fastmem[i]); - } - cfgfile_write(f, _T("mem25bit_size"), _T("%d"), p->mem25bit_size / 0x100000); - cfgfile_write(f, _T("a3000mem_size"), _T("%d"), p->mbresmem_low_size / 0x100000); - cfgfile_write(f, _T("mbresmem_size"), _T("%d"), p->mbresmem_high_size / 0x100000); + } + cfgfile_write (f, _T("a3000mem_size"), _T("%d"), p->mbresmem_low_size / 0x100000); + cfgfile_write (f, _T("mbresmem_size"), _T("%d"), p->mbresmem_high_size / 0x100000); for (int i = 0; i < MAX_RAM_BOARDS; i++) { if (i == 0 || p->z3fastmem[i].size) { if (i > 0) @@ -2086,28 +1400,9 @@ void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type) } cfgfile_writeramboard(p, f, _T("z3mem"), i, &p->z3fastmem[i]); } - cfgfile_write(f, _T("z3mem_start"), _T("0x%x"), p->z3autoconfig_start); - cfgfile_write(f, _T("bogomem_size"), _T("%d"), p->bogomem_size / 0x40000); - if (p->cpuboard_type) { - const struct cpuboardtype *cbt = &cpuboards[p->cpuboard_type]; - const struct cpuboardsubtype *cbst = &cbt->subtypes[p->cpuboard_subtype]; - const struct expansionboardsettings *cbs = cbst->settings; - cfgfile_dwrite_str(f, _T("cpuboard_type"), cbst->configname); - if (cbs && p->cpuboard_settings) { - tmp[0] = 0; - cfgfile_write_rom_settings(cbs, tmp, p->cpuboard_settings, NULL); - cfgfile_dwrite_str(f, _T("cpuboard_settings"), tmp); - } - } - else { - cfgfile_dwrite_str(f, _T("cpuboard_type"), _T("none")); - } - cfgfile_dwrite(f, _T("cpuboardmem1_size"), _T("%d"), p->cpuboardmem1_size / 0x100000); - cfgfile_dwrite(f, _T("cpuboardmem2_size"), _T("%d"), p->cpuboardmem2_size / 0x100000); - cfgfile_write_bool(f, _T("gfxcard_hardware_vblank"), p->rtg_hardwareinterrupt); - cfgfile_write_bool(f, _T("gfxcard_hardware_sprite"), p->rtg_hardwaresprite); + cfgfile_write (f, _T("z3mem_start"), _T("0x%x"), p->z3autoconfig_start); + cfgfile_write (f, _T("bogomem_size"), _T("%d"), p->bogomem_size / 0x40000); for (int i = 0; i < MAX_RTG_BOARDS; i++) { - TCHAR tmp2[100]; struct rtgboardconfig *rbc = &p->rtgboards[i]; if (rbc->rtgmem_size) { if (i > 0) @@ -2120,159 +1415,165 @@ void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type) else _tcscpy(tmp, _T("gfxcard_type")); cfgfile_dwrite_str(f, tmp, gfxboard_get_configname(rbc->rtgmem_type)); - if (rbc->device_order > 0 && p->autoconfig_custom_sort) { - _stprintf(tmp2, _T("order=%d"), rbc->device_order); - if (i > 0) - _stprintf(tmp, _T("gfxcard%d_options"), i + 1); - else - _tcscpy(tmp, _T("gfxcard_options")); - cfgfile_dwrite_str(f, tmp, tmp2); - } } } - cfgfile_write(f, _T("chipmem_size"), _T("%d"), p->chipmem_size == 0x20000 ? -1 : (p->chipmem_size == 0x40000 ? 0 : p->chipmem_size / 0x80000)); - cfgfile_dwrite(f, _T("megachipmem_size"), _T("%d"), p->z3chipmem_size / 0x100000); - // do not save aros rom special space + cfgfile_write (f, _T("rtg_modes"), _T("0x%x"), p->picasso96_modeflags); + + + // do not save aros rom special space if (!(p->custom_memory_sizes[0] == 512 * 1024 && p->custom_memory_sizes[1] == 512 * 1024 && p->custom_memory_addrs[0] == 0xa80000 && p->custom_memory_addrs[1] == 0xb00000)) { if (p->custom_memory_sizes[0]) - cfgfile_write(f, _T("addmem1"), _T("0x%x,0x%x"), p->custom_memory_addrs[0], p->custom_memory_sizes[0]); + cfgfile_write (f, _T("addmem1"), _T("0x%x,0x%x"), p->custom_memory_addrs[0], p->custom_memory_sizes[0]); if (p->custom_memory_sizes[1]) - cfgfile_write(f, _T("addmem2"), _T("0x%x,0x%x"), p->custom_memory_addrs[1], p->custom_memory_sizes[1]); + cfgfile_write (f, _T("addmem2"), _T("0x%x,0x%x"), p->custom_memory_addrs[1], p->custom_memory_sizes[1]); } - if (p->m68k_speed > 0) { - cfgfile_write(f, _T("finegrain_cpu_speed"), _T("%d"), p->m68k_speed); - } - else { - cfgfile_write_str(f, _T("cpu_speed"), p->m68k_speed < 0 ? _T("max") : _T("real")); - } - cfgfile_write(f, _T("cpu_throttle"), _T("%.1f"), p->m68k_speed_throttle); - cfgfile_dwrite(f, _T("cpu_x86_throttle"), _T("%.1f"), p->x86_speed_throttle); + + cfg_write (_T("; "), f); + cfg_write (_T("; *** Chipset"), f); + cfg_write (_T("; "), f); - /* do not reorder start */ - write_compatibility_cpu(f, p); - cfgfile_write(f, _T("cpu_model"), _T("%d"), p->cpu_model); - if (p->fpu_model) - cfgfile_write(f, _T("fpu_model"), _T("%d"), p->fpu_model); - if (p->mmu_model) - cfgfile_write(f, _T("mmu_model"), _T("%d"), p->mmu_model); - if (p->ppc_mode) { - cfgfile_write_str(f, _T("ppc_model"), p->ppc_model[0] ? p->ppc_model : (p->ppc_mode == 1 ? _T("automatic") : _T("manual"))); - cfgfile_write_str(f, _T("ppc_cpu_idle"), ppc_cpu_idle[p->ppc_cpu_idle]); - } - cfgfile_write_bool(f, _T("cpu_compatible"), p->cpu_compatible); - cfgfile_write_bool(f, _T("cpu_24bit_addressing"), p->address_space_24); - /* do not reorder end */ - cfgfile_dwrite_bool(f, _T("cpu_reset_pause"), p->reset_delay); - cfgfile_dwrite_bool(f, _T("cpu_threaded"), p->cpu_thread); - if (p->ppc_mode) - cfgfile_write_str(f, _T("ppc_implementation"), ppc_implementations[p->ppc_implementation]); + if (p->chipset_mask & CSMASK_AGA) + cfgfile_write (f, _T("chipset"), _T("aga")); + else if ((p->chipset_mask & CSMASK_ECS_AGNUS) && (p->chipset_mask & CSMASK_ECS_DENISE)) + cfgfile_write (f, _T("chipset"), _T("ecs")); + else if (p->chipset_mask & CSMASK_ECS_AGNUS) + cfgfile_write (f, _T("chipset"), _T("ecs_agnus")); + else if (p->chipset_mask & CSMASK_ECS_DENISE) + cfgfile_write (f, _T("chipset"), _T("ecs_denise")); + else + cfgfile_write (f, _T("chipset"), _T("ocs")); - if (p->cpu_cycle_exact) { - if (p->cpu_frequency) - cfgfile_write(f, _T("cpu_frequency"), _T("%d"), p->cpu_frequency); - if (p->cpu_clock_multiplier) { - if (p->cpu_clock_multiplier >= 256) - cfgfile_write(f, _T("cpu_multiplier"), _T("%d"), p->cpu_clock_multiplier >> 8); + if (p->chipset_refreshrate > 0) + cfgfile_write (f, _T("chipset_refreshrate"), _T("%f"), p->chipset_refreshrate); + + for (int i = 0; i < MAX_CHIPSET_REFRESH_TOTAL; i++) { + struct chipset_refresh *cr = &p->cr[i]; + if (!cr->inuse) + continue; + cr->index = i; + if (cr->rate == 0) + _tcscpy(tmp, _T("0")); + else + _stprintf (tmp, _T("%f"), cr->rate); + TCHAR *s = tmp + _tcslen (tmp); + if (cr->label[0] > 0 && i < MAX_CHIPSET_REFRESH) + s += _stprintf (s, _T(",t=%s"), cr->label); + if (cr->horiz > 0) + s += _stprintf (s, _T(",h=%d"), cr->horiz); + if (cr->vert > 0) + s += _stprintf (s, _T(",v=%d"), cr->vert); + if (cr->locked) + _tcscat (s, _T(",locked")); + if (cr->ntsc > 0) + _tcscat (s, _T(",ntsc")); + else if (cr->ntsc == 0) + _tcscat (s, _T(",pal")); + if (cr->lace > 0) + _tcscat (s, _T(",lace")); + else if (cr->lace == 0) + _tcscat (s, _T(",nlace")); + if ((cr->resolution & 7) != 7) { + if (cr->resolution & 1) + _tcscat(s, _T(",lores")); + if (cr->resolution & 2) + _tcscat(s, _T(",hires")); + if (cr->resolution & 4) + _tcscat(s, _T(",shres")); } + if (cr->vsync > 0) + _tcscat (s, _T(",vsync")); + else if (cr->vsync == 0) + _tcscat (s, _T(",nvsync")); + if (cr->rtg) + _tcscat (s, _T(",rtg")); + if (cr->defaultdata) + _tcscat(s, _T(",default")); + if (i == CHIPSET_REFRESH_PAL) { + cfgfile_dwrite (f, _T("displaydata_pal"), tmp); + } else if (i == CHIPSET_REFRESH_NTSC) { + cfgfile_dwrite (f, _T("displaydata_ntsc"), tmp); + } else { + cfgfile_dwrite (f, _T("displaydata"), tmp); + } } - cfgfile_write_bool(f, _T("cpu_cycle_exact"), p->cpu_cycle_exact); - // must be after cpu_cycle_exact - cfgfile_write_bool(f, _T("cpu_memory_cycle_exact"), p->cpu_memory_cycle_exact); - cfgfile_write_bool(f, _T("blitter_cycle_exact"), p->blitter_cycle_exact); - // must be after cpu_cycle_exact, cpu_memory_cycle_exact and blitter_cycle_exact - if (p->cpu_cycle_exact && p->blitter_cycle_exact) - cfgfile_write_str(f, _T("cycle_exact"), cycleexact[2]); - else if (p->cpu_memory_cycle_exact && p->blitter_cycle_exact) - cfgfile_write_str(f, _T("cycle_exact"), cycleexact[1]); - else - cfgfile_write_str(f, _T("cycle_exact"), cycleexact[0]); + cfgfile_write_str (f, _T("collision_level"), collmode[p->collision_level]); - cfgfile_dwrite_bool(f, _T("fpu_no_unimplemented"), p->fpu_no_unimplemented); - cfgfile_dwrite_bool(f, _T("cpu_no_unimplemented"), p->int_no_unimplemented); - cfgfile_write_bool(f, _T("fpu_strict"), p->fpu_strict); - cfgfile_dwrite_bool(f, _T("fpu_softfloat"), p->fpu_softfloat); + cfgfile_write_str(f, _T("chipset_compatible"), cscompa[p->cs_compatible]); + cfgfile_dwrite_str(f, _T("ciaatod"), ciaatodmode[p->cs_ciaatod]); + cfgfile_dwrite_str(f, _T("rtc"), rtctype[p->cs_rtc]); + cfgfile_dwrite_bool(f, _T("ksmirror_e0"), p->cs_ksmirror_e0); + cfgfile_dwrite_bool(f, _T("ksmirror_a8"), p->cs_ksmirror_a8); + cfgfile_dwrite_bool (f, _T("cd32cd"), p->cs_cd32cd); + cfgfile_dwrite_bool (f, _T("cd32c2p"), p->cs_cd32c2p); + cfgfile_dwrite_bool (f, _T("cd32nvram"), p->cs_cd32nvram); + cfgfile_dwrite (f, _T("cd32nvram_size"), _T("%d"), p->cs_cd32nvram_size / 1024); + cfgfile_dwrite(f, _T("fatgary"), _T("%d"), p->cs_fatgaryrev); + cfgfile_dwrite(f, _T("ramsey"), _T("%d"), p->cs_ramseyrev); + cfgfile_dwrite_bool(f, _T("pcmcia"), p->cs_pcmcia); + cfgfile_dwrite_bool(f, _T("cia_todbug"), p->cs_ciatodbug); + cfgfile_write_bool(f, _T("immediate_blits"), p->immediate_blits); + cfgfile_dwrite_str(f, _T("waiting_blits"), waitblits[p->waiting_blits]); + cfgfile_write_bool(f, _T("fast_copper"), p->fast_copper); - cfgfile_write_bool(f, _T("rtg_nocustom"), p->picasso96_nocustom); - cfgfile_write(f, _T("rtg_modes"), _T("0x%x"), p->picasso96_modeflags); + + cfg_write (_T("; "), f); + cfg_write (_T("; *** Sound Options"), f); + cfg_write (_T("; "), f); + + cfgfile_write_str (f, _T("sound_output"), soundmode1[p->produce_sound]); + cfgfile_write_str (f, _T("sound_channels"), stereomode[p->sound_stereo]); + cfgfile_write (f, _T("sound_stereo_separation"), _T("%d"), p->sound_stereo_separation); + cfgfile_write (f, _T("sound_stereo_mixing_delay"), _T("%d"), p->sound_mixed_stereo_delay >= 0 ? p->sound_mixed_stereo_delay : 0); + cfgfile_write (f, _T("sound_frequency"), _T("%d"), p->sound_freq); + cfgfile_write_str (f, _T("sound_interpol"), interpolmode[p->sound_interpol]); + cfgfile_write_str (f, _T("sound_filter"), soundfiltermode1[p->sound_filter]); + cfgfile_write_str (f, _T("sound_filter_type"), soundfiltermode2[p->sound_filter_type]); + if (p->sound_volume_cd >= 0) + cfgfile_write (f, _T("sound_volume_cd"), _T("%d"), p->sound_volume_cd); - cfgfile_write_bool(f, _T("log_illegal_mem"), p->illegal_mem); + + cfg_write (_T("; "), f); + cfg_write (_T("; *** Misc. Options"), f); + cfg_write (_T("; "), f); + + cfgfile_write_bool (f, _T("bsdsocket_emu"), p->socket_emu); + cfgfile_dwrite_str (f, _T("boot_rom_uae"), uaebootrom[p->boot_rom]); + cfgfile_dwrite_str(f, _T("uaeboard"), uaeboard[p->uaeboard]); -#if 0 - if (p->catweasel >= 100) - cfgfile_dwrite(f, _T("catweasel"), _T("0x%x"), p->catweasel); - else - cfgfile_dwrite(f, _T("catweasel"), _T("%d"), p->catweasel); - cfgfile_write_bool(f, _T("toccata"), p->obs_sound_toccata); - if (p->obs_sound_toccata_mixer) - cfgfile_write_bool(f, _T("toccata_mixer"), p->obs_sound_toccata_mixer); - cfgfile_write_bool(f, _T("es1370_pci"), p->obs_sound_es1370); - cfgfile_write_bool(f, _T("fm801_pci"), p->obs_sound_fm801); -#endif - cfgfile_dwrite_bool(f, _T("keyboard_connected"), p->keyboard_connected); - //cfgfile_write_str(f, _T("kbd_lang"), (p->keyboard_lang == KBD_LANG_DE ? _T("de") - // : p->keyboard_lang == KBD_LANG_DK ? _T("dk") - // : p->keyboard_lang == KBD_LANG_ES ? _T("es") - // : p->keyboard_lang == KBD_LANG_US ? _T("us") - // : p->keyboard_lang == KBD_LANG_SE ? _T("se") - // : p->keyboard_lang == KBD_LANG_FR ? _T("fr") - // : p->keyboard_lang == KBD_LANG_IT ? _T("it") - // : _T("FOO"))); - - cfgfile_dwrite(f, _T("state_replay_rate"), _T("%d"), p->statecapturerate); - cfgfile_dwrite(f, _T("state_replay_buffers"), _T("%d"), p->statecapturebuffersize); - cfgfile_dwrite_bool(f, _T("state_replay_autoplay"), p->inprec_autoplay); - cfgfile_dwrite_bool(f, _T("warp"), p->turbo_emulation); - cfgfile_dwrite(f, _T("warp_limit"), _T("%d"), p->turbo_emulation_limit); - -#ifdef FILESYS - write_filesys_config(p, f); - if (p->filesys_no_uaefsdb) - cfgfile_write_bool(f, _T("filesys_no_fsdb"), p->filesys_no_uaefsdb); - cfgfile_dwrite(f, _T("filesys_max_size"), _T("%d"), p->filesys_limit); - cfgfile_dwrite(f, _T("filesys_max_name_length"), _T("%d"), p->filesys_max_name); - cfgfile_dwrite(f, _T("filesys_max_file_size"), _T("%d"), p->filesys_max_file_size); - cfgfile_dwrite_bool(f, _T("filesys_inject_icons"), p->filesys_inject_icons); - cfgfile_dwrite_str(f, _T("filesys_inject_icons_drawer"), p->filesys_inject_icons_drawer); - cfgfile_dwrite_str(f, _T("filesys_inject_icons_project"), p->filesys_inject_icons_project); - cfgfile_dwrite_str(f, _T("filesys_inject_icons_tool"), p->filesys_inject_icons_tool); - cfgfile_dwrite_str(f, _T("scsidev_mode"), uaescsidevmodes[p->uaescsidevmode]); -#endif - cfgfile_dwrite_bool(f, _T("harddrive_write_protect"), p->harddrive_read_only); - - write_inputdevice_config(p, f); + } -static int cfgfile_yesno(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, bool numbercheck) +static int cfgfile_yesno (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, bool numbercheck) { - if (name != NULL && _tcscmp(option, name) != 0) - return 0; - if (strcasecmp(value, _T("yes")) == 0 || strcasecmp(value, _T("y")) == 0 - || strcasecmp(value, _T("true")) == 0 || strcasecmp(value, _T("t")) == 0 - || (numbercheck && strcasecmp(value, _T("1")) == 0)) - *location = 1; - else if (strcasecmp(value, _T("no")) == 0 || strcasecmp(value, _T("n")) == 0 - || strcasecmp(value, _T("false")) == 0 || strcasecmp(value, _T("f")) == 0 - || (numbercheck && strcasecmp(value, _T("0")) == 0)) - *location = 0; - else { + if (name != NULL && _tcscmp (option, name) != 0) + return 0; + if (_tcsicmp (value, _T("yes")) == 0 || _tcsicmp (value, _T("y")) == 0 + || _tcsicmp (value, _T("true")) == 0 || _tcsicmp (value, _T("t")) == 0 + || (numbercheck && _tcsicmp (value, _T("1")) == 0)) + *location = 1; + else if (_tcsicmp (value, _T("no")) == 0 || _tcsicmp (value, _T("n")) == 0 + || _tcsicmp (value, _T("false")) == 0 || _tcsicmp (value, _T("f")) == 0 + || (numbercheck && _tcsicmp (value, _T("0")) == 0)) + *location = 0; + else { cfgfile_warning(_T("Option '%s' requires a value of either 'true' or 'false' (was '%s').\n"), option, value); - return -1; - } - return 1; + return -1; + } + return 1; } -static int cfgfile_yesno(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location) +static int cfgfile_yesno (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location) { - return cfgfile_yesno(option, value, name, location, true); + return cfgfile_yesno (option, value, name, location, true); } -static int cfgfile_yesno(const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location, bool numbercheck) +static int cfgfile_yesno (const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location, bool numbercheck) { int val; - int ret = cfgfile_yesno(option, value, name, &val, numbercheck); + int ret = cfgfile_yesno (option, value, name, &val, numbercheck); if (ret == 0) return 0; if (ret < 0) @@ -2282,328 +1583,281 @@ static int cfgfile_yesno(const TCHAR *option, const TCHAR *value, const TCHAR *n return 1; } -int cfgfile_yesno(const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location) +int cfgfile_yesno (const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location) { - return cfgfile_yesno(option, value, name, location, true); + return cfgfile_yesno (option, value, name, location, true); } -static int cfgfile_doubleval(const TCHAR *option, const TCHAR *value, const TCHAR *name, double *location) +static int cfgfile_doubleval (const TCHAR *option, const TCHAR *value, const TCHAR *name, double *location) { TCHAR *endptr; - if (name != NULL && _tcscmp(option, name) != 0) + if (name != NULL && _tcscmp (option, name) != 0) return 0; - *location = _tcstod(value, &endptr); + *location = _tcstod (value, &endptr); return 1; } -static int cfgfile_floatval(const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, float *location) +static int cfgfile_floatval (const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, float *location) { TCHAR *endptr; if (name == NULL) return 0; if (nameext) { TCHAR tmp[MAX_DPATH]; - _tcscpy(tmp, name); - _tcscat(tmp, nameext); - if (_tcscmp(tmp, option) != 0) + _tcscpy (tmp, name); + _tcscat (tmp, nameext); + if (_tcscmp (tmp, option) != 0) + return 0; + } else { + if (_tcscmp (option, name) != 0) return 0; } - else { - if (_tcscmp(option, name) != 0) - return 0; - } - *location = (float)_tcstod(value, &endptr); + *location = (float)_tcstod (value, &endptr); return 1; } -static int cfgfile_floatval(const TCHAR *option, const TCHAR *value, const TCHAR *name, float *location) +static int cfgfile_floatval (const TCHAR *option, const TCHAR *value, const TCHAR *name, float *location) { - return cfgfile_floatval(option, value, name, NULL, location); + return cfgfile_floatval (option, value, name, NULL, location); } -static int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, unsigned int *location, int scale) +static int cfgfile_intval (const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, unsigned int *location, int scale) { - int base = 10; - TCHAR *endptr; + int base = 10; + TCHAR *endptr; TCHAR tmp[MAX_DPATH]; if (name == NULL) - return 0; + return 0; if (nameext) { - _tcscpy(tmp, name); - _tcscat(tmp, nameext); - if (_tcscmp(tmp, option) != 0) + _tcscpy (tmp, name); + _tcscat (tmp, nameext); + if (_tcscmp (tmp, option) != 0) + return 0; + } else { + if (_tcscmp (option, name) != 0) return 0; } - else { - if (_tcscmp(option, name) != 0) - return 0; - } - /* I guess octal isn't popular enough to worry about here... */ - if (value[0] == '0' && _totupper(value[1]) == 'X') - value += 2, base = 16; - *location = _tcstol(value, &endptr, base) * scale; + /* I guess octal isn't popular enough to worry about here... */ + if (value[0] == '0' && _totupper(value[1]) == 'X') + value += 2, base = 16; + *location = _tcstol (value, &endptr, base) * scale; - if (*endptr != '\0' || *value == '\0') { - if (strcasecmp(value, _T("false")) == 0 || strcasecmp(value, _T("no")) == 0) { + if (*endptr != '\0' || *value == '\0') { + if (_tcsicmp (value, _T("false")) == 0 || _tcsicmp (value, _T("no")) == 0) { *location = 0; return 1; } - if (strcasecmp(value, _T("true")) == 0 || strcasecmp(value, _T("yes")) == 0) { + if (_tcsicmp (value, _T("true")) == 0 || _tcsicmp (value, _T("yes")) == 0) { *location = 1; return 1; - } + } cfgfile_warning(_T("Option '%s' requires a numeric argument but got '%s'\n"), nameext ? tmp : option, value); - return -1; - } - return 1; + return -1; + } + return 1; } - -static int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *name, unsigned int *location, int scale) +static int cfgfile_intval (const TCHAR *option, const TCHAR *value, const TCHAR *name, unsigned int *location, int scale) { - return cfgfile_intval(option, value, name, NULL, location, scale); + return cfgfile_intval (option, value, name, NULL, location, scale); } -int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, int scale) +int cfgfile_intval (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, int scale) { unsigned int v = 0; - int r = cfgfile_intval(option, value, name, NULL, &v, scale); + int r = cfgfile_intval (option, value, name, NULL, &v, scale); if (!r) return 0; *location = (int)v; return r; } -static int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, int *location, int scale) +static int cfgfile_intval (const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, int *location, int scale) { unsigned int v = 0; - int r = cfgfile_intval(option, value, name, nameext, &v, scale); + int r = cfgfile_intval (option, value, name, nameext, &v, scale); if (!r) return 0; *location = (int)v; return r; } -static int cfgfile_strval(const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, int *location, const TCHAR *table[], int more) +static int cfgfile_strval (const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, int *location, const TCHAR *table[], int more) { - int val; + int val; TCHAR tmp[MAX_DPATH]; if (name == NULL) - return 0; + return 0; if (nameext) { - _tcscpy(tmp, name); - _tcscat(tmp, nameext); - if (_tcscmp(tmp, option) != 0) + _tcscpy (tmp, name); + _tcscat (tmp, nameext); + if (_tcscmp (tmp, option) != 0) + return 0; + } else { + if (_tcscmp (option, name) != 0) return 0; } - else { - if (_tcscmp(option, name) != 0) - return 0; - } - val = match_string(table, value); - if (val == -1) { - if (more) - return 0; - if (!strcasecmp(value, _T("yes")) || !strcasecmp(value, _T("true"))) { + val = match_string (table, value); + if (val == -1) { + if (more) + return 0; + if (!_tcsicmp (value, _T("yes")) || !_tcsicmp (value, _T("true"))) { val = 1; - } - else if (!strcasecmp(value, _T("no")) || !strcasecmp(value, _T("false"))) { + } else if (!_tcsicmp (value, _T("no")) || !_tcsicmp (value, _T("false"))) { val = 0; - } - else { + } else { cfgfile_warning(_T("Unknown value ('%s') for option '%s'.\n"), value, nameext ? tmp : option); - return -1; + return -1; } - } - *location = val; - return 1; + } + *location = val; + return 1; } -int cfgfile_strval(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, const TCHAR *table[], int more) +int cfgfile_strval (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, const TCHAR *table[], int more) { - return cfgfile_strval(option, value, name, NULL, location, table, more); + return cfgfile_strval (option, value, name, NULL, location, table, more); } -static int cfgfile_strboolval(const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location, const TCHAR *table[], int more) +static int cfgfile_strboolval (const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location, const TCHAR *table[], int more) { int locationint; - if (!cfgfile_strval(option, value, name, &locationint, table, more)) + if (!cfgfile_strval (option, value, name, &locationint, table, more)) return 0; *location = locationint != 0; return 1; } -int cfgfile_string(const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz) +int cfgfile_string (const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz) { - if (_tcscmp(option, name) != 0) - return 0; - _tcsncpy(location, value, maxsz - 1); - location[maxsz - 1] = '\0'; - return 1; + if (_tcscmp (option, name) != 0) + return 0; + _tcsncpy (location, value, maxsz - 1); + location[maxsz - 1] = '\0'; + return 1; } -static int cfgfile_string(const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, TCHAR *location, int maxsz) +static int cfgfile_string (const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, TCHAR *location, int maxsz) { if (nameext) { TCHAR tmp[MAX_DPATH]; - _tcscpy(tmp, name); - _tcscat(tmp, nameext); - if (_tcscmp(tmp, option) != 0) + _tcscpy (tmp, name); + _tcscat (tmp, nameext); + if (_tcscmp (tmp, option) != 0) + return 0; + } else { + if (_tcscmp (option, name) != 0) return 0; } - else { - if (_tcscmp(option, name) != 0) - return 0; - } - _tcsncpy(location, value, maxsz - 1); + _tcsncpy (location, value, maxsz - 1); location[maxsz - 1] = '\0'; return 1; } -static int cfgfile_path(const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz, struct multipath *mp) +static int cfgfile_path (const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz) { - if (!cfgfile_string(option, value, name, location, maxsz)) + if (!cfgfile_string (option, value, name, location, maxsz)) return 0; - - TCHAR* s = target_expand_environment(location); - _tcsncpy(location, s, maxsz - 1); + TCHAR *s = target_expand_environment (location, NULL, 0); + _tcsncpy (location, s, maxsz - 1); location[maxsz - 1] = 0; - if (mp) { - for (int i = 0; i < MAX_PATHS; i++) { - if (mp->path[i][0] && _tcscmp(mp->path[i], _T(".\\")) != 0 && _tcscmp(mp->path[i], _T("./")) != 0 && (location[0] != '/' && location[0] != '\\' && !_tcschr(location, ':'))) { - TCHAR np[MAX_DPATH]; - _tcscpy(np, mp->path[i]); - fixtrailing(np); - _tcscat(np, s); - if (zfile_exists(np)) { - _tcsncpy(location, np, maxsz - 1); - location[maxsz - 1] = 0; - break; - } - } - } - } - xfree(s); + xfree (s); return 1; } -static int cfgfile_path(const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz) -{ - return cfgfile_path(option, value, name, location, maxsz, NULL); -} - -static int cfgfile_multipath(const TCHAR *option, const TCHAR *value, const TCHAR *name, struct multipath *mp) -{ - TCHAR tmploc[MAX_DPATH]; - if (!cfgfile_string(option, value, name, tmploc, 256)) - return 0; - for (int i = 0; i < MAX_PATHS; i++) { - if (mp->path[i][0] == 0 || (i == 0 && (!_tcscmp(mp->path[i], _T(".\\")) || !_tcscmp(mp->path[i], _T("./"))))) { - TCHAR *s = target_expand_environment(tmploc); - _tcsncpy(mp->path[i], s, 256 - 1); - mp->path[i][256 - 1] = 0; - fixtrailing(mp->path[i]); - xfree(s); - return 1; - } - } - return 1; -} - -static int cfgfile_rom(const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz) +static int cfgfile_rom (const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz) { TCHAR id[MAX_DPATH]; - if (!cfgfile_string(option, value, name, id, sizeof id / sizeof(TCHAR))) + if (!cfgfile_string (option, value, name, id, sizeof id / sizeof (TCHAR))) return 0; - TCHAR *p = _tcschr(id, ','); + TCHAR *p = _tcschr (id, ','); if (p) { TCHAR *endptr, tmp; *p = 0; tmp = id[4]; id[4] = 0; - uae_u32 crc32 = _tcstol(id, &endptr, 16) << 16; + uae_u32 crc32 = _tcstol (id, &endptr, 16) << 16; id[4] = tmp; - crc32 |= _tcstol(id + 4, &endptr, 16); - struct romdata *rd = getromdatabycrc(crc32, true); + crc32 |= _tcstol (id + 4, &endptr, 16); + struct romdata *rd = getromdatabycrc (crc32, true); if (rd) { - struct romdata *rd2 = getromdatabyid(rd->id); + struct romdata *rd2 = getromdatabyid (rd->id); if (rd->group == 0 && rd2 == rd) { - if (zfile_exists(location)) + if (zfile_exists (location)) return 1; } if (rd->group && rd2) rd = rd2; - struct romlist *rl = getromlistbyromdata(rd); + struct romlist *rl = getromlistbyromdata (rd); if (rl) { - write_log(_T("%s: %s -> %s\n"), name, location, rl->path); - _tcsncpy(location, rl->path, maxsz); + write_log (_T("%s: %s -> %s\n"), name, location, rl->path); + _tcsncpy (location, rl->path, maxsz); } } } return 1; } -static int getintval(TCHAR **p, int *result, int delim) +static int getintval (TCHAR **p, int *result, int delim) { - TCHAR *value = *p; - int base = 10; - TCHAR *endptr; - TCHAR *p2 = _tcschr(*p, delim); + TCHAR *value = *p; + int base = 10; + TCHAR *endptr; + TCHAR *p2 = _tcschr (*p, delim); - if (p2 == 0) - return 0; + if (p2 == 0) + return 0; - *p2++ = '\0'; + *p2++ = '\0'; - if (value[0] == '0' && _totupper(value[1]) == 'X') - value += 2, base = 16; - *result = _tcstol(value, &endptr, base); - *p = p2; + if (value[0] == '0' && _totupper (value[1]) == 'X') + value += 2, base = 16; + *result = _tcstol (value, &endptr, base); + *p = p2; - if (*endptr != '\0' || *value == '\0') - return 0; + if (*endptr != '\0' || *value == '\0') + return 0; - return 1; + return 1; } -static int getintval2(TCHAR **p, int *result, int delim, bool last) +static int getintval2 (TCHAR **p, int *result, int delim, bool last) { - TCHAR *value = *p; - int base = 10; - TCHAR *endptr; + TCHAR *value = *p; + int base = 10; + TCHAR *endptr; TCHAR *p2; - p2 = _tcschr(*p, delim); - if (p2 == 0) { + p2 = _tcschr (*p, delim); + if (p2 == 0) { if (last) { if (delim != '.') - p2 = _tcschr(*p, ','); - if (p2 == 0) { + p2 = _tcschr (*p, ','); + if (p2 == 0) { p2 = *p; - while (*p2) + while(*p2) p2++; if (p2 == *p) - return 0; - } - } - else { + return 0; + } + } else { return 0; - } + } } if (!_istdigit(**p) && **p != '-' && **p != '+') return 0; - if (*p2 != 0) - *p2++ = '\0'; + if (*p2 != 0) + *p2++ = '\0'; - if (value[0] == '0' && _totupper(value[1]) == 'X') - value += 2, base = 16; - *result = _tcstol(value, &endptr, base); - *p = p2; + if (value[0] == '0' && _totupper (value[1]) == 'X') + value += 2, base = 16; + *result = _tcstol (value, &endptr, base); + *p = p2; - if (*endptr != '\0' || *value == '\0') { - *p = 0; - return 0; - } + if (*endptr != '\0' || *value == '\0') { + *p = 0; + return 0; + } - return 1; + return 1; } static int cfgfile_option_select(TCHAR *s, const TCHAR *option, const TCHAR *select) @@ -2615,7 +1869,7 @@ static int cfgfile_option_select(TCHAR *s, const TCHAR *option, const TCHAR *sel _tcscat(buf, _T(",")); TCHAR *p = buf; for (;;) { - TCHAR *tmpp = _tcschr(p, ','); + TCHAR *tmpp = _tcschr (p, ','); if (tmpp == NULL) return -1; *tmpp++ = 0; @@ -2623,10 +1877,10 @@ static int cfgfile_option_select(TCHAR *s, const TCHAR *option, const TCHAR *sel if (!tmpp2) return -1; *tmpp2++ = 0; - if (!strcasecmp(p, option)) { + if (!_tcsicmp(p, option)) { int idx = 0; while (select[0]) { - if (!strcasecmp(select, tmpp2)) + if (!_tcsicmp(select, tmpp2)) return idx; idx++; select += _tcslen(select) + 1; @@ -2645,94 +1899,137 @@ static int cfgfile_option_bool(TCHAR *s, const TCHAR *option) _tcscat(buf, _T(",")); TCHAR *p = buf; for (;;) { - TCHAR *tmpp = _tcschr(p, ','); + TCHAR *tmpp = _tcschr (p, ','); if (tmpp == NULL) return -1; *tmpp++ = 0; TCHAR *tmpp2 = _tcschr(p, '='); if (tmpp2) *tmpp2++ = 0; - if (!strcasecmp(p, option)) { + if (!_tcsicmp(p, option)) { if (!tmpp2) return 0; - TCHAR *tmpp3 = _tcschr(tmpp2, ','); + TCHAR *tmpp3 = _tcschr (tmpp2, ','); if (tmpp3) *tmpp3 = 0; - if (tmpp2 && !strcasecmp(tmpp2, _T("true"))) + if (tmpp2 && !_tcsicmp(tmpp2, _T("true"))) return 1; - if (tmpp2 && !strcasecmp(tmpp2, _T("false"))) + if (tmpp2 && !_tcsicmp(tmpp2, _T("false"))) return 0; return 1; } p = tmpp; } } - -static void set_chipset_mask(struct uae_prefs *p, int val) +static void set_chipset_mask (struct uae_prefs *p, int val) { - p->chipset_mask = (val == 0 ? 0 - : val == 1 ? CSMASK_ECS_AGNUS - : val == 2 ? CSMASK_ECS_DENISE - : val == 3 ? CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS - : CSMASK_AGA | CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS); + p->chipset_mask = (val == 0 ? 0 + : val == 1 ? CSMASK_ECS_AGNUS + : val == 2 ? CSMASK_ECS_DENISE + : val == 3 ? CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS + : CSMASK_AGA | CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS); } -static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value) +static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) { - int i, v; - bool vb; - TCHAR *section = 0; - TCHAR *tmpp; - TCHAR tmpbuf[CONFIG_BLEN]; + int i; + bool vb; + TCHAR *section = 0; + TCHAR *tmpp; + TCHAR tmpbuf[CONFIG_BLEN]; + const TCHAR *tmp1; + TCHAR *tmp2; - if (_tcsncmp(option, _T("input."), 6) == 0) { - read_inputdevice_config(p, option, value); - return 1; - } + if (_tcsncmp (option, _T("input."), 6) == 0) { + read_inputdevice_config (p, option, value); + return 1; + } + +#ifndef PANDORA + // custom options LOADING - for (tmpp = option; *tmpp != '\0'; tmpp++) - if (_istupper(*tmpp)) - *tmpp = _totlower(*tmpp); - tmpp = _tcschr(option, '.'); - if (tmpp) { - section = option; - option = tmpp + 1; - *tmpp = '\0'; - if (_tcscmp(section, TARGET_NAME) == 0) { - /* We special case the various path options here. */ - if (cfgfile_multipath(option, value, _T("rom_path"), &p->path_rom) - || cfgfile_multipath(option, value, _T("floppy_path"), &p->path_floppy) - || cfgfile_multipath(option, value, _T("cd_path"), &p->path_cd) - || cfgfile_multipath(option, value, _T("hardfile_path"), &p->path_hardfile)) - return 1; - return target_parse_option(p, option, value); - } - return 0; - } + + for (int i=0; i<4 ; ++i) // Loop 1 ... all 4 joyports + { + struct joypad_map_layout tempcustom = {}; + + for (int m=0; m<2 ; ++m) // Loop 2 ... none/hotkey function keys + { + if (m == 0) {tmp1 = "none"; tempcustom = p->jports[i].amiberry_custom_none ;} + else if (m == 1) {tmp1 = "hotkey"; tempcustom = p->jports[i].amiberry_custom_hotkey;} + + for (int n=0; n < 14; ++n) // Loop 3 ... all 14 buttons + { + _stprintf (tmpbuf, "joyport%d_amiberry_custom_%s_%s", i, tmp1, button_remap_name[n]); + + // this is where we need to check if we have this particular option!! + if (!_tcsncmp (option, _T(tmpbuf), sizeof (tmpbuf) / sizeof (TCHAR))) + { + int b = 0; + if (find_inputevent(value) > -1) {b = RemapEventList[find_inputevent(value)];} + //else {b=0;} - for (i = 0; i < MAX_SPARE_DRIVES; i++) { - _stprintf(tmpbuf, _T("diskimage%d"), i); - if (cfgfile_path(option, value, tmpbuf, p->dfxlist[i], sizeof p->dfxlist[i] / sizeof(TCHAR), &p->path_floppy)) { -#if 0 - if (i < 4 && !p->df[i][0]) - _tcscpy(p->df[i], p->dfxlist[i]); + if (n==0 ) {tempcustom.dpad_up_action = b;} + if (n==1 ) {tempcustom.dpad_down_action = b;} + if (n==2 ) {tempcustom.dpad_left_action = b;} + if (n==3 ) {tempcustom.dpad_right_action = b;} + if (n==4 ) {tempcustom.select_action = b;} + if (n==5 ) {tempcustom.left_shoulder_action = b;} + if (n==6 ) {tempcustom.lstick_select_action = b;} + if (n==7 ) {tempcustom.north_action = b;} + if (n==8 ) {tempcustom.south_action = b;} + if (n==9 ) {tempcustom.east_action = b;} + if (n==10) {tempcustom.west_action = b;} + if (n==11) {tempcustom.start_action = b;} + if (n==12) {tempcustom.right_shoulder_action = b;} + if (n==13) {tempcustom.rstick_select_action = b;} + + if (m==0) + { p->jports[i].amiberry_custom_none = tempcustom; } + + else if (m==1) + { p->jports[i].amiberry_custom_hotkey = tempcustom; } + return 1; + + } // close the IF check + } // close loop 3 + } // close loop 2 + } // close loop 1 + #endif - return 1; - } - } + + + for (tmpp = option; *tmpp != '\0'; tmpp++) + if (_istupper (*tmpp)) + *tmpp = _totlower (*tmpp); + tmpp = _tcschr (option, '.'); + if (tmpp) { + section = option; + option = tmpp + 1; + *tmpp = '\0'; + if (_tcscmp (section, TARGET_NAME) == 0) { + /* We special case the various path options here. */ + if (cfgfile_path (option, value, _T("rom_path"), p->path_rom, sizeof p->path_rom / sizeof (TCHAR)) + || cfgfile_path (option, value, _T("floppy_path"), p->path_floppy, sizeof p->path_floppy / sizeof (TCHAR)) + || cfgfile_path (option, value, _T("cd_path"), p->path_cd, sizeof p->path_cd / sizeof (TCHAR)) + || cfgfile_path (option, value, _T("hardfile_path"), p->path_hardfile, sizeof p->path_hardfile / sizeof (TCHAR))) + return 1; + return target_parse_option (p, option, value); + } + return 0; + } for (i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { TCHAR tmp[20]; - _stprintf(tmp, _T("cdimage%d"), i); - if (!_tcsicmp(option, tmp)) { - if (!_tcsicmp(value, _T("autodetect"))) { + _stprintf (tmp, _T("cdimage%d"), i); + if (!_tcsicmp (option, tmp)) { + if (!_tcsicmp (value, _T("autodetect"))) { p->cdslots[i].type = SCSI_UNIT_DEFAULT; p->cdslots[i].inuse = true; p->cdslots[i].name[0] = 0; - } - else { + } else { p->cdslots[i].delayed = false; - TCHAR *next = _tcsrchr(value, ','); + TCHAR *next = _tcsrchr (value, ','); int type = SCSI_UNIT_DEFAULT; int mode = 0; int unitnum = 0; @@ -2740,19 +2037,19 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value) if (!next) break; *next++ = 0; - TCHAR *next2 = _tcschr(next, ':'); + TCHAR *next2 = _tcschr (next, ':'); if (next2) *next2++ = 0; - if (!_tcsicmp(next, _T("delay"))) { + if (!_tcsicmp (next, _T("delay"))) { p->cdslots[i].delayed = true; next = next2; if (!next) break; - next2 = _tcschr(next, ':'); + next2 = _tcschr (next, ':'); if (next2) *next2++ = 0; } - type = match_string(cdmodes, next); + type = match_string (cdmodes, next); if (type < 0) type = SCSI_UNIT_DEFAULT; else @@ -2760,24 +2057,24 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value) next = next2; if (!next) break; - next2 = _tcschr(next, ':'); + next2 = _tcschr (next, ':'); if (next2) *next2++ = 0; - mode = match_string(cdconmodes, next); + mode = match_string (cdconmodes, next); if (mode < 0) mode = 0; next = next2; if (!next) break; - next2 = _tcschr(next, ':'); + next2 = _tcschr (next, ':'); if (next2) *next2++ = 0; - cfgfile_intval(option, next, tmp, &unitnum, 1); + cfgfile_intval (option, next, tmp, &unitnum, 1); } - if (_tcslen(value) > 0) { - TCHAR *s = cfgfile_get_multipath(&p->path_cd, NULL, value, false); - _tcsncpy(p->cdslots[i].name, s, sizeof p->cdslots[i].name / sizeof(TCHAR)); - xfree(s); + if (_tcslen (value) > 0) { + TCHAR *s = cfgfile_subst_path (UNEXPANDED, p->path_cd, value); + _tcsncpy (p->cdslots[i].name, s, sizeof p->cdslots[i].name / sizeof (TCHAR)); + xfree (s); } p->cdslots[i].name[sizeof p->cdslots[i].name - 1] = 0; p->cdslots[i].inuse = true; @@ -2793,779 +2090,281 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value) } } - if (!_tcsicmp(option, _T("lua"))) { - for (i = 0; i < MAX_LUA_STATES; i++) { - if (!p->luafiles[i][0]) { - _tcscpy(p->luafiles[i], value); - break; - } - } - return 1; - } + if (cfgfile_intval (option, value, _T("sound_frequency"), &p->sound_freq, 1) + || cfgfile_intval (option, value, _T("sound_volume_cd"), &p->sound_volume_cd, 1) + || cfgfile_intval (option, value, _T("sound_stereo_separation"), &p->sound_stereo_separation, 1) + || cfgfile_intval (option, value, _T("sound_stereo_mixing_delay"), &p->sound_mixed_stereo_delay, 1) - if (cfgfile_strval(option, value, _T("gfx_autoresolution_min_vertical"), &p->gfx_autoresolution_minv, vertmode, 0)) { - p->gfx_autoresolution_minv--; - return 1; - } - if (cfgfile_strval(option, value, _T("gfx_autoresolution_min_horizontal"), &p->gfx_autoresolution_minh, horizmode, 0)) { - p->gfx_autoresolution_minh--; - return 1; - } - if (!_tcsicmp(option, _T("gfx_autoresolution"))) { - p->gfx_autoresolution = 0; - cfgfile_intval(option, value, _T("gfx_autoresolution"), &p->gfx_autoresolution, 1); - if (!p->gfx_autoresolution) { - v = cfgfile_yesno(option, value, _T("gfx_autoresolution"), &vb); - if (v > 0) - p->gfx_autoresolution = vb ? 10 : 0; - } - return 1; - } + || cfgfile_intval (option, value, _T("gfx_framerate"), &p->gfx_framerate, 1) + || cfgfile_intval (option, value, _T("gfx_refreshrate"), &p->gfx_apmode[APMODE_NATIVE].gfx_refreshrate, 1) + || cfgfile_intval (option, value, _T("gfx_refreshrate_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_refreshrate, 1) - if (cfgfile_intval(option, value, _T("sound_frequency"), &p->sound_freq, 1) - || cfgfile_intval(option, value, _T("sound_max_buff"), &p->sound_maxbsiz, 1) - || cfgfile_intval(option, value, _T("state_replay_rate"), &p->statecapturerate, 1) - || cfgfile_intval(option, value, _T("state_replay_buffers"), &p->statecapturebuffersize, 1) - || cfgfile_yesno(option, value, _T("state_replay_autoplay"), &p->inprec_autoplay) - || cfgfile_intval(option, value, _T("sound_frequency"), &p->sound_freq, 1) - || cfgfile_intval(option, value, _T("sound_volume"), &p->sound_volume_master, 1) - || cfgfile_intval(option, value, _T("sound_volume_paula"), &p->sound_volume_paula, 1) - || cfgfile_intval(option, value, _T("sound_volume_cd"), &p->sound_volume_cd, 1) - || cfgfile_intval(option, value, _T("sound_volume_ahi"), &p->sound_volume_board, 1) - || cfgfile_intval(option, value, _T("sound_volume_midi"), &p->sound_volume_midi, 1) - || cfgfile_intval(option, value, _T("sound_volume_genlock"), &p->sound_volume_genlock, 1) - || cfgfile_intval(option, value, _T("sound_stereo_separation"), &p->sound_stereo_separation, 1) - || cfgfile_intval(option, value, _T("sound_stereo_mixing_delay"), &p->sound_mixed_stereo_delay, 1) - || cfgfile_intval(option, value, _T("sampler_frequency"), &p->sampler_freq, 1) - || cfgfile_intval(option, value, _T("sampler_buffer"), &p->sampler_buffer, 1) - || cfgfile_intval(option, value, _T("warp_limit"), &p->turbo_emulation_limit, 1) + || cfgfile_intval (option, value, _T("filesys_max_size"), &p->filesys_limit, 1) + || cfgfile_intval (option, value, _T("filesys_max_name_length"), &p->filesys_max_name, 1) + || cfgfile_yesno (option, value, _T("filesys_inject_icons"), &p->filesys_inject_icons) + || cfgfile_string (option, value, _T("filesys_inject_icons_drawer"), p->filesys_inject_icons_drawer, sizeof p->filesys_inject_icons_drawer / sizeof (TCHAR)) + || cfgfile_string (option, value, _T("filesys_inject_icons_project"), p->filesys_inject_icons_project, sizeof p->filesys_inject_icons_project / sizeof (TCHAR)) + || cfgfile_string (option, value, _T("filesys_inject_icons_tool"), p->filesys_inject_icons_tool, sizeof p->filesys_inject_icons_tool / sizeof (TCHAR))) + return 1; - || cfgfile_intval(option, value, _T("gfx_framerate"), &p->gfx_framerate, 1) - || cfgfile_intval(option, value, _T("gfx_top_windowed"), &p->gfx_size_win.x, 1) - || cfgfile_intval(option, value, _T("gfx_left_windowed"), &p->gfx_size_win.y, 1) - || cfgfile_intval(option, value, _T("gfx_refreshrate"), &p->gfx_apmode[APMODE_NATIVE].gfx_refreshrate, 1) - || cfgfile_intval(option, value, _T("gfx_refreshrate_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_refreshrate, 1) - || cfgfile_intval(option, value, _T("gfx_autoresolution_delay"), &p->gfx_autoresolution_delay, 1) - || cfgfile_intval(option, value, _T("gfx_backbuffers"), &p->gfx_apmode[APMODE_NATIVE].gfx_backbuffers, 1) - || cfgfile_intval(option, value, _T("gfx_backbuffers_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_backbuffers, 1) - || cfgfile_yesno(option, value, _T("gfx_interlace"), &p->gfx_apmode[APMODE_NATIVE].gfx_interlaced) - || cfgfile_yesno(option, value, _T("gfx_interlace_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_interlaced) - || cfgfile_intval(option, value, _T("gfx_black_frame_insertion_ratio"), &p->lightboost_strobo_ratio, 1) - - || cfgfile_intval(option, value, _T("gfx_center_horizontal_position"), &p->gfx_xcenter_pos, 1) - || cfgfile_intval(option, value, _T("gfx_center_vertical_position"), &p->gfx_ycenter_pos, 1) - || cfgfile_intval(option, value, _T("gfx_center_horizontal_size"), &p->gfx_xcenter_size, 1) - || cfgfile_intval(option, value, _T("gfx_center_vertical_size"), &p->gfx_ycenter_size, 1) - - || cfgfile_intval(option, value, _T("filesys_max_size"), &p->filesys_limit, 1) - || cfgfile_intval(option, value, _T("filesys_max_name_length"), &p->filesys_max_name, 1) - || cfgfile_intval(option, value, _T("filesys_max_file_size"), &p->filesys_max_file_size, 1) - || cfgfile_yesno(option, value, _T("filesys_inject_icons"), &p->filesys_inject_icons) - || cfgfile_string(option, value, _T("filesys_inject_icons_drawer"), p->filesys_inject_icons_drawer, sizeof p->filesys_inject_icons_drawer / sizeof(TCHAR)) - || cfgfile_string(option, value, _T("filesys_inject_icons_project"), p->filesys_inject_icons_project, sizeof p->filesys_inject_icons_project / sizeof(TCHAR)) - || cfgfile_string(option, value, _T("filesys_inject_icons_tool"), p->filesys_inject_icons_tool, sizeof p->filesys_inject_icons_tool / sizeof(TCHAR)) - - || cfgfile_intval(option, value, _T("gfx_luminance"), &p->gfx_luminance, 1) - || cfgfile_intval(option, value, _T("gfx_contrast"), &p->gfx_contrast, 1) - || cfgfile_intval(option, value, _T("gfx_gamma"), &p->gfx_gamma, 1) - || cfgfile_intval(option, value, _T("gfx_gamma_r"), &p->gfx_gamma_ch[0], 1) - || cfgfile_intval(option, value, _T("gfx_gamma_g"), &p->gfx_gamma_ch[1], 1) - || cfgfile_intval(option, value, _T("gfx_gamma_b"), &p->gfx_gamma_ch[2], 1) - || cfgfile_floatval(option, value, _T("rtg_vert_zoom_multf"), &p->rtg_vert_zoom_mult) - || cfgfile_floatval(option, value, _T("rtg_horiz_zoom_multf"), &p->rtg_horiz_zoom_mult) - || cfgfile_intval(option, value, _T("gfx_horizontal_tweak"), &p->gfx_extrawidth, 1) - - || cfgfile_intval(option, value, _T("floppy0sound"), &p->floppyslots[0].dfxclick, 1) - || cfgfile_intval(option, value, _T("floppy1sound"), &p->floppyslots[1].dfxclick, 1) - || cfgfile_intval(option, value, _T("floppy2sound"), &p->floppyslots[2].dfxclick, 1) - || cfgfile_intval(option, value, _T("floppy3sound"), &p->floppyslots[3].dfxclick, 1) - || cfgfile_intval(option, value, _T("floppy0soundvolume_disk"), &p->dfxclickvolume_disk[0], 1) - || cfgfile_intval(option, value, _T("floppy1soundvolume_disk"), &p->dfxclickvolume_disk[1], 1) - || cfgfile_intval(option, value, _T("floppy2soundvolume_disk"), &p->dfxclickvolume_disk[2], 1) - || cfgfile_intval(option, value, _T("floppy3soundvolume_disk"), &p->dfxclickvolume_disk[3], 1) - || cfgfile_intval(option, value, _T("floppy0soundvolume_empty"), &p->dfxclickvolume_empty[0], 1) - || cfgfile_intval(option, value, _T("floppy1soundvolume_empty"), &p->dfxclickvolume_empty[1], 1) - || cfgfile_intval(option, value, _T("floppy2soundvolume_empty"), &p->dfxclickvolume_empty[2], 1) - || cfgfile_intval(option, value, _T("floppy3soundvolume_empty"), &p->dfxclickvolume_empty[3], 1) - || cfgfile_intval(option, value, _T("floppy_channel_mask"), &p->dfxclickchannelmask, 1)) - return 1; - - if (cfgfile_path(option, value, _T("floppy0soundext"), p->floppyslots[0].dfxclickexternal, sizeof p->floppyslots[0].dfxclickexternal / sizeof(TCHAR)) - || cfgfile_path(option, value, _T("floppy1soundext"), p->floppyslots[1].dfxclickexternal, sizeof p->floppyslots[1].dfxclickexternal / sizeof(TCHAR)) - || cfgfile_path(option, value, _T("floppy2soundext"), p->floppyslots[2].dfxclickexternal, sizeof p->floppyslots[2].dfxclickexternal / sizeof(TCHAR)) - || cfgfile_path(option, value, _T("floppy3soundext"), p->floppyslots[3].dfxclickexternal, sizeof p->floppyslots[3].dfxclickexternal / sizeof(TCHAR)) - || cfgfile_string(option, value, _T("config_window_title"), p->config_window_title, sizeof p->config_window_title / sizeof(TCHAR)) - || cfgfile_string(option, value, _T("config_info"), p->info, sizeof p->info / sizeof(TCHAR)) + if (cfgfile_string(option, value, _T("config_info"), p->info, sizeof p->info / sizeof(TCHAR)) || cfgfile_string(option, value, _T("config_description"), p->description, sizeof p->description / sizeof(TCHAR))) return 1; - if (cfgfile_yesno(option, value, _T("use_debugger"), &p->start_debugger) - || cfgfile_yesno(option, value, _T("floppy0wp"), &p->floppyslots[0].forcedwriteprotect) - || cfgfile_yesno(option, value, _T("floppy1wp"), &p->floppyslots[1].forcedwriteprotect) - || cfgfile_yesno(option, value, _T("floppy2wp"), &p->floppyslots[2].forcedwriteprotect) - || cfgfile_yesno(option, value, _T("floppy3wp"), &p->floppyslots[3].forcedwriteprotect) - || cfgfile_yesno(option, value, _T("sampler_stereo"), &p->sampler_stereo) - || cfgfile_yesno(option, value, _T("sound_auto"), &p->sound_auto) - || cfgfile_yesno(option, value, _T("sound_cdaudio"), &p->sound_cdaudio) - || cfgfile_yesno(option, value, _T("sound_stereo_swap_paula"), &p->sound_stereo_swap_paula) - || cfgfile_yesno(option, value, _T("sound_stereo_swap_ahi"), &p->sound_stereo_swap_ahi) - || cfgfile_yesno(option, value, _T("log_illegal_mem"), &p->illegal_mem) - || cfgfile_yesno(option, value, _T("filesys_no_fsdb"), &p->filesys_no_uaefsdb) - || cfgfile_yesno(option, value, _T("gfx_monochrome"), &p->gfx_grayscale) - || cfgfile_yesno(option, value, _T("gfx_blacker_than_black"), &p->gfx_blackerthanblack) - || cfgfile_yesno(option, value, _T("gfx_black_frame_insertion"), &p->lightboost_strobo) - || cfgfile_yesno(option, value, _T("gfx_flickerfixer"), &p->gfx_scandoubler) - || cfgfile_yesno(option, value, _T("gfx_autoresolution_vga"), &p->gfx_autoresolution_vga) - || cfgfile_yesno(option, value, _T("show_refresh_indicator"), &p->refresh_indicator) - || cfgfile_yesno(option, value, _T("warp"), &p->turbo_emulation) - || cfgfile_yesno(option, value, _T("headless"), &p->headless) - || cfgfile_yesno(option, value, _T("clipboard_sharing"), &p->clipboard_sharing) - || cfgfile_yesno(option, value, _T("native_code"), &p->native_code) - || cfgfile_yesno(option, value, _T("tablet_library"), &p->tablet_library) - || cfgfile_yesno(option, value, _T("bsdsocket_emu"), &p->socket_emu)) - return 1; + if (cfgfile_yesno (option, value, _T("floppy0wp"), &p->floppyslots[0].forcedwriteprotect) + || cfgfile_yesno (option, value, _T("floppy1wp"), &p->floppyslots[1].forcedwriteprotect) + || cfgfile_yesno (option, value, _T("floppy2wp"), &p->floppyslots[2].forcedwriteprotect) + || cfgfile_yesno (option, value, _T("floppy3wp"), &p->floppyslots[3].forcedwriteprotect) + || cfgfile_yesno (option, value, _T("bsdsocket_emu"), &p->socket_emu)) + return 1; - if (cfgfile_strval(option, value, _T("sound_output"), &p->produce_sound, soundmode1, 1) - || cfgfile_strval(option, value, _T("sound_output"), &p->produce_sound, soundmode2, 0) - || cfgfile_strval(option, value, _T("sound_interpol"), &p->sound_interpol, interpolmode, 0) - || cfgfile_strval(option, value, _T("sound_filter"), &p->sound_filter, soundfiltermode1, 0) - || cfgfile_strval(option, value, _T("sound_filter_type"), &p->sound_filter_type, soundfiltermode2, 0) - || cfgfile_strboolval(option, value, _T("use_gui"), &p->start_gui, guimode1, 1) - || cfgfile_strboolval(option, value, _T("use_gui"), &p->start_gui, guimode2, 1) - || cfgfile_strboolval(option, value, _T("use_gui"), &p->start_gui, guimode3, 0) - || cfgfile_strval(option, value, _T("gfx_resolution"), &p->gfx_resolution, lorestype1, 0) - || cfgfile_strval(option, value, _T("gfx_lores"), &p->gfx_resolution, lorestype2, 0) - || cfgfile_strval(option, value, _T("gfx_lores_mode"), &p->gfx_lores_mode, loresmode, 0) - || cfgfile_strval(option, value, _T("gfx_fullscreen_amiga"), &p->gfx_apmode[APMODE_NATIVE].gfx_fullscreen, fullmodes, 0) - || cfgfile_strval(option, value, _T("gfx_fullscreen_picasso"), &p->gfx_apmode[APMODE_RTG].gfx_fullscreen, fullmodes, 0) - || cfgfile_strval(option, value, _T("gfx_center_horizontal"), &p->gfx_xcenter, centermode1, 1) - || cfgfile_strval(option, value, _T("gfx_center_vertical"), &p->gfx_ycenter, centermode1, 1) - || cfgfile_strval(option, value, _T("gfx_center_horizontal"), &p->gfx_xcenter, centermode2, 0) - || cfgfile_strval(option, value, _T("gfx_center_vertical"), &p->gfx_ycenter, centermode2, 0) - || cfgfile_strval(option, value, _T("gfx_colour_mode"), &p->color_mode, colormode1, 1) - || cfgfile_strval(option, value, _T("gfx_colour_mode"), &p->color_mode, colormode2, 0) - || cfgfile_strval(option, value, _T("gfx_color_mode"), &p->color_mode, colormode1, 1) - || cfgfile_strval(option, value, _T("gfx_color_mode"), &p->color_mode, colormode2, 0) - || cfgfile_strval(option, value, _T("gfx_max_horizontal"), &p->gfx_max_horizontal, maxhoriz, 0) - || cfgfile_strval(option, value, _T("gfx_max_vertical"), &p->gfx_max_vertical, maxvert, 0) - || cfgfile_strval(option, value, _T("gfx_api"), &p->gfx_api, filterapi, 0) - || cfgfile_strval(option, value, _T("gfx_atari_palette_fix"), &p->gfx_threebitcolors, threebitcolors, 0) - || cfgfile_strval(option, value, _T("magic_mousecursor"), &p->input_magic_mouse_cursor, magiccursors, 0) - || cfgfile_strval(option, value, _T("absolute_mouse"), &p->input_tablet, abspointers, 0)) + if (cfgfile_strval (option, value, _T("sound_output"), &p->produce_sound, soundmode1, 1) + || cfgfile_strval (option, value, _T("sound_output"), &p->produce_sound, soundmode2, 0) + || cfgfile_strval (option, value, _T("sound_interpol"), &p->sound_interpol, interpolmode, 0) + || cfgfile_strval (option, value, _T("sound_filter"), &p->sound_filter, soundfiltermode1, 0) + || cfgfile_strval (option, value, _T("sound_filter_type"), &p->sound_filter_type, soundfiltermode2, 0) + || cfgfile_strboolval (option, value, _T("use_gui"), &p->start_gui, guimode1, 1) + || cfgfile_strboolval (option, value, _T("use_gui"), &p->start_gui, guimode2, 1) + || cfgfile_strboolval (option, value, _T("use_gui"), &p->start_gui, guimode3, 0) + || cfgfile_strval (option, value, _T("gfx_resolution"), &p->gfx_resolution, lorestype1, 0) + || cfgfile_strval (option, value, _T("gfx_lores"), &p->gfx_resolution, lorestype2, 0) + || cfgfile_strval (option, value, _T("absolute_mouse"), &p->input_tablet, abspointers, 0)) + return 1; + + if (_tcscmp (option, _T("gfx_width_windowed")) == 0) { return 1; - - if (cfgfile_yesno(option, value, _T("magic_mouse"), &vb)) { - p->input_mouse_untrap |= MOUSEUNTRAP_MAGIC; + } + if (_tcscmp (option, _T("gfx_height_windowed")) == 0) { return 1; } - -#ifdef GFXFILTER - for (int j = 0; j < 2; j++) { - struct gfx_filterdata *gf = &p->gf[j]; - const TCHAR *ext = j == 0 ? NULL : _T("_rtg"); - if (cfgfile_strval(option, value, _T("gfx_filter_autoscale"), ext, &gf->gfx_filter_autoscale, j == 0 ? autoscale : autoscale_rtg, 0) - || cfgfile_strval(option, value, _T("gfx_filter_keep_aspect"), ext, &gf->gfx_filter_keep_aspect, aspects, 0) - || cfgfile_strval(option, value, _T("gfx_filter_autoscale_limit"), ext, &gf->gfx_filter_integerscalelimit, autoscalelimit, 0)) - return 1; - - if (cfgfile_floatval(option, value, _T("gfx_filter_vert_zoomf"), ext, &gf->gfx_filter_vert_zoom) - || cfgfile_floatval(option, value, _T("gfx_filter_horiz_zoomf"), ext, &gf->gfx_filter_horiz_zoom) - || cfgfile_floatval(option, value, _T("gfx_filter_vert_zoom_multf"), ext, &gf->gfx_filter_vert_zoom_mult) - || cfgfile_floatval(option, value, _T("gfx_filter_horiz_zoom_multf"), ext, &gf->gfx_filter_horiz_zoom_mult) - || cfgfile_floatval(option, value, _T("gfx_filter_vert_offsetf"), ext, &gf->gfx_filter_vert_offset) - || cfgfile_floatval(option, value, _T("gfx_filter_horiz_offsetf"), ext, &gf->gfx_filter_horiz_offset) - || cfgfile_intval(option, value, _T("gfx_filter_left_border"), ext, &gf->gfx_filter_left_border, 1) - || cfgfile_intval(option, value, _T("gfx_filter_right_border"), ext, &gf->gfx_filter_right_border, 1) - || cfgfile_intval(option, value, _T("gfx_filter_top_border"), ext, &gf->gfx_filter_top_border, 1) - || cfgfile_intval(option, value, _T("gfx_filter_bottom_border"), ext, &gf->gfx_filter_bottom_border, 1) - || cfgfile_intval(option, value, _T("gfx_filter_scanlines"), ext, &gf->gfx_filter_scanlines, 1) - || cfgfile_intval(option, value, _T("gfx_filter_scanlinelevel"), ext, &gf->gfx_filter_scanlinelevel, 1) - || cfgfile_intval(option, value, _T("gfx_filter_scanlineratio"), ext, &gf->gfx_filter_scanlineratio, 1) - || cfgfile_intval(option, value, _T("gfx_filter_luminance"), ext, &gf->gfx_filter_luminance, 1) - || cfgfile_intval(option, value, _T("gfx_filter_contrast"), ext, &gf->gfx_filter_contrast, 1) - || cfgfile_intval(option, value, _T("gfx_filter_saturation"), ext, &gf->gfx_filter_saturation, 1) - || cfgfile_intval(option, value, _T("gfx_filter_gamma"), ext, &gf->gfx_filter_gamma, 1) - || cfgfile_intval(option, value, _T("gfx_filter_gamma_r"), ext, &gf->gfx_filter_gamma_ch[0], 1) - || cfgfile_intval(option, value, _T("gfx_filter_gamma_g"), ext, &gf->gfx_filter_gamma_ch[1], 1) - || cfgfile_intval(option, value, _T("gfx_filter_gamma_b"), ext, &gf->gfx_filter_gamma_ch[2], 1) - || cfgfile_intval(option, value, _T("gfx_filter_blur"), ext, &gf->gfx_filter_blur, 1) - || cfgfile_intval(option, value, _T("gfx_filter_noise"), ext, &gf->gfx_filter_noise, 1) - || cfgfile_intval(option, value, _T("gfx_filter_bilinear"), ext, &gf->gfx_filter_bilinear, 1) - || cfgfile_intval(option, value, _T("gfx_filter_keep_autoscale_aspect"), ext, &gf->gfx_filter_keep_autoscale_aspect, 1) - || cfgfile_string(option, value, _T("gfx_filter_mask"), ext, gf->gfx_filtermask[2 * MAX_FILTERSHADERS], sizeof gf->gfx_filtermask[2 * MAX_FILTERSHADERS] / sizeof(TCHAR))) - return 1; - } -#endif - - if (cfgfile_intval(option, value, _T("floppy_volume"), &v, 1)) { - for (int i = 0; i < 4; i++) { - p->dfxclickvolume_disk[i] = v; - p->dfxclickvolume_empty[i] = v; - } + if (_tcscmp (option, _T("gfx_width_fullscreen")) == 0) { return 1; } - - if (_tcscmp(option, _T("gfx_width_windowed")) == 0) { - if (!_tcscmp(value, _T("native"))) { - p->gfx_size_win.width = 0; - p->gfx_size_win.height = 0; - } - else { - cfgfile_intval(option, value, _T("gfx_width_windowed"), &p->gfx_size_win.width, 1); - } - return 1; - } - if (_tcscmp(option, _T("gfx_height_windowed")) == 0) { - if (!_tcscmp(value, _T("native"))) { - p->gfx_size_win.width = 0; - p->gfx_size_win.height = 0; - } - else { - cfgfile_intval(option, value, _T("gfx_height_windowed"), &p->gfx_size_win.height, 1); - } - return 1; - } - if (_tcscmp(option, _T("gfx_width_fullscreen")) == 0) { - if (!_tcscmp(value, _T("native"))) { - p->gfx_size_fs.width = 0; - p->gfx_size_fs.height = 0; - p->gfx_size_fs.special = WH_NATIVE; - } - else { - cfgfile_intval(option, value, _T("gfx_width_fullscreen"), &p->gfx_size_fs.width, 1); - p->gfx_size_fs.special = 0; - } - return 1; - } - if (_tcscmp(option, _T("gfx_height_fullscreen")) == 0) { - if (!_tcscmp(value, _T("native"))) { - p->gfx_size_fs.width = 0; - p->gfx_size_fs.height = 0; - p->gfx_size_fs.special = WH_NATIVE; - } - else { - cfgfile_intval(option, value, _T("gfx_height_fullscreen"), &p->gfx_size_fs.height, 1); - p->gfx_size_fs.special = 0; - } - return 1; - } - - if (cfgfile_intval(option, value, _T("gfx_display"), &p->gfx_apmode[APMODE_NATIVE].gfx_display, 1)) { - p->gfx_apmode[APMODE_RTG].gfx_display = p->gfx_apmode[APMODE_NATIVE].gfx_display; - return 1; - } - if (cfgfile_intval(option, value, _T("gfx_display_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_display, 1)) { - return 1; - } - if (_tcscmp(option, _T("gfx_display_friendlyname")) == 0 || _tcscmp(option, _T("gfx_display_name")) == 0) { - TCHAR tmp[MAX_DPATH]; - if (cfgfile_string(option, value, _T("gfx_display_friendlyname"), tmp, sizeof tmp / sizeof(TCHAR))) { - int num = target_get_display(tmp); - if (num >= 0) - p->gfx_apmode[APMODE_RTG].gfx_display = p->gfx_apmode[APMODE_NATIVE].gfx_display = num; - } - if (cfgfile_string(option, value, _T("gfx_display_name"), tmp, sizeof tmp / sizeof(TCHAR))) { - int num = target_get_display(tmp); - if (num >= 0) - p->gfx_apmode[APMODE_RTG].gfx_display = p->gfx_apmode[APMODE_NATIVE].gfx_display = num; - } - return 1; - } - if (_tcscmp(option, _T("gfx_display_friendlyname_rtg")) == 0 || _tcscmp(option, _T("gfx_display_name_rtg")) == 0) { - TCHAR tmp[MAX_DPATH]; - if (cfgfile_string(option, value, _T("gfx_display_friendlyname_rtg"), tmp, sizeof tmp / sizeof(TCHAR))) { - int num = target_get_display(tmp); - if (num >= 0) - p->gfx_apmode[APMODE_RTG].gfx_display = num; - } - if (cfgfile_string(option, value, _T("gfx_display_name_rtg"), tmp, sizeof tmp / sizeof(TCHAR))) { - int num = target_get_display(tmp); - if (num >= 0) - p->gfx_apmode[APMODE_RTG].gfx_display = num; - } + if (_tcscmp (option, _T("gfx_height_fullscreen")) == 0) { return 1; } if (_tcscmp(option, _T("gfx_linemode")) == 0) { int v; p->gfx_vresolution = VRES_DOUBLE; - p->gfx_pscanlines = 0; - p->gfx_iscanlines = 0; if (cfgfile_strval(option, value, _T("gfx_linemode"), &v, linemode, 0)) { p->gfx_vresolution = VRES_NONDOUBLE; if (v > 0) { - p->gfx_iscanlines = (v - 1) / 4; - p->gfx_pscanlines = (v - 1) % 4; p->gfx_vresolution = VRES_DOUBLE; } } return 1; } - if (_tcscmp(option, _T("gfx_vsync")) == 0) { - if (cfgfile_strval(option, value, _T("gfx_vsync"), &p->gfx_apmode[APMODE_NATIVE].gfx_vsync, vsyncmodes, 0) >= 0) { + + if (_tcscmp (option, _T("gfx_vsync")) == 0) { + if (cfgfile_strval (option, value, _T("gfx_vsync"), &p->gfx_apmode[APMODE_NATIVE].gfx_vsync, vsyncmodes, 0) >= 0) { p->gfx_apmode[APMODE_NATIVE].gfx_vsync--; return 1; } - return cfgfile_yesno(option, value, _T("gfx_vsync"), &p->gfx_apmode[APMODE_NATIVE].gfx_vsync); + return cfgfile_yesno (option, value, _T("gfx_vsync"), &p->gfx_apmode[APMODE_NATIVE].gfx_vsync); } - if (_tcscmp(option, _T("gfx_vsync_picasso")) == 0) { - if (cfgfile_strval(option, value, _T("gfx_vsync_picasso"), &p->gfx_apmode[APMODE_RTG].gfx_vsync, vsyncmodes, 0) >= 0) { + if (_tcscmp (option, _T("gfx_vsync_picasso")) == 0) { + if (cfgfile_strval (option, value, _T("gfx_vsync_picasso"), &p->gfx_apmode[APMODE_RTG].gfx_vsync, vsyncmodes, 0) >= 0) { p->gfx_apmode[APMODE_RTG].gfx_vsync--; return 1; } - return cfgfile_yesno(option, value, _T("gfx_vsync_picasso"), &p->gfx_apmode[APMODE_RTG].gfx_vsync); - } - if (cfgfile_strval(option, value, _T("gfx_vsyncmode"), &p->gfx_apmode[APMODE_NATIVE].gfx_vsyncmode, vsyncmodes2, 0)) - return 1; - if (cfgfile_strval(option, value, _T("gfx_vsyncmode_picasso"), &p->gfx_apmode[APMODE_RTG].gfx_vsyncmode, vsyncmodes2, 0)) - return 1; - - if (cfgfile_yesno(option, value, _T("show_leds"), &vb)) { - if (vb) - p->leds_on_screen |= STATUSLINE_CHIPSET; - else - p->leds_on_screen &= ~STATUSLINE_CHIPSET; - return 1; - } - if (cfgfile_yesno(option, value, _T("show_leds_rtg"), &vb)) { - if (vb) - p->leds_on_screen |= STATUSLINE_RTG; - else - p->leds_on_screen &= ~STATUSLINE_RTG; - return 1; - } - if (_tcscmp(option, _T("show_leds_enabled")) == 0 || _tcscmp(option, _T("show_leds_enabled_rtg")) == 0) { - TCHAR tmp[MAX_DPATH]; - int idx = _tcscmp(option, _T("show_leds_enabled")) == 0 ? 0 : 1; - p->leds_on_screen_mask[idx] = 0; - _tcscpy(tmp, value); - _tcscat(tmp, _T(",")); - TCHAR *s = tmp; - for (;;) { - TCHAR *s2 = s; - TCHAR *s3 = _tcschr(s, ':'); - s = _tcschr(s, ','); - if (!s) - break; - if (s3 && s3 < s) - s = s3; - *s = 0; - for (int i = 0; leds[i]; i++) { - if (!_tcsicmp(s2, leds[i])) { - p->leds_on_screen_mask[idx] |= 1 << i; - } - } - s++; - } - return 1; + return cfgfile_yesno (option, value, _T("gfx_vsync_picasso"), &p->gfx_apmode[APMODE_RTG].gfx_vsync); } - if (!_tcscmp(option, _T("osd_position"))) { - TCHAR *s = value; - p->osd_pos.x = 0; - p->osd_pos.y = 0; - while (s) { - if (!_tcschr(s, ':')) - break; - p->osd_pos.x = (int)(_tstof(s) * 10.0); - s = _tcschr(s, ':'); - if (!s) - break; - if (s[-1] == '%') - p->osd_pos.x += 30000; - s++; - p->osd_pos.y = (int)(_tstof(s) * 10.0); - s += _tcslen(s); - if (s[-1] == '%') - p->osd_pos.y += 30000; - break; - } + if(cfgfile_yesno (option, value, _T("show_leds"), &vb)) { + p->leds_on_screen = vb; + return 1; + } + + if (_tcscmp (option, _T("gfx_width")) == 0 || _tcscmp (option, _T("gfx_height")) == 0) { + cfgfile_intval (option, value, _T("gfx_width"), &p->gfx_size.width, 1); + cfgfile_intval (option, value, _T("gfx_height"), &p->gfx_size.height, 1); + return 1; + } + +// olde versions (compatibility) + + if (_tcscmp (option, _T("joyportfriendlyname0")) == 0 || _tcscmp (option, _T("joyportfriendlyname1")) == 0) { + inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyportfriendlyname0")) == 0 ? 0 : 1, -1, 2); return 1; } - -#ifdef GFXFILTER - for (int j = 0; j < 2; j++) { - struct gfx_filterdata *gf = &p->gf[j]; - if ((j == 0 && _tcscmp(option, _T("gfx_filter_overlay")) == 0) || (j == 1 && _tcscmp(option, _T("gfx_filter_overlay_rtg")) == 0)) { - TCHAR *s = _tcschr(value, ','); - gf->gfx_filteroverlay_overscan = 0; - gf->gfx_filteroverlay_pos.x = 0; - gf->gfx_filteroverlay_pos.y = 0; - gf->gfx_filteroverlay_pos.width = 0; - gf->gfx_filteroverlay_pos.height = 0; - if (s) - *s = 0; - while (s) { - *s++ = 0; - gf->gfx_filteroverlay_overscan = _tstol(s); - s = _tcschr(s, ':'); - if (!s) - break; - break; - } - _tcsncpy(gf->gfx_filteroverlay, value, sizeof gf->gfx_filteroverlay / sizeof(TCHAR) - 1); - gf->gfx_filteroverlay[sizeof gf->gfx_filteroverlay / sizeof(TCHAR) - 1] = 0; - return 1; - } - - if ((j == 0 && (_tcscmp(option, _T("gfx_filtermask_pre")) == 0 || _tcscmp(option, _T("gfx_filtermask_post")) == 0)) || - (j == 1 && (_tcscmp(option, _T("gfx_filtermask_pre_rtg")) == 0 || _tcscmp(option, _T("gfx_filtermask_post_rtg")) == 0))) { - if (_tcscmp(option, _T("gfx_filtermask_pre")) == 0 || _tcscmp(option, _T("gfx_filtermask_pre_rtg")) == 0) { - for (int i = 0; i < MAX_FILTERSHADERS; i++) { - if (gf->gfx_filtermask[i][0] == 0) { - _tcscpy(gf->gfx_filtermask[i], value); - break; - } - } - } - else { - for (int i = 0; i < MAX_FILTERSHADERS; i++) { - if (gf->gfx_filtermask[i + MAX_FILTERSHADERS][0] == 0) { - _tcscpy(gf->gfx_filtermask[i + MAX_FILTERSHADERS], value); - break; - } - } - } - return 1; - } - - if ((j == 0 && (_tcscmp(option, _T("gfx_filter_pre")) == 0 || _tcscmp(option, _T("gfx_filter_post")) == 0)) || - (j == 1 && (_tcscmp(option, _T("gfx_filter_pre_rtg")) == 0 || _tcscmp(option, _T("gfx_filter_post_rtg")) == 0))) { - TCHAR *s = _tcschr(value, ':'); - if (s) { - *s++ = 0; - if (!_tcscmp(value, _T("D3D"))) { - p->gfx_api = 1; - if (_tcscmp(option, _T("gfx_filter_pre")) == 0 || _tcscmp(option, _T("gfx_filter_pre_rtg")) == 0) { - for (int i = 0; i < MAX_FILTERSHADERS; i++) { - if (gf->gfx_filtershader[i][0] == 0) { - _tcscpy(gf->gfx_filtershader[i], s); - break; - } - } - } - else { - for (int i = 0; i < MAX_FILTERSHADERS; i++) { - if (gf->gfx_filtershader[i + MAX_FILTERSHADERS][0] == 0) { - _tcscpy(gf->gfx_filtershader[i + MAX_FILTERSHADERS], s); - break; - } - } - } - } - } - return 1; - } - - if ((j == 0 && _tcscmp(option, _T("gfx_filter")) == 0) || (j == 1 && _tcscmp(option, _T("gfx_filter_rtg")) == 0)) { - TCHAR *s = _tcschr(value, ':'); - gf->gfx_filter = 0; - if (s) { - *s++ = 0; - if (!_tcscmp(value, _T("D3D"))) { - p->gfx_api = 1; - _tcscpy(gf->gfx_filtershader[2 * MAX_FILTERSHADERS], s); - for (int i = 0; i < 2 * MAX_FILTERSHADERS; i++) { - if (!_tcsicmp(gf->gfx_filtershader[i], s)) { - gf->gfx_filtershader[i][0] = 0; - gf->gfx_filtermask[i][0] = 0; - } - } - } - } - if (!_tcscmp(value, _T("none"))) { - gf->gfx_filtershader[2 * MAX_FILTERSHADERS][0] = 0; - for (int i = 0; i < 2 * MAX_FILTERSHADERS; i++) { - gf->gfx_filtershader[i][0] = 0; - gf->gfx_filtermask[i][0] = 0; - } - } - else if (!_tcscmp(value, _T("direct3d"))) { - p->gfx_api = 1; // forwards compatibiity - } - else { - int i = 0; - while (uaefilters[i].name) { - if (!_tcscmp(uaefilters[i].cfgname, value)) { - gf->gfx_filter = uaefilters[i].type; - break; - } - i++; - } - } - return 1; - } - if (j == 0 && _tcscmp(option, _T("gfx_filter_mode")) == 0) { - cfgfile_strval(option, value, _T("gfx_filter_mode"), &gf->gfx_filter_filtermode, filtermode2, 0); - return 1; - } - if (j == 1 && _tcscmp(option, _T("gfx_filter_mode_rtg")) == 0) { - cfgfile_strval(option, value, _T("gfx_filter_mode_rtg"), &gf->gfx_filter_filtermode, filtermode2, 0); - return 1; - } - - if ((j == 0 && cfgfile_string(option, value, _T("gfx_filter_aspect_ratio"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) || - (j == 1 && cfgfile_string(option, value, _T("gfx_filter_aspect_ratio_rtg"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR)))) { - int v1, v2; - TCHAR *s; - - gf->gfx_filter_aspect = -1; - v1 = _tstol(tmpbuf); - s = _tcschr(tmpbuf, ':'); - if (s) { - v2 = _tstol(s + 1); - if (v1 < 0 || v2 < 0) - gf->gfx_filter_aspect = -1; - else if (v1 == 0 || v2 == 0) - gf->gfx_filter_aspect = 0; - else - gf->gfx_filter_aspect = v1 * ASPECTMULT + v2; - } - return 1; - } - } -#endif - - if (_tcscmp(option, _T("gfx_width")) == 0 || _tcscmp(option, _T("gfx_height")) == 0) { - cfgfile_intval(option, value, _T("gfx_width"), &p->gfx_size_win.width, 1); - cfgfile_intval(option, value, _T("gfx_height"), &p->gfx_size_win.height, 1); - p->gfx_size_fs.width = p->gfx_size_win.width; - p->gfx_size_fs.height = p->gfx_size_win.height; + if (_tcscmp (option, _T("joyportfriendlyname2")) == 0 || _tcscmp (option, _T("joyportfriendlyname3")) == 0) { + inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyportfriendlyname2")) == 0 ? 2 : 3, -1, 2); return 1; } - - if (_tcscmp(option, _T("gfx_fullscreen_multi")) == 0 || _tcscmp(option, _T("gfx_windowed_multi")) == 0) { - TCHAR tmp[256], *tmpp, *tmpp2; - struct wh *wh = p->gfx_size_win_xtra; - if (_tcscmp(option, _T("gfx_fullscreen_multi")) == 0) - wh = p->gfx_size_fs_xtra; - _stprintf(tmp, _T(",%s,"), value); - tmpp2 = tmp; - for (i = 0; i < 4; i++) { - tmpp = _tcschr(tmpp2, ','); - tmpp++; - wh[i].width = _tstol(tmpp); - while (*tmpp != ',' && *tmpp != 'x' && *tmpp != '*') - tmpp++; - wh[i].height = _tstol(tmpp + 1); - tmpp2 = tmpp; - } + if (_tcscmp (option, _T("joyportname0")) == 0 || _tcscmp (option, _T("joyportname1")) == 0) { + inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyportname0")) == 0 ? 0 : 1, -1, 1); return 1; } - - if (cfgfile_string(option, value, _T("joyportcustom0"), p->jports_custom[0].custom, sizeof p->jports_custom[0].custom / sizeof(TCHAR))) + if (_tcscmp (option, _T("joyportname2")) == 0 || _tcscmp (option, _T("joyportname3")) == 0) { + inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyportname2")) == 0 ? 2 : 3, -1, 1); return 1; - if (cfgfile_string(option, value, _T("joyportcustom1"), p->jports_custom[1].custom, sizeof p->jports_custom[1].custom / sizeof(TCHAR))) + } + + + // new versions + if (_tcscmp (option, _T("joyport0_friendlyname")) == 0 || _tcscmp (option, _T("joyport1_friendlyname")) == 0) { + inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyport0_friendlyname")) == 0 ? 0 : 1, -1, 2); return 1; - if (cfgfile_string(option, value, _T("joyportcustom2"), p->jports_custom[2].custom, sizeof p->jports_custom[2].custom / sizeof(TCHAR))) + } + if (_tcscmp (option, _T("joyport2_friendlyname")) == 0 || _tcscmp (option, _T("joyport3_friendlyname")) == 0) { + inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyport2_friendlyname")) == 0 ? 2 : 3, -1, 2); return 1; - if (cfgfile_string(option, value, _T("joyportcustom3"), p->jports_custom[3].custom, sizeof p->jports_custom[3].custom / sizeof(TCHAR))) + } + if (_tcscmp (option, _T("joyport0_name")) == 0 || _tcscmp (option, _T("joyport1_name")) == 0) { + inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyport0_name")) == 0 ? 0 : 1, -1, 1); return 1; - if (cfgfile_string(option, value, _T("joyportcustom4"), p->jports_custom[4].custom, sizeof p->jports_custom[4].custom / sizeof(TCHAR))) + } + if (_tcscmp (option, _T("joyport2_name")) == 0 || _tcscmp (option, _T("joyport3_name")) == 0) { + inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyport2_name")) == 0 ? 2 : 3, -1, 1); return 1; - if (cfgfile_string(option, value, _T("joyportcustom5"), p->jports_custom[5].custom, sizeof p->jports_custom[5].custom / sizeof(TCHAR))) + } + +// old version only + if (_tcscmp (option, _T("joyport0")) == 0 || _tcscmp (option, _T("joyport1")) == 0) { + inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyport0")) == 0 ? 0 : 1, -1, 0); + return 1; + } + if (_tcscmp (option, _T("joyport2")) == 0 || _tcscmp (option, _T("joyport3")) == 0) { + inputdevice_joyport_config_store(p, value, _tcscmp (option, _T("joyport2")) == 0 ? 2 : 3, -1, 0); + return 1; + } + + // shared version + if (cfgfile_strval (option, value, _T("joyport0_mode"), &p->jports[0].mode, joyportmodes, 0) || + cfgfile_strval (option, value, _T("joyport0mode"), &p->jports[0].mode, joyportmodes, 0)) + return 1; + if (cfgfile_strval (option, value, _T("joyport1_mode"), &p->jports[1].mode, joyportmodes, 0) || + cfgfile_strval (option, value, _T("joyport1mode"), &p->jports[1].mode, joyportmodes, 0) ) return 1; - //if (_tcscmp(option, _T("joyportfriendlyname0")) == 0 || _tcscmp(option, _T("joyportfriendlyname1")) == 0) { - // inputdevice_joyport_config_store(p, value, _tcscmp(option, _T("joyportfriendlyname0")) == 0 ? 0 : 1, -1, 2); - // return 1; - //} - //if (_tcscmp(option, _T("joyportfriendlyname2")) == 0 || _tcscmp(option, _T("joyportfriendlyname3")) == 0) { - // inputdevice_joyport_config_store(p, value, _tcscmp(option, _T("joyportfriendlyname2")) == 0 ? 2 : 3, -1, 2); - // return 1; - //} - //if (_tcscmp(option, _T("joyportname0")) == 0 || _tcscmp(option, _T("joyportname1")) == 0) { - // inputdevice_joyport_config_store(p, value, _tcscmp(option, _T("joyportname0")) == 0 ? 0 : 1, -1, 1); - // return 1; - //} - //if (_tcscmp(option, _T("joyportname2")) == 0 || _tcscmp(option, _T("joyportname3")) == 0) { - // inputdevice_joyport_config_store(p, value, _tcscmp(option, _T("joyportname2")) == 0 ? 2 : 3, -1, 1); - // return 1; - //} - //if (_tcscmp(option, _T("joyport0")) == 0 || _tcscmp(option, _T("joyport1")) == 0) { - // inputdevice_joyport_config_store(p, value, _tcscmp(option, _T("joyport0")) == 0 ? 0 : 1, -1, 0); - // return 1; - //} - //if (_tcscmp(option, _T("joyport2")) == 0 || _tcscmp(option, _T("joyport3")) == 0) { - // inputdevice_joyport_config_store(p, value, _tcscmp(option, _T("joyport2")) == 0 ? 2 : 3, -1, 0); - // return 1; - //} - if (cfgfile_strval(option, value, _T("joyport0mode"), &p->jports[0].mode, joyportmodes, 0)) + if (cfgfile_strval (option, value, _T("joyport0autofire"), &p->jports[0].autofire, joyaf, 0) || + cfgfile_strval (option, value, _T("joyport0_autofire"), &p->jports[0].autofire, joyaf, 0)) return 1; - if (cfgfile_strval(option, value, _T("joyport1mode"), &p->jports[1].mode, joyportmodes, 0)) + if (cfgfile_strval (option, value, _T("joyport1autofire"), &p->jports[1].autofire, joyaf, 0) || + cfgfile_strval (option, value, _T("joyport1_autofire"), &p->jports[1].autofire, joyaf, 0)) return 1; - if (cfgfile_strval(option, value, _T("joyport2mode"), &p->jports[2].mode, joyportmodes, 0)) + if (cfgfile_strval (option, value, _T("joyport2autofire"), &p->jports[2].autofire, joyaf, 0) || + cfgfile_strval (option, value, _T("joyport2_autofire"), &p->jports[2].autofire, joyaf, 0)) return 1; - if (cfgfile_strval(option, value, _T("joyport3mode"), &p->jports[3].mode, joyportmodes, 0)) + if (cfgfile_strval (option, value, _T("joyport3autofire"), &p->jports[3].autofire, joyaf, 0) || + cfgfile_strval (option, value, _T("joyport3_autofire"), &p->jports[3].autofire, joyaf, 0)) return 1; - if (cfgfile_strval(option, value, _T("joyport0autofire"), &p->jports[0].autofire, joyaf, 0)) + + +#ifndef PANDORA + if (cfgfile_strval(option, value, _T("joyport0_mousemap"), &p->jports[0].mousemap, mousemaps, 0)) return 1; - if (cfgfile_strval(option, value, _T("joyport1autofire"), &p->jports[1].autofire, joyaf, 0)) + if (cfgfile_strval(option, value, _T("joyport1_mousemap"), &p->jports[1].mousemap, mousemaps, 0)) return 1; - if (cfgfile_strval(option, value, _T("joyport2autofire"), &p->jports[2].autofire, joyaf, 0)) - return 1; - if (cfgfile_strval(option, value, _T("joyport3autofire"), &p->jports[3].autofire, joyaf, 0)) - return 1; - - if (cfgfile_yesno(option, value, _T("joyport0keyboardoverride"), &vb)) { +#endif + +// shared version + if (cfgfile_yesno (option, value, _T("joyport0keyboardoverride"), &vb) || + cfgfile_yesno (option, value, _T("joyport0_keyboardoverride"), &vb)) { p->jports[0].nokeyboardoverride = !vb; return 1; } - if (cfgfile_yesno(option, value, _T("joyport1keyboardoverride"), &vb)) { + if (cfgfile_yesno (option, value, _T("joyport1keyboardoverride"), &vb) || + cfgfile_yesno (option, value, _T("joyport1_keyboardoverride"), &vb)) { p->jports[1].nokeyboardoverride = !vb; return 1; } - if (cfgfile_yesno(option, value, _T("joyport2keyboardoverride"), &vb)) { + if (cfgfile_yesno (option, value, _T("joyport2keyboardoverride"), &vb) || + cfgfile_yesno (option, value, _T("joyport2_keyboardoverride"), &vb)) { p->jports[2].nokeyboardoverride = !vb; return 1; } - if (cfgfile_yesno(option, value, _T("joyport3keyboardoverride"), &vb)) { + if (cfgfile_yesno (option, value, _T("joyport3keyboardoverride"), &vb) || + cfgfile_yesno (option, value, _T("joyport3_keyboardoverride"), &vb)) { p->jports[3].nokeyboardoverride = !vb; return 1; } - if (cfgfile_path(option, value, _T("statefile_quit"), p->quitstatefile, sizeof p->quitstatefile / sizeof(TCHAR))) - return 1; - - if (cfgfile_string(option, value, _T("statefile_name"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) { - fetch_statefilepath(savestate_fname, sizeof savestate_fname / sizeof(TCHAR)); - _tcscat(savestate_fname, tmpbuf); - if (_tcslen(savestate_fname) >= 4 && _tcsicmp(savestate_fname + _tcslen(savestate_fname) - 4, _T(".uss"))) - _tcscat(savestate_fname, _T(".uss")); - return 1; - } - - if (cfgfile_path(option, value, _T("statefile"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) { - _tcscpy(p->statefile, tmpbuf); - _tcscpy(savestate_fname, tmpbuf); - if (zfile_exists(savestate_fname)) { - savestate_state = STATE_DORESTORE; - } - else { - int ok = 0; - if (savestate_fname[0]) { - for (;;) { - TCHAR *p; - if (my_existsdir(savestate_fname)) { - ok = 1; - break; - } - p = _tcsrchr(savestate_fname, '\\'); - if (!p) - p = _tcsrchr(savestate_fname, '/'); - if (!p) - break; - *p = 0; - } + if (cfgfile_string (option, value, _T("statefile"), tmpbuf, sizeof (tmpbuf) / sizeof (TCHAR))) { + _tcscpy (savestate_fname, tmpbuf); + if (zfile_exists (savestate_fname)) { + savestate_state = STATE_DORESTORE; + } else { + int ok = 0; + if (savestate_fname[0]) { + for (;;) { + TCHAR *p; + if (my_existsdir (savestate_fname)) { + ok = 1; + break; + } + p = _tcsrchr (savestate_fname, '\\'); + if (!p) + p = _tcsrchr (savestate_fname, '/'); + if (!p) + break; + *p = 0; + } + } + if (!ok) { + savestate_fname[0] = 0; } - if (!ok) { - TCHAR tmp[MAX_DPATH]; - fetch_statefilepath(tmp, sizeof tmp / sizeof(TCHAR)); - _tcscat(tmp, savestate_fname); - if (zfile_exists(tmp)) { - _tcscpy(savestate_fname, tmp); - savestate_state = STATE_DORESTORE; - } - else { - savestate_fname[0] = 0; - } - } - } + } + return 1; + } + + if (cfgfile_strval (option, value, _T("sound_channels"), &p->sound_stereo, stereomode, 1)) { + if (p->sound_stereo == SND_NONE) { /* "mixed stereo" compatibility hack */ + p->sound_stereo = SND_STEREO; + p->sound_mixed_stereo_delay = 5; + p->sound_stereo_separation = 7; + } + return 1; + } + + if (_tcscmp (option, _T("kbd_lang")) == 0) { + KbdLang l; + if ((l = KBD_LANG_DE, _tcsicmp (value, _T("de")) == 0) + || (l = KBD_LANG_DK, _tcsicmp (value, _T("dk")) == 0) + || (l = KBD_LANG_SE, _tcsicmp (value, _T("se")) == 0) + || (l = KBD_LANG_US, _tcsicmp (value, _T("us")) == 0) + || (l = KBD_LANG_FR, _tcsicmp (value, _T("fr")) == 0) + || (l = KBD_LANG_IT, _tcsicmp (value, _T("it")) == 0) + || (l = KBD_LANG_ES, _tcsicmp (value, _T("es")) == 0)) + p->keyboard_lang = l; + else + cfgfile_warning(_T("Unknown keyboard language\n")); return 1; } - if (cfgfile_strval(option, value, _T("sound_channels"), &p->sound_stereo, stereomode, 1)) { - if (p->sound_stereo == SND_NONE) { /* "mixed stereo" compatibility hack */ - p->sound_stereo = SND_STEREO; - p->sound_mixed_stereo_delay = 5; - p->sound_stereo_separation = 7; - } - return 1; - } + if (cfgfile_string (option, value, _T("config_version"), tmpbuf, sizeof (tmpbuf) / sizeof (TCHAR))) { + TCHAR *tmpp2; + tmpp = _tcschr (value, '.'); + if (tmpp) { + *tmpp++ = 0; + tmpp2 = tmpp; + p->config_version = _tstol (tmpbuf) << 16; + tmpp = _tcschr (tmpp, '.'); + if (tmpp) { + *tmpp++ = 0; + p->config_version |= _tstol (tmpp2) << 8; + p->config_version |= _tstol (tmpp); + } + } + return 1; + } + if (_tcscmp (option, _T("displaydata")) == 0 || _tcscmp (option, _T("displaydata_pal")) == 0 || _tcscmp (option, _T("displaydata_ntsc")) == 0) { + _tcsncpy (tmpbuf, value, sizeof tmpbuf / sizeof (TCHAR) - 1); + tmpbuf[sizeof tmpbuf / sizeof (TCHAR) - 1] = '\0'; - //if (_tcscmp(option, _T("kbd_lang")) == 0) { - // KbdLang l; - // if ((l = KBD_LANG_DE, strcasecmp(value, _T("de")) == 0) - // || (l = KBD_LANG_DK, strcasecmp(value, _T("dk")) == 0) - // || (l = KBD_LANG_SE, strcasecmp(value, _T("se")) == 0) - // || (l = KBD_LANG_US, strcasecmp(value, _T("us")) == 0) - // || (l = KBD_LANG_FR, strcasecmp(value, _T("fr")) == 0) - // || (l = KBD_LANG_IT, strcasecmp(value, _T("it")) == 0) - // || (l = KBD_LANG_ES, strcasecmp(value, _T("es")) == 0)) - // p->keyboard_lang = l; - // else - // cfgfile_warning(_T("Unknown keyboard language\n")); - // return 1; - //} - - if (cfgfile_string(option, value, _T("config_version"), tmpbuf, sizeof(tmpbuf) / sizeof(TCHAR))) { - TCHAR *tmpp2; - tmpp = _tcschr(value, '.'); - if (tmpp) { - *tmpp++ = 0; - tmpp2 = tmpp; - p->config_version = _tstol(tmpbuf) << 16; - tmpp = _tcschr(tmpp, '.'); - if (tmpp) { - *tmpp++ = 0; - p->config_version |= _tstol(tmpp2) << 8; - p->config_version |= _tstol(tmpp); - } - } - return 1; - } - - if (cfgfile_string(option, value, _T("keyboard_leds"), tmpbuf, sizeof(tmpbuf) / sizeof(TCHAR))) { - TCHAR *tmpp2 = tmpbuf; - int i, num; - p->keyboard_leds[0] = p->keyboard_leds[1] = p->keyboard_leds[2] = 0; - p->keyboard_leds_in_use = 0; - _tcscat(tmpbuf, _T(",")); - for (i = 0; i < 3; i++) { - tmpp = _tcschr(tmpp2, ':'); - if (!tmpp) - break; - *tmpp++ = 0; - num = -1; - if (!strcasecmp(tmpp2, _T("numlock"))) - num = 0; - if (!strcasecmp(tmpp2, _T("capslock"))) - num = 1; - if (!strcasecmp(tmpp2, _T("scrolllock"))) - num = 2; - tmpp2 = tmpp; - tmpp = _tcschr(tmpp2, ','); - if (!tmpp) - break; - *tmpp++ = 0; - if (num >= 0) { - p->keyboard_leds[num] = match_string(kbleds, tmpp2); - if (p->keyboard_leds[num]) - p->keyboard_leds_in_use = 1; - } - tmpp2 = tmpp; - } - return 1; - } - - if (_tcscmp(option, _T("displaydata")) == 0 || _tcscmp(option, _T("displaydata_pal")) == 0 || _tcscmp(option, _T("displaydata_ntsc")) == 0) { - _tcsncpy(tmpbuf, value, sizeof tmpbuf / sizeof(TCHAR) - 1); - tmpbuf[sizeof tmpbuf / sizeof(TCHAR) - 1] = '\0'; - - int vert = -1, horiz = -1, lace = -1, ntsc = -1, framelength = -1, vsync = -1, hres = 0; - bool locked = false, rtg = false, exit = false; - bool cmdmode = false, defaultdata = false; - double rate = -1; - int rpct = 0; - TCHAR cmd[MAX_DPATH], filter[64] = { 0 }, label[16] = { 0 }; + int vert = -1, horiz = -1, lace = -1, ntsc = -1, vsync = -1, hres = 0; + bool locked = false, rtg = false; + bool defaultdata = false; + float rate = -1; + TCHAR label[16] = { 0 }; TCHAR *tmpp = tmpbuf; - TCHAR *end = tmpbuf + _tcslen(tmpbuf); - cmd[0] = 0; + TCHAR *end = tmpbuf + _tcslen (tmpbuf); for (;;) { - TCHAR *next = _tcschr(tmpp, ','); - TCHAR *equals = _tcschr(tmpp, '='); + TCHAR *next = _tcschr (tmpp, ','); + TCHAR *equals = _tcschr (tmpp, '='); if (!next) next = end; @@ -3575,68 +2374,39 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value) equals++; *next = 0; - if (cmdmode) { - if (_tcslen(cmd) + _tcslen(tmpp) + 2 < sizeof(cmd) / sizeof(TCHAR)) { - _tcscat(cmd, tmpp); - _tcscat(cmd, _T("\n")); - } - } - else { - if (!_tcsnicmp(tmpp, _T("cmd="), 4)) { - cmdmode = true; - tmpp += 4; - } - if (rate < 0) - rate = _tstof(tmpp); - else if (!_tcsnicmp(tmpp, _T("v="), 2)) - vert = _tstol(equals); - else if (!_tcsnicmp(tmpp, _T("h="), 2)) - horiz = _tstol(equals); - else if (!_tcsnicmp(tmpp, _T("t="), 2)) - _tcsncpy(label, equals, sizeof label / sizeof(TCHAR) - 1); - else if (!_tcsnicmp(tmpp, _T("filter="), 7)) - _tcsncpy(filter, equals, sizeof filter / sizeof(TCHAR) - 1); - else if (!_tcsnicmp(tmpp, _T("rpct="), 5)) - rpct = _tstol(equals); - else if (equals) { - if (_tcslen(cmd) + _tcslen(tmpp) + 2 < sizeof(cmd) / sizeof(TCHAR)) { - _tcscat(cmd, tmpp); - _tcscat(cmd, _T("\n")); - } - } - if (!_tcsnicmp(tmpp, _T("locked"), 4)) - locked = true; - if (!_tcsnicmp(tmpp, _T("nlace"), 5)) - lace = 0; - if (!_tcsnicmp(tmpp, _T("lace"), 4)) - lace = 1; - if (!_tcsnicmp(tmpp, _T("lores"), 5)) - hres |= 1 << RES_LORES; - if (!_tcsnicmp(tmpp, _T("hires"), 5)) - hres |= 1 << RES_HIRES; - if (!_tcsnicmp(tmpp, _T("shres"), 5)) - hres |= 1 << RES_SUPERHIRES; - if (!_tcsnicmp(tmpp, _T("nvsync"), 5)) - vsync = 0; - if (!_tcsnicmp(tmpp, _T("vsync"), 4)) - vsync = 1; - if (!_tcsnicmp(tmpp, _T("ntsc"), 4)) - ntsc = 1; - if (!_tcsnicmp(tmpp, _T("pal"), 3)) - ntsc = 0; - if (!_tcsnicmp(tmpp, _T("custom"), 6)) - ntsc = 2; - if (!_tcsnicmp(tmpp, _T("lof"), 3)) - framelength = 1; - if (!_tcsnicmp(tmpp, _T("shf"), 3)) - framelength = 0; - if (!_tcsnicmp(tmpp, _T("rtg"), 3)) - rtg = true; - if (!_tcsnicmp(tmpp, _T("exit"), 4)) - exit = true; - if (!_tcsnicmp(tmpp, _T("default"), 7)) - defaultdata = true; - } + if (rate < 0) + rate = _tstof(tmpp); + else if (!_tcsnicmp(tmpp, _T("v="), 2)) + vert = _tstol(equals); + else if (!_tcsnicmp(tmpp, _T("h="), 2)) + horiz = _tstol(equals); + else if (!_tcsnicmp(tmpp, _T("t="), 2)) + _tcsncpy(label, equals, sizeof label / sizeof(TCHAR) - 1); + if (!_tcsnicmp(tmpp, _T("locked"), 4)) + locked = true; + if (!_tcsnicmp(tmpp, _T("nlace"), 5)) + lace = 0; + if (!_tcsnicmp(tmpp, _T("lace"), 4)) + lace = 1; + if (!_tcsnicmp(tmpp, _T("lores"), 5)) + hres |= 1 << RES_LORES; + if (!_tcsnicmp(tmpp, _T("hires"), 5)) + hres |= 1 << RES_HIRES; + if (!_tcsnicmp(tmpp, _T("shres"), 5)) + hres |= 1 << RES_SUPERHIRES; + if (!_tcsnicmp(tmpp, _T("nvsync"), 5)) + vsync = 0; + if (!_tcsnicmp(tmpp, _T("vsync"), 4)) + vsync = 1; + if (!_tcsnicmp(tmpp, _T("ntsc"), 4)) + ntsc = 1; + if (!_tcsnicmp(tmpp, _T("pal"), 3)) + ntsc = 0; + if (!_tcsnicmp(tmpp, _T("rtg"), 3)) + rtg = true; + if (!_tcsnicmp(tmpp, _T("default"), 7)) + defaultdata = true; + tmpp = next; if (tmpp >= end) break; @@ -3644,17 +2414,16 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value) } for (int i = 0; i < MAX_CHIPSET_REFRESH; i++) { struct chipset_refresh *cr = &p->cr[i]; - if (_tcscmp(option, _T("displaydata_pal")) == 0) { + if (_tcscmp (option, _T("displaydata_pal")) == 0) { i = CHIPSET_REFRESH_PAL; - cr = &p->cr[i]; - cr->inuse = false; - _tcscpy(label, _T("PAL")); - } - else if (_tcscmp(option, _T("displaydata_ntsc")) == 0) { + cr = &p->cr[i]; + cr->rate = -1; + _tcscpy (label, _T("PAL")); + } else if (_tcscmp (option, _T("displaydata_ntsc")) == 0) { i = CHIPSET_REFRESH_NTSC; - cr = &p->cr[i]; - cr->inuse = false; - _tcscpy(label, _T("NTSC")); + cr = &p->cr[i]; + cr->rate = -1; + _tcscpy (label, _T("NTSC")); } if (!cr->inuse) { cr->inuse = true; @@ -3662,205 +2431,53 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value) cr->vert = vert; cr->lace = lace; cr->resolution = hres ? hres : 1 + 2 + 4; - cr->resolution_pct = rpct; cr->ntsc = ntsc; cr->vsync = vsync; cr->locked = locked; cr->rtg = rtg; - cr->exit = exit; - cr->framelength = framelength; cr->rate = rate; cr->defaultdata = defaultdata; - _tcscpy(cr->commands, cmd); _tcscpy(cr->label, label); - TCHAR *se = cfgfile_unescape(filter, NULL); - _tcscpy(cr->filterprofile, se); - xfree(se); break; } } return 1; } -#ifdef WITH_SLIRP - if (cfgfile_string(option, value, _T("slirp_ports"), tmpbuf, sizeof(tmpbuf) / sizeof(TCHAR))) { - TCHAR *tmpp2 = tmpbuf; - _tcscat(tmpbuf, _T(",")); - for (;;) { - tmpp = _tcschr(tmpp2, ','); - if (!tmpp) - break; - *tmpp++ = 0; - for (i = 0; i < MAX_SLIRP_REDIRS; i++) { - struct slirp_redir *sr = &p->slirp_redirs[i]; - if (sr->proto == 0) { - sr->dstport = _tstol(tmpp2); - sr->proto = 1; - break; - } - } - tmpp2 = tmpp; - } - return 1; - } - if (cfgfile_string(option, value, _T("slirp_redir"), tmpbuf, sizeof(tmpbuf) / sizeof(TCHAR))) { - TCHAR *tmpp2 = tmpbuf; - _tcscat(tmpbuf, _T(":")); - for (i = 0; i < MAX_SLIRP_REDIRS; i++) { - struct slirp_redir *sr = &p->slirp_redirs[i]; - if (sr->proto == 0) { - char *s; - tmpp = _tcschr(tmpp2, ':'); - if (!tmpp) - break; - *tmpp++ = 0; - if (!_tcsicmp(tmpp2, _T("tcp"))) - sr->proto = 1; - else if (!_tcsicmp(tmpp2, _T("udp"))) - sr->proto = 2; - else - break; - tmpp2 = tmpp; - tmpp = _tcschr(tmpp2, ':'); - if (!tmpp) { - sr->proto = 0; - break; - } - *tmpp++ = 0; - sr->dstport = _tstol(tmpp2); - tmpp2 = tmpp; - tmpp = _tcschr(tmpp2, ':'); - if (!tmpp) { - sr->proto = 0; - break; - } - *tmpp++ = 0; - sr->srcport = _tstol(tmpp2); - tmpp2 = tmpp; - tmpp = _tcschr(tmpp2, ':'); - if (!tmpp) - break; - *tmpp++ = 0; - s = ua(tmpp2); - sr->addr = inet_addr(s); - xfree(s); - } - } - return 1; - } -#endif - - return 0; -} - -static void decode_rom_ident(TCHAR *romfile, int maxlen, const TCHAR *ident, int romflags) -{ - const TCHAR *p; - int ver, rev, subver, subrev, round, i; - TCHAR model[64], *modelp; - struct romlist **rl; - TCHAR *romtxt; - - if (!ident[0]) - return; - romtxt = xmalloc(TCHAR, 10000); - romtxt[0] = 0; - for (round = 0; round < 2; round++) { - ver = rev = subver = subrev = -1; - modelp = NULL; - memset(model, 0, sizeof model); - p = ident; - while (*p) { - TCHAR c = *p++; - int *pp1 = NULL, *pp2 = NULL; - if (_totupper(c) == 'V' && _istdigit(*p)) { - pp1 = &ver; - pp2 = &rev; - } - else if (_totupper(c) == 'R' && _istdigit(*p)) { - pp1 = &subver; - pp2 = &subrev; - } - else if (!_istdigit(c) && c != ' ') { - _tcsncpy(model, p - 1, (sizeof model) / sizeof(TCHAR) - 1); - p += _tcslen(model); - modelp = model; - } - if (pp1) { - *pp1 = _tstol(p); - while (*p != 0 && *p != '.' && *p != ' ') - p++; - if (*p == '.') { - p++; - if (pp2) - *pp2 = _tstol(p); - } - } - if (*p == 0 || *p == ';') { - rl = getromlistbyident(ver, rev, subver, subrev, modelp, romflags, round > 0); - if (rl) { - for (i = 0; rl[i]; i++) { - if (round) { - TCHAR romname[MAX_DPATH]; - getromname(rl[i]->rd, romname); - _tcscat(romtxt, romname); - _tcscat(romtxt, _T("\n")); - } - else { - _tcsncpy(romfile, rl[i]->path, maxlen); - goto end; - } - } - xfree(rl); - } - } - } - } -end: - if (round && romtxt[0]) { - //notify_user_parms(NUMSG_ROMNEED, romtxt, romtxt); - } - xfree(romtxt); + return 0; } static struct uaedev_config_data *getuci(struct uae_prefs *p) { - if (p->mountitems < MOUNT_CONFIG_SIZE) - return &p->mountconfig[p->mountitems++]; - return NULL; + if (p->mountitems < MOUNT_CONFIG_SIZE) + return &p->mountconfig[p->mountitems++]; + return NULL; } -struct uaedev_config_data *add_filesys_config(struct uae_prefs *p, int index, struct uaedev_config_info *ci) +struct uaedev_config_data *add_filesys_config (struct uae_prefs *p, int index, struct uaedev_config_info *ci) { struct uaedev_config_data *uci; - int i; + int i; - if (index < 0 && (ci->type == UAEDEV_DIR || ci->type == UAEDEV_HDF) && ci->devname && _tcslen(ci->devname) > 0) { + if (index < 0 && (ci->type == UAEDEV_DIR || ci->type == UAEDEV_HDF) && ci->devname && _tcslen (ci->devname) > 0) { for (i = 0; i < p->mountitems; i++) { - if (p->mountconfig[i].ci.devname && !_tcscmp(p->mountconfig[i].ci.devname, ci->devname)) + if (p->mountconfig[i].ci.devname && !_tcscmp (p->mountconfig[i].ci.devname, ci->devname)) return NULL; } } for (;;) { - if (ci->type == UAEDEV_CD) { + if (ci->type == UAEDEV_CD) { if (ci->controller_type >= HD_CONTROLLER_TYPE_IDE_FIRST && ci->controller_type <= HD_CONTROLLER_TYPE_IDE_LAST) break; if (ci->controller_type >= HD_CONTROLLER_TYPE_SCSI_FIRST && ci->controller_type <= HD_CONTROLLER_TYPE_SCSI_LAST) break; - } - else if (ci->type == UAEDEV_TAPE) { - if (ci->controller_type == HD_CONTROLLER_TYPE_UAE) - break; - if (ci->controller_type >= HD_CONTROLLER_TYPE_SCSI_FIRST && ci->controller_type <= HD_CONTROLLER_TYPE_SCSI_LAST) - break; - } - else { + } else { break; } return NULL; } - if (index < 0) { + if (index < 0) { if (ci->controller_type != HD_CONTROLLER_TYPE_UAE) { int ctrl = ci->controller_type; int ctrlunit = ci->controller_type_unit; @@ -3887,54 +2504,53 @@ struct uaedev_config_data *add_filesys_config(struct uae_prefs *p, int index, st return NULL; } } - uci = getuci(p); - uci->configoffset = -1; + uci = getuci(p); + uci->configoffset = -1; uci->unitnum = -1; - } - else { - uci = &p->mountconfig[index]; - } - if (!uci) + } else { + uci = &p->mountconfig[index]; + } + if (!uci) return NULL; - memcpy(&uci->ci, ci, sizeof(struct uaedev_config_info)); - validatedevicename(uci->ci.devname, NULL); - validatevolumename(uci->ci.volname, NULL); - if (!uci->ci.devname[0] && ci->type != UAEDEV_CD && ci->type != UAEDEV_TAPE) { - TCHAR base[32]; - TCHAR base2[32]; - int num = 0; + memcpy (&uci->ci, ci, sizeof (struct uaedev_config_info)); + validatedevicename (uci->ci.devname, NULL); + validatevolumename (uci->ci.volname, NULL); + if (!uci->ci.devname[0] && ci->type != UAEDEV_CD) { + TCHAR base[32]; + TCHAR base2[32]; + int num = 0; if (uci->ci.rootdir[0] == 0 && ci->type == UAEDEV_DIR) - _tcscpy(base, _T("RDH")); - else - _tcscpy(base, _T("DH")); - _tcscpy(base2, base); - for (i = 0; i < p->mountitems; i++) { - _stprintf(base2, _T("%s%d"), base, num); + _tcscpy (base, _T("RDH")); + else + _tcscpy (base, _T("DH")); + _tcscpy (base2, base); + for (i = 0; i < p->mountitems; i++) { + _stprintf (base2, _T("%s%d"), base, num); if (!_tcsicmp(base2, p->mountconfig[i].ci.devname)) { - num++; - i = -1; - continue; - } - } - _tcscpy(uci->ci.devname, base2); - validatedevicename(uci->ci.devname, NULL); - } + num++; + i = -1; + continue; + } + } + _tcscpy (uci->ci.devname, base2); + validatedevicename (uci->ci.devname, NULL); + } if (ci->type == UAEDEV_DIR) { - TCHAR *s = filesys_createvolname(uci->ci.volname, uci->ci.rootdir, NULL, _T("Harddrive")); - _tcscpy(uci->ci.volname, s); - xfree(s); + TCHAR *s = filesys_createvolname (uci->ci.volname, uci->ci.rootdir, NULL, _T("Harddrive")); + _tcscpy (uci->ci.volname, s); + xfree (s); } - return uci; + return uci; } -static void parse_addmem(struct uae_prefs *p, TCHAR *buf, int num) +static void parse_addmem (struct uae_prefs *p, TCHAR *buf, int num) { int size = 0, addr = 0; - if (!getintval2(&buf, &addr, ',', false)) + if (!getintval2 (&buf, &addr, ',', false)) return; - if (!getintval2(&buf, &size, 0, true)) + if (!getintval2 (&buf, &size, 0, true)) return; if (addr & 0xffff) return; @@ -3944,18 +2560,17 @@ static void parse_addmem(struct uae_prefs *p, TCHAR *buf, int num) p->custom_memory_sizes[num] = size; } -static void get_filesys_controller(const TCHAR *hdc, int *type, int *typenum, int *num) +static void get_filesys_controller (const TCHAR *hdc, int *type, int *typenum, int *num) { int hdcv = HD_CONTROLLER_TYPE_UAE; int hdunit = 0; int idx = 0; - if (_tcslen(hdc) >= 4 && !_tcsncmp(hdc, _T("ide"), 3)) { + if(_tcslen (hdc) >= 4 && !_tcsncmp (hdc, _T("ide"), 3)) { hdcv = HD_CONTROLLER_TYPE_IDE_AUTO; hdunit = hdc[3] - '0'; if (hdunit < 0 || hdunit >= 6) hdunit = 0; - } - else if (_tcslen(hdc) >= 5 && !_tcsncmp(hdc, _T("scsi"), 4)) { + } else if(_tcslen (hdc) >= 5 && !_tcsncmp (hdc, _T("scsi"), 4)) { hdcv = HD_CONTROLLER_TYPE_SCSI_AUTO; hdunit = hdc[4] - '0'; if (hdunit < 0 || hdunit >= 8 + 2) @@ -3963,7 +2578,7 @@ static void get_filesys_controller(const TCHAR *hdc, int *type, int *typenum, in } if (hdcv > HD_CONTROLLER_TYPE_UAE) { bool found = false; - const TCHAR *ext = _tcsrchr(hdc, '_'); + const TCHAR *ext = _tcsrchr (hdc, '_'); if (ext) { ext++; int len = _tcslen(ext); @@ -3985,9 +2600,8 @@ static void get_filesys_controller(const TCHAR *hdc, int *type, int *typenum, in } } if (hdcv == HD_CONTROLLER_TYPE_IDE_AUTO) { - hdcv = i; - } - else if (hdcv == HD_CONTROLLER_TYPE_SCSI_AUTO) { + hdcv = i; + } else if (hdcv == HD_CONTROLLER_TYPE_SCSI_AUTO) { hdcv = i + HD_CONTROLLER_EXPANSION_MAX; } found = true; @@ -4001,8 +2615,7 @@ static void get_filesys_controller(const TCHAR *hdc, int *type, int *typenum, in if (_tcslen(ert->name) == len && !_tcsnicmp(ext, ert->name, len)) { if (hdcv == HD_CONTROLLER_TYPE_IDE_AUTO) { hdcv = HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST + i; - } - else { + } else { hdcv = HD_CONTROLLER_TYPE_SCSI_EXPANSION_FIRST + i; } break; @@ -4011,191 +2624,164 @@ static void get_filesys_controller(const TCHAR *hdc, int *type, int *typenum, in } } - } - else if (_tcslen(hdc) >= 6 && !_tcsncmp(hdc, _T("scsram"), 6)) { + } else if (_tcslen (hdc) >= 6 && !_tcsncmp (hdc, _T("scsram"), 6)) { hdcv = HD_CONTROLLER_TYPE_PCMCIA; hdunit = 0; idx = 0; - } - else if (_tcslen(hdc) >= 5 && !_tcsncmp(hdc, _T("scide"), 6)) { + } else if (_tcslen (hdc) >= 5 && !_tcsncmp (hdc, _T("scide"), 6)) { hdcv = HD_CONTROLLER_TYPE_PCMCIA; hdunit = 0; idx = 1; } if (idx >= MAX_DUPLICATE_EXPANSION_BOARDS) idx = MAX_DUPLICATE_EXPANSION_BOARDS - 1; + if (hdunit < 0) + hdunit = 0; *type = hdcv; *typenum = idx; *num = hdunit; } -static bool parse_geo(const TCHAR *tname, struct uaedev_config_info *uci, struct hardfiledata *hfd, bool empty) +static bool parse_geo (const TCHAR *tname, struct uaedev_config_info *uci, struct hardfiledata *hfd, bool empty) { struct zfile *f; int found; TCHAR buf[200]; - - f = zfile_fopen(tname, _T("r")); + + f = zfile_fopen (tname, _T("r")); if (!f) return false; found = hfd == NULL && !empty ? 2 : 0; if (found) - write_log(_T("Geometry file '%s' detected\n"), tname); - while (zfile_fgets(buf, sizeof buf / sizeof(TCHAR), f)) { + write_log (_T("Geometry file '%s' detected\n"), tname); + while (zfile_fgets (buf, sizeof buf / sizeof (TCHAR), f)) { int v; TCHAR *sep; - - my_trim(buf); - if (_tcslen(buf) == 0) + + my_trim (buf); + if (_tcslen (buf) == 0) continue; - if (buf[0] == '[' && buf[_tcslen(buf) - 1] == ']') { + if (buf[0] == '[' && buf[_tcslen (buf) - 1] == ']') { if (found > 1) { - zfile_fclose(f); + zfile_fclose (f); return true; } found = 0; - buf[_tcslen(buf) - 1] = 0; - my_trim(buf + 1); - if (!_tcsicmp(buf + 1, _T("empty"))) { + buf[_tcslen (buf) - 1] = 0; + my_trim (buf + 1); + if (!_tcsicmp (buf + 1, _T("empty"))) { if (empty) found = 1; - } - else if (!_tcsicmp(buf + 1, _T("default"))) { + } else if (!_tcsicmp (buf + 1, _T("default"))) { if (!empty) found = 1; - } - else if (hfd) { - uae_u64 size = _tstoi64(buf + 1); + } else if (hfd) { + uae_u64 size = _tstoi64 (buf + 1); if (size == hfd->virtsize) found = 2; } if (found) - write_log(_T("Geometry file '%s', entry '%s' detected\n"), tname, buf + 1); + write_log (_T("Geometry file '%s', entry '%s' detected\n"), tname, buf + 1); continue; } if (!found) continue; - sep = _tcschr(buf, '='); + sep = _tcschr (buf, '='); if (!sep) continue; sep[0] = 0; - TCHAR *key = my_strdup_trim(buf); - TCHAR *val = my_strdup_trim(sep + 1); - if (val[0] == '0' && _totupper(val[1]) == 'X') { + TCHAR *key = my_strdup_trim (buf); + TCHAR *val = my_strdup_trim (sep + 1); + if (val[0] == '0' && _totupper (val[1]) == 'X') { TCHAR *endptr; - v = _tcstol(val, &endptr, 16); + v = _tcstol (val, &endptr, 16); + } else { + v = _tstol (val); } - else { - v = _tstol(val); - } - if (!_tcsicmp(key, _T("surfaces"))) + if (!_tcsicmp (key, _T("surfaces"))) uci->surfaces = v; - if (!_tcsicmp(key, _T("sectorspertrack")) || !_tcsicmp(key, _T("blockspertrack"))) + if (!_tcsicmp (key, _T("sectorspertrack")) || !_tcsicmp (key, _T("blockspertrack"))) uci->sectors = v; - if (!_tcsicmp(key, _T("sectorsperblock"))) + if (!_tcsicmp (key, _T("sectorsperblock"))) uci->sectorsperblock = v; - if (!_tcsicmp(key, _T("reserved"))) + if (!_tcsicmp (key, _T("reserved"))) uci->reserved = v; - if (!_tcsicmp(key, _T("lowcyl"))) + if (!_tcsicmp (key, _T("lowcyl"))) uci->lowcyl = v; - if (!_tcsicmp(key, _T("highcyl")) || !_tcsicmp(key, _T("cyl"))) + if (!_tcsicmp (key, _T("highcyl")) || !_tcsicmp (key, _T("cyl"))) uci->highcyl = v; - if (!_tcsicmp(key, _T("blocksize")) || !_tcsicmp(key, _T("sectorsize"))) + if (!_tcsicmp (key, _T("blocksize")) || !_tcsicmp (key, _T("sectorsize"))) uci->blocksize = v; - if (!_tcsicmp(key, _T("buffers"))) + if (!_tcsicmp (key, _T("buffers"))) uci->buffers = v; - if (!_tcsicmp(key, _T("maxtransfer"))) + if (!_tcsicmp (key, _T("maxtransfer"))) uci->maxtransfer = v; - if (!_tcsicmp(key, _T("interleave"))) + if (!_tcsicmp (key, _T("interleave"))) uci->interleave = v; - if (!_tcsicmp(key, _T("dostype"))) + if (!_tcsicmp (key, _T("dostype"))) uci->dostype = v; - if (!_tcsicmp(key, _T("bufmemtype"))) + if (!_tcsicmp (key, _T("bufmemtype"))) uci->bufmemtype = v; - if (!_tcsicmp(key, _T("stacksize"))) + if (!_tcsicmp (key, _T("stacksize"))) uci->stacksize = v; - if (!_tcsicmp(key, _T("mask"))) + if (!_tcsicmp (key, _T("mask"))) uci->mask = v; - if (!_tcsicmp(key, _T("unit"))) + if (!_tcsicmp (key, _T("unit"))) uci->unit = v; - if (!_tcsicmp(key, _T("controller"))) - get_filesys_controller(val, &uci->controller_type, &uci->controller_type_unit, &uci->controller_unit); - if (!_tcsicmp(key, _T("flags"))) + if (!_tcsicmp (key, _T("controller"))) + get_filesys_controller (val, &uci->controller_type, &uci->controller_type_unit, &uci->controller_unit); + if (!_tcsicmp (key, _T("flags"))) uci->flags = v; - if (!_tcsicmp(key, _T("priority"))) + if (!_tcsicmp (key, _T("priority"))) uci->priority = v; - if (!_tcsicmp(key, _T("forceload"))) + if (!_tcsicmp (key, _T("forceload"))) uci->forceload = v; - if (!_tcsicmp(key, _T("bootpri"))) { + if (!_tcsicmp (key, _T("bootpri"))) { if (v < -129) v = -129; if (v > 127) v = 127; uci->bootpri = v; } - if (!_tcsicmp(key, _T("filesystem"))) - _tcscpy(uci->filesys, val); - if (!_tcsicmp(key, _T("device"))) - _tcscpy(uci->devname, val); - if (!_tcsicmp(key, _T("badblocks"))) { - TCHAR *p = val; - while (p && *p && uci->badblock_num < MAX_UAEDEV_BADBLOCKS) { - struct uaedev_badblock *bb = &uci->badblocks[uci->badblock_num]; - if (!_istdigit(*p)) - break; - bb->first = _tstol(p); - bb->last = bb->first; - TCHAR *p1 = _tcschr(p, ','); - TCHAR *p2 = NULL; - if (p1) { - p2 = p1 + 1; - *p1 = 0; - } - p1 = _tcschr(p, '-'); - if (p1) { - bb->last = _tstol(p1 + 1); - } - uci->badblock_num++; - p = p2; - } - } - xfree(val); - xfree(key); + if (!_tcsicmp (key, _T("filesystem"))) + _tcscpy (uci->filesys, val); + if (!_tcsicmp (key, _T("device"))) + _tcscpy (uci->devname, val); + xfree (val); + xfree (key); } - zfile_fclose(f); + zfile_fclose (f); return false; } - -bool get_hd_geometry(struct uaedev_config_info *uci) +bool get_hd_geometry (struct uaedev_config_info *uci) { TCHAR tname[MAX_DPATH]; - fetch_configurationpath(tname, sizeof tname / sizeof(TCHAR)); - _tcscat(tname, _T("default.geo")); - if (zfile_exists(tname)) { + fetch_configurationpath (tname, sizeof tname / sizeof (TCHAR)); + _tcscat (tname, _T("default.geo")); + if (zfile_exists (tname)) { struct hardfiledata hfd; - memset(&hfd, 0, sizeof hfd); + memset (&hfd, 0, sizeof hfd); hfd.ci.readonly = true; hfd.ci.blocksize = 512; - if (hdf_open(&hfd, uci->rootdir) > 0) { - parse_geo(tname, uci, &hfd, false); - hdf_close(&hfd); - } - else { - parse_geo(tname, uci, NULL, true); + if (hdf_open (&hfd, uci->rootdir) > 0) { + parse_geo (tname, uci, &hfd, false); + hdf_close (&hfd); + } else { + parse_geo (tname, uci, NULL, true); } } if (uci->rootdir[0]) { - _tcscpy(tname, uci->rootdir); - _tcscat(tname, _T(".geo")); - return parse_geo(tname, uci, NULL, false); + _tcscpy (tname, uci->rootdir); + _tcscat (tname, _T(".geo")); + return parse_geo (tname, uci, NULL, false); } return false; } -static int cfgfile_parse_partial_newfilesys(struct uae_prefs *p, int nr, int type, const TCHAR *value, int unit, bool uaehfentry) +static int cfgfile_parse_partial_newfilesys (struct uae_prefs *p, int nr, int type, const TCHAR *value, int unit, bool uaehfentry) { TCHAR *tmpp; TCHAR *name = NULL, *path = NULL; @@ -4205,123 +2791,145 @@ static int cfgfile_parse_partial_newfilesys(struct uae_prefs *p, int nr, int typ return 0; if (type != 1) return 0; - tmpp = getnextentry(&value, ','); + tmpp = getnextentry (&value, ','); if (!tmpp) return 0; - xfree(tmpp); - tmpp = getnextentry(&value, ':'); + xfree (tmpp); + tmpp = getnextentry (&value, ':'); if (!tmpp) return 0; - xfree(tmpp); - name = getnextentry(&value, ':'); - if (name && _tcslen(name) > 0) { - path = getnextentry(&value, ','); - if (path && _tcslen(path) > 0) { + xfree (tmpp); + name = getnextentry (&value, ':'); + if (name && _tcslen (name) > 0) { + path = getnextentry (&value, ','); + if (path && _tcslen (path) > 0) { for (int i = 0; i < MAX_FILESYSTEM_UNITS; i++) { struct uaedev_config_info *uci = &p->mountconfig[i].ci; - if (_tcsicmp(uci->rootdir, name) == 0) { - _tcscat(uci->rootdir, _T(":")); - _tcscat(uci->rootdir, path); + if (_tcsicmp (uci->rootdir, name) == 0) { + _tcscat (uci->rootdir, _T(":")); + _tcscat (uci->rootdir, path); } } } } - xfree(path); - xfree(name); + xfree (path); + xfree (name); return 1; } -static int cfgfile_parse_newfilesys(struct uae_prefs *p, int nr, int type, TCHAR *value, int unit, bool uaehfentry) +static int cfgfile_parse_newfilesys (struct uae_prefs *p, int nr, int type, TCHAR *value, int unit, bool uaehfentry) { struct uaedev_config_info uci; - TCHAR *tmpp = _tcschr(value, ','), *tmpp2; - TCHAR *str = NULL; + TCHAR *tmpp = _tcschr (value, ','), *tmpp2; + TCHAR *str = NULL; TCHAR devname[MAX_DPATH], volname[MAX_DPATH]; devname[0] = volname[0] = 0; - uci_set_defaults(&uci, false); + uci_set_defaults (&uci, false); - config_newfilesystem = 1; - if (tmpp == 0) - goto invalid_fs; + config_newfilesystem = 1; + if (tmpp == 0) + goto invalid_fs; - *tmpp++ = '\0'; - if (strcasecmp(value, _T("ro")) == 0) + *tmpp++ = '\0'; + if (_tcsicmp (value, _T("ro")) == 0) uci.readonly = true; - else if (strcasecmp(value, _T("rw")) == 0) + else if (_tcsicmp (value, _T("rw")) == 0) uci.readonly = false; else - goto invalid_fs; + goto invalid_fs; - value = tmpp; + value = tmpp; if (type == 0) { uci.type = UAEDEV_DIR; - tmpp = _tcschr(value, ':'); - if (tmpp == 0) - goto empty_fs; - *tmpp++ = 0; - _tcscpy(devname, value); + tmpp = _tcschr (value, ':'); + if (tmpp == 0) + goto empty_fs; + *tmpp++ = 0; + _tcscpy (devname, value); tmpp2 = tmpp; - tmpp = _tcschr(tmpp, ':'); - if (tmpp == 0) - goto empty_fs; - *tmpp++ = 0; - _tcscpy(volname, tmpp2); + tmpp = _tcschr (tmpp, ':'); + if (tmpp == 0) + goto empty_fs; + *tmpp++ = 0; + _tcscpy (volname, tmpp2); tmpp2 = tmpp; - tmpp = _tcschr(tmpp, ','); - if (tmpp == 0) - goto empty_fs; - *tmpp++ = 0; - _tcscpy(uci.rootdir, tmpp2); - _tcscpy(uci.volname, volname); - _tcscpy(uci.devname, devname); - if (!getintval(&tmpp, &uci.bootpri, 0)) - goto empty_fs; - } - else if (type == 1 || ((type == 2 || type == 3) && uaehfentry)) { - tmpp = _tcschr(value, ':'); - if (tmpp == 0) - goto invalid_fs; - *tmpp++ = '\0'; - _tcscpy(devname, value); + // quoted special case + if (tmpp2[0] == '\"') { + const TCHAR *end; + TCHAR *n = cfgfile_unescape (tmpp2, &end, 0); + if (!n) + goto invalid_fs; + _tcscpy (uci.rootdir, n); + xfree(n); + tmpp = (TCHAR*)end; + *tmpp++ = 0; + } else { + tmpp = _tcschr (tmpp, ','); + if (tmpp == 0) + goto empty_fs; + *tmpp++ = 0; + _tcscpy (uci.rootdir, tmpp2); + } + _tcscpy (uci.volname, volname); + _tcscpy (uci.devname, devname); + if (! getintval (&tmpp, &uci.bootpri, 0)) + goto empty_fs; + } else if (type == 1 || ((type == 2 || type == 3) && uaehfentry)) { + tmpp = _tcschr (value, ':'); + if (tmpp == 0) + goto invalid_fs; + *tmpp++ = '\0'; + _tcscpy (devname, value); tmpp2 = tmpp; - tmpp = _tcschr(tmpp, ','); - if (tmpp == 0) - goto invalid_fs; - *tmpp++ = 0; - _tcscpy(uci.rootdir, tmpp2); + // quoted special case + if (tmpp2[0] == '\"') { + const TCHAR *end; + TCHAR *n = cfgfile_unescape (tmpp2, &end, 0); + if (!n) + goto invalid_fs; + _tcscpy (uci.rootdir, n); + xfree(n); + tmpp = (TCHAR*)end; + *tmpp++ = 0; + } else { + tmpp = _tcschr (tmpp, ','); + if (tmpp == 0) + goto invalid_fs; + *tmpp++ = 0; + _tcscpy (uci.rootdir, tmpp2); + } if (uci.rootdir[0] != ':') - get_hd_geometry(&uci); - _tcscpy(uci.devname, devname); - if (!getintval(&tmpp, &uci.sectors, ',') - || !getintval(&tmpp, &uci.surfaces, ',') - || !getintval(&tmpp, &uci.reserved, ',') - || !getintval(&tmpp, &uci.blocksize, ',')) - goto invalid_fs; - if (getintval2(&tmpp, &uci.bootpri, ',', false)) { + get_hd_geometry (&uci); + _tcscpy (uci.devname, devname); + if (! getintval (&tmpp, &uci.sectors, ',') + || ! getintval (&tmpp, &uci.surfaces, ',') + || ! getintval (&tmpp, &uci.reserved, ',') + || ! getintval (&tmpp, &uci.blocksize, ',')) + goto invalid_fs; + if (getintval2 (&tmpp, &uci.bootpri, ',', false)) { tmpp2 = tmpp; - tmpp = _tcschr(tmpp, ','); - if (tmpp != 0) { - *tmpp++ = 0; - _tcscpy(uci.filesys, tmpp2); - TCHAR *tmpp2 = _tcschr(tmpp, ','); + tmpp = _tcschr (tmpp, ','); + if (tmpp != 0) { + *tmpp++ = 0; + _tcscpy (uci.filesys, tmpp2); + TCHAR *tmpp2 = _tcschr (tmpp, ','); if (tmpp2) *tmpp2++ = 0; - get_filesys_controller(tmpp, &uci.controller_type, &uci.controller_type_unit, &uci.controller_unit); + get_filesys_controller (tmpp, &uci.controller_type, &uci.controller_type_unit, &uci.controller_unit); if (tmpp2) { - if (getintval2(&tmpp2, &uci.highcyl, ',', false)) { - getintval(&tmpp2, &uci.pcyls, '/'); - getintval(&tmpp2, &uci.pheads, '/'); - getintval2(&tmpp2, &uci.psecs, '/', true); + if (getintval2 (&tmpp2, &uci.highcyl, ',', false)) { + getintval (&tmpp2, &uci.pcyls, '/'); + getintval (&tmpp2, &uci.pheads, '/'); + getintval2 (&tmpp2, &uci.psecs, '/', true); if (uci.pheads && uci.psecs) { uci.physical_geometry = true; - } - else { + } else { uci.pheads = uci.psecs = uci.pcyls = 0; uci.physical_geometry = false; - } - } - } + } + } + } uci.controller_media_type = 0; uci.unit_feature_level = 1; @@ -4354,214 +2962,188 @@ static int cfgfile_parse_newfilesys(struct uae_prefs *p, int nr, int type, TCHAR uci.unit_feature_level = HD_LEVEL_ATA_2; else if (cfgfile_option_find(tmpp2, _T("ATA1"))) uci.unit_feature_level = HD_LEVEL_ATA_1; - } + } } if (type == 2) { uci.device_emu_unit = unit; uci.blocksize = 2048; uci.readonly = true; uci.type = UAEDEV_CD; - } - else if (type == 3) { - uci.device_emu_unit = unit; - uci.blocksize = 512; - uci.type = UAEDEV_TAPE; - } - else { + } else { uci.type = UAEDEV_HDF; } - } - else { + } else { goto invalid_fs; } empty_fs: if (uci.rootdir[0]) { - if (_tcslen(uci.rootdir) > 3 && uci.rootdir[0] == 'H' && uci.rootdir[1] == 'D' && uci.rootdir[2] == '_') { - memmove(uci.rootdir, uci.rootdir + 2, (_tcslen(uci.rootdir + 2) + 1) * sizeof(TCHAR)); + if (_tcslen (uci.rootdir) > 3 && uci.rootdir[0] == 'H' && uci.rootdir[1] == 'D' && uci.rootdir[2] == '_') { + memmove (uci.rootdir, uci.rootdir + 2, (_tcslen (uci.rootdir + 2) + 1) * sizeof (TCHAR)); uci.rootdir[0] = ':'; } - str = cfgfile_subst_path_load(UNEXPANDED, &p->path_hardfile, uci.rootdir, false); - _tcscpy(uci.rootdir, str); + str = cfgfile_subst_path (UNEXPANDED, p->path_hardfile, uci.rootdir); + _tcscpy (uci.rootdir, str); } #ifdef FILESYS - add_filesys_config(p, nr, &uci); + add_filesys_config (p, nr, &uci); #endif - xfree(str); - return 1; + xfree (str); + return 1; invalid_fs: cfgfile_warning(_T("Invalid filesystem/hardfile/cd specification.\n")); return 1; } -static int cfgfile_parse_filesys(struct uae_prefs *p, const TCHAR *option, TCHAR *value) +static int cfgfile_parse_filesys (struct uae_prefs *p, const TCHAR *option, TCHAR *value) { int i; - for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) { - TCHAR tmp[100]; - _stprintf(tmp, _T("uaehf%d"), i); - if (_tcscmp(option, tmp) == 0) { + for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) { + TCHAR tmp[100]; + _stprintf (tmp, _T("uaehf%d"), i); + if (_tcscmp (option, tmp) == 0) { for (;;) { int type = -1; int unit = -1; - TCHAR *tmpp = _tcschr(value, ','); + TCHAR *tmpp = _tcschr (value, ','); if (tmpp == NULL) - return 1; + return 1; *tmpp++ = 0; - if (_tcsicmp(value, _T("hdf")) == 0) { + if (_tcsicmp (value, _T("hdf")) == 0) { type = 1; - cfgfile_parse_partial_newfilesys(p, -1, type, tmpp, unit, true); + cfgfile_parse_partial_newfilesys (p, -1, type, tmpp, unit, true); return 1; - } - else if (_tcsnicmp(value, _T("cd"), 2) == 0 && (value[2] == 0 || value[3] == 0)) { + } else if (_tcsnicmp (value, _T("cd"), 2) == 0 && (value[2] == 0 || value[3] == 0)) { unit = 0; if (value[2] > 0) unit = value[2] - '0'; if (unit >= 0 && unit <= MAX_TOTAL_SCSI_DEVICES) { type = 2; } - } - else if (_tcsnicmp(value, _T("tape"), 4) == 0 && (value[4] == 0 || value[5] == 0)) { - unit = 0; - if (value[4] > 0) - unit = value[4] - '0'; - if (unit >= 0 && unit <= MAX_TOTAL_SCSI_DEVICES) { - type = 3; - } - } - else if (_tcsicmp(value, _T("dir")) != 0) { + } else if (_tcsicmp (value, _T("dir")) != 0) { type = 0; return 1; /* ignore for now */ } if (type >= 0) - cfgfile_parse_newfilesys(p, -1, type, tmpp, unit, true); + cfgfile_parse_newfilesys (p, -1, type, tmpp, unit, true); return 1; } return 1; - } - else if (!_tcsncmp(option, tmp, _tcslen(tmp)) && option[_tcslen(tmp)] == '_') { + } else if (!_tcsncmp (option, tmp, _tcslen (tmp)) && option[_tcslen (tmp)] == '_') { struct uaedev_config_info *uci = &currprefs.mountconfig[i].ci; if (uci->devname) { - const TCHAR *s = &option[_tcslen(tmp) + 1]; - if (!_tcscmp(s, _T("bootpri"))) { - getintval(&value, &uci->bootpri, 0); - } - else if (!_tcscmp(s, _T("read-only"))) { - cfgfile_yesno(NULL, value, NULL, &uci->readonly); - } - else if (!_tcscmp(s, _T("volumename"))) { - _tcscpy(uci->volname, value); - } - else if (!_tcscmp(s, _T("devicename"))) { - _tcscpy(uci->devname, value); - } - else if (!_tcscmp(s, _T("root"))) { - _tcscpy(uci->rootdir, value); - } - else if (!_tcscmp(s, _T("filesys"))) { - _tcscpy(uci->filesys, value); - } - else if (!_tcscmp(s, _T("controller"))) { - get_filesys_controller(value, &uci->controller_type, &uci->controller_type_unit, &uci->controller_unit); + const TCHAR *s = &option[_tcslen (tmp) + 1]; + if (!_tcscmp (s, _T("bootpri"))) { + getintval (&value, &uci->bootpri, 0); + } else if (!_tcscmp (s, _T("read-only"))) { + cfgfile_yesno (NULL, value, NULL, &uci->readonly); + } else if (!_tcscmp (s, _T("volumename"))) { + _tcscpy (uci->volname, value); + } else if (!_tcscmp (s, _T("devicename"))) { + _tcscpy (uci->devname, value); + } else if (!_tcscmp (s, _T("root"))) { + _tcscpy (uci->rootdir, value); + } else if (!_tcscmp (s, _T("filesys"))) { + _tcscpy (uci->filesys, value); + } else if (!_tcscmp (s, _T("controller"))) { + get_filesys_controller (value, &uci->controller_type, &uci->controller_type_unit, &uci->controller_unit); } } } - } + } - if (_tcscmp(option, _T("filesystem")) == 0 - || _tcscmp(option, _T("hardfile")) == 0) - { + if (_tcscmp (option, _T("filesystem")) == 0 + || _tcscmp (option, _T("hardfile")) == 0) + { struct uaedev_config_info uci; - TCHAR *tmpp = _tcschr(value, ','); - TCHAR *str; + TCHAR *tmpp = _tcschr (value, ','); + TCHAR *str; bool hdf; - uci_set_defaults(&uci, false); + uci_set_defaults (&uci, false); - if (config_newfilesystem) - return 1; + if (config_newfilesystem) + return 1; - if (tmpp == 0) - goto invalid_fs; + if (tmpp == 0) + goto invalid_fs; - *tmpp++ = '\0'; - if (_tcscmp(value, _T("1")) == 0 || strcasecmp(value, _T("ro")) == 0 - || strcasecmp(value, _T("readonly")) == 0 - || strcasecmp(value, _T("read-only")) == 0) + *tmpp++ = '\0'; + if (_tcscmp (value, _T("1")) == 0 || _tcsicmp (value, _T("ro")) == 0 + || _tcsicmp (value, _T("readonly")) == 0 + || _tcsicmp (value, _T("read-only")) == 0) uci.readonly = true; - else if (_tcscmp(value, _T("0")) == 0 || strcasecmp(value, _T("rw")) == 0 - || strcasecmp(value, _T("readwrite")) == 0 - || strcasecmp(value, _T("read-write")) == 0) + else if (_tcscmp (value, _T("0")) == 0 || _tcsicmp (value, _T("rw")) == 0 + || _tcsicmp (value, _T("readwrite")) == 0 + || _tcsicmp (value, _T("read-write")) == 0) uci.readonly = false; - else - goto invalid_fs; + else + goto invalid_fs; - value = tmpp; - if (_tcscmp(option, _T("filesystem")) == 0) { + value = tmpp; + if (_tcscmp (option, _T("filesystem")) == 0) { hdf = false; - tmpp = _tcschr(value, ':'); - if (tmpp == 0) - goto invalid_fs; - *tmpp++ = '\0'; - _tcscpy(uci.volname, value); - _tcscpy(uci.rootdir, tmpp); - } - else { + tmpp = _tcschr (value, ':'); + if (tmpp == 0) + goto invalid_fs; + *tmpp++ = '\0'; + _tcscpy (uci.volname, value); + _tcscpy (uci.rootdir, tmpp); + } else { hdf = true; - if (!getintval(&value, &uci.sectors, ',') - || !getintval(&value, &uci.surfaces, ',') - || !getintval(&value, &uci.reserved, ',') - || !getintval(&value, &uci.blocksize, ',')) - goto invalid_fs; - _tcscpy(uci.rootdir, value); - } - str = cfgfile_subst_path_load(UNEXPANDED, &p->path_hardfile, uci.rootdir, true); + if (! getintval (&value, &uci.sectors, ',') + || ! getintval (&value, &uci.surfaces, ',') + || ! getintval (&value, &uci.reserved, ',') + || ! getintval (&value, &uci.blocksize, ',')) + goto invalid_fs; + _tcscpy (uci.rootdir, value); + } + str = cfgfile_subst_path (UNEXPANDED, p->path_hardfile, uci.rootdir); #ifdef FILESYS uci.type = hdf ? UAEDEV_HDF : UAEDEV_DIR; - add_filesys_config(p, -1, &uci); + add_filesys_config (p, -1, &uci); #endif - xfree(str); - return 1; - invalid_fs: + xfree (str); + return 1; +invalid_fs: cfgfile_warning(_T("Invalid filesystem/hardfile specification.\n")); - return 1; + return 1; } - if (_tcscmp(option, _T("filesystem2")) == 0) - return cfgfile_parse_newfilesys(p, -1, 0, value, -1, false); - if (_tcscmp(option, _T("hardfile2")) == 0) - return cfgfile_parse_newfilesys(p, -1, 1, value, -1, false); - if (_tcscmp(option, _T("filesystem_extra")) == 0) { + if (_tcscmp (option, _T("filesystem2")) == 0) + return cfgfile_parse_newfilesys (p, -1, 0, value, -1, false); + if (_tcscmp (option, _T("hardfile2")) == 0) + return cfgfile_parse_newfilesys (p, -1, 1, value, -1, false); + if (_tcscmp (option, _T("filesystem_extra")) == 0) { int idx = 0; TCHAR *s = value; _tcscat(s, _T(",")); struct uaedev_config_info *ci = NULL; for (;;) { - TCHAR *tmpp = _tcschr(s, ','); + TCHAR *tmpp = _tcschr (s, ','); if (tmpp == NULL) return 1; *tmpp++ = 0; if (idx == 0) { for (i = 0; i < p->mountitems; i++) { - if (p->mountconfig[i].ci.devname && !_tcscmp(p->mountconfig[i].ci.devname, s)) { + if (p->mountconfig[i].ci.devname && !_tcscmp (p->mountconfig[i].ci.devname, s)) { ci = &p->mountconfig[i].ci; break; } } if (!ci || ci->type != UAEDEV_DIR) return 1; - } - else { + } else { bool b = true; TCHAR *tmpp2 = _tcschr(s, '='); if (tmpp2) { *tmpp2++ = 0; - if (!strcasecmp(tmpp2, _T("false"))) + if (!_tcsicmp(tmpp2, _T("false"))) b = false; } - if (!strcasecmp(s, _T("inject_icons"))) { + if (!_tcsicmp(s, _T("inject_icons"))) { ci->inject_icons = b; } } @@ -4573,7 +3155,7 @@ static int cfgfile_parse_filesys(struct uae_prefs *p, const TCHAR *option, TCHAR return 0; } -static bool cfgfile_read_board_rom(struct uae_prefs *p, const TCHAR *option, const TCHAR *value, struct multipath *mp) +static bool cfgfile_read_board_rom(struct uae_prefs *p, const TCHAR *option, const TCHAR *value) { TCHAR buf[256], buf2[MAX_DPATH], buf3[MAX_DPATH]; bool dummy; @@ -4581,7 +3163,7 @@ static bool cfgfile_read_board_rom(struct uae_prefs *p, const TCHAR *option, con const struct expansionromtype *ert; for (int i = 0; expansionroms[i].name; i++) { - struct boardromconfig *brc; + struct boardromconfig *brc; int idx; ert = &expansionroms[i]; @@ -4599,12 +3181,8 @@ static bool cfgfile_read_board_rom(struct uae_prefs *p, const TCHAR *option, con } _stprintf(buf, _T("%s_rom_file"), name); - if (cfgfile_path(option, value, buf, buf2, MAX_DPATH / sizeof(TCHAR), mp)) { + if (cfgfile_path(option, value, buf, buf2, MAX_DPATH / sizeof (TCHAR))) { if (buf2[0]) { - if (ert->deviceflags & EXPANSIONTYPE_NET) { - // make sure network settings are available before parsing net "rom" entries - //ethernet_updateselection(); - } brc = get_device_rom_new(p, ert->romtype, j, &idx); _tcscpy(brc->roms[idx].romfile, buf2); } @@ -4613,7 +3191,7 @@ static bool cfgfile_read_board_rom(struct uae_prefs *p, const TCHAR *option, con _stprintf(buf, _T("%s_rom_file_id"), name); buf2[0] = 0; - if (cfgfile_rom(option, value, buf, buf2, MAX_DPATH / sizeof(TCHAR))) { + if (cfgfile_rom (option, value, buf, buf2, MAX_DPATH / sizeof (TCHAR))) { if (buf2[0]) { brc = get_device_rom_new(p, ert->romtype, j, &idx); _tcscpy(brc->roms[idx].romfile, buf2); @@ -4621,20 +3199,8 @@ static bool cfgfile_read_board_rom(struct uae_prefs *p, const TCHAR *option, con return true; } - _stprintf(buf, _T("%s_rom"), name); - if (cfgfile_string(option, value, buf, buf2, sizeof buf2 / sizeof(TCHAR))) { - if (buf2[0]) { - decode_rom_ident(buf3, sizeof(buf3) / sizeof(TCHAR), buf2, ert->romtype); - if (buf3[0]) { - brc = get_device_rom_new(p, ert->romtype, j, &idx); - _tcscpy(brc->roms[idx].romident, buf3); - } - } - return true; - } - _stprintf(buf, _T("%s_rom_options"), name); - if (cfgfile_string(option, value, buf, buf2, sizeof buf2 / sizeof(TCHAR))) { + if (cfgfile_string (option, value, buf, buf2, sizeof buf2 / sizeof (TCHAR))) { brc = get_device_rom(p, ert->romtype, j, &idx); if (brc) { TCHAR *p; @@ -4648,34 +3214,13 @@ static bool cfgfile_read_board_rom(struct uae_prefs *p, const TCHAR *option, con if (ert->settings) { brc->roms[idx].device_settings = cfgfile_read_rom_settings(ert->settings, buf2, brc->roms[idx].configtext); } - if (ert->id_jumper) { - p = cfgfile_option_get(buf2, _T("id")); - if (p) { - brc->roms[idx].device_id = _tstol(p); - } - } - if (ert->subtypes) { - const struct expansionsubromtype *srt = ert->subtypes; - TCHAR tmp[MAX_DPATH]; - p = tmp; - *p = 0; - while (srt->name) { - _tcscpy(p, srt->configname); - p += _tcslen(p) + 1; - p[0] = 0; - srt++; - } - int v = cfgfile_option_select(buf2, _T("subtype"), tmp); - if (v >= 0) - brc->roms[idx].subtype = v; - } } return true; } } _stprintf(buf, _T("%s_mem_size"), ert->name); - if (cfgfile_intval(option, value, buf, &val, 0x40000)) { + if (cfgfile_intval (option, value, buf, &val, 0x40000)) { if (val) { brc = get_device_rom_new(p, ert->romtype, 0, &idx); brc->roms[idx].board_ram_size = val; @@ -4690,8 +3235,7 @@ static void addbcromtype(struct uae_prefs *p, int romtype, bool add, const TCHAR { if (!add) { clear_device_rom(p, romtype, devnum, true); - } - else { + } else { struct boardromconfig *brc = get_device_rom_new(p, romtype, devnum, NULL); if (brc && !brc->roms[0].romfile[0]) { _tcscpy(brc->roms[0].romfile, romfile ? romfile : _T(":ENABLED")); @@ -4699,220 +3243,66 @@ static void addbcromtype(struct uae_prefs *p, int romtype, bool add, const TCHAR } } -static void addbcromtypenet(struct uae_prefs *p, int romtype, const TCHAR *netname, int devnum) +static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCHAR *value) { - int is = is_device_rom(p, romtype, devnum); - if (netname == NULL || netname[0] == 0) { - if (is < 0) - clear_device_rom(p, romtype, devnum, true); - } - else { - if (is < 0) { - struct boardromconfig *brc = get_device_rom_new(p, romtype, devnum, NULL); - if (brc) { - if (!brc->roms[0].romfile[0]) { - _tcscpy(brc->roms[0].romfile, _T(":ENABLED")); - } - //ethernet_updateselection(); - //if (!brc->roms[0].device_settings) - // brc->roms[0].device_settings = ethernet_getselection(netname); - } - } - } -} + int tmpval, dummyint, i; + TCHAR tmpbuf[CONFIG_BLEN]; -static int cfgfile_parse_hardware(struct uae_prefs *p, const TCHAR *option, TCHAR *value) -{ - int tmpval, dummyint, i; - bool dummybool; - TCHAR tmpbuf[CONFIG_BLEN]; - - if (cfgfile_yesno(option, value, _T("cpu_cycle_exact"), &p->cpu_cycle_exact)) { - /* we don't want cycle-exact in 68020/40+JIT modes */ - if (p->cpu_model >= 68020 && p->cachesize > 0) - p->cpu_cycle_exact = p->cpu_memory_cycle_exact = p->blitter_cycle_exact = false; - p->cpu_memory_cycle_exact = p->cpu_cycle_exact; - return 1; - } - if (cfgfile_yesno(option, value, _T("blitter_cycle_exact"), &p->blitter_cycle_exact)) { - if (p->cpu_model >= 68020 && p->cachesize > 0) - p->cpu_cycle_exact = p->cpu_memory_cycle_exact = p->blitter_cycle_exact = false; - return 1; - } - if (cfgfile_yesno(option, value, _T("cpu_memory_cycle_exact"), &p->cpu_memory_cycle_exact)) { - if (!p->cpu_memory_cycle_exact) - p->blitter_cycle_exact = p->cpu_cycle_exact = false; - return 1; - } - if (cfgfile_strval(option, value, _T("cycle_exact"), &tmpval, cycleexact, 0)) { - if (tmpval > 0) { - p->blitter_cycle_exact = true; - p->cpu_cycle_exact = tmpval > 1; - p->cpu_memory_cycle_exact = true; - } - else { - p->blitter_cycle_exact = false; - p->cpu_cycle_exact = false; - p->cpu_memory_cycle_exact = false; - } - if (p->cpu_model >= 68020 && p->cachesize > 0) - p->cpu_cycle_exact = p->cpu_memory_cycle_exact = p->blitter_cycle_exact = false; - // if old version and CE and fastest possible: set to approximate - if (p->cpu_cycle_exact && p->config_version < ((2 << 16) | (8 << 8) | (2 << 0)) && p->m68k_speed < 0) - p->m68k_speed = 0; - return 1; - } - - if (cfgfile_string(option, value, _T("cpu_multiplier"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) { - p->cpu_clock_multiplier = (int)(_tstof(tmpbuf) * 256.0); - return 1; - } - - - if (cfgfile_string(option, value, _T("a2065"), p->a2065name, sizeof p->a2065name / sizeof(TCHAR))) { - if (p->a2065name[0]) - addbcromtype(p, ROMTYPE_A2065, true, NULL, 0); - return 1; - } - - if (cfgfile_string(option, value, _T("ne2000_pci"), p->ne2000pciname, sizeof p->ne2000pciname / sizeof(TCHAR))) - return 1; - if (cfgfile_string(option, value, _T("ne2000_pcmcia"), p->ne2000pcmcianame, sizeof p->ne2000pcmcianame / sizeof(TCHAR))) - return 1; - - if (cfgfile_yesno(option, value, _T("immediate_blits"), &p->immediate_blits) - || cfgfile_yesno(option, value, _T("fpu_no_unimplemented"), &p->fpu_no_unimplemented) - || cfgfile_yesno(option, value, _T("cpu_no_unimplemented"), &p->int_no_unimplemented) - || cfgfile_yesno(option, value, _T("cd32cd"), &p->cs_cd32cd) - || cfgfile_yesno(option, value, _T("cd32c2p"), &p->cs_cd32c2p) - || cfgfile_yesno(option, value, _T("cd32nvram"), &p->cs_cd32nvram) - || cfgfile_yesno(option, value, _T("cdtvcd"), &p->cs_cdtvcd) - || cfgfile_yesno(option, value, _T("cdtv-cr"), &p->cs_cdtvcr) - || cfgfile_yesno(option, value, _T("cdtvram"), &p->cs_cdtvram) - || cfgfile_yesno(option, value, _T("a1000ram"), &p->cs_a1000ram) - || cfgfile_yesno(option, value, _T("scsi_cdtv"), &p->cs_cdtvscsi) + if (cfgfile_yesno (option, value, _T("immediate_blits"), &p->immediate_blits) + || cfgfile_yesno (option, value, _T("fast_copper"), &p->fast_copper) + || cfgfile_yesno(option, value, _T("fpu_no_unimplemented"), &p->fpu_no_unimplemented) + || cfgfile_yesno (option, value, _T("cd32cd"), &p->cs_cd32cd) + || cfgfile_yesno (option, value, _T("cd32c2p"), &p->cs_cd32c2p) + || cfgfile_yesno (option, value, _T("cd32nvram"), &p->cs_cd32nvram) || cfgfile_yesno(option, value, _T("cia_overlay"), &p->cs_ciaoverlay) - || cfgfile_yesno(option, value, _T("bogomem_fast"), &p->cs_slowmemisfast) || cfgfile_yesno(option, value, _T("ksmirror_e0"), &p->cs_ksmirror_e0) || cfgfile_yesno(option, value, _T("ksmirror_a8"), &p->cs_ksmirror_a8) - || cfgfile_yesno(option, value, _T("resetwarning"), &p->cs_resetwarning) || cfgfile_yesno(option, value, _T("cia_todbug"), &p->cs_ciatodbug) - || cfgfile_yesno(option, value, _T("denise_noehb"), &p->cs_denisenoehb) - || cfgfile_yesno(option, value, _T("ics_agnus"), &p->cs_dipagnus) || cfgfile_yesno(option, value, _T("z3_autoconfig"), &p->cs_z3autoconfig) - || cfgfile_yesno(option, value, _T("color_burst"), &p->cs_color_burst) - || cfgfile_yesno(option, value, _T("1mchipjumper"), &p->cs_1mchipjumper) - || cfgfile_yesno(option, value, _T("agnus_bltbusybug"), &p->cs_agnusbltbusybug) - || cfgfile_yesno(option, value, _T("gfxcard_hardware_vblank"), &p->rtg_hardwareinterrupt) - || cfgfile_yesno(option, value, _T("gfxcard_hardware_sprite"), &p->rtg_hardwaresprite) - || cfgfile_yesno(option, value, _T("synchronize_clock"), &p->tod_hack) - || cfgfile_yesno(option, value, _T("keyboard_connected"), &p->keyboard_connected) + || cfgfile_yesno (option, value, _T("ntsc"), &p->ntscmode) + || cfgfile_yesno (option, value, _T("cpu_compatible"), &p->cpu_compatible) + || cfgfile_yesno (option, value, _T("cpu_24bit_addressing"), &p->address_space_24) + || cfgfile_yesno (option, value, _T("fpu_strict"), &p->fpu_strict) + || cfgfile_yesno (option, value, _T("fpu_softfloat"), &p->fpu_softfloat) + || cfgfile_yesno (option, value, _T("floppy_write_protect"), &p->floppy_read_only) + || cfgfile_yesno(option, value, _T("harddrive_write_protect"), &p->harddrive_read_only)) + return 1; - || cfgfile_yesno(option, value, _T("kickshifter"), &p->kickshifter) - || cfgfile_yesno(option, value, _T("ks_write_enabled"), &p->rom_readwrite) - || cfgfile_yesno(option, value, _T("ntsc"), &p->ntscmode) - || cfgfile_yesno(option, value, _T("sana2"), &p->sana2) - || cfgfile_yesno(option, value, _T("genlock"), &p->genlock) - || cfgfile_yesno(option, value, _T("genlock_alpha"), &p->genlock_alpha) - || cfgfile_yesno(option, value, _T("genlock_aspect"), &p->genlock_aspect) - || cfgfile_yesno(option, value, _T("cpu_compatible"), &p->cpu_compatible) - || cfgfile_yesno(option, value, _T("cpu_threaded"), &p->cpu_thread) - || cfgfile_yesno(option, value, _T("cpu_24bit_addressing"), &p->address_space_24) - || cfgfile_yesno(option, value, _T("cpu_reset_pause"), &p->reset_delay) - || cfgfile_yesno(option, value, _T("parallel_on_demand"), &p->parallel_demand) - || cfgfile_yesno(option, value, _T("parallel_postscript_emulation"), &p->parallel_postscript_emulation) - || cfgfile_yesno(option, value, _T("parallel_postscript_detection"), &p->parallel_postscript_detection) - || cfgfile_yesno(option, value, _T("serial_on_demand"), &p->serial_demand) - || cfgfile_yesno(option, value, _T("serial_hardware_ctsrts"), &p->serial_hwctsrts) - || cfgfile_yesno(option, value, _T("serial_direct"), &p->serial_direct) - || cfgfile_yesno(option, value, _T("fpu_strict"), &p->fpu_strict) - || cfgfile_yesno(option, value, _T("fpu_softfloat"), &p->fpu_softfloat) - || cfgfile_yesno(option, value, _T("comp_nf"), &p->compnf) - || cfgfile_yesno(option, value, _T("comp_constjump"), &p->comp_constjump) -#ifdef USE_JIT_FPU - || cfgfile_yesno(option, value, _T("compfpu"), &p->compfpu) -#endif - || cfgfile_yesno(option, value, _T("rtg_nocustom"), &p->picasso96_nocustom) - || cfgfile_yesno(option, value, _T("floppy_write_protect"), &p->floppy_read_only) - || cfgfile_yesno(option, value, _T("harddrive_write_protect"), &p->harddrive_read_only) - || cfgfile_yesno(option, value, _T("uae_hide_autoconfig"), &p->uae_hide_autoconfig) - || cfgfile_yesno(option, value, _T("board_custom_order"), &p->autoconfig_custom_sort) - || cfgfile_yesno(option, value, _T("uaeserial"), &p->uaeserial)) - return 1; + if (cfgfile_intval (option, value, _T("cachesize"), &p->cachesize, 1) + || cfgfile_intval (option, value, _T("cd32nvram_size"), &p->cs_cd32nvram_size, 1024) + || cfgfile_intval (option, value, _T("fatgary"), &p->cs_fatgaryrev, 1) + || cfgfile_intval (option, value, _T("ramsey"), &p->cs_ramseyrev, 1) + || cfgfile_floatval (option, value, _T("chipset_refreshrate"), &p->chipset_refreshrate) + || cfgfile_intval (option, value, _T("a3000mem_size"), &p->mbresmem_low_size, 0x100000) + || cfgfile_intval (option, value, _T("mbresmem_size"), &p->mbresmem_high_size, 0x100000) + || cfgfile_intval (option, value, _T("z3mem_start"), &p->z3autoconfig_start, 1) + || cfgfile_intval (option, value, _T("bogomem_size"), &p->bogomem_size, 0x40000) + || cfgfile_intval (option, value, _T("rtg_modes"), &p->picasso96_modeflags, 1) + || cfgfile_intval (option, value, _T("floppy_speed"), &p->floppy_speed, 1) + || cfgfile_intval (option, value, _T("cd_speed"), &p->cd_speed, 1) + || cfgfile_intval (option, value, _T("floppy_write_length"), &p->floppy_write_length, 1) + || cfgfile_intval (option, value, _T("nr_floppies"), &p->nr_floppies, 1) + || cfgfile_intval (option, value, _T("floppy0type"), &p->floppyslots[0].dfxtype, 1) + || cfgfile_intval (option, value, _T("floppy1type"), &p->floppyslots[1].dfxtype, 1) + || cfgfile_intval (option, value, _T("floppy2type"), &p->floppyslots[2].dfxtype, 1) + || cfgfile_intval (option, value, _T("floppy3type"), &p->floppyslots[3].dfxtype, 1)) + return 1; - if (cfgfile_intval(option, value, _T("cachesize"), &p->cachesize, 1) - || cfgfile_intval(option, value, _T("cd32nvram_size"), &p->cs_cd32nvram_size, 1024) - || cfgfile_intval(option, value, _T("chipset_hacks"), &p->cs_hacks, 1) - || cfgfile_intval(option, value, _T("serial_stopbits"), &p->serial_stopbits, 1) - || cfgfile_intval(option, value, _T("cpu060_revision"), &p->cpu060_revision, 1) - || cfgfile_intval(option, value, _T("fpu_revision"), &p->fpu_revision, 1) - || cfgfile_intval(option, value, _T("cdtvramcard"), &p->cs_cdtvcard, 1) - || cfgfile_intval(option, value, _T("fatgary"), &p->cs_fatgaryrev, 1) - || cfgfile_intval(option, value, _T("ramsey"), &p->cs_ramseyrev, 1) - || cfgfile_doubleval(option, value, _T("chipset_refreshrate"), &p->chipset_refreshrate) - || cfgfile_intval(option, value, _T("cpuboardmem1_size"), &p->cpuboardmem1_size, 0x100000) - || cfgfile_intval(option, value, _T("cpuboardmem2_size"), &p->cpuboardmem2_size, 0x100000) - || cfgfile_intval(option, value, _T("mem25bit_size"), &p->mem25bit_size, 0x100000) - || cfgfile_intval(option, value, _T("a3000mem_size"), &p->mbresmem_low_size, 0x100000) - || cfgfile_intval(option, value, _T("mbresmem_size"), &p->mbresmem_high_size, 0x100000) - || cfgfile_intval(option, value, _T("megachipmem_size"), &p->z3chipmem_size, 0x100000) - || cfgfile_intval(option, value, _T("z3mem_start"), &p->z3autoconfig_start, 1) - || cfgfile_intval(option, value, _T("bogomem_size"), &p->bogomem_size, 0x40000) - || cfgfile_intval(option, value, _T("rtg_modes"), &p->picasso96_modeflags, 1) - || cfgfile_intval(option, value, _T("floppy_speed"), &p->floppy_speed, 1) - || cfgfile_intval(option, value, _T("cd_speed"), &p->cd_speed, 1) - || cfgfile_intval(option, value, _T("floppy_write_length"), &p->floppy_write_length, 1) - || cfgfile_intval(option, value, _T("floppy_random_bits_min"), &p->floppy_random_bits_min, 1) - || cfgfile_intval(option, value, _T("floppy_random_bits_max"), &p->floppy_random_bits_max, 1) - || cfgfile_intval(option, value, _T("nr_floppies"), &p->nr_floppies, 1) - || cfgfile_intval(option, value, _T("floppy0type"), &p->floppyslots[0].dfxtype, 1) - || cfgfile_intval(option, value, _T("floppy1type"), &p->floppyslots[1].dfxtype, 1) - || cfgfile_intval(option, value, _T("floppy2type"), &p->floppyslots[2].dfxtype, 1) - || cfgfile_intval(option, value, _T("floppy3type"), &p->floppyslots[3].dfxtype, 1) - || cfgfile_intval(option, value, _T("maprom"), &p->maprom, 1) - || cfgfile_intval(option, value, _T("parallel_autoflush"), &p->parallel_autoflush_time, 1) - || cfgfile_intval(option, value, _T("uae_hide"), &p->uae_hide, 1) - || cfgfile_intval(option, value, _T("cpu_frequency"), &p->cpu_frequency, 1) - || cfgfile_intval(option, value, _T("kickstart_ext_rom_file2addr"), &p->romextfile2addr, 1) - || cfgfile_intval(option, value, _T("genlock_scale"), &p->genlock_scale, 1) - || cfgfile_intval(option, value, _T("genlock_mix"), &p->genlock_mix, 1)) - return 1; - - if (cfgfile_strval(option, value, _T("comp_trustbyte"), &p->comptrustbyte, compmode, 0) - || cfgfile_strval(option, value, _T("rtc"), &p->cs_rtc, rtctype, 0) - || cfgfile_strval(option, value, _T("ciaatod"), &p->cs_ciaatod, ciaatodmode, 0) - || cfgfile_strval(option, value, _T("scsi"), &p->scsi, scsimode, 0) - || cfgfile_strval(option, value, _T("comp_trustword"), &p->comptrustword, compmode, 0) - || cfgfile_strval(option, value, _T("comp_trustlong"), &p->comptrustlong, compmode, 0) - || cfgfile_strval(option, value, _T("comp_trustnaddr"), &p->comptrustnaddr, compmode, 0) - || cfgfile_strval(option, value, _T("collision_level"), &p->collision_level, collmode, 0) - || cfgfile_strval(option, value, _T("parallel_matrix_emulation"), &p->parallel_matrix_emulation, epsonprinter, 0) - || cfgfile_strval(option, value, _T("monitoremu"), &p->monitoremu, specialmonitors, 0) - || cfgfile_strval(option, value, _T("genlockmode"), &p->genlock_image, genlockmodes, 0) - || cfgfile_strval(option, value, _T("waiting_blits"), &p->waiting_blits, waitblits, 0) - || cfgfile_strval(option, value, _T("floppy_auto_extended_adf"), &p->floppy_auto_ext2, autoext2, 0) - || cfgfile_strval(option, value, _T("z3mapping"), &p->z3_mapping_mode, z3mapping, 0) - || cfgfile_strval(option, value, _T("scsidev_mode"), &p->uaescsidevmode, uaescsidevmodes, 0) + if (cfgfile_strval (option, value, _T("rtc"), &p->cs_rtc, rtctype, 0) + || cfgfile_strval (option, value, _T("ciaatod"), &p->cs_ciaatod, ciaatodmode, 0) + || cfgfile_strval (option, value, _T("collision_level"), &p->collision_level, collmode, 0) + || cfgfile_strval (option, value, _T("waiting_blits"), &p->waiting_blits, waitblits, 0) + || cfgfile_strval (option, value, _T("floppy_auto_extended_adf"), &p->floppy_auto_ext2, autoext2, 0) + || cfgfile_strval (option, value, _T("z3mapping"), &p->z3_mapping_mode, z3mapping, 0) || cfgfile_strval(option, value, _T("boot_rom_uae"), &p->boot_rom, uaebootrom, 0) - || cfgfile_strval(option, value, _T("uaeboard"), &p->uaeboard, uaeboard, 0) - || cfgfile_strval(option, value, _T("serial_translate"), &p->serial_crlf, serialcrlf, 0) - || cfgfile_strboolval(option, value, _T("comp_flushmode"), &p->comp_hardflush, flushmode, 0)) - return 1; + || cfgfile_strval(option, value, _T("uaeboard"), &p->uaeboard, uaeboard, 0)) + return 1; - if (cfgfile_path(option, value, _T("kickstart_rom_file"), p->romfile, sizeof p->romfile / sizeof(TCHAR), &p->path_rom) - || cfgfile_path(option, value, _T("kickstart_ext_rom_file"), p->romextfile, sizeof p->romextfile / sizeof(TCHAR), &p->path_rom) - || cfgfile_path(option, value, _T("kickstart_ext_rom_file2"), p->romextfile2, sizeof p->romextfile2 / sizeof(TCHAR), &p->path_rom) - || cfgfile_rom(option, value, _T("kickstart_rom_file_id"), p->romfile, sizeof p->romfile / sizeof(TCHAR)) - || cfgfile_rom(option, value, _T("kickstart_ext_rom_file_id"), p->romextfile, sizeof p->romextfile / sizeof(TCHAR)) - || cfgfile_path(option, value, _T("flash_file"), p->flashfile, sizeof p->flashfile / sizeof(TCHAR), &p->path_rom) - || cfgfile_path(option, value, _T("cart_file"), p->cartfile, sizeof p->cartfile / sizeof(TCHAR), &p->path_rom) - || cfgfile_path(option, value, _T("rtc_file"), p->rtcfile, sizeof p->rtcfile / sizeof(TCHAR), &p->path_rom) - || cfgfile_path(option, value, _T("picassoiv_rom_file"), p->picassoivromfile, sizeof p->picassoivromfile / sizeof(TCHAR), &p->path_rom) - || cfgfile_string(option, value, _T("genlock_image"), p->genlock_image_file, sizeof p->genlock_image_file / sizeof(TCHAR)) - || cfgfile_string(option, value, _T("genlock_video"), p->genlock_video_file, sizeof p->genlock_video_file / sizeof(TCHAR)) - || cfgfile_string(option, value, _T("pci_devices"), p->pci_devices, sizeof p->pci_devices / sizeof(TCHAR)) - || cfgfile_string(option, value, _T("ghostscript_parameters"), p->ghostscript_parameters, sizeof p->ghostscript_parameters / sizeof(TCHAR))) - return 1; + if (cfgfile_path (option, value, _T("kickstart_rom_file"), p->romfile, sizeof p->romfile / sizeof (TCHAR)) + || cfgfile_path (option, value, _T("kickstart_ext_rom_file"), p->romextfile, sizeof p->romextfile / sizeof (TCHAR)) + || cfgfile_path (option, value, _T("flash_file"), p->flashfile, sizeof p->flashfile / sizeof (TCHAR)) + || cfgfile_path (option, value, _T("cart_file"), p->cartfile, sizeof p->cartfile / sizeof (TCHAR))) + return 1; if (cfgfile_string(option, value, _T("uaeboard_options"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) { TCHAR *s = cfgfile_option_get(value, _T("order")); @@ -4938,60 +3328,12 @@ static int cfgfile_parse_hardware(struct uae_prefs *p, const TCHAR *option, TCHA addbcromtype(p, ROMTYPE_MB_IDE, true, NULL, 0); return 1; } - if (cfgfile_yesno(option, value, _T("scsi_a3000"), &dummybool)) { - if (dummybool) { - addbcromtype(p, ROMTYPE_SCSI_A3000, true, NULL, 0); - p->cs_mbdmac = 1; - } - return 1; - } - if (cfgfile_yesno(option, value, _T("scsi_a4000t"), &dummybool)) { - if (dummybool) { - addbcromtype(p, ROMTYPE_SCSI_A4000T, true, NULL, 0); - p->cs_mbdmac = 2; - } - return 1; - } if (cfgfile_yesno(option, value, _T("cd32fmv"), &p->cs_cd32fmv)) { if (p->cs_cd32fmv) { addbcromtype(p, ROMTYPE_CD32CART, true, p->cartfile, 0); } return 1; } - if (cfgfile_intval(option, value, _T("catweasel"), &p->catweasel, 1)) { - if (p->catweasel) { - addbcromtype(p, ROMTYPE_CATWEASEL, true, NULL, 0); - } - return 1; - } - if (cfgfile_yesno(option, value, _T("toccata"), &dummybool)) - { - if (dummybool) { - addbcromtype(p, ROMTYPE_TOCCATA, true, NULL, 0); - } - return 1; - } - if (cfgfile_yesno(option, value, _T("es1370_pci"), &dummybool)) - { - if (dummybool) { - addbcromtype(p, ROMTYPE_ES1370, true, NULL, 0); - } - return 1; - } - if (cfgfile_yesno(option, value, _T("fm801_pci"), &dummybool)) - { - if (dummybool) { - addbcromtype(p, ROMTYPE_FM801, true, NULL, 0); - } - return 1; - } - if (cfgfile_yesno(option, value, _T("toccata_mixer"), &dummybool)) - { - if (dummybool) { - addbcromtype(p, ROMTYPE_TOCCATA, true, NULL, 0); - } - return 1; - } for (int i = 0; i < MAX_RTG_BOARDS; i++) { struct rtgboardconfig *rbc = &p->rtgboards[i]; @@ -5019,7 +3361,6 @@ static int cfgfile_parse_hardware(struct uae_prefs *p, const TCHAR *option, TCHA _tcscpy(tmp, _T("gfxcard_type")); if (cfgfile_string(option, value, tmp, tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) { rbc->rtgmem_type = 0; - rbc->rtg_index = i; int j = 0; for (;;) { const TCHAR *t = gfxboard_get_configname(j); @@ -5036,248 +3377,142 @@ static int cfgfile_parse_hardware(struct uae_prefs *p, const TCHAR *option, TCHA } } - if (cfgfile_string(option, value, _T("cpuboard_type"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) { - p->cpuboard_type = 0; - p->cpuboard_subtype = 0; - for (i = 0; cpuboards[i].name && !p->cpuboard_type; i++) { - const struct cpuboardtype *cbt = &cpuboards[i]; - if (cbt->subtypes) { - for (int j = 0; cbt->subtypes[j].name; j++) { - if (!_tcsicmp(cbt->subtypes[j].configname, tmpbuf)) { - p->cpuboard_type = i; - p->cpuboard_subtype = j; - } - } - } - } - return 1; - } - if (cfgfile_string(option, value, _T("cpuboard_settings"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) { - p->cpuboard_settings = 0; - const struct cpuboardsubtype *cbst = &cpuboards[p->cpuboard_type].subtypes[p->cpuboard_subtype]; - if (cbst->settings) { - p->cpuboard_settings = cfgfile_read_rom_settings(cbst->settings, tmpbuf, NULL); - } + if (cfgfile_strval (option, value, _T("chipset_compatible"), &p->cs_compatible, cscompa, 0)) { + built_in_chipset_prefs (p); return 1; } - if (cfgfile_strval(option, value, _T("chipset_compatible"), &p->cs_compatible, cscompa, 0)) { - built_in_chipset_prefs(p); - return 1; - } - - if (cfgfile_strval(option, value, _T("cart_internal"), &p->cart_internal, cartsmode, 0)) { + if (cfgfile_strval (option, value, _T("cart_internal"), &p->cart_internal, cartsmode, 0)) { if (p->cart_internal) { - struct romdata *rd = getromdatabyid(63); + struct romdata *rd = getromdatabyid (63); if (rd) - _stprintf(p->cartfile, _T(":%s"), rd->configname); + _stprintf (p->cartfile, _T(":%s"), rd->configname); } return 1; } - if (cfgfile_string(option, value, _T("kickstart_rom"), p->romident, sizeof p->romident / sizeof(TCHAR))) { - decode_rom_ident(p->romfile, sizeof p->romfile / sizeof(TCHAR), p->romident, ROMTYPE_ALL_KICK); + + if (cfgfile_read_board_rom(p, option, value)) + return 1; + + for (i = 0; i < 4; i++) { + _stprintf (tmpbuf, _T("floppy%d"), i); + if (cfgfile_path (option, value, tmpbuf, p->floppyslots[i].df, sizeof p->floppyslots[i].df / sizeof (TCHAR))) + return 1; + } + + if (cfgfile_intval (option, value, _T("chipmem_size"), &dummyint, 1)) { + if (dummyint < 0) + p->chipmem_size = 0x20000; /* 128k, prototype support */ + else if (dummyint == 0) + p->chipmem_size = 0x40000; /* 256k */ + else + p->chipmem_size = dummyint * 0x80000; + return 1; + } + + if (cfgfile_string (option, value, _T("addmem1"), tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) { + parse_addmem (p, tmpbuf, 0); return 1; } - if (cfgfile_string(option, value, _T("kickstart_ext_rom"), p->romextident, sizeof p->romextident / sizeof(TCHAR))) { - decode_rom_ident(p->romextfile, sizeof p->romextfile / sizeof(TCHAR), p->romextident, ROMTYPE_ALL_EXT); + if (cfgfile_string (option, value, _T("addmem2"), tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) { + parse_addmem (p, tmpbuf, 1); return 1; } - if (cfgfile_string(option, value, _T("cart"), p->cartident, sizeof p->cartident / sizeof(TCHAR))) { - decode_rom_ident(p->cartfile, sizeof p->cartfile / sizeof(TCHAR), p->cartident, ROMTYPE_ALL_CART); - return 1; - } + if (cfgfile_strval (option, value, _T("chipset"), &tmpval, csmode, 0)) { + set_chipset_mask (p, tmpval); + return 1; + } - if (cfgfile_read_board_rom(p, option, value, &p->path_rom)) - return 1; + if (cfgfile_string (option, value, _T("fpu_model"), tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) { + p->fpu_model = _tstol(tmpbuf); + return 1; + } - for (i = 0; i < 4; i++) { - _stprintf(tmpbuf, _T("floppy%d"), i); - if (cfgfile_path(option, value, tmpbuf, p->floppyslots[i].df, sizeof p->floppyslots[i].df / sizeof(TCHAR), &p->path_floppy)) - return 1; - } + if (cfgfile_string (option, value, _T("cpu_model"), tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) { + p->cpu_model = _tstol(tmpbuf); + p->fpu_model = 0; + return 1; + } - if (cfgfile_intval(option, value, _T("chipmem_size"), &dummyint, 1)) { - if (dummyint < 0) - p->chipmem_size = 0x20000; /* 128k, prototype support */ - else if (dummyint == 0) - p->chipmem_size = 0x40000; /* 256k */ - else - p->chipmem_size = dummyint * 0x80000; - return 1; - } - - if (cfgfile_string(option, value, _T("addmem1"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) { - parse_addmem(p, tmpbuf, 0); - return 1; - } - if (cfgfile_string(option, value, _T("addmem2"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) { - parse_addmem(p, tmpbuf, 1); - return 1; - } - - if (cfgfile_strval(option, value, _T("chipset"), &tmpval, csmode, 0)) { - set_chipset_mask(p, tmpval); - return 1; - } - - if (cfgfile_string(option, value, _T("mmu_model"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) { - p->mmu_model = _tstol(tmpbuf); - return 1; - } - - if (cfgfile_string(option, value, _T("fpu_model"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) { - p->fpu_model = _tstol(tmpbuf); - return 1; - } - - if (cfgfile_string(option, value, _T("cpu_model"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) { - p->cpu_model = _tstol(tmpbuf); - p->fpu_model = 0; - return 1; - } - - if (cfgfile_strval(option, value, _T("ppc_implementation"), &p->ppc_implementation, ppc_implementations, 0)) - return 1; - if (cfgfile_string(option, value, _T("ppc_model"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) { - p->ppc_mode = 0; - p->ppc_model[0] = 0; - if (!_tcsicmp(tmpbuf, _T("automatic"))) { - p->ppc_mode = 1; - } - else if (!_tcsicmp(tmpbuf, _T("manual"))) { - p->ppc_mode = 2; - } - else { - if (tmpbuf[0] && _tcslen(tmpbuf) < sizeof(p->ppc_model) / sizeof(TCHAR)) { - _tcscpy(p->ppc_model, tmpbuf); - p->ppc_mode = 2; - } - } - return 1; - } - if (cfgfile_strval(option, value, _T("ppc_cpu_idle"), &p->ppc_cpu_idle, ppc_cpu_idle, 0)) - return 1; - - /* old-style CPU configuration */ - if (cfgfile_string(option, value, _T("cpu_type"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) { + /* old-style CPU configuration */ + if (cfgfile_string (option, value, _T("cpu_type"), tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) { // 68000/010 32-bit addressing was not available until 2.8.2 bool force24bit = p->config_version <= ((2 << 16) | (8 << 8) | (1 << 0)); - p->fpu_model = 0; - p->address_space_24 = 0; - p->cpu_model = 680000; - if (!_tcscmp(tmpbuf, _T("68000"))) { - p->cpu_model = 68000; + p->fpu_model = 0; + p->address_space_24 = 0; + p->cpu_model = 680000; + if (!_tcscmp (tmpbuf, _T("68000"))) { + p->cpu_model = 68000; if (force24bit) p->address_space_24 = 1; - } - else if (!_tcscmp(tmpbuf, _T("68010"))) { - p->cpu_model = 68010; + } else if (!_tcscmp (tmpbuf, _T("68010"))) { + p->cpu_model = 68010; if (force24bit) p->address_space_24 = 1; - } - else if (!_tcscmp(tmpbuf, _T("68ec020"))) { - p->cpu_model = 68020; - } - else if (!_tcscmp(tmpbuf, _T("68020"))) { - p->cpu_model = 68020; - } - else if (!_tcscmp(tmpbuf, _T("68ec020/68881"))) { - p->cpu_model = 68020; - p->fpu_model = 68881; - p->address_space_24 = 1; - } - else if (!_tcscmp(tmpbuf, _T("68020/68881"))) { - p->cpu_model = 68020; - p->fpu_model = 68881; - } - else if (!_tcscmp(tmpbuf, _T("68040"))) { - p->cpu_model = 68040; - p->fpu_model = 68040; - } - else if (!_tcscmp(tmpbuf, _T("68060"))) { - p->cpu_model = 68060; - p->fpu_model = 68060; - } - return 1; - } + } else if (!_tcscmp (tmpbuf, _T("68ec020"))) { + p->cpu_model = 68020; + } else if (!_tcscmp (tmpbuf, _T("68020"))) { + p->cpu_model = 68020; + } else if (!_tcscmp (tmpbuf, _T("68ec020/68881"))) { + p->cpu_model = 68020; + p->fpu_model = 68881; + p->address_space_24 = 1; + } else if (!_tcscmp (tmpbuf, _T("68020/68881"))) { + p->cpu_model = 68020; + p->fpu_model = 68881; + } else if (!_tcscmp (tmpbuf, _T("68040"))) { + p->cpu_model = 68040; + p->fpu_model = 68040; + } + return 1; + } + + /* Broken earlier versions used to write this out as a string. */ + if (cfgfile_strval (option, value, _T("finegraincpu_speed"), &p->m68k_speed, speedmode, 1)) { + p->m68k_speed--; + return 1; + } - /* Broken earlier versions used to write this out as a string. */ - if (cfgfile_strval(option, value, _T("finegraincpu_speed"), &p->m68k_speed, speedmode, 1)) { + if (cfgfile_strval (option, value, _T("cpu_speed"), &p->m68k_speed, speedmode, 1)) { p->m68k_speed--; return 1; } + if (cfgfile_intval (option, value, _T("cpu_speed"), &p->m68k_speed, 1)) { + p->m68k_speed *= CYCLE_UNIT; + return 1; + } + if (cfgfile_intval (option, value, _T("finegrain_cpu_speed"), &p->m68k_speed, 1)) { + if (OFFICIAL_CYCLE_UNIT > CYCLE_UNIT) { + int factor = OFFICIAL_CYCLE_UNIT / CYCLE_UNIT; + p->m68k_speed = (p->m68k_speed + factor - 1) / factor; + } + if (_tcsicmp (value, _T("max")) == 0) + p->m68k_speed = -1; + return 1; + } - if (cfgfile_strval(option, value, _T("cpu_speed"), &p->m68k_speed, speedmode, 1)) { - p->m68k_speed--; - return 1; - } - if (cfgfile_intval(option, value, _T("cpu_speed"), &p->m68k_speed, 1)) { - p->m68k_speed *= CYCLE_UNIT; - return 1; - } - if (cfgfile_doubleval(option, value, _T("cpu_throttle"), &p->m68k_speed_throttle)) { - return 1; - } - if (cfgfile_doubleval(option, value, _T("cpu_x86_throttle"), &p->x86_speed_throttle)) { - return 1; - } - if (cfgfile_intval(option, value, _T("finegrain_cpu_speed"), &p->m68k_speed, 1)) { - if (OFFICIAL_CYCLE_UNIT > CYCLE_UNIT) { - int factor = OFFICIAL_CYCLE_UNIT / CYCLE_UNIT; - p->m68k_speed = (p->m68k_speed + factor - 1) / factor; - } - if (strcasecmp(value, _T("max")) == 0) - p->m68k_speed = -1; - return 1; - } - - if (cfgfile_intval(option, value, _T("dongle"), &p->dongle, 1)) { - if (p->dongle == 0) - cfgfile_strval(option, value, _T("dongle"), &p->dongle, dongles, 0); - return 1; - } - - if (strcasecmp(option, _T("quickstart")) == 0) { + if (_tcsicmp (option, _T("quickstart")) == 0) { int model = 0; - TCHAR *tmpp = _tcschr(value, ','); + TCHAR *tmpp = _tcschr (value, ','); if (tmpp) { *tmpp++ = 0; - TCHAR *tmpp2 = _tcschr(value, ','); + TCHAR *tmpp2 = _tcschr (value, ','); if (tmpp2) *tmpp2 = 0; - cfgfile_strval(option, value, option, &model, qsmodes, 0); + cfgfile_strval (option, value, option, &model, qsmodes, 0); if (model >= 0) { - int config = _tstol(tmpp); - built_in_prefs(p, model, config, 0, 0); + int config = _tstol (tmpp); + built_in_prefs (p, model, config, 0, 0); } } - return 1; - } + return 1; + } - if (cfgfile_parse_filesys(p, option, value)) + if (cfgfile_parse_filesys (p, option, value)) return 1; - return 0; -} - -static void romtype_restricted(struct uae_prefs *p, const int *list) -{ - for (int i = 0; list[i]; i++) { - int romtype = list[i]; - if (is_board_enabled(p, romtype, 0)) { - i++; - while (list[i]) { - romtype = list[i]; - if (is_board_enabled(p, romtype, 0)) { - write_log(_T("ROMTYPE %08x removed\n"), romtype); - addbcromtype(p, romtype, false, NULL, 0); - } - i++; - return; - } - } - } + return 0; } void cfgfile_compatibility_rtg(struct uae_prefs *p) @@ -5286,12 +3521,11 @@ void cfgfile_compatibility_rtg(struct uae_prefs *p) // only one uaegfx for (int i = 0; i < MAX_RTG_BOARDS; i++) { struct rtgboardconfig *rbc = &p->rtgboards[i]; - if (rbc->rtgmem_size && rbc->rtgmem_type < GFXBOARD_HARDWARE) { + if (rbc->rtgmem_size) { if (uaegfx >= 0) { rbc->rtgmem_size = 0; rbc->rtgmem_type = 0; - } - else { + } else { uaegfx = i; } } @@ -5307,30 +3541,6 @@ void cfgfile_compatibility_rtg(struct uae_prefs *p) rbc2->rtgmem_size = size; rbc2->rtgmem_type = type; } - // allow only one a2410 and vga - int a2410 = -1; - int vga = -1; - //for (int i = 0; i < MAX_RTG_BOARDS; i++) { - // struct rtgboardconfig *rbc = &p->rtgboards[i]; - // if (rbc->rtgmem_type == GFXBOARD_A2410) { - // if (a2410 >= 0) { - // rbc->rtgmem_size = 0; - // rbc->rtgmem_type = 0; - // } - // else { - // a2410 = i; - // } - // } - // if (rbc->rtgmem_type == GFXBOARD_VGA) { - // if (vga >= 0) { - // rbc->rtgmem_size = 0; - // rbc->rtgmem_type = 0; - // } - // else { - // vga = i; - // } - // } - //} // empty slots last bool reorder = true; while (reorder) { @@ -5350,94 +3560,21 @@ void cfgfile_compatibility_rtg(struct uae_prefs *p) } } } - int rtgs[MAX_RTG_BOARDS] = { 0 }; - //for (int i = 0; i < MAX_RTG_BOARDS; i++) { - // if (p->rtgboards[i].rtgmem_size && !rtgs[i]) { - // uae_u32 romtype = gfxboard_get_romtype(&p->rtgboards[i]); - // if (romtype) { - // int devnum = 0; - // for (int j = i; j < MAX_RTG_BOARDS; j++) { - // rtgs[j] = 1; - // if (gfxboard_get_romtype(&p->rtgboards[j]) == romtype) { - // TCHAR *romname = NULL; - // if (romtype == ROMTYPE_PICASSOIV) { - // romname = p->picassoivromfile; - // } - // else if (romtype == ROMTYPE_x86_VGA) { - // romname = _T(""); - // } - // addbcromtype(p, romtype, true, romname, devnum); - // devnum++; - // } - // } - // while (devnum < MAX_DUPLICATE_EXPANSION_BOARDS) { - // addbcromtype(p, romtype, false, NULL, devnum); - // devnum++; - // } - // } - // } - //} - //for (int i = 0; i < MAX_RTG_BOARDS; i++) { - // if (!rtgs[i]) { - // uae_u32 romtype = gfxboard_get_romtype(&p->rtgboards[i]); - // if (romtype) { - // for (int devnum = 0; devnum < MAX_DUPLICATE_EXPANSION_BOARDS; devnum++) { - // addbcromtype(p, romtype, false, NULL, devnum); - // } - // } - // } - //} } void cfgfile_compatibility_romtype(struct uae_prefs *p) { - addbcromtype(p, ROMTYPE_MB_PCMCIA, p->cs_pcmcia, NULL, 0); + addbcromtype(p, ROMTYPE_MB_PCMCIA, p->cs_pcmcia, NULL, 0); addbcromtype(p, ROMTYPE_MB_IDE, p->cs_ide != 0, NULL, 0); - if (p->cs_mbdmac == 1) { - addbcromtype(p, ROMTYPE_SCSI_A4000T, false, NULL, 0); - addbcromtype(p, ROMTYPE_SCSI_A3000, true, NULL, 0); - } - else if (p->cs_mbdmac == 2) { - addbcromtype(p, ROMTYPE_SCSI_A3000, false, NULL, 0); - addbcromtype(p, ROMTYPE_SCSI_A4000T, true, NULL, 0); - } - else { - addbcromtype(p, ROMTYPE_SCSI_A3000, false, NULL, 0); - addbcromtype(p, ROMTYPE_SCSI_A4000T, false, NULL, 0); - } - - addbcromtype(p, ROMTYPE_CDTVDMAC, p->cs_cdtvcd && !p->cs_cdtvcr, NULL, 0); - addbcromtype(p, ROMTYPE_CDTVSCSI, p->cs_cdtvscsi, NULL, 0); - - addbcromtype(p, ROMTYPE_CDTVCR, p->cs_cdtvcr, NULL, 0); - - addbcromtype(p, ROMTYPE_CD32CART, p->cs_cd32fmv, p->cartfile, 0); - - if (p->config_version < ((3 << 16) | (4 << 8) | (0 << 0))) { - // 3.3.0 or older - addbcromtypenet(p, ROMTYPE_A2065, p->a2065name, 0); - addbcromtypenet(p, ROMTYPE_NE2KPCMCIA, p->ne2000pcmcianame, 0); - addbcromtypenet(p, ROMTYPE_NE2KPCI, p->ne2000pciname, 0); - } - - static const int restricted_net[] = { - ROMTYPE_A2065, ROMTYPE_NE2KPCMCIA, ROMTYPE_NE2KPCI, ROMTYPE_NE2KISA, - ROMTYPE_ARIADNE2, ROMTYPE_XSURF, ROMTYPE_XSURF100Z2, ROMTYPE_XSURF100Z3, - ROMTYPE_HYDRA, ROMTYPE_LANROVER, - 0 }; - static const int restricted_x86[] = { ROMTYPE_A1060, ROMTYPE_A2088, ROMTYPE_A2088T, ROMTYPE_A2286, ROMTYPE_A2386, 0 }; - static const int restricted_pci[] = { ROMTYPE_GREX, ROMTYPE_MEDIATOR, ROMTYPE_PROMETHEUS, 0 }; - romtype_restricted(p, restricted_net); - romtype_restricted(p, restricted_x86); - romtype_restricted(p, restricted_pci); + addbcromtype(p, ROMTYPE_CD32CART, p->cs_cd32fmv, p->cartfile,0); } -static bool createconfigstore(struct uae_prefs*); -static int getconfigstoreline(const TCHAR *option, TCHAR *value); +static bool createconfigstore (struct uae_prefs*); +static int getconfigstoreline (const TCHAR *option, TCHAR *value); -static void calcformula(struct uae_prefs *prefs, TCHAR *in) +static void calcformula (struct uae_prefs *prefs, TCHAR *in) { TCHAR out[MAX_DPATH], configvalue[CONFIG_BLEN]; TCHAR *p = out; @@ -5445,36 +3582,35 @@ static void calcformula(struct uae_prefs *prefs, TCHAR *in) int cnt1, cnt2; static bool updatestore; - if (_tcslen(in) < 2 || in[0] != '[' || in[_tcslen(in) - 1] != ']') + if (_tcslen (in) < 2 || in[0] != '[' || in[_tcslen (in) - 1] != ']') return; if (!configstore || updatestore) - createconfigstore(prefs); + createconfigstore (prefs); updatestore = false; if (!configstore) return; cnt1 = cnt2 = 0; - for (int i = 1; i < _tcslen(in) - 1; i++) { - TCHAR c = _totupper(in[i]); - if (c >= 'A' && c <= 'Z') { + for (int i = 1; i < _tcslen (in) - 1; i++) { + TCHAR c = _totupper (in[i]); + if (c >= 'A' && c <='Z') { TCHAR *start = &in[i]; - while (_istalnum(c) || c == '_' || c == '.') { + while (_istalnum (c) || c == '_' || c == '.') { i++; c = in[i]; } TCHAR store = in[i]; in[i] = 0; //write_log (_T("'%s'\n"), start); - if (!getconfigstoreline(start, configvalue)) + if (!getconfigstoreline (start, configvalue)) return; - _tcscpy(p, configvalue); - p += _tcslen(p); + _tcscpy (p, configvalue); + p += _tcslen (p); in[i] = store; i--; cnt1++; - } - else { + } else { cnt2++; - *p++ = c; + *p ++= c; } } *p = 0; @@ -5482,592 +3618,438 @@ static void calcformula(struct uae_prefs *prefs, TCHAR *in) return; /* single config entry only? */ if (cnt1 == 1 && cnt2 == 0) { - _tcscpy(in, out); + _tcscpy (in, out); updatestore = true; return; } - if (calc(out, &val)) { + if (calc (out, &val)) { if (val - (int)val != 0.0f) - _stprintf(in, _T("%f"), val); + _stprintf (in, _T("%f"), val); else - _stprintf(in, _T("%d"), (int)val); + _stprintf (in, _T("%d"), (int)val); updatestore = true; return; } } -int cfgfile_parse_option(struct uae_prefs *p, const TCHAR *option, TCHAR *value, int type) +int cfgfile_parse_option (struct uae_prefs *p, const TCHAR *option, TCHAR *value, int type) { - calcformula(p, value); + calcformula (p, value); - if (!_tcscmp(option, _T("debug"))) { - write_log(_T("CONFIG DEBUG: '%s'\n"), value); - return 1; - } - if (!_tcscmp(option, _T("config_hardware"))) - return 1; - if (!_tcscmp(option, _T("config_host"))) - return 1; - if (cfgfile_path(option, value, _T("config_all_path"), p->config_all_path, sizeof p->config_all_path / sizeof(TCHAR))) - return 1; - if (cfgfile_path(option, value, _T("config_hardware_path"), p->config_hardware_path, sizeof p->config_hardware_path / sizeof(TCHAR))) - return 1; - if (cfgfile_path(option, value, _T("config_host_path"), p->config_host_path, sizeof p->config_host_path / sizeof(TCHAR))) - return 1; - if (type == 0 || (type & CONFIG_TYPE_HARDWARE)) { - if (cfgfile_parse_hardware(p, option, value)) - return 1; - } - if (type == 0 || (type & CONFIG_TYPE_HOST)) { + if (!_tcscmp (option, _T("config_hardware"))) + return 1; + if (!_tcscmp (option, _T("config_host"))) + return 1; + if (type == 0 || (type & CONFIG_TYPE_HARDWARE)) { + if (cfgfile_parse_hardware (p, option, value)) + return 1; + } + if (type == 0 || (type & CONFIG_TYPE_HOST)) { // cfgfile_parse_host may modify the option (convert to lowercase). TCHAR* writable_option = my_strdup(option); - if (cfgfile_parse_host(p, writable_option, value)) { + if (cfgfile_parse_host (p, writable_option, value)) { free(writable_option); - return 1; + return 1; } free(writable_option); - } + } if (type > 0 && (type & (CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST)) != (CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST)) - return 1; - return 0; + return 1; + return 0; } -static int isutf8ext(TCHAR *s) +static int isutf8ext (TCHAR *s) { - if (_tcslen(s) > _tcslen(UTF8NAME) && !_tcscmp(s + _tcslen(s) - _tcslen(UTF8NAME), UTF8NAME)) { - s[_tcslen(s) - _tcslen(UTF8NAME)] = 0; + if (_tcslen (s) > _tcslen (UTF8NAME) && !_tcscmp (s + _tcslen (s) - _tcslen (UTF8NAME), UTF8NAME)) { + s[_tcslen (s) - _tcslen (UTF8NAME)] = 0; return 1; } return 0; } -static int cfgfile_separate_linea(const TCHAR *filename, char *line, TCHAR *line1b, TCHAR *line2b) +int cfgfile_separate_linea (const TCHAR *filename, char *line, TCHAR *line1b, TCHAR *line2b) { - char *line1, *line2; - int i; + char *line1, *line2; + int i; - line1 = line; - line1 += strspn(line1, "\t \r\n"); - if (*line1 == ';') - return 0; - line2 = strchr(line, '='); - if (!line2) { - TCHAR *s = au(line1); + line1 = line; + line1 += strspn (line1, "\t \r\n"); + if (*line1 == ';') + return 0; + line2 = strchr (line, '='); + if (! line2) { + TCHAR *s = au (line1); cfgfile_warning(_T("CFGFILE: '%s', linea was incomplete with only %s\n"), filename, s); - xfree(s); - return 0; - } - *line2++ = '\0'; + xfree (s); + return 0; + } + *line2++ = '\0'; - /* Get rid of whitespace. */ - i = strlen(line2); - while (i > 0 && (line2[i - 1] == '\t' || line2[i - 1] == ' ' - || line2[i - 1] == '\r' || line2[i - 1] == '\n')) - line2[--i] = '\0'; - line2 += strspn(line2, "\t \r\n"); + /* Get rid of whitespace. */ + i = strlen (line2); + while (i > 0 && (line2[i - 1] == '\t' || line2[i - 1] == ' ' + || line2[i - 1] == '\r' || line2[i - 1] == '\n')) + line2[--i] = '\0'; + line2 += strspn (line2, "\t \r\n"); - i = strlen(line); - while (i > 0 && (line[i - 1] == '\t' || line[i - 1] == ' ' - || line[i - 1] == '\r' || line[i - 1] == '\n')) - line[--i] = '\0'; - line += strspn(line, "\t \r\n"); - au_copy(line1b, MAX_DPATH, line); - if (isutf8ext(line1b)) { + i = strlen (line); + while (i > 0 && (line[i - 1] == '\t' || line[i - 1] == ' ' + || line[i - 1] == '\r' || line[i - 1] == '\n')) + line[--i] = '\0'; + line += strspn (line, "\t \r\n"); + + au_copy (line1b, MAX_DPATH, line); + if (isutf8ext (line1b)) { if (line2[0]) { - TCHAR *s = utf8u(line2); - _tcscpy(line2b, s); - xfree(s); + TCHAR *s = utf8u (line2); + _tcscpy (line2b, s); + xfree (s); } + } else { + au_copy (line2b, MAX_DPATH, line2); } - else { - au_copy(line2b, MAX_DPATH, line2); - } - return 1; + + return 1; } -static int cfgfile_separate_line(TCHAR *line, TCHAR *line1b, TCHAR *line2b) +static int cfgfile_separate_line (TCHAR *line, TCHAR *line1b, TCHAR *line2b) { TCHAR *line1, *line2; int i; line1 = line; - line1 += _tcsspn(line1, _T("\t \r\n")); + line1 += _tcsspn (line1, _T("\t \r\n")); if (*line1 == ';') return 0; - line2 = _tcschr(line, '='); - if (!line2) { + line2 = _tcschr (line, '='); + if (! line2) { cfgfile_warning(_T("CFGFILE: line was incomplete with only %s\n"), line1); return 0; } *line2++ = '\0'; /* Get rid of whitespace. */ - i = _tcslen(line2); + i = _tcslen (line2); while (i > 0 && (line2[i - 1] == '\t' || line2[i - 1] == ' ' || line2[i - 1] == '\r' || line2[i - 1] == '\n')) line2[--i] = '\0'; - line2 += _tcsspn(line2, _T("\t \r\n")); - _tcscpy(line2b, line2); - i = _tcslen(line); + line2 += _tcsspn (line2, _T("\t \r\n")); + _tcscpy (line2b, line2); + i = _tcslen (line); while (i > 0 && (line[i - 1] == '\t' || line[i - 1] == ' ' || line[i - 1] == '\r' || line[i - 1] == '\n')) line[--i] = '\0'; - line += _tcsspn(line, _T("\t \r\n")); - _tcscpy(line1b, line); + line += _tcsspn (line, _T("\t \r\n")); + _tcscpy (line1b, line); if (line2b[0] == '"' || line2b[0] == '\"') { TCHAR c = line2b[0]; int i = 0; - memmove(line2b, line2b + 1, (_tcslen(line2b) + 1) * sizeof(TCHAR)); + memmove (line2b, line2b + 1, (_tcslen (line2b) + 1) * sizeof (TCHAR)); while (line2b[i] != 0 && line2b[i] != c) i++; line2b[i] = 0; } - if (isutf8ext(line1b)) + if (isutf8ext (line1b)) return 0; return 1; } -static int isobsolete(TCHAR *s) +static int isobsolete (TCHAR *s) { - int i = 0; - while (obsolete[i]) { - if (!strcasecmp(s, obsolete[i])) { + int i = 0; + while (obsolete[i]) { + if (!_tcsicmp (s, obsolete[i])) { cfgfile_warning_obsolete(_T("obsolete config entry '%s'\n"), s); - return 1; - } - i++; - } - if (_tcslen(s) > 2 && !_tcsncmp(s, _T("w."), 2)) - return 1; - if (_tcslen(s) >= 10 && !_tcsncmp(s, _T("gfx_opengl"), 10)) { + return 1; + } + i++; + } + if (_tcslen (s) > 2 && !_tcsncmp (s, _T("w."), 2)) + return 1; + if (_tcslen (s) >= 10 && !_tcsncmp (s, _T("gfx_opengl"), 10)) { cfgfile_warning_obsolete(_T("obsolete config entry '%s\n"), s); - return 1; - } - if (_tcslen(s) >= 6 && !_tcsncmp(s, _T("gfx_3d"), 6)) { + return 1; + } + if (_tcslen (s) >= 6 && !_tcsncmp (s, _T("gfx_3d"), 6)) { cfgfile_warning_obsolete(_T("obsolete config entry '%s\n"), s); - return 1; - } - return 0; + return 1; + } + return 0; } -static void cfgfile_parse_separated_line(struct uae_prefs *p, TCHAR *line1b, TCHAR *line2b, int type) +static void cfgfile_parse_separated_line (struct uae_prefs *p, TCHAR *line1b, TCHAR *line2b, int type) { - TCHAR line3b[CONFIG_BLEN], line4b[CONFIG_BLEN]; - struct strlist *sl; - int ret; + TCHAR line3b[CONFIG_BLEN], line4b[CONFIG_BLEN]; + struct strlist *sl; + int ret; - _tcscpy(line3b, line1b); - _tcscpy(line4b, line2b); - ret = cfgfile_parse_option(p, line1b, line2b, type); - if (!isobsolete(line3b)) { - for (sl = p->all_lines; sl; sl = sl->next) { - if (sl->option && !strcasecmp(line1b, sl->option)) break; - } - if (!sl) { - struct strlist *u = xcalloc(struct strlist, 1); - u->option = my_strdup(line3b); - u->value = my_strdup(line4b); - u->next = p->all_lines; - p->all_lines = u; - if (!ret) { - u->unknown = 1; + _tcscpy (line3b, line1b); + _tcscpy (line4b, line2b); + ret = cfgfile_parse_option (p, line1b, line2b, type); + if (!isobsolete (line3b)) { + for (sl = p->all_lines; sl; sl = sl->next) { + if (sl->option && !_tcsicmp (line1b, sl->option)) break; + } + if (!sl) { + struct strlist *u = xcalloc (struct strlist, 1); + u->option = my_strdup(line3b); + u->value = my_strdup(line4b); + u->next = p->all_lines; + p->all_lines = u; + if (!ret) { + u->unknown = 1; cfgfile_warning(_T("unknown config entry: '%s=%s'\n"), u->option, u->value); - } - } - } + } + } + } } -void cfgfile_parse_lines(struct uae_prefs *p, const TCHAR *lines, int type) +void cfgfile_parse_line (struct uae_prefs *p, TCHAR *line, int type) { - TCHAR *buf = my_strdup(lines); - TCHAR *t = buf; - for (;;) { - if (_tcslen(t) == 0) - break; - TCHAR *t2 = _tcschr(t, '\n'); - if (t2) - *t2 = 0; - cfgfile_parse_line(p, t, type); - if (!t2) - break; - t = t2 + 1; - } - xfree(buf); + TCHAR line1b[CONFIG_BLEN], line2b[CONFIG_BLEN]; + + if (!cfgfile_separate_line (line, line1b, line2b)) + return; + cfgfile_parse_separated_line (p, line1b, line2b, type); } -void cfgfile_parse_line(struct uae_prefs *p, TCHAR *line, int type) -{ - TCHAR line1b[CONFIG_BLEN], line2b[CONFIG_BLEN]; - - if (!cfgfile_separate_line(line, line1b, line2b)) - return; - cfgfile_parse_separated_line(p, line1b, line2b, type); -} - -static void subst(TCHAR *p, TCHAR *f, int n) +static void subst (TCHAR *p, TCHAR *f, int n) { if (_tcslen(p) == 0 || _tcslen(f) == 0) return; - TCHAR *str = cfgfile_subst_path(UNEXPANDED, p, f); - _tcsncpy(f, str, n - 1); - f[n - 1] = '\0'; - free(str); + TCHAR *str = cfgfile_subst_path (UNEXPANDED, p, f); + _tcsncpy (f, str, n - 1); + f[n - 1] = '\0'; + free (str); } -static int getconfigstoreline(const TCHAR *option, TCHAR *value) +static int getconfigstoreline (const TCHAR *option, TCHAR *value) { TCHAR tmp[CONFIG_BLEN * 2], tmp2[CONFIG_BLEN * 2]; if (!configstore) return 0; - zfile_fseek(configstore, 0, SEEK_SET); + zfile_fseek (configstore, 0, SEEK_SET); for (;;) { - if (!zfile_fgets(tmp, sizeof tmp / sizeof(TCHAR), configstore)) + if (!zfile_fgets (tmp, sizeof tmp / sizeof (TCHAR), configstore)) return 0; - if (!cfgfile_separate_line(tmp, tmp2, value)) + if (!cfgfile_separate_line (tmp, tmp2, value)) continue; - if (!_tcsicmp(option, tmp2)) + if (!_tcsicmp (option, tmp2)) return 1; } } -static bool createconfigstore(struct uae_prefs *p) +static bool createconfigstore (struct uae_prefs *p) { uae_u8 zeros[4] = { 0 }; - zfile_fclose(configstore); - configstore = zfile_fopen_empty(NULL, _T("configstore"), 50000); + zfile_fclose (configstore); + configstore = zfile_fopen_empty (NULL, _T("configstore"), 50000); if (!configstore) return false; - zfile_fseek(configstore, 0, SEEK_SET); + zfile_fseek (configstore, 0, SEEK_SET); uaeconfig++; - cfgfile_save_options(configstore, p, 0); + cfgfile_save_options (configstore, p, 0); uaeconfig--; - zfile_fwrite(zeros, 1, sizeof zeros, configstore); - zfile_fseek(configstore, 0, SEEK_SET); + zfile_fwrite (zeros, 1, sizeof zeros, configstore); + zfile_fseek (configstore, 0, SEEK_SET); return true; } -static char *cfg_fgets(char *line, int max, struct zfile *fh) +static char *cfg_fgets (char *line, int max, struct zfile *fh) { -#ifdef SINGLEFILE - extern TCHAR singlefile_config[]; - static TCHAR *sfile_ptr; - TCHAR *p; -#endif - - if (fh) - return zfile_fgetsa(line, max, fh); -#ifdef SINGLEFILE - if (sfile_ptr == 0) { - sfile_ptr = singlefile_config; - if (*sfile_ptr) { - write_log(_T("singlefile config found\n")); - while (*sfile_ptr++); - } - } - if (*sfile_ptr == 0) { - sfile_ptr = singlefile_config; - return 0; - } - p = sfile_ptr; - while (*p != 13 && *p != 10 && *p != 0) p++; - memset(line, 0, max); - memcpy(line, sfile_ptr, (p - sfile_ptr) * sizeof(TCHAR)); - sfile_ptr = p + 1; - if (*sfile_ptr == 13) - sfile_ptr++; - if (*sfile_ptr == 10) - sfile_ptr++; - return line; -#endif - return 0; + if (fh) + return zfile_fgetsa (line, max, fh); + return 0; } -static int cfgfile_load_2(struct uae_prefs *p, const TCHAR *filename, bool real, int *type) +static int cfgfile_load_2 (struct uae_prefs *p, const TCHAR *filename, bool real, int *type) { - int i; - struct zfile *fh; - char linea[CONFIG_BLEN]; - TCHAR line[CONFIG_BLEN], line1b[CONFIG_BLEN], line2b[CONFIG_BLEN]; - struct strlist *sl; - bool type1 = false, type2 = false; - int askedtype = 0; + int i; + struct zfile *fh; + char linea[CONFIG_BLEN]; + TCHAR line[CONFIG_BLEN], line1b[CONFIG_BLEN], line2b[CONFIG_BLEN]; + struct strlist *sl; + bool type1 = false, type2 = false; + int askedtype = 0; - if (type) { - askedtype = *type; - *type = 0; - } - if (real) { - p->config_version = 0; - config_newfilesystem = 0; - //reset_inputdevice_config (p); - } + if (type) { + askedtype = *type; + *type = 0; + } + if (real) { + p->config_version = 0; + config_newfilesystem = 0; + //reset_inputdevice_config (p); + } - fh = zfile_fopen(filename, _T("r"), ZFD_NORMAL); -#ifndef SINGLEFILE - if (!fh) - return 0; -#endif + fh = zfile_fopen (filename, _T("r"), ZFD_NORMAL); + if (! fh) + return 0; - while (cfg_fgets(linea, sizeof(linea), fh) != 0) { - trimwsa(linea); - if (strlen(linea) > 0) { + while (cfg_fgets (linea, sizeof (linea), fh) != 0) { + trimwsa (linea); + if (strlen (linea) > 0) { if (linea[0] == '#' || linea[0] == ';') { - struct strlist *u = xcalloc(struct strlist, 1); + struct strlist *u = xcalloc (struct strlist, 1); u->option = NULL; - TCHAR *com = au(linea); - u->value = my_strdup(com); - xfree(com); + TCHAR *com = au (linea); + u->value = my_strdup (com); + xfree (com); u->unknown = 1; u->next = p->all_lines; p->all_lines = u; - continue; + continue; } - if (!cfgfile_separate_linea(filename, linea, line1b, line2b)) - continue; - type1 = type2 = 0; - if (cfgfile_yesno(line1b, line2b, _T("config_hardware"), &type1) || - cfgfile_yesno(line1b, line2b, _T("config_host"), &type2)) { - if (type1 && type) - *type |= CONFIG_TYPE_HARDWARE; - if (type2 && type) - *type |= CONFIG_TYPE_HOST; - continue; - } - if (real) { - cfgfile_parse_separated_line(p, line1b, line2b, askedtype); - } - else { - cfgfile_string(line1b, line2b, _T("config_description"), p->description, sizeof p->description / sizeof(TCHAR)); - cfgfile_path(line1b, line2b, _T("config_hardware_path"), p->config_hardware_path, sizeof p->config_hardware_path / sizeof(TCHAR)); - cfgfile_path(line1b, line2b, _T("config_host_path"), p->config_host_path, sizeof p->config_host_path / sizeof(TCHAR)); - cfgfile_path(line1b, line2b, _T("config_all_path"), p->config_all_path, sizeof p->config_all_path / sizeof(TCHAR)); - cfgfile_string(line1b, line2b, _T("config_window_title"), p->config_window_title, sizeof p->config_window_title / sizeof(TCHAR)); - } - } - } + if (!cfgfile_separate_linea (filename, linea, line1b, line2b)) + continue; + type1 = type2 = 0; + if (cfgfile_yesno (line1b, line2b, _T("config_hardware"), &type1) || + cfgfile_yesno (line1b, line2b, _T("config_host"), &type2)) { + if (type1 && type) + *type |= CONFIG_TYPE_HARDWARE; + if (type2 && type) + *type |= CONFIG_TYPE_HOST; + continue; + } + if (real) { + cfgfile_parse_separated_line (p, line1b, line2b, askedtype); + } else { + cfgfile_string (line1b, line2b, _T("config_description"), p->description, sizeof p->description / sizeof (TCHAR)); + } + } + } - if (type && *type == 0) - *type = CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST; - zfile_fclose(fh); + if (type && *type == 0) + *type = CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST; + zfile_fclose (fh); - if (!real) - return 1; + if (!real) + return 1; - for (sl = temp_lines; sl; sl = sl->next) { - _stprintf(line, _T("%s=%s"), sl->option, sl->value); - cfgfile_parse_line(p, line, 0); - } + for (sl = temp_lines; sl; sl = sl->next) { + _stprintf (line, _T("%s=%s"), sl->option, sl->value); + cfgfile_parse_line (p, line, 0); + } - for (i = 0; i < 4; i++) - subst(p->path_floppy.path[0], p->floppyslots[i].df, sizeof p->floppyslots[i].df / sizeof(TCHAR)); - subst(p->path_rom.path[0], p->romfile, sizeof p->romfile / sizeof(TCHAR)); - subst(p->path_rom.path[0], p->romextfile, sizeof p->romextfile / sizeof(TCHAR)); - subst(p->path_rom.path[0], p->romextfile2, sizeof p->romextfile2 / sizeof(TCHAR)); + for (i = 0; i < 4; i++) { + subst (p->path_floppy, p->floppyslots[i].df, sizeof p->floppyslots[i].df / sizeof (TCHAR)); + if(i >= p->nr_floppies) + p->floppyslots[i].dfxtype = DRV_NONE; + } + subst (p->path_rom, p->romfile, sizeof p->romfile / sizeof (TCHAR)); + subst (p->path_rom, p->romextfile, sizeof p->romextfile / sizeof (TCHAR)); for (i = 0; i < MAX_EXPANSION_BOARDS; i++) { for (int j = 0; j < MAX_BOARD_ROMS; j++) { - subst(p->path_rom.path[0], p->expansionboard[i].roms[j].romfile, MAX_DPATH / sizeof(TCHAR)); + subst(p->path_rom, p->expansionboard[i].roms[j].romfile, MAX_DPATH / sizeof(TCHAR)); } } - return 1; + return 1; } -int cfgfile_load(struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig) +int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig) { - int v; - TCHAR tmp[MAX_DPATH]; - int type2; - static int recursive; + int v; + static int recursive; - if (recursive > 1) - return 0; - recursive++; - write_log(_T("load config '%s':%d\n"), filename, type ? *type : -1); - v = cfgfile_load_2(p, filename, 1, type); - if (!v) { + if (recursive > 1) + return 0; + recursive++; + write_log (_T("load config '%s':%d\n"), filename, type ? *type : -1); + v = cfgfile_load_2 (p, filename, 1, type); + if (!v) { cfgfile_warning(_T("cfgfile_load_2 failed\n")); - goto end; - } - //if (userconfig) - // target_addtorecent(filename, 0); - if (!ignorelink) { - if (p->config_all_path[0]) { - fetch_configurationpath(tmp, sizeof(tmp) / sizeof(TCHAR)); - _tcsncat(tmp, p->config_all_path, sizeof(tmp) / sizeof(TCHAR) - _tcslen(tmp) - 1); - type2 = CONFIG_TYPE_HOST | CONFIG_TYPE_HARDWARE; - cfgfile_load(p, tmp, &type2, 1, 0); - } - if (p->config_hardware_path[0]) { - fetch_configurationpath(tmp, sizeof(tmp) / sizeof(TCHAR)); - _tcsncat(tmp, p->config_hardware_path, sizeof(tmp) / sizeof(TCHAR) - _tcslen(tmp) - 1); - type2 = CONFIG_TYPE_HARDWARE; - cfgfile_load(p, tmp, &type2, 1, 0); - } - if (p->config_host_path[0]) { - fetch_configurationpath(tmp, sizeof(tmp) / sizeof(TCHAR)); - _tcsncat(tmp, p->config_host_path, sizeof(tmp) / sizeof(TCHAR) - _tcslen(tmp) - 1); - type2 = CONFIG_TYPE_HOST; - cfgfile_load(p, tmp, &type2, 1, 0); - } - } + goto end; + } + if (userconfig) + target_addtorecent (filename, 0); end: - recursive--; - fixup_prefs(p, userconfig != 0); - return v; + recursive--; + fixup_prefs (p, userconfig != 0); + return v; } -void cfgfile_backup(const TCHAR *path) +int cfgfile_save (struct uae_prefs *p, const TCHAR *filename, int type) { - TCHAR dpath[MAX_DPATH]; + struct zfile *fh; - fetch_configurationpath(dpath, sizeof(dpath) / sizeof(TCHAR)); - _tcscat(dpath, _T("configuration.backup")); - //bool hidden = my_isfilehidden(dpath); - my_unlink(dpath); - my_rename(path, dpath); - //if (hidden) - // my_setfilehidden(dpath, hidden); + fh = zfile_fopen (filename, _T("w"), ZFD_NORMAL); + if (! fh) + return 0; + + if (!type) + type = CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST; + cfgfile_save_options (fh, p, type); + zfile_fclose (fh); + return 1; } -int cfgfile_save(struct uae_prefs *p, const TCHAR *filename, int type) +int cfgfile_get_description (const TCHAR *filename, TCHAR *description) { - struct zfile *fh; + int result = 0; + struct uae_prefs *p = xmalloc (struct uae_prefs, 1); - cfgfile_backup(filename); - fh = zfile_fopen(filename, unicode_config ? _T("w, ccs=UTF-8") : _T("w"), ZFD_NORMAL); - if (!fh) - return 0; - - if (!type) - type = CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST; - cfgfile_save_options(fh, p, type); - zfile_fclose(fh); - return 1; -} - -int cfgfile_get_description(const TCHAR *filename, TCHAR *description, TCHAR *hostlink, TCHAR *hardwarelink, int *type) -{ - int result = 0; - struct uae_prefs *p = xmalloc(struct uae_prefs, 1); - - p->description[0] = 0; - p->config_host_path[0] = 0; - p->config_hardware_path[0] = 0; - if (cfgfile_load_2(p, filename, 0, type)) { - result = 1; - if (description) - _tcscpy(description, p->description); - if (hostlink) - _tcscpy(hostlink, p->config_host_path); - if (hardwarelink) - _tcscpy(hardwarelink, p->config_hardware_path); - } - xfree(p); - return result; + p->description[0] = 0; + if (cfgfile_load_2 (p, filename, 0, 0)) { + result = 1; + if (description) + _tcscpy (description, p->description); + } + xfree (p); + return result; } int cfgfile_configuration_change(int v) { - static int mode; - if (v >= 0) - mode = v; - return mode; + static int mode; + if (v >= 0) + mode = v; + return mode; } -void cfgfile_show_usage(void) +static void parse_sound_spec (struct uae_prefs *p, const TCHAR *spec) { - int i; - write_log(_T("UAE Configuration Help:\n") \ - _T("=======================\n")); - for (i = 0; i < sizeof opttable / sizeof *opttable; i++) - write_log(_T("%s: %s\n"), opttable[i].config_label, opttable[i].config_help); + TCHAR *x0 = my_strdup (spec); + TCHAR *x1, *x2 = NULL, *x3 = NULL, *x4 = NULL, *x5 = NULL; + + x1 = _tcschr (x0, ':'); + if (x1 != NULL) { + *x1++ = '\0'; + x2 = _tcschr (x1 + 1, ':'); + if (x2 != NULL) { + *x2++ = '\0'; + x3 = _tcschr (x2 + 1, ':'); + if (x3 != NULL) { + *x3++ = '\0'; + x4 = _tcschr (x3 + 1, ':'); + if (x4 != NULL) { + *x4++ = '\0'; + x5 = _tcschr (x4 + 1, ':'); + } + } + } + } + p->produce_sound = _tstoi (x0); + if (x1) { + p->sound_stereo_separation = 0; + if (*x1 == 'S') { + p->sound_stereo = SND_STEREO; + p->sound_stereo_separation = 7; + } else if (*x1 == 's') + p->sound_stereo = SND_STEREO; + else + p->sound_stereo = SND_MONO; + } + if (x3) + p->sound_freq = _tstoi (x3); + free (x0); } -/* This implements the old commandline option parsing. I've re-added this -because the new way of doing things is painful for me (it requires me -to type a couple hundred characters when invoking UAE). The following -is far less annoying to use. */ -static void parse_gfx_specs(struct uae_prefs *p, const TCHAR *spec) -{ - TCHAR *x0 = my_strdup(spec); - TCHAR *x1, *x2; - - x1 = _tcschr(x0, ':'); - if (x1 == 0) - goto argh; - x2 = _tcschr(x1 + 1, ':'); - if (x2 == 0) - goto argh; - *x1++ = 0; *x2++ = 0; - - p->gfx_size_win.width = p->gfx_size_fs.width = _tstoi(x0); - p->gfx_size_win.height = p->gfx_size_fs.height = _tstoi(x1); - p->gfx_resolution = _tcschr(x2, 'l') != 0 ? 1 : 0; - p->gfx_xcenter = _tcschr(x2, 'x') != 0 ? 1 : _tcschr(x2, 'X') != 0 ? 2 : 0; - p->gfx_ycenter = _tcschr(x2, 'y') != 0 ? 1 : _tcschr(x2, 'Y') != 0 ? 2 : 0; - p->gfx_vresolution = _tcschr(x2, 'd') != 0 ? VRES_DOUBLE : VRES_NONDOUBLE; - p->gfx_pscanlines = _tcschr(x2, 'D') != 0; - if (p->gfx_pscanlines) - p->gfx_vresolution = VRES_DOUBLE; - p->gfx_apmode[0].gfx_fullscreen = _tcschr(x2, 'a') != 0; - p->gfx_apmode[1].gfx_fullscreen = _tcschr(x2, 'p') != 0; - - free(x0); - return; - -argh: - write_log(_T("Bad display mode specification.\n")); - write_log(_T("The format to use is: \"width:height:modifiers\"\n")); - write_log(_T("Type \"uae -h\" for detailed help.\n")); - free(x0); -} - -static void parse_sound_spec(struct uae_prefs *p, const TCHAR *spec) -{ - TCHAR *x0 = my_strdup(spec); - TCHAR *x1, *x2 = NULL, *x3 = NULL, *x4 = NULL, *x5 = NULL; - - x1 = _tcschr(x0, ':'); - if (x1 != NULL) { - *x1++ = '\0'; - x2 = _tcschr(x1 + 1, ':'); - if (x2 != NULL) { - *x2++ = '\0'; - x3 = _tcschr(x2 + 1, ':'); - if (x3 != NULL) { - *x3++ = '\0'; - x4 = _tcschr(x3 + 1, ':'); - if (x4 != NULL) { - *x4++ = '\0'; - x5 = _tcschr(x4 + 1, ':'); - } - } - } - } - p->produce_sound = _tstoi(x0); - if (x1) { - p->sound_stereo_separation = 0; - if (*x1 == 'S') { - p->sound_stereo = SND_STEREO; - p->sound_stereo_separation = 7; - } - else if (*x1 == 's') - p->sound_stereo = SND_STEREO; - else - p->sound_stereo = SND_MONO; - } - if (x3) - p->sound_freq = _tstoi(x3); - if (x4) - p->sound_maxbsiz = _tstoi(x4); - free(x0); -} - -static void parse_joy_spec(struct uae_prefs *p, const TCHAR *spec) +static void parse_joy_spec (struct uae_prefs *p, const TCHAR *spec) { int v0 = 2, v1 = 0; if (_tcslen(spec) != 2) @@ -6096,8 +4078,8 @@ static void parse_joy_spec(struct uae_prefs *p, const TCHAR *spec) goto bad; /* Let's scare Pascal programmers */ if (0) - bad: - write_log(_T("Bad joystick mode specification. Use -J xy, where x and y\n") +bad: + write_log (_T("Bad joystick mode specification. Use -J xy, where x and y\n") _T("can be 0 for joystick 0, 1 for joystick 1, M for mouse, and\n") _T("a, b or c for different keyboard settings.\n")); @@ -6105,263 +4087,236 @@ static void parse_joy_spec(struct uae_prefs *p, const TCHAR *spec) p->jports[1].id = v1; } -static void parse_filesys_spec(struct uae_prefs *p, bool readonly, const TCHAR *spec) +static void parse_filesys_spec (struct uae_prefs *p, bool readonly, const TCHAR *spec) { struct uaedev_config_info uci; - TCHAR buf[256]; - TCHAR *s2; + TCHAR buf[256]; + TCHAR *s2; - uci_set_defaults(&uci, false); - _tcsncpy(buf, spec, 255); buf[255] = 0; - s2 = _tcschr(buf, ':'); - if (s2) { - *s2++ = '\0'; + uci_set_defaults (&uci, false); + _tcsncpy (buf, spec, 255); buf[255] = 0; + s2 = _tcschr (buf, ':'); + if (s2) { + *s2++ = '\0'; #ifdef __DOS__ - { - TCHAR *tmp; + { + TCHAR *tmp; - while ((tmp = _tcschr(s2, '\\'))) - *tmp = '/'; - } + while ((tmp = _tcschr (s2, '\\'))) + *tmp = '/'; + } #endif #ifdef FILESYS - _tcscpy(uci.volname, buf); - _tcscpy(uci.rootdir, s2); + _tcscpy (uci.volname, buf); + _tcscpy (uci.rootdir, s2); uci.readonly = readonly; uci.type = UAEDEV_DIR; - add_filesys_config(p, -1, &uci); + add_filesys_config (p, -1, &uci); #endif - } - else { - write_log(_T("Usage: [-m | -M] VOLNAME:mount_point\n")); - } + } else { + write_log (_T("Usage: [-m | -M] VOLNAME:mount_point\n")); + } } -static void parse_hardfile_spec(struct uae_prefs *p, const TCHAR *spec) +static void parse_hardfile_spec (struct uae_prefs *p, const TCHAR *spec) { struct uaedev_config_info uci; - TCHAR *x0 = my_strdup(spec); - TCHAR *x1, *x2, *x3, *x4; + TCHAR *x0 = my_strdup (spec); + TCHAR *x1, *x2, *x3, *x4; - uci_set_defaults(&uci, false); - x1 = _tcschr(x0, ':'); - if (x1 == NULL) - goto argh; - *x1++ = '\0'; - x2 = _tcschr(x1 + 1, ':'); - if (x2 == NULL) - goto argh; - *x2++ = '\0'; - x3 = _tcschr(x2 + 1, ':'); - if (x3 == NULL) - goto argh; - *x3++ = '\0'; - x4 = _tcschr(x3 + 1, ':'); - if (x4 == NULL) - goto argh; - *x4++ = '\0'; + uci_set_defaults (&uci, false); + x1 = _tcschr (x0, ':'); + if (x1 == NULL) + goto argh; + *x1++ = '\0'; + x2 = _tcschr (x1 + 1, ':'); + if (x2 == NULL) + goto argh; + *x2++ = '\0'; + x3 = _tcschr (x2 + 1, ':'); + if (x3 == NULL) + goto argh; + *x3++ = '\0'; + x4 = _tcschr (x3 + 1, ':'); + if (x4 == NULL) + goto argh; + *x4++ = '\0'; #ifdef FILESYS - _tcscpy(uci.rootdir, x4); + _tcscpy (uci.rootdir, x4); //add_filesys_config (p, -1, NULL, NULL, x4, 0, 0, _tstoi (x0), _tstoi (x1), _tstoi (x2), _tstoi (x3), 0, 0, 0, 0, 0, 0, 0); #endif - free(x0); - return; + free (x0); + return; -argh: - free(x0); - write_log(_T("Bad hardfile parameter specified - type \"uae -h\" for help.\n")); - return; + argh: + free (x0); + cfgfile_warning(_T("Bad hardfile parameter specified\n")); + return; } -static void parse_cpu_specs(struct uae_prefs *p, const TCHAR *spec) +static void parse_cpu_specs (struct uae_prefs *p, const TCHAR *spec) { - if (*spec < '0' || *spec > '4') { - write_log(_T("CPU parameter string must begin with '0', '1', '2', '3' or '4'.\n")); - return; - } + if (*spec < '0' || *spec > '4') { + cfgfile_warning(_T("CPU parameter string must begin with '0', '1', '2', '3' or '4'.\n")); + return; + } - p->cpu_model = (*spec++) * 10 + 68000; - p->address_space_24 = p->cpu_model < 68020; - p->cpu_compatible = 0; - while (*spec != '\0') { - switch (*spec) { - case 'a': - if (p->cpu_model < 68020) - write_log(_T("In 68000/68010 emulation, the address space is always 24 bit.\n")); - else if (p->cpu_model >= 68040) - write_log(_T("In 68040/060 emulation, the address space is always 32 bit.\n")); - else - p->address_space_24 = 1; - break; - case 'c': - if (p->cpu_model != 68000) - write_log(_T("The more compatible CPU emulation is only available for 68000\n") - _T("emulation, not for 68010 upwards.\n")); - else - p->cpu_compatible = 1; - break; - default: - write_log(_T("Bad CPU parameter specified - type \"uae -h\" for help.\n")); - break; - } - spec++; - } + p->cpu_model = (*spec++) * 10 + 68000; + p->address_space_24 = p->cpu_model < 68020; + p->cpu_compatible = 0; + while (*spec != '\0') { + switch (*spec) { + case 'a': + if (p->cpu_model < 68020) + cfgfile_warning(_T("In 68000/68010 emulation, the address space is always 24 bit.\n")); + else if (p->cpu_model >= 68040) + cfgfile_warning(_T("In 68040/060 emulation, the address space is always 32 bit.\n")); + else + p->address_space_24 = 1; + break; + case 'c': + if (p->cpu_model != 68000) + cfgfile_warning(_T("The more compatible CPU emulation is only available for 68000\n") + _T("emulation, not for 68010 upwards.\n")); + else + p->cpu_compatible = 1; + break; + default: + cfgfile_warning(_T("Bad CPU parameter specified.\n")); + break; + } + spec++; + } } -static void cmdpath(TCHAR *dst, const TCHAR *src, int maxsz) +static void cmdpath (TCHAR *dst, const TCHAR *src, int maxsz) { - TCHAR *s = target_expand_environment(src); - _tcsncpy(dst, s, maxsz); + TCHAR *s = target_expand_environment (src, NULL, 0); + _tcsncpy (dst, s, maxsz); dst[maxsz] = 0; - xfree(s); + xfree (s); } /* Returns the number of args used up (0 or 1). */ -int parse_cmdline_option(struct uae_prefs *p, TCHAR c, const TCHAR *arg) +int parse_cmdline_option (struct uae_prefs *p, TCHAR c, const TCHAR *arg) { - struct strlist *u = xcalloc(struct strlist, 1); + struct strlist *u = xcalloc (struct strlist, 1); const TCHAR arg_required[] = _T("0123rKpImWSAJwNCZUFcblOdHRv"); - if (_tcschr(arg_required, c) && !arg) { - write_log(_T("Missing argument for option `-%c'!\n"), c); - return 0; - } + if (_tcschr (arg_required, c) && ! arg) { + write_log (_T("Missing argument for option `-%c'!\n"), c); + return 0; + } - u->option = xmalloc(TCHAR, 2); - u->option[0] = c; - u->option[1] = 0; - u->value = my_strdup(arg); - u->next = p->all_lines; - p->all_lines = u; + u->option = xmalloc (TCHAR, 2); + u->option[0] = c; + u->option[1] = 0; + if (arg) + u->value = my_strdup(arg); + u->next = p->all_lines; + p->all_lines = u; - switch (c) { - case 'h': usage(); exit(0); + switch (c) { + case '0': cmdpath (p->floppyslots[0].df, arg, 255); break; + case '1': cmdpath (p->floppyslots[1].df, arg, 255); break; + case '2': cmdpath (p->floppyslots[2].df, arg, 255); break; + case '3': cmdpath (p->floppyslots[3].df, arg, 255); break; + case 'r': cmdpath (p->romfile, arg, 255); break; + case 'K': cmdpath (p->romextfile, arg, 255); break; + case 'm': case 'M': parse_filesys_spec (p, c == 'M', arg); break; + case 'W': parse_hardfile_spec (p, arg); break; + case 'S': parse_sound_spec (p, arg); break; + case 'R': p->gfx_framerate = _tstoi (arg); break; + case 'J': parse_joy_spec (p, arg); break; - case '0': cmdpath(p->floppyslots[0].df, arg, 255); break; - case '1': cmdpath(p->floppyslots[1].df, arg, 255); break; - case '2': cmdpath(p->floppyslots[2].df, arg, 255); break; - case '3': cmdpath(p->floppyslots[3].df, arg, 255); break; - case 'r': cmdpath(p->romfile, arg, 255); break; - case 'K': cmdpath(p->romextfile, arg, 255); break; - case 'p': _tcsncpy(p->prtname, arg, 255); p->prtname[255] = 0; break; - /* case 'I': _tcsncpy (p->sername, arg, 255); p->sername[255] = 0; currprefs.use_serial = 1; break; */ - case 'm': case 'M': parse_filesys_spec(p, c == 'M', arg); break; - case 'W': parse_hardfile_spec(p, arg); break; - case 'S': parse_sound_spec(p, arg); break; - case 'R': p->gfx_framerate = _tstoi(arg); break; - case 'i': p->illegal_mem = 1; break; - case 'J': parse_joy_spec(p, arg); break; + case 'w': p->m68k_speed = _tstoi (arg); break; - case 'w': p->m68k_speed = _tstoi(arg); break; + case 'G': p->start_gui = 0; break; - /* case 'g': p->use_gfxlib = 1; break; */ - case 'G': p->start_gui = 0; break; - case 'D': p->start_debugger = 1; break; + case 'n': + if (_tcschr (arg, 'i') != 0) + p->immediate_blits = 1; + break; - case 'n': - if (_tcschr(arg, 'i') != 0) - p->immediate_blits = 1; - break; + case 'v': + set_chipset_mask (p, _tstoi (arg)); + break; - case 'v': - set_chipset_mask(p, _tstoi(arg)); - break; + case 'C': + parse_cpu_specs (p, arg); + break; - case 'C': - parse_cpu_specs(p, arg); - break; + case 'Z': + p->z3fastmem[0].size = _tstoi (arg) * 0x100000; + break; - case 'Z': - p->z3fastmem[0].size = _tstoi(arg) * 0x100000; - break; + case 'U': + p->rtgboards[0].rtgmem_size = _tstoi (arg) * 0x100000; + break; - case 'U': - p->rtgboards[0].rtgmem_size = _tstoi(arg) * 0x100000; - break; + case 'F': + p->fastmem[0].size = _tstoi (arg) * 0x100000; + break; - case 'F': - p->fastmem[0].size = _tstoi(arg) * 0x100000; - break; + case 'b': + p->bogomem_size = _tstoi (arg) * 0x40000; + break; - case 'b': - p->bogomem_size = _tstoi(arg) * 0x40000; - break; + case 'c': + p->chipmem_size = _tstoi (arg) * 0x80000; + break; - case 'c': - p->chipmem_size = _tstoi(arg) * 0x80000; - break; + case 'l': + if (0 == _tcsicmp(arg, _T("de"))) + p->keyboard_lang = KBD_LANG_DE; + else if (0 == _tcsicmp(arg, _T("dk"))) + p->keyboard_lang = KBD_LANG_DK; + else if (0 == _tcsicmp(arg, _T("us"))) + p->keyboard_lang = KBD_LANG_US; + else if (0 == _tcsicmp(arg, _T("se"))) + p->keyboard_lang = KBD_LANG_SE; + else if (0 == _tcsicmp(arg, _T("fr"))) + p->keyboard_lang = KBD_LANG_FR; + else if (0 == _tcsicmp(arg, _T("it"))) + p->keyboard_lang = KBD_LANG_IT; + else if (0 == _tcsicmp(arg, _T("es"))) + p->keyboard_lang = KBD_LANG_ES; + break; - //case 'l': - // if (0 == strcasecmp(arg, _T("de"))) - // p->keyboard_lang = KBD_LANG_DE; - // else if (0 == strcasecmp(arg, _T("dk"))) - // p->keyboard_lang = KBD_LANG_DK; - // else if (0 == strcasecmp(arg, _T("us"))) - // p->keyboard_lang = KBD_LANG_US; - // else if (0 == strcasecmp(arg, _T("se"))) - // p->keyboard_lang = KBD_LANG_SE; - // else if (0 == strcasecmp(arg, _T("fr"))) - // p->keyboard_lang = KBD_LANG_FR; - // else if (0 == strcasecmp(arg, _T("it"))) - // p->keyboard_lang = KBD_LANG_IT; - // else if (0 == strcasecmp(arg, _T("es"))) - // p->keyboard_lang = KBD_LANG_ES; - // break; - - case 'O': parse_gfx_specs(p, arg); break; - case 'd': - if (_tcschr(arg, 'S') != NULL || _tcschr(arg, 's')) { - write_log(_T(" Serial on demand.\n")); - p->serial_demand = 1; - } - if (_tcschr(arg, 'P') != NULL || _tcschr(arg, 'p')) { - write_log(_T(" Parallel on demand.\n")); - p->parallel_demand = 1; - } - - break; - - case 'H': - p->color_mode = _tstoi(arg); - if (p->color_mode < 0) { - write_log(_T("Bad color mode selected. Using default.\n")); - p->color_mode = 0; - } - break; - default: - write_log(_T("Unknown option `-%c'!\n"), c); - break; - } - return !!_tcschr(arg_required, c); + default: + write_log (_T("Unknown option `-%c'!\n"), c); + break; + } + return !! _tcschr (arg_required, c); } -void cfgfile_addcfgparam(TCHAR *line) +void cfgfile_addcfgparam (TCHAR *line) { - struct strlist *u; - TCHAR line1b[CONFIG_BLEN], line2b[CONFIG_BLEN]; + struct strlist *u; + TCHAR line1b[CONFIG_BLEN], line2b[CONFIG_BLEN]; - if (!line) { - struct strlist **ps = &temp_lines; - while (*ps) { - struct strlist *s = *ps; - *ps = s->next; - xfree(s->value); - xfree(s->option); - xfree(s); - } - temp_lines = 0; - return; - } - if (!cfgfile_separate_line(line, line1b, line2b)) - return; - u = xcalloc(struct strlist, 1); - u->option = my_strdup(line1b); - u->value = my_strdup(line2b); - u->next = temp_lines; - temp_lines = u; + if (!line) { + struct strlist **ps = &temp_lines; + while (*ps) { + struct strlist *s = *ps; + *ps = s->next; + xfree (s->value); + xfree (s->option); + xfree (s); + } + temp_lines = 0; + return; + } + if (!cfgfile_separate_line (line, line1b, line2b)) + return; + u = xcalloc (struct strlist, 1); + u->option = my_strdup(line1b); + u->value = my_strdup(line2b); + u->next = temp_lines; + temp_lines = u; } -int cmdlineparser(const TCHAR *s, TCHAR *outp[], int max) +static int cmdlineparser (const TCHAR *s, TCHAR *outp[], int max) { int j, cnt = 0; int slash = 0; @@ -6386,8 +4341,7 @@ int cmdlineparser(const TCHAR *s, TCHAR *outp[], int max) if (quote) { quote = 0; doout = 1; - } - else { + } else { quote = 1; j = -1; } @@ -6402,8 +4356,8 @@ int cmdlineparser(const TCHAR *s, TCHAR *outp[], int max) j++; } if (doout) { - if (_tcslen(tmp1) > 0) { - outp[cnt++] = my_strdup(tmp1); + if (_tcslen (tmp1) > 0) { + outp[cnt++] = my_strdup (tmp1); outp[cnt] = 0; } tmp1[0] = 0; @@ -6413,7 +4367,7 @@ int cmdlineparser(const TCHAR *s, TCHAR *outp[], int max) slash = 0; } if (j > 0 && cnt < max) { - outp[cnt++] = my_strdup(tmp1); + outp[cnt++] = my_strdup (tmp1); outp[cnt] = 0; } return cnt; @@ -6421,16 +4375,16 @@ int cmdlineparser(const TCHAR *s, TCHAR *outp[], int max) #define UAELIB_MAX_PARSE 100 -static bool cfgfile_parse_uaelib_option(struct uae_prefs* p, TCHAR* option, TCHAR* value, int type) +static bool cfgfile_parse_uaelib_option (struct uae_prefs *p, TCHAR *option, TCHAR *value, int type) { return false; } -int cfgfile_searchconfig(const TCHAR *in, int index, TCHAR *out, int outsize) +static int cfgfile_searchconfig(const TCHAR *in, int index, TCHAR *out, int outsize) { TCHAR tmp[CONFIG_BLEN]; int j = 0; - int inlen = _tcslen(in); + int inlen = _tcslen (in); int joker = 0; uae_u32 err = 0; bool configsearchfound = false; @@ -6452,14 +4406,14 @@ int cfgfile_searchconfig(const TCHAR *in, int index, TCHAR *out, int outsize) for (;;) { uae_u8 b = 0; - if (zfile_fread(&b, 1, 1, configstore) != 1) { + if (zfile_fread (&b, 1, 1, configstore) != 1) { err = 10; if (configsearchfound) err = 0; goto end; } - if (j >= sizeof(tmp) / sizeof(TCHAR) - 1) - j = sizeof(tmp) / sizeof(TCHAR) - 1; + if (j >= sizeof (tmp) / sizeof (TCHAR) - 1) + j = sizeof (tmp) / sizeof (TCHAR) - 1; if (b == 0) { err = 10; if (configsearchfound) @@ -6467,12 +4421,12 @@ int cfgfile_searchconfig(const TCHAR *in, int index, TCHAR *out, int outsize) goto end; } if (b == '\n') { - if (!_tcsncmp(tmp, in, inlen) && ((inlen > 0 && _tcslen(tmp) > inlen && tmp[inlen] == '=') || (joker))) { + if (!_tcsncmp (tmp, in, inlen) && ((inlen > 0 && _tcslen (tmp) > inlen && tmp[inlen] == '=') || (joker))) { TCHAR *p; if (joker) p = tmp - 1; else - p = _tcschr(tmp, '='); + p = _tcschr (tmp, '='); if (p) { for (int i = 0; out && i < outsize - 1; i++) { TCHAR b = *++p; @@ -6487,8 +4441,7 @@ int cfgfile_searchconfig(const TCHAR *in, int index, TCHAR *out, int outsize) goto end; } j = 0; - } - else { + } else { tmp[j++] = b; tmp[j] = 0; } @@ -6497,13 +4450,12 @@ end: return err; } -uae_u32 cfgfile_modify(uae_u32 index, const TCHAR *parms, uae_u32 size, TCHAR *out, uae_u32 outsize) +uae_u32 cfgfile_modify (uae_u32 index, const TCHAR *parms, uae_u32 size, TCHAR *out, uae_u32 outsize) { TCHAR *p; TCHAR *argc[UAELIB_MAX_PARSE]; int argv, i; uae_u32 err; - TCHAR zero = 0; static TCHAR *configsearch; *out = 0; @@ -6516,13 +4468,13 @@ uae_u32 cfgfile_modify(uae_u32 index, const TCHAR *parms, uae_u32 size, TCHAR *o goto end; } if (configsearch) { - err = cfgfile_searchconfig(configsearch, index, out, outsize); + err = cfgfile_searchconfig(configsearch, index, out, outsize); goto end; } err = 0xffffffff; for (i = 0; out && i < outsize - 1; i++) { uae_u8 b = 0; - if (zfile_fread(&b, 1, 1, configstore) != 1) + if (zfile_fread (&b, 1, 1, configstore) != 1) err = 0; if (b == 0) err = 0; @@ -6538,44 +4490,41 @@ uae_u32 cfgfile_modify(uae_u32 index, const TCHAR *parms, uae_u32 size, TCHAR *o if (size > 10000) return 10; - argv = cmdlineparser(parms, argc, UAELIB_MAX_PARSE); + argv = cmdlineparser (parms, argc, UAELIB_MAX_PARSE); if (argv <= 1 && index == 0xffffffff) { - createconfigstore(&currprefs); - xfree(configsearch); + createconfigstore (&currprefs); + xfree (configsearch); configsearch = NULL; if (!configstore) { err = 20; goto end; } - if (argv > 0 && _tcslen(argc[0]) > 0) - configsearch = my_strdup(argc[0]); + if (argv > 0 && _tcslen (argc[0]) > 0) + configsearch = my_strdup (argc[0]); err = 0xffffffff; goto end; } for (i = 0; i < argv; i++) { if (i + 2 <= argv) { - if (!_tcsicmp(argc[i], _T("dbg"))) { - //debug_parser(argc[i + 1], out, outsize); - } - else if (!inputdevice_uaelib(argc[i], argc[i + 1])) { - if (!cfgfile_parse_uaelib_option(&changed_prefs, argc[i], argc[i + 1], 0)) { - if (!cfgfile_parse_option(&changed_prefs, argc[i], argc[i + 1], 0)) { + if (!inputdevice_uaelib (argc[i], argc[i + 1])) { + if (!cfgfile_parse_uaelib_option (&changed_prefs, argc[i], argc[i + 1], 0)) { + if (!cfgfile_parse_option (&changed_prefs, argc[i], argc[i + 1], 0)) { err = 5; break; } } } - set_config_changed(); - set_special(SPCFLAG_MODE_CHANGE); + set_config_changed (); + set_special (SPCFLAG_MODE_CHANGE); i++; } } end: for (i = 0; i < argv; i++) - xfree(argc[i]); - xfree(p); + xfree (argc[i]); + xfree (p); return err; } @@ -6586,18 +4535,18 @@ uae_u32 cfgfile_uaelib_modify(TrapContext *ctx, uae_u32 index, uae_u32 parms, ua TCHAR *out_p = NULL, *parms_in = NULL; if (out) - put_byte(out, 0); + trap_put_byte(ctx, out, 0); if (size == 0) { - while (get_byte(parms + size) != 0) + while (trap_get_byte(ctx, parms + size) != 0) size++; } - parms_p = xmalloc(uae_char, size + 1); + parms_p = xmalloc (uae_char, size + 1); if (!parms_p) { ret = 10; goto end; } if (out) { - out_p = xmalloc(TCHAR, outsize + 1); + out_p = xmalloc (TCHAR, outsize + 1); if (!out_p) { ret = 10; goto end; @@ -6606,39 +4555,30 @@ uae_u32 cfgfile_uaelib_modify(TrapContext *ctx, uae_u32 index, uae_u32 parms, ua } p = parms_p; for (i = 0; i < size; i++) { - p[i] = get_byte(parms + i); + p[i] = trap_get_byte(ctx, parms + i); if (p[i] == 10 || p[i] == 13 || p[i] == 0) break; } p[i] = 0; - parms_in = au(parms_p); - ret = cfgfile_modify(index, parms_in, size, out_p, outsize); - xfree(parms_in); + parms_in = au (parms_p); + ret = cfgfile_modify (index, parms_in, size, out_p, outsize); + xfree (parms_in); if (out) { - parms_out = ua(out_p); - int len = 0; - uae_u8 *haddr = (uae_u8*)parms_out; - for (;;) { - uae_u8 v = *haddr++; - put_byte(out, v); - out++; - if (!v) - break; - len++; - } + parms_out = ua (out_p); + trap_put_string(ctx, parms_out, out, outsize - 1); } - xfree(parms_out); + xfree (parms_out); end: - xfree(out_p); - xfree(parms_p); + xfree (out_p); + xfree (parms_p); return ret; } -static const TCHAR *cfgfile_read_config_value(const TCHAR *option) +static const TCHAR *cfgfile_read_config_value (const TCHAR *option) { struct strlist *sl; for (sl = currprefs.all_lines; sl; sl = sl->next) { - if (sl->option && !strcasecmp(sl->option, option)) + if (sl->option && !_tcsicmp (sl->option, option)) return sl->value; } return NULL; @@ -6652,17 +4592,7 @@ uae_u32 cfgfile_uaelib(TrapContext *ctx, int mode, uae_u32 name, uae_u32 dst, ua if (mode) return 0; - int len = 0; - uae_u8 *haddr = (uae_u8*)tmpa; - for (;;) { - uae_u8 v = *haddr++; - put_byte(name, v); - name++; - if (!v) - break; - len++; - } - + trap_get_string(ctx, tmpa, name, sizeof tmpa); str = au(tmpa); if (str[0] == 0) { xfree(str); @@ -6671,125 +4601,33 @@ uae_u32 cfgfile_uaelib(TrapContext *ctx, int mode, uae_u32 name, uae_u32 dst, ua const TCHAR *value = cfgfile_read_config_value(str); xfree(str); if (value) { - char *s = ua(value); - - len = 0; - haddr = (uae_u8*)s; - for (;;) { - uae_u8 v = *haddr++; - put_byte(dst, v); - dst++; - if (!v) - break; - len++; - } - - xfree(s); + char *s = ua (value); + trap_put_string(ctx, s, dst, maxlen); + xfree (s); return dst; } return 0; } -uae_u8 *restore_configuration(uae_u8 *src) -{ - TCHAR *s = au(reinterpret_cast(src)); - //write_log (s); - xfree(s); - src += strlen(reinterpret_cast(src)) + 1; - return src; -} - -uae_u8 *save_configuration(int *len, bool fullconfig) -{ - int tmpsize = 100000; - uae_u8 *dstbak, *dst, *p; - int index = -1; - - dstbak = dst = xcalloc(uae_u8, tmpsize); - p = dst; - for (;;) { - TCHAR tmpout[1000]; - int ret; - tmpout[0] = 0; - ret = cfgfile_modify(index, _T("*"), 1, tmpout, sizeof(tmpout) / sizeof(TCHAR)); - index++; - if (_tcslen(tmpout) > 0) { - char *out; - if (!fullconfig && !_tcsncmp(tmpout, _T("input."), 6)) - continue; - //write_log (_T("'%s'\n"), tmpout); - out = uutf8(tmpout); - strcpy((char*)p, out); - xfree(out); - strcat((char*)p, "\n"); - p += strlen((char*)p); - if (p - dstbak >= tmpsize - sizeof(tmpout)) - break; - } - if (ret >= 0) - break; - } - *len = p - dstbak + 1; - return dstbak; -} - -#ifdef UAE_MINI -static void default_prefs_mini(struct uae_prefs *p, int type) -{ - _tcscpy(p->description, _T("UAE default A500 configuration")); - - p->nr_floppies = 1; - p->floppyslots[0].dfxtype = DRV_35_DD; - p->floppyslots[1].dfxtype = DRV_NONE; - p->cpu_model = 68000; - p->address_space_24 = 1; - p->chipmem_size = 0x00080000; - p->bogomem_size = 0x00080000; -} -#endif - #include "sounddep/sound.h" -void default_prefs(struct uae_prefs *p, bool reset, int type) +void default_prefs (struct uae_prefs *p, bool reset, int type) { - int i; int roms[] = { 6, 7, 8, 9, 10, 14, 5, 4, 3, 2, 1, -1 }; TCHAR zero = 0; - struct zfile *f; - //reset_inputdevice_config(p, reset); //TODO - reset_inputdevice_config(p); - - memset(p, 0, sizeof(*p)); + reset_inputdevice_config(p, reset); + memset(p, 0, sizeof(struct uae_prefs)); _tcscpy(p->description, _T("UAE default configuration")); - p->config_hardware_path[0] = 0; - p->config_host_path[0] = 0; - p->gfx_scandoubler = false; p->start_gui = true; - p->start_debugger = false; - p->all_lines = 0; - /* Note to porters: please don't change any of these options! UAE is supposed - * to behave identically on all platforms if possible. - * (TW says: maybe it is time to update default config..) */ - p->illegal_mem = 0; - p->use_serial = 0; - p->serial_demand = 0; - p->serial_hwctsrts = 1; - p->serial_stopbits = 0; - p->parallel_demand = 0; - p->parallel_matrix_emulation = 0; - p->parallel_postscript_emulation = 0; - p->parallel_postscript_detection = 0; - p->parallel_autoflush_time = 5; - p->ghostscript_parameters[0] = 0; - p->uae_hide = 0; - p->uae_hide_autoconfig = false; + p->all_lines = nullptr; + p->z3_mapping_mode = Z3MAPPING_AUTO; p->mountitems = 0; - for (i = 0; i < MOUNT_CONFIG_SIZE; i++) { + for (int i = 0; i < MOUNT_CONFIG_SIZE; i++) { p->mountconfig[i].configoffset = -1; p->mountconfig[i].unitnum = -1; } @@ -6798,212 +4636,90 @@ void default_prefs(struct uae_prefs *p, bool reset, int type) p->jports[1].id = -1; p->jports[2].id = -1; p->jports[3].id = -1; - //if (reset) { - // inputdevice_joyport_config_store(p, _T("mouse"), 0, -1, 0); - // inputdevice_joyport_config_store(p, _T("kbd1"), 1, -1, 0); - //} - - p->keyboard_connected = true; + if (reset) { + inputdevice_joyport_config_store(p, _T("mouse"), 0, -1, 0); + inputdevice_joyport_config_store(p, _T("joy1"), 1, -1, 0); + } + p->keyboard_lang = KBD_LANG_US; p->produce_sound = 3; p->sound_stereo = SND_STEREO; p->sound_stereo_separation = 7; p->sound_mixed_stereo_delay = 0; p->sound_freq = DEFAULT_SOUND_FREQ; - p->sound_maxbsiz = DEFAULT_SOUND_MAXB; - p->sound_interpol = 1; - p->sound_filter = FILTER_SOUND_EMUL; + p->sound_interpol = 0; + p->sound_filter = FILTER_SOUND_OFF; p->sound_filter_type = 0; - p->sound_auto = true; - p->sound_cdaudio = false; - p->sampler_stereo = false; - p->sampler_buffer = 0; - p->sampler_freq = 0; + p->sound_volume_cd = 20; - p->comptrustbyte = 0; - p->comptrustword = 0; - p->comptrustlong = 0; - p->comptrustnaddr = 0; - p->compnf = 1; - p->comp_hardflush = 0; - p->comp_constjump = 1; -#ifdef USE_JIT_FPU - p->compfpu = 1; -#else - p->compfpu = 0; -#endif - p->cachesize = DEFAULT_JIT_CACHE_SIZE; + p->cachesize = 0; - p->gfx_framerate = 1; - p->gfx_autoframerate = 50; - p->gfx_size_fs.width = 800; - p->gfx_size_fs.height = 600; - p->gfx_size_win.width = 720; - p->gfx_size_win.height = 568; - for (i = 0; i < 4; i++) { - p->gfx_size_fs_xtra[i].width = 0; - p->gfx_size_fs_xtra[i].height = 0; - p->gfx_size_win_xtra[i].width = 0; - p->gfx_size_win_xtra[i].height = 0; - } + p->gfx_framerate = 0; + + p->gfx_size.width = 640; //TODO: Default WinUAE prefs indicate this should be 720x568 + p->gfx_size.height = 256; p->gfx_resolution = RES_HIRES; -#ifndef AMIBERRY p->gfx_vresolution = VRES_DOUBLE; - p->gfx_iscanlines = 1; -#else - p->gfx_vresolution = VRES_NONDOUBLE; - p->gfx_iscanlines = 0; -#endif - p->gfx_apmode[0].gfx_fullscreen = GFX_WINDOW; - p->gfx_apmode[1].gfx_fullscreen = GFX_WINDOW; - p->gfx_xcenter = 0; p->gfx_ycenter = 0; - p->gfx_xcenter_pos = -1; - p->gfx_ycenter_pos = -1; - p->gfx_xcenter_size = -1; - p->gfx_ycenter_size = -1; - p->gfx_max_horizontal = RES_HIRES; - p->gfx_max_vertical = VRES_DOUBLE; - p->gfx_autoresolution_minv = 0; - p->gfx_autoresolution_minh = 0; - p->color_mode = 2; - p->gfx_blackerthanblack = 0; - p->gfx_autoresolution_vga = true; - p->gfx_apmode[0].gfx_backbuffers = 2; - p->gfx_apmode[1].gfx_backbuffers = 1; p->immediate_blits = false; p->waiting_blits = 0; + p->chipset_refreshrate = 50; p->collision_level = 2; p->leds_on_screen = 0; - p->leds_on_screen_mask[0] = p->leds_on_screen_mask[1] = (1 << LED_MAX) - 1; - p->keyboard_leds_in_use = 0; - p->keyboard_leds[0] = p->keyboard_leds[1] = p->keyboard_leds[2] = 0; - p->scsi = 0; - p->uaeserial = false; - p->cpu_idle = 0; - p->turbo_emulation = 0; - p->turbo_emulation_limit = 0; - p->headless = 0; - p->catweasel = 0; - p->tod_hack = 0; - p->maprom = 0; p->boot_rom = 0; - p->filesys_no_uaefsdb = 0; - p->filesys_custom_uaefsdb = 1; - p->picasso96_nocustom = 1; + p->cart_internal = 1; - p->sana2 = false; - p->clipboard_sharing = false; - p->native_code = false; p->cs_compatible = CP_GENERIC; p->cs_rtc = 2; - p->cs_df0idhw = 1; - p->cs_a1000ram = 0; + p->cs_df0idhw = true; p->cs_fatgaryrev = -1; p->cs_ramseyrev = -1; - p->cs_agnusrev = -1; - p->cs_deniserev = -1; - p->cs_mbdmac = 0; p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = p->cs_cd32fmv = false; p->cs_cd32nvram_size = 1024; - p->cs_cdtvcd = p->cs_cdtvram = false; - p->cs_cdtvcard = 0; - p->cs_pcmcia = 0; - p->cs_ksmirror_e0 = 1; - p->cs_ksmirror_a8 = 0; - p->cs_ciaoverlay = 1; + p->cs_pcmcia = false; + p->cs_ksmirror_e0 = true; + p->cs_ksmirror_a8 = false; + p->cs_ciaoverlay = true; p->cs_ciaatod = 0; - p->cs_df0idhw = 1; - p->cs_slowmemisfast = 0; - p->cs_resetwarning = 1; + p->cs_df0idhw = true; p->cs_ciatodbug = false; - p->cs_color_burst = false; - for (int i = APMODE_NATIVE; i <= APMODE_RTG; i++) { - struct gfx_filterdata *f = &p->gf[i]; - f->gfx_filter = 0; - f->gfx_filter_scanlineratio = (1 << 4) | 1; - for (int j = 0; j <= 2 * MAX_FILTERSHADERS; j++) { - f->gfx_filtershader[i][0] = 0; - f->gfx_filtermask[i][0] = 0; - } - f->gfx_filter_horiz_zoom_mult = 1.0; - f->gfx_filter_vert_zoom_mult = 1.0; - f->gfx_filter_bilinear = 0; - f->gfx_filter_filtermode = 0; - f->gfx_filter_keep_aspect = 0; - f->gfx_filter_autoscale = AUTOSCALE_STATIC_AUTO; - f->gfx_filter_keep_autoscale_aspect = false; - f->gfx_filteroverlay_overscan = 0; - } - - p->rtg_horiz_zoom_mult = 1.0; - p->rtg_vert_zoom_mult = 1.0; - - _tcscpy(p->floppyslots[0].df, _T("df0.adf")); - _tcscpy(p->floppyslots[1].df, _T("df1.adf")); - _tcscpy(p->floppyslots[2].df, _T("df2.adf")); - _tcscpy(p->floppyslots[3].df, _T("df3.adf")); - - for (int i = 0; i < MAX_LUA_STATES; i++) { - p->luafiles[i][0] = 0; - } + _tcscpy(p->floppyslots[0].df, _T("")); + _tcscpy(p->floppyslots[1].df, _T("")); + _tcscpy(p->floppyslots[2].df, _T("")); + _tcscpy(p->floppyslots[3].df, _T("")); configure_rom(p, roms, 0); _tcscpy(p->romextfile, _T("")); - _tcscpy(p->romextfile2, _T("")); - p->romextfile2addr = 0; _tcscpy(p->flashfile, _T("")); _tcscpy(p->cartfile, _T("")); - _tcscpy(p->rtcfile, _T("")); - _tcscpy(p->path_rom.path[0], _T("./")); - _tcscpy(p->path_floppy.path[0], _T("./")); - _tcscpy(p->path_hardfile.path[0], _T("./")); - - p->prtname[0] = 0; - p->sername[0] = 0; - - p->cpu_thread = false; + sprintf(p->path_rom, _T("%s/kickstarts/"), start_path_data); + sprintf(p->path_floppy, _T("%s/disks/"), start_path_data); + sprintf(p->path_hardfile, _T("%s/"), start_path_data); + sprintf(p->path_cd, _T("%s/cd32/"), start_path_data); p->fpu_model = 0; p->cpu_model = 68000; - p->m68k_speed_throttle = 0; - p->cpu_clock_multiplier = 0; - p->cpu_frequency = 0; - p->mmu_model = 0; - p->cpu060_revision = 6; - p->fpu_revision = 0; p->fpu_no_unimplemented = false; - p->int_no_unimplemented = false; p->fpu_strict = false; p->fpu_softfloat = false; p->m68k_speed = 0; -#ifndef AMIBERRY - p->cpu_compatible = true; -#else p->cpu_compatible = false; -#endif p->address_space_24 = true; - p->cpu_cycle_exact = false; - p->cpu_memory_cycle_exact = false; - p->blitter_cycle_exact = false; p->chipset_mask = CSMASK_ECS_AGNUS; - p->genlock = false; - p->genlock_image = 0; - p->genlock_mix = 0; - p->ntscmode = 0; + p->ntscmode = false; p->filesys_limit = 0; p->filesys_max_name = 107; - p->filesys_max_file_size = 0x7fffffff; + p->fastmem[0].size = 0x00000000; + p->mbresmem_low_size = 0x00000000; + p->mbresmem_high_size = 0x00000000; + p->z3fastmem[0].size = 0x00000000; p->z3autoconfig_start = 0x10000000; p->chipmem_size = 0x00080000; p->bogomem_size = 0x00080000; - for (int i = 0; i < MAX_RTG_BOARDS; i++) { - p->rtgboards[i].rtg_index = i; - } p->rtgboards[0].rtgmem_size = 0x00000000; p->rtgboards[0].rtgmem_type = GFXBOARD_UAE_Z3; p->custom_memory_addrs[0] = 0; @@ -7019,34 +4735,13 @@ void default_prefs(struct uae_prefs *p, bool reset, int type) p->floppyslots[3].dfxtype = DRV_NONE; p->floppy_speed = 100; p->floppy_write_length = 0; - p->floppy_random_bits_min = 1; - p->floppy_random_bits_max = 3; - p->dfxclickvolume_disk[0] = 33; - p->dfxclickvolume_disk[1] = 33; - p->dfxclickvolume_disk[2] = 33; - p->dfxclickvolume_disk[3] = 33; - p->dfxclickvolume_empty[0] = 33; - p->dfxclickvolume_empty[1] = 33; - p->dfxclickvolume_empty[2] = 33; - p->dfxclickvolume_empty[3] = 33; - p->dfxclickchannelmask = 0xffff; p->cd_speed = 100; - p->statecapturebuffersize = 100; - p->statecapturerate = 5 * 50; - p->inprec_autoplay = true; - -#ifdef UAE_MINI - default_prefs_mini(p, 0); -#endif + p->socket_emu = 0; p->input_tablet = TABLET_OFF; - p->tablet_library = false; - p->input_mouse_untrap = MOUSEUNTRAP_NONE; - p->input_magic_mouse_cursor = 0; inputdevice_default_prefs(p); - blkdev_default_prefs(p); p->cr_selected = -1; @@ -7062,7 +4757,6 @@ void default_prefs(struct uae_prefs *p, bool reset, int type) cr->vert = -1; cr->lace = -1; cr->vsync = -1; - cr->framelength = -1; cr->rate = 50.0; cr->ntsc = 0; cr->locked = false; @@ -7074,24 +4768,21 @@ void default_prefs(struct uae_prefs *p, bool reset, int type) cr->vert = -1; cr->lace = -1; cr->vsync = -1; - cr->framelength = -1; cr->rate = 60.0; cr->ntsc = 1; cr->locked = false; cr->inuse = true; _tcscpy(cr->label, _T("NTSC")); - p->lightboost_strobo = false; - p->lightboost_strobo_ratio = 50; - savestate_state = 0; target_default_options(p, type); zfile_fclose(default_file); - default_file = NULL; - f = zfile_fopen_empty(NULL, _T("configstore")); - if (f) { + default_file = nullptr; + struct zfile *f = zfile_fopen_empty(nullptr, _T("configstore")); + if (f) + { uaeconfig++; cfgfile_save_options(f, p, 0); uaeconfig--; @@ -7104,21 +4795,15 @@ static void buildin_default_prefs_68020(struct uae_prefs *p) { p->cpu_model = 68020; p->address_space_24 = 1; - p->cpu_compatible = 1; + p->cpu_compatible = 0; p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE | CSMASK_AGA; p->chipmem_size = 0x200000; p->bogomem_size = 0; p->m68k_speed = -1; } -static void buildin_default_host_prefs(struct uae_prefs *p) -{ -} - static void buildin_default_prefs(struct uae_prefs *p) { - buildin_default_host_prefs(p); - p->floppyslots[0].dfxtype = DRV_35_DD; if (p->nr_floppies != 1 && p->nr_floppies != 2) p->nr_floppies = 2; @@ -7129,84 +4814,54 @@ static void buildin_default_prefs(struct uae_prefs *p) p->fpu_model = 0; p->cpu_model = 68000; - p->cpu_clock_multiplier = 0; - p->cpu_frequency = 0; - p->cpu060_revision = 1; - p->fpu_revision = -1; p->m68k_speed = 0; - p->cpu_compatible = 1; - p->address_space_24 = 1; - p->cpu_cycle_exact = false; - p->cpu_memory_cycle_exact = false; - p->blitter_cycle_exact = false; + p->cpu_compatible = true; + p->address_space_24 = true; p->chipset_mask = CSMASK_ECS_AGNUS; p->immediate_blits = 0; p->waiting_blits = 0; p->collision_level = 2; if (p->produce_sound < 1) p->produce_sound = 1; - p->scsi = 0; - p->uaeserial = 0; - p->cpu_idle = 0; - p->turbo_emulation = 0; - p->turbo_emulation_limit = 0; - p->catweasel = 0; - p->tod_hack = 0; - p->maprom = 0; - p->cachesize = 0; - p->socket_emu = 0; - p->clipboard_sharing = false; - p->ppc_mode = 0; - p->ppc_model[0] = 0; - p->cpuboard_type = 0; - p->cpuboard_subtype = 0; + p->socket_emu = false; + p->sound_volume_cd = 0; p->chipmem_size = 0x00080000; p->bogomem_size = 0x00080000; - p->z3chipmem_size = 0; - for (int i = 0; i < MAX_RAM_BOARDS; i++) { + for (int i = 0; i < MAX_RAM_BOARDS; i++) + { memset(p->fastmem, 0, sizeof(struct ramboard)); memset(p->z3fastmem, 0, sizeof(struct ramboard)); } - for (int i = 0; i < MAX_RTG_BOARDS; i++) { + p->mbresmem_low_size = 0x00000000; + p->mbresmem_high_size = 0x00000000; + for (int i = 0; i < MAX_RTG_BOARDS; i++) + { p->rtgboards[i].rtgmem_size = 0x00000000; p->rtgboards[i].rtgmem_type = GFXBOARD_UAE_Z3; } - for (int i = 0; i < MAX_EXPANSION_BOARDS; i++) { + for (int i = 0; i < MAX_EXPANSION_BOARDS; i++) + { memset(&p->expansionboard[i], 0, sizeof(struct boardromconfig)); } p->cs_rtc = 0; - p->cs_a1000ram = false; p->cs_fatgaryrev = -1; p->cs_ramseyrev = -1; - p->cs_agnusrev = -1; - p->cs_deniserev = -1; - p->cs_mbdmac = 0; p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = p->cs_cd32fmv = false; - p->cs_cdtvcd = p->cs_cdtvram = p->cs_cdtvcard = false; p->cs_ide = 0; - p->cs_pcmcia = 0; - p->cs_ksmirror_e0 = 1; - p->cs_ksmirror_a8 = 0; - p->cs_ciaoverlay = 1; + p->cs_pcmcia = false; + p->cs_ksmirror_e0 = true; + p->cs_ksmirror_a8 = false; + p->cs_ciaoverlay = true; p->cs_ciaatod = 0; - p->cs_df0idhw = 1; - p->cs_resetwarning = 0; + p->cs_df0idhw = true; p->cs_ciatodbug = false; - p->cs_1mchipjumper = false; _tcscpy(p->romextfile, _T("")); - _tcscpy(p->romextfile2, _T("")); - - p->ne2000pciname[0] = 0; - p->ne2000pcmcianame[0] = 0; - p->a2065name[0] = 0; - - p->prtname[0] = 0; - p->sername[0] = 0; p->mountitems = 0; + p->leds_on_screen = 0; target_default_options(p, 1); cfgfile_compatibility_romtype(p); @@ -7217,38 +4872,19 @@ static void set_68020_compa(struct uae_prefs *p, int compa, int cd32) switch (compa) { case 0: - p->blitter_cycle_exact = 1; + p->cpu_compatible = 0; p->m68k_speed = 0; - if ((p->cpu_model == 68020 || p->cpu_model == 68030) && p->cachesize == 0) { - p->cpu_cycle_exact = 1; - p->cpu_memory_cycle_exact = true; - if (p->cpu_model == 68020) - p->cpu_clock_multiplier = 4 << 8; - else - p->cpu_clock_multiplier = 5 << 8; - } break; case 1: - p->blitter_cycle_exact = true; + p->cpu_compatible = 0; p->m68k_speed = 0; - if ((p->cpu_model == 68020 || p->cpu_model == 68030) && p->cachesize == 0) { - p->cpu_memory_cycle_exact = true; - if (p->cpu_model == 68020) - p->cpu_clock_multiplier = 4 << 8; - else - p->cpu_clock_multiplier = 5 << 8; - } break; case 2: - p->cpu_compatible = true; - p->m68k_speed = 0; - break; - case 3: p->cpu_compatible = 0; p->m68k_speed = -1; p->address_space_24 = 0; break; - case 4: + case 3: p->cpu_compatible = 0; p->address_space_24 = 0; p->cachesize = MAX_JIT_CACHE; @@ -7266,11 +4902,9 @@ static void set_68020_compa(struct uae_prefs *p, int compa, int cd32) static void set_68000_compa(struct uae_prefs *p, int compa) { - p->cpu_clock_multiplier = 2 << 8; switch (compa) { case 0: - p->cpu_cycle_exact = p->cpu_memory_cycle_exact = p->blitter_cycle_exact = true; break; case 1: break; @@ -7284,41 +4918,6 @@ static void set_68000_compa(struct uae_prefs *p, int compa) } } -static int bip_a3000(struct uae_prefs *p, int config, int compa, int romcheck) -{ - int roms[2]; - - if (config == 2) - roms[0] = 61; - else if (config == 1) - roms[0] = 71; - else - roms[0] = 59; - roms[1] = -1; - p->bogomem_size = 0; - p->chipmem_size = 0x200000; - p->cpu_model = 68030; - p->fpu_model = 68882; - p->fpu_no_unimplemented = true; - if (compa == 0) - p->mmu_model = 68030; - else - p->cachesize = MAX_JIT_CACHE; - p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE; - p->cpu_compatible = p->address_space_24 = 0; - p->m68k_speed = -1; - p->immediate_blits = 0; - p->produce_sound = 2; - p->floppyslots[0].dfxtype = DRV_35_HD; - p->floppy_speed = 0; - p->cpu_idle = 150; - p->cs_compatible = CP_A3000; - p->mbresmem_low_size = 8 * 1024 * 1024; - built_in_chipset_prefs(p); - p->cs_ciaatod = p->ntscmode ? 2 : 1; - return configure_rom(p, roms, romcheck); -} - static int bip_a4000(struct uae_prefs *p, int config, int compa, int romcheck) { int roms[8]; @@ -7340,15 +4939,6 @@ static int bip_a4000(struct uae_prefs *p, int config, int compa, int romcheck) p->cpu_model = 68040; p->fpu_model = 68040; break; - case 2: - p->cpu_model = 68060; - p->fpu_model = 68060; - p->ppc_mode = 1; - //cpuboard_setboard(p, BOARD_CYBERSTORM, BOARD_CYBERSTORM_SUB_PPC); - p->cpuboardmem1_size = 128 * 1024 * 1024; - int roms_ppc[] = { 98, -1 }; - configure_rom(p, roms_ppc, romcheck); - break; } p->chipset_mask = CSMASK_AGA | CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE; p->cpu_compatible = p->address_space_24 = 0; @@ -7356,167 +4946,17 @@ static int bip_a4000(struct uae_prefs *p, int config, int compa, int romcheck) p->immediate_blits = 0; p->produce_sound = 2; p->cachesize = MAX_JIT_CACHE; + + p->nr_floppies = 2; p->floppyslots[0].dfxtype = DRV_35_HD; p->floppyslots[1].dfxtype = DRV_35_HD; p->floppy_speed = 0; - p->cpu_idle = 150; p->cs_compatible = CP_A4000; built_in_chipset_prefs(p); p->cs_ciaatod = p->ntscmode ? 2 : 1; return configure_rom(p, roms, romcheck); } -static int bip_a4000t(struct uae_prefs *p, int config, int compa, int romcheck) -{ - - int roms[8]; - - roms[0] = 16; - roms[1] = 31; - roms[2] = 13; - roms[3] = -1; - - p->bogomem_size = 0; - p->chipmem_size = 0x200000; - p->mbresmem_low_size = 8 * 1024 * 1024; - p->cpu_model = 68030; - p->fpu_model = 68882; - if (config > 0) { - p->cpu_model = 68040; - p->fpu_model = 68040; - } - p->chipset_mask = CSMASK_AGA | CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE; - p->cpu_compatible = p->address_space_24 = 0; - p->m68k_speed = -1; - p->immediate_blits = 0; - p->produce_sound = 2; - p->cachesize = MAX_JIT_CACHE; - p->floppyslots[0].dfxtype = DRV_35_HD; - p->floppyslots[1].dfxtype = DRV_35_HD; - p->floppy_speed = 0; - p->cpu_idle = 150; - p->cs_compatible = CP_A4000T; - built_in_chipset_prefs(p); - p->cs_ciaatod = p->ntscmode ? 2 : 1; - return configure_rom(p, roms, romcheck); -} - -static void bip_velvet(struct uae_prefs *p, int config, int compa, int romcheck) -{ - p->chipset_mask = 0; - p->bogomem_size = 0; - p->sound_filter = FILTER_SOUND_ON; - set_68000_compa(p, compa); - p->floppyslots[1].dfxtype = DRV_NONE; - p->cs_compatible = CP_VELVET; - p->cs_slowmemisfast = 1; - p->cs_dipagnus = 1; - p->cs_agnusbltbusybug = 1; - built_in_chipset_prefs(p); - p->cs_denisenoehb = 1; - p->cs_cia6526 = 1; - p->chipmem_size = 0x40000; -} - -static int bip_a1000(struct uae_prefs *p, int config, int compa, int romcheck) -{ - int roms[2]; - - roms[0] = 24; - roms[1] = -1; - p->chipset_mask = 0; - p->bogomem_size = 0; - p->sound_filter = FILTER_SOUND_ON; - set_68000_compa(p, compa); - p->floppyslots[1].dfxtype = DRV_NONE; - p->cs_compatible = CP_A1000; - p->cs_slowmemisfast = 1; - p->cs_dipagnus = 1; - p->cs_agnusbltbusybug = 1; - built_in_chipset_prefs(p); - if (config > 0) - p->cs_denisenoehb = 1; - if (config > 1) - p->chipmem_size = 0x40000; - if (config > 2) { - roms[0] = 125; - roms[1] = -1; - bip_velvet(p, config, compa, romcheck); - } - return configure_rom(p, roms, romcheck); -} - -static int bip_cdtvcr(struct uae_prefs *p, int config, int compa, int romcheck) -{ - int roms[4]; - - p->bogomem_size = 0; - p->chipmem_size = 0x100000; - p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE; - p->cs_cdtvcd = p->cs_cdtvram = true; - p->cs_cdtvcr = true; - p->cs_rtc = 1; - p->nr_floppies = 0; - p->floppyslots[0].dfxtype = DRV_NONE; - if (config > 0) - p->floppyslots[0].dfxtype = DRV_35_DD; - p->floppyslots[1].dfxtype = DRV_NONE; - set_68000_compa(p, compa); - p->cs_compatible = CP_CDTVCR; - built_in_chipset_prefs(p); - fetch_datapath(p->flashfile, sizeof(p->flashfile) / sizeof(TCHAR)); - _tcscat(p->flashfile, _T("cdtv-cr.nvr")); - roms[0] = 9; - roms[1] = 10; - roms[2] = -1; - if (!configure_rom(p, roms, romcheck)) - return 0; - roms[0] = 108; - roms[1] = 107; - roms[2] = -1; - if (!configure_rom(p, roms, romcheck)) - return 0; - return 1; -} - -static int bip_cdtv(struct uae_prefs *p, int config, int compa, int romcheck) -{ - int roms[4]; - - if (config >= 2) - return bip_cdtvcr(p, config - 2, compa, romcheck); - - p->bogomem_size = 0; - p->chipmem_size = 0x100000; - p->chipset_mask = CSMASK_ECS_AGNUS; - p->cs_cdtvcd = p->cs_cdtvram = 1; - if (config > 0) - p->cs_cdtvcard = 64; - p->cs_rtc = 1; - p->nr_floppies = 0; - p->floppyslots[0].dfxtype = DRV_NONE; - if (config > 0) - p->floppyslots[0].dfxtype = DRV_35_DD; - p->floppyslots[1].dfxtype = DRV_NONE; - set_68000_compa(p, compa); - p->cs_compatible = CP_CDTV; - built_in_chipset_prefs(p); - fetch_datapath(p->flashfile, sizeof(p->flashfile) / sizeof(TCHAR)); - _tcscat(p->flashfile, _T("cdtv.nvr")); - roms[0] = 6; - roms[1] = 32; - roms[2] = -1; - if (!configure_rom(p, roms, romcheck)) - return 0; - roms[0] = 20; - roms[1] = 21; - roms[2] = 22; - roms[3] = -1; - if (!configure_rom(p, roms, romcheck)) - return 0; - return 1; -} - static int bip_cd32(struct uae_prefs *p, int config, int compa, int romcheck) { int roms[3]; @@ -7531,9 +4971,11 @@ static int bip_cd32(struct uae_prefs *p, int config, int compa, int romcheck) built_in_chipset_prefs(p); fetch_datapath(p->flashfile, sizeof(p->flashfile) / sizeof(TCHAR)); _tcscat(p->flashfile, _T("cd32.nvr")); + roms[0] = 64; roms[1] = -1; - if (!configure_rom(p, roms, 0)) { + if (!configure_rom(p, roms, 0)) + { roms[0] = 18; roms[1] = -1; if (!configure_rom(p, roms, romcheck)) @@ -7542,7 +4984,8 @@ static int bip_cd32(struct uae_prefs *p, int config, int compa, int romcheck) if (!configure_rom(p, roms, romcheck)) return 0; } - if (config > 0) { + if (config > 0) + { p->cs_cd32fmv = true; roms[0] = 74; roms[1] = 23; @@ -7550,21 +4993,30 @@ static int bip_cd32(struct uae_prefs *p, int config, int compa, int romcheck) if (!configure_rom(p, roms, romcheck)) return 0; } + + p->cdslots[0].inuse = true; + p->cdslots[0].type = SCSI_UNIT_IMAGE; + +#ifdef PANDORA + p->gfx_size.width = 384; + p->gfx_size.height = 256; +#endif + + p->m68k_speed = M68K_SPEED_14MHZ_CYCLES; + return 1; } static int bip_a1200(struct uae_prefs *p, int config, int compa, int romcheck) { int roms[4]; - int roms_bliz[2]; buildin_default_prefs_68020(p); roms[0] = 11; roms[1] = 15; roms[2] = 31; roms[3] = -1; - roms_bliz[0] = -1; - roms_bliz[1] = -1; + p->cs_rtc = 0; p->cs_compatible = CP_A1200; built_in_chipset_prefs(p); @@ -7574,47 +5026,14 @@ static int bip_a1200(struct uae_prefs *p, int config, int compa, int romcheck) p->fastmem[0].size = 0x400000; p->cs_rtc = 1; break; - case 2: - //cpuboard_setboard(p, BOARD_BLIZZARD, BOARD_BLIZZARD_SUB_1230IV); - p->cpuboardmem1_size = 32 * 1024 * 1024; - p->cpu_model = 68030; - p->cs_rtc = 1; - roms_bliz[0] = 89; - configure_rom(p, roms_bliz, romcheck); - break; - case 3: - //cpuboard_setboard(p, BOARD_BLIZZARD, BOARD_BLIZZARD_SUB_1260); - p->cpuboardmem1_size = 32 * 1024 * 1024; - p->cpu_model = 68040; - p->fpu_model = 68040; - p->cs_rtc = 1; - roms_bliz[0] = 90; - configure_rom(p, roms_bliz, romcheck); - break; - case 4: - //cpuboard_setboard(p, BOARD_BLIZZARD, BOARD_BLIZZARD_SUB_1260); - p->cpuboardmem1_size = 32 * 1024 * 1024; - p->cpu_model = 68060; - p->fpu_model = 68060; - p->cs_rtc = 1; - roms_bliz[0] = 90; - configure_rom(p, roms_bliz, romcheck); - break; - case 5: - //cpuboard_setboard(p, BOARD_BLIZZARD, BOARD_BLIZZARD_SUB_PPC); - p->cpuboardmem1_size = 256 * 1024 * 1024; - p->cpu_model = 68060; - p->fpu_model = 68060; - p->ppc_mode = 1; - p->cs_rtc = 1; - roms[0] = 15; - roms[1] = 11; - roms[2] = -1; - roms_bliz[0] = 100; - configure_rom(p, roms_bliz, romcheck); - break; } set_68020_compa(p, compa, 0); + + p->m68k_speed = M68K_SPEED_14MHZ_CYCLES; + + p->nr_floppies = 1; + p->floppyslots[1].dfxtype = DRV_NONE; + return configure_rom(p, roms, romcheck); } @@ -7708,91 +5127,13 @@ static int bip_a500(struct uae_prefs *p, int config, int compa, int romcheck) p->chipset_mask = 0; break; } + p->fast_copper = 0; set_68000_compa(p, compa); p->cs_compatible = CP_A500; built_in_chipset_prefs(p); return configure_rom(p, roms, romcheck); } -static int bip_super(struct uae_prefs *p, int config, int compa, int romcheck) -{ - int roms[7]; - - roms[0] = 16; - roms[1] = 31; - roms[2] = 15; - roms[3] = 14; - roms[4] = 12; - roms[5] = 11; - roms[6] = -1; - p->bogomem_size = 0; - p->chipmem_size = 0x400000; - p->z3fastmem[0].size = 8 * 1024 * 1024; - p->rtgboards[0].rtgmem_size = 16 * 1024 * 1024; - p->cpu_model = 68040; - p->fpu_model = 68040; - p->chipset_mask = CSMASK_AGA | CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE; - p->cpu_compatible = p->address_space_24 = 0; - p->m68k_speed = -1; - p->immediate_blits = 1; - p->produce_sound = 2; - p->cachesize = MAX_JIT_CACHE; - p->floppyslots[0].dfxtype = DRV_35_HD; - p->floppyslots[1].dfxtype = DRV_35_HD; - p->floppy_speed = 0; - p->cpu_idle = 150; - p->scsi = 1; - p->uaeserial = 1; - p->socket_emu = 1; - p->cart_internal = 0; - p->picasso96_nocustom = 1; - p->cs_compatible = 1; - built_in_chipset_prefs(p); - p->cs_ide = -1; - p->cs_ciaatod = p->ntscmode ? 2 : 1; - //_tcscat(p->flashfile, _T("battclock.nvr")); - return configure_rom(p, roms, romcheck); -} - -static int bip_arcadia(struct uae_prefs *p, int config, int compa, int romcheck) -{ - int roms[4], i; - struct romlist **rl; - - p->bogomem_size = 0; - p->chipset_mask = 0; - p->cs_rtc = 0; - p->nr_floppies = 0; - p->floppyslots[0].dfxtype = DRV_NONE; - p->floppyslots[1].dfxtype = DRV_NONE; - set_68000_compa(p, compa); - p->cs_compatible = CP_A500; - built_in_chipset_prefs(p); - fetch_datapath(p->flashfile, sizeof(p->flashfile) / sizeof(TCHAR)); - _tcscat(p->flashfile, _T("arcadia.nvr")); - roms[0] = 5; - roms[1] = 4; - roms[2] = -1; - if (!configure_rom(p, roms, romcheck)) - return 0; - roms[0] = 51; - roms[1] = 49; - roms[2] = -1; - if (!configure_rom(p, roms, romcheck)) - return 0; - rl = getarcadiaroms(); - for (i = 0; rl[i]; i++) { - if (config-- == 0) { - roms[0] = rl[i]->rd->id; - roms[1] = -1; - configure_rom(p, roms, 0); - break; - } - } - xfree(rl); - return 1; -} - int built_in_prefs(struct uae_prefs *p, int model, int config, int compa, int romcheck) { int v = 0; @@ -7810,34 +5151,16 @@ int built_in_prefs(struct uae_prefs *p, int model, int config, int compa, int ro v = bip_a600(p, config, compa, romcheck); break; case 3: - v = bip_a1000(p, config, compa, romcheck); - break; - case 4: v = bip_a1200(p, config, compa, romcheck); break; - case 5: - v = bip_a3000(p, config, compa, romcheck); - break; - case 6: + case 4: v = bip_a4000(p, config, compa, romcheck); break; - case 7: - v = bip_a4000t(p, config, compa, romcheck); - break; - case 8: + case 5: v = bip_cd32(p, config, compa, romcheck); break; - case 9: - v = bip_cdtv(p, config, compa, romcheck); - break; - case 10: - v = bip_arcadia(p, config, compa, romcheck); - break; - case 11: - v = bip_super(p, config, compa, romcheck); - break; } - if ((p->cpu_model >= 68020 || !p->cpu_cycle_exact || !p->cpu_memory_cycle_exact) && !p->immediate_blits) + if (!p->immediate_blits) p->waiting_blits = 1; if (p->sound_filter_type == FILTER_SOUND_TYPE_A500 && (p->chipset_mask & CSMASK_AGA)) p->sound_filter_type = FILTER_SOUND_TYPE_A1200; @@ -7854,94 +5177,61 @@ int built_in_chipset_prefs(struct uae_prefs *p) if (!p->cs_compatible) return 1; - p->cs_a1000ram = 0; p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = 0; - p->cs_cdtvcd = p->cs_cdtvram = p->cs_cdtvscsi = p->cs_cdtvcr = 0; p->cs_fatgaryrev = -1; p->cs_ide = 0; p->cs_ramseyrev = -1; - p->cs_deniserev = -1; - p->cs_agnusrev = -1; - p->cs_denisenoehb = 0; - p->cs_dipagnus = 0; - p->cs_agnusbltbusybug = 0; - p->cs_mbdmac = 0; p->cs_pcmcia = 0; p->cs_ksmirror_e0 = 1; p->cs_ksmirror_a8 = 0; p->cs_ciaoverlay = 1; p->cs_ciaatod = 0; p->cs_rtc = 0; - p->cs_rtc_adjust_mode = p->cs_rtc_adjust = 0; p->cs_df0idhw = 1; - p->cs_resetwarning = 1; - p->cs_slowmemisfast = 0; p->cs_ciatodbug = false; p->cs_z3autoconfig = false; p->cs_bytecustomwritebug = false; - p->cs_1mchipjumper = false; switch (p->cs_compatible) { case CP_GENERIC: // generic - if (p->cpu_model >= 68020) { + if (p->cpu_model >= 68020) + { // big box-like p->cs_rtc = 2; p->cs_fatgaryrev = 0; p->cs_ide = -1; - p->cs_mbdmac = 0; p->cs_ramseyrev = 0x0f; } - else if (p->cpu_compatible) { + else if (p->cpu_compatible) + { // very A500-like p->cs_df0idhw = 0; - p->cs_resetwarning = 0; if (p->bogomem_size || p->chipmem_size > 0x80000 || p->fastmem[0].size) p->cs_rtc = 1; p->cs_ciatodbug = true; } - else { + else + { // sort of A500-like p->cs_ide = -1; p->cs_rtc = 1; } break; - case CP_CDTV: // CDTV - p->cs_rtc = 1; - p->cs_cdtvcd = p->cs_cdtvram = 1; - p->cs_df0idhw = 1; - p->cs_ksmirror_e0 = 0; - break; - case CP_CDTVCR: // CDTV-CR - p->cs_rtc = 1; - p->cs_cdtvcd = p->cs_cdtvram = 1; - p->cs_cdtvcr = true; - p->cs_df0idhw = 1; - p->cs_ksmirror_e0 = 0; - p->cs_ide = IDE_A600A1200; - p->cs_pcmcia = 1; - p->cs_ksmirror_a8 = 1; - p->cs_ciaoverlay = 0; - p->cs_resetwarning = 0; - p->cs_ciatodbug = true; - break; case CP_CD32: // CD32 p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = true; p->cs_ksmirror_e0 = 0; p->cs_ksmirror_a8 = 1; p->cs_ciaoverlay = 0; - p->cs_resetwarning = 0; break; case CP_A500: // A500 p->cs_df0idhw = 0; - p->cs_resetwarning = 0; if (p->bogomem_size || p->chipmem_size > 0x80000 || p->fastmem[0].size) p->cs_rtc = 1; p->cs_ciatodbug = true; break; case CP_A500P: // A500+ p->cs_rtc = 1; - p->cs_resetwarning = 0; p->cs_ciatodbug = true; break; case CP_A600: // A600 @@ -7949,30 +5239,14 @@ int built_in_chipset_prefs(struct uae_prefs *p) p->cs_pcmcia = 1; p->cs_ksmirror_a8 = 1; p->cs_ciaoverlay = 0; - p->cs_resetwarning = 0; p->cs_ciatodbug = true; break; - case CP_A1000: // A1000 - p->cs_a1000ram = 1; - p->cs_ciaatod = p->ntscmode ? 2 : 1; - p->cs_ksmirror_e0 = 0; - p->cs_agnusbltbusybug = 1; - p->cs_dipagnus = 1; - p->cs_ciatodbug = true; - break; - case CP_VELVET: // A1000 Prototype - p->cs_ciaatod = p->ntscmode ? 2 : 1; - p->cs_ksmirror_e0 = 0; - p->cs_agnusbltbusybug = 1; - p->cs_dipagnus = 1; - p->cs_denisenoehb = 1; - break; case CP_A1200: // A1200 p->cs_ide = IDE_A600A1200; p->cs_pcmcia = 1; p->cs_ksmirror_a8 = 1; p->cs_ciaoverlay = 0; - if (p->fastmem[0].size || p->z3fastmem[0].size || p->cpuboard_type) + if (p->fastmem[0].size || p->z3fastmem[0].size) p->cs_rtc = 1; break; case CP_A2000: // A2000 @@ -7980,41 +5254,11 @@ int built_in_chipset_prefs(struct uae_prefs *p) p->cs_ciaatod = p->ntscmode ? 2 : 1; p->cs_ciatodbug = true; break; - case CP_A3000: // A3000 - p->cs_rtc = 2; - p->cs_fatgaryrev = 0; - p->cs_ramseyrev = 0x0d; - p->cs_mbdmac = 1; - p->cs_ksmirror_e0 = 0; - p->cs_ciaatod = p->ntscmode ? 2 : 1; - p->cs_z3autoconfig = true; - break; - case CP_A3000T: // A3000T - p->cs_rtc = 2; - p->cs_fatgaryrev = 0; - p->cs_ramseyrev = 0x0d; - p->cs_mbdmac = 1; - p->cs_ksmirror_e0 = 0; - p->cs_ciaatod = p->ntscmode ? 2 : 1; - p->cs_z3autoconfig = true; - break; case CP_A4000: // A4000 p->cs_rtc = 2; p->cs_fatgaryrev = 0; p->cs_ramseyrev = 0x0f; p->cs_ide = IDE_A4000; - p->cs_mbdmac = 0; - p->cs_ksmirror_a8 = 0; - p->cs_ksmirror_e0 = 0; - p->cs_ciaoverlay = 0; - p->cs_z3autoconfig = true; - break; - case CP_A4000T: // A4000T - p->cs_rtc = 2; - p->cs_fatgaryrev = 0; - p->cs_ramseyrev = 0x0f; - p->cs_ide = IDE_A4000; - p->cs_mbdmac = 2; p->cs_ksmirror_a8 = 0; p->cs_ksmirror_e0 = 0; p->cs_ciaoverlay = 0; @@ -8026,67 +5270,6 @@ int built_in_chipset_prefs(struct uae_prefs *p) return 1; } -int built_in_cpuboard_prefs(struct uae_prefs *p) -{ - int roms[2], roms2[2]; - - roms[0] = -1; - roms[1] = -1; - roms2[0] = -1; - roms2[1] = -1; - - //switch (cpuboards[p->cpuboard_type].id) - //{ - //case BOARD_MACROSYSTEM: - // switch (p->cpuboard_subtype) - // { - // case BOARD_MACROSYSTEM_SUB_WARPENGINE_A4000: - // roms[0] = 93; - // break; - // } - // break; - //case BOARD_BLIZZARD: - // switch (p->cpuboard_subtype) - // { - // case BOARD_BLIZZARD_SUB_1230IV: - // roms[0] = 89; - // break; - // case BOARD_BLIZZARD_SUB_1260: - // roms[0] = 90; - // break; - // case BOARD_BLIZZARD_SUB_2060: - // roms[0] = 92; - // break; - // case BOARD_BLIZZARD_SUB_PPC: - // roms[0] = p->cpu_model == 68040 ? 99 : 100; - // break; - // } - // break; - //case BOARD_CYBERSTORM: - // switch (p->cpuboard_subtype) - // { - // case BOARD_CYBERSTORM_SUB_MK1: - // roms[0] = p->cpu_model == 68040 ? 95 : 101; - // break; - // case BOARD_CYBERSTORM_SUB_MK2: - // roms[0] = 96; - // break; - // case BOARD_CYBERSTORM_SUB_MK3: - // roms[0] = 97; - // break; - // case BOARD_CYBERSTORM_SUB_PPC: - // roms[0] = 98; - // break; - // } - // break; - //} - if (!configure_rom(p, roms, 0)) - return 0; - if (!configure_rom(p, roms2, 0)) - return 0; - return 1; -} - void set_config_changed(void) { config_changed = 1; @@ -8094,13 +5277,8 @@ void set_config_changed(void) void config_check_vsync(void) { - if (config_changed) { -#ifdef WITH_LUA - if (config_changed == 1) { - createconfigstore(&currprefs); - uae_lua_run_handler("on_uae_config_changed"); - } -#endif + if (config_changed) + { config_changed++; if (config_changed >= 3) config_changed = 0; @@ -8115,28 +5293,31 @@ TCHAR *get_error_log(void) { strlist *sl; int len = 0; - for (sl = error_lines; sl; sl = sl->next) { + for (sl = error_lines; sl; sl = sl->next) + { len += _tcslen(sl->option) + 1; } if (!len) return NULL; TCHAR *s = xcalloc(TCHAR, len + 1); - for (sl = error_lines; sl; sl = sl->next) { + for (sl = error_lines; sl; sl = sl->next) + { _tcscat(s, sl->option); _tcscat(s, _T("\n")); } return s; } - void error_log(const TCHAR *format, ...) { TCHAR buffer[256], *bufp; int bufsize = 256; va_list parms; - if (format == NULL) { + if (format == NULL) + { struct strlist **ps = &error_lines; - while (*ps) { + while (*ps) + { struct strlist *s = *ps; *ps = s->next; xfree(s->value); @@ -8148,9 +5329,11 @@ void error_log(const TCHAR *format, ...) va_start(parms, format); bufp = buffer; - for (;;) { + for (;;) + { int count = _vsntprintf(bufp, bufsize - 1, format, parms); - if (count < 0) { + if (count < 0) + { bufsize *= 10; if (bufp != buffer) xfree(bufp); @@ -8171,3 +5354,104 @@ void error_log(const TCHAR *format, ...) if (bufp != buffer) xfree(bufp); } + +int bip_a4000(struct uae_prefs *p, int rom) +{ + return bip_a4000(p, 0, 0, 0); +} + +int bip_cd32(struct uae_prefs *p, int rom) +{ + return bip_cd32(p, 0, 0, 0); +} + +int bip_a1200(struct uae_prefs *p, int rom) +{ + int roms[4]; + + int v = bip_a1200(p, 0, 0, 0); + if (rom == 310) + { + roms[0] = 15; + roms[1] = 11; + roms[2] = 31; + roms[3] = -1; + v = configure_rom(p, roms, 0); + } + + return v; +} + +int bip_a500plus(struct uae_prefs *p, int rom) +{ + int roms[4]; + + int v = bip_a500p(p, 0, 0, 0); + if (rom == 130) + { + roms[0] = 6; + roms[1] = 5; + roms[2] = 4; + roms[3] = -1; + } + else + { + roms[0] = 7; + roms[1] = 6; + roms[2] = 5; + roms[3] = -1; + } + return configure_rom(p, roms, 0); +} + +int bip_a500(struct uae_prefs *p, int rom) +{ + int roms[4]; + + int v = bip_a500(p, 0, 0, 0); + if (rom == 130) + { + roms[0] = 6; + roms[1] = 5; + roms[2] = 4; + roms[3] = -1; + } + else + { + roms[0] = 5; + roms[1] = 4; + roms[2] = 3; + roms[3] = -1; + } + return configure_rom(p, roms, 0); +} + +int bip_a2000(struct uae_prefs *p, int rom) +{ + int roms[4]; + + if (rom == 130) + { + roms[0] = 6; + roms[1] = 5; + roms[2] = 4; + roms[3] = -1; + } + else + { + roms[0] = 5; + roms[1] = 4; + roms[2] = 3; + roms[3] = -1; + } + p->cs_compatible = CP_A2000; + built_in_chipset_prefs(p); + p->chipmem_size = 0x00080000; + p->bogomem_size = 0x00080000; + p->chipset_mask = 0; + p->cpu_compatible = 0; + p->fast_copper = 0; + p->nr_floppies = 1; + p->floppyslots[1].dfxtype = DRV_NONE; + return configure_rom(p, roms, 0); +} diff --git a/src/cia.cpp b/src/cia.cpp index bc30ffda..35823ead 100644 --- a/src/cia.cpp +++ b/src/cia.cpp @@ -12,7 +12,7 @@ #include #include "options.h" -#include "include/memory.h" +#include "memory.h" #include "custom.h" #include "newcpu.h" #include "cia.h" @@ -23,36 +23,23 @@ #include "savestate.h" #include "inputdevice.h" #include "zfile.h" +#include "ar.h" #include "akiko.h" #include "audio.h" #include "keyboard.h" #include "uae.h" #include "autoconf.h" -#include "drawing.h" +#include "rtc.h" -#define CIAA_DEBUG_R 0 -#define CIAA_DEBUG_W 0 -#define CIAA_DEBUG_IRQ 0 +/* Akiko internal CIA differences: -#define CIAB_DEBUG_R 0 -#define CIAB_DEBUG_W 0 -#define CIAB_DEBUG_IRQ 0 +- BFE101 and BFD100: reads 3F if data direction is in. -#define DONGLE_DEBUG 0 -#define KB_DEBUG 0 -#define CLOCK_DEBUG 0 + */ -#define TOD_HACK - - /* Akiko internal CIA differences: - - - BFE101 and BFD100: reads 3F if data direction is in. - - */ - - /* e-clock is 10 CPU cycles, 4 cycles high, 6 low - * data transfer happens during 4 high cycles - */ +/* e-clock is 10 CPU cycles, 4 cycles high, 6 low + * data transfer happens during 4 high cycles + */ #define ECLOCK_DATA_CYCLE 4 #define ECLOCK_WAIT_CYCLE 6 @@ -73,10 +60,8 @@ static unsigned long ciaatod, ciabtod, ciaatol, ciabtol, ciaaalarm, ciabalarm; static int ciaatlatch, ciabtlatch; static bool oldovl, oldcd32mute; static bool led; -static int led_old_brightness; -static unsigned long led_cycles_on, led_cycles_off, led_cycle; -unsigned int ciabpra; +static unsigned int ciabpra; static unsigned long ciaala, ciaalb, ciabla, ciablb; static int ciaatodon, ciabtodon; @@ -86,660 +71,376 @@ static int div10; static int kbstate, kblostsynccnt; static uae_u8 kbcode; -static uae_u8 serbits; -static int warned = 10; -static int rtc_delayed_write; +static struct rtc_msm_data rtc_msm; +static struct rtc_ricoh_data rtc_ricoh; -static void setclr(unsigned int *p, unsigned int val) +STATIC_INLINE void setclr (unsigned int *p, unsigned int val) { - if (val & 0x80) { - *p |= val & 0x7F; - } - else { - *p &= ~val; - } + if (val & 0x80) { + *p |= val & 0x7F; + } else { + *p &= ~val; + } } -/* delay interrupt after current CIA register access if -* interrupt would have triggered mid access -*/ -static int cia_interrupt_disabled; -static int cia_interrupt_delay; - -static void ICR(uae_u32 data) +STATIC_INLINE void ICR (uae_u32 data) { - INTREQ_0(0x8000 | data); + INTREQ_0 (0x8000 | data); } -static void ICRA(uae_u32 data) +STATIC_INLINE void ICRA(uae_u32 data) { ciaaicr |= 0x40; -#if 1 - if (currprefs.cpu_memory_cycle_exact && !(ciaaicr & 0x20) && (cia_interrupt_disabled & 1)) { - cia_interrupt_delay |= 1; -#if CIAB_DEBUG_IRQ - write_log(_T("ciab interrupt disabled ICR=%02X PC=%x\n"), ciabicr, M68K_GETPC); -#endif - return; - } -#endif ciaaicr |= 0x20; - ICR(0x0008); + ICR (0x0008); } -static void ICRB(uae_u32 data) +STATIC_INLINE void ICRB(uae_u32 data) { ciabicr |= 0x40; -#if 1 - if (currprefs.cpu_memory_cycle_exact && !(ciabicr & 0x20) && (cia_interrupt_disabled & 2)) { - cia_interrupt_delay |= 2; -#if CIAB_DEBUG_IRQ - write_log(_T("ciab interrupt disabled ICR=%02X PC=%x\n"), ciabicr, M68K_GETPC); -#endif - return; - } -#endif ciabicr |= 0x20; - if (currprefs.cs_compatible == CP_VELVET) { - // Both CIAs in Velvet are connected to level 2. - ICR(0x0008); - } - else { - ICR(0x2000); - } + ICR (0x2000); } -static void RethinkICRA(void) +STATIC_INLINE void RethinkICRA (void) { - if (ciaaicr & ciaaimask) { -#if CIAA_DEBUG_IRQ - write_log(_T("CIAA IRQ %02X\n"), ciaaicr); -#endif + if (ciaaicr & ciaaimask) { if (!(ciaaicr & 0x80)) { ciaaicr |= 0x80; - if (currprefs.cpu_memory_cycle_exact) { - event2_newevent_xx(-1, DIV10 + 2 * CYCLE_UNIT + CYCLE_UNIT / 2, 0, ICRA); - } - else { - ICRA(0x0008); - } - } - } + ICRA (0x0008); + } + } } -static void RethinkICRB(void) +STATIC_INLINE void RethinkICRB (void) { - if (ciabicr & ciabimask) { -#if CIAB_DEBUG_IRQ - write_log(_T("CIAB IRQ %02X\n"), ciabicr); -#endif + if (ciabicr & ciabimask) { if (!(ciabicr & 0x80)) { ciabicr |= 0x80; - if (currprefs.cpu_memory_cycle_exact) { - event2_newevent_xx(-1, DIV10 + 2 * CYCLE_UNIT + CYCLE_UNIT / 2, 0, ICRB); - } - else { - ICRB(0); - } - } - } + ICRB (0); + } + } } -void rethink_cias(void) +void rethink_cias (void) { if (ciaaicr & 0x40) - ICRA(0); + ICRA (0); if (ciabicr & 0x40) - ICRB(0); + ICRB (0); } /* Figure out how many CIA timer cycles have passed for each timer since the last call of CIA_calctimers. */ -static void compute_passed_time(void) +static void compute_passed_time (void) { - unsigned long int ccount = (get_cycles() - eventtab[ev_cia].oldcycles + div10); - unsigned long int ciaclocks = ccount / DIV10; + unsigned long int ccount = (get_cycles () - eventtab[ev_cia].oldcycles + div10); + unsigned long int ciaclocks = ccount / DIV10; - ciaata_passed = ciaatb_passed = ciabta_passed = ciabtb_passed = 0; + ciaata_passed = ciaatb_passed = ciabta_passed = ciabtb_passed = 0; - /* CIA A timers */ - if ((ciaacra & 0x21) == 0x01) { + /* CIA A timers */ + if ((ciaacra & 0x21) == 0x01) { unsigned long int cc = ciaclocks; if (cc > ciaastarta) cc -= ciaastarta; else cc = 0; - assert((ciaata + 1) >= cc); ciaata_passed = cc; - } - if ((ciaacrb & 0x61) == 0x01) { + } + if ((ciaacrb & 0x61) == 0x01) { unsigned long int cc = ciaclocks; if (cc > ciaastartb) cc -= ciaastartb; else cc = 0; - assert((ciaatb + 1) >= cc); ciaatb_passed = cc; - } + } - /* CIA B timers */ - if ((ciabcra & 0x21) == 0x01) { + /* CIA B timers */ + if ((ciabcra & 0x21) == 0x01) { unsigned long int cc = ciaclocks; if (cc > ciabstarta) cc -= ciabstarta; else cc = 0; - assert((ciabta + 1) >= cc); ciabta_passed = cc; - } - if ((ciabcrb & 0x61) == 0x01) { + } + if ((ciabcrb & 0x61) == 0x01) { unsigned long int cc = ciaclocks; if (cc > ciabstartb) cc -= ciabstartb; else cc = 0; - assert((ciabtb + 1) >= cc); ciabtb_passed = cc; - } + } } /* Called to advance all CIA timers to the current time. This expects that one of the timer values will be modified, and CIA_calctimers will be called in the same cycle. */ -static int CIA_update_check(void) +static int CIA_update_check (void) { - unsigned long int ccount = (get_cycles() - eventtab[ev_cia].oldcycles + div10); - unsigned long int ciaclocks = ccount / DIV10; + unsigned long int ccount = (get_cycles () - eventtab[ev_cia].oldcycles + div10); + unsigned long int ciaclocks = ccount / DIV10; - int aovfla = 0, aovflb = 0, asp = 0, bovfla = 0, bovflb = 0, bsp = 0; + int aovfla = 0, aovflb = 0, asp = 0, bovfla = 0, bovflb = 0, bsp = 0; int icr = 0; - div10 = ccount % DIV10; + div10 = ccount % DIV10; - /* CIA A timers */ - if ((ciaacra & 0x21) == 0x01) { + /* CIA A timers */ + if ((ciaacra & 0x21) == 0x01) { bool check = true; unsigned long int cc = ciaclocks; if (ciaastarta > 0) { if (cc > ciaastarta) { cc -= ciaastarta; ciaastarta = 0; - } - else { + } else { ciaastarta -= cc; check = false; } } if (check) { - assert((ciaata + 1) >= cc); if ((ciaata + 1) == cc) { - if ((ciaacra & 0x48) == 0x40 && ciaasdr_cnt > 0 && --ciaasdr_cnt == 0) - asp = 1; - aovfla = 1; - if ((ciaacrb & 0x61) == 0x41 || (ciaacrb & 0x61) == 0x61) { - if (ciaatb-- == 0) - aovflb = 1; - } - } + if ((ciaacra & 0x48) == 0x40 && ciaasdr_cnt > 0 && --ciaasdr_cnt == 0) + asp = 1; + aovfla = 1; + if ((ciaacrb & 0x61) == 0x41 || (ciaacrb & 0x61) == 0x61) { + if (ciaatb-- == 0) + aovflb = 1; + } + } ciaata -= cc; } - } - if ((ciaacrb & 0x61) == 0x01) { + } + if ((ciaacrb & 0x61) == 0x01) { bool check = true; unsigned long int cc = ciaclocks; if (ciaastartb > 0) { if (cc > ciaastartb) { cc -= ciaastartb; ciaastartb = 0; - } - else { + } else { ciaastartb -= cc; check = false; } } if (check) { - assert((ciaatb + 1) >= cc); if ((ciaatb + 1) == cc) - aovflb = 1; + aovflb = 1; ciaatb -= cc; } - } + } - /* CIA B timers */ - if ((ciabcra & 0x21) == 0x01) { + /* CIA B timers */ + if ((ciabcra & 0x21) == 0x01) { bool check = true; unsigned long int cc = ciaclocks; if (ciabstarta > 0) { if (cc > ciabstarta) { cc -= ciabstarta; ciabstarta = 0; - } - else { + } else { ciabstarta -= cc; check = false; } } if (check) { - assert((ciabta + 1) >= cc); if ((ciabta + 1) == cc) { - if ((ciabcra & 0x48) == 0x40 && ciabsdr_cnt > 0 && --ciabsdr_cnt == 0) - bsp = 1; - bovfla = 1; - if ((ciabcrb & 0x61) == 0x41 || (ciabcrb & 0x61) == 0x61) { - if (ciabtb-- == 0) - bovflb = 1; - } - } + if ((ciabcra & 0x48) == 0x40 && ciabsdr_cnt > 0 && --ciabsdr_cnt == 0) + bsp = 1; + bovfla = 1; + if ((ciabcrb & 0x61) == 0x41 || (ciabcrb & 0x61) == 0x61) { + if (ciabtb-- == 0) + bovflb = 1; + } + } ciabta -= cc; } - } - if ((ciabcrb & 0x61) == 0x01) { + } + if ((ciabcrb & 0x61) == 0x01) { bool check = true; unsigned long int cc = ciaclocks; if (ciabstartb > 0) { if (cc > ciabstartb) { cc -= ciabstartb; ciabstartb = 0; - } - else { + } else { ciabstartb -= cc; check = false; } } if (check) { - assert((ciabtb + 1) >= cc); if ((ciabtb + 1) == cc) - bovflb = 1; + bovflb = 1; ciabtb -= cc; } - } + } - if (aovfla) { + if (aovfla) { ciaaicr |= 1; icr = 1; - ciaata = ciaala; - if (ciaacra & 0x8) { - ciaacra &= ~1; - } - } - if (aovflb) { + ciaata = ciaala; + if (ciaacra & 0x8) { + ciaacra &= ~1; + } + } + if (aovflb) { ciaaicr |= 2; icr = 1; - ciaatb = ciaalb; - if (ciaacrb & 0x8) { - ciaacrb &= ~1; - } - } - if (asp) { + ciaatb = ciaalb; + if (ciaacrb & 0x8) { + ciaacrb &= ~1; + } + } + if (asp) { ciaaicr |= 8; icr = 1; - } - if (bovfla) { + } + if (bovfla) { ciabicr |= 1; icr |= 2; - ciabta = ciabla; - if (ciabcra & 0x8) { - ciabcra &= ~1; - } - } - if (bovflb) { + ciabta = ciabla; + if (ciabcra & 0x8) { + ciabcra &= ~1; + } + } + if (bovflb) { ciabicr |= 2; icr |= 2; - ciabtb = ciablb; - if (ciabcrb & 0x8) { - ciabcrb &= ~1; - } - } - if (bsp) { + ciabtb = ciablb; + if (ciabcrb & 0x8) { + ciabcrb &= ~1; + } + } + if (bsp) { ciabicr |= 8; icr |= 2; - } + } return icr; } -static void CIA_update(void) +static void CIA_update (void) { - int icr = CIA_update_check(); + int icr = CIA_update_check (); if (icr & 1) - RethinkICRA(); + RethinkICRA (); if (icr & 2) - RethinkICRB(); + RethinkICRB (); } /* Call this only after CIA_update has been called in the same cycle. */ -static void CIA_calctimers(void) +static void CIA_calctimers (void) { - long int ciaatimea = -1, ciaatimeb = -1, ciabtimea = -1, ciabtimeb = -1; + long int ciaatimea = -1, ciaatimeb = -1, ciabtimea = -1, ciabtimeb = -1; int div10diff = DIV10 - div10; - eventtab[ev_cia].oldcycles = get_cycles(); + eventtab[ev_cia].oldcycles = get_cycles (); - if ((ciaacra & 0x21) == 0x01) { + if ((ciaacra & 0x21) == 0x01) { ciaatimea = div10diff + DIV10 * (ciaata + ciaastarta); - } -#if 0 - if ((ciaacrb & 0x61) == 0x41) { - /* Timer B will not get any pulses if Timer A is off. */ - if (ciaatimea >= 0) { - /* If Timer A is in one-shot mode, and Timer B needs more than - * one pulse, it will not underflow. */ - if (ciaatb == 0 || (ciaacra & 0x8) == 0) { - /* Otherwise, we can determine the time of the underflow. */ - /* This may overflow, however. So just ignore this timer and - use the fact that we'll call CIA_handler for the A timer. */ - /* ciaatimeb = ciaatimea + ciaala * DIV10 * ciaatb; */ - } - } - } -#endif - if ((ciaacrb & 0x61) == 0x01) { + } + if ((ciaacrb & 0x61) == 0x01) { ciaatimeb = div10diff + DIV10 * (ciaatb + ciaastartb); - } + } - if ((ciabcra & 0x21) == 0x01) { + if ((ciabcra & 0x21) == 0x01) { ciabtimea = div10diff + DIV10 * (ciabta + ciabstarta); - } -#if 0 - if ((ciabcrb & 0x61) == 0x41) { - /* Timer B will not get any pulses if Timer A is off. */ - if (ciabtimea >= 0) { - /* If Timer A is in one-shot mode, and Timer B needs more than - * one pulse, it will not underflow. */ - if (ciabtb == 0 || (ciabcra & 0x8) == 0) { - /* Otherwise, we can determine the time of the underflow. */ - /* ciabtimeb = ciabtimea + ciabla * DIV10 * ciabtb; */ - } - } - } -#endif - if ((ciabcrb & 0x61) == 0x01) { + } + if ((ciabcrb & 0x61) == 0x01) { ciabtimeb = div10diff + DIV10 * (ciabtb + ciabstartb); - } + } - eventtab[ev_cia].active = (ciaatimea != -1 || ciaatimeb != -1 - || ciabtimea != -1 || ciabtimeb != -1); - if (eventtab[ev_cia].active) { - unsigned long int ciatime = ~0L; - if (ciaatimea != -1) - ciatime = ciaatimea; - if (ciaatimeb != -1 && ciaatimeb < ciatime) - ciatime = ciaatimeb; - if (ciabtimea != -1 && ciabtimea < ciatime) - ciatime = ciabtimea; - if (ciabtimeb != -1 && ciabtimeb < ciatime) - ciatime = ciabtimeb; - eventtab[ev_cia].evtime = ciatime + get_cycles(); - } - events_schedule(); + eventtab[ev_cia].active = (ciaatimea != -1 || ciaatimeb != -1 + || ciabtimea != -1 || ciabtimeb != -1); + if (eventtab[ev_cia].active) { + unsigned long int ciatime = ~0L; + if (ciaatimea != -1) + ciatime = ciaatimea; + if (ciaatimeb != -1 && ciaatimeb < ciatime) + ciatime = ciaatimeb; + if (ciabtimea != -1 && ciabtimea < ciatime) + ciatime = ciabtimea; + if (ciabtimeb != -1 && ciabtimeb < ciatime) + ciatime = ciabtimeb; + eventtab[ev_cia].evtime = ciatime + get_cycles (); + } + events_schedule(); } -void CIA_handler(void) +void CIA_handler (void) { - CIA_update(); - CIA_calctimers(); + CIA_update (); + CIA_calctimers (); } -void cia_diskindex(void) +void cia_diskindex (void) { - ciabicr |= 0x10; - RethinkICRB(); -} -void cia_parallelack(void) -{ - ciaaicr |= 0x10; - RethinkICRA(); + ciabicr |= 0x10; + RethinkICRB(); } -static bool checkalarm(unsigned long tod, unsigned long alarm, bool inc, int ab) +static bool checkalarm (unsigned long tod, unsigned long alarm, bool inc) { - if (tod == alarm) - return true; - // if (!ab) - // return false; + if (tod == alarm) + return true; if (!currprefs.cs_ciatodbug) return false; - if (!inc) - return false; - /* emulate buggy TODMED counter. - * it counts: .. 29 2A 2B 2C 2D 2E 2F 20 30 31 32 .. - * (2F->20->30 only takes couple of cycles but it will trigger alarm.. - */ - if (tod & 0x000fff) - return false; - if (((tod - 1) & 0xfff000) == alarm) - return true; - return false; + if (!inc) + return false; + /* emulate buggy TODMED counter. + * it counts: .. 29 2A 2B 2C 2D 2E 2F 20 30 31 32 .. + * (2F->20->30 only takes couple of cycles but it will trigger alarm.. + */ + if (tod & 0x000fff) + return false; + if (((tod - 1) & 0xfff000) == alarm) + return true; + return false; } -STATIC_INLINE bool ciab_checkalarm(bool inc, bool irq) +STATIC_INLINE void ciab_checkalarm (bool inc, bool irq) { // hack: do not trigger alarm interrupt if KS code and both // tod and alarm == 0. This incorrectly triggers on non-cycle exact // modes. Real hardware value written to ciabtod by KS is always // at least 1 or larger due to bus cycle delays when reading // old value. -#if 1 - if ((munge24(m68k_getpc()) & 0xFFF80000) != 0xF80000) { + if ((munge24 (m68k_getpc ()) & 0xFFF80000) != 0xF80000) { if (ciabtod == 0 && ciabalarm == 0) - return false; - } -#endif - if (checkalarm(ciabtod, ciabalarm, inc, 1)) { -#if CIAB_DEBUG_IRQ - write_log(_T("CIAB tod %08x %08x\n"), ciabtod, ciabalarm); -#endif - if (irq) { - ciabicr |= 4; - RethinkICRB(); - } - return true; - } - return false; -} - -STATIC_INLINE void ciaa_checkalarm(bool inc) -{ - if (checkalarm(ciaatod, ciaaalarm, inc, 0)) { -#if CIAA_DEBUG_IRQ - write_log(_T("CIAA tod %08x %08x\n"), ciaatod, ciaaalarm); -#endif - ciaaicr |= 4; - RethinkICRA(); - } -} - - -#ifdef TOD_HACK -static uae_u64 tod_hack_tv, tod_hack_tod, tod_hack_tod_last; -static int tod_hack_enabled; -static int tod_hack_delay; -static int tod_diff_cnt; -#define TOD_HACK_DELAY 50 -#define TOD_HACK_TIME 312 * 50 * 10 -static void tod_hack_reset(void) -{ - struct timeval tv; - gettimeofday(&tv, NULL); - tod_hack_tv = (uae_u64)tv.tv_sec * 1000000 + tv.tv_usec; - tod_hack_tod = ciaatod; - tod_hack_tod_last = tod_hack_tod; - tod_diff_cnt = 0; -} -#endif - -static int heartbeat_cnt; -void cia_heartbeat(void) -{ - heartbeat_cnt = 10; -} - -static void do_tod_hack(int dotod) -{ - struct timeval tv; - static int oldrate; - uae_u64 t; - int rate; - int docount = 0; - - if (tod_hack_enabled == 0) - return; - if (!heartbeat_cnt) { - if (tod_hack_enabled > 0) - tod_hack_enabled = -1; - return; - } - if (tod_hack_enabled < 0) { - tod_hack_enabled = TOD_HACK_TIME; - return; - } - if (tod_hack_enabled > 1) { - tod_hack_enabled--; - if (tod_hack_enabled == 1) { - //write_log (_T("TOD HACK enabled\n")); - tod_hack_reset(); - } - return; - } - - if (currprefs.cs_ciaatod == 0) { - rate = (int)(vblank_hz + 0.5); - if (rate >= 59 && rate <= 61) - rate = 60; - if (rate >= 49 && rate <= 51) - rate = 50; - } - else if (currprefs.cs_ciaatod == 1) { - rate = 50; - } - else { - rate = 60; - } - if (rate <= 0) - return; - if (rate != oldrate || (ciaatod & 0xfff) != (tod_hack_tod_last & 0xfff)) { - write_log(_T("TOD HACK reset %d,%d %ld,%lld\n"), rate, oldrate, ciaatod, tod_hack_tod_last); - tod_hack_reset(); - oldrate = rate; - docount = 1; - } - - if (!dotod && currprefs.cs_ciaatod == 0) - return; - - if (tod_hack_delay > 0) { - tod_hack_delay--; - if (tod_hack_delay > 0) return; - tod_hack_delay = TOD_HACK_DELAY; - } - - gettimeofday(&tv, NULL); - t = (uae_u64)tv.tv_sec * 1000000 + tv.tv_usec; - if (t - tod_hack_tv >= 1000000 / rate) { - tod_hack_tv += 1000000 / rate; - tod_diff_cnt += 1000000 - (1000000 / rate) * rate; - tod_hack_tv += tod_diff_cnt / rate; - tod_diff_cnt %= rate; - docount = 1; - } - if (docount) { - ciaatod++; - ciaatod &= 0x00ffffff; - tod_hack_tod_last = ciaatod; - ciaa_checkalarm(false); } + if (checkalarm (ciabtod, ciabalarm, inc)) { + if (irq) { + ciabicr |= 4; + RethinkICRB (); + } + } } -static int resetwarning_phase, resetwarning_timer; - -static void setcode(uae_u8 keycode) +STATIC_INLINE void ciaa_checkalarm (bool inc) { - kbcode = ~((keycode << 1) | (keycode >> 7)); + if (checkalarm (ciaatod, ciaaalarm, inc)) { + ciaaicr |= 4; + RethinkICRA (); + } } -static void sendrw(void) +static void setcode (uae_u8 keycode) +{ + kbcode = ~((keycode << 1) | (keycode >> 7)); +} + +static void keyreq (void) { - setcode(AK_RESETWARNING); ciaasdr = kbcode; kblostsynccnt = 8 * maxvpos * 8; // 8 frames * 8 bits. ciaaicr |= 8; - RethinkICRA(); - write_log(_T("KB: sent reset warning code (phase=%d)\n"), resetwarning_phase); -} - -int resetwarning_do(int canreset) -{ - if (!currprefs.keyboard_connected) - return 0; - if (resetwarning_phase || regs.halted > 0) { - /* just force reset if second reset happens during resetwarning */ - if (canreset) { - resetwarning_phase = 0; - resetwarning_timer = 0; - } - return 0; - } - resetwarning_phase = 1; - resetwarning_timer = maxvpos_nom * 5; - write_log(_T("KB: reset warning triggered\n")); - sendrw(); - return 1; -} - -static void resetwarning_check(void) -{ - if (resetwarning_timer > 0) { - resetwarning_timer--; - if (resetwarning_timer <= 0) { - write_log(_T("KB: reset warning forced reset. Phase=%d\n"), resetwarning_phase); - resetwarning_phase = -1; - kblostsynccnt = 0; - //send_internalevent(INTERNALEVENT_KBRESET); - uae_reset(0, 1); - } - } - if (resetwarning_phase == 1) { - if (!kblostsynccnt) { /* first AK_RESETWARNING handshake received */ - write_log(_T("KB: reset warning second phase..\n")); - resetwarning_phase = 2; - resetwarning_timer = maxvpos_nom * 5; - sendrw(); - } - } - else if (resetwarning_phase == 2) { - if (ciaacra & 0x40) { /* second AK_RESETWARNING handshake active */ - resetwarning_phase = 3; - write_log(_T("KB: reset warning SP = output\n")); - /* System won't reset until handshake signal becomes inactive or 10s has passed */ - resetwarning_timer = 10 * maxvpos_nom * vblank_hz; - } - } - else if (resetwarning_phase == 3) { - if (!(ciaacra & 0x40)) { /* second AK_RESETWARNING handshake disabled */ - write_log(_T("KB: reset warning end by software. reset.\n")); - resetwarning_phase = -1; - kblostsynccnt = 0; - //send_internalevent(INTERNALEVENT_KBRESET); - uae_reset(0, 1); - } - } -} - -void CIA_hsync_prehandler(void) -{ -} - -static void keyreq(void) -{ -#if KB_DEBUG - write_log(_T("code=%02x (%02x)\n"), kbcode, (uae_u8)(~((kbcode >> 1) | (kbcode << 7)))); -#endif - ciaasdr = kbcode; - kblostsynccnt = 8 * maxvpos * 8; // 8 frames * 8 bits. - ciaaicr |= 8; - RethinkICRA(); + RethinkICRA (); } /* All this complexity to lazy evaluate TOD increase. -* Only increase it cycle-exactly if it is visible to running program: -* causes interrupt or program is reading or writing TOD registers -*/ + * Only increase it cycle-exactly if it is visible to running program: + * causes interrupt or program is reading or writing TOD registers + */ static int ciab_tod_hoffset; static int ciab_tod_event_state; @@ -747,279 +448,152 @@ static int ciab_tod_event_state; // Possibly TICK input pin has built-in debounce circuit #define TOD_INC_DELAY (14 * (ECLOCK_DATA_CYCLE + ECLOCK_WAIT_CYCLE) / 2) -static void CIAB_tod_inc(bool irq) +static void CIAB_tod_inc (bool irq) { ciab_tod_event_state = 3; // done if (!ciabtodon) return; ciabtod++; ciabtod &= 0xFFFFFF; - ciab_checkalarm(true, irq); + ciab_checkalarm (true, irq); } -static void CIAB_tod_inc_event(uae_u32 v) +void CIAB_tod_inc_event (uae_u32 v) { if (ciab_tod_event_state != 2) return; - CIAB_tod_inc(true); + CIAB_tod_inc (true); } // Someone reads or writes TOD registers, sync TOD increase -static void CIAB_tod_check(void) +static void CIAB_tod_check (void) { if (ciab_tod_event_state != 1 || !ciabtodon) return; - int hpos = current_hpos(); + int hpos = current_hpos (); hpos -= ciab_tod_hoffset; if (hpos >= 0 || currprefs.m68k_speed < 0) { // Program should see the changed TOD - CIAB_tod_inc(true); + CIAB_tod_inc (true); return; } // Not yet, add event to guarantee exact TOD inc position ciab_tod_event_state = 2; // event active - event2_newevent_xx(-1, -hpos, 0, CIAB_tod_inc_event); + event2_newevent(ev2_ciab_tod, -hpos, 0); } -void CIAB_tod_handler(int hoffset) +void CIAB_tod_handler (int hoffset) { if (!ciabtodon) return; ciab_tod_hoffset = hoffset + TOD_INC_DELAY; ciab_tod_event_state = 1; // TOD inc needed - if (checkalarm((ciabtod + 1) & 0xffffff, ciabalarm, true, 1)) { + if (checkalarm ((ciabtod + 1) & 0xffffff, ciabalarm, true)) { // causes interrupt on this line, add event ciab_tod_event_state = 2; // event active - event2_newevent_xx(-1, ciab_tod_hoffset, 0, CIAB_tod_inc_event); + event2_newevent(ev2_ciab_tod, ciab_tod_hoffset, 0); } } -void keyboard_connected(bool connect) +STATIC_INLINE void check_keyboard(void) { - if (connect) { - write_log(_T("Keyboard connected\n")); - } - else { - write_log(_T("Keyboard disconnected\n")); - } - kbstate = 0; - kblostsynccnt = 0; - resetwarning_phase = 0; -} - -static void check_keyboard(void) -{ - if (currprefs.keyboard_connected) { - if ((keys_available() || kbstate < 3) && !kblostsynccnt) { - switch (kbstate) - { - case 0: - kbcode = 0; /* powerup resync */ - kbstate++; - break; - case 1: - setcode(AK_INIT_POWERUP); - kbstate++; - break; - case 2: - setcode(AK_TERM_POWERUP); - kbstate++; - break; - case 3: - kbcode = ~get_next_key(); - break; - } - keyreq(); - } - } - else { - while (keys_available()) { - get_next_key(); - } + if ((keys_available() || kbstate < 3) && !kblostsynccnt) { + switch (kbstate) + { + case 0: + kbcode = 0; /* powerup resync */ + kbstate++; + break; + case 1: + setcode (AK_INIT_POWERUP); + kbstate++; + break; + case 2: + setcode (AK_TERM_POWERUP); + kbstate++; + break; + case 3: + kbcode = ~get_next_key (); + break; + } + keyreq (); } } -void CIA_hsync_posthandler(bool ciahsync, bool dotod) +void CIA_hsync_posthandler (bool ciahsync) { if (ciahsync) { // cia hysnc // Previous line was supposed to increase TOD but // no one cared. Do it now. if (ciab_tod_event_state == 1) - CIAB_tod_inc(false); + CIAB_tod_inc (false); ciab_tod_event_state = 0; - - if (currprefs.tod_hack && ciaatodon) - do_tod_hack(dotod); - } - else if (currprefs.keyboard_connected) { + } else { // custom hsync - if (resetwarning_phase) { - resetwarning_check(); - while (keys_available()) - get_next_key(); - } - else { - if ((hsync_counter & 15) == 0) - check_keyboard(); - } - } - else { - while (keys_available()) { - get_next_key(); - } - } + if ((hsync_counter & 15) == 0) + check_keyboard(); + } } -static void calc_led(int old_led) +void CIA_vsync_prehandler (void) { - unsigned long c = get_cycles(); - unsigned long t = (c - led_cycle) / CYCLE_UNIT; - if (old_led) - led_cycles_on += t; - else - led_cycles_off += t; - led_cycle = c; -} - -static void led_vsync(void) -{ - int v; - - calc_led(led); - if (led_cycles_on && !led_cycles_off) - v = 255; - else if (led_cycles_off && !led_cycles_on) - v = 0; - else if (led_cycles_off) - v = led_cycles_on * 255 / (led_cycles_on + led_cycles_off); - else - v = 255; - if (v < 0) - v = 0; - if (v > 255) - v = 255; - gui_data.powerled_brightness = v; - led_cycles_on = 0; - led_cycles_off = 0; - if (led_old_brightness != gui_data.powerled_brightness) { - gui_data.powerled = gui_data.powerled_brightness > 127; - //gui_led(LED_POWER, gui_data.powerled, gui_data.powerled_brightness); - gui_led(LED_POWER, gui_data.powerled); - led_filter_audio(); - } - led_old_brightness = gui_data.powerled_brightness; - led_cycle = get_cycles(); -} - -static void write_battclock(void); -void CIA_vsync_prehandler(void) -{ - if (heartbeat_cnt > 0) - heartbeat_cnt--; - if (rtc_delayed_write < 0) { - rtc_delayed_write = 50; - } - else if (rtc_delayed_write > 0) { - rtc_delayed_write--; - if (rtc_delayed_write == 0) - write_battclock(); - } - led_vsync(); - CIA_handler(); + CIA_handler (); if (kblostsynccnt > 0) { kblostsynccnt -= maxvpos; if (kblostsynccnt <= 0) { kblostsynccnt = 0; - keyreq(); -#if KB_DEBUG - write_log(_T("lostsync\n")); -#endif + keyreq (); } } } -static void CIAA_tod_handler(uae_u32 v) +void CIAA_tod_handler (uae_u32 v) { ciaatod++; - ciaatod &= 0xFFFFFF; - ciaa_checkalarm(true); + ciaatod &= 0xFFFFFF; + ciaa_checkalarm (true); } -void CIAA_tod_inc(int cycles) +void CIAA_tod_inc (int cycles) { -#ifdef TOD_HACK - if (currprefs.tod_hack && tod_hack_enabled == 1) - return; -#endif if (!ciaatodon) return; - event2_newevent_xx(-1, cycles + TOD_INC_DELAY, 0, CIAA_tod_handler); + event2_newevent(ev2_ciaa_tod, cycles + TOD_INC_DELAY, 0); } -static void check_led(void) +STATIC_INLINE void check_led (void) { - uae_u8 v = ciaapra; - bool led2; + uae_u8 v = ciaapra; + bool led2; - v |= ~ciaadra; /* output is high when pin's direction is input */ - led2 = (v & 2) ? 0 : 1; - if (led2 != led) { - calc_led(led); - led = led2; - led_old_brightness = -1; - } + v |= ~ciaadra; /* output is high when pin's direction is input */ + led2 = (v & 2) ? 0 : 1; + if (led2 != led) { + led = led2; + gui_data.powerled = led2; + led_filter_audio(); + } } -static void bfe001_change(void) +static void bfe001_change (void) { - uae_u8 v = ciaapra; - check_led(); - if (currprefs.cs_ciaoverlay && (v & 1) != oldovl) { - oldovl = v & 1; - if (!oldovl) { - map_overlay(1); - } - else { - //activate_debugger (); - map_overlay(0); - } - } + uae_u8 v = ciaapra; + check_led (); + if (currprefs.cs_ciaoverlay && (v & 1) != oldovl) { + oldovl = v & 1; + if (!oldovl) { + map_overlay (1); + } else { + map_overlay (0); + } + } if (currprefs.cs_cd32cd && (v & 1) != oldcd32mute) { oldcd32mute = v & 1; - akiko_mute(oldcd32mute ? 0 : 1); + akiko_mute (oldcd32mute ? 0 : 1); } } -static uae_u32 getciatod(uae_u32 tod) -{ - if (!currprefs.cs_cia6526) - return tod; - uae_u32 bcdtod = 0; - for (int i = 0; i < 4; i++) { - int val = tod % 10; - bcdtod *= 16; - bcdtod += val; - tod /= 10; - } - return bcdtod; -} -static void setciatod(unsigned long *tod, uae_u32 v) -{ - if (!currprefs.cs_cia6526) { - *tod = v; - return; - } - uae_u32 bintod = 0; - for (int i = 0; i < 4; i++) { - int val = v / 16; - bintod *= 10; - bintod += val; - v /= 16; - } - *tod = bintod; -} - static uae_u8 ReadCIAA (unsigned int addr) { unsigned int tmp; @@ -1029,12 +603,17 @@ static uae_u8 ReadCIAA (unsigned int addr) switch (reg) { case 0: - tmp = DISK_status() & 0x3c; - tmp |= handle_joystick_buttons (ciaapra, ciaadra); - tmp |= (ciaapra | (ciaadra ^ 3)) & 0x03; - return tmp; + { +#ifdef ACTION_REPLAY + action_replay_cia_access(false); +#endif + uae_u8 v = DISK_status_ciaa() & 0x3c; + v |= handle_joystick_buttons (ciaapra, ciaadra); + v |= (ciaapra | (ciaadra ^ 3)) & 0x03; + return v; + } case 1: -#ifdef INPUTDEVICE_SIMPLE +#if defined(INPUTDEVICE_SIMPLE) && !defined(AMIBERRY) tmp = (ciaaprb & ciaadrb) | (ciaadrb ^ 0xff); #else tmp = handle_parport_joystick (0, ciaaprb, ciaadrb); @@ -1078,13 +657,16 @@ static uae_u8 ReadCIAA (unsigned int addr) else return (uae_u8)(ciaatod >> 8); case 10: - if (!ciaatlatch) { /* only if not already latched. A1200 confirmed. (TW) */ + /* only if not already latched. A1200 confirmed. (TW) */ + if (!ciaatlatch) { /* no latching if ALARM is set */ if (!(ciaacrb & 0x80)) ciaatlatch = 1; ciaatol = ciaatod; } return (uae_u8)(ciaatol >> 16); + case 11: + break; case 12: return ciaasdr; case 13: @@ -1109,7 +691,7 @@ static uae_u8 ReadCIAB (unsigned int addr) switch (reg) { case 0: tmp = 0; -#ifdef INPUTDEVICE_SIMPLE +#if defined(INPUTDEVICE_SIMPLE) && !defined(AMIBERRY) tmp = ((ciabpra & ciabdra) | (ciabdra ^ 0xff)) & 0x7; #else tmp |= handle_parport_joystick (1, ciabpra, ciabdra); @@ -1145,17 +727,20 @@ static uae_u8 ReadCIAB (unsigned int addr) case 7: return (uae_u8)((ciabtb - ciabtb_passed) >> 8); case 8: + CIAB_tod_check (); if (ciabtlatch) { ciabtlatch = 0; return (uae_u8)ciabtol; } else return (uae_u8)ciabtod; case 9: + CIAB_tod_check (); if (ciabtlatch) return (uae_u8)(ciabtol >> 8); else return (uae_u8)(ciabtod >> 8); case 10: + CIAB_tod_check (); if (!ciabtlatch) { /* no latching if ALARM is set */ if (!(ciabcrb & 0x80)) @@ -1163,6 +748,8 @@ static uae_u8 ReadCIAB (unsigned int addr) ciabtol = ciabtod; } return (uae_u8)(ciabtol >> 16); + case 11: + break; case 12: return ciabsdr; case 13: @@ -1177,385 +764,258 @@ static uae_u8 ReadCIAB (unsigned int addr) return 0; } -static void WriteCIAA(uae_u16 addr, uae_u8 val) +static void WriteCIAA (uae_u16 addr,uae_u8 val) { int reg = addr & 15; -#if CIAA_DEBUG_W > 0 - write_log(_T("W_CIAA: bfe%x01 %02X %08X\n"), reg, val, M68K_GETPC); -#endif #ifdef ACTION_REPLAY ar_ciaa[reg] = val; #endif - if (!currprefs.cs_ciaoverlay && oldovl) { - map_overlay(1); - oldovl = 0; - } - switch (reg) { - case 0: -#if DONGLE_DEBUG > 0 - if (notinrom()) - write_log(_T("BFE001 W %02X %s\n"), val, debuginfo(0)); -#endif - ciaapra = (ciaapra & ~0xc3) | (val & 0xc3); - bfe001_change(); - handle_cd32_joystick_cia(ciaapra, ciaadra); - //dongle_cia_write(0, reg, val); -#ifdef AMAX - if (is_device_rom(&currprefs, ROMTYPE_AMAX, 0) > 0) - amax_bfe001_write(val, ciaadra); -#endif - break; - case 1: -#if DONGLE_DEBUG > 0 - if (notinrom()) - write_log(_T("BFE101 W %02X %s\n"), val, debuginfo(0)); -#endif - ciaaprb = val; - //dongle_cia_write(0, reg, val); -#ifdef PARALLEL_PORT - if (isprinter() > 0) { - doprinter(val); - cia_parallelack(); - } - else if (isprinter() < 0) { - parallel_direct_write_data(val, ciaadrb); - cia_parallelack(); -#ifdef ARCADIA - } - else if (arcadia_bios) { - arcadia_parport(1, ciaaprb, ciaadrb); -#endif - } - else if (parallel_port_scsi) { - parallel_port_scsi_write(0, ciaaprb, ciaadrb); - } -#endif - break; - case 2: -#if DONGLE_DEBUG > 0 - if (notinrom()) - write_log(_T("BFE201 W %02X %s\n"), val, debuginfo(0)); -#endif - ciaadra = val; - //dongle_cia_write(0, reg, val); - bfe001_change(); - break; - case 3: - ciaadrb = val; - //dongle_cia_write(0, reg, val); -#if DONGLE_DEBUG > 0 - if (notinrom()) - write_log(_T("BFE301 W %02X %s\n"), val, debuginfo(0)); -#endif -#ifdef ARCADIA - if (arcadia_bios) - arcadia_parport(1, ciaaprb, ciaadrb); -#endif - break; - case 4: - CIA_update(); - ciaala = (ciaala & 0xff00) | val; - CIA_calctimers(); - break; - case 5: - CIA_update(); - ciaala = (ciaala & 0xff) | (val << 8); - if ((ciaacra & 1) == 0) - ciaata = ciaala; - if (ciaacra & 8) { - ciaata = ciaala; - ciaacra |= 1; + if (!currprefs.cs_ciaoverlay && oldovl) { + map_overlay (1); + oldovl = 0; + } + switch (reg) { + case 0: + ciaapra = (ciaapra & ~0xc3) | (val & 0xc3); + bfe001_change (); + handle_cd32_joystick_cia (ciaapra, ciaadra); + break; + case 1: + ciaaprb = val; + break; + case 2: + ciaadra = val; + bfe001_change (); + break; + case 3: + ciaadrb = val; + break; + case 4: + CIA_update (); + ciaala = (ciaala & 0xff00) | val; + CIA_calctimers (); + break; + case 5: + CIA_update (); + ciaala = (ciaala & 0xff) | (val << 8); + if ((ciaacra & 1) == 0) + ciaata = ciaala; + if (ciaacra & 8) { + ciaata = ciaala; + ciaacra |= 1; ciaastarta = CIASTARTCYCLESHI; - } - CIA_calctimers(); - break; - case 6: - CIA_update(); - ciaalb = (ciaalb & 0xff00) | val; - CIA_calctimers(); - break; - case 7: - CIA_update(); - ciaalb = (ciaalb & 0xff) | (val << 8); - if ((ciaacrb & 1) == 0) - ciaatb = ciaalb; - if (ciaacrb & 8) { - ciaatb = ciaalb; - ciaacrb |= 1; + } + CIA_calctimers (); + break; + case 6: + CIA_update (); + ciaalb = (ciaalb & 0xff00) | val; + CIA_calctimers (); + break; + case 7: + CIA_update (); + ciaalb = (ciaalb & 0xff) | (val << 8); + if ((ciaacrb & 1) == 0) + ciaatb = ciaalb; + if (ciaacrb & 8) { + ciaatb = ciaalb; + ciaacrb |= 1; ciaastartb = CIASTARTCYCLESHI; - } - CIA_calctimers(); - break; - case 8: - if (ciaacrb & 0x80) { - setciatod(&ciaaalarm, (getciatod(ciaaalarm) & ~0xff) | val); - } - else { - setciatod(&ciaatod, (getciatod(ciaatod) & ~0xff) | val); - ciaatodon = 1; - ciaa_checkalarm(false); - } - break; - case 9: - if (ciaacrb & 0x80) { - setciatod(&ciaaalarm, (getciatod(ciaaalarm) & ~0xff00) | (val << 8)); - } - else { - setciatod(&ciaatod, (getciatod(ciaatod) & ~0xff00) | (val << 8)); - } - break; - case 10: - if (ciaacrb & 0x80) { - setciatod(&ciaaalarm, (getciatod(ciaaalarm) & ~0xff0000) | (val << 16)); - } - else { - setciatod(&ciaatod, (getciatod(ciaatod) & ~0xff0000) | (val << 16)); - if (!currprefs.cs_cia6526) - ciaatodon = 0; - } - break; + } + CIA_calctimers (); + break; + case 8: + if (ciaacrb & 0x80) { + ciaaalarm = (ciaaalarm & ~0xff) | val; + } else { + ciaatod = (ciaatod & ~0xff) | val; + ciaatodon = 1; + ciaa_checkalarm (false); + } + break; + case 9: + if (ciaacrb & 0x80) { + ciaaalarm = (ciaaalarm & ~0xff00) | (val << 8); + } else { + ciaatod = (ciaatod & ~0xff00) | (val << 8); + } + break; + case 10: + if (ciaacrb & 0x80) { + ciaaalarm = (ciaaalarm & ~0xff0000) | (val << 16); + } else { + ciaatod = (ciaatod & ~0xff0000) | (val << 16); + ciaatodon = 0; + } + break; case 11: - if (currprefs.cs_cia6526) { - if (ciaacrb & 0x80) { - setciatod(&ciaaalarm, (getciatod(ciaaalarm) & ~0xff000000) | (val << 24)); - } - else { - setciatod(&ciaatod, (getciatod(ciaatod) & ~0xff000000) | (val << 24)); - ciaatodon = 0; - } - } break; - case 12: - CIA_update(); - ciaasdr = val; - if ((ciaacra & 0x41) == 0x41 && ciaasdr_cnt == 0) - ciaasdr_cnt = 8 * 2; -#if KB_DEBUG - write_log(_T("CIAA serial port write: %02x cnt=%d PC=%08x\n"), ciaasdr, ciaasdr_cnt, M68K_GETPC); -#endif - CIA_calctimers(); - break; - case 13: - setclr(&ciaaimask, val); - RethinkICRA(); - break; - case 14: - CIA_update(); - val &= 0x7f; /* bit 7 is unused */ - if ((val & 1) && !(ciaacra & 1)) - ciaastarta = CIASTARTCYCLESCRA; - //if (currprefs.cpuboard_type != 0 && (val & 0x40) != (ciaacra & 0x40)) { - // /* bleh, Phase5 CPU timed early boot key check fix.. */ - // if (m68k_getpc() >= 0xf00000 && m68k_getpc() < 0xf80000) - // check_keyboard(); - //} - if ((val & 0x40) == 0 && (ciaacra & 0x40) != 0) { - /* todo: check if low to high or high to low only */ - kblostsynccnt = 0; -#if KB_DEBUG - write_log(_T("KB_ACK %02x->%02x %08x\n"), ciaacra, val, M68K_GETPC); -#endif - } - ciaacra = val; - if (ciaacra & 0x10) { - ciaacra &= ~0x10; - ciaata = ciaala; - } - CIA_calctimers(); - break; - case 15: - CIA_update(); - if ((val & 1) && !(ciaacrb & 1)) - ciaastartb = CIASTARTCYCLESCRA; - ciaacrb = val; - if (ciaacrb & 0x10) { - ciaacrb &= ~0x10; - ciaatb = ciaalb; - } - CIA_calctimers(); - break; - } + case 12: + CIA_update (); + ciaasdr = val; + if ((ciaacra & 0x41) == 0x41 && ciaasdr_cnt == 0) + ciaasdr_cnt = 8 * 2; + CIA_calctimers (); + break; + case 13: + setclr(&ciaaimask,val); + RethinkICRA (); + break; + case 14: + CIA_update (); + val &= 0x7f; /* bit 7 is unused */ + if ((val & 1) && !(ciaacra & 1)) + ciaastarta = CIASTARTCYCLESCRA; + if ((val & 0x40) == 0 && (ciaacra & 0x40) != 0) { + /* todo: check if low to high or high to low only */ + kblostsynccnt = 0; + } + ciaacra = val; + if (ciaacra & 0x10) { + ciaacra &= ~0x10; + ciaata = ciaala; + } + CIA_calctimers (); + break; + case 15: + CIA_update (); + if ((val & 1) && !(ciaacrb & 1)) + ciaastartb = CIASTARTCYCLESCRA; + ciaacrb = val; + if (ciaacrb & 0x10) { + ciaacrb &= ~0x10; + ciaatb = ciaalb; + } + CIA_calctimers (); + break; + } } -static void WriteCIAB(uae_u16 addr, uae_u8 val) +static void WriteCIAB (uae_u16 addr,uae_u8 val) { int reg = addr & 15; -#if CIAB_DEBUG_W > 0 - if (((addr >= 8 && addr <= 10) || addr == 15) || CIAB_DEBUG_W > 1) - write_log(_T("W_CIAB: bfd%x00 %02X %08X\n"), reg, val, M68K_GETPC); -#endif #ifdef ACTION_REPLAY ar_ciab[reg] = val; #endif - switch (reg) { - case 0: -#if DONGLE_DEBUG > 0 - if (notinrom()) - write_log(_T("BFD000 W %02X %s\n"), val, debuginfo(0)); -#endif - //dongle_cia_write(1, reg, val); - ciabpra = val; -#ifdef SERIAL_PORT - if (currprefs.use_serial) - serial_writestatus(ciabpra, ciabdra); -#endif -#ifdef PARALLEL_PORT - if (isprinter() < 0) { - parallel_direct_write_status(val, ciabdra); - } - else if (parallel_port_scsi) { - parallel_port_scsi_write(1, ciabpra, ciabdra); - } -#endif - break; - case 1: + switch (reg) { + case 0: + ciabpra = val; + break; + case 1: #ifdef ACTION_REPLAY action_replay_cia_access(true); #endif -#if DONGLE_DEBUG > 0 - if (notinrom()) - write_log(_T("BFD100 W %02X %s\n"), val, debuginfo(0)); -#endif - //dongle_cia_write(1, reg, val); - ciabprb = val; - DISK_select(val); - break; - case 2: -#if DONGLE_DEBUG > 0 - if (notinrom()) - write_log(_T("BFD200 W %02X %s\n"), val, debuginfo(0)); -#endif - //dongle_cia_write(1, reg, val); - ciabdra = val; -#ifdef SERIAL_PORT - if (currprefs.use_serial) - serial_writestatus(ciabpra, ciabdra); -#endif - break; - case 3: -#if DONGLE_DEBUG > 0 - if (notinrom()) - write_log(_T("BFD300 W %02X %s\n"), val, debuginfo(0)); -#endif - //dongle_cia_write(1, reg, val); - ciabdrb = val; - break; - case 4: - CIA_update(); - ciabla = (ciabla & 0xff00) | val; - CIA_calctimers(); - break; - case 5: - CIA_update(); - ciabla = (ciabla & 0xff) | (val << 8); - if ((ciabcra & 1) == 0) - ciabta = ciabla; - if (ciabcra & 8) { - ciabta = ciabla; - ciabcra |= 1; + ciabprb = val; + DISK_select(val); + break; + case 2: + ciabdra = val; + break; + case 3: + ciabdrb = val; + break; + case 4: + CIA_update (); + ciabla = (ciabla & 0xff00) | val; + CIA_calctimers (); + break; + case 5: + CIA_update (); + ciabla = (ciabla & 0xff) | (val << 8); + if ((ciabcra & 1) == 0) + ciabta = ciabla; + if (ciabcra & 8) { + ciabta = ciabla; + ciabcra |= 1; ciabstarta = CIASTARTCYCLESHI; - } - CIA_calctimers(); - break; - case 6: - CIA_update(); - ciablb = (ciablb & 0xff00) | val; - CIA_calctimers(); - break; - case 7: - CIA_update(); - ciablb = (ciablb & 0xff) | (val << 8); - if ((ciabcrb & 1) == 0) - ciabtb = ciablb; - if (ciabcrb & 8) { - ciabtb = ciablb; - ciabcrb |= 1; + } + CIA_calctimers (); + break; + case 6: + CIA_update (); + ciablb = (ciablb & 0xff00) | val; + CIA_calctimers (); + break; + case 7: + CIA_update (); + ciablb = (ciablb & 0xff) | (val << 8); + if ((ciabcrb & 1) == 0) + ciabtb = ciablb; + if (ciabcrb & 8) { + ciabtb = ciablb; + ciabcrb |= 1; ciabstartb = CIASTARTCYCLESHI; - } - CIA_calctimers(); - break; - case 8: - CIAB_tod_check(); - if (ciabcrb & 0x80) { - setciatod(&ciabalarm, (getciatod(ciabalarm) & ~0xff) | val); - } - else { - setciatod(&ciabtod, (getciatod(ciabtod) & ~0xff) | val); - ciabtodon = 1; - ciab_checkalarm(false, true); - } - break; - case 9: - CIAB_tod_check(); - if (ciabcrb & 0x80) { - setciatod(&ciabalarm, (getciatod(ciabalarm) & ~0xff00) | (val << 8)); - } - else { - setciatod(&ciabtod, (getciatod(ciabtod) & ~0xff00) | (val << 8)); - } - break; - case 10: - CIAB_tod_check(); - if (ciabcrb & 0x80) { - setciatod(&ciabalarm, (getciatod(ciabalarm) & ~0xff0000) | (val << 16)); - } - else { - setciatod(&ciabtod, (getciatod(ciabtod) & ~0xff0000) | (val << 16)); - if (!currprefs.cs_cia6526) - ciabtodon = 0; - } - break; + } + CIA_calctimers (); + break; + case 8: + CIAB_tod_check (); + if (ciabcrb & 0x80) { + ciabalarm = (ciabalarm & ~0xff) | val; + } else { + ciabtod = (ciabtod & ~0xff) | val; + ciabtodon = 1; + ciab_checkalarm (false, true); + } + break; + case 9: + CIAB_tod_check (); + if (ciabcrb & 0x80) { + ciabalarm = (ciabalarm & ~0xff00) | (val << 8); + } else { + ciabtod = (ciabtod & ~0xff00) | (val << 8); + } + break; + case 10: + CIAB_tod_check (); + if (ciabcrb & 0x80) { + ciabalarm = (ciabalarm & ~0xff0000) | (val << 16); + } else { + ciabtod = (ciabtod & ~0xff0000) | (val << 16); + ciabtodon = 0; + } + break; case 11: - if (currprefs.cs_cia6526) { - CIAB_tod_check(); - if (ciabcrb & 0x80) { - setciatod(&ciabalarm, (getciatod(ciabalarm) & ~0xff000000) | (val << 24)); - } - else { - setciatod(&ciabtod, (getciatod(ciabtod) & ~0xff000000) | (val << 24)); - ciabtodon = 0; - } - } break; - case 12: - CIA_update(); - ciabsdr = val; - if ((ciabcra & 0x40) == 0) - ciabsdr_cnt = 0; - if ((ciabcra & 0x41) == 0x41 && ciabsdr_cnt == 0) - ciabsdr_cnt = 8 * 2; - CIA_calctimers(); - break; - case 13: - setclr(&ciabimask, val); - RethinkICRB(); - break; - case 14: - CIA_update(); - val &= 0x7f; /* bit 7 is unused */ - if ((val & 1) && !(ciabcra & 1)) - ciabstarta = CIASTARTCYCLESCRA; - ciabcra = val; - if (ciabcra & 0x10) { - ciabcra &= ~0x10; - ciabta = ciabla; - } - CIA_calctimers(); - break; - case 15: - CIA_update(); - if ((val & 1) && !(ciabcrb & 1)) - ciabstartb = CIASTARTCYCLESCRA; - ciabcrb = val; - if (ciabcrb & 0x10) { - ciabcrb &= ~0x10; - ciabtb = ciablb; - } - CIA_calctimers(); - break; - } + case 12: + CIA_update (); + ciabsdr = val; + if ((ciabcra & 0x40) == 0) + ciabsdr_cnt = 0; + if ((ciabcra & 0x41) == 0x41 && ciabsdr_cnt == 0) + ciabsdr_cnt = 8 * 2; + CIA_calctimers (); + break; + case 13: + setclr(&ciabimask,val); + RethinkICRB (); + break; + case 14: + CIA_update (); + val &= 0x7f; /* bit 7 is unused */ + if ((val & 1) && !(ciabcra & 1)) + ciabstarta = CIASTARTCYCLESCRA; + ciabcra = val; + if (ciabcra & 0x10) { + ciabcra &= ~0x10; + ciabta = ciabla; + } + CIA_calctimers (); + break; + case 15: + CIA_update (); + if ((val & 1) && !(ciabcrb & 1)) + ciabstartb = CIASTARTCYCLESCRA; + ciabcrb = val; + if (ciabcrb & 0x10) { + ciabcrb &= ~0x10; + ciabtb = ciablb; + } + CIA_calctimers (); + break; + } } void cia_set_overlay (bool overlay) @@ -1563,89 +1023,69 @@ void cia_set_overlay (bool overlay) oldovl = overlay; } -void CIA_reset(void) -{ -#ifdef TOD_HACK - tod_hack_tv = 0; - tod_hack_tod = 0; - tod_hack_enabled = 0; - if (currprefs.tod_hack) - tod_hack_enabled = TOD_HACK_TIME; -#endif +/* CIA memory access */ - kblostsynccnt = 0; - serbits = 0; +DECLARE_MEMORY_FUNCTIONS(cia); +static uae_u32 REGPARAM3 cia_bget_compatible (uaecptr) REGPARAM; +addrbank cia_bank = { + cia_lget, cia_wget, cia_bget, + cia_lput, cia_wput, cia_bput, + default_xlate, default_check, NULL, NULL, _T("CIA"), + cia_lgeti, cia_wgeti, + ABFLAG_IO | ABFLAG_CIA, S_READ, S_WRITE, NULL, 0x3f01, 0xbfc000 +}; + +void CIA_reset (void) +{ + if (currprefs.cpu_model == 68000 && currprefs.cpu_compatible) + cia_bank.bget = cia_bget_compatible; + else + cia_bank.bget = cia_bget; + + kblostsynccnt = 0; oldcd32mute = 1; - resetwarning_phase = resetwarning_timer = 0; - heartbeat_cnt = 0; ciab_tod_event_state = 0; - if (!savestate_state) { + if (!savestate_state) { oldovl = true; - kbstate = 0; - ciaatlatch = ciabtlatch = 0; - ciaapra = 0; ciaadra = 0; - ciaatod = ciabtod = 0; ciaatodon = ciabtodon = 0; - ciaaicr = ciabicr = ciaaimask = ciabimask = 0; - ciaacra = ciaacrb = ciabcra = ciabcrb = 0x4; /* outmode = toggle; */ - ciaala = ciaalb = ciabla = ciablb = ciaata = ciaatb = ciabta = ciabtb = 0xFFFF; - ciaaalarm = ciabalarm = 0; - ciabpra = 0x8C; ciabdra = 0; - div10 = 0; - ciaasdr_cnt = 0; ciaasdr = 0; - ciabsdr_cnt = 0; ciabsdr = 0; - ciaata_passed = ciaatb_passed = ciabta_passed = ciabtb_passed = 0; - CIA_calctimers(); - DISK_select_set(ciabprb); - } - map_overlay(0); - check_led(); -#ifdef SERIAL_PORT - if (currprefs.use_serial && !savestate_state) - serial_dtr_off(); /* Drop DTR at reset */ -#endif - if (savestate_state) { + kbstate = 0; + ciaatlatch = ciabtlatch = 0; + ciaapra = 0; ciaadra = 0; + ciaatod = ciabtod = 0; ciaatodon = ciabtodon = 0; + ciaaicr = ciabicr = ciaaimask = ciabimask = 0; + ciaacra = ciaacrb = ciabcra = ciabcrb = 0x4; /* outmode = toggle; */ + ciaala = ciaalb = ciabla = ciablb = ciaata = ciaatb = ciabta = ciabtb = 0xFFFF; + ciaaalarm = ciabalarm = 0; + ciabpra = 0x8C; ciabdra = 0; + div10 = 0; + ciaasdr_cnt = 0; ciaasdr = 0; + ciabsdr_cnt = 0; ciabsdr = 0; + ciaata_passed = ciaatb_passed = ciabta_passed = ciabtb_passed = 0; + ciaatol = ciabtol = ciaaprb = ciaadrb = ciabprb = ciabdrb = 0; + CIA_calctimers (); + DISK_select_set (ciabprb); + } + map_overlay (0); + check_led (); + if (savestate_state) { if (currprefs.cs_ciaoverlay) { oldovl = true; } - bfe001_change(); + bfe001_change (); if (!currprefs.cs_ciaoverlay) { - map_overlay(oldovl ? 0 : 1); + map_overlay (oldovl ? 0 : 1); } - } + } #ifdef CD32 - if (!isrestore()) { - akiko_reset(); - if (!akiko_init()) + if (!isrestore ()) { + akiko_reset (); + if (!akiko_init ()) currprefs.cs_cd32cd = changed_prefs.cs_cd32cd = 0; } #endif } -void dumpcia(void) -{ - write_log(_T("A: CRA %02x CRB %02x ICR %02x IM %02x TA %04x (%04x) TB %04x (%04x)\n"), - ciaacra, ciaacrb, ciaaicr, ciaaimask, ciaata, ciaala, ciaatb, ciaalb); - write_log(_T("TOD %06x (%06x) ALARM %06x %c%c CYC=%08X\n"), - ciaatod, ciaatol, ciaaalarm, ciaatlatch ? 'L' : ' ', ciaatodon ? ' ' : 'S', get_cycles()); - write_log(_T("B: CRA %02x CRB %02x ICR %02x IM %02x TA %04x (%04x) TB %04x (%04x)\n"), - ciabcra, ciabcrb, ciabicr, ciabimask, ciabta, ciabla, ciabtb, ciablb); - write_log(_T("TOD %06x (%06x) ALARM %06x %c%c CLK=%d\n"), - ciabtod, ciabtol, ciabalarm, ciabtlatch ? 'L' : ' ', ciabtodon ? ' ' : 'S', div10 / CYCLE_UNIT); -} - -/* CIA memory access */ - -DECLARE_MEMORY_FUNCTIONS(cia); -addrbank cia_bank = { - cia_lget, cia_wget, cia_bget, - cia_lput, cia_wput, cia_bput, - default_xlate, default_check, NULL, NULL, _T("CIA"), - cia_lgeti, cia_wgeti, - ABFLAG_IO | ABFLAG_CIA, S_READ, S_WRITE, NULL, 0x3f01, 0xbfc000 -}; - -static void cia_wait_pre(int cianummask) +static void cia_wait_pre (void) { if (currprefs.cachesize) return; @@ -1654,21 +1094,20 @@ static void cia_wait_pre(int cianummask) int cycles; if (div >= DIV10 * ECLOCK_DATA_CYCLE / 10) { - cycles = DIV10 - div; + cycles = DIV10 - div; cycles += DIV10 * ECLOCK_DATA_CYCLE / 10; - } - else if (div) { - cycles = DIV10 + DIV10 * ECLOCK_DATA_CYCLE / 10 - div; - } - else { + } else if (div) { + cycles = DIV10 + DIV10 * ECLOCK_DATA_CYCLE / 10 - div; + } else { cycles = DIV10 * ECLOCK_DATA_CYCLE / 10 - div; } - if (cycles) { - do_cycles(cycles); + + if (cycles) { + do_cycles (cycles); } } -static void cia_wait_post(int cianummask, uae_u32 value) +static void cia_wait_post (uae_u32 value) { if (currprefs.cachesize) { do_cycles (8 * CYCLE_UNIT / 2); @@ -1683,7 +1122,7 @@ static void cia_wait_post(int cianummask, uae_u32 value) STATIC_INLINE bool issinglecia(void) { - return currprefs.cs_ide || currprefs.cs_pcmcia || currprefs.cs_mbdmac || currprefs.cs_cd32cd; + return currprefs.cs_ide || currprefs.cs_pcmcia || currprefs.cs_cd32cd; } STATIC_INLINE bool isgayle(void) { @@ -1699,7 +1138,7 @@ STATIC_INLINE bool iscia(uaecptr addr) static bool isgaylenocia(uaecptr addr) { - if (!isgayle()) + if (!isgayle ()) return true; // gayle CIA region is only 4096 bytes at 0xbfd000 and 0xbfe000 return iscia(addr); @@ -1725,7 +1164,46 @@ static int cia_chipselect(uaecptr addr) return cs; } -static uae_u32 REGPARAM2 cia_bget(uaecptr addr) +static uae_u32 REGPARAM2 cia_bget_compatible (uaecptr addr) +{ + int r = (addr & 0xf00) >> 8; + uae_u8 v = 0; + + if (isgarynocia(addr)) + return dummy_get(addr, 1, false, 0); + + if (!isgaylenocia (addr)) + return dummy_get(addr, 1, false, 0); + + switch (cia_chipselect(addr)) { + case 0: + if (!issinglecia ()) { + cia_wait_pre (); + v = (addr & 1) ? ReadCIAA (r) : ReadCIAB (r); + cia_wait_post (v); + } + break; + case 1: + cia_wait_pre (); + v = (addr & 1) ? regs.irc : ReadCIAB (r); + cia_wait_post (v); + break; + case 2: + cia_wait_pre (); + v = (addr & 1) ? ReadCIAA (r) : regs.irc >> 8; + cia_wait_post (v); + break; + case 3: + cia_wait_pre (); + v = (addr & 1) ? regs.irc : regs.irc >> 8; + cia_wait_post (v); + break; + } + + return v; +} + +static uae_u32 REGPARAM2 cia_bget (uaecptr addr) { int r = (addr & 0xf00) >> 8; uae_u8 v = 0; @@ -1733,53 +1211,36 @@ static uae_u32 REGPARAM2 cia_bget(uaecptr addr) if (isgarynocia(addr)) return dummy_get(addr, 1, false, 0); - if (!isgaylenocia(addr)) + if (!isgaylenocia (addr)) return dummy_get(addr, 1, false, 0); - switch (cia_chipselect(addr)) - { - case 0: - if (!issinglecia()) { - cia_wait_pre(1 | 2); - v = (addr & 1) ? ReadCIAA(r) : ReadCIAB(r); - cia_wait_post(1 | 2, v); - } - break; - case 1: - cia_wait_pre(2); - if (currprefs.cpu_model == 68000 && currprefs.cpu_compatible) { - v = (addr & 1) ? regs.irc : ReadCIAB(r); - } - else { - v = (addr & 1) ? dummy_get(addr, 1, false, 0) : ReadCIAB(r); - } - cia_wait_post(2, v); - break; - case 2: - cia_wait_pre(1); - if (currprefs.cpu_model == 68000 && currprefs.cpu_compatible) - v = (addr & 1) ? ReadCIAA(r) : regs.irc >> 8; - else - v = (addr & 1) ? ReadCIAA(r) : dummy_get(addr, 1, false, 0); - cia_wait_post(1, v); - break; + switch (cia_chipselect(addr)) { + case 0: + if (!issinglecia ()) { + cia_wait_pre (); + v = (addr & 1) ? ReadCIAA (r) : ReadCIAB (r); + cia_wait_post (v); + } + break; + case 1: + cia_wait_pre (); + v = (addr & 1) ? dummy_get_safe(addr, 1, false, 0) : ReadCIAB (r); + cia_wait_post (v); + break; + case 2: + cia_wait_pre (); + v = (addr & 1) ? ReadCIAA (r) : dummy_get_safe(addr, 1, false, 0); + cia_wait_post (v); + break; case 3: - if (currprefs.cpu_model == 68000 && currprefs.cpu_compatible) { - cia_wait_pre(0); - v = (addr & 1) ? regs.irc : regs.irc >> 8; - cia_wait_post(0, v); - } - if (warned > 0 || currprefs.illegal_mem) { - write_log(_T("cia_bget: unknown CIA address %08X=%02X PC=%08X\n"), addr, v & 0xff, M68K_GETPC); - warned--; - } - break; - } + v = 0xff; + break; + } - return v; + return v; } -static uae_u32 REGPARAM2 cia_wget(uaecptr addr) +static uae_u32 REGPARAM2 cia_wget (uaecptr addr) { int r = (addr & 0xf00) >> 8; uae_u16 v = 0; @@ -1787,632 +1248,435 @@ static uae_u32 REGPARAM2 cia_wget(uaecptr addr) if (isgarynocia(addr)) return dummy_get(addr, 2, false, 0); - if (!isgaylenocia(addr)) - return dummy_get(addr, 2, false, 0); + if (!isgaylenocia (addr)) + return dummy_get_safe(addr, 2, false, 0); - switch (cia_chipselect(addr)) - { - case 0: - if (!issinglecia()) + switch (cia_chipselect(addr)) + { + case 0: + if (!issinglecia ()) { - cia_wait_pre(1 | 2); - v = (ReadCIAB(r) << 8) | ReadCIAA(r); - cia_wait_post(1 | 2, v); + cia_wait_pre (); + v = (ReadCIAB (r) << 8) | ReadCIAA (r); + cia_wait_post (v); } - break; - case 1: - cia_wait_pre(2); - v = (ReadCIAB(r) << 8) | dummy_get(addr, 1, false, 0); - cia_wait_post(2, v); - break; - case 2: - cia_wait_pre(1); - v = (dummy_get(addr, 1, false, 0) << 8) | ReadCIAA(r); - cia_wait_post(1, v); - break; + break; + case 1: + cia_wait_pre (); + v = (ReadCIAB (r) << 8) | dummy_get_safe(addr, 1, false, 0); + cia_wait_post (v); + break; + case 2: + cia_wait_pre (); + v = (dummy_get_safe(addr, 1, false, 0) << 8) | ReadCIAA (r); + cia_wait_post (v); + break; case 3: - if (currprefs.cpu_model == 68000 && currprefs.cpu_compatible) { - cia_wait_pre(0); - v = regs.irc; - cia_wait_post(0, v); - } - if (warned > 0 || currprefs.illegal_mem) { - write_log(_T("cia_wget: unknown CIA address %08X=%04X PC=%08X\n"), addr, v & 0xffff, M68K_GETPC); - warned--; - } - break; - } - return v; + if (currprefs.cpu_model == 68000 && currprefs.cpu_compatible) { + cia_wait_pre (); + v = regs.irc; + cia_wait_post (v); + } + break; + } + return v; } -static uae_u32 REGPARAM2 cia_lget(uaecptr addr) +static uae_u32 REGPARAM2 cia_lget (uaecptr addr) { - uae_u32 v; - v = cia_wget(addr) << 16; - v |= cia_wget(addr + 2); - return v; + uae_u32 v; + v = cia_wget (addr) << 16; + v |= cia_wget (addr + 2); + return v; } -static uae_u32 REGPARAM2 cia_wgeti(uaecptr addr) +static uae_u32 REGPARAM2 cia_wgeti (uaecptr addr) { - if (currprefs.cpu_model >= 68020) - return dummy_wgeti(addr); - return cia_wget(addr); + if (currprefs.cpu_model >= 68020) + return dummy_wgeti(addr); + return cia_wget(addr); } -static uae_u32 REGPARAM2 cia_lgeti(uae_u32 addr) +static uae_u32 REGPARAM2 cia_lgeti (uaecptr addr) { - if (currprefs.cpu_model >= 68020) - return dummy_lgeti(addr); - return cia_lget(addr); + if (currprefs.cpu_model >= 68020) + return dummy_lgeti(addr); + return cia_lget(addr); } -static void REGPARAM2 cia_bput(uaecptr addr, uae_u32 value) +static void REGPARAM2 cia_bput (uaecptr addr, uae_u32 value) { - int r = (addr & 0xf00) >> 8; + int r = (addr & 0xf00) >> 8; if (isgarynocia(addr)) { - dummy_put(addr, 1, false); return; } - if (!isgaylenocia(addr)) + if (!isgaylenocia (addr)) return; int cs = cia_chipselect(addr); - if (!issinglecia() || (cs & 3) != 0) { - cia_wait_pre(((cs & 2) == 0 ? 1 : 0) | ((cs & 1) == 0 ? 2 : 0)); - if ((cs & 2) == 0) - WriteCIAB(r, value); - if ((cs & 1) == 0) - WriteCIAA(r, value); - cia_wait_post(((cs & 2) == 0 ? 1 : 0) | ((cs & 1) == 0 ? 2 : 0), value); - if (((cs & 3) == 3) && (warned > 0 || currprefs.illegal_mem)) { - write_log(_T("cia_bput: unknown CIA address %08X=%02X PC=%08X\n"), addr, value & 0xff, M68K_GETPC); - warned--; - } - } + if (!issinglecia () || (cs & 3) != 0) { + cia_wait_pre (); + if ((cs & 2) == 0) + WriteCIAB (r, value); + if ((cs & 1) == 0) + WriteCIAA (r, value); + cia_wait_post (value); + } } -static void REGPARAM2 cia_wput(uaecptr addr, uae_u32 value) +static void REGPARAM2 cia_wput (uaecptr addr, uae_u32 value) { - int r = (addr & 0xf00) >> 8; + int r = (addr & 0xf00) >> 8; if (isgarynocia(addr)) { - dummy_put(addr, 2, false); return; } - if (!isgaylenocia(addr)) + if (!isgaylenocia (addr)) return; int cs = cia_chipselect(addr); - if (!issinglecia() || (cs & 3) != 0) { - cia_wait_pre(((cs & 2) == 0 ? 1 : 0) | ((cs & 1) == 0 ? 2 : 0)); - if ((cs & 2) == 0) - WriteCIAB(r, value >> 8); - if ((cs & 1) == 0) - WriteCIAA(r, value & 0xff); - cia_wait_post(((cs & 2) == 0 ? 1 : 0) | ((cs & 1) == 0 ? 2 : 0), value); - if (((cs & 3) == 3) && (warned > 0 || currprefs.illegal_mem)) { - write_log(_T("cia_wput: unknown CIA address %08X=%04X %08X\n"), addr, value & 0xffff, M68K_GETPC); - warned--; - } - } + if (!issinglecia ()|| (cs & 3) != 0) { + cia_wait_pre (); + if ((cs & 2) == 0) + WriteCIAB (r, value >> 8); + if ((cs & 1) == 0) + WriteCIAA (r, value & 0xff); + cia_wait_post (value); + } } -static void REGPARAM2 cia_lput(uaecptr addr, uae_u32 value) +static void REGPARAM2 cia_lput (uaecptr addr, uae_u32 value) { - cia_wput(addr, value >> 16); - cia_wput(addr + 2, value & 0xffff); + cia_wput (addr, value >> 16); + cia_wput (addr + 2, value & 0xffff); } /* battclock memory access */ -static uae_u32 REGPARAM3 clock_lget(uaecptr) REGPARAM; -static uae_u32 REGPARAM3 clock_wget(uaecptr) REGPARAM; -static uae_u32 REGPARAM3 clock_bget(uaecptr) REGPARAM; -static void REGPARAM3 clock_lput(uaecptr, uae_u32) REGPARAM; -static void REGPARAM3 clock_wput(uaecptr, uae_u32) REGPARAM; -static void REGPARAM3 clock_bput(uaecptr, uae_u32) REGPARAM; +static uae_u32 REGPARAM3 clock_lget (uaecptr) REGPARAM; +static uae_u32 REGPARAM3 clock_wget (uaecptr) REGPARAM; +static uae_u32 REGPARAM3 clock_bget (uaecptr) REGPARAM; +static void REGPARAM3 clock_lput (uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 clock_wput (uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 clock_bput (uaecptr, uae_u32) REGPARAM; addrbank clock_bank = { - clock_lget, clock_wget, clock_bget, - clock_lput, clock_wput, clock_bput, + clock_lget, clock_wget, clock_bget, + clock_lput, clock_wput, clock_bput, default_xlate, default_check, NULL, NULL, _T("Battery backed up clock (none)"), dummy_lgeti, dummy_wgeti, ABFLAG_IO, S_READ, S_WRITE, NULL, 0x3f, 0xd80000 }; -static unsigned int clock_control_d; -static unsigned int clock_control_e; -static unsigned int clock_control_f; - -#define RF5C01A_RAM_SIZE 16 -static uae_u8 rtc_memory[RF5C01A_RAM_SIZE], rtc_alarm[RF5C01A_RAM_SIZE]; - -static uae_u8 getclockreg(int addr, struct tm *ct) +static uae_u8 getclockreg (int addr, struct tm *ct) { uae_u8 v = 0; if (currprefs.cs_rtc == 1 || currprefs.cs_rtc == 3) { /* MSM6242B */ - switch (addr) { - case 0x0: v = ct->tm_sec % 10; break; - case 0x1: v = ct->tm_sec / 10; break; - case 0x2: v = ct->tm_min % 10; break; - case 0x3: v = ct->tm_min / 10; break; - case 0x4: v = ct->tm_hour % 10; break; - case 0x5: - if (clock_control_f & 4) { - v = ct->tm_hour / 10; // 24h - } - else { - v = (ct->tm_hour % 12) / 10; // 12h - v |= ct->tm_hour >= 12 ? 4 : 0; // AM/PM bit - } - break; - case 0x6: v = ct->tm_mday % 10; break; - case 0x7: v = ct->tm_mday / 10; break; - case 0x8: v = (ct->tm_mon + 1) % 10; break; - case 0x9: v = (ct->tm_mon + 1) / 10; break; - case 0xA: v = ct->tm_year % 10; break; - case 0xB: v = (ct->tm_year / 10) & 0x0f; break; - case 0xC: v = ct->tm_wday; break; - case 0xD: v = clock_control_d; break; - case 0xE: v = clock_control_e; break; - case 0xF: v = clock_control_f; break; - } + return get_clock_msm(&rtc_msm, addr, ct); + } else if (currprefs.cs_rtc == 2) { /* RF5C01A */ + return get_clock_ricoh(&rtc_ricoh, addr, ct); } - else if (currprefs.cs_rtc == 2) { /* RF5C01A */ - int bank = clock_control_d & 3; - /* memory access */ - if (bank >= 2 && addr < 0x0d) - return (rtc_memory[addr] >> ((bank == 2) ? 0 : 4)) & 0x0f; - /* alarm */ - if (bank == 1 && addr < 0x0d) { - v = rtc_alarm[addr]; -#if CLOCK_DEBUG - write_log(_T("CLOCK ALARM R %X: %X\n"), addr, v); -#endif - return v; - } - switch (addr) { - case 0x0: v = ct->tm_sec % 10; break; - case 0x1: v = ct->tm_sec / 10; break; - case 0x2: v = ct->tm_min % 10; break; - case 0x3: v = ct->tm_min / 10; break; - case 0x4: v = ct->tm_hour % 10; break; - case 0x5: - if (rtc_alarm[10] & 1) - v = ct->tm_hour / 10; // 24h - else - v = ((ct->tm_hour % 12) / 10) | (ct->tm_hour >= 12 ? 2 : 0); // 12h - break; - case 0x6: v = ct->tm_wday; break; - case 0x7: v = ct->tm_mday % 10; break; - case 0x8: v = ct->tm_mday / 10; break; - case 0x9: v = (ct->tm_mon + 1) % 10; break; - case 0xA: v = (ct->tm_mon + 1) / 10; break; - case 0xB: v = (ct->tm_year % 100) % 10; break; - case 0xC: v = (ct->tm_year % 100) / 10; break; - case 0xD: v = clock_control_d; break; - /* E and F = write-only, reads as zero */ - case 0xE: v = 0; break; - case 0xF: v = 0; break; - } - } -#if CLOCK_DEBUG - write_log(_T("CLOCK R: %X = %X, PC=%08x\n"), addr, v, M68K_GETPC); -#endif return v; } -static void write_battclock(void) -{ - if (!currprefs.rtcfile[0] || currprefs.cs_rtc == 0) - return; - struct zfile *f = zfile_fopen(currprefs.rtcfile, _T("wb")); - if (f) { - struct tm *ct; - time_t t = time(0); - t += currprefs.cs_rtc_adjust; - ct = localtime(&t); - uae_u8 od = clock_control_d; - if (currprefs.cs_rtc == 2) - clock_control_d &= ~3; - for (int i = 0; i < 13; i++) { - uae_u8 v = getclockreg(i, ct); - zfile_fwrite(&v, 1, 1, f); - } - clock_control_d = od; - zfile_fwrite(&clock_control_d, 1, 1, f); - zfile_fwrite(&clock_control_e, 1, 1, f); - zfile_fwrite(&clock_control_f, 1, 1, f); - if (currprefs.cs_rtc == 2) { - zfile_fwrite(rtc_alarm, RF5C01A_RAM_SIZE, 1, f); - zfile_fwrite(rtc_memory, RF5C01A_RAM_SIZE, 1, f); - } - zfile_fclose(f); - } -} - void rtc_hardreset(void) { - rtc_delayed_write = 0; if (currprefs.cs_rtc == 1 || currprefs.cs_rtc == 3) { /* MSM6242B */ clock_bank.name = currprefs.cs_rtc == 1 ? _T("Battery backed up clock (MSM6242B)") : _T("Battery backed up clock A2000 (MSM6242B)"); - clock_control_d = 0x1; - clock_control_e = 0; - clock_control_f = 0x4; /* 24/12 */ - } - else if (currprefs.cs_rtc == 2) { /* RF5C01A */ + rtc_msm.clock_control_d = 0x1; + rtc_msm.clock_control_e = 0; + rtc_msm.clock_control_f = 0x4; /* 24/12 */ + } else if (currprefs.cs_rtc == 2) { /* RF5C01A */ clock_bank.name = _T("Battery backed up clock (RF5C01A)"); - clock_control_d = 0x8; /* Timer EN */ - clock_control_e = 0; - clock_control_f = 0; - memset(rtc_memory, 0, RF5C01A_RAM_SIZE); - memset(rtc_alarm, 0, RF5C01A_RAM_SIZE); - rtc_alarm[10] = 1; /* 24H mode */ - } - if (currprefs.rtcfile[0]) { - struct zfile *f = zfile_fopen(currprefs.rtcfile, _T("rb")); - if (f) { - uae_u8 empty[13]; - zfile_fread(empty, 13, 1, f); - zfile_fread(&clock_control_d, 1, 1, f); - zfile_fread(&clock_control_e, 1, 1, f); - zfile_fread(&clock_control_f, 1, 1, f); - zfile_fread(rtc_alarm, RF5C01A_RAM_SIZE, 1, f); - zfile_fread(rtc_memory, RF5C01A_RAM_SIZE, 1, f); - zfile_fclose(f); - } + rtc_ricoh.clock_control_d = 0x8; /* Timer EN */ + rtc_ricoh.clock_control_e = 0; + rtc_ricoh.clock_control_f = 0; + memset (rtc_ricoh.rtc_memory, 0, RF5C01A_RAM_SIZE); + memset (rtc_ricoh.rtc_alarm, 0, RF5C01A_RAM_SIZE); + rtc_ricoh.rtc_alarm[10] = 1; /* 24H mode */ } } -static uae_u32 REGPARAM2 clock_lget(uaecptr addr) +static uae_u32 REGPARAM2 clock_lget (uaecptr addr) { if ((addr & 0xffff) >= 0x8000 && currprefs.cs_fatgaryrev >= 0) return dummy_get(addr, 4, false, 0); - return (clock_wget(addr) << 16) | clock_wget(addr + 2); + return (clock_wget (addr) << 16) | clock_wget (addr + 2); } -static uae_u32 REGPARAM2 clock_wget(uaecptr addr) +static uae_u32 REGPARAM2 clock_wget (uaecptr addr) { if ((addr & 0xffff) >= 0x8000 && currprefs.cs_fatgaryrev >= 0) return dummy_get(addr, 2, false, 0); - return (clock_bget(addr) << 8) | clock_bget(addr + 1); + return (clock_bget (addr) << 8) | clock_bget (addr + 1); } -static uae_u32 REGPARAM2 clock_bget(uaecptr addr) +static uae_u32 REGPARAM2 clock_bget (uaecptr addr) { - struct tm *ct; + struct tm *ct; uae_u8 v = 0; if ((addr & 0xffff) >= 0x8000 && currprefs.cs_fatgaryrev >= 0) return dummy_get(addr, 1, false, 0); -#ifdef CDTV - if (currprefs.cs_cdtvram && (addr & 0xffff) >= 0x8000) - return cdtv_battram_read(addr); -#endif - - addr &= 0x3f; + addr &= 0x3f; if ((addr & 3) == 2 || (addr & 3) == 0 || currprefs.cs_rtc == 0) { - return dummy_get(addr, 1, false, v); - } - time_t t = time(0); - t += currprefs.cs_rtc_adjust; - ct = localtime(&t); - addr >>= 2; - return getclockreg(addr, ct); + return dummy_get_safe(addr, 1, false, v); + } + time_t t = time(0); + ct = localtime (&t); + addr >>= 2; + return getclockreg (addr, ct); } -static void REGPARAM2 clock_lput(uaecptr addr, uae_u32 value) +static void REGPARAM2 clock_lput (uaecptr addr, uae_u32 value) { if ((addr & 0xffff) >= 0x8000 && currprefs.cs_fatgaryrev >= 0) { - dummy_put(addr, 4, value); return; } - clock_wput(addr, value >> 16); - clock_wput(addr + 2, value); + clock_wput (addr, value >> 16); + clock_wput (addr + 2, value); } -static void REGPARAM2 clock_wput(uaecptr addr, uae_u32 value) +static void REGPARAM2 clock_wput (uaecptr addr, uae_u32 value) { if ((addr & 0xffff) >= 0x8000 && currprefs.cs_fatgaryrev >= 0) { - dummy_put(addr, 2, value); return; } - clock_bput(addr, value >> 8); - clock_bput(addr + 1, value); + clock_bput (addr, value >> 8); + clock_bput (addr + 1, value); } -static void REGPARAM2 clock_bput(uaecptr addr, uae_u32 value) +static void REGPARAM2 clock_bput (uaecptr addr, uae_u32 value) { - // write_log(_T("W: %x (%x): %x, PC=%08x\n"), addr, (addr & 0xff) >> 2, value & 0xff, M68K_GETPC); - if ((addr & 0xffff) >= 0x8000 && currprefs.cs_fatgaryrev >= 0) { - dummy_put(addr, 1, value); return; } -#ifdef CDTV - if (currprefs.cs_cdtvram && (addr & 0xffff) >= 0x8000) { - cdtv_battram_write(addr, value); - return; - } -#endif - - addr &= 0x3f; + addr &= 0x3f; if ((addr & 1) != 1 || currprefs.cs_rtc == 0) - return; - addr >>= 2; - value &= 0x0f; + return; + addr >>= 2; + value &= 0x0f; if (currprefs.cs_rtc == 1 || currprefs.cs_rtc == 3) { /* MSM6242B */ -#if CLOCK_DEBUG - write_log(_T("CLOCK W %X: %X\n"), addr, value); -#endif - switch (addr) - { - case 0xD: clock_control_d = value & (1 | 8); break; - case 0xE: clock_control_e = value; break; - case 0xF: clock_control_f = value; break; - } + put_clock_msm(&rtc_msm, addr, value); + } else if (currprefs.cs_rtc == 2) { /* RF5C01A */ + put_clock_ricoh(&rtc_ricoh, addr, value); } - else if (currprefs.cs_rtc == 2) { /* RF5C01A */ - int bank = clock_control_d & 3; - /* memory access */ - if (bank >= 2 && addr < 0x0d) { - uae_u8 ov = rtc_memory[addr]; - rtc_memory[addr] &= ((bank == 2) ? 0xf0 : 0x0f); - rtc_memory[addr] |= value << ((bank == 2) ? 0 : 4); - if (rtc_memory[addr] != ov) - rtc_delayed_write = -1; - return; - } - /* alarm */ - if (bank == 1 && addr < 0x0d) { -#if CLOCK_DEBUG - write_log(_T("CLOCK ALARM W %X: %X\n"), addr, value); -#endif - uae_u8 ov = rtc_alarm[addr]; - rtc_alarm[addr] = value; - rtc_alarm[0] = rtc_alarm[1] = rtc_alarm[9] = rtc_alarm[12] = 0; - rtc_alarm[3] &= ~0x8; - rtc_alarm[5] &= ~0xc; - rtc_alarm[6] &= ~0x8; - rtc_alarm[8] &= ~0xc; - rtc_alarm[10] &= ~0xe; - rtc_alarm[11] &= ~0xc; - if (rtc_alarm[addr] != ov) - rtc_delayed_write = -1; - return; - } -#if CLOCK_DEBUG - write_log(_T("CLOCK W %X: %X\n"), addr, value); -#endif - switch (addr) - { - case 0xD: clock_control_d = value; break; - case 0xE: clock_control_e = value; break; - case 0xF: clock_control_f = value; break; - } - } - rtc_delayed_write = -1; } #ifdef SAVESTATE /* CIA-A and CIA-B save/restore code */ -static void save_cia_prepare(void) +static void save_cia_prepare (void) { - CIA_update_check(); - CIA_calctimers(); - compute_passed_time(); + CIA_update_check (); + CIA_calctimers (); + compute_passed_time (); } -void restore_cia_start(void) +void restore_cia_start (void) { /* Fixes very old statefiles without keyboard state */ kbstate = 3; - setcapslockstate(0); kblostsynccnt = 0; } -void restore_cia_finish(void) +void restore_cia_finish (void) { - eventtab[ev_cia].oldcycles = get_cycles(); - CIA_update(); - CIA_calctimers(); - compute_passed_time(); + eventtab[ev_cia].oldcycles = get_cycles (); + CIA_update (); + CIA_calctimers (); + compute_passed_time (); eventtab[ev_cia].oldcycles -= div10; - //dumpcia (); - DISK_select_set(ciabprb); + DISK_select_set (ciabprb); } -uae_u8 *restore_cia(int num, uae_u8 *src) +uae_u8 *restore_cia (int num, uae_u8 *src) { - uae_u8 b; - uae_u16 w; - uae_u32 l; + uae_u8 b; + uae_u16 w; + uae_u32 l; - /* CIA registers */ - b = restore_u8(); /* 0 PRA */ - if (num) ciabpra = b; else ciaapra = b; - b = restore_u8(); /* 1 PRB */ - if (num) ciabprb = b; else ciaaprb = b; - b = restore_u8(); /* 2 DDRA */ - if (num) ciabdra = b; else ciaadra = b; - b = restore_u8(); /* 3 DDRB */ - if (num) ciabdrb = b; else ciaadrb = b; - w = restore_u16(); /* 4 TA */ - if (num) ciabta = w; else ciaata = w; - w = restore_u16(); /* 6 TB */ - if (num) ciabtb = w; else ciaatb = w; - l = restore_u8(); /* 8/9/A TOD */ - l |= restore_u8() << 8; - l |= restore_u8() << 16; - if (num) ciabtod = l; else ciaatod = l; - restore_u8(); /* B unused */ - b = restore_u8(); /* C SDR */ - if (num) ciabsdr = b; else ciaasdr = b; - b = restore_u8(); /* D ICR INFORMATION (not mask!) */ - if (num) ciabicr = b; else ciaaicr = b; - b = restore_u8(); /* E CRA */ - if (num) ciabcra = b; else ciaacra = b; - b = restore_u8(); /* F CRB */ - if (num) ciabcrb = b; else ciaacrb = b; + /* CIA registers */ + b = restore_u8 (); /* 0 PRA */ + if (num) ciabpra = b; else ciaapra = b; + b = restore_u8 (); /* 1 PRB */ + if (num) ciabprb = b; else ciaaprb = b; + b = restore_u8 (); /* 2 DDRA */ + if (num) ciabdra = b; else ciaadra = b; + b = restore_u8 (); /* 3 DDRB */ + if (num) ciabdrb = b; else ciaadrb = b; + w = restore_u16 (); /* 4 TA */ + if (num) ciabta = w; else ciaata = w; + w = restore_u16 (); /* 6 TB */ + if (num) ciabtb = w; else ciaatb = w; + l = restore_u8 (); /* 8/9/A TOD */ + l |= restore_u8 () << 8; + l |= restore_u8 () << 16; + if (num) ciabtod = l; else ciaatod = l; + restore_u8 (); /* B unused */ + b = restore_u8 (); /* C SDR */ + if (num) ciabsdr = b; else ciaasdr = b; + b = restore_u8 (); /* D ICR INFORMATION (not mask!) */ + if (num) ciabicr = b; else ciaaicr = b; + b = restore_u8 (); /* E CRA */ + if (num) ciabcra = b; else ciaacra = b; + b = restore_u8 (); /* F CRB */ + if (num) ciabcrb = b; else ciaacrb = b; - /* CIA internal data */ + /* CIA internal data */ - b = restore_u8(); /* ICR MASK */ - if (num) ciabimask = b; else ciaaimask = b; - w = restore_u8(); /* timer A latch */ - w |= restore_u8() << 8; - if (num) ciabla = w; else ciaala = w; - w = restore_u8(); /* timer B latch */ - w |= restore_u8() << 8; - if (num) ciablb = w; else ciaalb = w; - w = restore_u8(); /* TOD latched value */ - w |= restore_u8() << 8; - w |= restore_u8() << 16; - if (num) ciabtol = w; else ciaatol = w; - l = restore_u8(); /* alarm */ - l |= restore_u8() << 8; - l |= restore_u8() << 16; - if (num) ciabalarm = l; else ciaaalarm = l; - b = restore_u8(); - if (num) ciabtlatch = b & 1; else ciaatlatch = b & 1; /* is TOD latched? */ - if (num) ciabtodon = b & 2; else ciaatodon = b & 2; /* is TOD stopped? */ - b = restore_u8(); - if (num) - div10 = CYCLE_UNIT * b; - b = restore_u8(); - if (num) ciabsdr_cnt = b; else ciaasdr_cnt = b; - return src; + b = restore_u8 (); /* ICR MASK */ + if (num) ciabimask = b; else ciaaimask = b; + w = restore_u8 (); /* timer A latch */ + w |= restore_u8 () << 8; + if (num) ciabla = w; else ciaala = w; + w = restore_u8 (); /* timer B latch */ + w |= restore_u8 () << 8; + if (num) ciablb = w; else ciaalb = w; + w = restore_u8 (); /* TOD latched value */ + w |= restore_u8 () << 8; + w |= restore_u8 () << 16; + if (num) ciabtol = w; else ciaatol = w; + l = restore_u8 (); /* alarm */ + l |= restore_u8 () << 8; + l |= restore_u8 () << 16; + if (num) ciabalarm = l; else ciaaalarm = l; + b = restore_u8 (); + if (num) ciabtlatch = b & 1; else ciaatlatch = b & 1; /* is TOD latched? */ + if (num) ciabtodon = b & 2; else ciaatodon = b & 2; /* is TOD stopped? */ + b = restore_u8 (); + if (num) + div10 = CYCLE_UNIT * b; + b = restore_u8 (); + if (num) ciabsdr_cnt = b; else ciaasdr_cnt = b; + return src; } -uae_u8 *save_cia(int num, int *len, uae_u8 *dstptr) +uae_u8 *save_cia (int num, int *len, uae_u8 *dstptr) { - uae_u8 *dstbak, *dst, b; - uae_u16 t; + uae_u8 *dstbak,*dst, b; + uae_u16 t; - if (dstptr) - dstbak = dst = dstptr; - else - dstbak = dst = xmalloc(uae_u8, 1000); + if (dstptr) + dstbak = dst = dstptr; + else + dstbak = dst = xmalloc (uae_u8, 100); - save_cia_prepare(); + save_cia_prepare (); - /* CIA registers */ + /* CIA registers */ - b = num ? ciabpra : ciaapra; /* 0 PRA */ - save_u8(b); - b = num ? ciabprb : ciaaprb; /* 1 PRB */ - save_u8(b); - b = num ? ciabdra : ciaadra; /* 2 DDRA */ - save_u8(b); - b = num ? ciabdrb : ciaadrb; /* 3 DDRB */ - save_u8(b); - t = (num ? ciabta - ciabta_passed : ciaata - ciaata_passed);/* 4 TA */ - save_u16(t); - t = (num ? ciabtb - ciabtb_passed : ciaatb - ciaatb_passed);/* 6 TB */ - save_u16(t); - b = (num ? ciabtod : ciaatod); /* 8 TODL */ - save_u8(b); - b = (num ? ciabtod >> 8 : ciaatod >> 8); /* 9 TODM */ - save_u8(b); - b = (num ? ciabtod >> 16 : ciaatod >> 16); /* A TODH */ - save_u8(b); - save_u8(0); /* B unused */ - b = num ? ciabsdr : ciaasdr; /* C SDR */ - save_u8(b); - b = num ? ciabicr : ciaaicr; /* D ICR INFORMATION (not mask!) */ - save_u8(b); - b = num ? ciabcra : ciaacra; /* E CRA */ - save_u8(b); - b = num ? ciabcrb : ciaacrb; /* F CRB */ - save_u8(b); + b = num ? ciabpra : ciaapra; /* 0 PRA */ + save_u8 (b); + b = num ? ciabprb : ciaaprb; /* 1 PRB */ + save_u8 (b); + b = num ? ciabdra : ciaadra; /* 2 DDRA */ + save_u8 (b); + b = num ? ciabdrb : ciaadrb; /* 3 DDRB */ + save_u8 (b); + t = (num ? ciabta - ciabta_passed : ciaata - ciaata_passed);/* 4 TA */ + save_u16 (t); + t = (num ? ciabtb - ciabtb_passed : ciaatb - ciaatb_passed);/* 6 TB */ + save_u16 (t); + b = (num ? ciabtod : ciaatod); /* 8 TODL */ + save_u8 (b); + b = (num ? ciabtod >> 8 : ciaatod >> 8); /* 9 TODM */ + save_u8 (b); + b = (num ? ciabtod >> 16 : ciaatod >> 16); /* A TODH */ + save_u8 (b); + save_u8 (0); /* B unused */ + b = num ? ciabsdr : ciaasdr; /* C SDR */ + save_u8 (b); + b = num ? ciabicr : ciaaicr; /* D ICR INFORMATION (not mask!) */ + save_u8 (b); + b = num ? ciabcra : ciaacra; /* E CRA */ + save_u8 (b); + b = num ? ciabcrb : ciaacrb; /* F CRB */ + save_u8 (b); - /* CIA internal data */ + /* CIA internal data */ - save_u8(num ? ciabimask : ciaaimask); /* ICR */ - b = (num ? ciabla : ciaala); /* timer A latch LO */ - save_u8(b); - b = (num ? ciabla >> 8 : ciaala >> 8); /* timer A latch HI */ - save_u8(b); - b = (num ? ciablb : ciaalb); /* timer B latch LO */ - save_u8(b); - b = (num ? ciablb >> 8 : ciaalb >> 8); /* timer B latch HI */ - save_u8(b); - b = (num ? ciabtol : ciaatol); /* latched TOD LO */ - save_u8(b); - b = (num ? ciabtol >> 8 : ciaatol >> 8); /* latched TOD MED */ - save_u8(b); - b = (num ? ciabtol >> 16 : ciaatol >> 16); /* latched TOD HI */ - save_u8(b); - b = (num ? ciabalarm : ciaaalarm); /* alarm LO */ - save_u8(b); - b = (num ? ciabalarm >> 8 : ciaaalarm >> 8);/* alarm MED */ - save_u8(b); - b = (num ? ciabalarm >> 16 : ciaaalarm >> 16); /* alarm HI */ - save_u8(b); - b = 0; - if (num) - b |= ciabtlatch ? 1 : 0; - else - b |= ciaatlatch ? 1 : 0; /* is TOD latched? */ - if (num) - b |= ciabtodon ? 2 : 0; - else - b |= ciaatodon ? 2 : 0; /* TOD stopped? */ - save_u8(b); - save_u8(num ? div10 / CYCLE_UNIT : 0); - save_u8(num ? ciabsdr_cnt : ciaasdr_cnt); - *len = dst - dstbak; - return dstbak; + save_u8 (num ? ciabimask : ciaaimask); /* ICR */ + b = (num ? ciabla : ciaala); /* timer A latch LO */ + save_u8 (b); + b = (num ? ciabla >> 8 : ciaala >> 8); /* timer A latch HI */ + save_u8 (b); + b = (num ? ciablb : ciaalb); /* timer B latch LO */ + save_u8 (b); + b = (num ? ciablb >> 8 : ciaalb >> 8); /* timer B latch HI */ + save_u8 (b); + b = (num ? ciabtol : ciaatol); /* latched TOD LO */ + save_u8 (b); + b = (num ? ciabtol >> 8 : ciaatol >> 8); /* latched TOD MED */ + save_u8 (b); + b = (num ? ciabtol >> 16 : ciaatol >> 16); /* latched TOD HI */ + save_u8 (b); + b = (num ? ciabalarm : ciaaalarm); /* alarm LO */ + save_u8 (b); + b = (num ? ciabalarm >> 8 : ciaaalarm >>8 ); /* alarm MED */ + save_u8 (b); + b = (num ? ciabalarm >> 16 : ciaaalarm >> 16); /* alarm HI */ + save_u8 (b); + b = 0; + if (num) + b |= ciabtlatch ? 1 : 0; + else + b |= ciaatlatch ? 1 : 0; /* is TOD latched? */ + if (num) + b |= ciabtodon ? 2 : 0; + else + b |= ciaatodon ? 2 : 0; /* TOD stopped? */ + save_u8 (b); + save_u8 (num ? div10 / CYCLE_UNIT : 0); + save_u8 (num ? ciabsdr_cnt : ciaasdr_cnt); + *len = dst - dstbak; + return dstbak; } -uae_u8 *save_keyboard(int *len, uae_u8 *dstptr) +uae_u8 *save_keyboard (int *len, uae_u8 *dstptr) { uae_u8 *dst, *dstbak; if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = xmalloc(uae_u8, 4 + 4 + 1 + 1 + 1 + 1 + 1 + 2); - save_u32(getcapslockstate() ? 1 : 0); - save_u32(1); - save_u8(kbstate); - save_u8(0); - save_u8(0); - save_u8(0); - save_u8(kbcode); - save_u16(kblostsynccnt); + dstbak = dst = xmalloc (uae_u8, 4 + 4 + 1 + 1 + 1 + 1 + 1 + 2); + save_u32 (1); + save_u8 (kbstate); + save_u8 (0); + save_u8 (0); + save_u8 (0); + save_u8 (kbcode); + save_u16 (kblostsynccnt); *len = dst - dstbak; return dstbak; } -uae_u8 *restore_keyboard(uae_u8 *src) +uae_u8 *restore_keyboard (uae_u8 *src) { - setcapslockstate(restore_u32() & 1); - uae_u32 v = restore_u32(); - kbstate = restore_u8(); - restore_u8(); - restore_u8(); - restore_u8(); - kbcode = restore_u8(); - kblostsynccnt = restore_u16(); + uae_u32 v = restore_u32 (); + kbstate = restore_u8 (); + restore_u8 (); + restore_u8 (); + restore_u8 (); + kbcode = restore_u8 (); + kblostsynccnt = restore_u16 (); if (!(v & 1)) { kbstate = 3; kblostsynccnt = 0; } - return src; + return src; } #endif /* SAVESTATE */ diff --git a/src/custom.cpp b/src/custom.cpp index c19bf2d7..fc4ea7a2 100644 --- a/src/custom.cpp +++ b/src/custom.cpp @@ -1,18 +1,19 @@ -/* - * UAE - The Un*x Amiga Emulator - * - * Custom chip emulation - * - * Copyright 1995-2002 Bernd Schmidt - * Copyright 1995 Alessandro Bissacco - * Copyright 2000-2010 Toni Wilen - */ + /* +* UAE - The Un*x Amiga Emulator +* +* Custom chip emulation +* +* Copyright 1995-2002 Bernd Schmidt +* Copyright 1995 Alessandro Bissacco +* Copyright 2000-2015 Toni Wilen +*/ #include "sysconfig.h" #include "sysdeps.h" #include #include +#include #include "options.h" #include "uae.h" @@ -28,240 +29,163 @@ #include "blitter.h" #include "xwin.h" #include "inputdevice.h" -#include "keybuf.h" #include "autoconf.h" #include "traps.h" #include "gui.h" #include "picasso96.h" #include "drawing.h" +#include "ar.h" #include "akiko.h" -#include "gfxboard.h" -#include "blkdev.h" -#include "clipboard.h" -#include "amiberry_gfx.h" -#include "rommgr.h" +#include "devices.h" -#define CUSTOM_DEBUG 0 -#define SPRITE_DEBUG 0 -#define SPRITE_DEBUG_MINY 0 -#define SPRITE_DEBUG_MAXY 0x300 #define SPR0_HPOS 0x15 #define MAX_SPRITES 8 -#define SPRITE_COLLISIONS -#define SPEEDUP 1 -#define AUTOSCALE_SPRITES 1 -#define SPRBORDER 0 +#define nocustom() (picasso_on) -STATIC_INLINE bool nocustom(void) -{ - if (picasso_on && currprefs.picasso96_nocustom) - return true; - return false; -} - -static void uae_abort(const TCHAR *format, ...) +static void uae_abort (const TCHAR *format,...) { static int nomore; va_list parms; TCHAR buffer[1000]; - va_start(parms, format); - _vsntprintf(buffer, sizeof(buffer) - 1, format, parms); - va_end(parms); + va_start (parms, format); + _vsntprintf (buffer, sizeof (buffer) - 1, format, parms ); + va_end (parms); if (nomore) { - write_log(_T("%s\n"), buffer); + write_log (_T("%s\n"), buffer); return; } - gui_message(buffer); + gui_message (buffer); nomore = 1; } -static unsigned int n_consecutive_skipped = 0; -static unsigned int total_skipped = 0; - -extern int cpu_last_stop_vpos, cpu_stopped_lines; -static int cpu_sleepmode, cpu_sleepmode_cnt; - -STATIC_INLINE void sync_copper(int hpos); +#define SPEEDUP_CYCLES_JIT_PAL 5000 +#define SPEEDUP_CYCLES_JIT_NTSC 4000 +#define SPEEDUP_CYCLES_NONJIT 256 +#define SPEEDUP_TIMELIMIT_JIT -750 +#define SPEEDUP_TIMELIMIT_NONJIT -750 +int pissoff_value = SPEEDUP_CYCLES_JIT_PAL * CYCLE_UNIT; +int speedup_timelimit = SPEEDUP_TIMELIMIT_JIT; /* Events */ -unsigned long int vsync_cycles; -static int extra_cycle; - static int rpt_did_reset; struct ev eventtab[ev_max]; struct ev2 eventtab2[ev2_max]; -int hpos_offset; int vpos; static int vpos_count, vpos_count_diff; -int lof_store; // real bit in custom registers +static int lof_store; // real bit in custom registers static int lof_current; // what display device thinks static bool lof_lastline, lof_prev_lastline; -static int lol; static int next_lineno, prev_lineno; -static enum nln_how nextline_how; static int lof_changed = 0, lof_changing = 0, interlace_changed = 0; static int lof_changed_previous_field; static int vposw_change; static bool lof_lace; -static bool bplcon0_interlace_seen; -static int scandoubled_line; static bool vsync_rendered, frame_rendered, frame_shown; static int vsynctimeperline; static int frameskiptime; -static bool genlockhtoggle; -static bool genlockvtoggle; -static bool graphicsbuffer_retry; -static int scanlinecount; static int cia_hsync; #define LOF_TOGGLES_NEEDED 3 - static int lof_togglecnt_lace, lof_togglecnt_nlace; -/* Stupid genlock-detection prevention hack. -* We should stop calling vsync_handler() and -* hstop_handler() completely but it is not -* worth the trouble.. -*/ static int vpos_previous, hpos_previous; -static int vpos_lpen, hpos_lpen, lightpen_triggered; -int lightpen_x = -1, lightpen_y = -1, lightpen_cx, lightpen_cy, lightpen_active, lightpen_enabled; -static uae_u32 sprtaba[256], sprtabb[256]; +static uae_u32 sprtaba[256],sprtabb[256]; static uae_u32 sprite_ab_merge[256]; + /* Tables for collision detection. */ static uae_u32 sprclx[16], clxmask[16]; -/* T genlock bit in ECS Denise and AGA color registers */ -static uae_u8 color_regs_genlock[256]; - /* * Hardware registers of all sorts. */ -static int REGPARAM3 custom_wput_1(int, uaecptr, uae_u32, int) REGPARAM; +static int REGPARAM3 custom_wput_1 (int, uaecptr, uae_u32, int) REGPARAM; -static uae_u16 cregs[256]; - -uae_u16 intena, intreq; +static uae_u16 intena; +uae_u16 intreq; uae_u16 dmacon; uae_u16 adkcon; /* used by audio code */ uae_u32 last_custom_value1; -static uae_u32 cop1lc, cop2lc, copcon; - +static uae_u32 cop1lc,cop2lc,copcon; + int maxhpos = MAXHPOS_PAL; -int maxhpos_short = MAXHPOS_PAL; int maxvpos = MAXVPOS_PAL; int maxvpos_nom = MAXVPOS_PAL; // nominal value (same as maxvpos but "faked" maxvpos in fake 60hz modes) int maxvpos_display = MAXVPOS_PAL; // value used for display size int hsyncendpos, hsyncstartpos; static int maxvpos_total = 511; int minfirstline = VBLANK_ENDLINE_PAL; -int firstblankedline; static int equ_vblank_endline = EQU_ENDLINE_PAL; static bool equ_vblank_toggle = true; -double vblank_hz = VBLANK_HZ_PAL, fake_vblank_hz, vblank_hz_stored, vblank_hz_nom; -double hblank_hz; +float vblank_hz = VBLANK_HZ_PAL, fake_vblank_hz, vblank_hz_nom; +float hblank_hz; static float vblank_hz_lof, vblank_hz_shf, vblank_hz_lace; -static int vblank_hz_mult, vblank_hz_state; static struct chipset_refresh *stored_chipset_refresh; -int doublescan; -bool programmedmode; int syncbase; static int fmode_saved, fmode; -uae_u16 beamcon0, new_beamcon0; +static uae_u16 beamcon0, new_beamcon0; static bool varsync_changed; -uae_u16 vtotal = MAXVPOS_PAL, htotal = MAXHPOS_PAL; -static int maxvpos_stored, maxhpos_stored; +static uae_u16 vtotal = MAXVPOS_PAL, htotal = MAXHPOS_PAL; static uae_u16 hsstop, hbstrt, hbstop, vsstop, vbstrt, vbstop, hsstrt, vsstrt, hcenter; -static int ciavsyncmode; static int diw_hstrt, diw_hstop; static int diw_hcounter; -static uae_u16 refptr; -static uae_u32 refptr_val; #define HSYNCTIME (maxhpos * CYCLE_UNIT) struct sprite { - uaecptr pt; - int xpos; - int vstart; - int vstop; + uaecptr pt; + int xpos; + int vstart; + int vstop; int dblscan; /* AGA SSCAN2 */ - int armed; - int dmastate; - int dmacycle; - int ptxhpos; - int ptxhpos2, ptxvpos2; - bool ignoreverticaluntilnextline; + int armed; + int dmastate; + int dmacycle; }; static struct sprite spr[MAX_SPRITES]; static int plfstrt_sprite; -static bool sprite_ignoreverticaluntilnextline; - -uaecptr sprite_0; -int sprite_0_width, sprite_0_height, sprite_0_doubled; -uae_u32 sprite_0_colors[4]; -static uae_u8 magic_sprite_mask = 0xff; static int sprite_vblank_endline = VBLANK_SPRITE_PAL; static uae_u16 sprctl[MAX_SPRITES], sprpos[MAX_SPRITES]; -#ifdef AGA static uae_u16 sprdata[MAX_SPRITES][4], sprdatb[MAX_SPRITES][4]; -#else -static uae_u16 sprdata[MAX_SPRITES][1], sprdatb[MAX_SPRITES][1]; -#endif -static int sprite_last_drawn_at[MAX_SPRITES]; static int last_sprite_point, nr_armed; static int sprite_width, sprres; -static int sprite_sprctlmask; int sprite_buffer_res; -#ifdef CPUEMU_13 -uae_u8 cycle_line[256 + 1]; -#endif - static bool bpl1dat_written, bpl1dat_written_at_least_once; static bool bpldmawasactive; static uae_s16 bpl1mod, bpl2mod, dbpl1mod, dbpl2mod; static int dbpl1mod_on, dbpl2mod_on; -static uaecptr prevbpl[2][MAXVPOS][8]; -static uaecptr bplpt[8], bplptx[8]; - -static int bitplane_line_crossing; +static uaecptr bplpt[8]; static struct color_entry current_colors; -unsigned int bplcon0; +static unsigned int bplcon0; static unsigned int bplcon1, bplcon2, bplcon3, bplcon4; static unsigned int bplcon0d, bplcon0dd, bplcon0_res, bplcon0_planes, bplcon0_planes_limit; static unsigned int diwstrt, diwstop, diwhigh; static int diwhigh_written; static unsigned int ddfstrt, ddfstop; -static int line_cyclebased, badmode, diw_change; -static int bplcon1_fetch; -static int hpos_is_zero_bplcon1_hack = -1; +static int line_cyclebased, badmode; #define SET_LINE_CYCLEBASED line_cyclebased = 2; /* The display and data fetch windows */ + enum diw_states { DIW_waiting_start, DIW_waiting_stop }; static int plffirstline, plflastline; -int plffirstline_total, plflastline_total; -static int autoscale_bordercolors; static int plfstrt, plfstop; static int sprite_minx, sprite_maxx; -static int first_bpl_vpos; -static int last_ddf_pix_hpos; static int last_decide_line_hpos; static int last_fetch_hpos, last_sprite_hpos; static int diwfirstword, diwlastword; @@ -269,16 +193,6 @@ static int last_hdiw; static enum diw_states diwstate, hdiwstate, ddfstate; static int bpl_hstart; -int first_planes_vpos, last_planes_vpos; -static int first_bplcon0, first_bplcon0_old; -static int first_planes_vpos_old, last_planes_vpos_old; -int diwfirstword_total, diwlastword_total; -int ddffirstword_total, ddflastword_total; -static int diwfirstword_total_old, diwlastword_total_old; -static int ddffirstword_total_old, ddflastword_total_old; -bool vertical_changed, horizontal_changed; -int firstword_bplcon1; - static int last_copper_hpos; static int copper_access; @@ -286,18 +200,18 @@ static int copper_access; static unsigned int clxdat, clxcon, clxcon2, clxcon_bpl_enable, clxcon_bpl_match; enum copper_states { - COP_stop, + COP_stop, COP_waitforever, - COP_read1, - COP_read2, - COP_bltwait, - COP_wait_in2, - COP_skip_in2, - COP_wait1, - COP_wait, - COP_skip1, - COP_strobe_delay1, - COP_strobe_delay2, + COP_read1, + COP_read2, + COP_bltwait, + COP_wait_in2, + COP_skip_in2, + COP_wait1, + COP_wait, + COP_skip1, + COP_strobe_delay1, + COP_strobe_delay2, COP_strobe_delay1x, COP_strobe_delay2x, COP_strobe_extra, // just to skip current cycle when CPU wrote to COPJMP @@ -305,66 +219,71 @@ enum copper_states { }; struct copper { - /* The current instruction words. */ - unsigned int i1, i2; - unsigned int saved_i1, saved_i2; - enum copper_states state, state_prev; - /* Instruction pointer. */ - uaecptr ip, saved_ip; - int hpos, vpos; - unsigned int ignore_next; - int vcmp, hcmp; + /* The current instruction words. */ + unsigned int i1, i2; + enum copper_states state, state_prev; + /* Instruction pointer. */ + uaecptr ip; + int hpos; + unsigned int ignore_next; + int vcmp, hcmp; - int strobe; /* COPJMP1 / COPJMP2 accessed */ - int moveaddr, movedata, movedelay; + /* When we schedule a copper event, knowing a few things about the future + of the copper list can reduce the number of sync_with_cpu calls + dramatically. */ + unsigned int first_sync; + unsigned int regtypes_modified; + + int strobe; /* COPJMP1 / COPJMP2 accessed */ + int moveaddr, movedata, movedelay; }; +#define REGTYPE_NONE 0 +#define REGTYPE_COLOR 1 +#define REGTYPE_SPRITE 2 +#define REGTYPE_PLANE 4 +#define REGTYPE_BLITTER 8 +#define REGTYPE_JOYPORT 16 +#define REGTYPE_DISK 32 +#define REGTYPE_POS 64 +#define REGTYPE_AUDIO 128 + +#define REGTYPE_ALL 255 +/* Always set in regtypes_modified, to enable a forced update when things like + DMACON, BPLCON0, COPJMPx get written. */ +#define REGTYPE_FORCE 256 + +static unsigned int regtypes[512]; + static struct copper cop_state; static int copper_enabled_thisline; -static int cop_min_waittime; /* -* Statistics -*/ -unsigned long int frametime = 0, lastframetime = 0, timeframes = 0; -unsigned long hsync_counter = 0, vsync_counter = 0; + * Statistics + */ +static unsigned long lastframetime = 0; +unsigned long timeframes = 0; +unsigned long hsync_counter = 0; unsigned long int idletime; -int bogusframe; /* Recording of custom chip register changes. */ -static int current_change_set; -static struct sprite_entry sprite_entries[2][MAX_SPR_PIXELS / 16]; -static struct color_change color_changes[2][MAX_REG_CHANGE]; +struct sprite_entry *curr_sprite_entries = 0; +struct color_change *curr_color_changes = 0; struct decision line_decisions[2 * (MAXVPOS + 2) + 1]; -static struct draw_info line_drawinfo[2][2 * (MAXVPOS + 2) + 1]; +struct draw_info curr_drawinfo[2 * (MAXVPOS + 2) + 1]; #define COLOR_TABLE_SIZE (MAXVPOS + 2) * 2 -static struct color_entry color_tables[2][COLOR_TABLE_SIZE]; +struct color_entry curr_color_tables[COLOR_TABLE_SIZE]; static int next_sprite_entry = 0; -static int prev_next_sprite_entry; static int next_sprite_forced = 1; -struct sprite_entry *curr_sprite_entries, *prev_sprite_entries; -struct color_change *curr_color_changes, *prev_color_changes; -struct draw_info *curr_drawinfo, *prev_drawinfo; -struct color_entry *curr_color_tables, *prev_color_tables; - static int next_color_change; static int next_color_entry, remembered_color_entry; -static int color_src_match, color_dest_match, color_compare_result; - -static uae_u32 thisline_changed; - -#ifdef SMART_UPDATE -#define MARK_LINE_CHANGED do { thisline_changed = 1; } while (0) -#else -#define MARK_LINE_CHANGED do { ; } while (0) -#endif static struct decision thisline_decision; static int fetch_cycle, fetch_modulo_cycle; -static bool aga_plf_passed_stop2; +static int aga_plf_passed_stop2; static int plf_start_hpos, plf_end_hpos; static int ddfstop_written_hpos; static int bitplane_off_delay; @@ -372,12 +291,10 @@ static bool ocs_agnus_ddf_enable_toggle; static int bpl_dma_off_when_active; static int bitplane_maybe_start_hpos; static bool ddfstop_matched; -static int bitplane_overrun, bitplane_overrun_hpos; -static int bitplane_overrun_fetch_cycle, bitplane_overrun_cycle_diagram_shift; enum plfstate { - plf_idle, + plf_idle, // enable passed plf_passed_enable, // ddfstrt match @@ -404,10 +321,10 @@ enum plfrenderstate } plfr_state; enum fetchstate { - fetch_not_started, + fetch_not_started, fetch_started_first, - fetch_started, - fetch_was_plane0 + fetch_started, + fetch_was_plane0 } fetch_state; /* @@ -419,206 +336,121 @@ STATIC_INLINE int ecsshres(void) return bplcon0_res == RES_SUPERHIRES && (currprefs.chipset_mask & CSMASK_ECS_DENISE) && !(currprefs.chipset_mask & CSMASK_AGA); } -STATIC_INLINE int nodraw(void) -{ - //return !currprefs.cpu_memory_cycle_exact && framecnt != 0; - return framecnt != 0; -} +#define nodraw() (framecnt != 0) -static int doflickerfix(void) +void set_speedup_values(void) { - return currprefs.gfx_vresolution && doublescan < 0 && vpos < MAXVPOS; -} - -uae_u32 get_copper_address(int copno) -{ - switch (copno) { - case 1: return cop1lc; - case 2: return cop2lc; - case -1: return cop_state.ip; - default: return 0; - } -} - -void reset_frame_rate_hack(void) -{ - if (currprefs.m68k_speed >= 0) - return; - - rpt_did_reset = 1; - is_syncline = 0; - vsyncmintime = read_processor_time() + vsynctimebase; - write_log(_T("Resetting frame rate hack\n")); -} - -STATIC_INLINE void setclr(uae_u16 *p, uae_u16 val) -{ - if (val & 0x8000) - *p |= val & 0x7FFF; - else - *p &= ~val; -} - -STATIC_INLINE void alloc_cycle(int hpos, int type) -{ -#ifdef CPUEMU_13 - cycle_line[hpos] = type; -#endif -} -STATIC_INLINE void alloc_cycle_maybe(int hpos, int type) -{ -#ifdef CPUEMU_13 - if ((cycle_line[hpos] & CYCLE_MASK) == 0) - alloc_cycle(hpos, type); -#endif -} - -void alloc_cycle_ext(int hpos, int type) -{ - alloc_cycle(hpos, type); -} - -void alloc_cycle_blitter(int hpos, uaecptr *ptr, int chnum) -{ -#ifdef CPUEMU_13 - if (cycle_line[hpos] & CYCLE_COPPER_SPECIAL) { - static int warned = 100; - uaecptr srcptr = cop_state.strobe == 1 ? cop1lc : cop2lc; - if (warned > 0) { - write_log(_T("buggy copper cycle conflict with blitter ch %c %08x <- %08x PC=%08x\n"), 'A' + (chnum - 1), *ptr, srcptr, m68k_getpc()); - warned--; - //activate_debugger (); + if (currprefs.m68k_speed < 0) { + if (currprefs.cachesize) { + pissoff_value = ((vblank_hz > 55) ? SPEEDUP_CYCLES_JIT_NTSC : SPEEDUP_CYCLES_JIT_PAL) * CYCLE_UNIT; + speedup_timelimit = SPEEDUP_TIMELIMIT_JIT; + } + else { + pissoff_value = SPEEDUP_CYCLES_NONJIT * CYCLE_UNIT; + speedup_timelimit = SPEEDUP_TIMELIMIT_NONJIT; } - if ((currprefs.cs_hacks & 1) && currprefs.cpu_model == 68000) - *ptr = srcptr; } -#endif - alloc_cycle(hpos, CYCLE_BLITTER); + else { + pissoff_value = 0; + speedup_timelimit = 0; + } } -static void set_chipset_mode(void) +void reset_frame_rate_hack (void) +{ + if (currprefs.m68k_speed >= 0) + return; + + rpt_did_reset = 1; + is_syncline = 0; + vsyncmintime = read_processor_time() + vsynctimebase; + write_log (_T("Resetting frame rate hack\n")); +} + +STATIC_INLINE void setclr (uae_u16 *p, uae_u16 val) +{ + if (val & 0x8000) + *p |= val & 0x7FFF; + else + *p &= ~val; +} + +STATIC_INLINE void set_chipset_mode(void) { if (currprefs.chipset_mask & CSMASK_AGA) { fmode = fmode_saved; - } - else { + } else { fmode = 0; } - sprite_width = GET_SPRITEWIDTH(fmode); + sprite_width = GET_SPRITEWIDTH (fmode); } static void update_mirrors(void) { - aga_mode = (currprefs.chipset_mask & CSMASK_AGA) != 0; - direct_rgb = aga_mode; - if (currprefs.chipset_mask & CSMASK_AGA) - sprite_sprctlmask = 0x01 | 0x08 | 0x10; - else if (currprefs.chipset_mask & CSMASK_ECS_DENISE) - sprite_sprctlmask = 0x01 | 0x10; - else - sprite_sprctlmask = 0x01; + aga_mode = (currprefs.chipset_mask & CSMASK_AGA) != 0; set_chipset_mode(); } -STATIC_INLINE uae_u8 *pfield_xlateptr(uaecptr plpt, int bytecount) +STATIC_INLINE uae_u8 *pfield_xlateptr (uaecptr plpt, int bytecount) { - if (!chipmem_check_indirect(plpt, bytecount)) { - static int count = 0; - if (!count) - count++, write_log(_T("Warning: Bad playfield pointer %08x\n"), plpt); - return NULL; - } - return chipmem_xlate_indirect(plpt); + plpt &= chipmem_bank.mask; + if((plpt + bytecount) > chipmem_bank.allocated_size) + return NULL; + return chipmem_bank.baseaddr + plpt; } -static void docols(struct color_entry *colentry) +static void docols (struct color_entry *colentry) { int i; - -#ifdef AGA - if (currprefs.chipset_mask & CSMASK_AGA) { + + if (aga_mode) { for (i = 0; i < 256; i++) { - int v = color_reg_get(colentry, i); - if (v < 0 || v > 16777215) + int v = colentry->color_regs_aga[i]; + if (v < 0 || v > 16777215) continue; - colentry->acolors[i] = getxcolor(v); + colentry->acolors[i] = CONVERT_RGB (v); } - } - else { -#endif + } else { for (i = 0; i < 32; i++) { - int v = color_reg_get(colentry, i); - if (v < 0 || v > 4095) + int v = colentry->color_regs_ecs[i]; + if (v < 0 || v > 4095) continue; - colentry->acolors[i] = getxcolor(v); + colentry->acolors[i] = xcolors[v]; } -#ifdef AGA } -#endif } extern struct color_entry colors_for_drawing; -void notice_new_xcolors(void) +void notice_new_xcolors (void) { int i; - - update_mirrors(); + + update_mirrors (); docols(¤t_colors); - docols(&colors_for_drawing); - for (i = 0; i < (MAXVPOS + 1) * 2; i++) { - docols(color_tables[0] + i); - docols(color_tables[1] + i); + docols(&colors_for_drawing); + for (i = 0; i < (MAXVPOS + 1)*2; i++) { + docols(curr_color_tables + i); } } -static void do_sprites(int currhp); +static void do_sprites (int currhp); -static void remember_ctable(void) +static void remember_ctable (void) { /* This can happen when program crashes very badly */ if (next_color_entry >= COLOR_TABLE_SIZE) return; if (remembered_color_entry < 0) { /* The colors changed since we last recorded a color map. Record a - * new one. */ - color_reg_cpy(curr_color_tables + next_color_entry, ¤t_colors); + * new one. */ + color_reg_cpy (curr_color_tables + next_color_entry, ¤t_colors); remembered_color_entry = next_color_entry++; } thisline_decision.ctable = remembered_color_entry; - if (color_src_match < 0 || color_dest_match != remembered_color_entry - || line_decisions[next_lineno].ctable != color_src_match) - { - /* The remembered comparison didn't help us - need to compare again. */ - int oldctable = line_decisions[next_lineno].ctable; - int changed = 0; - - if (oldctable < 0) { - changed = 1; - color_src_match = color_dest_match = -1; - } - else { - color_compare_result = color_reg_cmp(&prev_color_tables[oldctable], ¤t_colors) != 0; - if (color_compare_result) - changed = 1; - color_src_match = oldctable; - color_dest_match = remembered_color_entry; - } - thisline_changed |= changed; - } - else { - /* We know the result of the comparison */ - if (color_compare_result) - thisline_changed = 1; - } } -static void remember_ctable_for_border(void) -{ - remember_ctable(); -} - -STATIC_INLINE int get_equ_vblank_endline(void) +STATIC_INLINE int get_equ_vblank_endline (void) { return equ_vblank_endline + (equ_vblank_toggle ? (lof_current ? 1 : 0) : 0); } @@ -634,16 +466,16 @@ STATIC_INLINE int get_equ_vblank_endline(void) /* Called to determine the state of the horizontal display window state * machine at the current position. It might have changed since we last * checked. */ -static void decide_diw(int hpos) +static void decide_diw (int hpos) { /* Last hpos = hpos + 0.5, eg. normal PAL end hpos is 227.5 * 2 = 455 - OCS Denise: 9 bit hdiw counter does not reset during lines 0 to 9 - (PAL) or lines 0 to 10 (NTSC). A1000 PAL: 1 to 9, NTSC: 1 to 10. - ECS Denise and AGA: no above "features" + OCS Denise: 9 bit hdiw counter does not reset during lines 0 to 9 + (PAL) or lines 0 to 10 (NTSC). A1000 PAL: 1 to 9, NTSC: 1 to 10. + ECS Denise and AGA: no above "features" */ int hdiw = hpos >= maxhpos ? maxhpos * 2 + 1 : hpos * 2 + 2; - if (!(currprefs.chipset_mask & CSMASK_ECS_DENISE) && vpos <= get_equ_vblank_endline()) + if (!(currprefs.chipset_mask & CSMASK_ECS_DENISE) && vpos <= get_equ_vblank_endline ()) hdiw = diw_hcounter; /* always mask, bad programs may have set maxhpos = 256 */ hdiw &= 511; @@ -669,19 +501,17 @@ static void decide_diw(int hpos) last_hdiw = hdiw; } -static int fetchmode, fetchmode_size, fetchmode_mask, fetchmode_bytes; +static int fetchmode, fetchmode_size, fetchmode_mask, fetchmode_bytes, fetchmode_fmode; static int real_bitplane_number[3][3][9]; /* Disable bitplane DMA if planes > available DMA slots. This is needed -e.g. by the Sanity WOC demo (at the "Party Effect"). */ -STATIC_INLINE int GET_PLANES_LIMIT(uae_u16 bc0) + e.g. by the Sanity WOC demo (at the "Party Effect"). */ +STATIC_INLINE int GET_PLANES_LIMIT (void) { - int res = GET_RES_AGNUS(bc0); - int planes = GET_PLANES(bc0); - return real_bitplane_number[fetchmode][res][planes]; + return real_bitplane_number[fetchmode][bplcon0_res][bplcon0_planes]; } -static void reset_moddelays(void) +static void reset_moddelays (void) { if (dbpl1mod_on > 0) { bpl1mod = dbpl1mod; @@ -693,9 +523,9 @@ static void reset_moddelays(void) } } -static void add_modulo(int hpos, int nr) +static void add_modulo (int hpos, int nr) { - int mod; + int mod; if (dbpl1mod_on != hpos && dbpl1mod_on) { bpl1mod = dbpl1mod; @@ -705,90 +535,62 @@ static void add_modulo(int hpos, int nr) bpl2mod = dbpl2mod; dbpl2mod_on = 0; } - if (fmode & 0x4000) { - if (((diwstrt >> 8) ^ vpos) & 1) - mod = bpl2mod; - else - mod = bpl1mod; - } - else if (nr & 1) - mod = bpl2mod; - else - mod = bpl1mod; - bplpt[nr] += mod; - bplptx[nr] += mod; - reset_moddelays(); + if (fmode & 0x4000) { + if (((diwstrt >> 8) ^ vpos) & 1) + mod = bpl2mod; + else + mod = bpl1mod; + } else if (nr & 1) + mod = bpl2mod; + else + mod = bpl1mod; + bplpt[nr] += mod; + reset_moddelays (); } -static void add_modulos(void) +STATIC_INLINE void add_modulos(void) { - int m1, m2; - - reset_moddelays(); - if (fmode & 0x4000) { - if (((diwstrt >> 8) ^ vpos) & 1) - m1 = m2 = bpl2mod; - else - m1 = m2 = bpl1mod; - } - else { - m1 = bpl1mod; - m2 = bpl2mod; - } - - switch (bplcon0_planes_limit) { -#ifdef AGA - case 8: bplpt[7] += m2; bplptx[7] += m2; - case 7: bplpt[6] += m1; bplptx[6] += m1; -#endif - case 6: bplpt[5] += m2; bplptx[5] += m2; - case 5: bplpt[4] += m1; bplptx[4] += m1; - case 4: bplpt[3] += m2; bplptx[3] += m2; - case 3: bplpt[2] += m1; bplptx[2] += m1; - case 2: bplpt[1] += m2; bplptx[1] += m2; - case 1: bplpt[0] += m1; bplptx[0] += m1; - } -} - -static void finish_playfield_line(void) -{ - /* The latter condition might be able to happen in interlaced frames. */ - if (vpos >= minfirstline && (thisframe_first_drawn_line < 0 || vpos < thisframe_first_drawn_line)) - thisframe_first_drawn_line = vpos; - thisframe_last_drawn_line = vpos; - -#ifdef SMART_UPDATE - if (line_decisions[next_lineno].plflinelen != thisline_decision.plflinelen - || line_decisions[next_lineno].plfleft != thisline_decision.plfleft - || line_decisions[next_lineno].bplcon0 != thisline_decision.bplcon0 - || line_decisions[next_lineno].bplcon2 != thisline_decision.bplcon2 -#ifdef ECS_DENISE - || line_decisions[next_lineno].bplcon3 != thisline_decision.bplcon3 -#endif -#ifdef AGA - || line_decisions[next_lineno].bplcon4 != thisline_decision.bplcon4 -#endif - ) -#endif /* SMART_UPDATE */ - thisline_changed = 1; + int m1, m2; + + reset_moddelays (); + if (fmode & 0x4000) { + if (((diwstrt >> 8) ^ vpos) & 1) + m1 = m2 = bpl2mod; + else + m1 = m2 = bpl1mod; + } else { + m1 = bpl1mod; + m2 = bpl2mod; + } + + switch (bplcon0_planes_limit) { + case 8: bplpt[7] += m2; + case 7: bplpt[6] += m1; + case 6: bplpt[5] += m2; + case 5: bplpt[4] += m1; + case 4: bplpt[3] += m2; + case 3: bplpt[2] += m1; + case 2: bplpt[1] += m2; + case 1: bplpt[0] += m1; + } } /* The fetch unit mainly controls ddf stop. It's the number of cycles that -are contained in an indivisible block during which ddf is active. E.g. -if DDF starts at 0x30, and fetchunit is 8, then possible DDF stops are -0x30 + n * 8. */ + are contained in an indivisible block during which ddf is active. E.g. + if DDF starts at 0x30, and fetchunit is 8, then possible DDF stops are + 0x30 + n * 8. */ static int fetchunit, fetchunit_mask; /* The delay before fetching the same bitplane again. Can be larger than -the number of bitplanes; in that case there are additional empty cycles -with no data fetch (this happens for high fetchmodes and low -resolutions). */ -static int fetchstart, fetchstart_shift, fetchstart_mask; + the number of bitplanes; in that case there are additional empty cycles + with no data fetch (this happens for high fetchmodes and low + resolutions). */ +static int fetchstart, fetchstart_mask; /* fm_maxplane holds the maximum number of planes possible with the current -fetch mode. This selects the cycle diagram: -8 planes: 73516240 -4 planes: 3120 -2 planes: 10. */ -static int fm_maxplane, fm_maxplane_shift; + fetch mode. This selects the cycle diagram: + 8 planes: 73516240 + 4 planes: 3120 + 2 planes: 10. */ +static int fm_maxplane; /* The corresponding values, by fetchmode and display resolution. */ static const int fetchunits[] = { 8,8,8,0, 16,8,8,0, 32,16,8,0 }; @@ -803,77 +605,74 @@ static const int cycle_sequences[3 * 8] = { 2,1,2,1,2,1,2,1, 4,2,3,1,4,2,3,1, 8, static void create_cycle_diagram_table(void) { - int fm, res, cycle, planes, rplanes, v; - int fetch_start, max_planes, freecycles; - const int *cycle_sequence; - - for (fm = 0; fm <= 2; fm++) { - for (res = 0; res <= 2; res++) { - max_planes = fm_maxplanes[fm * 4 + res]; - fetch_start = 1 << fetchstarts[fm * 4 + res]; - cycle_sequence = &cycle_sequences[(max_planes - 1) * 8]; - max_planes = 1 << max_planes; - for (planes = 0; planes <= 8; planes++) { - freecycles = 0; - for (cycle = 0; cycle < 32; cycle++) - cycle_diagram_table[fm][res][planes][cycle] = -1; - if (planes <= max_planes) { - for (cycle = 0; cycle < fetch_start; cycle++) { - if (cycle < max_planes && planes >= cycle_sequence[cycle & 7]) { - v = cycle_sequence[cycle & 7]; - } - else { - v = 0; - freecycles++; - } - cycle_diagram_table[fm][res][planes][cycle] = v; - } - } - cycle_diagram_free_cycles[fm][res][planes] = freecycles; + int fm, res, cycle, planes, rplanes, v; + int fetch_start, max_planes, freecycles; + const int *cycle_sequence; + + for (fm = 0; fm <= 2; fm++) { + for (res = 0; res <= 2; res++) { + max_planes = fm_maxplanes[fm * 4 + res]; + fetch_start = 1 << fetchstarts[fm * 4 + res]; + cycle_sequence = &cycle_sequences[(max_planes - 1) * 8]; + max_planes = 1 << max_planes; + for (planes = 0; planes <= 8; planes++) { + freecycles = 0; + for (cycle = 0; cycle < 32; cycle++) + cycle_diagram_table[fm][res][planes][cycle] = -1; + if (planes <= max_planes) { + for (cycle = 0; cycle < fetch_start; cycle++) { + if (cycle < max_planes && planes >= cycle_sequence[cycle & 7]) { + v = cycle_sequence[cycle & 7]; + } else { + v = 0; + freecycles++; + } + cycle_diagram_table[fm][res][planes][cycle] = v; + } + } + cycle_diagram_free_cycles[fm][res][planes] = freecycles; cycle_diagram_total_cycles[fm][res][planes] = fetch_start; - rplanes = planes; - if (rplanes > max_planes) - rplanes = 0; - if (rplanes == 7 && fm == 0 && res == 0 && !(currprefs.chipset_mask & CSMASK_AGA)) - rplanes = 4; - real_bitplane_number[fm][res][planes] = rplanes; - } - } - } + rplanes = planes; + if (rplanes > max_planes) + rplanes = 0; + if (rplanes == 7 && fm == 0 && res == 0 && !(aga_mode)) + rplanes = 4; + real_bitplane_number[fm][res][planes] = rplanes; + } + } + } } + /* Used by the copper. */ static int estimated_last_fetch_cycle; static int cycle_diagram_shift; -static void estimate_last_fetch_cycle(int hpos) +static void estimate_last_fetch_cycle (int hpos) { - int fetchunit = fetchunits[fetchmode * 4 + bplcon0_res]; // Last fetch is always max 8 even if fetchunit is larger. int lastfetchunit = fetchunit >= 8 ? 8 : fetchunit; if (plf_state < plf_passed_stop) { - int stop; - + int stop; + if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { // ECS: stop wins if start == stop stop = plfstop + DDF_OFFSET < hpos || plfstop > HARD_DDF_STOP ? HARD_DDF_STOP : plfstop; - } - else { + } else { // OCS: start wins if start == stop stop = plfstop + DDF_OFFSET <= hpos || plfstop > HARD_DDF_STOP ? HARD_DDF_STOP : plfstop; } /* We know that fetching is up-to-date up until hpos, so we can use fetch_cycle. */ int fetch_cycle_at_stop = fetch_cycle + (stop - hpos + DDF_OFFSET); - int starting_last_block_at = (fetch_cycle_at_stop + fetchunit - 1) & ~(fetchunit - 1); - + int starting_last_block_at = (fetch_cycle_at_stop + fetchunit - 1) & ~fetchunit_mask; + estimated_last_fetch_cycle = hpos + (starting_last_block_at - fetch_cycle) + lastfetchunit; - } - else { - int starting_last_block_at = (fetch_cycle + fetchunit - 1) & ~(fetchunit - 1); + } else { + int starting_last_block_at = (fetch_cycle + fetchunit - 1) & ~fetchunit_mask; if (plf_state == plf_passed_stop2) starting_last_block_at -= fetchunit; - + estimated_last_fetch_cycle = hpos + (starting_last_block_at - fetch_cycle) + lastfetchunit; } } @@ -883,23 +682,16 @@ static int out_nbits, out_offs; static uae_u16 todisplay[MAX_PLANES], todisplay2[MAX_PLANES]; static uae_u16 fetched[MAX_PLANES]; static bool todisplay_fetched[2]; -#ifdef AGA static uae_u64 todisplay_aga[MAX_PLANES], todisplay2_aga[MAX_PLANES]; static uae_u64 fetched_aga[MAX_PLANES]; -#endif /* Expansions from bplcon0/bplcon1. */ static int toscr_res, toscr_res2p; static int toscr_nr_planes, toscr_nr_planes2, toscr_nr_planes_agnus, toscr_nr_planes_shifter; -static int fetchwidth; static int toscr_delay[2], toscr_delay_adjusted[2], toscr_delay_sh[2]; -static bool shdelay_disabled; -static int delay_cycles, delay_lastcycle[2], hack_delay_shift; +static int delay_cycles, delay_lastcycle[2]; static bool bplcon1_written; -#define PLANE_RESET_HPOS 8 -static int planesactiveatresetpoint; - /* The number of bits left from the last fetched words. This is an optimization - conceptually, we have to make sure the result is the same as if toscr is called in each clock cycle. However, to speed this @@ -908,179 +700,132 @@ static int planesactiveatresetpoint; we can do more work at once. */ static int toscr_nbits; -static void record_color_change2(int hpos, int regno, unsigned long value) +static void record_color_change2 (int hpos, int regno, uae_u32 value) { - int pos = hpos * 2; - if (regno == 0x1000 + 0x10c) - pos++; // BPLCON4 change needs 1 lores pixel delay + int pos = (hpos * 2) * 4; + if (regno == 0x1000 + 0x10c) { + pos += 4; // BPLCON4 change needs 1 lores pixel delay + if (value & 0xff00) + thisline_decision.xor_seen = true; + } curr_color_changes[next_color_change].linepos = pos; curr_color_changes[next_color_change].regno = regno; curr_color_changes[next_color_change].value = value; next_color_change++; - curr_color_changes[next_color_change].regno = -1; -} - -static bool isehb(uae_u16 bplcon0, uae_u16 bplcon2) -{ - bool bplehb; - if (currprefs.chipset_mask & CSMASK_AGA) - bplehb = (bplcon0 & 0x7010) == 0x6000; - else if (currprefs.chipset_mask & CSMASK_ECS_DENISE) - bplehb = ((bplcon0 & 0xFC00) == 0x6000 || (bplcon0 & 0xFC00) == 0x7000); - else - bplehb = ((bplcon0 & 0xFC00) == 0x6000 || (bplcon0 & 0xFC00) == 0x7000) && !currprefs.cs_denisenoehb; - return bplehb; + curr_color_changes[next_color_change].regno = -1; } // OCS/ECS, lores, 7 planes = 4 "real" planes + BPL5DAT and BPL6DAT as static 5th and 6th plane -STATIC_INLINE int isocs7planes(void) +STATIC_INLINE int isocs7planes (void) { - return !(currprefs.chipset_mask & CSMASK_AGA) && bplcon0_res == 0 && bplcon0_planes == 7; + return !(aga_mode) && bplcon0_res == 0 && bplcon0_planes == 7; } -int is_bitplane_dma(int hpos) +STATIC_INLINE int is_bitplane_dma (int hpos) { - if (hpos < bpl_hstart || fetch_state == fetch_not_started || plf_state == plf_wait) { - if (bitplane_overrun && hpos < bitplane_overrun_hpos) { - return curr_diagram[(hpos - bitplane_overrun_cycle_diagram_shift) & fetchstart_mask]; - } - return 0; - } - if ((plf_state >= plf_end && hpos >= thisline_decision.plfright) - || hpos >= estimated_last_fetch_cycle) - return 0; - return curr_diagram[(hpos - cycle_diagram_shift) & fetchstart_mask]; -} - -STATIC_INLINE int is_bitplane_dma_inline(int hpos) -{ - if (hpos < bpl_hstart || fetch_state == fetch_not_started || plf_state == plf_wait) { - if (bitplane_overrun && hpos < bitplane_overrun_hpos) { - return curr_diagram[(hpos - bitplane_overrun_cycle_diagram_shift) & fetchstart_mask]; - } - return 0; - } - if ((plf_state >= plf_end && hpos >= thisline_decision.plfright) - || hpos >= estimated_last_fetch_cycle) - return 0; - return curr_diagram[(hpos - cycle_diagram_shift) & fetchstart_mask]; -} - -static int islinetoggle(void) -{ - int linetoggle = 0; - if (!(beamcon0 & 0x0800) && !(beamcon0 & 0x0020) && (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) { - linetoggle = 1; // NTSC and !LOLDIS -> LOL toggles every line - } - else if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS) && currprefs.ntscmode) { - linetoggle = 1; // hardwired NTSC Agnus - } - return linetoggle; + if (hpos < bpl_hstart || fetch_state == fetch_not_started || plf_state == plf_wait) { + return 0; + } + if ((plf_state >= plf_end && hpos >= thisline_decision.plfright) + || hpos >= estimated_last_fetch_cycle) + return 0; + return curr_diagram[(hpos - cycle_diagram_shift) & fetchstart_mask]; } /* Expand bplcon0/bplcon1 into the toscr_xxx variables. */ -static void compute_toscr_delay(int bplcon1) +STATIC_INLINE void compute_toscr_delay (int bplcon1) { - int delay1 = (bplcon1 & 0x0f) | ((bplcon1 & 0x0c00) >> 6); - int delay2 = ((bplcon1 >> 4) & 0x0f) | (((bplcon1 >> 4) & 0x0c00) >> 6); - int shdelay1 = (bplcon1 >> 8) & 3; - int shdelay2 = (bplcon1 >> 12) & 3; + int delay1 = (bplcon1 & 0x0f) | ((bplcon1 & 0x0c00) >> 6); + int delay2 = ((bplcon1 >> 4) & 0x0f) | (((bplcon1 >> 4) & 0x0c00) >> 6); + int shdelay1 = (bplcon1 >> 8) & 3; + int shdelay2 = (bplcon1 >> 12) & 3; int delaymask = fetchmode_mask >> toscr_res; + + toscr_delay[0] = (delay1 & delaymask) << toscr_res; + toscr_delay[0] |= shdelay1 >> (RES_MAX - toscr_res); + toscr_delay[1] = (delay2 & delaymask) << toscr_res; + toscr_delay[1] |= shdelay2 >> (RES_MAX - toscr_res); - toscr_delay[0] = (delay1 & delaymask) << toscr_res; - toscr_delay[0] |= shdelay1 >> (RES_MAX - toscr_res); - toscr_delay[1] = (delay2 & delaymask) << toscr_res; - toscr_delay[1] |= shdelay2 >> (RES_MAX - toscr_res); - -#if SPEEDUP /* SPEEDUP code still needs this hack */ int delayoffset = fetchmode_size - (((bpl_hstart - (HARD_DDF_START_REAL + DDF_OFFSET)) & fetchstart_mask) << 1); - delay1 += delayoffset; - delay2 += delayoffset; + delay1 += delayoffset; + delay2 += delayoffset; toscr_delay_adjusted[0] = (delay1 & delaymask) << toscr_res; toscr_delay_adjusted[0] |= shdelay1 >> (RES_MAX - toscr_res); toscr_delay_adjusted[1] = (delay2 & delaymask) << toscr_res; toscr_delay_adjusted[1] |= shdelay2 >> (RES_MAX - toscr_res); -#endif } -static void set_delay_lastcycle(void) +static void set_delay_lastcycle (void) { if (HARD_DDF_LIMITS_DISABLED) { delay_lastcycle[0] = (256 * 2) << bplcon0_res; delay_lastcycle[1] = (256 * 2) << bplcon0_res; - } - else { + } else { delay_lastcycle[0] = ((maxhpos + 1) * 2 + 0) << bplcon0_res; delay_lastcycle[1] = delay_lastcycle[0]; - if (islinetoggle()) + if (currprefs.ntscmode) delay_lastcycle[1]++; } } static int bpldmasetuphpos, bpldmasetuphpos_diff; static int bpldmasetupphase; -static void update_toscr_planes(int fm); +static void update_toscr_planes (int fm); /* set currently active Agnus bitplane DMA sequence */ -static void setup_fmodes(int hpos) +static void setup_fmodes (int hpos) { - switch (fmode & 3) - { - case 0: - fetchmode = 0; - break; - case 1: - case 2: - fetchmode = 1; - break; - case 3: - fetchmode = 2; - break; - } - badmode = GET_RES_AGNUS(bplcon0) != GET_RES_DENISE(bplcon0); - bplcon0_res = GET_RES_AGNUS(bplcon0); - bplcon0_planes = GET_PLANES(bplcon0); - bplcon0_planes_limit = GET_PLANES_LIMIT(bplcon0); - fetchunit = fetchunits[fetchmode * 4 + bplcon0_res]; - fetchunit_mask = fetchunit - 1; - fetchstart_shift = fetchstarts[fetchmode * 4 + bplcon0_res]; - fetchstart = 1 << fetchstart_shift; - fetchstart_mask = fetchstart - 1; - fm_maxplane_shift = fm_maxplanes[fetchmode * 4 + bplcon0_res]; - fm_maxplane = 1 << fm_maxplane_shift; - fetch_modulo_cycle = fetchunit - fetchstart; + switch (fmode & 3) + { + case 0: + fetchmode = 0; + break; + case 1: + case 2: + fetchmode = 1; + break; + case 3: + fetchmode = 2; + break; + } + badmode = GET_RES_AGNUS (bplcon0) != GET_RES_DENISE (bplcon0); + bplcon0_res = GET_RES_AGNUS (bplcon0); + bplcon0_planes = GET_PLANES (bplcon0); + bplcon0_planes_limit = GET_PLANES_LIMIT (); + fetchunit = fetchunits[fetchmode * 4 + bplcon0_res]; + fetchunit_mask = fetchunit - 1; + int fetchstart_shift = fetchstarts[fetchmode * 4 + bplcon0_res]; + fetchstart = 1 << fetchstart_shift; + fetchstart_mask = fetchstart - 1; + int fm_maxplane_shift = fm_maxplanes[fetchmode * 4 + bplcon0_res]; + fm_maxplane = 1 << fm_maxplane_shift; + fetch_modulo_cycle = fetchunit - fetchstart; fetchmode_size = 16 << fetchmode; fetchmode_bytes = 2 << fetchmode; fetchmode_mask = fetchmode_size - 1; - set_delay_lastcycle(); - compute_toscr_delay(bplcon1); + fetchmode_fmode = fmode; + set_delay_lastcycle (); + compute_toscr_delay (bplcon1); if (thisline_decision.plfleft < 0) { thisline_decision.bplres = bplcon0_res; thisline_decision.bplcon0 = bplcon0; thisline_decision.nr_planes = bplcon0_planes; } -#ifdef CPUEMU_13 - if (is_bitplane_dma(hpos - 1)) - cycle_line[hpos - 1] = 1; -#endif - curr_diagram = cycle_diagram_table[fetchmode][bplcon0_res][bplcon0_planes_limit]; - estimate_last_fetch_cycle(hpos); -#ifdef DEBUGGER - if (bpldmasetuphpos >= 0 && debug_dma) - record_dma_event(DMA_EVENT_BPLFETCHUPDATE, hpos, vpos); -#endif + + curr_diagram = cycle_diagram_table[fetchmode][bplcon0_res][bplcon0_planes_limit]; + estimate_last_fetch_cycle (hpos); bpldmasetuphpos = -1; bpldmasetupphase = 0; toscr_nr_planes_agnus = bplcon0_planes; - if (isocs7planes()) { + if (isocs7planes ()) { toscr_nr_planes_agnus = 6; } SET_LINE_CYCLEBASED; } -static void BPLCON0_Denise(int hpos, uae_u16 v, bool); +static void BPLCON0_Denise (int hpos, uae_u16 v, bool); // writing to BPLCON0 adds 4 cycle delay before Agnus bitplane DMA sequence changes // (Note that Denise sees the change after 1 cycle) @@ -1089,33 +834,33 @@ static void BPLCON0_Denise(int hpos, uae_u16 v, bool); #define BPLCON_AGNUS_DELAY (3 + (copper_access ? 1 : 0) + (bplcon0_planes == 8 ? 1 : 0)) #define BPLCON_DENISE_DELAY (copper_access ? 1 : 0) -static void maybe_setup_fmodes(int hpos) +STATIC_INLINE void maybe_setup_fmodes (int hpos) { switch (bpldmasetupphase) { case 0: - BPLCON0_Denise(hpos, bplcon0, false); + BPLCON0_Denise (hpos, bplcon0, false); bpldmasetupphase++; bpldmasetuphpos += bpldmasetuphpos_diff; break; case 1: - setup_fmodes(hpos); + setup_fmodes (hpos); break; } } -STATIC_INLINE void maybe_check(int hpos) +STATIC_INLINE void maybe_check (int hpos) { if (bpldmasetuphpos > 0 && hpos >= bpldmasetuphpos) - maybe_setup_fmodes(hpos); + maybe_setup_fmodes (hpos); } -static void bpldmainitdelay(int hpos) +static void bpldmainitdelay (int hpos) { SET_LINE_CYCLEBASED; - if (!bitplane_overrun && hpos + BPLCON_AGNUS_DELAY < 0x14) { - BPLCON0_Denise(hpos, bplcon0, false); - setup_fmodes(hpos); + if (hpos + BPLCON_AGNUS_DELAY < 0x14) { + BPLCON0_Denise (hpos, bplcon0, false); + setup_fmodes (hpos); return; } if (bpldmasetuphpos < 0) { @@ -1123,127 +868,111 @@ static void bpldmainitdelay(int hpos) bpldmasetuphpos_diff = BPLCON_AGNUS_DELAY - BPLCON_DENISE_DELAY; bpldmasetupphase = 0; if (BPLCON_DENISE_DELAY == 0) { - maybe_setup_fmodes(hpos); + maybe_setup_fmodes (hpos); } } } -STATIC_INLINE void clear_fetchbuffer(uae_u32 *ptr, int nwords) +STATIC_INLINE void clear_fetchbuffer (uae_u32 *ptr, int nwords) { - int i; - - if (!thisline_changed) { - for (i = 0; i < nwords; i++) { - if (ptr[i]) { - thisline_changed = 1; - break; - } - } - } - memset(ptr, 0, nwords * 4); + memset (ptr, 0, nwords * 4); } -static void update_toscr_planes(int fm) +STATIC_INLINE void update_toscr_planes (int fm) { // This must be called just before new bitplane block starts, // not when depth value changes. Depth can change early and can leave // 16+ pixel horizontal line of old data visible. if (toscr_nr_planes_agnus > thisline_decision.nr_planes) { - if (out_offs) { - int j; - for (j = thisline_decision.nr_planes; j < toscr_nr_planes_agnus; j++) { - clear_fetchbuffer(reinterpret_cast(line_data[next_lineno] + 2 * MAX_WORDS_PER_LINE * j), out_offs); + if(out_offs) { + int j; + for (j = thisline_decision.nr_planes; j < toscr_nr_planes_agnus; j++) { + clear_fetchbuffer ((uae_u32 *)(line_data[next_lineno] + 2 * MAX_WORDS_PER_LINE * j), out_offs); if (thisline_decision.plfleft >= 0) { todisplay[j] = 0; -#ifdef AGA if (fm) todisplay_aga[j] = 0; -#endif - } - } - } + } + } + } thisline_decision.nr_planes = toscr_nr_planes_agnus; - } + } } -STATIC_INLINE void maybe_first_bpl1dat(int hpos) +STATIC_INLINE void maybe_first_bpl1dat (int hpos) { - if (thisline_decision.plfleft < 0) + if (thisline_decision.plfleft < 0) { thisline_decision.plfleft = hpos; + } } -static int fetch_warn(int nr, int hpos) -{ - static int warned1 = 30, warned2 = 30; - int add = fetchmode_bytes; - if (hpos == maxhpos - 1 || hpos == 1 || hpos == 3 || hpos == 5) { - if (warned1 >= 0) { - write_log(_T("WARNING: BPL fetch conflicts with strobe refresh slot %d!\n"), hpos); - warned1--; - } - add = refptr_val; - } - else { - if (warned2 >= 0) { - warned2--; - write_log(_T("WARNING: BPL fetch at hpos 0x%02X!\n"), hpos); - } - add = refptr_val; - } - bitplane_line_crossing = hpos; - return add; - } - -static void fetch(int nr, int fm, bool modulo, int hpos) +STATIC_INLINE void fetch (int nr, int fm, bool modulo, int hpos) { if (nr < bplcon0_planes_limit) { - uaecptr p; + uaecptr p; int add = fetchmode_bytes; - // refresh conflict? - if ((hpos > maxhpos - HPOS_SHIFT || hpos == 1 || hpos == 3 || hpos == 5) && !(beamcon0 & 0x80)) { - add = fetch_warn(nr, hpos); - } + p = bplpt[nr]; - p = bplpt[nr]; bplpt[nr] += add; - bplptx[nr] += add; if (nr == 0) bpl1dat_written = true; -#ifdef DEBUGGER - if (debug_dma) - record_dma(0x110 + nr * 2, chipmem_wget_indirect(p), p, hpos, vpos, DMARECORD_BITPLANE); - if (memwatch_enabled) - debug_wgetpeekdma_chipram(p, chipmem_wget_indirect(p), MW_MASK_BPL_0 << nr, 0x110 + nr * 2); -#endif - switch (fm) - { - case 0: - fetched[nr] = chipmem_wget_indirect(p); - last_custom_value1 = fetched[nr]; - break; -#ifdef AGA - case 1: - fetched_aga[nr] = chipmem_lget_indirect(p); - last_custom_value1 = fetched_aga[nr]; - fetched[nr] = uae_u16(fetched_aga[nr]); - break; - case 2: - fetched_aga[nr] = static_cast(chipmem_lget_indirect(p)) << 32; - fetched_aga[nr] |= chipmem_lget_indirect(p + 4); - last_custom_value1 = uae_u32(fetched_aga[nr]); - fetched[nr] = uae_u16(fetched_aga[nr]); - break; -#endif - } - if (modulo) + switch (fm) + { + case 0: + fetched[nr] = chipmem_wget_indirect (p); + last_custom_value1 = fetched[nr]; + break; + case 1: + { + uaecptr pm = p & ~3; + if (p & 2) { + fetched_aga[nr] = chipmem_lget_indirect(pm) & 0x0000ffff; + fetched_aga[nr] |= fetched_aga[nr] << 16; + } else if (fetchmode_fmode & 2) { // optimized (fetchmode_fmode & 3) == 2 + fetched_aga[nr] = chipmem_lget_indirect(pm) & 0xffff0000; + fetched_aga[nr] |= fetched_aga[nr] >> 16; + } else { + fetched_aga[nr] = chipmem_lget_indirect(pm); + } + last_custom_value1 = (uae_u32)fetched_aga[nr]; + fetched[nr] = (uae_u16)fetched_aga[nr]; + break; + } + case 2: + { + uaecptr pm = p & ~7; + uaecptr pm1, pm2; + if (p & 4) { + pm1 = pm + 4; + pm2 = pm + 4; + } else { + pm1 = pm; + pm2 = pm + 4; + } + if (p & 2) { + uae_u32 v1 = chipmem_lget_indirect(pm1) & 0x0000ffff; + uae_u32 v2 = chipmem_lget_indirect(pm2) & 0x0000ffff; + v1 |= v1 << 16; + v2 |= v2 << 16; + fetched_aga[nr] = (((uae_u64)v1) << 32) | v2; + } else { + fetched_aga[nr] = ((uae_u64)chipmem_lget_indirect(pm1)) << 32; + fetched_aga[nr] |= chipmem_lget_indirect(pm2); + } + last_custom_value1 = (uae_u32)fetched_aga[nr]; + fetched[nr] = (uae_u16)fetched_aga[nr]; + break; + } + } + if (modulo) add_modulo(hpos, nr); } } -STATIC_INLINE void toscr_3_ecs(int oddeven, int step, int nbits) +STATIC_INLINE void toscr_3_ecs (int oddeven, int step, int nbits) { int i; int shift = 16 - nbits; @@ -1260,9 +989,7 @@ STATIC_INLINE void toscr_3_ecs(int oddeven, int step, int nbits) } } -#ifdef AGA - -STATIC_INLINE void toscr_3_aga(int oddeven, int step, int nbits, int fm) +STATIC_INLINE void toscr_3_aga (int oddeven, int step, int nbits, int fm) { int i; uae_u32 mask = 0xFFFF >> (16 - nbits); @@ -1278,44 +1005,38 @@ STATIC_INLINE void toscr_3_aga(int oddeven, int step, int nbits, int fm) } } -#endif +static void toscr_2_0 (int nbits) { toscr_3_ecs (0, 1, nbits); } +static void toscr_2_0_oe (int oddeven, int step, int nbits) { toscr_3_ecs (oddeven, step, nbits); } +static void toscr_2_1 (int nbits) { toscr_3_aga (0, 1, nbits, 1); } +static void toscr_2_1_oe (int oddeven, int step, int nbits) { toscr_3_aga (oddeven, step, nbits, 1); } +static void toscr_2_2 (int nbits) { toscr_3_aga (0, 1, nbits, 2); } +static void toscr_2_2_oe (int oddeven, int step, int nbits) { toscr_3_aga (oddeven, step, nbits, 2); } -static void toscr_2_0(int nbits) { toscr_3_ecs(0, 1, nbits); } -static void toscr_2_0_oe(int oddeven, int step, int nbits) { toscr_3_ecs(oddeven, step, nbits); } -#ifdef AGA -static void toscr_2_1(int nbits) { toscr_3_aga(0, 1, nbits, 1); } -static void toscr_2_1_oe(int oddeven, int step, int nbits) { toscr_3_aga(oddeven, step, nbits, 1); } -static void toscr_2_2(int nbits) { toscr_3_aga(0, 1, nbits, 2); } -static void toscr_2_2_oe(int oddeven, int step, int nbits) { toscr_3_aga(oddeven, step, nbits, 2); } -#endif - -STATIC_INLINE void do_tosrc(int oddeven, int step, int nbits, int fm) +static void do_tosrc (int oddeven, int step, int nbits, int fm) { switch (fm) { - case 0: - if (step == 2) - toscr_2_0_oe(oddeven, step, nbits); - else - toscr_2_0(nbits); - break; -#ifdef AGA - case 1: - if (step == 2) - toscr_2_1_oe(oddeven, step, nbits); - else - toscr_2_1(nbits); - break; - case 2: - if (step == 2) - toscr_2_2_oe(oddeven, step, nbits); - else - toscr_2_2(nbits); - break; -#endif + case 0: + if (step == 2) + toscr_2_0_oe (oddeven, step, nbits); + else + toscr_2_0 (nbits); + break; + case 1: + if (step == 2) + toscr_2_1_oe (oddeven, step, nbits); + else + toscr_2_1 (nbits); + break; + case 2: + if (step == 2) + toscr_2_2_oe (oddeven, step, nbits); + else + toscr_2_2 (nbits); + break; } } -STATIC_INLINE void do_delays_3_ecs(int nbits) +STATIC_INLINE void do_delays_3_ecs (int nbits) { int delaypos = delay_cycles & fetchmode_mask; for (int oddeven = 0; oddeven < 2; oddeven++) { @@ -1325,7 +1046,7 @@ STATIC_INLINE void do_delays_3_ecs(int nbits) int diff = delay - delaypos; int nbits2 = nbits; if (nbits2 > diff) { - do_tosrc(oddeven, 2, diff, 0); + do_tosrc (oddeven, 2, diff, 0); nbits2 -= diff; if (todisplay_fetched[oddeven]) { for (int i = oddeven; i < toscr_nr_planes_shifter; i += 2) @@ -1334,11 +1055,11 @@ STATIC_INLINE void do_delays_3_ecs(int nbits) } } if (nbits2) - do_tosrc(oddeven, 2, nbits2, 0); + do_tosrc (oddeven, 2, nbits2, 0); } } -STATIC_INLINE void do_delays_fast_3_ecs(int nbits) +STATIC_INLINE void do_delays_fast_3_ecs (int nbits) { int delaypos = delay_cycles & fetchmode_mask; int delay = toscr_delay[0]; @@ -1347,7 +1068,7 @@ STATIC_INLINE void do_delays_fast_3_ecs(int nbits) int diff = delay - delaypos; int nbits2 = nbits; if (nbits2 > diff) { - do_tosrc(0, 1, diff, 0); + do_tosrc (0, 1, diff, 0); nbits2 -= diff; if (todisplay_fetched[0]) { for (int i = 0; i < toscr_nr_planes_shifter; i++) @@ -1357,10 +1078,10 @@ STATIC_INLINE void do_delays_fast_3_ecs(int nbits) } } if (nbits2) - do_tosrc(0, 1, nbits2, 0); + do_tosrc (0, 1, nbits2, 0); } -STATIC_INLINE void do_delays_3_aga(int nbits, int fm) +STATIC_INLINE void do_delays_3_aga (int nbits, int fm) { int delaypos = delay_cycles & fetchmode_mask; for (int oddeven = 0; oddeven < 2; oddeven++) { @@ -1370,7 +1091,7 @@ STATIC_INLINE void do_delays_3_aga(int nbits, int fm) int diff = delay - delaypos; int nbits2 = nbits; if (nbits2 > diff) { - do_tosrc(oddeven, 2, diff, fm); + do_tosrc (oddeven, 2, diff, fm); nbits2 -= diff; if (todisplay_fetched[oddeven]) { for (int i = oddeven; i < toscr_nr_planes_shifter; i += 2) @@ -1379,11 +1100,11 @@ STATIC_INLINE void do_delays_3_aga(int nbits, int fm) } } if (nbits2) - do_tosrc(oddeven, 2, nbits2, fm); + do_tosrc (oddeven, 2, nbits2, fm); } } -STATIC_INLINE void do_delays_fast_3_aga(int nbits, int fm) +STATIC_INLINE void do_delays_fast_3_aga (int nbits, int fm) { int delaypos = delay_cycles & fetchmode_mask; int delay = toscr_delay[0]; @@ -1392,7 +1113,7 @@ STATIC_INLINE void do_delays_fast_3_aga(int nbits, int fm) int diff = delay - delaypos; int nbits2 = nbits; if (nbits2 > diff) { - do_tosrc(0, 1, diff, fm); + do_tosrc (0, 1, diff, fm); nbits2 -= diff; if (todisplay_fetched[0]) { for (int i = 0; i < toscr_nr_planes_shifter; i++) @@ -1402,94 +1123,79 @@ STATIC_INLINE void do_delays_fast_3_aga(int nbits, int fm) } } if (nbits2) - do_tosrc(0, 1, nbits2, fm); + do_tosrc (0, 1, nbits2, fm); } -static void do_delays_2_0(int nbits) { do_delays_3_ecs(nbits); } -#ifdef AGA -static void do_delays_2_1(int nbits) { do_delays_3_aga(nbits, 1); } -static void do_delays_2_2(int nbits) { do_delays_3_aga(nbits, 2); } -#endif -static void do_delays_fast_2_0(int nbits) { do_delays_fast_3_ecs(nbits); } -#ifdef AGA -static void do_delays_fast_2_1(int nbits) { do_delays_fast_3_aga(nbits, 1); } -static void do_delays_fast_2_2(int nbits) { do_delays_fast_3_aga(nbits, 2); } -#endif - +static void do_delays_2_0 (int nbits) { do_delays_3_ecs (nbits); } +static void do_delays_2_1 (int nbits) { do_delays_3_aga (nbits, 1); } +static void do_delays_2_2 (int nbits) { do_delays_3_aga (nbits, 2); } +static void do_delays_fast_2_0 (int nbits) { do_delays_fast_3_ecs (nbits); } +static void do_delays_fast_2_1 (int nbits) { do_delays_fast_3_aga (nbits, 1); } +static void do_delays_fast_2_2 (int nbits) { do_delays_fast_3_aga (nbits, 2); } // slower version, odd and even delays are different or crosses maxhpos -STATIC_INLINE void do_delays(int nbits, int fm) +static void do_delays (int nbits, int fm) { switch (fm) { case 0: - do_delays_2_0(nbits); + do_delays_2_0 (nbits); break; -#ifdef AGA case 1: - do_delays_2_1(nbits); + do_delays_2_1 (nbits); break; case 2: - do_delays_2_2(nbits); + do_delays_2_2 (nbits); break; -#endif } } // common optimized case: odd delay == even delay -STATIC_INLINE void do_delays_fast(int nbits, int fm) +static void do_delays_fast (int nbits, int fm) { switch (fm) { case 0: - do_delays_fast_2_0(nbits); + do_delays_fast_2_0 (nbits); break; -#ifdef AGA case 1: - do_delays_fast_2_1(nbits); + do_delays_fast_2_1 (nbits); break; case 2: - do_delays_fast_2_2(nbits); + do_delays_fast_2_2 (nbits); break; -#endif } } -static void toscr_right_edge(int nbits, int fm) +static void toscr_right_edge (int nbits, int fm) { // Emulate hpos counter (delay_cycles) reseting at the end of scanline. // (Result is ugly shift in graphics in far right overscan) - int diff = delay_lastcycle[lol] - delay_cycles; + int diff = delay_lastcycle[0] - delay_cycles; int nbits2 = nbits; if (nbits2 >= diff) { - do_delays(diff, fm); + do_delays (diff, fm); nbits2 -= diff; delay_cycles = 0; - if (hpos_is_zero_bplcon1_hack >= 0) { - compute_toscr_delay(hpos_is_zero_bplcon1_hack); - hpos_is_zero_bplcon1_hack = -1; - } toscr_delay[0] -= 2; toscr_delay[0] &= fetchmode_mask; toscr_delay[1] -= 2; toscr_delay[1] &= fetchmode_mask; } if (nbits2) { - do_delays(nbits2, fm); + do_delays (nbits2, fm); delay_cycles += nbits2; } } -STATIC_INLINE void toscr_1(int nbits, int fm) +STATIC_INLINE void toscr_1 (int nbits, int fm) { - if (delay_cycles + nbits >= delay_lastcycle[lol]) { - toscr_right_edge(nbits, fm); - } - else if (toscr_delay[0] == toscr_delay[1]) { + if (delay_cycles + nbits >= delay_lastcycle[0]) { + toscr_right_edge (nbits, fm); + } else if (toscr_delay[0] == toscr_delay[1]) { // Most common case. - do_delays_fast(nbits, fm); + do_delays_fast (nbits, fm); delay_cycles += nbits; - } - else { - do_delays(nbits, fm); + } else { + do_delays (nbits, fm); delay_cycles += nbits; } @@ -1498,11 +1204,8 @@ STATIC_INLINE void toscr_1(int nbits, int fm) int i; uae_u8 *dataptr = line_data[next_lineno] + out_offs * 4; for (i = 0; i < thisline_decision.nr_planes; i++) { - uae_u32 *dataptr32 = reinterpret_cast(dataptr); - if (*dataptr32 != outword[i]) { - thisline_changed = 1; - *dataptr32 = outword[i]; - } + uae_u32 *dataptr32 = (uae_u32 *)dataptr; + *dataptr32 = outword[i]; outword[i] = 0; dataptr += MAX_WORDS_PER_LINE * 2; } @@ -1511,123 +1214,119 @@ STATIC_INLINE void toscr_1(int nbits, int fm) } } -static void toscr_fm0(int); -static void toscr_fm1(int); -static void toscr_fm2(int); - -STATIC_INLINE void toscr(int nbits, int fm) +static void toscr_1_hires (int nbits_nres, int fm) { - switch (fm) { - case 0: toscr_fm0(nbits); break; -#ifdef AGA - case 1: toscr_fm1(nbits); break; - case 2: toscr_fm2(nbits); break; -#endif + int maxnbits = 16; + while (nbits_nres >= 0) { + int nbits = nbits_nres >= maxnbits ? maxnbits : nbits_nres; + if (delay_cycles + nbits >= delay_lastcycle[0]) { + toscr_right_edge(nbits, fm); + } else { + do_delays(nbits, fm); + delay_cycles += nbits; + } + + out_nbits += nbits; + if (out_nbits == 32) { + int i; + uae_u8 *dataptr = line_data[next_lineno] + out_offs * 4; + for (i = 0; i < thisline_decision.nr_planes; i++) { + uae_u32 *dataptr32 = (uae_u32 *)dataptr; + *dataptr32 = outword[i]; + outword[i] = 0; + dataptr += MAX_WORDS_PER_LINE * 2; + } + out_offs++; + out_nbits = 0; + } + nbits_nres -= nbits; } } -STATIC_INLINE void toscr_0(int nbits, int fm) +static void toscr_fm0 (int); +static void toscr_fm1 (int); +static void toscr_fm2 (int); + +STATIC_INLINE void toscr (int nbits, int fm) +{ + switch (fm) { + case 0: toscr_fm0 (nbits); break; + case 1: toscr_fm1 (nbits); break; + case 2: toscr_fm2 (nbits); break; + } +} + +STATIC_INLINE void toscr_0 (int nbits, int fm) { int t; if (nbits > 16) { - toscr(16, fm); + toscr (16, fm); nbits -= 16; } t = 32 - out_nbits; if (t < nbits) { - toscr_1(t, fm); + toscr_1 (t, fm); nbits -= t; } - toscr_1(nbits, fm); + toscr_1 (nbits, fm); } -static void toscr_fm0(int nbits) { toscr_0(nbits, 0); } -static void toscr_fm1(int nbits) { toscr_0(nbits, 1); } -static void toscr_fm2(int nbits) { toscr_0(nbits, 2); } +static void toscr_fm0 (int nbits) { toscr_0 (nbits, 0); } +static void toscr_fm1 (int nbits) { toscr_0 (nbits, 1); } +static void toscr_fm2 (int nbits) { toscr_0 (nbits, 2); } -static int flush_plane_data(int fm) +STATIC_INLINE int flush_plane_data (int fm) { int i = 0; if (out_nbits <= 16) { i += 16; - toscr_1(16, fm); + toscr_1 (16, fm); } if (out_nbits != 0) { i += 32 - out_nbits; - toscr_1(32 - out_nbits, fm); + toscr_1 (32 - out_nbits, fm); } i += 32; - toscr_1(16, fm); - toscr_1(16, fm); + toscr_1 (16, fm); + toscr_1 (16, fm); - if (fm == 2) { + if (fm == 2) { /* flush AGA full 64-bit shift register + possible data in todisplay */ + i += 32; + toscr_1 (16, fm); + toscr_1 (16, fm); i += 32; - toscr_1(16, fm); - toscr_1(16, fm); - i += 32; - toscr_1(16, fm); - toscr_1(16, fm); + toscr_1 (16, fm); + toscr_1 (16, fm); } return i >> (1 + toscr_res); } -STATIC_INLINE void flush_display(int fm) +STATIC_INLINE void flush_display (int fm) { - if (toscr_nbits > 0 && thisline_decision.plfleft >= 0) - toscr(toscr_nbits, fm); - toscr_nbits = 0; + if (toscr_nbits > 0 && thisline_decision.plfleft >= 0) + toscr (toscr_nbits, fm); + toscr_nbits = 0; } -static void record_color_change(int hpos, int regno, unsigned long value); - -static void hack_shres_delay(int hpos) +static void update_denise_shifter_planes (int hpos) { - if (!(currprefs.chipset_mask & CSMASK_AGA) && !toscr_delay_sh[0] && !toscr_delay_sh[1]) - return; - int o0 = toscr_delay_sh[0]; - int o1 = toscr_delay_sh[1]; - int shdelay1 = (bplcon1 >> 8) & 3; - int shdelay2 = (bplcon1 >> 12) & 3; - if (shdelay1 != shdelay2) { - shdelay_disabled = true; - } - if (shdelay_disabled) { - toscr_delay_sh[0] = 0; - toscr_delay_sh[1] = 0; - } - else { - toscr_delay_sh[0] = (shdelay1 & 3) >> toscr_res; - toscr_delay_sh[1] = (shdelay2 & 3) >> toscr_res; - } - if (hpos >= 0 && (toscr_delay_sh[0] != o0 || toscr_delay_sh[1] != o1)) { - record_color_change(hpos, 0, COLOR_CHANGE_SHRES_DELAY | toscr_delay_sh[0]); - current_colors.extra &= ~(1 << CE_SHRES_DELAY); - current_colors.extra &= ~(1 << (CE_SHRES_DELAY + 1)); - current_colors.extra |= toscr_delay_sh[0] << CE_SHRES_DELAY; - remembered_color_entry = -1; - thisline_changed = true; - } -} - -static void update_denise_shifter_planes(int hpos) -{ - int np = GET_PLANES(bplcon0d); + int np = GET_PLANES (bplcon0d); // if DMA has ended but there is still data waiting in todisplay, // it must be flushed out before number of planes change if (np < toscr_nr_planes_shifter && hpos > thisline_decision.plfright && thisline_decision.plfright && (todisplay_fetched[0] || todisplay_fetched[1])) { int diff = (hpos - thisline_decision.plfright) << (1 + toscr_res); while (diff >= 16) { - toscr_1(16, fetchmode); + toscr_1 (16, fetchmode); diff -= 16; } if (diff) - toscr_1(diff, fetchmode); + toscr_1 (diff, fetchmode); thisline_decision.plfright += hpos - thisline_decision.plfright; } // FIXME: Samplers / Back In 90 vs Disposable Hero title screen in fast modes @@ -1640,84 +1339,78 @@ static void update_denise_shifter_planes(int hpos) } } -static void update_denise(int hpos) +static void update_denise (int hpos) { - int res = GET_RES_DENISE(bplcon0d); + int res = GET_RES_DENISE (bplcon0d); if (res != toscr_res) - flush_display(fetchmode); - toscr_res = GET_RES_DENISE(bplcon0d); + flush_display (fetchmode); + toscr_res = GET_RES_DENISE (bplcon0d); toscr_res2p = 2 << toscr_res; delay_cycles = (hpos * 2) << toscr_res; if (bplcon0dd != bplcon0d) { - record_color_change2(hpos, 0x100 + 0x1000, bplcon0d); + record_color_change2 (hpos, 0x100 + 0x1000, bplcon0d); bplcon0dd = bplcon0d; } - toscr_nr_planes = GET_PLANES(bplcon0d); - if (isocs7planes()) { + toscr_nr_planes = GET_PLANES (bplcon0d); + if (isocs7planes ()) { if (toscr_nr_planes2 < 6) toscr_nr_planes2 = 6; - } - else { + } else { toscr_nr_planes2 = toscr_nr_planes; } toscr_nr_planes_shifter = toscr_nr_planes2; - hack_shres_delay(hpos); } -STATIC_INLINE void fetch_start(int hpos) +STATIC_INLINE void fetch_start (void) { fetch_state = fetch_started; } /* Called when all planes have been fetched, i.e. when a new block -of data is available to be displayed. The data in fetched[] is -moved into todisplay[]. */ -static void beginning_of_plane_block(int hpos, int fm) + of data is available to be displayed. The data in fetched[] is + moved into todisplay[]. */ +STATIC_INLINE void beginning_of_plane_block (int hpos, int fm) { int i; if (fm == 0) for (i = 0; i < MAX_PLANES; i++) { todisplay[i] = fetched[i]; - } -#ifdef AGA + } else for (i = 0; i < MAX_PLANES; i++) { todisplay_aga[i] = fetched_aga[i]; - } -#endif + } todisplay_fetched[0] = todisplay_fetched[1] = true; - maybe_first_bpl1dat(hpos); - update_denise(hpos); + maybe_first_bpl1dat (hpos); + update_denise (hpos); if (toscr_nr_planes_agnus > thisline_decision.nr_planes) - update_toscr_planes(fm); + update_toscr_planes (fm); } -#ifdef SPEEDUP /* The usual inlining tricks - don't touch unless you know what you are doing. */ -STATIC_INLINE void long_fetch_16(int plane, int nwords, int weird_number_of_bits, int dma) +STATIC_INLINE void long_fetch_16 (int plane, int nwords, int weird_number_of_bits, int dma) { - uae_u16 *real_pt = reinterpret_cast(pfield_xlateptr(bplpt[plane], nwords * 2)); + uae_u16 *real_pt = (uae_u16 *)pfield_xlateptr (bplpt[plane], nwords * 2); int delay = toscr_delay_adjusted[plane & 1]; - int tmp_nbits = out_nbits; - uae_u32 shiftbuffer; - uae_u32 outval = outword[plane]; - uae_u32 fetchval = fetched[plane]; - uae_u32 *dataptr = reinterpret_cast(line_data[next_lineno] + 2 * plane * MAX_WORDS_PER_LINE + 4 * out_offs); + int tmp_nbits = out_nbits; + uae_u32 shiftbuffer; + uae_u32 outval = outword[plane]; + uae_u32 fetchval = fetched[plane]; + uae_u32 *dataptr = (uae_u32 *)(line_data[next_lineno] + 2 * plane * MAX_WORDS_PER_LINE + 4 * out_offs); - if (dma) { - bplpt[plane] += nwords * 2; - bplptx[plane] += nwords * 2; - } + if (dma) { + bplpt[plane] += nwords *2; + } - if (real_pt == nullptr) + if (real_pt == 0) /* @@@ Don't do this, fall back on chipmem_wget instead. */ - return; + return; shiftbuffer = todisplay2[plane] << delay; - while (nwords > 0) { + while (nwords > 0) { int bits_left = 32 - tmp_nbits; uae_u32 t; @@ -1728,48 +1421,51 @@ STATIC_INLINE void long_fetch_16(int plane, int nwords, int weird_number_of_bits if (weird_number_of_bits && bits_left < 16) { outval <<= bits_left; outval |= t >> (16 - bits_left); - thisline_changed |= *dataptr ^ outval; - *dataptr++ = outval; + *dataptr++ = outval; - outval = t; + outval = t; tmp_nbits = 16 - bits_left; - } - else { + } else { outval = (outval << 16) | t; tmp_nbits += 16; if (tmp_nbits == 32) { - thisline_changed |= *dataptr ^ outval; - *dataptr++ = outval; + *dataptr++ = outval; tmp_nbits = 0; } } shiftbuffer <<= 16; nwords--; if (dma) { - fetchval = do_get_mem_word(real_pt); +#ifdef ARMV6_ASSEMBLY + __asm__ ( + "ldrh %[val], [%[pt]], #2 \n\t" + "rev16 %[val], %[val] \n\t" + : [val] "=r" (fetchval), [pt] "+r" (real_pt) ); +#else + fetchval = do_get_mem_word (real_pt); real_pt++; +#endif } } - fetched[plane] = fetchval; + fetched[plane] = fetchval; todisplay2[plane] = shiftbuffer >> delay; - outword[plane] = outval; + outword[plane] = outval; } -#ifdef AGA -STATIC_INLINE void long_fetch_32(int plane, int nwords, int weird_number_of_bits, int dma) +STATIC_INLINE void long_fetch_32 (int plane, int nwords, int weird_number_of_bits, int dma) { - uae_u32 *real_pt = reinterpret_cast(pfield_xlateptr(bplpt[plane], nwords * 2)); + uae_u32 *real_pt = (uae_u32 *)pfield_xlateptr (bplpt[plane] & ~3, nwords * 2); int delay = toscr_delay_adjusted[plane & 1]; int tmp_nbits = out_nbits; uae_u64 shiftbuffer; uae_u32 outval = outword[plane]; - uae_u32 fetchval = fetched_aga[plane]; - uae_u32 *dataptr = reinterpret_cast(line_data[next_lineno] + 2 * plane * MAX_WORDS_PER_LINE + 4 * out_offs); + uae_u32 fetchval = (uae_u32)fetched_aga[plane]; + uae_u32 *dataptr = (uae_u32 *)(line_data[next_lineno] + 2 * plane * MAX_WORDS_PER_LINE + 4 * out_offs); + bool unaligned = (bplpt[plane] & 2) != 0; if (dma) { bplpt[plane] += nwords * 2; - bplptx[plane] += nwords * 2; - } + } if (real_pt == 0) /* @@@ Don't do this, fall back on chipmem_wget instead. */ @@ -1782,7 +1478,7 @@ STATIC_INLINE void long_fetch_32(int plane, int nwords, int weird_number_of_bits shiftbuffer |= fetchval; for (int i = 0; i < 2; i++) { - uae_u32 t; + uae_u32 t; int bits_left = 32 - tmp_nbits; t = (shiftbuffer >> (16 + delay)) & 0xffff; @@ -1791,36 +1487,46 @@ STATIC_INLINE void long_fetch_32(int plane, int nwords, int weird_number_of_bits outval <<= bits_left; outval |= t >> (16 - bits_left); - thisline_changed |= *dataptr ^ outval; - *dataptr++ = outval; + *dataptr++ = outval; outval = t; tmp_nbits = 16 - bits_left; - } - else { + } else { outval = (outval << 16) | t; tmp_nbits += 16; if (tmp_nbits == 32) { - thisline_changed |= *dataptr ^ outval; - *dataptr++ = outval; - tmp_nbits = 0; + *dataptr++ = outval; + tmp_nbits = 0; } } shiftbuffer <<= 16; } nwords -= 2; if (dma) { - fetchval = do_get_mem_long(real_pt); +#ifdef ARMV6_ASSEMBLY + __asm__ ( + "ldr %[val], [%[pt]], #4 \n\t" + "rev %[val], %[val] \n\t" + : [val] "=r" (fetchval), [pt] "+r" (real_pt) ); +#else + fetchval = do_get_mem_long (real_pt); real_pt++; +#endif + if (unaligned) { + fetchval &= 0x0000ffff; + fetchval |= fetchval << 16; + } else if (fetchmode_fmode & 2) { + fetchval &= 0xffff0000; + fetchval |= fetchval >> 16; + } } - } fetched_aga[plane] = fetchval; todisplay2_aga[plane] = (shiftbuffer >> delay) & 0xffffffff; outword[plane] = outval; } -STATIC_INLINE void shift32plus(uae_u64 *p, int n) +STATIC_INLINE void shift32plus (uae_u64 *p, int n) { uae_u64 t = p[1]; t <<= n; @@ -1828,14 +1534,14 @@ STATIC_INLINE void shift32plus(uae_u64 *p, int n) p[1] = t; } -STATIC_INLINE void aga_shift(uae_u64 *p, int n) +STATIC_INLINE void aga_shift (uae_u64 *p, int n) { if (n == 0) return; - shift32plus(p, n); + shift32plus (p, n); p[0] <<= n; } -STATIC_INLINE void shift32plusn(uae_u64 *p, int n) +STATIC_INLINE void shift32plusn (uae_u64 *p, int n) { uae_u64 t = p[0]; t >>= n; @@ -1843,165 +1549,148 @@ STATIC_INLINE void shift32plusn(uae_u64 *p, int n) p[0] = t; } -STATIC_INLINE void aga_shift_n(uae_u64 *p, int n) +STATIC_INLINE void aga_shift_n (uae_u64 *p, int n) { if (n == 0) return; - shift32plusn(p, n); + shift32plusn (p, n); p[1] >>= n; } -STATIC_INLINE void long_fetch_64(int plane, int nwords, int weird_number_of_bits, int dma) +STATIC_INLINE void long_fetch_64 (int plane, int nwords, int weird_number_of_bits, int dma) { - uae_u32 *real_pt = reinterpret_cast(pfield_xlateptr(bplpt[plane], nwords * 2)); + uae_u32 *real_pt = (uae_u32 *)pfield_xlateptr (bplpt[plane] & ~7, nwords * 2); int delay = toscr_delay_adjusted[plane & 1]; int tmp_nbits = out_nbits; -#ifdef HAVE_UAE_U128 - uae_u128 shiftbuffer; -#else uae_u64 shiftbuffer[2]; -#endif uae_u32 outval = outword[plane]; uae_u64 fetchval = fetched_aga[plane]; - uae_u32 *dataptr = reinterpret_cast(line_data[next_lineno] + 2 * plane * MAX_WORDS_PER_LINE + 4 * out_offs); + uae_u32 *dataptr = (uae_u32 *)(line_data[next_lineno] + 2 * plane * MAX_WORDS_PER_LINE + 4 * out_offs); int shift = (64 - 16) + delay; + bool unaligned2 = (bplpt[plane] & 2) != 0; + bool unaligned4 = (bplpt[plane] & 4) != 0; if (dma) { bplpt[plane] += nwords * 2; - bplptx[plane] += nwords * 2; - } + } if (real_pt == 0) /* @@@ Don't do this, fall back on chipmem_wget instead. */ return; -#ifdef HAVE_UAE_U128 - shiftbuffer = todisplay2_aga[plane] << delay; -#else shiftbuffer[1] = 0; shiftbuffer[0] = todisplay2_aga[plane]; - aga_shift(shiftbuffer, delay); -#endif + aga_shift (shiftbuffer, delay); while (nwords > 0) { int i; -#ifdef HAVE_UAE_U128 - shiftbuffer |= fetchval; -#else shiftbuffer[0] |= fetchval; -#endif for (i = 0; i < 4; i++) { - uae_u32 t; + uae_u32 t; int bits_left = 32 - tmp_nbits; -#ifdef HAVE_UAE_U128 - t = (shiftbuffer >> shift) & 0xffff; -#else if (64 - shift > 0) { - t = shiftbuffer[1] << (64 - shift); + t = (uae_u32)(shiftbuffer[1] << (64 - shift)); t |= shiftbuffer[0] >> shift; - } - else { - t = shiftbuffer[1] >> (shift - 64); + } else { + t = (uae_u32)(shiftbuffer[1] >> (shift - 64)); } t &= 0xffff; -#endif if (weird_number_of_bits && bits_left < 16) { outval <<= bits_left; outval |= t >> (16 - bits_left); - thisline_changed |= *dataptr ^ outval; - *dataptr++ = outval; + *dataptr++ = outval; outval = t; tmp_nbits = 16 - bits_left; - } - else { + } else { outval = (outval << 16) | t; tmp_nbits += 16; if (tmp_nbits == 32) { - thisline_changed |= *dataptr ^ outval; - *dataptr++ = outval; - tmp_nbits = 0; + *dataptr++ = outval; + tmp_nbits = 0; + } } + aga_shift (shiftbuffer, 16); } -#ifdef HAVE_UAE_U128 - shiftbuffer <<= 16; -#else - aga_shift(shiftbuffer, 16); -#endif - } nwords -= 4; if (dma) { - fetchval = static_cast(do_get_mem_long(real_pt)) << 32; - fetchval |= do_get_mem_long(real_pt + 1); - real_pt += 2; + uae_u32 *real_pt1, *real_pt2; + if (unaligned4) { + real_pt1 = real_pt + 1; + real_pt2 = real_pt + 1; + } else { + real_pt1 = real_pt; + real_pt2 = real_pt + 1; + } + if (unaligned2) { + uae_u32 v1 = do_get_mem_long (real_pt1); + uae_u32 v2 = do_get_mem_long (real_pt2); + v1 &= 0x0000ffff; + v1 |= v1 << 16; + v2 &= 0x0000ffff; + v2 |= v2 << 16; + fetchval = (((uae_u64)v1) << 32) | v2; + } else { + fetchval = ((uae_u64)do_get_mem_long (real_pt1)) << 32; + fetchval |= do_get_mem_long (real_pt2); + } + real_pt += 2; } -} + } fetched_aga[plane] = fetchval; -#ifdef HAVE_UAE_U128 - todisplay2_aga[plane] = shiftbuffer >> delay; -#else - aga_shift_n(shiftbuffer, delay); + aga_shift_n (shiftbuffer, delay); todisplay2_aga[plane] = shiftbuffer[0]; -#endif outword[plane] = outval; } -#endif -static void long_fetch_16_0(int hpos, int nwords, int dma) { long_fetch_16(hpos, nwords, 0, dma); } -static void long_fetch_16_1(int hpos, int nwords, int dma) { long_fetch_16(hpos, nwords, 1, dma); } -#ifdef AGA -static void long_fetch_32_0(int hpos, int nwords, int dma) { long_fetch_32(hpos, nwords, 0, dma); } -static void long_fetch_32_1(int hpos, int nwords, int dma) { long_fetch_32(hpos, nwords, 1, dma); } -static void long_fetch_64_0(int hpos, int nwords, int dma) { long_fetch_64(hpos, nwords, 0, dma); } -static void long_fetch_64_1(int hpos, int nwords, int dma) { long_fetch_64(hpos, nwords, 1, dma); } -#endif +static void long_fetch_16_0 (int hpos, int nwords, int dma) { long_fetch_16 (hpos, nwords, 0, dma); } +static void long_fetch_16_1 (int hpos, int nwords, int dma) { long_fetch_16 (hpos, nwords, 1, dma); } +static void long_fetch_32_0 (int hpos, int nwords, int dma) { long_fetch_32 (hpos, nwords, 0, dma); } +static void long_fetch_32_1 (int hpos, int nwords, int dma) { long_fetch_32 (hpos, nwords, 1, dma); } +static void long_fetch_64_0 (int hpos, int nwords, int dma) { long_fetch_64 (hpos, nwords, 0, dma); } +static void long_fetch_64_1 (int hpos, int nwords, int dma) { long_fetch_64 (hpos, nwords, 1, dma); } -static void do_long_fetch(int hpos, int nwords, int dma, int fm) +static void do_long_fetch (int hpos, int nwords, int dma, int fm) { int i; - flush_display(fm); - beginning_of_plane_block(hpos, fm); + flush_display (fm); + beginning_of_plane_block (hpos, fm); switch (fm) { - case 0: - if (out_nbits & 15) { - for (i = 0; i < toscr_nr_planes; i++) - long_fetch_16_1(i, nwords, dma); - } - else { - for (i = 0; i < toscr_nr_planes; i++) - long_fetch_16_0(i, nwords, dma); - } - break; -#ifdef AGA - case 1: - if (out_nbits & 15) { - for (i = 0; i < toscr_nr_planes; i++) - long_fetch_32_1(i, nwords, dma); - } - else { - for (i = 0; i < toscr_nr_planes; i++) - long_fetch_32_0(i, nwords, dma); - } - break; - case 2: - if (out_nbits & 15) { - for (i = 0; i < toscr_nr_planes; i++) - long_fetch_64_1(i, nwords, dma); - } - else { - for (i = 0; i < toscr_nr_planes; i++) - long_fetch_64_0(i, nwords, dma); - } - break; -#endif + case 0: + if (out_nbits & 15) { + for (i = 0; i < toscr_nr_planes; i++) + long_fetch_16_1 (i, nwords, dma); + } else { + for (i = 0; i < toscr_nr_planes; i++) + long_fetch_16_0 (i, nwords, dma); + } + break; + case 1: + if (out_nbits & 15) { + for (i = 0; i < toscr_nr_planes; i++) + long_fetch_32_1 (i, nwords, dma); + } else { + for (i = 0; i < toscr_nr_planes; i++) + long_fetch_32_0 (i, nwords, dma); + } + break; + case 2: + if (out_nbits & 15) { + for (i = 0; i < toscr_nr_planes; i++) + long_fetch_64_1 (i, nwords, dma); + } else { + for (i = 0; i < toscr_nr_planes; i++) + long_fetch_64_0 (i, nwords, dma); + } + break; } out_nbits += nwords * 16; @@ -2009,31 +1698,29 @@ static void do_long_fetch(int hpos, int nwords, int dma, int fm) out_nbits &= 31; delay_cycles += nwords * 16; - if (dma && toscr_nr_planes > 0) + if (dma && toscr_nr_planes > 0) fetch_state = fetch_was_plane0; } -#endif - -static void finish_last_fetch(int pos, int fm, bool reallylast) +STATIC_INLINE void finish_last_fetch (int pos, int fm, bool reallylast) { - if (thisline_decision.plfleft < 0) - return; + if (thisline_decision.plfleft < 0) + return; if (plfr_state >= plfr_end) - return; + return; plfr_state = plfr_end; - flush_display(fm); + flush_display (fm); // This may not be the last fetch, store current endpos for future use. // There is at least one demo that has two DDFSTRT-DDFSTOP horizontal sections // Subtle Shades / Nuance. - thisline_decision.plfright = pos; + thisline_decision.plfright = pos; if (!reallylast) { - if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { - ddfstate = DIW_waiting_start; - fetch_state = fetch_not_started; - } + if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { + ddfstate = DIW_waiting_start; + fetch_state = fetch_not_started; + } } } @@ -2046,129 +1733,43 @@ static void reset_bpl_vars(void) } /* check special case where last fetch wraps to next line -* this makes totally corrupted and flickering display on -* real hardware due to refresh cycle conflicts -* Exception: AGA + 64 bit fetch: glitch free overrun is possible. -*/ -static void maybe_finish_last_fetch(int pos, int fm) + * this makes totally corrupted and flickering display on + * real hardware due to refresh cycle conflicts + */ +static void maybe_finish_last_fetch (int pos, int fm) { - if (plf_state > plf_passed_stop2 || plf_state < plf_passed_stop || (fetch_state != fetch_started && fetch_state != fetch_started_first) || !dmaen(DMA_BITPLANE)) { - finish_last_fetch(pos, fm, true); - } - else { - bitplane_overrun_fetch_cycle = fetch_cycle - 1; - int cycle_start = bitplane_overrun_fetch_cycle & fetchstart_mask; - int left = fetchunit - cycle_start; - if (plf_state == plf_passed_stop_act) { - // not passed stop: remaining cycles + full block. - bitplane_overrun = 2; - bitplane_overrun_hpos = left + fm_maxplane; - } - else { - // already passsed stop but some cycles remaining. - bitplane_overrun = -1; - // only idle cycles left? - left -= fetchunit - fm_maxplane; - if (left <= 0) - bitplane_overrun = 0; - bitplane_overrun_hpos = left; - } - bitplane_overrun_cycle_diagram_shift = fetchunit - (bitplane_overrun_fetch_cycle & fetchstart_mask); + if (plf_state > plf_passed_stop2 || plf_state < plf_passed_stop || (fetch_state != fetch_started && fetch_state != fetch_started_first) || !dmaen (DMA_BITPLANE) || bitplane_maybe_start_hpos >= 0x100) { + finish_last_fetch (pos, fm, true); + } else { + SET_LINE_CYCLEBASED; finish_last_fetch(pos, fm, true); } } -static void do_overrun_fetch(int until, int fm) -{ - static int warned = 20; - bool hit = false; - - if (until <= 0) - return; - for (int pos = last_fetch_hpos; pos < until; pos++) { - bool bpl0 = false; - int cycle_start = bitplane_overrun_fetch_cycle & fetchstart_mask; - - if (pos < 0) - continue; - - if ((bitplane_overrun_fetch_cycle & fetchunit_mask) == 0 && bitplane_overrun < 0) { - bitplane_overrun = 0; - return; - } - - bool modulo = bitplane_overrun < 2; - switch (fm_maxplane) { - case 8: - switch (cycle_start) { - case 0: fetch(7, fm, modulo, pos); hit = true; break; - case 1: fetch(3, fm, modulo, pos); hit = true; break; - case 2: fetch(5, fm, modulo, pos); hit = true; break; - case 3: fetch(1, fm, modulo, pos); hit = true; break; - case 4: fetch(6, fm, modulo, pos); hit = true; break; - case 5: fetch(2, fm, modulo, pos); hit = true; break; - case 6: fetch(4, fm, modulo, pos); hit = true; break; - case 7: fetch(0, fm, modulo, pos); hit = true; bpl0 = true; break; - default: - break; - } - break; - case 4: - switch (cycle_start) { - case 0: fetch(3, fm, modulo, pos); hit = true; break; - case 1: fetch(1, fm, modulo, pos); hit = true; break; - case 2: fetch(2, fm, modulo, pos); hit = true; break; - case 3: fetch(0, fm, modulo, pos); hit = true; bpl0 = true; break; - default: - break; - } - break; - case 2: - switch (cycle_start) { - case 0: fetch(1, fm, modulo, pos); hit = true; break; - case 1: fetch(0, fm, modulo, pos); hit = true; bpl0 = true; break; - default: - break; - } - break; - } - - if ((bitplane_overrun_fetch_cycle & fetchunit_mask) == 0) { - bitplane_overrun--; - if (hit && warned > 0) { - warned--; - write_log(_T("WARNING: bitplane DMA crossing scanlines!\n")); - } - if (bitplane_overrun <= 0) - break; - } - - bitplane_overrun_fetch_cycle++; - } -} /* make sure fetch that goes beyond maxhpos is finished */ -static void finish_final_fetch(void) +STATIC_INLINE void finish_final_fetch (void) { if (thisline_decision.plfleft < 0) - return; + return; if (plfr_state < plfr_end) - finish_last_fetch(maxhpos, fetchmode, true); + finish_last_fetch (maxhpos, fetchmode, true); plfr_state = plfr_finished; // workaround for too long fetches that don't pass plf_passed_stop2 before end of scanline if (aga_plf_passed_stop2 && plf_state >= plf_passed_stop) plf_state = plf_end; - + // This is really the end of scanline, we can finally flush all remaining data. - thisline_decision.plfright += flush_plane_data(fetchmode); + thisline_decision.plfright += flush_plane_data (fetchmode); + // This can overflow if display setup is really bad. + if (out_offs > MAX_PIXELS_PER_LINE / 32) + out_offs = MAX_PIXELS_PER_LINE / 32; thisline_decision.plflinelen = out_offs; - - finish_playfield_line(); } -STATIC_INLINE int one_fetch_cycle_0(int pos, int dma, int fm) +STATIC_INLINE int one_fetch_cycle_0 (int pos, int dma, int fm) { bool bplactive = true; bool diw = diwstate == DIW_waiting_stop; @@ -2183,14 +1784,12 @@ STATIC_INLINE int one_fetch_cycle_0(int pos, int dma, int fm) if (bitplane_off_delay == 0) { if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { plf_state = plf_passed_stop; - } - else { + } else { plf_state = plf_active; } } } - } - else if (!dma || !diw) { + } else if (!dma || !diw) { bplactive = false; // dma off: turn off bitplane output after 4 cycles // (yes, switching DMA off won't disable it immediately) @@ -2220,8 +1819,7 @@ STATIC_INLINE int one_fetch_cycle_0(int pos, int dma, int fm) plf_state = plf_passed_stop; } plf_end_hpos = pos + DDF_OFFSET; - } - else if (pos == plf_end_hpos) { + } else if (pos == plf_end_hpos) { ddfstop_matched = true; if (plf_state < plf_passed_stop_act) { plf_state = plf_passed_stop_act; @@ -2245,67 +1843,60 @@ STATIC_INLINE int one_fetch_cycle_0(int pos, int dma, int fm) if (pos == HARD_DDF_STOP) { if (plf_state < plf_wait) { plf_state = plf_passed_stop_act; - } + } } - maybe_check(pos); + maybe_check (pos); if (bplactive) { - /* fetchstart_mask can be larger than fm_maxplane if FMODE > 0. This means - that the remaining cycles are idle; we'll fall through the whole switch - without doing anything. */ + /* fetchstart_mask can be larger than fm_maxplane if FMODE > 0. This means + that the remaining cycles are idle; we'll fall through the whole switch + without doing anything. */ int cycle_start = fetch_cycle & fetchstart_mask; - bool modulo = plf_state == plf_passed_stop2 && fetch_cycle >= (fetch_cycle & ~fetchunit_mask) + fetch_modulo_cycle; - + bool modulo = plf_state == plf_passed_stop2 && fetch_cycle >= (fetch_cycle & ~fetchunit_mask) + fetch_modulo_cycle; switch (fm_maxplane) { - case 8: - switch (cycle_start) { - case 0: fetch(7, fm, modulo, pos); break; - case 1: fetch(3, fm, modulo, pos); break; - case 2: fetch(5, fm, modulo, pos); break; - case 3: fetch(1, fm, modulo, pos); break; - case 4: fetch(6, fm, modulo, pos); break; - case 5: fetch(2, fm, modulo, pos); break; - case 6: fetch(4, fm, modulo, pos); break; - case 7: fetch(0, fm, modulo, pos); break; -#ifdef AGA - default: - // if AGA: consider plf_passed_stop2 already - // active when last plane has been written, - // even if there is still idle cycles left - if (plf_state == plf_passed_stop_act) - aga_plf_passed_stop2 = true; + case 8: + switch (cycle_start) { + case 0: fetch (7, fm, modulo, pos); break; + case 1: fetch (3, fm, modulo, pos); break; + case 2: fetch (5, fm, modulo, pos); break; + case 3: fetch (1, fm, modulo, pos); break; + case 4: fetch (6, fm, modulo, pos); break; + case 5: fetch (2, fm, modulo, pos); break; + case 6: fetch (4, fm, modulo, pos); break; + case 7: fetch (0, fm, modulo, pos); break; + default: + // if AGA: consider plf_passed_stop2 already + // active when last plane has been written, + // even if there is still idle cycles left + if (!aga_plf_passed_stop2 && plf_state >= plf_passed_stop_act) + aga_plf_passed_stop2 = pos + ((8 << fetchmode) - cycle_start); + break; + } break; -#endif - } - break; - case 4: - switch (cycle_start) { - case 0: fetch(3, fm, modulo, pos); break; - case 1: fetch(1, fm, modulo, pos); break; - case 2: fetch(2, fm, modulo, pos); break; - case 3: fetch(0, fm, modulo, pos); break; -#ifdef AGA - default: - if (plf_state == plf_passed_stop_act) - aga_plf_passed_stop2 = true; + case 4: + switch (cycle_start) { + case 0: fetch (3, fm, modulo, pos); break; + case 1: fetch (1, fm, modulo, pos); break; + case 2: fetch (2, fm, modulo, pos); break; + case 3: fetch (0, fm, modulo, pos); break; + default: + if (!aga_plf_passed_stop2 && plf_state >= plf_passed_stop_act) + aga_plf_passed_stop2 = pos + ((8 << fetchmode) - cycle_start); + break; + } break; -#endif - } - break; - case 2: - switch (cycle_start) { - case 0: fetch(1, fm, modulo, pos); break; - case 1: fetch(0, fm, modulo, pos); break; -#ifdef AGA - default: - if (plf_state == plf_passed_stop_act) - aga_plf_passed_stop2 = true; + case 2: + switch (cycle_start) { + case 0: fetch (1, fm, modulo, pos); break; + case 1: fetch (0, fm, modulo, pos); break; + default: + if (!aga_plf_passed_stop2 && plf_state >= plf_passed_stop_act) + aga_plf_passed_stop2 = pos + ((8 << fetchmode) - cycle_start); + break; + } break; -#endif - } - break; } } @@ -2322,46 +1913,45 @@ STATIC_INLINE int one_fetch_cycle_0(int pos, int dma, int fm) toscr_nbits += toscr_res2p; if (bplcon1_written) { - flush_display(fm); - compute_toscr_delay(bplcon1); + flush_display (fm); + compute_toscr_delay (bplcon1); bplcon1_written = false; } if (toscr_nbits > 16) { - uae_abort(_T("toscr_nbits > 16 (%d)"), toscr_nbits); + uae_abort (_T("toscr_nbits > 16 (%d)"), toscr_nbits); toscr_nbits = 0; } - if (toscr_nbits == 16) - flush_display(fm); + if (toscr_nbits == 16) + flush_display (fm); + return 0; } -static int one_fetch_cycle_fm0(int pos, int dma) { return one_fetch_cycle_0(pos, dma, 0); } -static int one_fetch_cycle_fm1(int pos, int dma) { return one_fetch_cycle_0(pos, dma, 1); } -static int one_fetch_cycle_fm2(int pos, int dma) { return one_fetch_cycle_0(pos, dma, 2); } +static int one_fetch_cycle_fm0 (int pos, int dma) { return one_fetch_cycle_0 (pos, dma, 0); } +static int one_fetch_cycle_fm1 (int pos, int dma) { return one_fetch_cycle_0 (pos, dma, 1); } +static int one_fetch_cycle_fm2 (int pos, int dma) { return one_fetch_cycle_0 (pos, dma, 2); } -STATIC_INLINE int one_fetch_cycle(int pos, int dma, int fm) +STATIC_INLINE int one_fetch_cycle (int pos, int dma, int fm) { - switch (fm) { - case 0: return one_fetch_cycle_fm0(pos, dma); -#ifdef AGA - case 1: return one_fetch_cycle_fm1(pos, dma); - case 2: return one_fetch_cycle_fm2(pos, dma); -#endif - default: uae_abort(_T("fm corrupt")); return 0; - } + switch (fm) { + case 0: return one_fetch_cycle_fm0 (pos, dma); + case 1: return one_fetch_cycle_fm1 (pos, dma); + case 2: return one_fetch_cycle_fm2 (pos, dma); + default: uae_abort (_T("fm corrupt")); return 0; + } } -static void update_fetch_x(int until, int fm) +static void update_fetch_x (int until, int fm) { int pos; - if (nodraw()) + if (nodraw ()) return; pos = last_fetch_hpos; - update_toscr_planes(fm); + update_toscr_planes (fm); // not optimized, update_fetch_x() is extremely rarely used. for (; pos < until; pos++) { @@ -2369,41 +1959,41 @@ static void update_fetch_x(int until, int fm) toscr_nbits += toscr_res2p; if (toscr_nbits > 16) { - uae_abort(_T("xtoscr_nbits > 16 (%d)"), toscr_nbits); + uae_abort (_T("xtoscr_nbits > 16 (%d)"), toscr_nbits); toscr_nbits = 0; } if (toscr_nbits == 16) - flush_display(fm); + flush_display (fm); } if (until >= maxhpos) { - maybe_finish_last_fetch(pos, fm); + maybe_finish_last_fetch (pos, fm); return; } - flush_display(fm); + flush_display (fm); } -static void update_fetch(int until, int fm) +STATIC_INLINE void update_fetch (int until, int fm) { int pos; - int dma = dmaen(DMA_BITPLANE); + int dma = dmaen (DMA_BITPLANE); - if (nodraw() || plf_state >= plf_end) + if (nodraw() || plf_state >= plf_end) return; pos = last_fetch_hpos; - cycle_diagram_shift = last_fetch_hpos - fetch_cycle; + cycle_diagram_shift = last_fetch_hpos - fetch_cycle; /* First, a loop that prepares us for the speedup code. We want to enter the SPEEDUP case with fetch_state == fetch_was_plane0 or it is the very first fetch cycle (which equals to same state as fetch_was_plane0) - and then unroll whole blocks, so that we end on the same fetch_state again. */ + and then unroll whole blocks, so that we end on the same fetch_state again. */ for (; ; pos++) { if (pos == until) { if (until >= maxhpos) { - maybe_finish_last_fetch(pos, fm); + maybe_finish_last_fetch (pos, fm); return; } return; @@ -2411,20 +2001,15 @@ static void update_fetch(int until, int fm) if (fetch_state == fetch_was_plane0) break; + fetch_start (); + if (one_fetch_cycle (pos, dma, fm)) + return; + } - fetch_start(pos); - if (one_fetch_cycle(pos, dma, fm)) - return; - } - -#if SPEEDUP /* Unrolled version of the for loop below. */ if (plf_state == plf_active && !line_cyclebased && dma && (fetch_cycle & fetchstart_mask) == (fm_maxplane & fetchstart_mask) && !badmode -#ifdef DEBUGGER - && !debug_dma -#endif && toscr_nr_planes == toscr_nr_planes_agnus) { int ddfstop_to_test_ddf = HARD_DDF_STOP; @@ -2443,15 +2028,15 @@ static void update_fetch(int until, int fm) int stoppos = pos + count; if (thisline_decision.plfleft < 0) { - compute_toscr_delay(bplcon1); + compute_toscr_delay (bplcon1); } - do_long_fetch(pos, count >> (3 - toscr_res), dma, fm); + do_long_fetch (pos, count >> (3 - toscr_res), dma, fm); - /* This must come _after_ do_long_fetch so as not to confuse flush_display - into thinking the first fetch has produced any output worth emitting to - the screen. But the calculation of delay_offset must happen _before_. */ - maybe_first_bpl1dat(pos); + /* This must come _after_ do_long_fetch so as not to confuse flush_display + into thinking the first fetch has produced any output worth emitting to + the screen. But the calculation of delay_offset must happen _before_. */ + maybe_first_bpl1dat (pos); if (pos <= plfstop && stoppos > plfstop) { plf_state = plf_passed_stop; @@ -2465,106 +2050,71 @@ static void update_fetch(int until, int fm) if (pos <= HARD_DDF_STOP && stoppos > HARD_DDF_STOP) { if (plf_state < plf_wait) plf_state = plf_passed_stop_act; - } - if (pos <= ddfstop_to_test && stoppos > ddf2) { + } + if (pos <= ddfstop_to_test && stoppos > ddf2) { plf_state = plf_passed_stop2; - } - if (pos <= ddf2 && stoppos >= ddf2 + fm_maxplane) { - add_modulos(); - } + } + if (pos <= ddf2 && stoppos >= ddf2 + fm_maxplane) { + add_modulos (); + } pos += count; fetch_cycle += count; } } -#endif + for (; pos < until; pos++) { - if (fetch_state == fetch_was_plane0) { - flush_display(fm); - beginning_of_plane_block(pos, fm); - } + flush_display (fm); + beginning_of_plane_block (pos, fm); + } - fetch_start(pos); + fetch_start (); - if (one_fetch_cycle(pos, dma, fm)) - return; + if (one_fetch_cycle (pos, dma, fm)) + return; } if (until >= maxhpos) { - maybe_finish_last_fetch(pos, fm); + maybe_finish_last_fetch (pos, fm); return; } - flush_display(fm); + flush_display (fm); } -static void update_fetch_0(int hpos) { update_fetch(hpos, 0); } -static void update_fetch_1(int hpos) { update_fetch(hpos, 1); } -static void update_fetch_2(int hpos) { update_fetch(hpos, 2); } +static void update_fetch_0 (int hpos) { update_fetch (hpos, 0); } +static void update_fetch_1 (int hpos) { update_fetch (hpos, 1); } +static void update_fetch_2 (int hpos) { update_fetch (hpos, 2); } -static void decide_fetch(int hpos) +STATIC_INLINE void decide_fetch (int hpos) { if (hpos > last_fetch_hpos) { - if (bitplane_overrun) { - if (fetch_state != fetch_not_started) { - bitplane_overrun = 0; - } - else { - do_overrun_fetch(hpos, fetchmode); - } - } if (fetch_state != fetch_not_started) { - switch (fetchmode) { - case 0: update_fetch_0(hpos); break; -#ifdef AGA - case 1: update_fetch_1(hpos); break; - case 2: update_fetch_2(hpos); break; -#endif - default: uae_abort(_T("fetchmode corrupt")); - } - } - else if (bpl1dat_written_at_least_once) { + switch (fetchmode) { + case 0: update_fetch_0 (hpos); break; + case 1: update_fetch_1 (hpos); break; + case 2: update_fetch_2 (hpos); break; + default: uae_abort (_T("fetchmode corrupt")); + } + } else if (bpl1dat_written_at_least_once) { // "PIO" mode display - update_fetch_x(hpos, fetchmode); + update_fetch_x (hpos, fetchmode); bpl1dat_written = false; - } + } - maybe_check(hpos); - last_fetch_hpos = hpos; - } + maybe_check (hpos); + last_fetch_hpos = hpos; + } } -STATIC_INLINE void decide_fetch_safe(int hpos) +STATIC_INLINE void decide_fetch_safe (int hpos) { - if (!blitter_dangerous_bpl) { - decide_fetch(hpos); - decide_blitter(hpos); - } - else { - while (hpos > last_fetch_hpos) { - decide_fetch(last_fetch_hpos + 1); - decide_blitter(last_fetch_hpos + 1); - } - } + decide_fetch (hpos); } -static void start_bpl_dma(int hstart) +STATIC_INLINE void start_bpl_dma (int hstart) { - if (first_bpl_vpos < 0) - first_bpl_vpos = vpos; - - if (doflickerfix() && interlace_seen > 0 && !scandoubled_line) { - int i; - for (i = 0; i < 8; i++) { - prevbpl[lof_current][vpos][i] = bplptx[i]; - if (!lof_current && (bplcon0 & 4)) - bplpt[i] = prevbpl[1 - lof_current][vpos][i]; - if (!(bplcon0 & 4) || interlace_seen < 0) - prevbpl[1 - lof_current][vpos][i] = prevbpl[lof_current][vpos][i] = 0; - } - } - fetch_state = fetch_started; plfr_state = plfr_active; - ddfstate = DIW_waiting_stop; + ddfstate = DIW_waiting_stop; bpl_hstart = hstart; if (!bpldmawasactive) { @@ -2576,77 +2126,72 @@ static void start_bpl_dma(int hstart) // sprite fetch and bitplane cycle sequence start. if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) plfstrt_sprite--; - fetch_cycle = 0; - update_denise(last_fetch_hpos); - if (bpl1dat_written_at_least_once && hstart > last_fetch_hpos) { - update_fetch_x(hstart, fetchmode); - bpl1dat_written_at_least_once = false; - } - else { - reset_bpl_vars(); - } - cycle_diagram_shift = hstart; + fetch_cycle = 0; + update_denise (last_fetch_hpos); + if (bpl1dat_written_at_least_once && hstart > last_fetch_hpos) { + update_fetch_x (hstart, fetchmode); + bpl1dat_written_at_least_once = false; + } else { + reset_bpl_vars (); + } + cycle_diagram_shift = hstart; bpldmawasactive = true; - } - else { + } else { - flush_display(fetchmode); + // Bitplane DMA restart during FMODE>0 idle cycles? + if (aga_plf_passed_stop2) { + if (aga_plf_passed_stop2 > hstart) + aga_plf_passed_stop2 = hstart; + thisline_decision.plfright = aga_plf_passed_stop2; + aga_plf_passed_stop2 = 0; + } + + flush_display (fetchmode); // Calculate difference between last end to new start int diff = (hstart - thisline_decision.plfright) << (1 + toscr_res); // Render all missing pixels, use toscr because previous data may // still be in buffers. while (diff >= 16) { - toscr_1(16, fetchmode); + toscr_1 (16, fetchmode); diff -= 16; } if (diff) - toscr_1(diff, fetchmode); + toscr_1 (diff, fetchmode); + fetch_cycle = 0; cycle_diagram_shift = hstart; - update_denise(last_fetch_hpos); - update_fetch_x(hstart, fetchmode); - } - - last_fetch_hpos = hstart; - estimate_last_fetch_cycle(hstart); + update_denise (last_fetch_hpos); + update_fetch_x (hstart, fetchmode); + } + last_fetch_hpos = hstart; + estimate_last_fetch_cycle (hstart); } -STATIC_INLINE bool cant_this_last_line(void) -{ - // Last line.. - // ..works normally if A1000 Agnus - if (currprefs.cs_dipagnus) - return false; - // ..inhibits bitplane and sprite DMA if later Agnus revision. - return vpos + 1 >= maxvpos + lof_store; -} - -/* This function is responsible for turning on datafetch if necessary. */ -STATIC_INLINE void decide_line(int hpos) +/* This function is responsible for turning on datafetch if necessary. */ +static void decide_line (int hpos) { bool ecs = (currprefs.chipset_mask & CSMASK_ECS_AGNUS) != 0; /* Take care of the vertical DIW. */ if (vpos == plffirstline) { - // A1000 Agnus won't start bitplane DMA if vertical diw is zero. - if (vpos > 0 || (vpos == 0 && !currprefs.cs_dipagnus)) { - diwstate = DIW_waiting_stop; - SET_LINE_CYCLEBASED; - } + if (vpos >= 0) { + diwstate = DIW_waiting_stop; + SET_LINE_CYCLEBASED; + } } // last line of field can never have bitplane dma active if not A1000 Agnus. - if (vpos == plflastline || cant_this_last_line() || (vpos == 0 && currprefs.cs_dipagnus)) { + if (vpos == plflastline) { diwstate = DIW_waiting_start; SET_LINE_CYCLEBASED; } + + if (hpos <= last_decide_line_hpos) + return; - if (hpos <= last_decide_line_hpos) - return; - - bool dma = dmaen(DMA_BITPLANE) != 0; + bool dma = dmaen (DMA_BITPLANE) != 0; bool diw = diwstate == DIW_waiting_stop; if (ecs) { @@ -2655,8 +2200,7 @@ STATIC_INLINE void decide_line(int hpos) ddfstop_matched = false; } } - } - else { + } else { if (1) { if (last_decide_line_hpos < plfstrt && hpos >= plfstrt) { ddfstop_matched = false; @@ -2667,7 +2211,7 @@ STATIC_INLINE void decide_line(int hpos) } } - if (fetch_state == fetch_not_started) { + if (fetch_state == fetch_not_started || (aga_plf_passed_stop2 && plfstrt >= last_decide_line_hpos)) { bool strtpassed = false; plfstate nextstate = plf_end; int hstart; @@ -2703,8 +2247,7 @@ STATIC_INLINE void decide_line(int hpos) } } } - } - else { + } else { if (1) { int start = HARD_DDF_START_REAL; if (last_decide_line_hpos < start && hpos >= start) { @@ -2743,8 +2286,7 @@ STATIC_INLINE void decide_line(int hpos) test = false; } } - } - else { + } else { test = (plf_state == plf_active); // if DMA enabled mid-scanline but ddfstrt not matched (dma was off): start when ddfstop is matched // (Crash Landing crack intro / Scoopex) @@ -2753,11 +2295,13 @@ STATIC_INLINE void decide_line(int hpos) hstart = plfstop + DDF_OFFSET; test = true; nextstate = plf_passed_stop; + // inform overrun code that this won't overrun. + bitplane_maybe_start_hpos = 0x100; } } } if (test) { - start_bpl_dma(hstart); + start_bpl_dma (hstart); // if ECS: pre-set plf_end_hpos if we have already passed virtual ddfstop if (ecs) { if (last_decide_line_hpos < hstart && hstart >= plfstop && hstart - plfstop <= DDF_OFFSET) { @@ -2778,7 +2322,7 @@ STATIC_INLINE void decide_line(int hpos) estimate_last_fetch_cycle(hstart); } last_decide_line_hpos = hpos; - do_sprites(hpos); + do_sprites (hpos); return; } @@ -2798,8 +2342,7 @@ STATIC_INLINE void decide_line(int hpos) plf_state = plf_passed_stop_act; } } - } - else { + } else { if (dma && diw) { if (last_decide_line_hpos < plfstop && hpos >= plfstop && plfstop <= maxhpos - DDF_OFFSET && plf_state != plf_wait) { ddfstop_matched = true; @@ -2808,31 +2351,31 @@ STATIC_INLINE void decide_line(int hpos) } } - if (hpos > last_sprite_hpos && last_sprite_hpos < SPR0_HPOS + 4 * MAX_SPRITES) - do_sprites(hpos); - - last_decide_line_hpos = hpos; + if (hpos > last_sprite_hpos && last_sprite_hpos < SPR0_HPOS + 4 * MAX_SPRITES) + do_sprites (hpos); + + last_decide_line_hpos = hpos; } /* Called when a color is about to be changed (write to a color register), -* but the new color has not been entered into the table yet. */ -static void record_color_change(int hpos, int regno, unsigned long value) + * but the new color has not been entered into the table yet. */ +static void record_color_change (int hpos, int regno, unsigned long value) { - if (regno < 0x1000 && nodraw()) + if (regno < 0x1000 && nodraw ()) return; /* Early positions don't appear on-screen. */ - if (vpos < minfirstline) + if (vpos < minfirstline) return; - - decide_diw(hpos); - decide_line(hpos); - + + decide_diw (hpos); + decide_line (hpos); + if (thisline_decision.ctable < 0) - remember_ctable(); - - if ((regno < 0x1000 || regno == 0x1000 + 0x10c) && hpos < HBLANK_OFFSET && !(beamcon0 & 0x80) && prev_lineno >= 0) { - struct draw_info *pdip = curr_drawinfo + prev_lineno; - int idx = pdip->last_color_change; + remember_ctable (); + + if ((regno < 0x1000 || regno == 0x1000 + 0x10c) && hpos < HBLANK_OFFSET && !(beamcon0 & 0x80) && prev_lineno >= 0) { + struct draw_info *pdip = curr_drawinfo + prev_lineno; + int idx = pdip->last_color_change; int extrahpos = regno == 0x1000 + 0x10c ? 1 : 0; bool lastsync = false; /* Move color changes in horizontal cycles 0 to HBLANK_OFFSET to end of previous line. @@ -2842,54 +2385,41 @@ static void record_color_change(int hpos, int regno, unsigned long value) idx--; lastsync = true; } - pdip->last_color_change++; - pdip->nr_color_changes++; - curr_color_changes[idx].linepos = (hpos + maxhpos) * 2 + extrahpos; - curr_color_changes[idx].regno = regno; - curr_color_changes[idx].value = value; + pdip->last_color_change++; + pdip->nr_color_changes++; + curr_color_changes[idx].linepos = ((hpos + maxhpos) * 2 + extrahpos) * 4; + curr_color_changes[idx].regno = regno; + curr_color_changes[idx].value = value; if (lastsync) { - curr_color_changes[idx + 1].linepos = hsyncstartpos * 2; + curr_color_changes[idx + 1].linepos = (hsyncstartpos * 2) * 4; curr_color_changes[idx + 1].regno = 0xffff; curr_color_changes[idx + 2].regno = -1; + } else { + curr_color_changes[idx + 1].regno = -1; } - else { - curr_color_changes[idx + 1].regno = -1; - } - } - record_color_change2(hpos, regno, value); + } + record_color_change2 (hpos, regno, value); } -static bool isbrdblank(int hpos, uae_u16 bplcon0, uae_u16 bplcon3) +static bool isbrdblank (int hpos, uae_u16 bplcon0, uae_u16 bplcon3) { - bool brdblank, brdntrans; -#ifdef ECS_DENISE + bool brdblank; brdblank = (currprefs.chipset_mask & CSMASK_ECS_DENISE) && (bplcon0 & 1) && (bplcon3 & 0x20); - brdntrans = (currprefs.chipset_mask & CSMASK_ECS_DENISE) && (bplcon0 & 1) && (bplcon3 & 0x10); -#else - brdblank = false; - brdntrans = false; -#endif - if (hpos >= 0 && (ce_is_borderblank(current_colors.extra) != brdblank || ce_is_borderntrans(current_colors.extra) != brdntrans)) { - record_color_change(hpos, 0, COLOR_CHANGE_BRDBLANK | (brdblank ? 1 : 0) | (ce_is_bordersprite(current_colors.extra) ? 2 : 0) | (brdntrans ? 4 : 0)); + if (hpos >= 0 && (ce_is_borderblank(current_colors.extra) != brdblank)) { + record_color_change (hpos, 0, COLOR_CHANGE_BRDBLANK | (brdblank ? 1 : 0) | (ce_is_bordersprite(current_colors.extra) ? 2 : 0)); current_colors.extra &= ~(1 << CE_BORDERBLANK); - current_colors.extra &= ~(1 << CE_BORDERNTRANS); current_colors.extra |= brdblank ? (1 << CE_BORDERBLANK) : 0; - current_colors.extra |= brdntrans ? (1 << CE_BORDERNTRANS) : 0; remembered_color_entry = -1; } return brdblank; } -static bool issprbrd(int hpos, uae_u16 bplcon0, uae_u16 bplcon3) +static bool issprbrd (int hpos, uae_u16 bplcon0, uae_u16 bplcon3) { bool brdsprt; -#ifdef AGA - brdsprt = (currprefs.chipset_mask & CSMASK_AGA) && (bplcon0 & 1) && (bplcon3 & 0x02); -#else - brdsprt = false; -#endif + brdsprt = (aga_mode) && (bplcon0 & 1) && (bplcon3 & 0x02); if (hpos >= 0 && ce_is_bordersprite(current_colors.extra) != brdsprt) { - record_color_change(hpos, 0, COLOR_CHANGE_BRDBLANK | (ce_is_borderblank(current_colors.extra) ? 1 : 0) | (ce_is_borderntrans(current_colors.extra) ? 4 : 0) | (brdsprt ? 2 : 0)); + record_color_change (hpos, 0, COLOR_CHANGE_BRDBLANK | (ce_is_borderblank(current_colors.extra) ? 1 : 0) | (brdsprt ? 2 : 0)); current_colors.extra &= ~(1 << CE_BORDERSPRITE); current_colors.extra |= brdsprt ? (1 << CE_BORDERSPRITE) : 0; remembered_color_entry = -1; @@ -2899,57 +2429,48 @@ static bool issprbrd(int hpos, uae_u16 bplcon0, uae_u16 bplcon3) return brdsprt && !ce_is_borderblank(current_colors.extra); } -static void record_register_change(int hpos, int regno, uae_u16 value) +static void record_register_change (int hpos, int regno, uae_u16 value) { - if (regno == 0x100) { // BPLCON0 - if (value & 0x800) - thisline_decision.ham_seen = 1; - thisline_decision.ehb_seen = isehb(value, bplcon2); - isbrdblank(hpos, value, bplcon3); - issprbrd(hpos, value, bplcon3); - } - else if (regno == 0x104) { // BPLCON2 - thisline_decision.ehb_seen = isehb(bplcon0, value); - } - else if (regno == 0x106) { // BPLCON3 - isbrdblank(hpos, bplcon0, value); - issprbrd(hpos, bplcon0, value); - } - record_color_change(hpos, regno + 0x1000, value); + if (regno == 0x100) { // BPLCON0 + if (value & 0x800) + thisline_decision.ham_seen = 1; + isbrdblank (hpos, value, bplcon3); + issprbrd (hpos, value, bplcon3); + } else if (regno == 0x106) { // BPLCON3 + isbrdblank (hpos, bplcon0, value); + issprbrd (hpos, bplcon0, value); + } + record_color_change (hpos, regno + 0x1000, value); } typedef int sprbuf_res_t, cclockres_t, hwres_t, bplres_t; -static int expand_sprres(uae_u16 con0, uae_u16 con3) +static int expand_sprres (uae_u16 con0, uae_u16 con3) { - int res; + int res; - switch ((con3 >> 6) & 3) - { - default: - res = RES_LORES; - break; -#ifdef ECS_DENISE - case 0: /* ECS defaults (LORES,HIRES=LORES sprite,SHRES=HIRES sprite) */ - if ((currprefs.chipset_mask & CSMASK_ECS_DENISE) && GET_RES_DENISE(con0) == RES_SUPERHIRES) - res = RES_HIRES; - else + switch ((con3 >> 6) & 3) + { + default: + res = RES_LORES; + break; + case 0: /* ECS defaults (LORES,HIRES=LORES sprite,SHRES=HIRES sprite) */ + if ((currprefs.chipset_mask & CSMASK_ECS_DENISE) && GET_RES_DENISE (con0) == RES_SUPERHIRES) + res = RES_HIRES; + else + res = RES_LORES; + break; + case 1: res = RES_LORES; - break; -#endif -#ifdef AGA - case 1: - res = RES_LORES; - break; - case 2: - res = RES_HIRES; - break; - case 3: - res = RES_SUPERHIRES; - break; -#endif + break; + case 2: + res = RES_HIRES; + break; + case 3: + res = RES_SUPERHIRES; + break; } - return res; + return res; } #define DO_PLAYFIELD_COLLISIONS \ @@ -2963,188 +2484,165 @@ static int expand_sprres(uae_u16 con0, uae_u16 con3) /* handle very rarely needed playfield collision (CLXDAT bit 0) */ /* only known game needing this is Rotor */ -static void do_playfield_collisions(void) +static void do_playfield_collisions (void) { - int bplres = bplcon0_res; - hwres_t ddf_left = thisline_decision.plfleft * 2 << bplres; - hwres_t hw_diwlast = coord_window_to_diw_x(thisline_decision.diwlastword); - hwres_t hw_diwfirst = coord_window_to_diw_x(thisline_decision.diwfirstword); - int i, collided, minpos, maxpos; -#ifdef AGA - int planes = (currprefs.chipset_mask & CSMASK_AGA) ? 8 : 6; -#else - int planes = 6; -#endif + int bplres = bplcon0_res; + hwres_t ddf_left = thisline_decision.plfleft * 2 << bplres; + hwres_t hw_diwlast = coord_window_to_diw_x (thisline_decision.diwlastword); + hwres_t hw_diwfirst = coord_window_to_diw_x (thisline_decision.diwfirstword); + int i, collided, minpos, maxpos; + int planes = (aga_mode) ? 8 : 6; - //if (clxcon_bpl_enable == 0) { - // clxdat |= 1; - // return; - //} - //// collision bit already set? - //if (clxdat & 1) - // return; - - collided = 0; - minpos = thisline_decision.plfleft * 2; - if (minpos < hw_diwfirst) - minpos = hw_diwfirst; - maxpos = thisline_decision.plfright * 2; - if (maxpos > hw_diwlast) - maxpos = hw_diwlast; - for (i = minpos; i < maxpos && !collided; i += 32) { - int offs = ((i << bplres) - ddf_left) >> 3; - int j; - uae_u32 total = 0xffffffff; - for (j = 0; j < planes; j++) { - int ena = (clxcon_bpl_enable >> j) & 1; - int match = (clxcon_bpl_match >> j) & 1; - uae_u32 t = 0xffffffff; - if (ena) { - if (j < thisline_decision.nr_planes) { - t = *(uae_u32 *)(line_data[next_lineno] + offs + 2 * j * MAX_WORDS_PER_LINE); - t ^= (match & 1) - 1; - } - else { - t = (match & 1) - 1; - } - } - total &= t; - } - if (total) { - collided = 1; - } - } - if (collided) - clxdat |= 1; + collided = 0; + minpos = thisline_decision.plfleft * 2; + if (minpos < hw_diwfirst) + minpos = hw_diwfirst; + maxpos = thisline_decision.plfright * 2; + if (maxpos > hw_diwlast) + maxpos = hw_diwlast; + for (i = minpos; i < maxpos && !collided; i+= 32) { + int offs = ((i << bplres) - ddf_left) >> 3; + int j; + uae_u32 total = 0xffffffff; + for (j = 0; j < planes; j++) { + int ena = (clxcon_bpl_enable >> j) & 1; + int match = (clxcon_bpl_match >> j) & 1; + uae_u32 t = 0xffffffff; + if (ena) { + if (j < thisline_decision.nr_planes) { + t = *(uae_u32 *)(line_data[next_lineno] + offs + 2 * j * MAX_WORDS_PER_LINE); + t ^= (match & 1) - 1; + } else { + t = (match & 1) - 1; + } + } + total &= t; + } + if (total) { + collided = 1; + } + } + if (collided) + clxdat |= 1; } #define DO_SPRITE_COLLISIONS \ { \ - if (!clxcon_bpl_enable) \ - clxdat |= 0x1FE; \ - else \ + if (clxcon_bpl_enable || curr_drawinfo[next_lineno].nr_sprites) { \ + /* all sprite to bitplane collision bits already set? */ \ + if ((clxdat & 0x1fe) != 0x1fe) \ do_sprite_collisions (); \ + } \ } /* Sprite-to-sprite collisions are taken care of in record_sprite. This one does -playfield/sprite collisions. */ -static void do_sprite_collisions(void) + playfield/sprite collisions. */ +static void do_sprite_collisions (void) { - int nr_sprites = curr_drawinfo[next_lineno].nr_sprites; - int first = curr_drawinfo[next_lineno].first_sprite_entry; - int i; - unsigned int collision_mask = clxmask[clxcon >> 12]; - int bplres = bplcon0_res; - hwres_t ddf_left = thisline_decision.plfleft * 2 << bplres; - hwres_t hw_diwlast = coord_window_to_diw_x(thisline_decision.diwlastword); - hwres_t hw_diwfirst = coord_window_to_diw_x(thisline_decision.diwfirstword); + int nr_sprites = curr_drawinfo[next_lineno].nr_sprites; + int first = curr_drawinfo[next_lineno].first_sprite_entry; + int i; + unsigned int collision_mask = clxmask[clxcon >> 12]; + int bplres = bplcon0_res; + hwres_t ddf_left = thisline_decision.plfleft * 2 << bplres; + hwres_t hw_diwlast = coord_window_to_diw_x (thisline_decision.diwlastword); + hwres_t hw_diwfirst = coord_window_to_diw_x (thisline_decision.diwfirstword); - //if (clxcon_bpl_enable == 0 && !nr_sprites) - // return; - //// all sprite to bitplane collision bits already set? - //if ((clxdat & 0x1fe) == 0x1fe) - // return; + for (i = 0; i < nr_sprites; i++) { + struct sprite_entry *e = curr_sprite_entries + first + i; + sprbuf_res_t j; + sprbuf_res_t minpos = e->pos; + sprbuf_res_t maxpos = e->max; + hwres_t minp1 = minpos >> sprite_buffer_res; + hwres_t maxp1 = maxpos >> sprite_buffer_res; - for (i = 0; i < nr_sprites; i++) { - struct sprite_entry *e = curr_sprite_entries + first + i; - sprbuf_res_t j; - sprbuf_res_t minpos = e->pos; - sprbuf_res_t maxpos = e->max; - hwres_t minp1 = minpos >> sprite_buffer_res; - hwres_t maxp1 = maxpos >> sprite_buffer_res; + if (maxp1 > hw_diwlast) + maxpos = hw_diwlast << sprite_buffer_res; + if (maxp1 > thisline_decision.plfright * 2) + maxpos = thisline_decision.plfright * 2 << sprite_buffer_res; + if (minp1 < hw_diwfirst) + minpos = hw_diwfirst << sprite_buffer_res; + if (minp1 < thisline_decision.plfleft * 2) + minpos = thisline_decision.plfleft * 2 << sprite_buffer_res; - if (maxp1 > hw_diwlast) - maxpos = hw_diwlast << sprite_buffer_res; - if (maxp1 > thisline_decision.plfright * 2) - maxpos = thisline_decision.plfright * 2 << sprite_buffer_res; - if (minp1 < hw_diwfirst) - minpos = hw_diwfirst << sprite_buffer_res; - if (minp1 < thisline_decision.plfleft * 2) - minpos = thisline_decision.plfleft * 2 << sprite_buffer_res; + for (j = minpos; j < maxpos; j++) { + int sprpix = spixels[e->first_pixel + j - e->pos] & collision_mask; + int k, offs, match = 1; - for (j = minpos; j < maxpos; j++) { - int sprpix = spixels[e->first_pixel + j - e->pos] & collision_mask; - int k, offs, match = 1; + if (sprpix == 0) + continue; - if (sprpix == 0) - continue; - - offs = ((j << bplres) >> sprite_buffer_res) - ddf_left; - sprpix = sprite_ab_merge[sprpix & 255] | (sprite_ab_merge[sprpix >> 8] << 2); - sprpix <<= 1; + offs = ((j << bplres) >> sprite_buffer_res) - ddf_left; + sprpix = sprite_ab_merge[sprpix & 255] | (sprite_ab_merge[sprpix >> 8] << 2); + sprpix <<= 1; // both odd and even collision bits already set? if ((clxdat & (sprpix << 0)) && (clxdat & (sprpix << 4))) continue; - /* Loop over number of playfields. */ - for (k = 1; k >= 0; k--) { - int l; -#ifdef AGA - int planes = (currprefs.chipset_mask & CSMASK_AGA) ? 8 : 6; -#else - int planes = 6; -#endif - if (bplcon0 & 0x400) - match = 1; - for (l = k; match && l < planes; l += 2) { - int t = 0; - if (l < thisline_decision.nr_planes) { - uae_u32 *ldata = reinterpret_cast(line_data[next_lineno] + 2 * l * MAX_WORDS_PER_LINE); - uae_u32 word = ldata[offs >> 5]; - t = (word >> (31 - (offs & 31))) & 1; - } - if (clxcon_bpl_enable & (1 << l)) { - if (t != ((clxcon_bpl_match >> l) & 1)) - match = 0; - } - } - if (match) { - clxdat |= sprpix << (k * 4); - } - } - } - } + /* Loop over number of playfields. */ + for (k = 1; k >= 0; k--) { + int l; + int planes = (aga_mode) ? 8 : 6; + if (bplcon0 & 0x400) + match = 1; + for (l = k; match && l < planes; l += 2) { + int t = 0; + if (l < thisline_decision.nr_planes) { + uae_u32 *ldata = (uae_u32 *)(line_data[next_lineno] + 2 * l * MAX_WORDS_PER_LINE); + uae_u32 word = ldata[offs >> 5]; + t = (word >> (31 - (offs & 31))) & 1; + } + if (clxcon_bpl_enable & (1 << l)) { + if (t != ((clxcon_bpl_match >> l) & 1)) + match = 0; + } + } + if (match) { + clxdat |= sprpix << (k * 4); + } + } + } + } } -static void record_sprite_1(int sprxp, uae_u16 *buf, uae_u32 datab, int num, int dbl, - unsigned int mask, int do_collisions, uae_u32 collision_mask) +static void record_sprite_1 (int sprxp, uae_u16 *buf, uae_u32 datab, int num, int dbl, + unsigned int mask, int do_collisions, uae_u32 collision_mask) { int j = 0; while (datab) { - unsigned int col = 0; - unsigned coltmp = 0; - - if ((sprxp >= sprite_minx && sprxp < sprite_maxx) || (bplcon3 & 2)) - col = (datab & 3) << (2 * num); - + unsigned int col = 0; + unsigned int coltmp = 0; + + if ((sprxp >= sprite_minx && sprxp < sprite_maxx) || (bplcon3 & 2)) + col = (datab & 3) << (2 * num); if ((j & mask) == 0) { - unsigned int tmp = (*buf) | col; + unsigned int tmp = (*buf) | col; *buf++ = tmp; - if (do_collisions) - coltmp |= tmp; - sprxp++; - } - if (dbl > 0) { - unsigned int tmp = (*buf) | col; + if (do_collisions) + coltmp |= tmp; + sprxp++; + } + if (dbl > 0) { + unsigned int tmp = (*buf) | col; *buf++ = tmp; - if (do_collisions) - coltmp |= tmp; - sprxp++; - } - if (dbl > 1) { - unsigned int tmp; - tmp = (*buf) | col; - *buf++ = tmp; - if (do_collisions) - coltmp |= tmp; - tmp = (*buf) | col; - *buf++ = tmp; - if (do_collisions) - coltmp |= tmp; - sprxp++; - sprxp++; - } + if (do_collisions) + coltmp |= tmp; + sprxp++; + } + if (dbl > 1) { + unsigned int tmp; + tmp = (*buf) | col; + *buf++ = tmp; + if (do_collisions) + coltmp |= tmp; + tmp = (*buf) | col; + *buf++ = tmp; + if (do_collisions) + coltmp |= tmp; + sprxp++; + sprxp++; + } j++; datab >>= 2; if (do_collisions) { @@ -3166,7 +2664,7 @@ static void record_sprite_1(int sprxp, uae_u16 *buf, uae_u32 datab, int num, int The data is recorded either in lores pixels (if OCS/ECS), or in hires or superhires pixels (if AGA). */ -static void record_sprite(int line, int num, int sprxp, uae_u16 *data, uae_u16 *datb, unsigned int ctl) +static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16 *datb, unsigned int ctl) { struct sprite_entry *e = curr_sprite_entries + next_sprite_entry; int i; @@ -3174,58 +2672,57 @@ static void record_sprite(int line, int num, int sprxp, uae_u16 *data, uae_u16 * uae_u32 collision_mask; int width, dbl, half; unsigned int mask = 0; - int attachment; - - half = 0; + int attachment; + + half = 0; dbl = sprite_buffer_res - sprres; - if (dbl < 0) { - half = -dbl; - dbl = 0; - mask = 1 << half; - } - width = (sprite_width << sprite_buffer_res) >> sprres; - attachment = sprctl[num | 1] & 0x80; + if (dbl < 0) { + half = -dbl; + dbl = 0; + mask = 1 << half; + } + width = (sprite_width << sprite_buffer_res) >> sprres; + attachment = sprctl[num | 1] & 0x80; /* Try to coalesce entries if they aren't too far apart */ - if (!next_sprite_forced && e[-1].max + sprite_width >= sprxp) { + if (! next_sprite_forced && e[-1].max + sprite_width >= sprxp) { e--; - } - else { + } else { next_sprite_entry++; e->pos = sprxp; e->has_attached = 0; } - + if (sprxp < e->pos) - uae_abort(_T("sprxp < e->pos")); + uae_abort (_T("sprxp < e->pos")); e->max = sprxp + width; e[1].first_pixel = e->first_pixel + ((e->max - e->pos + 3) & ~3); next_sprite_forced = 0; - + collision_mask = clxmask[clxcon >> 12]; word_offs = e->first_pixel + sprxp - e->pos; - + for (i = 0; i < sprite_width; i += 16) { unsigned int da = *data; unsigned int db = *datb; uae_u32 datab = ((sprtaba[da & 0xFF] << 16) | sprtaba[da >> 8] - | (sprtabb[db & 0xFF] << 16) | sprtabb[db >> 8]); - int off = (i << dbl) >> half; + | (sprtabb[db & 0xFF] << 16) | sprtabb[db >> 8]); + int off = (i << dbl) >> half; uae_u16 *buf = spixels + word_offs + off; - if (currprefs.collision_level > 0 && collision_mask) - record_sprite_1(sprxp + off, buf, datab, num, dbl, mask, 1, collision_mask); - else - record_sprite_1(sprxp + off, buf, datab, num, dbl, mask, 0, collision_mask); + if (currprefs.collision_level > 0 && collision_mask) + record_sprite_1 (sprxp + off, buf, datab, num, dbl, mask, 1, collision_mask); + else + record_sprite_1 (sprxp + off, buf, datab, num, dbl, mask, 0, collision_mask); data++; datb++; } - + /* We have 8 bits per pixel in spixstate, two for every sprite pair. The - low order bit records whether the attach bit was set for this pair. */ - if (attachment && !ecsshres()) { - uae_u32 state = 0x01010101 << (num & ~1); - uae_u8 *stb1 = spixstate.bytes + word_offs; + low order bit records whether the attach bit was set for this pair. */ + if (attachment && !ecsshres ()) { + uae_u8 state = 0x03 << (num & ~1); + uae_u8 *stb1 = spixstate.bytes + word_offs; for (i = 0; i < width; i += 8) { stb1[0] |= state; stb1[1] |= state; @@ -3236,87 +2733,81 @@ static void record_sprite(int line, int num, int sprxp, uae_u16 *data, uae_u16 * stb1[6] |= state; stb1[7] |= state; stb1 += 8; - } + } e->has_attached = 1; } } -static void add_sprite(int *countp, int num, int sprxp, int posns[], int nrs[]) +static void add_sprite (int *countp, int num, int sprxp, int posns[], int nrs[]) { - int count = *countp; - int j, bestp; + int count = *countp; + int j, bestp; /* Sort the sprites in order of ascending X position before recording them. */ for (bestp = 0; bestp < count; bestp++) { if (posns[bestp] > sprxp) break; - if (posns[bestp] == sprxp && nrs[bestp] < num) + if (posns[bestp] == sprxp && nrs[bestp] < num) break; } for (j = count; j > bestp; j--) { - posns[j] = posns[j - 1]; + posns[j] = posns[j-1]; nrs[j] = nrs[j - 1]; } posns[j] = sprxp; nrs[j] = num; count++; - *countp = count; + *countp = count; } -static int tospritexdiw(int diw) +static int tospritexdiw (int diw) { - return coord_window_to_hw_x(diw - (DIW_DDF_OFFSET << lores_shift)) << sprite_buffer_res; + return coord_window_to_hw_x (diw - (DIW_DDF_OFFSET << lores_shift)) << sprite_buffer_res; } -static int tospritexddf(int ddf) +static int tospritexddf (int ddf) { - return (ddf * 2 - DIW_DDF_OFFSET) << sprite_buffer_res; -} -static int fromspritexdiw(int ddf) -{ - return coord_hw_to_window_x(ddf >> sprite_buffer_res) + (DIW_DDF_OFFSET << lores_shift); + return (ddf * 2 - DIW_DDF_OFFSET) << sprite_buffer_res; } -static void calcsprite(void) +static void calcsprite (void) { - sprite_maxx = 0x7fff; - sprite_minx = 0; - if (thisline_decision.diwlastword >= 0) - sprite_maxx = tospritexdiw(thisline_decision.diwlastword); - if (thisline_decision.diwfirstword >= 0) - sprite_minx = tospritexdiw(thisline_decision.diwfirstword); - if (thisline_decision.plfleft >= 0) { - int min, max; - min = tospritexddf(thisline_decision.plfleft); - max = tospritexddf(thisline_decision.plfright); + sprite_maxx = 0x7fff; + sprite_minx = 0; + if (thisline_decision.diwlastword >= 0) + sprite_maxx = tospritexdiw (thisline_decision.diwlastword); + if (thisline_decision.diwfirstword >= 0) + sprite_minx = tospritexdiw (thisline_decision.diwfirstword); + if (thisline_decision.plfleft >= 0) { + int min, max; + min = tospritexddf (thisline_decision.plfleft); + max = tospritexddf (thisline_decision.plfright); if (min > sprite_minx && min < max) { /* min < max = full line ddf */ if (currprefs.chipset_mask & CSMASK_ECS_DENISE) { - sprite_minx = min; - } - else { + sprite_minx = min; + } else { if (thisline_decision.plfleft >= 0x28 || bpldmawasactive) sprite_minx = min; } } - /* sprites are visible from first BPL1DAT write to end of line - * ECS Denise/AGA: no limits - * OCS Denise: BPL1DAT write only enables sprite if hpos >= 0x28 or so. - * (undocumented feature) - */ - } + /* sprites are visible from first BPL1DAT write to end of line + * ECS Denise/AGA: no limits + * OCS Denise: BPL1DAT write only enables sprite if hpos >= 0x28 or so. + * (undocumented feature) + */ + } } -static void decide_sprites(int spnr, int hpos, bool usepointx, bool quick) +static void decide_sprites(int spnr, int hpos, bool quick) { int nrs[MAX_SPRITES * 2], posns[MAX_SPRITES * 2]; int count, i; int point; int width = sprite_width; - int sscanmask = 0x100 << sprite_buffer_res; - int gotdata = 0; + int sscanmask = 0x100 << sprite_buffer_res; int startnr = 0, endnr = MAX_SPRITES - 1; if (thisline_decision.plfleft < 0 && !(bplcon3 & 2)) - return; + return; // let sprite shift register empty completely // if sprite is at the very edge of right border @@ -3324,310 +2815,181 @@ static void decide_sprites(int spnr, int hpos, bool usepointx, bool quick) if (hpos >= maxhpos) point += ((9 - 2) * 2) * sprite_buffer_res; - if (nodraw() || hpos < 0x14 || nr_armed == 0 || point == last_sprite_point) + if (nodraw () || hpos < 0x14 || nr_armed == 0 || point == last_sprite_point) return; - + if (spnr >= 0) { startnr = spnr; endnr = spnr; } if (!quick) { - decide_diw(hpos); - decide_line(hpos); - calcsprite(); + decide_diw (hpos); + decide_line (hpos); + calcsprite (); } - + count = 0; for (i = startnr; i <= endnr; i++) { int xpos = spr[i].xpos; int sprxp = (fmode & 0x8000) ? (xpos & ~sscanmask) : xpos; int hw_xp = sprxp >> sprite_buffer_res; - int pointx = usepointx && (sprctl[i] & sprite_sprctlmask) ? 0 : 1; + + if (xpos < 0) + continue; - if (xpos < 0) + if (! spr[i].armed) continue; - if (!((false & magic_sprite_mask) & (1 << i))) - continue; - - if (!spr[i].armed) - continue; - - if (hw_xp > last_sprite_point && hw_xp <= point + pointx) { - add_sprite(&count, i, sprxp, posns, nrs); + if (hw_xp > last_sprite_point && hw_xp <= point) { + add_sprite (&count, i, sprxp, posns, nrs); } - /* SSCAN2-bit is fun.. */ - if ((fmode & 0x8000) && !(sprxp & sscanmask)) { - sprxp |= sscanmask; - hw_xp = sprxp >> sprite_buffer_res; - if (hw_xp > last_sprite_point && hw_xp <= point + pointx) { - add_sprite(&count, MAX_SPRITES + i, sprxp, posns, nrs); - } - } - else if (!(fmode & 0x80) && xpos >= (2 << sprite_buffer_res) && xpos <= (9 << sprite_buffer_res)) { + /* SSCAN2-bit is fun.. */ + if ((fmode & 0x8000) && !(sprxp & sscanmask)) { + sprxp |= sscanmask; + hw_xp = sprxp >> sprite_buffer_res; + if (hw_xp > last_sprite_point && hw_xp <= point) { + add_sprite (&count, MAX_SPRITES + i, sprxp, posns, nrs); + } + } else if (!(fmode & 0x80) && xpos >= (2 << sprite_buffer_res) && xpos <= (9 << sprite_buffer_res)) { // right border wrap around. SPRxCTL horizontal bits do not matter. sprxp += (maxhpos * 2) << sprite_buffer_res; hw_xp = sprxp >> sprite_buffer_res; - if (hw_xp > last_sprite_point && hw_xp <= point + pointx) { + if (hw_xp > last_sprite_point && hw_xp <= point) { add_sprite(&count, MAX_SPRITES + i, sprxp, posns, nrs); } // (not really mutually exclusive of SSCAN2-bit but not worth the trouble) - } + } } for (i = 0; i < count; i++) { - int nr = nrs[i] & (MAX_SPRITES - 1); - record_sprite(next_lineno, nr, posns[i], sprdata[nr], sprdatb[nr], sprctl[nr]); - /* get left and right sprite edge if brdsprt enabled */ -#if AUTOSCALE_SPRITES - if (dmaen(DMA_SPRITE) && (bplcon0 & 1) && (bplcon3 & 0x02) && !(bplcon3 & 0x20) && nr > 0) { - int j, jj; - for (j = 0, jj = 0; j < sprite_width; j += 16, jj++) { - int nx = fromspritexdiw(posns[i] + j); - if (sprdata[nr][jj] || sprdatb[nr][jj]) { - if (diwfirstword_total > nx && nx >= (48 << currprefs.gfx_resolution)) - diwfirstword_total = nx; - if (diwlastword_total < nx + 16 && nx <= (448 << currprefs.gfx_resolution)) - diwlastword_total = nx + 16; - } - } - gotdata = 1; - } -#endif + int nr = nrs[i] & (MAX_SPRITES - 1); + record_sprite (next_lineno, nr, posns[i], sprdata[nr], sprdatb[nr], sprctl[nr]); } last_sprite_point = point; +} -#if AUTOSCALE_SPRITES - /* get upper and lower sprite position if brdsprt enabled */ - if (gotdata) { - if (vpos < first_planes_vpos) - first_planes_vpos = vpos; - if (vpos < plffirstline_total) - plffirstline_total = vpos; - if (vpos > last_planes_vpos) - last_planes_vpos = vpos; - if (vpos > plflastline_total) - plflastline_total = vpos; - } -#endif -} -static void decide_sprites(int spnr, int hpos) +STATIC_INLINE void decide_sprites(int spnr, int hpos) { - decide_sprites(spnr, hpos, false, false); + decide_sprites(spnr, hpos, false); } -static void maybe_decide_sprites(int spnr, int hpos) +STATIC_INLINE void maybe_decide_sprites(int spnr, int hpos) { if (!spr[spnr].armed) return; if (!sprdata[spnr] && !sprdatb[spnr]) return; - decide_sprites(spnr, hpos, true, true); -} - -static int sprites_differ(struct draw_info *dip, struct draw_info *dip_old) -{ - struct sprite_entry *this_first = curr_sprite_entries + dip->first_sprite_entry; - struct sprite_entry *this_last = curr_sprite_entries + dip->last_sprite_entry; - struct sprite_entry *prev_first = prev_sprite_entries + dip_old->first_sprite_entry; - int npixels; - int i; - - if (dip->nr_sprites != dip_old->nr_sprites) - return 1; - - if (dip->nr_sprites == 0) - return 0; - - for (i = 0; i < dip->nr_sprites; i++) { - if (this_first[i].pos != prev_first[i].pos - || this_first[i].max != prev_first[i].max - || this_first[i].has_attached != prev_first[i].has_attached) - return 1; - } - - npixels = this_last->first_pixel + (this_last->max - this_last->pos) - this_first->first_pixel; - if (memcmp(spixels + this_first->first_pixel, spixels + prev_first->first_pixel, - npixels * sizeof(uae_u16)) != 0) - return 1; - if (memcmp(spixstate.bytes + this_first->first_pixel, spixstate.bytes + prev_first->first_pixel, npixels) != 0) - return 1; - return 0; -} - -static int color_changes_differ(struct draw_info *dip, struct draw_info *dip_old) -{ - if (dip->nr_color_changes != dip_old->nr_color_changes) - return 1; - - if (dip->nr_color_changes == 0) - return 0; - if (memcmp(curr_color_changes + dip->first_color_change, - prev_color_changes + dip_old->first_color_change, - dip->nr_color_changes * sizeof *curr_color_changes) != 0) - return 1; - return 0; + decide_sprites(spnr, hpos, true); } /* End of a horizontal scan line. Finish off all decisions that were not -* made yet. */ -static void finish_decisions(void) + * made yet. */ +STATIC_INLINE void finish_decisions (void) { struct draw_info *dip; - struct draw_info *dip_old; struct decision *dp; - int changed; int hpos = maxhpos; - - if (nodraw()) + + if (nodraw ()) return; - - decide_diw(hpos); - decide_line(hpos); - decide_fetch_safe(hpos); - finish_final_fetch(); - - record_color_change2(hsyncstartpos, 0xffff, 0); - if (thisline_decision.plfleft >= 0 && thisline_decision.plflinelen < 0) { - if (fetch_state != fetch_not_started) { - write_log(_T("fetch_state=%d plfleft=%d,len=%d,vpos=%d,hpos=%d\n"), - fetch_state, thisline_decision.plfleft, thisline_decision.plflinelen, - vpos, hpos); - uae_abort(_T("fetch_state != fetch_not_started")); - } - thisline_decision.plfright = thisline_decision.plfleft; - thisline_decision.plflinelen = 0; - thisline_decision.bplres = RES_LORES; - } - + + decide_diw (hpos); + decide_line (hpos); + decide_fetch_safe (hpos); + finish_final_fetch (); + + record_color_change2 (hsyncstartpos, 0xffff, 0); + if (thisline_decision.plfleft >= 0 && thisline_decision.plflinelen < 0) { + thisline_decision.plfright = thisline_decision.plfleft; + thisline_decision.plflinelen = 0; + thisline_decision.bplres = RES_LORES; + } + /* Large DIWSTOP values can cause the stop position never to be - * reached, so the state machine always stays in the same state and - * there's a more-or-less full-screen DIW. */ - if (hdiwstate == DIW_waiting_stop) { + * reached, so the state machine always stays in the same state and + * there's a more-or-less full-screen DIW. */ + if (hdiwstate == DIW_waiting_stop) { thisline_decision.diwlastword = max_diwlastword; if (thisline_decision.diwfirstword < 0) thisline_decision.diwfirstword = min_diwlastword; } - if (thisline_decision.diwfirstword != line_decisions[next_lineno].diwfirstword) - MARK_LINE_CHANGED; - if (thisline_decision.diwlastword != line_decisions[next_lineno].diwlastword) - MARK_LINE_CHANGED; - dip = curr_drawinfo + next_lineno; - dip_old = prev_drawinfo + next_lineno; dp = line_decisions + next_lineno; - changed = thisline_changed | custom_frame_redraw_necessary; - if (thisline_decision.plfleft >= 0 && thisline_decision.nr_planes > 0) - record_diw_line(thisline_decision.plfleft, diwfirstword, diwlastword); decide_sprites(-1, hpos + 1); - + dip->last_sprite_entry = next_sprite_entry; dip->last_color_change = next_color_change; - + if (thisline_decision.ctable < 0) { - if (thisline_decision.plfleft < 0) - remember_ctable_for_border(); - else - remember_ctable(); - } - + remember_ctable(); + } + dip->nr_color_changes = next_color_change - dip->first_color_change; dip->nr_sprites = next_sprite_entry - dip->first_sprite_entry; + + *dp = thisline_decision; - line_decisions[next_lineno] = thisline_decision; - - if (thisline_decision.plfleft != line_decisions[next_lineno].plfleft) - changed = 1; - if (!changed && color_changes_differ(dip, dip_old)) - changed = 1; - if (!changed && /* bitplane visible in this line OR border sprites enabled */ - (thisline_decision.plfleft >= 0 || ((thisline_decision.bplcon0 & 1) && (thisline_decision.bplcon3 & 0x02) && !(thisline_decision.bplcon3 & 0x20))) - && sprites_differ(dip, dip_old)) - { - changed = 1; - } - - if (changed) { - thisline_changed = 1; - *dp = thisline_decision; - } - else { - /* The only one that may differ: */ - dp->ctable = thisline_decision.ctable; - } - - /* leave free space for possible extra color changes at the end of line */ - next_color_change += (HBLANK_OFFSET + 1) / 2; + /* leave free space for possible extra color changes at the end of line */ + next_color_change += (HBLANK_OFFSET + 1) / 2; diw_hcounter += maxhpos * 2; - if (!(currprefs.chipset_mask & CSMASK_ECS_DENISE) && vpos == get_equ_vblank_endline() - 1) + if (!(currprefs.chipset_mask & CSMASK_ECS_DENISE) && vpos == get_equ_vblank_endline () - 1) diw_hcounter++; - if ((currprefs.chipset_mask & CSMASK_ECS_DENISE) || vpos > get_equ_vblank_endline() || (currprefs.cs_dipagnus && vpos == 0)) { + if ((currprefs.chipset_mask & CSMASK_ECS_DENISE) || vpos > get_equ_vblank_endline ()) { diw_hcounter = maxhpos * 2; last_hdiw = 2 - 1; } - - if (next_color_change >= MAX_REG_CHANGE - 30) { - //write_log(_T("color_change buffer overflow!\n")); - next_color_change = 0; - dip->nr_color_changes = 0; - dip->first_color_change = 0; - dip->last_color_change = 0; - } } /* Set the state of all decisions to "undecided" for a new scanline. */ -static void reset_decisions(void) +static void reset_decisions (void) { - if (nodraw()) - return; - + if (nodraw ()) + return; + toscr_nr_planes = toscr_nr_planes2 = 0; - thisline_decision.bplres = bplcon0_res; - thisline_decision.nr_planes = 0; + thisline_decision.bplres = bplcon0_res; + thisline_decision.nr_planes = 0; bpl1dat_written = false; bpl1dat_written_at_least_once = false; - - thisline_decision.plfleft = -1; - thisline_decision.plflinelen = -1; - thisline_decision.ham_seen = !!(bplcon0 & 0x800); - thisline_decision.ehb_seen = !!isehb(bplcon0, bplcon2); - thisline_decision.ham_at_start = !!(bplcon0 & 0x800); - thisline_decision.bordersprite_seen = issprbrd(-1, bplcon0, bplcon3); - - /* decided_res shouldn't be touched before it's initialized by decide_line(). */ - thisline_decision.diwfirstword = -1; - thisline_decision.diwlastword = -1; - if (hdiwstate == DIW_waiting_stop) { - thisline_decision.diwfirstword = min_diwlastword; - if (thisline_decision.diwfirstword != line_decisions[next_lineno].diwfirstword) - MARK_LINE_CHANGED; - } - thisline_decision.ctable = -1; - - thisline_changed = 0; - curr_drawinfo[next_lineno].first_color_change = next_color_change; - curr_drawinfo[next_lineno].first_sprite_entry = next_sprite_entry; - next_sprite_forced = 1; - - last_sprite_point = 0; - fetch_state = fetch_not_started; + + thisline_decision.plfleft = -1; + thisline_decision.plflinelen = -1; + thisline_decision.ham_seen = !! (bplcon0 & 0x800); + thisline_decision.ham_at_start = !! (bplcon0 & 0x800); + thisline_decision.bordersprite_seen = issprbrd (-1, bplcon0, bplcon3); + thisline_decision.xor_seen = (bplcon4 & 0xff00) != 0; + + /* decided_res shouldn't be touched before it's initialized by decide_line(). */ + thisline_decision.diwfirstword = -1; + thisline_decision.diwlastword = -1; + if (hdiwstate == DIW_waiting_stop) { + thisline_decision.diwfirstword = min_diwlastword; + } + thisline_decision.ctable = -1; + + curr_drawinfo[next_lineno].first_color_change = next_color_change; + curr_drawinfo[next_lineno].first_sprite_entry = next_sprite_entry; + next_sprite_forced = 1; + + last_sprite_point = 0; + fetch_state = fetch_not_started; if (bpldmasetuphpos >= 0) { // this can happen in "too fast" modes - BPLCON0_Denise(0, bplcon0, true); - setup_fmodes(0); + BPLCON0_Denise (0, bplcon0, true); + setup_fmodes (0); } bpldmasetuphpos = -1; bpldmasetupphase = 0; bpldmawasactive = false; - reset_moddelays(); + reset_moddelays (); delay_cycles = 0; - compute_toscr_delay(bplcon1); + compute_toscr_delay (bplcon1); if (plf_state >= plf_passed_stop2 || plf_state == plf_wait) - plf_state = plf_idle; + plf_state = plf_idle; // Only ECS Agnus can keep DDF open between lines if ((currprefs.chipset_mask & CSMASK_ECS_AGNUS)) { @@ -3635,7 +2997,7 @@ static void reset_decisions(void) plf_state = plf_active; } } - + bpl_hstart = 256; plfr_state = plfr_idle; plf_start_hpos = 256 + DDF_OFFSET; @@ -3643,155 +3005,81 @@ static void reset_decisions(void) ddfstop_written_hpos = -1; bitplane_maybe_start_hpos = -1; bitplane_off_delay = -1; - hack_delay_shift = 0; if (line_cyclebased) { line_cyclebased--; if (!line_cyclebased) { bpl_dma_off_when_active = 0; - } + } } - memset(outword, 0, sizeof outword); + memset (outword, 0, sizeof outword); // fetched[] must not be cleared (Sony VX-90 / Royal Amiga Force) todisplay_fetched[0] = todisplay_fetched[1] = false; - memset(todisplay, 0, sizeof todisplay); - memset(todisplay2, 0, sizeof todisplay2); -#ifdef AGA + memset (todisplay, 0, sizeof todisplay); + memset (todisplay2, 0, sizeof todisplay2); if (currprefs.chipset_mask & CSMASK_AGA) { - memset(todisplay_aga, 0, sizeof todisplay_aga); - memset(todisplay2_aga, 0, sizeof todisplay2_aga); - } - aga_plf_passed_stop2 = false; -#endif - - if (bitplane_line_crossing) { - // BPL1DAT would have been written after end of last scanline. - // Set BPL1DAT "written at least once" state for new scanline. - bitplane_line_crossing -= maxhpos - HPOS_SHIFT; - if (bitplane_line_crossing > 0) { - bpl1dat_written = true; - bpl1dat_written_at_least_once = true; - reset_bpl_vars(); - beginning_of_plane_block(bitplane_line_crossing, fetchmode); - } - bitplane_line_crossing = 0; - } - else { - reset_bpl_vars(); - } + memset (todisplay_aga, 0, sizeof todisplay_aga); + memset (todisplay2_aga, 0, sizeof todisplay2_aga); + } + aga_plf_passed_stop2 = 0; + + reset_bpl_vars (); last_decide_line_hpos = -(DDF_OFFSET + 1); - last_ddf_pix_hpos = -1; - last_sprite_hpos = -1; - last_fetch_hpos = -1; + last_sprite_hpos = -1; + last_fetch_hpos = -1; - if (sprite_ignoreverticaluntilnextline) { - sprite_ignoreverticaluntilnextline = false; - for (int i = 0; i < MAX_SPRITES; i++) - spr[i].ignoreverticaluntilnextline = false; - } - - /* These are for comparison. */ - thisline_decision.bplcon0 = bplcon0; - thisline_decision.bplcon2 = bplcon2; -#ifdef ECS_DENISE - thisline_decision.bplcon3 = bplcon3; -#endif -#ifdef AGA - thisline_decision.bplcon4 = bplcon4; -#endif - scanlinecount++; + /* These are for comparison. */ + thisline_decision.bplcon0 = bplcon0; + thisline_decision.bplcon2 = bplcon2; + thisline_decision.bplcon3 = bplcon3; + thisline_decision.bplcon4 = bplcon4; } int vsynctimebase_orig; -void compute_vsynctime(void) +void compute_vsynctime (void) { - double svpos = maxvpos_nom; - double shpos = maxhpos_short; - double syncadjust = 1.0; + float svpos = maxvpos_nom; + float shpos = maxhpos; + float syncadjust = 1.0; fake_vblank_hz = 0; - vblank_hz_mult = 0; - vblank_hz_state = 1; - if (fabs(currprefs.chipset_refreshrate) > 0.1) { - syncadjust = currprefs.chipset_refreshrate / vblank_hz_nom; - vblank_hz = currprefs.chipset_refreshrate; - if (isvsync_chipset()) { - int mult = 0; - if (getvsyncrate(vblank_hz, &mult) != vblank_hz) { - vblank_hz = getvsyncrate(vblank_hz, &vblank_hz_mult); - if (vblank_hz_mult > 0) - vblank_hz_state = 0; - } - } - } + if (fabs (currprefs.chipset_refreshrate) > 0.1) { + syncadjust = currprefs.chipset_refreshrate / vblank_hz_nom; + vblank_hz = currprefs.chipset_refreshrate; + } if (!fake_vblank_hz) fake_vblank_hz = vblank_hz; - if (currprefs.turbo_emulation) { - if (currprefs.turbo_emulation_limit > 0) { - vsynctimebase = int(syncbase / currprefs.turbo_emulation_limit); - } - else { - vsynctimebase = 1; - } - } - else { - vsynctimebase = int(syncbase / fake_vblank_hz); - } + vsynctimebase = (int)(syncbase / fake_vblank_hz); vsynctimebase_orig = vsynctimebase; - if (islinetoggle()) { + if (currprefs.ntscmode) { shpos += 0.5; } if (interlace_seen) { svpos += 0.5; - } - else if (lof_current) { + } else if (lof_current) { svpos += 1.0; } - if (currprefs.produce_sound > 1) { - double clk = svpos * shpos * fake_vblank_hz; - //write_log (_T("SNDRATE %.1f*%.1f*%.6f=%.6f\n"), svpos, shpos, fake_vblank_hz, clk); - update_sound(clk); - //devices_update_sound(clk, syncadjust); //TODO - } - //devices_update_sync(svpos, syncadjust); //TODO + if (currprefs.produce_sound > 1) { + float clk = svpos * shpos * fake_vblank_hz; + devices_update_sound(clk, syncadjust); + } + devices_update_sync(svpos, syncadjust); } -void getsyncregisters(uae_u16 *phsstrt, uae_u16 *phsstop, uae_u16 *pvsstrt, uae_u16 *pvsstop) -{ - *phsstrt = hsstrt; - *phsstop = hsstop; - *pvsstrt = vsstrt; - *pvsstop = vsstop; -} - -//static void dumpsync(void) -//{ -// static int cnt = 100; -// if (cnt < 0) -// return; -// cnt--; -// write_log(_T("BEAMCON0=%04X VTOTAL=%04X HTOTAL=%04X\n"), new_beamcon0, vtotal, htotal); -// write_log(_T(" HSSTOP=%04X HBSTRT=%04X HBSTOP=%04X\n"), hsstop, hbstrt, hbstop); -// write_log(_T(" VSSTOP=%04X VBSTRT=%04X VBSTOP=%04X\n"), vsstop, vbstrt, vbstop); -// write_log(_T(" HSSTRT=%04X VSSTRT=%04X HCENTER=%04X\n"), hsstrt, vsstrt, hcenter); -// write_log(_T(" HSYNCSTART=%04X HSYNCEND=%04X\n"), hsyncstartpos, hsyncendpos); -//} - -int current_maxvpos(void) +int current_maxvpos (void) { return maxvpos + (lof_store ? 1 : 0); } -struct chipset_refresh *get_chipset_refresh(void) +struct chipset_refresh *get_chipset_refresh (void) { int islace = interlace_seen ? 1 : 0; int isntsc = (beamcon0 & 0x20) ? 0 : 1; - int custom = (beamcon0 & 0x80) ? 1 : 0; if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) isntsc = currprefs.ntscmode ? 1 : 0; @@ -3801,205 +3089,152 @@ struct chipset_refresh *get_chipset_refresh(void) struct chipset_refresh *cr = &currprefs.cr[i]; if (cr->defaultdata) def = i; - if (cr->inuse) { - if ((cr->horiz < 0 || cr->horiz == maxhpos) && - (cr->vert < 0 || cr->vert == maxvpos_display) && - (cr->ntsc < 0 || (cr->ntsc == 1 && isntsc && !custom) || (cr->ntsc == 0 && !isntsc && !custom) || (cr->ntsc == 2 && custom)) && - (cr->lace < 0 || (cr->lace > 0 && islace) || (cr->lace == 0 && !islace)) && - (cr->resolution == 0 || cr->resolution == 7 || (cr->resolution & (1 << detected_screen_resolution))) && - (cr->framelength < 0 || (cr->framelength > 0 && lof_store) || (cr->framelength == 0 && !lof_store) || (cr->framelength >= 0 && islace)) && - ((cr->rtg && picasso_on) || (!cr->rtg && !picasso_on)) && - (cr->vsync < 0 || (cr->vsync > 0 && isvsync_chipset()) || (cr->vsync == 0 && !isvsync_chipset()))) + if ((cr->horiz < 0 || cr->horiz == maxhpos) && + (cr->vert < 0 || cr->vert == maxvpos_display) && + (cr->ntsc < 0 || (cr->ntsc > 0 && isntsc) || (cr->ntsc == 0 && !isntsc)) && + (cr->lace < 0 || (cr->lace > 0 && islace) || (cr->lace == 0 && !islace)) && + (cr->resolution == 0 || cr->resolution == 7) && + ((cr->rtg && picasso_on) || (!cr->rtg && !picasso_on)) && + (cr->vsync < 0 || (cr->vsync > 0 && isvsync_chipset ()) || (cr->vsync == 0 && !isvsync_chipset ()))) return cr; - } } if (def >= 0) return &currprefs.cr[def]; - return nullptr; + return NULL; } -static bool changed_chipset_refresh(void) +static bool changed_chipset_refresh (void) { - return stored_chipset_refresh != get_chipset_refresh(); + return stored_chipset_refresh != get_chipset_refresh (); } -void compute_framesync(void) +static void compute_framesync (void) { int islace = interlace_seen ? 1 : 0; - int isntsc = (beamcon0 & 0x20) ? 0 : 1; bool found = false; if (islace) { vblank_hz = vblank_hz_lace; - } - else if (lof_current) { + } else if (lof_current) { vblank_hz = vblank_hz_lof; - } - else { + } else { vblank_hz = vblank_hz_shf; } - //vblank_hz = target_adjust_vblank_hz(vblank_hz); - - struct chipset_refresh *cr = get_chipset_refresh(); + struct chipset_refresh *cr = get_chipset_refresh (); while (cr) { - double v = -1; - if (!picasso_on && !picasso_requested_on) { - if (isvsync_chipset()) { + float v = -1; + if (!picasso_on && !picasso_requested_on) { + if (isvsync_chipset ()) { if (cr->index == CHIPSET_REFRESH_PAL || cr->index == CHIPSET_REFRESH_NTSC) { - if ((fabs(vblank_hz - 50) < 1 || fabs(vblank_hz - 60) < 1 || fabs(vblank_hz - 100) < 1 || fabs(vblank_hz - 120) < 1) && currprefs.gfx_apmode[0].gfx_vsync == 2 && currprefs.gfx_apmode[0].gfx_fullscreen > 0) { - vsync_switchmode(int(vblank_hz)); - } - } - - else if (isvsync_chipset() > 0) { + if ((fabs (vblank_hz - 50) < 1 || fabs (vblank_hz - 60) < 1 || fabs (vblank_hz - 100) < 1 || fabs (vblank_hz - 120) < 1) && currprefs.gfx_apmode[0].gfx_vsync == 2) { + vsync_switchmode ((int)vblank_hz); + } + } else if (isvsync_chipset () > 0) { if (currprefs.gfx_apmode[0].gfx_refreshrate) - v = abs(currprefs.gfx_apmode[0].gfx_refreshrate); + v = abs (currprefs.gfx_apmode[0].gfx_refreshrate); } - } - else { + } else { if (cr->locked == false) { changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = vblank_hz; - cfgfile_parse_lines(&changed_prefs, cr->commands, -1); - if (cr->commands[0]) - write_log(_T("CMD1: '%s'\n"), cr->commands); break; - } - else { + } else { v = cr->rate; } - } + } if (v < 0) v = cr->rate; if (v > 0) { changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = v; - cfgfile_parse_lines(&changed_prefs, cr->commands, -1); - if (cr->commands[0]) - write_log(_T("CMD2: '%s'\n"), cr->commands); } - } - else { + } else { if (cr->locked == false) v = vblank_hz; else v = cr->rate; changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = v; - cfgfile_parse_lines(&changed_prefs, cr->commands, -1); - if (cr->commands[0]) - write_log(_T("CMD3: '%s'\n"), cr->commands); - } + vsync_switchmode((int)v); + } found = true; break; - } + } if (!found) { - changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = vblank_hz; + vsync_switchmode((int)vblank_hz); + changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = vblank_hz; } stored_chipset_refresh = cr; interlace_changed = 0; lof_togglecnt_lace = 0; lof_togglecnt_nlace = 0; - lof_changing = 0; + lof_changing = 0; - if (beamcon0 & 0x80) { - int res = GET_RES_AGNUS(bplcon0); - int vres = islace ? 1 : 0; - int res2, vres2; + if (beamcon0 & 0x80) { + gui_message(_T("Variable beam counter comparator enabled. Not supported in Amiberry.")); + } - res2 = currprefs.gfx_resolution; - if (doublescan > 0) - res2++; - if (res2 > RES_MAX) - res2 = RES_MAX; - - vres2 = currprefs.gfx_vresolution; - if (doublescan > 0 && !islace) - vres2--; - - if (vres2 < 0) - vres2 = 0; - if (vres2 > VRES_QUAD) - vres2 = VRES_QUAD; - - int start = hsyncstartpos; //hbstrt; - int stop = hsyncendpos; //hbstop; - - gfxvidinfo.outwidth = ((maxhpos - (maxhpos - start + DISPLAY_LEFT_SHIFT / 2) + 1) * 2) << res2; - gfxvidinfo.outheight = ((firstblankedline < maxvpos ? firstblankedline : maxvpos) - minfirstline + 1) << vres2; - - } - else { - gfxvidinfo.outwidth = AMIGA_WIDTH_MAX << currprefs.gfx_resolution; - gfxvidinfo.outheight = (maxvpos_display - minfirstline + 1) << currprefs.gfx_vresolution; - } - - memset(line_decisions, 0, sizeof line_decisions); - memset(line_drawinfo, 0, sizeof line_drawinfo); - for (int i = 0; i < sizeof(line_decisions) / sizeof *line_decisions; i++) { + memset (line_decisions, 0, sizeof line_decisions); + memset (curr_drawinfo, 0, sizeof curr_drawinfo); + for (int i = 0; i < sizeof (line_decisions) / sizeof *line_decisions; i++) { line_decisions[i].plfleft = -2; } - compute_vsynctime(); + compute_vsynctime (); - hblank_hz = double(currprefs.ntscmode ? CHIPSET_CLOCK_NTSC : CHIPSET_CLOCK_PAL) / (maxhpos + (islinetoggle() ? 0.5 : 0)); + hblank_hz = (float)(currprefs.ntscmode ? CHIPSET_CLOCK_NTSC : CHIPSET_CLOCK_PAL) / (maxhpos + (currprefs.ntscmode ? 0.5 : 0)); - set_config_changed(); + set_config_changed (); - if (target_graphics_buffer_update()) { - reset_drawing(); + if (target_graphics_buffer_update ()) { + reset_drawing (); } } /* set PAL/NTSC or custom timing variables */ -static void init_hz(bool checkvposw) +static void init_hz (bool checkvposw) { int isntsc, islace; - int odbl = doublescan, omaxvpos = maxvpos; - double ovblank = vblank_hz; - int hzc = 0; + int omaxvpos = maxvpos; + int hzc = 0; if (!checkvposw) vpos_count = 0; vpos_count_diff = vpos_count; - doublescan = 0; - programmedmode = false; - if ((beamcon0 & 0xA0) != (new_beamcon0 & 0xA0)) - hzc = 1; - if (beamcon0 != new_beamcon0) { - //write_log(_T("BEAMCON0 %04x -> %04x PC=%08x\n"), beamcon0, new_beamcon0, M68K_GETPC); + if ((beamcon0 & 0xA0) != (new_beamcon0 & 0xA0)) + hzc = 1; + if (beamcon0 != new_beamcon0) { vpos_count_diff = vpos_count = 0; - } + } beamcon0 = new_beamcon0; isntsc = (beamcon0 & 0x20) ? 0 : 1; islace = (interlace_seen) ? 1 : 0; - if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) - isntsc = currprefs.ntscmode ? 1 : 0; + if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) + isntsc = currprefs.ntscmode ? 1 : 0; int clk = currprefs.ntscmode ? CHIPSET_CLOCK_NTSC : CHIPSET_CLOCK_PAL; - if (!isntsc) { - maxvpos = MAXVPOS_PAL; - maxhpos = MAXHPOS_PAL; - minfirstline = VBLANK_ENDLINE_PAL; + if (!isntsc) { + maxvpos = MAXVPOS_PAL; + maxhpos = MAXHPOS_PAL; + minfirstline = VBLANK_ENDLINE_PAL; vblank_hz_nom = vblank_hz = VBLANK_HZ_PAL; - sprite_vblank_endline = VBLANK_SPRITE_PAL; + sprite_vblank_endline = VBLANK_SPRITE_PAL; equ_vblank_endline = EQU_ENDLINE_PAL; equ_vblank_toggle = true; - vblank_hz_shf = double(clk) / ((maxvpos + 0) * maxhpos); - vblank_hz_lof = double(clk) / ((maxvpos + 1) * maxhpos); - vblank_hz_lace = double(clk) / ((maxvpos + 0.5) * maxhpos); - } - else { - maxvpos = MAXVPOS_NTSC; - maxhpos = MAXHPOS_NTSC; - minfirstline = VBLANK_ENDLINE_NTSC; + vblank_hz_shf = (float)((float)clk / ((maxvpos + 0) * maxhpos)); + vblank_hz_lof = (float)((float)clk / ((maxvpos + 1) * maxhpos)); + vblank_hz_lace = (float)((float)clk / ((maxvpos + 0.5) * maxhpos)); + } else { + maxvpos = MAXVPOS_NTSC; + maxhpos = MAXHPOS_NTSC; + minfirstline = VBLANK_ENDLINE_NTSC; vblank_hz_nom = vblank_hz = VBLANK_HZ_NTSC; - sprite_vblank_endline = VBLANK_SPRITE_NTSC; + sprite_vblank_endline = VBLANK_SPRITE_NTSC; equ_vblank_endline = EQU_ENDLINE_NTSC; equ_vblank_toggle = false; - vblank_hz_shf = double(clk) / ((maxvpos + 0) * (maxhpos + 0.5)); - vblank_hz_lof = double(clk) / ((maxvpos + 1) * (maxhpos + 0.5)); - vblank_hz_lace = double(clk) / ((maxvpos + 0.5) * (maxhpos + 0.5)); - } + vblank_hz_shf = (float)((float)clk / ((maxvpos + 0) * (maxhpos + 0.5))); + vblank_hz_lof = (float)((float)clk / ((maxvpos + 1) * (maxhpos + 0.5))); + vblank_hz_lace = (float)((float)clk / ((maxvpos + 0.5) * (maxhpos + 0.5))); + } maxvpos_nom = maxvpos; maxvpos_display = maxvpos; @@ -4013,194 +3248,84 @@ static void init_hz(bool checkvposw) maxvpos_nom = vpos_count - (lof_current ? 1 : 0); if ((maxvpos_nom >= 256 && maxvpos_nom <= 313) || (beamcon0 & 0x80)) { maxvpos_display = maxvpos_nom; - } - else if (maxvpos_nom < 256) { + } else if (maxvpos_nom < 256) { maxvpos_display = 255; - } - else { + } else { maxvpos_display = 313; } - reset_drawing(); - } - else if (vpos_count == 0) { + reset_drawing (); + } else if (vpos_count == 0) { // mode reset vpos_count = maxvpos; vpos_count_diff = maxvpos; } - firstblankedline = maxvpos + 1; - if (beamcon0 & 0x80) { + if (beamcon0 & 0x80) { // programmable scanrates (ECS Agnus) - if (vtotal >= MAXVPOS) - vtotal = MAXVPOS - 1; - maxvpos = vtotal + 1; - firstblankedline = maxvpos + 1; - if (htotal >= MAXHPOS) - htotal = MAXHPOS - 1; - maxhpos = htotal + 1; - vblank_hz_nom = vblank_hz = 227.0 * 312.0 * 50.0 / (maxvpos * maxhpos); - vblank_hz_shf = vblank_hz; - vblank_hz_lof = 227.0 * 313.0 * 50.0 / (maxvpos * maxhpos);; - vblank_hz_lace = 227.0 * 312.5 * 50.0 / (maxvpos * maxhpos);; - - if ((beamcon0 & 0x1000) && (beamcon0 & 0x0200)) { // VARVBEN + VARVSYEN - minfirstline = vsstop > vbstop ? vsstop : vbstop; - if (minfirstline > maxvpos / 2) - minfirstline = vsstop > vbstop ? vbstop : vsstop; - firstblankedline = vbstrt; - } - else if (beamcon0 & 0x0200) { - minfirstline = vsstop; - if (minfirstline > maxvpos / 2) - minfirstline = 0; - } - else if (beamcon0 & 0x1000) { - minfirstline = vbstop; - if (minfirstline > maxvpos / 2) - minfirstline = 0; - firstblankedline = vbstrt; - } - - if (minfirstline < 2) - minfirstline = 2; - if (minfirstline >= maxvpos) - minfirstline = maxvpos - 1; - - if (firstblankedline < minfirstline) - firstblankedline = maxvpos + 1; - - sprite_vblank_endline = minfirstline - 2; - maxvpos_nom = maxvpos; - maxvpos_display = maxvpos; - equ_vblank_endline = -1; - doublescan = htotal <= 164 && vtotal >= 350 ? 1 : 0; - // if superhires and wide enough: not doublescan - if (doublescan && htotal >= 140 && (bplcon0 & 0x0040)) - doublescan = 0; - programmedmode = true; - varsync_changed = true; - vpos_count = maxvpos_nom; - vpos_count_diff = maxvpos_nom; - hzc = 1; - } +#ifdef WITH_INGAME_WARNING + InGameMessage("Programmable scanrates (ECS Agnus) not supported."); +#endif + } if (maxvpos_nom >= MAXVPOS) maxvpos_nom = MAXVPOS; if (maxvpos_display >= MAXVPOS) maxvpos_display = MAXVPOS; - if (currprefs.gfx_scandoubler && doublescan == 0) - doublescan = -1; - if (doublescan != odbl || maxvpos != omaxvpos) + if (maxvpos != omaxvpos) hzc = 1; - /* limit to sane values */ - if (vblank_hz < 10) - vblank_hz = 10; - if (vblank_hz > 300) - vblank_hz = 300; - maxhpos_short = maxhpos; - set_delay_lastcycle(); - if ((beamcon0 & 0x80) && (beamcon0 & 0x0100)) { + /* limit to sane values */ + if (vblank_hz < 10) + vblank_hz = 10; + if (vblank_hz > 300) + vblank_hz = 300; + set_delay_lastcycle (); - hsyncstartpos = hsstrt; - hsyncendpos = hsstop; - - if ((bplcon0 & 1) && (bplcon3 & 1)) { - - if (hbstrt > maxhpos / 2) { - if (hsyncstartpos < hbstrt) - hsyncstartpos = hbstrt; - } - else { - if (hsyncstartpos > hbstrt) - hsyncstartpos = hbstrt; - } - - if (hbstop > maxhpos / 2) { - if (hsyncendpos > hbstop) - hsyncendpos = hbstop; - } - else { - if (hsyncendpos < hbstop) - hsyncendpos = hbstop; - } - } - - if (hsyncstartpos < hsyncendpos) - hsyncstartpos = maxhpos + hsyncstartpos; - - hsyncendpos--; - - if (hsyncendpos < 2) - hsyncendpos = 2; - - if (hsyncstartpos - hsyncendpos < maxhpos / 2) - hsyncstartpos = maxhpos; - - } - else { - - hsyncstartpos = maxhpos_short + 13; + hsyncstartpos = maxhpos + 13; hsyncendpos = 24; - } - hpos_offset = 0; - eventtab[ev_hsync].oldcycles = get_cycles(); - eventtab[ev_hsync].evtime = get_cycles() + HSYNCTIME; - events_schedule(); - if (hzc) { + eventtab[ev_hsync].oldcycles = get_cycles (); + eventtab[ev_hsync].evtime = get_cycles() + HSYNCTIME; + events_schedule (); + if (hzc) { interlace_seen = islace; - reset_drawing(); - } + reset_drawing (); + } maxvpos_total = (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? (MAXVPOS_LINES_ECS - 1) : (MAXVPOS_LINES_OCS - 1); if (maxvpos_total > MAXVPOS) maxvpos_total = MAXVPOS; -#ifdef PICASSO96 - if (!p96refresh_active) { - maxvpos_stored = maxvpos; - maxhpos_stored = maxhpos; - vblank_hz_stored = vblank_hz; - } -#endif - compute_framesync(); - //devices_syncchange(); + compute_framesync (); #ifdef PICASSO96 - init_hz_p96(); + init_hz_p96 (); #endif - if (vblank_hz != ovblank) - updatedisplayarea(); - inputdevice_tablet_strobe(); + inputdevice_tablet_strobe (); - if (varsync_changed) { - varsync_changed = false; - //dumpsync(); - } + varsync_changed = false; } -static void init_hz_vposw(void) +static void init_hz_vposw (void) { - init_hz(true); + init_hz (true); } -void init_hz_normal(void) +void init_hz_normal (void) { - init_hz(false); + init_hz (false); } -static void calcdiw(void) +static void calcdiw (void) { int hstrt = diwstrt & 0xFF; int hstop = diwstop & 0xFF; int vstrt = diwstrt >> 8; int vstop = diwstop >> 8; - + // vertical in ECS Agnus if (diwhigh_written && (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) { vstrt |= (diwhigh & 7) << 8; vstop |= ((diwhigh >> 8) & 7) << 8; - } - else { + } else { if ((vstop & 0x80) == 0) vstop |= 0x100; } @@ -4208,24 +3333,23 @@ static void calcdiw(void) if (diwhigh_written && (currprefs.chipset_mask & CSMASK_ECS_DENISE)) { hstrt |= ((diwhigh >> 5) & 1) << 8; hstop |= ((diwhigh >> 13) & 1) << 8; - } - else { + } else { hstop += 0x100; } diw_hstrt = hstrt; diw_hstop = hstop; - - diwfirstword = coord_diw_to_window_x(hstrt); - diwlastword = coord_diw_to_window_x(hstop); - - if (diwfirstword >= diwlastword) { + + diwfirstword = coord_diw_to_window_x (hstrt); + diwlastword = coord_diw_to_window_x (hstop); + + if (diwfirstword >= diwlastword) { diwfirstword = min_diwlastword; - diwlastword = max_diwlastword; - } + diwlastword = max_diwlastword; + } if (diwfirstword < min_diwlastword) diwfirstword = min_diwlastword; - + if (vstrt == vpos && vstop != vpos && diwstate == DIW_waiting_start) { // This may start BPL DMA immediately. SET_LINE_CYCLEBASED; @@ -4234,190 +3358,126 @@ static void calcdiw(void) plffirstline = vstrt; plflastline = vstop; - + plfstrt = ddfstrt - DDF_OFFSET; plfstop = ddfstop - DDF_OFFSET; - - diw_change = 2; } /* display mode changed (lores, doubling etc..), recalculate everything */ -void init_custom(void) +void init_custom (void) { - update_mirrors(); - create_cycle_diagram_table(); - reset_drawing(); + update_mirrors(); + create_cycle_diagram_table (); + reset_drawing (); init_hz_normal(); - calcdiw(); + calcdiw (); } static int timehack_alive = 0; -static uae_u32 REGPARAM2 timehack_helper(TrapContext *context) +static uae_u32 REGPARAM2 timehack_helper (TrapContext *context) { #ifdef HAVE_GETTIMEOFDAY - struct timeval tv; - if (m68k_dreg(regs, 0) == 0) - return timehack_alive; + struct timeval tv; + if (m68k_dreg (regs, 0) == 0) + return timehack_alive; - timehack_alive = 10; + timehack_alive = 10; - gettimeofday(&tv, nullptr); - put_long(m68k_areg(regs, 0), tv.tv_sec - (((365 * 8 + 2) * 24) * 60 * 60)); - put_long(m68k_areg(regs, 0) + 4, tv.tv_usec); - return 0; + gettimeofday (&tv, NULL); + put_long (m68k_areg (regs, 0), tv.tv_sec - (((365 * 8 + 2) * 24) * 60 * 60)); + put_long (m68k_areg (regs, 0) + 4, tv.tv_usec); + return 0; #else - return 2; + return 2; #endif } -/* -* register functions -*/ -static uae_u16 DENISEID(int *missing) + /* + * register functions + */ +STATIC_INLINE uae_u16 DENISEID (int *missing) { *missing = 0; - if (currprefs.cs_deniserev >= 0) - return currprefs.cs_deniserev; -#ifdef AGA - if (currprefs.chipset_mask & CSMASK_AGA) { + if (aga_mode) { if (currprefs.cs_ide == IDE_A4000) return 0xFCF8; return 0x00F8; - } -#endif + } if (currprefs.chipset_mask & CSMASK_ECS_DENISE) return 0xFFFC; - if (currprefs.cpu_model == 68000 && (currprefs.cpu_compatible || currprefs.cpu_memory_cycle_exact)) + if (currprefs.cpu_model == 68000 && currprefs.cpu_compatible) *missing = 1; return 0xFFFF; } - -STATIC_INLINE uae_u16 DMACONR(int hpos) +STATIC_INLINE uae_u16 DMACONR (int hpos) { - decide_line(hpos); - decide_fetch_safe(hpos); dmacon &= ~(0x4000 | 0x2000); - dmacon |= ((blit_interrupt || (!blit_interrupt && currprefs.cs_agnusbltbusybug && !blt_info.got_cycle)) ? 0 : 0x4000) - | (blt_info.blitzero ? 0x2000 : 0); - return dmacon; + dmacon |= ((blit_interrupt) ? 0 : 0x4000) + | (blt_info.blitzero ? 0x2000 : 0); + return dmacon; } -STATIC_INLINE uae_u16 INTENAR(void) +STATIC_INLINE uae_u16 INTENAR (void) { - return intena; + return intena; } -uae_u16 INTREQR(void) +STATIC_INLINE uae_u16 ADKCONR (void) { - return intreq; -} -STATIC_INLINE uae_u16 ADKCONR(void) -{ - return adkcon; + return adkcon; } -STATIC_INLINE int islightpentriggered(void) +STATIC_INLINE int issyncstopped (void) { - if (beamcon0 & 0x2000) // LPENDIS - return 0; - return lightpen_triggered > 0; -} -STATIC_INLINE int issyncstopped(void) -{ - return (bplcon0 & 2) && !currprefs.genlock; + return (bplcon0 & 2); } -STATIC_INLINE int GETVPOS(void) +STATIC_INLINE int GETVPOS (void) { - return islightpentriggered() ? vpos_lpen : (issyncstopped() ? vpos_previous : vpos); + return issyncstopped () ? vpos_previous : vpos; } -STATIC_INLINE int GETHPOS(void) +STATIC_INLINE int GETHPOS (void) { - return islightpentriggered() ? hpos_lpen : (issyncstopped() ? hpos_previous : current_hpos()); + return issyncstopped () ? hpos_previous : current_hpos (); } -// fake changing hpos when rom genlock test runs and genlock is connected -static bool hsyncdelay(void) -{ - if (!currprefs.genlock) - return false; - //if (currprefs.cpu_memory_cycle_exact || currprefs.m68k_speed >= 0) - if (currprefs.m68k_speed >= 0) - return false; - if (bplcon0 == (0x0100 | 0x0002)) { - return true; - } - return false; -} - -#define CPU_ACCURATE (currprefs.cpu_model < 68020 || (currprefs.cpu_model == 68020 && currprefs.cpu_memory_cycle_exact)) +#define CPU_ACCURATE (currprefs.cpu_model < 68020) // DFF006 = 0.W must be valid result but better do this only in 68000 modes (whdload black screen!) // HPOS is shifted by 3 cycles and VPOS increases when shifted HPOS==1 #define HPOS_OFFSET (CPU_ACCURATE ? HPOS_SHIFT : 0) #define VPOS_INC_DELAY (HPOS_OFFSET ? 1 : 0) -static uae_u16 VPOSR(void) +STATIC_INLINE uae_u16 VPOSR (void) { - unsigned int csbit = 0; - uae_u16 vp = GETVPOS(); - uae_u16 hp = GETHPOS(); - int lof = lof_store; + unsigned int csbit = 0; + uae_u16 vp = GETVPOS (); + uae_u16 hp = GETHPOS (); - if (vp + 1 == maxvpos + lof_store && (hp == maxhpos - 1 || hp == maxhpos - 2)) { - // lof toggles 2 cycles before maxhpos, so do fake toggle here. - if ((bplcon0 & 4) && CPU_ACCURATE) - lof = lof ? 0 : 1; - } if (hp + HPOS_OFFSET >= maxhpos + VPOS_INC_DELAY) { vp++; if (vp >= maxvpos + lof_store) vp = 0; } - vp = (vp >> 8) & 7; + vp = (vp >> 8) & 7; - if (currprefs.cs_agnusrev >= 0) { - csbit |= currprefs.cs_agnusrev << 8; - } - else { -#ifdef AGA - csbit |= (currprefs.chipset_mask & CSMASK_AGA) ? 0x2300 : 0; -#endif - csbit |= (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? 0x2000 : 0; - if (currprefs.ntscmode) - csbit |= 0x1000; - } + csbit |= (aga_mode) ? 0x2300 : 0; + csbit |= (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? 0x2000 : 0; + if (currprefs.ntscmode) + csbit |= 0x1000; - if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) - vp &= 1; - vp |= (lof ? 0x8000 : 0) | csbit; - if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) - vp |= lol ? 0x80 : 0; - hsyncdelay(); - - return vp; + if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) + vp &= 1; + vp |= (lof_store ? 0x8000 : 0) | csbit; + return vp; } -static void vposback(int oldvpos) -{ - if (cop_state.state == COP_wait && oldvpos == cop_state.vcmp) { - copper_enabled_thisline = 0; - unset_special(SPCFLAG_COPPER); - } -} - -static void VPOSW(uae_u16 v) +static void VPOSW (uae_u16 v) { int oldvpos = vpos; - if (lof_store != ((v & 0x8000) ? 1 : 0)) { - lof_store = (v & 0x8000) ? 1 : 0; + lof_store = (v & 0x8000) ? 1 : 0; lof_changing = lof_store ? 1 : -1; - } - if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { - lol = (v & 0x0080) ? 1 : 0; - if (!islinetoggle()) - lol = 0; - } + } if (lof_changing) return; vpos &= 0x00ff; @@ -4431,22 +3491,11 @@ static void VPOSW(uae_u16 v) vpos = oldvpos; } -static void VHPOSW(uae_u16 v) +static void VHPOSW (uae_u16 v) { int oldvpos = vpos; bool changed = false; - if (currprefs.cpu_memory_cycle_exact && currprefs.cpu_model == 68000) { - /* Special hack for Smooth Copper in CoolFridge / Upfront demo */ - int chp = current_hpos_safe(); - int hp = v & 0xff; - if (chp >= 0x21 && chp <= 0x29 && hp == 0x2d) { - hack_delay_shift = 4; - record_color_change(chp, 0, COLOR_CHANGE_HSYNC_HACK | 6); - thisline_changed = true; - } - } - v >>= 8; vpos &= 0xff00; vpos |= v; @@ -4454,335 +3503,268 @@ static void VHPOSW(uae_u16 v) vposw_change++; if (vpos < oldvpos) { vpos = oldvpos; - } - else if (vpos < minfirstline && oldvpos < minfirstline) { + } else if (vpos < minfirstline && oldvpos < minfirstline) { vpos = oldvpos; } } -static uae_u16 VHPOSR(void) +STATIC_INLINE uae_u16 VHPOSR (void) { - static uae_u16 oldhp; - uae_u16 vp = GETVPOS(); - uae_u16 hp = GETHPOS(); + uae_u16 vp = GETVPOS (); + uae_u16 hp = GETHPOS (); hp += HPOS_OFFSET; - if (hp >= maxhpos) { - hp -= maxhpos; + if (hp >= maxhpos) { + hp -= maxhpos; // vpos increases when hp==1, not when hp==0 if (hp >= VPOS_INC_DELAY) { - vp++; - if (vp >= maxvpos + lof_store) - vp = 0; - } + vp++; + if (vp >= maxvpos + lof_store) + vp = 0; + } } if (HPOS_OFFSET) { - hp += 1; - if (hp >= maxhpos) - hp -= maxhpos; + hp += 1; + if (hp >= maxhpos) + hp -= maxhpos; } - vp <<= 8; - - if (hsyncdelay()) { - // fake continuously changing hpos in fastest possible modes - hp = oldhp % maxhpos; - oldhp++; - } - - vp |= hp; - return vp; + vp <<= 8; + vp |= hp; + return vp; } -static void REFPTR(uae_u16 v) +static int test_copper_dangerous (unsigned int address) { - /* - ECS Agnus: - - b15 8000: R 040 - b14 4000: R 020 - b13 2000: R 010 - b12 1000: R 008 - b11 0800: R 004 - b10 0400: R 002 - b09 0200: R 001 - b08 0100: C 080 - b07 0080: C 040 - b06 0040: C 020 - b05 0020: C 010 - b04 0010: C 008 - b03 0008: C 004 - b02 0004: C 002 C 100 - b01 0002: C 001 R 100 - b00 0001: R 080 - - */ - - refptr = v; - refptr_val = (v & 0xfe00) | ((v & 0x01fe) >> 1); - if (v & 1) { - refptr_val |= 0x80 << 9; - } - if (v & 2) { - refptr_val |= 1; - refptr_val |= 0x100 << 9; - } - if (v & 4) { - refptr_val |= 2; - refptr_val |= 0x100; - } + int addr = address & 0x01fe; + if (addr < ((copcon & 2) ? ((currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? 0 : 0x40) : 0x80)) { + cop_state.state = COP_stop; + copper_enabled_thisline = 0; + unset_special (SPCFLAG_COPPER); + return 1; + } + return 0; } -static int test_copper_dangerous(unsigned int address) +static void immediate_copper (int num) { - int addr = address & 0x01fe; - if (addr < ((copcon & 2) ? ((currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? 0 : 0x40) : 0x80)) { - cop_state.state = COP_stop; - copper_enabled_thisline = 0; - unset_special(SPCFLAG_COPPER); - return 1; - } - return 0; + int pos = 0; + int oldpos = 0; + + cop_state.state = COP_stop; + cop_state.hpos = current_hpos () & ~1; + cop_state.ip = num == 1 ? cop1lc : cop2lc; + + while (pos < (maxvpos << 5)) { + if (oldpos > pos) + pos = oldpos; + if (!dmaen(DMA_COPPER)) + break; + if (cop_state.ip >= currprefs.chipmem_size) + break; + pos++; + oldpos = pos; + cop_state.i1 = chipmem_wget_indirect (cop_state.ip); + cop_state.i2 = chipmem_wget_indirect (cop_state.ip + 2); + cop_state.ip += 4; + if (!(cop_state.i1 & 1)) { // move + cop_state.i1 &= 0x1fe; + if (cop_state.i1 == 0x88) { + cop_state.ip = cop1lc; + continue; + } + if (cop_state.i1 == 0x8a) { + cop_state.ip = cop2lc; + continue; + } + if (test_copper_dangerous (cop_state.i1)) + break; + custom_wput_1 (0, cop_state.i1, cop_state.i2, 0); + } else { // wait or skip + if ((cop_state.i1 >> 8) > ((pos >> 5) & 0xff)) + pos = (((pos >> 5) & 0x100) | ((cop_state.i1 >> 8)) << 5) | ((cop_state.i1 & 0xff) >> 3); + if (cop_state.i1 >= 0xffdf && cop_state.i2 == 0xfffe) + break; + } + } + cop_state.state = COP_stop; + unset_special (SPCFLAG_COPPER); } -static void immediate_copper(int num) -{ - int pos = 0; - int oldpos = 0; - - cop_state.state = COP_stop; - cop_state.vpos = vpos; - cop_state.hpos = current_hpos() & ~1; - cop_state.ip = num == 1 ? cop1lc : cop2lc; - - while (pos < (maxvpos << 5)) { - if (oldpos > pos) - pos = oldpos; - if (!dmaen(DMA_COPPER)) - break; - if (cop_state.ip >= currprefs.chipmem_size && cop_state.ip < currprefs.z3chipmem_start && cop_state.ip >= currprefs.z3chipmem_start + currprefs.z3chipmem_size) - break; - pos++; - oldpos = pos; - cop_state.i1 = chipmem_wget_indirect(cop_state.ip); - cop_state.i2 = chipmem_wget_indirect(cop_state.ip + 2); - cop_state.ip += 4; - if (!(cop_state.i1 & 1)) { // move - cop_state.i1 &= 0x1fe; - if (cop_state.i1 == 0x88) { - cop_state.ip = cop1lc; - continue; - } - if (cop_state.i1 == 0x8a) { - cop_state.ip = cop2lc; - continue; - } - if (test_copper_dangerous(cop_state.i1)) - break; - custom_wput_1(0, cop_state.i1, cop_state.i2, 0); - } - else { // wait or skip - if ((cop_state.i1 >> 8) > ((pos >> 5) & 0xff)) - pos = (((pos >> 5) & 0x100) | ((cop_state.i1 >> 8)) << 5) | ((cop_state.i1 & 0xff) >> 3); - if (cop_state.i1 >= 0xffdf && cop_state.i2 == 0xfffe) - break; - } - } - cop_state.state = COP_stop; - unset_special(SPCFLAG_COPPER); -} - -STATIC_INLINE void COP1LCH(uae_u16 v) +STATIC_INLINE void COP1LCH (uae_u16 v) { cop1lc = (cop1lc & 0xffff) | ((uae_u32)v << 16); } -STATIC_INLINE void COP1LCL(uae_u16 v) +STATIC_INLINE void COP1LCL (uae_u16 v) { cop1lc = (cop1lc & ~0xffff) | (v & 0xfffe); } -STATIC_INLINE void COP2LCH(uae_u16 v) +STATIC_INLINE void COP2LCH (uae_u16 v) { cop2lc = (cop2lc & 0xffff) | ((uae_u32)v << 16); } -STATIC_INLINE void COP2LCL(uae_u16 v) +STATIC_INLINE void COP2LCL (uae_u16 v) { cop2lc = (cop2lc & ~0xffff) | (v & 0xfffe); } -static void compute_spcflag_copper(int hpos); +static void compute_spcflag_copper (int hpos); // vblank = copper starts at hpos=2 // normal COPJMP write: takes 2 more cycles -static void COPJMP(int num, int vblank) +static void COPJMP (int num, int vblank) { - int oldstrobe = cop_state.strobe; + int was_active = eventtab[ev_copper].active; + int oldstrobe = cop_state.strobe; bool wasstopped = cop_state.state == COP_stop && !vblank; - unset_special(SPCFLAG_COPPER); + unset_special (SPCFLAG_COPPER); cop_state.ignore_next = 0; - if (!oldstrobe) - cop_state.state_prev = cop_state.state; + if (!oldstrobe) + cop_state.state_prev = cop_state.state; if ((cop_state.state == COP_wait || cop_state.state == COP_waitforever) && !vblank && dmaen(DMA_COPPER)) { cop_state.state = COP_strobe_delay1x; - } - else { + } else { cop_state.state = vblank ? COP_start_delay : (copper_access ? COP_strobe_delay1 : COP_strobe_extra); } - cop_state.vpos = vpos; - cop_state.hpos = current_hpos() & ~1; - copper_enabled_thisline = 0; - cop_state.strobe = num; + cop_state.hpos = current_hpos () & ~1; + copper_enabled_thisline = 0; + cop_state.strobe = num; + + eventtab[ev_copper].active = 0; - if (nocustom()) { - immediate_copper(num); - return; - } + if (nocustom()) { + immediate_copper (num); + return; + } - if (dmaen(DMA_COPPER)) { - compute_spcflag_copper(current_hpos()); - } - else if (wasstopped || (oldstrobe > 0 && oldstrobe != num && cop_state.state_prev == COP_wait)) { - /* dma disabled, copper idle and accessed both COPxJMPs -> copper stops! */ - cop_state.state = COP_stop; + if (was_active) + events_schedule (); + + if (dmaen (DMA_COPPER)) { + compute_spcflag_copper (current_hpos ()); + } else if (wasstopped || (oldstrobe > 0 && oldstrobe != num && cop_state.state_prev == COP_wait)) { + /* dma disabled, copper idle and accessed both COPxJMPs -> copper stops! */ + cop_state.state = COP_stop; } } -STATIC_INLINE void COPCON(uae_u16 a) +STATIC_INLINE void COPCON (uae_u16 a) { - copcon = a; + copcon = a; } -static void check_copper_stop(void) +STATIC_INLINE void check_copper_stop(void) { if (copper_enabled_thisline < 0 && !((dmacon & DMA_COPPER) && (dmacon & DMA_MASTER))) { copper_enabled_thisline = 0; - unset_special(SPCFLAG_COPPER); + unset_special (SPCFLAG_COPPER); } } -static void copper_stop(void) +STATIC_INLINE void copper_stop(void) { if (copper_enabled_thisline) { // let MOVE to finish switch (cop_state.state) { - case COP_read2: - copper_enabled_thisline = -1; - break; + case COP_read2: + copper_enabled_thisline = -1; + break; } } if (copper_enabled_thisline >= 0) { copper_enabled_thisline = 0; - unset_special(SPCFLAG_COPPER); + unset_special (SPCFLAG_COPPER); } } -static void DMACON(int hpos, uae_u16 v) +static void DMACON (int hpos, uae_u16 v) { int oldcop, newcop; - uae_u16 changed; - + uae_u16 changed; + uae_u16 oldcon = dmacon; - - decide_line(hpos); - decide_fetch_safe(hpos); - - setclr(&dmacon, v); + + decide_line (hpos); + decide_fetch_safe (hpos); + + setclr (&dmacon, v); dmacon &= 0x07FF; + + changed = dmacon ^ oldcon; + oldcop = (oldcon & DMA_COPPER) && (oldcon & DMA_MASTER); + newcop = (dmacon & DMA_COPPER) && (dmacon & DMA_MASTER); - changed = dmacon ^ oldcon; + if (oldcop != newcop) { + eventtab[ev_copper].active = 0; - oldcop = (oldcon & DMA_COPPER) && (oldcon & DMA_MASTER); - newcop = (dmacon & DMA_COPPER) && (dmacon & DMA_MASTER); - - if (oldcop != newcop) { - if (newcop && !oldcop) { - compute_spcflag_copper(hpos); - } - else if (!newcop) { + if (newcop && !oldcop) { + compute_spcflag_copper (hpos); + } else if (!newcop) { copper_stop(); - } + } } if ((dmacon & DMA_BLITPRI) > (oldcon & DMA_BLITPRI) && bltstate != BLT_done) - set_special(SPCFLAG_BLTNASTY); + set_special (SPCFLAG_BLTNASTY); - if (dmaen(DMA_BLITTER) && bltstate == BLT_init) { - blitter_check_start(); + if (dmaen (DMA_BLITTER) && bltstate == BLT_init) { + blitter_check_start (); } if ((dmacon & (DMA_BLITPRI | DMA_BLITTER | DMA_MASTER)) != (DMA_BLITPRI | DMA_BLITTER | DMA_MASTER)) - unset_special(SPCFLAG_BLTNASTY); + unset_special (SPCFLAG_BLTNASTY); + + if (changed & (DMA_MASTER | 0x0f)) + audio_state_machine (); - if (changed & (DMA_MASTER | 0x0f)) - audio_state_machine(); - - if (changed & (DMA_MASTER | DMA_BITPLANE)) { - SET_LINE_CYCLEBASED; + if (changed & (DMA_MASTER | DMA_BITPLANE)) { + SET_LINE_CYCLEBASED; bitplane_maybe_start_hpos = hpos; - } + } + + events_schedule(); } -static int irq_nmi; - -void NMI_delayed(void) +int intlev (void) { - irq_nmi = 1; + uae_u16 imask = intreq & intena; + if (!(imask && (intena & 0x4000))) + return -1; + if (imask & (0x4000 | 0x2000)) // 13 14 + return 6; + if (imask & (0x1000 | 0x0800)) // 11 12 + return 5; + if (imask & (0x0400 | 0x0200 | 0x0100 | 0x0080)) // 7 8 9 10 + return 4; + if (imask & (0x0040 | 0x0020 | 0x0010)) // 4 5 6 + return 3; + if (imask & 0x0008) // 3 + return 2; + if (imask & (0x0001 | 0x0002 | 0x0004)) // 0 1 2 + return 1; + return -1; } -static uae_u16 intreq_internal, intena_internal; - -int intlev(void) -{ - uae_u16 imask = intreq_internal & intena_internal; - if (irq_nmi) { - irq_nmi = 0; - return 7; - } - if (!(imask && (intena_internal & 0x4000))) - return -1; - if (imask & (0x4000 | 0x2000)) // 13 14 - return 6; - if (imask & (0x1000 | 0x0800)) // 11 12 - return 5; - if (imask & (0x0400 | 0x0200 | 0x0100 | 0x0080)) // 7 8 9 10 - return 4; - if (imask & (0x0040 | 0x0020 | 0x0010)) // 4 5 6 - return 3; - if (imask & 0x0008) // 3 - return 2; - if (imask & (0x0001 | 0x0002 | 0x0004)) // 0 1 2 - return 1; - return -1; -} - -#define INT_PROCESSING_DELAY (3 * CYCLE_UNIT) -STATIC_INLINE int use_eventmode(uae_u16 v) -{ - if (currprefs.cpu_memory_cycle_exact && currprefs.cpu_model <= 68020) - return 1; - return 0; -} - - void rethink_uae_int(void) { bool irq2 = false; bool irq6 = false; - if (uae_int_requested) { + if (uae_int_requested) { if (uae_int_requested & 0xff00) irq6 = true; if (uae_int_requested & 0x00ff) irq2 = true; - } + } { - extern void bsdsock_fake_int_handler(void); + extern void bsdsock_fake_int_handler (void); extern int volatile bsd_int_requested; if (bsd_int_requested) - bsdsock_fake_int_handler(); + bsdsock_fake_int_handler (); } uae_u16 mask = (irq6 ? 0x2000 : 0) | (irq2 ? 0x0008 : 0); @@ -4790,487 +3772,322 @@ void rethink_uae_int(void) INTREQ_0(0x8000 | mask); } -static void rethink_intreq(void) +STATIC_INLINE void rethink_intreq (void) { - //serial_check_irq(); //TODO - rethink_cias(); -#ifdef A2065 - rethink_a2065(); -#endif -#ifdef A2091 - rethink_a2091(); -#endif -#ifdef CDTV - rethink_cdtv(); -#endif -#ifdef CD32 - rethink_akiko(); -#endif - //rethink_gayle(); //TODO + devices_rethink(); } -static void send_interrupt_do(uae_u32 v) -{ - INTREQ_0(0x8000 | (1 << v)); -} - -void send_interrupt(int num, int delay) -{ - if (use_eventmode(0x8000) && delay > 0) { - // always queue interrupt if it is active because - // next instruction in bad code can switch it off.. - // Absolute Inebriation / Virtual Dreams "big glenz" part - if (!(intreq & (1 << num)) || (intena & (1 << num))) - event2_newevent_xx(-1, delay, num, send_interrupt_do); - } - else { - send_interrupt_do(num); - } -} - -static int int_recursive; // yes, bad idea. - -static void send_intena_do(uae_u32 v) -{ - setclr(&intena_internal, v); - doint(); -} - -static void send_intreq_do(uae_u32 v) -{ - setclr(&intreq_internal, v); - int_recursive++; - rethink_intreq(); - int_recursive--; - doint(); -} - -static void INTENA(uae_u16 v) +static void INTENA (uae_u16 v) { uae_u16 old = intena; - setclr(&intena, v); + setclr (&intena,v); - if (!(v & 0x8000) && old == intena && intena == intena_internal) + if (!(v & 0x8000) && old == intena) return; - //write_log (_T("%04x %04x %04x %04x\n"), intena, intena_internal, intreq, intreq_internal); - - if (use_eventmode(v)) { - if (old == intena && intena == intena_internal) - return; - event2_newevent_xx(-1, INT_PROCESSING_DELAY, v, send_intena_do); - } - else { - intena_internal = intena; - if (v & 0x8000) - doint(); - } + if (v & 0x8000) + doint(); } -static void INTREQ_nodelay(uae_u16 v) +void INTREQ_f (uae_u16 v) { - setclr(&intreq, v); - setclr(&intreq_internal, v); - doint(); + setclr (&intreq, v); } -void INTREQ_f(uae_u16 v) -{ - if (use_eventmode(v)) { - setclr(&intreq, v); - send_intreq_do(v); - } - else { - uae_u16 old = intreq; - setclr(&intreq, v); - setclr(&intreq_internal, v); - //if ((old & 0x0800) && !(intreq & 0x0800)) - // serial_rbf_clear(); - } -} - -bool INTREQ_0(uae_u16 v) +bool INTREQ_0 (uae_u16 v) { uae_u16 old = intreq; - setclr(&intreq, v); + setclr (&intreq, v); - //if ((old & 0x0800) && !(intreq & 0x0800)) - // serial_rbf_clear(); - - if (int_recursive) { - // don't add new event if this call came from send_intreq_do/rethink - // and intreq didn't change. - // it wouldn't make any difference except to slow down everything - if (old == intreq) - return false; - } - - if (use_eventmode(v)) { - // don't bother to waste time for interrupt queuing if nothing changes - // but only if we are sure there is no other queued changes - if (old == intreq && intreq_internal == intreq) - return false; - event2_newevent_xx(-1, INT_PROCESSING_DELAY, v, send_intreq_do); + if (old == intreq) return false; - } - else { - uae_u16 old2 = intreq_internal; - intreq_internal = intreq; - if (old == intreq && old2 == intreq_internal) - return false; - if (v & 0x8000) - doint(); - return true; - } + if (v & 0x8000) + doint(); + return true; } -void INTREQ(uae_u16 data) +void INTREQ (uae_u16 data) { - if (INTREQ_0(data)) - rethink_intreq(); + if (INTREQ_0 (data)) + rethink_intreq (); } -static void ADKCON(int hpos, uae_u16 v) +static void ADKCON (int hpos, uae_u16 v) { - if (currprefs.produce_sound > 0) - update_audio(); - DISK_update(hpos); - DISK_update_adkcon(hpos, v); - setclr(&adkcon, v); - audio_update_adkmasks(); - //if ((v >> 11) & 1) - // serial_uartbreak((adkcon >> 11) & 1); + if (currprefs.produce_sound > 0) + update_audio (); + DISK_update (hpos); + DISK_update_adkcon (hpos, v); + setclr (&adkcon,v); + audio_update_adkmasks (); } -static void BEAMCON0(uae_u16 v) +static void BEAMCON0 (uae_u16 v) { - if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { - if (v != new_beamcon0) { - new_beamcon0 = v; - //if (v & ~0x20) { - //write_log(_T("warning: %04X written to BEAMCON0 PC=%08X\n"), v, M68K_GETPC); - //dumpsync(); - //} - } + if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { + new_beamcon0 = v; calcdiw(); - } + } } -static void varsync(void) +STATIC_INLINE void varsync (void) { - if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) - return; -#ifdef PICASSO96 - if (picasso_on && p96refresh_active) { - vtotal = p96refresh_active; - return; - } -#endif - if (!(beamcon0 & 0x80)) - return; + if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) + return; + if (!(beamcon0 & 0x80)) + return; varsync_changed = true; } -#ifdef PICASSO96 -void set_picasso_hack_rate(int hz) +static void BPLxPTH (int hpos, uae_u16 v, int num) { - if (!picasso_on) - return; - vpos_count = 0; - p96refresh_active = int(maxvpos_stored * vblank_hz_stored / hz); - if (!currprefs.cs_ciaatod) - changed_prefs.cs_ciaatod = currprefs.cs_ciaatod = currprefs.ntscmode ? 2 : 1; - if (p96refresh_active > 0) { - new_beamcon0 |= 0x80; - } -} -#endif - - -/* "Dangerous" blitter D-channel: Writing to memory which is also currently -* read by bitplane DMA -*/ -static void dcheck_is_blit_dangerous(void) -{ - check_is_blit_dangerous(bplpt, bplcon0_planes, 50 << bplcon0_res); -} -static void BPLxPTH(int hpos, uae_u16 v, int num) -{ - decide_line(hpos); - decide_fetch_safe(hpos); - if (copper_access && is_bitplane_dma(hpos + 1) == num + 1) { + decide_line (hpos); + decide_fetch_safe (hpos); + if (copper_access && is_bitplane_dma (hpos + 1) == num + 1) { SET_LINE_CYCLEBASED; return; } - bplpt[num] = (bplpt[num] & 0x0000ffff) | ((uae_u32)v << 16); - bplptx[num] = (bplptx[num] & 0x0000ffff) | ((uae_u32)v << 16); - dcheck_is_blit_dangerous(); - //write_log (_T("%d:%d:BPL%dPTH %08X COP=%08x\n"), hpos, vpos, num, bplpt[num], cop_state.ip); + bplpt[num] = (bplpt[num] & 0x0000ffff) | ((uae_u32)v << 16); } -static void BPLxPTL(int hpos, uae_u16 v, int num) + +static void BPLxPTL (int hpos, uae_u16 v, int num) { - decide_line(hpos); - decide_fetch_safe(hpos); + decide_line (hpos); + decide_fetch_safe (hpos); /* chipset feature: - * BPLxPTL write and next cycle doing DMA fetch using same pointer register -> - * next DMA cycle uses old value. - * (Multiscroll / Cult) - * - * If following cycle is not BPL DMA: written value is lost - * - * last fetch block does not have this side-effect, probably due to modulo adds. - * Also it seems only plane 0 fetches have this feature (because of above reason!) - * (MoreNewStuffy / PlasmaForce) - */ + * BPLxPTL write and next cycle doing DMA fetch using same pointer register -> + * next DMA cycle uses old value. + * (Multiscroll / Cult) + * + * If following cycle is not BPL DMA: written value is lost + * + * last fetch block does not have this side-effect, probably due to modulo adds. + * Also it seems only plane 0 fetches have this feature (because of above reason!) + * (MoreNewStuffy / PlasmaForce) + */ /* only detect copper accesses to prevent too fast CPU mode glitches */ - if (copper_access && is_bitplane_dma(hpos + 1) == num + 1) { + if (copper_access && is_bitplane_dma (hpos + 1) == num + 1) { SET_LINE_CYCLEBASED; return; - } - bplpt[num] = (bplpt[num] & 0xffff0000) | (v & 0x0000fffe); - bplptx[num] = (bplptx[num] & 0xffff0000) | (v & 0x0000fffe); - dcheck_is_blit_dangerous(); - //write_log (_T("%d:%d:BPL%dPTL %08X COP=%08x\n"), hpos, vpos, num, bplpt[num], cop_state.ip); + } + bplpt[num] = (bplpt[num] & 0xffff0000) | (v & 0x0000fffe); } -static void BPLCON0_Denise(int hpos, uae_u16 v, bool immediate) +static void BPLCON0_Denise (int hpos, uae_u16 v, bool immediate) { - if (!(currprefs.chipset_mask & CSMASK_ECS_DENISE)) + if (! (currprefs.chipset_mask & CSMASK_ECS_DENISE)) v &= ~0x00F1; - else if (!(currprefs.chipset_mask & CSMASK_AGA)) + else if (! (aga_mode)) v &= ~0x00B0; v &= ~(0x0200 | 0x0100 | 0x0080 | 0x0020); -#if SPRBORDER - v |= 1; -#endif if (bplcon0d == v && !immediate) return; bplcon0dd = -1; - // fake unused 0x0080 bit as an EHB bit (see below) - if (isehb(bplcon0d, bplcon2)) - v |= 0x80; + if (immediate) { - record_register_change(hpos, 0x100, v); - } - else { - record_register_change(hpos, 0x100, (bplcon0d & ~(0x800 | 0x400 | 0x80)) | (v & (0x0800 | 0x400 | 0x80 | 0x01))); + record_register_change (hpos, 0x100, v); + } else { + record_register_change (hpos, 0x100, (bplcon0d & ~(0x800 | 0x400 | 0x80)) | (v & (0x0800 | 0x400 | 0x80 | 0x01))); } - bplcon0d = v & ~0x80; + bplcon0d = v; -#ifdef ECS_DENISE if (currprefs.chipset_mask & CSMASK_ECS_DENISE) { decide_sprites(-1, hpos); - sprres = expand_sprres(v, bplcon3); + sprres = expand_sprres (v, bplcon3); } -#endif if (thisline_decision.plfleft < 0) - update_denise(hpos); + update_denise (hpos); else - update_denise_shifter_planes(hpos); + update_denise_shifter_planes (hpos); } -static void BPLCON0(int hpos, uae_u16 v) +static void BPLCON0 (int hpos, uae_u16 v) { - if (!(currprefs.chipset_mask & CSMASK_ECS_DENISE)) + if (! (currprefs.chipset_mask & CSMASK_ECS_DENISE)) v &= ~0x00F1; - else if (!(currprefs.chipset_mask & CSMASK_AGA)) + else if (! (aga_mode)) v &= ~0x00B0; v &= ~0x0080; - -#if SPRBORDER - v |= 1; -#endif + if (bplcon0 == v) return; - + SET_LINE_CYCLEBASED; - decide_diw(hpos); - decide_line(hpos); - decide_fetch_safe(hpos); + decide_diw (hpos); + decide_line (hpos); + decide_fetch_safe (hpos); - if (!issyncstopped()) { + if (!issyncstopped ()) { vpos_previous = vpos; hpos_previous = hpos; } - if (bplcon0 & 4) - bplcon0_interlace_seen = true; - bplcon0 = v; - bpldmainitdelay(hpos); + bpldmainitdelay (hpos); if (thisline_decision.plfleft < 0) - BPLCON0_Denise(hpos, v, true); + BPLCON0_Denise (hpos, v, true); } -static void BPLCON1(int hpos, uae_u16 v) +STATIC_INLINE void BPLCON1 (int hpos, uae_u16 v) { - if (!(currprefs.chipset_mask & CSMASK_AGA)) - v &= 0xff; + if (!(aga_mode)) + v &= 0xff; if (bplcon1 == v) return; SET_LINE_CYCLEBASED; - decide_line(hpos); - decide_fetch_safe(hpos); + decide_line (hpos); + decide_fetch_safe (hpos); bplcon1_written = true; bplcon1 = v; - hack_shres_delay(hpos); } -static void BPLCON2(int hpos, uae_u16 v) +STATIC_INLINE void BPLCON2 (int hpos, uae_u16 v) { - if (!(currprefs.chipset_mask & CSMASK_AGA)) - v &= 0x7f; + if (!(aga_mode)) + v &= 0x7f; if ((bplcon2 & 0x3fff) == (v & 0x3fff)) return; - decide_line(hpos); + decide_line (hpos); bplcon2 = v; - record_register_change(hpos, 0x104, bplcon2); + record_register_change (hpos, 0x104, bplcon2); } -#ifdef ECS_DENISE -static void BPLCON3(int hpos, uae_u16 v) +STATIC_INLINE void BPLCON3 (int hpos, uae_u16 v) { - if (!(currprefs.chipset_mask & CSMASK_ECS_DENISE)) - return; - if (!(currprefs.chipset_mask & CSMASK_AGA)) { - v &= 0x003f; - v |= 0x0c00; - } -#if SPRBORDER - v |= 2; -#endif + if (! (currprefs.chipset_mask & CSMASK_ECS_DENISE)) + return; + if (!(aga_mode)) { + v &= 0x003f; + v |= 0x0c00; + } if (bplcon3 == v) return; - decide_line(hpos); + decide_line (hpos); decide_sprites(-1, hpos); bplcon3 = v; - sprres = expand_sprres(bplcon0, bplcon3); - record_register_change(hpos, 0x106, v); + sprres = expand_sprres (bplcon0, bplcon3); + record_register_change (hpos, 0x106, v); } -#endif -#ifdef AGA -static void BPLCON4(int hpos, uae_u16 v) + +STATIC_INLINE void BPLCON4 (int hpos, uae_u16 v) { - if (!(currprefs.chipset_mask & CSMASK_AGA)) + if (! (aga_mode)) return; if (bplcon4 == v) return; - decide_line(hpos); + decide_line (hpos); bplcon4 = v; - record_register_change(hpos, 0x10c, v); + record_register_change (hpos, 0x10c, v); } -#endif -static void BPL1MOD(int hpos, uae_u16 v) +static void BPL1MOD (int hpos, uae_u16 v) { - v &= ~1; - if (uae_s16(bpl1mod) != uae_s16(v)) { - decide_line(hpos); - decide_fetch_safe(hpos); + v &= ~1; + if ((uae_s16)bpl1mod != (uae_s16)v) { + decide_line (hpos); + decide_fetch_safe (hpos); } // write to BPLxMOD one cycle before // BPL fetch that also adds modulo: // Old BPLxMOD value is added. - if (1 && (is_bitplane_dma(hpos + 1) & 1)) { + if (1 && (is_bitplane_dma (hpos + 1) & 1)) { dbpl1mod = v; dbpl1mod_on = hpos + 1; - } - else { + } else { bpl1mod = v; dbpl1mod_on = 0; } } -static void BPL2MOD(int hpos, uae_u16 v) +static void BPL2MOD (int hpos, uae_u16 v) { - v &= ~1; - if (uae_s16(bpl2mod) != uae_s16(v)) { - decide_line(hpos); - decide_fetch_safe(hpos); + v &= ~1; + if ((uae_s16)bpl2mod != (uae_s16)v) { + decide_line (hpos); + decide_fetch_safe (hpos); } - if (1 && (is_bitplane_dma(hpos + 1) & 2)) { + if (1 && (is_bitplane_dma (hpos + 1) & 2)) { dbpl2mod = v; dbpl2mod_on = hpos + 1; - } - else { - bpl2mod = v; + } else { + bpl2mod = v; dbpl2mod_on = 0; } } /* Needed in special OCS/ECS "7-plane" mode, -* also handles CPU generated bitplane data -*/ -static void BPLxDAT(int hpos, int num, uae_u16 v) + * also handles CPU generated bitplane data + */ +static void BPLxDAT (int hpos, int num, uae_u16 v) { // only BPL1DAT access can do anything visible if (num == 0 && hpos >= 8) { - decide_line(hpos); - decide_fetch_safe(hpos); + decide_line (hpos); + decide_fetch_safe (hpos); } - flush_display(fetchmode); + flush_display (fetchmode); fetched[num] = v; fetched_aga[num] = v; if (num == 0 && hpos >= 8) { - bpl1dat_written = true; - bpl1dat_written_at_least_once = true; + bpl1dat_written = true; + bpl1dat_written_at_least_once = true; if (thisline_decision.plfleft < 0) - reset_bpl_vars(); - beginning_of_plane_block(hpos, fetchmode); - } + reset_bpl_vars (); + beginning_of_plane_block (hpos, fetchmode); + } } -static void DIWSTRT(int hpos, uae_u16 v) +static void DIWSTRT (int hpos, uae_u16 v) { - if (diwstrt == v && !diwhigh_written) + if (diwstrt == v && ! diwhigh_written) return; - decide_diw(hpos); - decide_line(hpos); + decide_diw (hpos); + decide_line (hpos); diwhigh_written = 0; diwstrt = v; - calcdiw(); + calcdiw (); } -static void DIWSTOP(int hpos, uae_u16 v) +static void DIWSTOP (int hpos, uae_u16 v) { - if (diwstop == v && !diwhigh_written) + if (diwstop == v && ! diwhigh_written) return; - decide_diw(hpos); - decide_line(hpos); + decide_diw (hpos); + decide_line (hpos); diwhigh_written = 0; diwstop = v; - calcdiw(); + calcdiw (); } -static void DIWHIGH(int hpos, uae_u16 v) +static void DIWHIGH (int hpos, uae_u16 v) { - if (!(currprefs.chipset_mask & (CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS))) - return; - if (!(currprefs.chipset_mask & CSMASK_AGA)) + if (!(currprefs.chipset_mask & (CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS))) + return; + if (!(aga_mode)) v &= ~(0x0008 | 0x0010 | 0x1000 | 0x0800); - v &= ~(0x8000 | 0x4000 | 0x0080 | 0x0040); - if (diwhigh_written && diwhigh == v) + v &= ~(0x8000 | 0x4000 | 0x0080 | 0x0040); + if (diwhigh_written && diwhigh == v) return; - decide_line(hpos); + decide_line (hpos); diwhigh_written = 1; diwhigh = v; - calcdiw(); + calcdiw (); } -static void DDFSTRT(int hpos, uae_u16 v) +static void DDFSTRT (int hpos, uae_u16 v) { - v &= 0xfe; - if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) - v &= 0xfc; - decide_line(hpos); - SET_LINE_CYCLEBASED; + v &= 0xfe; + if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) + v &= 0xfc; + decide_line (hpos); + SET_LINE_CYCLEBASED; // Move state back to passed_enable if this DDFSTRT write was done exactly when // it would match and start bitplane DMA. if (hpos == ddfstrt - DDF_OFFSET && plf_state == plf_passed_start && plf_start_hpos == hpos + DDF_OFFSET) { @@ -5278,24 +4095,18 @@ static void DDFSTRT(int hpos, uae_u16 v) plf_start_hpos = maxhpos; } ddfstrt = v; - calcdiw(); + calcdiw (); if (fetch_state != fetch_not_started) - estimate_last_fetch_cycle(hpos); - if (ddfstop > 0xD4 && (ddfstrt & 4) == 4) { - static int last_warned; - last_warned = (last_warned + 1) & 4095; - if (last_warned == 0) - write_log(_T("WARNING! Very strange DDF values (%x %x).\n"), ddfstrt, ddfstop); - } + estimate_last_fetch_cycle (hpos); } -static void DDFSTOP(int hpos, uae_u16 v) +static void DDFSTOP (int hpos, uae_u16 v) { v &= 0xfe; - if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) - v &= 0xfc; - decide_line(hpos); - decide_fetch_safe(hpos); + if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) + v &= 0xfc; + decide_line (hpos); + decide_fetch_safe (hpos); SET_LINE_CYCLEBASED; // DDFSTOP write when old DDFSTOP value match: old value matches normally. // Works differently than DDFSTRT which is interesting. @@ -5306,8 +4117,7 @@ static void DDFSTOP(int hpos, uae_u16 v) // don't let one_fetch_cycle_0() to do this again ddfstop_written_hpos = hpos; } - } - else if (hpos == ddfstop - DDF_OFFSET) { + } else if (hpos == ddfstop - DDF_OFFSET) { // if old ddfstop would have matched, emulate it here if (plf_state == plf_active) { plf_state = plf_passed_stop; @@ -5315,23 +4125,15 @@ static void DDFSTOP(int hpos, uae_u16 v) } } ddfstop = v; - calcdiw(); + calcdiw (); if (fetch_state != fetch_not_started) - estimate_last_fetch_cycle(hpos); - if (ddfstop > 0xD4 && (ddfstrt & 4) == 4) { - static int last_warned; - if (last_warned == 0) - write_log(_T("WARNING! Very strange DDF values (%x).\n"), ddfstop); - last_warned = (last_warned + 1) & 4095; - } + estimate_last_fetch_cycle (hpos); } -static void FMODE(int hpos, uae_u16 v) +static void FMODE (int hpos, uae_u16 v) { - if (!(currprefs.chipset_mask & CSMASK_AGA)) { - //if (currprefs.monitoremu) - // specialmonitor_store_fmode(vpos, hpos, v); - v = 0; + if (!(aga_mode)) { + v = 0; } v &= 0xC00F; if (fmode == v) @@ -5339,465 +4141,326 @@ static void FMODE(int hpos, uae_u16 v) SET_LINE_CYCLEBASED; fmode_saved = v; set_chipset_mode(); - bpldmainitdelay(hpos); + bpldmainitdelay (hpos); } -static void FNULL(uae_u16 v) +static void FNULL (uae_u16 v) { } -static void BLTADAT(int hpos, uae_u16 v) +static void BLTADAT (uae_u16 v) { - maybe_blit(hpos, 0); + maybe_blit (0); - blt_info.bltadat = v; + blt_info.bltadat = v; } - /* -* "Loading data shifts it immediately" says the HRM. Well, that may -* be true for BLTBDAT, but not for BLTADAT - it appears the A data must be -* loaded for every word so that AFWM and ALWM can be applied. -*/ -static void BLTBDAT(int hpos, uae_u16 v) + * "Loading data shifts it immediately" says the HRM. Well, that may + * be true for BLTBDAT, but not for BLTADAT - it appears the A data must be + * loaded for every word so that AFWM and ALWM can be applied. + */ +static void BLTBDAT (uae_u16 v) { - maybe_blit(hpos, 0); + maybe_blit (0); - if (bltcon1 & 2) - blt_info.bltbhold = v << (bltcon1 >> 12); - else - blt_info.bltbhold = v >> (bltcon1 >> 12); - blt_info.bltbdat = v; + int shift = bltcon1 >> 12; + + if (bltcon1 & 2) + blt_info.bltbhold = (((uae_u32)v << 16) | blt_info.bltbold) >> (16 - shift); + else + blt_info.bltbhold = (((uae_u32)blt_info.bltbold << 16) | v) >> shift; + + blt_info.bltbdat = v; + blt_info.bltbold = v; } -static void BLTCDAT(int hpos, uae_u16 v) { maybe_blit(hpos, 0); blt_info.bltcdat = v; reset_blit(0); } +STATIC_INLINE void BLTCDAT (uae_u16 v) { maybe_blit (0); blt_info.bltcdat = v; } -static void BLTAMOD(int hpos, uae_u16 v) { maybe_blit(hpos, 1); blt_info.bltamod = uae_s16(v & 0xFFFE); reset_blit(0); } -static void BLTBMOD(int hpos, uae_u16 v) { maybe_blit(hpos, 1); blt_info.bltbmod = uae_s16(v & 0xFFFE); reset_blit(0); } -static void BLTCMOD(int hpos, uae_u16 v) { maybe_blit(hpos, 1); blt_info.bltcmod = uae_s16(v & 0xFFFE); reset_blit(0); } -static void BLTDMOD(int hpos, uae_u16 v) { maybe_blit(hpos, 1); blt_info.bltdmod = uae_s16(v & 0xFFFE); reset_blit(0); } +STATIC_INLINE void BLTAMOD (uae_u16 v) { maybe_blit (1); blt_info.bltamod = (uae_s16)(v & 0xFFFE); } +STATIC_INLINE void BLTBMOD (uae_u16 v) { maybe_blit (1); blt_info.bltbmod = (uae_s16)(v & 0xFFFE); } +STATIC_INLINE void BLTCMOD (uae_u16 v) { maybe_blit (1); blt_info.bltcmod = (uae_s16)(v & 0xFFFE); } +STATIC_INLINE void BLTDMOD (uae_u16 v) { maybe_blit (1); blt_info.bltdmod = (uae_s16)(v & 0xFFFE); } + +STATIC_INLINE void BLTCON0 (uae_u16 v) { maybe_blit (2); bltcon0 = v; reset_blit (1); } -static void BLTCON0(int hpos, uae_u16 v) { maybe_blit(hpos, 2); bltcon0 = v; reset_blit(1); } /* The next category is "Most useless hardware register". -* And the winner is... */ -static void BLTCON0L(int hpos, uae_u16 v) + * And the winner is... */ +static void BLTCON0L (uae_u16 v) { - if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) + if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) return; // ei voittoa. - maybe_blit(hpos, 2); bltcon0 = (bltcon0 & 0xFF00) | (v & 0xFF); - reset_blit(1); + maybe_blit (2); + bltcon0 = (bltcon0 & 0xFF00) | (v & 0xFF); + reset_blit (1); } -static void BLTCON1(int hpos, uae_u16 v) { maybe_blit(hpos, 2); bltcon1 = v; reset_blit(2); } +STATIC_INLINE void BLTCON1 (uae_u16 v) { maybe_blit (2); bltcon1 = v; reset_blit (2); } -static void BLTAFWM(int hpos, uae_u16 v) { maybe_blit(hpos, 2); blt_info.bltafwm = v; reset_blit(0); } -static void BLTALWM(int hpos, uae_u16 v) { maybe_blit(hpos, 2); blt_info.bltalwm = v; reset_blit(0); } +STATIC_INLINE void BLTAFWM (uae_u16 v) { maybe_blit (2); blt_info.bltafwm = v; } +STATIC_INLINE void BLTALWM (uae_u16 v) { maybe_blit (2); blt_info.bltalwm = v; } -static void BLTAPTH(int hpos, uae_u16 v) +STATIC_INLINE void BLTAPTH (uae_u16 v) { - maybe_blit(hpos, 0); - if (bltstate != BLT_done && currprefs.blitter_cycle_exact && currprefs.cpu_memory_cycle_exact) { - bltptx = (bltapt & 0xffff) | ((uae_u32)v << 16); - bltptxpos = hpos; - bltptxc = 1; - } - else { - bltapt = (bltapt & 0xffff) | ((uae_u32)v << 16); - } + maybe_blit (0); + bltapt = (bltapt & 0xffff) | ((uae_u32)v << 16); } -static void BLTAPTL(int hpos, uae_u16 v) -{ - maybe_blit(hpos, 0); - if (bltstate != BLT_done && currprefs.blitter_cycle_exact && currprefs.cpu_memory_cycle_exact) { - bltptx = (bltapt & ~0xffff) | (v & 0xFFFE); - bltptxpos = hpos; - bltptxc = 1; - } - else { - bltapt = (bltapt & ~0xffff) | (v & 0xFFFE); - } +STATIC_INLINE void BLTAPTL (uae_u16 v) +{ + maybe_blit (0); + bltapt = (bltapt & ~0xffff) | (v & 0xFFFE); } -static void BLTBPTH(int hpos, uae_u16 v) -{ - maybe_blit(hpos, 0); - if (bltstate != BLT_done && currprefs.blitter_cycle_exact && currprefs.cpu_memory_cycle_exact) { - bltptx = (bltbpt & 0xffff) | ((uae_u32)v << 16); - bltptxpos = hpos; - bltptxc = 2; - } - else { - bltbpt = (bltbpt & 0xffff) | ((uae_u32)v << 16); - } +STATIC_INLINE void BLTBPTH (uae_u16 v) +{ + maybe_blit (0); + bltbpt = (bltbpt & 0xffff) | ((uae_u32)v << 16); } -static void BLTBPTL(int hpos, uae_u16 v) -{ - maybe_blit(hpos, 0); - if (bltstate != BLT_done && currprefs.blitter_cycle_exact && currprefs.cpu_memory_cycle_exact) { - bltptx = (bltbpt & ~0xffff) | (v & 0xFFFE); - bltptxpos = hpos; - bltptxc = 2; - } - else { - bltbpt = (bltbpt & ~0xffff) | (v & 0xFFFE); - } +STATIC_INLINE void BLTBPTL (uae_u16 v) +{ + maybe_blit (0); + bltbpt = (bltbpt & ~0xffff) | (v & 0xFFFE); } -static void BLTCPTH(int hpos, uae_u16 v) -{ - maybe_blit(hpos, 0); - if (bltstate != BLT_done && currprefs.blitter_cycle_exact && currprefs.cpu_memory_cycle_exact) { - bltptx = (bltcpt & 0xffff) | ((uae_u32)v << 16); - bltptxpos = hpos; - bltptxc = 3; - } - else { - bltcpt = (bltcpt & 0xffff) | ((uae_u32)v << 16); - } +STATIC_INLINE void BLTCPTH (uae_u16 v) +{ + maybe_blit (0); + bltcpt = (bltcpt & 0xffff) | ((uae_u32)v << 16); } -static void BLTCPTL(int hpos, uae_u16 v) -{ - maybe_blit(hpos, 0); - if (bltstate != BLT_done && currprefs.blitter_cycle_exact && currprefs.cpu_memory_cycle_exact) { - bltptx = (bltcpt & ~0xffff) | (v & 0xFFFE); - bltptxpos = hpos; - bltptxc = 3; - } - else { - bltcpt = (bltcpt & ~0xffff) | (v & 0xFFFE); - } +STATIC_INLINE void BLTCPTL (uae_u16 v) +{ + maybe_blit (0); + bltcpt = (bltcpt & ~0xffff) | (v & 0xFFFE); } -static void BLTDPTH(int hpos, uae_u16 v) -{ - maybe_blit(hpos, 0); - if (bltstate != BLT_done && currprefs.blitter_cycle_exact && currprefs.cpu_memory_cycle_exact) { - bltptx = (bltdpt & 0xffff) | ((uae_u32)v << 16); - bltptxpos = hpos; - bltptxc = 4; - } - else { - bltdpt = (bltdpt & 0xffff) | ((uae_u32)v << 16); - } +STATIC_INLINE void BLTDPTH (uae_u16 v) +{ + maybe_blit (0); + bltdpt = (bltdpt & 0xffff) | ((uae_u32)v << 16); } -static void BLTDPTL(int hpos, uae_u16 v) -{ - maybe_blit(hpos, 0); - if (bltstate != BLT_done && currprefs.blitter_cycle_exact && currprefs.cpu_memory_cycle_exact) { - bltptx = (bltdpt & ~0xffff) | (v & 0xFFFE); - bltptxpos = hpos; - bltptxc = 4; - } - else { - bltdpt = (bltdpt & ~0xffff) | (v & 0xFFFE); - } +STATIC_INLINE void BLTDPTL (uae_u16 v) +{ + maybe_blit (0); + bltdpt = (bltdpt & ~0xffff) | (v & 0xFFFE); } -static void BLTSIZE(int hpos, uae_u16 v) +STATIC_INLINE void BLTSIZE (uae_u16 v) { - maybe_blit(hpos, 0); + maybe_blit (0); - blt_info.vblitsize = v >> 6; - blt_info.hblitsize = v & 0x3F; - if (!blt_info.vblitsize) - blt_info.vblitsize = 1024; - if (!blt_info.hblitsize) - blt_info.hblitsize = 64; - do_blitter(hpos, copper_access); - dcheck_is_blit_dangerous(); + blt_info.vblitsize = v >> 6; + blt_info.hblitsize = v & 0x3F; + if (!blt_info.vblitsize) + blt_info.vblitsize = 1024; + if (!blt_info.hblitsize) + blt_info.hblitsize = 64; + do_blitter (); } -static void BLTSIZV(int hpos, uae_u16 v) +STATIC_INLINE void BLTSIZV (uae_u16 v) { - if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) + if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) return; - maybe_blit(hpos, 0); + maybe_blit (0); blt_info.vblitsize = v & 0x7FFF; } -static void BLTSIZH(int hpos, uae_u16 v) +STATIC_INLINE void BLTSIZH (uae_u16 v) { - if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) + if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) return; - maybe_blit(hpos, 0); + maybe_blit (0); blt_info.hblitsize = v & 0x7FF; - if (!blt_info.vblitsize) - blt_info.vblitsize = 0x8000; - if (!blt_info.hblitsize) - blt_info.hblitsize = 0x0800; - do_blitter(hpos, copper_access); + if (!blt_info.vblitsize) + blt_info.vblitsize = 0x8000; + if (!blt_info.hblitsize) + blt_info.hblitsize = 0x0800; + do_blitter (); } -STATIC_INLINE void spr_arm(int num, int state) +STATIC_INLINE void spr_arm (int num, int state) { - switch (state) { - case 0: - nr_armed -= spr[num].armed; - spr[num].armed = 0; - break; - default: - nr_armed += 1 - spr[num].armed; - spr[num].armed = 1; - break; - } + switch (state) { + case 0: + nr_armed -= spr[num].armed; + spr[num].armed = 0; + break; + default: + nr_armed += 1 - spr[num].armed; + spr[num].armed = 1; + break; + } } -STATIC_INLINE void sprstartstop(struct sprite *s) +STATIC_INLINE void sprstartstop (struct sprite *s) { - if (vpos < sprite_vblank_endline || cant_this_last_line() || s->ignoreverticaluntilnextline) + if (vpos < sprite_vblank_endline) return; - if (vpos == s->vstart) - s->dmastate = 1; - if (vpos == s->vstop) - s->dmastate = 0; + if (vpos == s->vstart) + s->dmastate = 1; + if (vpos == s->vstop) + s->dmastate = 0; } -static void SPRxCTLPOS(int num) +STATIC_INLINE void SPRxCTLPOS (int num) { - int sprxp; - struct sprite *s = &spr[num]; + int sprxp; + struct sprite *s = &spr[num]; - sprstartstop(s); - sprxp = (sprpos[num] & 0xFF) * 2 + (sprctl[num] & 1); - sprxp <<= sprite_buffer_res; - /* Quite a bit salad in this register... */ - if (false) { - } -#ifdef AGA - else if (currprefs.chipset_mask & CSMASK_AGA) { + sprstartstop (s); + sprxp = (sprpos[num] & 0xFF) * 2 + (sprctl[num] & 1); + sprxp <<= sprite_buffer_res; + /* Quite a bit salad in this register... */ + if (aga_mode) { sprxp |= ((sprctl[num] >> 3) & 3) >> (RES_MAX - sprite_buffer_res); s->dblscan = sprpos[num] & 0x80; } -#endif -#ifdef ECS_DENISE else if (currprefs.chipset_mask & CSMASK_ECS_DENISE) { sprxp |= ((sprctl[num] >> 3) & 2) >> (RES_MAX - sprite_buffer_res); - } -#endif - s->xpos = sprxp; - s->vstart = sprpos[num] >> 8; - s->vstart |= (sprctl[num] & 0x04) ? 0x0100 : 0; - s->vstop = sprctl[num] >> 8; - s->vstop |= (sprctl[num] & 0x02) ? 0x100 : 0; - if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { + } + s->xpos = sprxp; + s->vstart = sprpos[num] >> 8; + s->vstart |= (sprctl[num] & 0x04) ? 0x0100 : 0; + s->vstop = sprctl[num] >> 8; + s->vstop |= (sprctl[num] &0x02) ? 0x100 : 0; + if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { s->vstart |= (sprctl[num] & 0x40) ? 0x0200 : 0; s->vstop |= (sprctl[num] & 0x20) ? 0x0200 : 0; - } - sprstartstop(s); + } + sprstartstop (s); } -static void SPRxCTL_1(uae_u16 v, int num, int hpos) +STATIC_INLINE void SPRxCTL_1 (uae_u16 v, int num) { - if (hpos >= maxhpos - 2 && sprctl[num] != v && vpos < maxvpos - 1) { - struct sprite *s = &spr[num]; - vpos++; - sprstartstop(s); - vpos--; - s->ignoreverticaluntilnextline = true; - sprite_ignoreverticaluntilnextline = true; - } - sprctl[num] = v; - spr_arm(num, 0); - SPRxCTLPOS(num); + sprctl[num] = v; + spr_arm (num, 0); + SPRxCTLPOS (num); } -static void SPRxPOS_1(uae_u16 v, int num, int hpos) +STATIC_INLINE void SPRxPOS_1 (uae_u16 v, int num) { - if (hpos >= maxhpos - 2 && sprpos[num] != v && vpos < maxvpos - 1) { - struct sprite *s = &spr[num]; - vpos++; - sprstartstop(s); - vpos--; - s->ignoreverticaluntilnextline = true; - sprite_ignoreverticaluntilnextline = true; - } - sprpos[num] = v; - SPRxCTLPOS(num); - } -static void SPRxDATA_1(uae_u16 v, int num, int hpos) -{ - sprdata[num][0] = v; -#ifdef AGA - sprdata[num][1] = v; - sprdata[num][2] = v; - sprdata[num][3] = v; -#endif - spr_arm(num, 1); + sprpos[num] = v; + SPRxCTLPOS (num); } -static void SPRxDATB_1(uae_u16 v, int num, int hpos) +STATIC_INLINE void SPRxDATA_1 (uae_u16 v, int num) { - sprdatb[num][0] = v; -#ifdef AGA - sprdatb[num][1] = v; - sprdatb[num][2] = v; - sprdatb[num][3] = v; -#endif + sprdata[num][0] = v; + sprdata[num][1] = v; + sprdata[num][2] = v; + sprdata[num][3] = v; + spr_arm (num, 1); +} +STATIC_INLINE void SPRxDATB_1 (uae_u16 v, int num) +{ + sprdatb[num][0] = v; + sprdatb[num][1] = v; + sprdatb[num][2] = v; + sprdatb[num][3] = v; } /* -SPRxDATA and SPRxDATB is moved to shift register when SPRxPOS matches. + SPRxDATA and SPRxDATB is moved to shift register when SPRxPOS matches. -When copper writes to SPRxDATx exactly when SPRxPOS matches: -- If sprite low x bit (SPRCTL bit 0) is not set, shift register copy -is done first (previously loaded SPRxDATx value is shown) and then -new SPRxDATx gets stored for future use. -- If sprite low x bit is set, new SPRxDATx is stored, then SPRxPOS -matches and value written to SPRxDATx is visible. + When copper writes to SPRxDATx exactly when SPRxPOS matches: + - If sprite low x bit (SPRCTL bit 0) is not set, shift register copy + is done first (previously loaded SPRxDATx value is shown) and then + new SPRxDATx gets stored for future use. + - If sprite low x bit is set, new SPRxDATx is stored, then SPRxPOS + matches and value written to SPRxDATx is visible. -- Writing to SPRxPOS when SPRxPOS matches: shift register -copy is always done first, then new SPRxPOS value is stored -for future use. (SPRxCTL not tested) + - Writing to SPRxPOS when SPRxPOS matches: shift register + copy is always done first, then new SPRxPOS value is stored + for future use. (SPRxCTL not tested) */ -static void SPRxDATA(int hpos, uae_u16 v, int num) -{ - decide_sprites(-1, hpos, true, false); - SPRxDATA_1(v, num, hpos); +STATIC_INLINE void SPRxDATA (int hpos, uae_u16 v, int num) +{ + decide_sprites(-1, hpos, false); + SPRxDATA_1 (v, num); } -static void SPRxDATB(int hpos, uae_u16 v, int num) -{ - decide_sprites(-1, hpos, true, false); - SPRxDATB_1(v, num, hpos); +STATIC_INLINE void SPRxDATB (int hpos, uae_u16 v, int num) +{ + decide_sprites(-1, hpos, false); + SPRxDATB_1 (v, num); } -static void SPRxCTL(int hpos, uae_u16 v, int num) -{ +STATIC_INLINE void SPRxCTL (int hpos, uae_u16 v, int num) +{ decide_sprites(-1, hpos); - SPRxCTL_1(v, num, hpos); + SPRxCTL_1 (v, num); } -static void SPRxPOS(int hpos, uae_u16 v, int num) +STATIC_INLINE void SPRxPOS (int hpos, uae_u16 v, int num) { - struct sprite *s = &spr[num]; - int oldvpos; - decide_sprites(-1, hpos); - oldvpos = s->vstart; - SPRxPOS_1(v, num, hpos); - // Superfrog flashing intro bees fix. - // if SPRxPOS is written one cycle before sprite's first DMA slot and sprite's vstart matches after - // SPRxPOS write, current line's DMA slot's stay idle. DMA decision seems to be done 4 cycles earlier. - if (hpos >= SPR0_HPOS + num * 4 - 4 && hpos <= SPR0_HPOS + num * 4 - 1 && oldvpos != vpos) { - s->ptxvpos2 = vpos; - s->ptxhpos2 = hpos + 4; - } + SPRxPOS_1 (v, num); } -static void SPRxPTH(int hpos, uae_u16 v, int num) +static void SPRxPTH (int hpos, uae_u16 v, int num) { decide_sprites(-1, hpos); - if (hpos - 1 != spr[num].ptxhpos) { - spr[num].pt &= 0xffff; - spr[num].pt |= (uae_u32)v << 16; - } + if (hpos - 1 != MAXHPOS) { + spr[num].pt &= 0xffff; + spr[num].pt |= (uae_u32)v << 16; + } } -static void SPRxPTL(int hpos, uae_u16 v, int num) +static void SPRxPTL (int hpos, uae_u16 v, int num) { decide_sprites(-1, hpos); - if (hpos - 1 != spr[num].ptxhpos) { - spr[num].pt &= ~0xffff; + if (hpos - 1 != MAXHPOS) { + spr[num].pt &= ~0xffff; spr[num].pt |= v & ~1; - } + } } -static void CLXCON(uae_u16 v) +static void CLXCON (uae_u16 v) { - clxcon = v; - clxcon_bpl_enable = (v >> 6) & 63; - clxcon_bpl_match = v & 63; + clxcon = v; + clxcon_bpl_enable = (v >> 6) & 63; + clxcon_bpl_match = v & 63; } -static void CLXCON2(uae_u16 v) +static void CLXCON2 (uae_u16 v) { - if (!(currprefs.chipset_mask & CSMASK_AGA)) + if (!(aga_mode)) return; clxcon2 = v; - clxcon_bpl_enable |= v & (0x40 | 0x80); - clxcon_bpl_match |= (v & (0x01 | 0x02)) << 6; + clxcon_bpl_enable |= v & (0x40|0x80); + clxcon_bpl_match |= (v & (0x01|0x02)) << 6; } -static uae_u16 CLXDAT(void) +static uae_u16 CLXDAT (void) { - uae_u16 v = clxdat | 0x8000; - clxdat = 0; - return v; + uae_u16 v = clxdat | 0x8000; + clxdat = 0; + return v; } -#ifdef AGA - -//void dump_aga_custom(void) -//{ -// int c1, c2, c3, c4; -// uae_u32 rgb1, rgb2, rgb3, rgb4; -// -// for (c1 = 0; c1 < 64; c1++) { -// c2 = c1 + 64; -// c3 = c2 + 64; -// c4 = c3 + 64; -// rgb1 = current_colors.color_regs_aga[c1]; -// rgb2 = current_colors.color_regs_aga[c2]; -// rgb3 = current_colors.color_regs_aga[c3]; -// rgb4 = current_colors.color_regs_aga[c4]; -// write_log(_T("%3d %08X %3d %08X %3d %08X %3d %08X\n"), -// c1, rgb1, c2, rgb2, c3, rgb3, c4, rgb4); -// } -//} - -static uae_u16 COLOR_READ(int num) +static uae_u16 COLOR_READ (int num) { int cr, cg, cb, colreg; uae_u16 cval; - - if (!(currprefs.chipset_mask & CSMASK_AGA) || !(bplcon2 & 0x0100)) + + if (!(aga_mode) || !(bplcon2 & 0x0100)) return 0xffff; - + colreg = ((bplcon3 >> 13) & 7) * 32 + num; cr = (current_colors.color_regs_aga[colreg] >> 16) & 0xFF; cg = (current_colors.color_regs_aga[colreg] >> 8) & 0xFF; cb = current_colors.color_regs_aga[colreg] & 0xFF; if (bplcon3 & 0x200) { cval = ((cr & 15) << 8) | ((cg & 15) << 4) | ((cb & 15) << 0); - } - else { + } else { cval = ((cr >> 4) << 8) | ((cg >> 4) << 4) | ((cb >> 4) << 0); - if (color_regs_genlock[num]) - cval |= 0x8000; - } - return cval; -} -#endif - -static void checkautoscalecol0(void) -{ - if (!copper_access) - return; - if (vpos < 20) - return; - if (isbrdblank(-1, bplcon0, bplcon3)) - return; - // autoscale if copper changes COLOR00 on top or bottom of screen - if (vpos >= minfirstline) { - int vpos2 = autoscale_bordercolors ? minfirstline : vpos; - if (first_planes_vpos == 0) - first_planes_vpos = vpos2 - 2; - if (plffirstline_total == current_maxvpos()) - plffirstline_total = vpos2 - 2; - if (vpos2 > last_planes_vpos || vpos2 > plflastline_total) - plflastline_total = last_planes_vpos = vpos2 + 3; - autoscale_bordercolors = 0; - } - else { - autoscale_bordercolors++; } + return cval; } -static void COLOR_WRITE(int hpos, uae_u16 v, int num) +static void COLOR_WRITE (int hpos, uae_u16 v, int num) { - bool colzero = false; -#ifdef AGA - if (currprefs.chipset_mask & CSMASK_AGA) { - int r, g, b; - int cr, cg, cb; + if (aga_mode) { + int r,g,b; + int cr,cg,cb; int colreg; uae_u32 cval; - + /* writing is disabled when RDRAM=1 */ if (bplcon2 & 0x0100) return; - + colreg = ((bplcon3 >> 13) & 7) * 32 + num; r = (v & 0xF00) >> 8; g = (v & 0xF0) >> 4; @@ -5805,56 +4468,40 @@ static void COLOR_WRITE(int hpos, uae_u16 v, int num) cr = (current_colors.color_regs_aga[colreg] >> 16) & 0xFF; cg = (current_colors.color_regs_aga[colreg] >> 8) & 0xFF; cb = current_colors.color_regs_aga[colreg] & 0xFF; - + if (bplcon3 & 0x200) { cr &= 0xF0; cr |= r; cg &= 0xF0; cg |= g; cb &= 0xF0; cb |= b; - } - else { + } else { cr = r + (r << 4); cg = g + (g << 4); cb = b + (b << 4); - color_regs_genlock[colreg] = v >> 15; } - cval = (cr << 16) | (cg << 8) | cb | (color_regs_genlock[colreg] ? 0x80000000 : 0); - if (cval && colreg == 0) - colzero = true; + cval = (cr << 16) | (cg << 8) | cb; if (cval == current_colors.color_regs_aga[colreg]) return; - - if (colreg == 0) - checkautoscalecol0(); - + /* Call this with the old table still intact. */ - record_color_change(hpos, colreg, cval); + record_color_change (hpos, colreg, cval); remembered_color_entry = -1; current_colors.color_regs_aga[colreg] = cval; - current_colors.acolors[colreg] = getxcolor(cval); + current_colors.acolors[colreg] = CONVERT_RGB (cval); - } - else { -#endif + } else { v &= 0x8fff; if (!(currprefs.chipset_mask & CSMASK_ECS_DENISE)) v &= 0xfff; - color_regs_genlock[num] = v >> 15; - if (num && v == 0) - colzero = true; - if (current_colors.color_regs_ecs[num] == v) + if (current_colors.color_regs_ecs[num] == v) return; - if (num == 0) - checkautoscalecol0(); /* Call this with the old table still intact. */ - record_color_change(hpos, num, v); + record_color_change (hpos, num, v); remembered_color_entry = -1; - current_colors.color_regs_ecs[num] = v; - current_colors.acolors[num] = getxcolor(v); -#ifdef AGA + current_colors.color_regs_ecs[num] = v; + current_colors.acolors[num] = xcolors[v]; } -#endif } /* The copper code. The biggest nightmare in the whole emulator. @@ -5896,396 +4543,499 @@ static void COLOR_WRITE(int hpos, uae_u16 v, int num) /* Determine which cycles are available for the copper in a display * with a agiven number of planes. */ -STATIC_INLINE int copper_cant_read2(int hpos, int alloc) +STATIC_INLINE int copper_cant_read (int hpos) { - if (hpos + 1 >= maxhpos) // first refresh slot - return 1; - if ((hpos == maxhpos - 3) && (maxhpos & 1) && alloc >= 0) { - if (alloc) { - alloc_cycle(hpos, CYCLE_COPPER); - } + if (hpos + 1 >= maxhpos) // first refresh slot + return 1; + if ((hpos == maxhpos - 3) && (maxhpos & 1)) { return -1; } - return is_bitplane_dma_inline(hpos); + return is_bitplane_dma (hpos); } -static int copper_cant_read(int hpos, int alloc) + +/* The future, Conan? + We try to look ahead in the copper list to avoid doing continuous calls + to updat_copper (which is what happens when SPCFLAG_COPPER is set). If + we find that the same effect can be achieved by setting a delayed event + and then doing multiple copper insns in one batch, we can get a massive + speedup. + + We don't try to be precise here. All copper reads take exactly 2 cycles, + the effect of bitplane contention is ignored. Trying to get it exactly + right would be much more complex and as such carry a huge risk of getting + it subtly wrong; and it would also be more expensive - we want this code + to be fast. */ + +static void predict_copper (void) { - int cant = copper_cant_read2(hpos, alloc); -#ifdef DEBUGGER - if (cant && debug_dma) - record_dma_event(DMA_EVENT_COPPERWANTED, hpos, vpos); -#endif - return cant; + uaecptr ip = cop_state.ip; + unsigned int c_hpos = cop_state.hpos; + enum copper_states state = cop_state.state; + unsigned int w1, w2, cycle_count; + unsigned int modified = REGTYPE_FORCE; + + switch (state) { + case COP_read1: + break; + + case COP_read2: + w1 = cop_state.i1; + w2 = chipmem_wget_indirect (ip); + if (w1 & 1) { + if (w2 & 1) + return; // SKIP + state = COP_wait; // WAIT + c_hpos += 4; + } else { // MOVE + modified |= regtypes[w1 & 0x1FE]; + state = COP_read1; + c_hpos += 2; + } + ip += 2; + break; + + case COP_strobe_delay2: + case COP_strobe_delay2x: + case COP_start_delay: + c_hpos += 2; + state = COP_read1; + break; + + case COP_strobe_extra: + c_hpos += 6; + state = COP_read1; + break; + + case COP_strobe_delay1: + case COP_strobe_delay1x: + c_hpos += 4; + state = COP_read1; + break; + + case COP_stop: + case COP_waitforever: + case COP_bltwait: + case COP_skip_in2: + case COP_skip1: + return; + + case COP_wait_in2: + c_hpos += 2; + case COP_wait1: + w1 = cop_state.i1; + w2 = cop_state.i2; + state = COP_wait; + break; + + case COP_wait: + w1 = cop_state.i1; + w2 = cop_state.i2; + break; + + default: + return; + } + /* Only needed for COP_wait, but let's shut up the compiler. */ + cop_state.first_sync = c_hpos; + + while (c_hpos + 1 < maxhpos) { + if (state == COP_read1) { + w1 = chipmem_wget_indirect (ip); + if (w1 & 1) { + w2 = chipmem_wget_indirect (ip + 2); + if (w2 & 1) + break; // SKIP + state = COP_wait; // WAIT + c_hpos += 6; + } else { // MOVE + modified |= regtypes[w1 & 0x1FE]; + c_hpos += 4; + } + ip += 4; + } else { // state is COP_wait + if ((w2 & 0xFE) != 0xFE) + break; + else { + unsigned int vcmp = (w1 & (w2 | 0x8000)) >> 8; + unsigned int hcmp = (w1 & 0xFE); + + unsigned int vp = vpos & (((w2 >> 8) & 0x7F) | 0x80); + if (vp < vcmp) { + /* Whee. We can wait until the end of the line! */ + c_hpos = maxhpos; + } else if (vp > vcmp || hcmp <= c_hpos) { + state = COP_read1; + /* minimum wakeup time */ + c_hpos += 2; + } else { + state = COP_read1; + c_hpos = hcmp + 2; + } + /* If this is the current instruction, remember that we don't + need to sync CPU and copper anytime soon. */ + if (cop_state.ip == ip) { + cop_state.first_sync = c_hpos; + } + } + } + } + + cycle_count = c_hpos - cop_state.hpos; + if (cycle_count >= 8) { + cop_state.regtypes_modified = modified; + unset_special (SPCFLAG_COPPER); + eventtab[ev_copper].active = 1; + eventtab[ev_copper].evtime = get_cycles () + cycle_count * CYCLE_UNIT; + events_schedule (); + } } -static int custom_wput_copper(int hpos, uaecptr addr, uae_u32 value, int noget) +STATIC_INLINE int custom_wput_copper (int hpos, uaecptr addr, uae_u32 value, int noget) { int v; - hpos += hack_delay_shift; - //value = debug_wputpeekdma_chipset(0xdff000 + addr, value, MW_MASK_COPPER, 0x08c); copper_access = 1; - v = custom_wput_1(hpos, addr, value, noget); + v = custom_wput_1 (hpos, addr, value, noget); copper_access = 0; return v; } -//static void dump_copper(const TCHAR *error, int until_hpos) -//{ -// write_log(_T("\n")); -// write_log(_T("%s: vpos=%d until_hpos=%d vp=%d\n"), -// error, vpos, until_hpos, vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80)); -// write_log(_T("cvcmp=%d chcmp=%d chpos=%d cvpos=%d ci1=%04X ci2=%04X\n"), -// cop_state.vcmp, cop_state.hcmp, cop_state.hpos, cop_state.vpos, cop_state.saved_i1, cop_state.saved_i2); -// write_log(_T("cstate=%d ip=%x SPCFLAGS=%x iscline=%d\n"), -// cop_state.state, cop_state.ip, regs.spcflags, copper_enabled_thisline); -// write_log(_T("\n")); -//} - // "emulate" chip internal delays, not the right place but fast and 99.9% programs // use only copper to write BPLCON1 etc.. (exception is HulkaMania/TSP..) // this table should be filled with zeros and done somewhere else.. static int customdelay[]= { - 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* 32 0x00 - 0x3e */ + 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* 32 0x00 - 0x3e */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x40 - 0x5e */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x60 - 0x7e */ 0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0, /* 0x80 - 0x9e */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 32 0xa0 - 0xde */ - /* BPLxPTH/BPLxPTL */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 16 */ - /* BPLCON0-3,BPLMOD1-2 */ + /* BPLxPTH/BPLxPTL */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 16 */ + /* BPLCON0-3,BPLMOD1-2 */ 0,0,0,0,0,0,0,0, /* 8 */ /* BPLxDAT */ 0,0,0,0,0,0,0,0, /* 8 */ - /* SPRxPTH/SPRxPTL */ - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 16 */ - /* SPRxPOS/SPRxCTL/SPRxDATA/SPRxDATB */ + /* SPRxPTH/SPRxPTL */ + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 16 */ + /* SPRxPOS/SPRxCTL/SPRxDATA/SPRxDATB */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - /* COLORxx */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - /* RESERVED */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + /* COLORxx */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + /* RESERVED */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; /* -CPU write COPJMP wakeup sequence when copper is waiting: -- Idle cycle (can be used by other DMA channel) -- Read word from current copper pointer (next word after wait instruction) to 1FE -This cycle can conflict with blitter DMA. -Normal copper cycles resume -- Write word from new copper pointer to 8C + CPU write COPJMP wakeup sequence when copper is waiting: + - Idle cycle (can be used by other DMA channel) + - Read word from current copper pointer (next word after wait instruction) to 1FE + This cycle can conflict with blitter DMA. + Normal copper cycles resume + - Write word from new copper pointer to 8C */ -static void update_copper(int until_hpos) +static void update_copper (int until_hpos) { - int vp = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80); + int vp = vpos & (((cop_state.i2 >> 8) & 0x7F) | 0x80); int c_hpos = cop_state.hpos; + + if (nocustom()) { + eventtab[ev_copper].active = 0; + return; + } - if (nocustom()) - return; - - if (cop_state.state == COP_wait && vp < cop_state.vcmp) { - //dump_copper(_T("error2"), until_hpos); - copper_enabled_thisline = 0; - cop_state.state = COP_stop; - unset_special(SPCFLAG_COPPER); + if(currprefs.fast_copper) { + if (eventtab[ev_copper].active) { + eventtab[ev_copper].active = 0; + return; + } + } + + if (cop_state.state == COP_wait && vp < cop_state.vcmp) { + eventtab[ev_copper].active = 0; + copper_enabled_thisline = 0; + cop_state.state = COP_stop; + unset_special(SPCFLAG_COPPER); return; } - + if (until_hpos <= last_copper_hpos) return; - + if (until_hpos > (maxhpos & ~1)) until_hpos = maxhpos & ~1; - + for (;;) { int old_hpos = c_hpos; int hp; - + if (c_hpos >= until_hpos) break; - + /* So we know about the fetch state. */ - decide_line(c_hpos); + decide_line (c_hpos); // bitplane only, don't want blitter to steal our cycles. - decide_fetch(c_hpos); + decide_fetch (c_hpos); - if (cop_state.movedelay > 0) { - cop_state.movedelay--; - if (cop_state.movedelay == 0) { - custom_wput_copper(c_hpos, cop_state.moveaddr, cop_state.movedata, 0); - } - } + if (cop_state.movedelay) { // cop_state.movedelay is 0 or 1 + cop_state.movedelay = 0; + custom_wput_copper (c_hpos, cop_state.moveaddr, cop_state.movedata, 0); + if (! copper_enabled_thisline) + goto out; + } if ((c_hpos == maxhpos - 3) && (maxhpos & 1)) c_hpos += 1; else - c_hpos += 2; + c_hpos += 2; - switch (cop_state.state) - { - case COP_wait_in2: - if (copper_cant_read(old_hpos, 0)) - continue; - cop_state.state = COP_wait1; - break; - case COP_skip_in2: - if (copper_cant_read(old_hpos, 0)) - continue; - cop_state.state = COP_skip1; - break; + switch (cop_state.state) + { + case COP_wait_in2: + if (copper_cant_read (old_hpos)) + continue; + cop_state.state = COP_wait1; + break; + case COP_skip_in2: + if (copper_cant_read (old_hpos)) + continue; + cop_state.state = COP_skip1; + break; - case COP_strobe_extra: - // Wait 1 copper cycle doing nothing - cop_state.state = COP_strobe_delay1; - break; - case COP_strobe_delay1: - // First cycle after COPJMP is just like normal first read cycle - // Cycle is used and needs to be free. - if (copper_cant_read(old_hpos, 1)) - continue; -#ifdef CPUEMU_13 - alloc_cycle(old_hpos, CYCLE_COPPER); -#endif - if (old_hpos == maxhpos - 2) { - // if COP_strobe_delay2 would cross scanlines (positioned immediately - // after first strobe/refresh slot) it will disappear! - cop_state.state = COP_read1; - if (cop_state.strobe == 1) - cop_state.ip = cop1lc; - else - cop_state.ip = cop2lc; - cop_state.strobe = 0; - } - else { - cop_state.state = COP_strobe_delay2; - cop_state.ip += 2; - } - break; - case COP_strobe_delay2: - // Second cycle after COPJMP. This is the strange one. - // This cycle does not need to be free - // But it still gets allocated by copper if it is free = CPU and blitter can't use it. -#ifdef CPUEMU_13 - if (!copper_cant_read(old_hpos, 0)) { - alloc_cycle(old_hpos, CYCLE_COPPER); -#ifdef DEBUGGER - if (debug_dma) - record_dma(0x1fe, chipmem_wget_indirect(cop_state.ip), cop_state.ip, old_hpos, vpos, DMARECORD_COPPER); - if (memwatch_enabled) - debug_wgetpeekdma_chipram(cop_state.ip, chipmem_wget_indirect(cop_state.ip), MW_MASK_COPPER, 0x1fe); -#endif - } -#endif - cop_state.state = COP_read1; - // Next cycle finally reads from new pointer - if (cop_state.strobe == 1) - cop_state.ip = cop1lc; - else - cop_state.ip = cop2lc; - cop_state.strobe = 0; - break; + case COP_strobe_extra: + // Wait 1 copper cycle doing nothing + cop_state.state = COP_strobe_delay1; + break; + case COP_strobe_delay1: + // First cycle after COPJMP is just like normal first read cycle + // Cycle is used and needs to be free. + if (copper_cant_read (old_hpos)) + continue; + if (old_hpos == maxhpos - 2) { + // if COP_strobe_delay2 would cross scanlines (positioned immediately + // after first strobe/refresh slot) it will disappear! + cop_state.state = COP_read1; + if (cop_state.strobe == 1) + cop_state.ip = cop1lc; + else + cop_state.ip = cop2lc; + cop_state.strobe = 0; + } else { + cop_state.state = COP_strobe_delay2; + cop_state.ip += 2; + } + break; + case COP_strobe_delay2: + // Second cycle after COPJMP. This is the strange one. + // This cycle does not need to be free + // But it still gets allocated by copper if it is free = CPU and blitter can't use it. + cop_state.state = COP_read1; + // Next cycle finally reads from new pointer + if (cop_state.strobe == 1) + cop_state.ip = cop1lc; + else + cop_state.ip = cop2lc; + cop_state.strobe = 0; + break; - case COP_strobe_delay1x: + case COP_strobe_delay1x: // First cycle after COPJMP and Copper was waiting. - cop_state.state = COP_strobe_delay2x; - break; - case COP_strobe_delay2x: + cop_state.state = COP_strobe_delay2x; + break; + case COP_strobe_delay2x: // Second cycle fetches following word and tosses it away. // Cycle can be free and copper won't allocate it. // If Blitter uses this cycle = Copper's PC gets copied to blitter DMA pointer.. - if (copper_cant_read(old_hpos, 1)) - continue; -#ifdef CPUEMU_13 - cycle_line[old_hpos] |= CYCLE_COPPER_SPECIAL; -#endif - cop_state.state = COP_read1; - // Next cycle finally reads from new pointer - if (cop_state.strobe == 1) - cop_state.ip = cop1lc; - else - cop_state.ip = cop2lc; - cop_state.strobe = 0; - break; + if (copper_cant_read (old_hpos)) + continue; + cop_state.state = COP_read1; + // Next cycle finally reads from new pointer + if (cop_state.strobe == 1) + cop_state.ip = cop1lc; + else + cop_state.ip = cop2lc; + cop_state.strobe = 0; + break; - case COP_start_delay: + case COP_start_delay: // cycle after vblank strobe fetches word from old pointer first - if (copper_cant_read(old_hpos, 1)) - continue; - cop_state.state = COP_read1; - cop_state.i1 = last_custom_value1 = chipmem_wget_indirect(cop_state.ip); -#ifdef CPUEMU_13 - alloc_cycle(old_hpos, CYCLE_COPPER); -#endif - cop_state.ip = cop1lc; - break; + if (copper_cant_read (old_hpos)) + continue; + cop_state.state = COP_read1; + cop_state.i1 = last_custom_value1 = chipmem_wget_indirect (cop_state.ip); + cop_state.ip = cop1lc; + break; - case COP_read1: - if (copper_cant_read(old_hpos, 1)) - continue; - cop_state.i1 = last_custom_value1 = chipmem_wget_indirect(cop_state.ip); -#ifdef CPUEMU_13 - alloc_cycle(old_hpos, CYCLE_COPPER); -#endif - cop_state.ip += 2; - cop_state.state = COP_read2; - break; + case COP_read1: + if (copper_cant_read (old_hpos)) + continue; + cop_state.i1 = last_custom_value1 = chipmem_wget_indirect (cop_state.ip); + cop_state.ip += 2; + cop_state.state = COP_read2; + break; + + case COP_read2: + if (copper_cant_read (old_hpos)) + continue; + cop_state.i2 = last_custom_value1 = chipmem_wget_indirect (cop_state.ip); + cop_state.ip += 2; + + if (cop_state.i1 & 1) { // WAIT or SKIP + cop_state.ignore_next = 0; + if (cop_state.i2 & 1) + cop_state.state = COP_skip_in2; + else + cop_state.state = COP_wait_in2; + } else { // MOVE + unsigned int reg = cop_state.i1 & 0x1FE; + uae_u16 data = cop_state.i2; + cop_state.state = COP_read1; + test_copper_dangerous (reg); + if (! copper_enabled_thisline) + goto out; // was "dangerous" register -> copper stopped - case COP_read2: - if (copper_cant_read(old_hpos, 1)) - continue; - cop_state.i2 = last_custom_value1 = chipmem_wget_indirect(cop_state.ip); -#ifdef CPUEMU_13 - alloc_cycle(old_hpos, CYCLE_COPPER); -#endif - cop_state.ip += 2; - cop_state.saved_i1 = cop_state.i1; - cop_state.saved_i2 = cop_state.i2; - cop_state.saved_ip = cop_state.ip; + if (cop_state.ignore_next) { + reg = 0x1fe; + cop_state.ignore_next = 0; + } - if (cop_state.i1 & 1) { // WAIT or SKIP - cop_state.ignore_next = 0; - if (cop_state.i2 & 1) - cop_state.state = COP_skip_in2; - else - cop_state.state = COP_wait_in2; - - } - else { // MOVE - - unsigned int reg = cop_state.i1 & 0x1FE; - uae_u16 data = cop_state.i2; - cop_state.state = COP_read1; - - test_copper_dangerous(reg); - if (!copper_enabled_thisline) - goto out; // was "dangerous" register -> copper stopped - - if (cop_state.ignore_next) - reg = 0x1fe; - - if (reg == 0x88) { - cop_state.strobe = 1; - cop_state.state = COP_strobe_delay1; - } - else if (reg == 0x8a) { - cop_state.strobe = 2; - cop_state.state = COP_strobe_delay1; - } - else { - - // FIX: all copper writes happen 1 cycle later than CPU writes - if (customdelay[reg / 2]) { - cop_state.moveaddr = reg; - cop_state.movedata = data; - cop_state.movedelay = customdelay[cop_state.moveaddr / 2]; - } - else { - custom_wput_copper(old_hpos, reg, data, 0); - } - } - cop_state.ignore_next = 0; - } - check_copper_stop(); - break; - - case COP_wait1: - cop_state.state = COP_wait; - - cop_state.vcmp = (cop_state.saved_i1 & (cop_state.saved_i2 | 0x8000)) >> 8; - cop_state.hcmp = (cop_state.saved_i1 & cop_state.saved_i2 & 0xFE); - - vp = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80); - - if (cop_state.saved_i1 == 0xFFFF && cop_state.saved_i2 == 0xFFFE) { - cop_state.state = COP_waitforever; - copper_enabled_thisline = 0; - unset_special(SPCFLAG_COPPER); - goto out; - } - if (vp < cop_state.vcmp) { - copper_enabled_thisline = 0; - unset_special(SPCFLAG_COPPER); - goto out; - } - - /* fall through */ - case COP_wait: - { - int ch_comp = c_hpos; - if (ch_comp & 1) - ch_comp = 0; - - /* First handle possible blitter wait - * Must be before following free cycle check - */ - if ((cop_state.saved_i2 & 0x8000) == 0) { - decide_blitter(old_hpos); - if (bltstate != BLT_done) { - /* We need to wait for the blitter. */ - cop_state.state = COP_bltwait; + if (reg == 0x88) { + cop_state.strobe = 1; + cop_state.state = COP_strobe_delay1; + } else if (reg == 0x8a) { + cop_state.strobe = 2; + cop_state.state = COP_strobe_delay1; + } else { + // FIX: all copper writes happen 1 cycle later than CPU writes + if (customdelay[reg / 2]) { + cop_state.moveaddr = reg; + cop_state.movedata = data; + cop_state.movedelay = 1; + } else { + custom_wput_copper (old_hpos, reg, data, 0); + } + } + } + check_copper_stop(); + break; + + case COP_wait1: + cop_state.state = COP_wait; + + cop_state.vcmp = (cop_state.i1 & (cop_state.i2 | 0x8000)) >> 8; + cop_state.hcmp = (cop_state.i1 & cop_state.i2 & 0xFE); + + vp = vpos & (((cop_state.i2 >> 8) & 0x7F) | 0x80); + + if (cop_state.i1 == 0xFFFF && cop_state.i2 == 0xFFFE) { + cop_state.state = COP_waitforever; copper_enabled_thisline = 0; - unset_special(SPCFLAG_COPPER); + unset_special (SPCFLAG_COPPER); goto out; } - } + if (vp < cop_state.vcmp) { + copper_enabled_thisline = 0; + unset_special (SPCFLAG_COPPER); + goto out; + } + + /* fall through */ + case COP_wait: + { + int ch_comp = c_hpos; + if (ch_comp & 1) + ch_comp = 0; - if (copper_cant_read(old_hpos, 0)) - continue; - - hp = ch_comp & (cop_state.saved_i2 & 0xFE); - if (vp == cop_state.vcmp && hp < cop_state.hcmp) + /* First handle possible blitter wait + * Must be before following free cycle check + */ + if ((cop_state.i2 & 0x8000) == 0) { + if (bltstate != BLT_done) { + /* We need to wait for the blitter. */ + cop_state.state = COP_bltwait; + copper_enabled_thisline = 0; + unset_special (SPCFLAG_COPPER); + goto out; + } + } + + if (copper_cant_read (old_hpos)) + continue; + + hp = ch_comp & (cop_state.i2 & 0xFE); + if (vp == cop_state.vcmp && hp < cop_state.hcmp) { + /* Position not reached yet. */ + if(currprefs.fast_copper) { + if ((cop_state.i2 & 0xFE) == 0xFE) { + int wait_finish = cop_state.hcmp - 2; + /* This will leave c_hpos untouched if it's equal to wait_finish. */ + if (wait_finish < c_hpos) + return; + else if (wait_finish <= until_hpos) { + c_hpos = wait_finish; + } else + c_hpos = until_hpos; + } + } + break; + } + + cop_state.state = COP_read1; + } break; + + case COP_skip1: + { + unsigned int vcmp, hcmp, vp1, hp1; - cop_state.state = COP_read1; - } - break; + if (c_hpos >= (maxhpos & ~1) || (c_hpos & 1)) + break; - case COP_skip1: - { - unsigned int vcmp, hcmp, vp1, hp1; + if (copper_cant_read (old_hpos)) + continue; - if (c_hpos >= (maxhpos & ~1) || (c_hpos & 1)) + vcmp = (cop_state.i1 & (cop_state.i2 | 0x8000)) >> 8; + hcmp = (cop_state.i1 & cop_state.i2 & 0xFE); + vp1 = vpos & (((cop_state.i2 >> 8) & 0x7F) | 0x80); + hp1 = c_hpos & (cop_state.i2 & 0xFE); + + if ((vp1 > vcmp || (vp1 == vcmp && hp1 >= hcmp)) && ((cop_state.i2 & 0x8000) != 0 || bltstate == BLT_done)) + cop_state.ignore_next = 1; + + cop_state.state = COP_read1; + break; + } + default: break; - - if (copper_cant_read(old_hpos, 0)) - continue; - - vcmp = (cop_state.saved_i1 & (cop_state.saved_i2 | 0x8000)) >> 8; - hcmp = (cop_state.saved_i1 & cop_state.saved_i2 & 0xFE); - vp1 = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80); - hp1 = c_hpos & (cop_state.saved_i2 & 0xFE); - - if ((vp1 > vcmp || (vp1 == vcmp && hp1 >= hcmp)) && ((cop_state.saved_i2 & 0x8000) != 0 || bltstate == BLT_done)) - cop_state.ignore_next = 1; - - cop_state.state = COP_read1; - - break; - } - default: - break; } } - + out: cop_state.hpos = c_hpos; last_copper_hpos = until_hpos; + + if(currprefs.fast_copper) { + /* The test against maxhpos also prevents us from calling predict_copper + when we are being called from hsync_handler, which would not only be + stupid, but actively harmful. */ + if ((regs.spcflags & SPCFLAG_COPPER) && (c_hpos + 8 < maxhpos)) + predict_copper (); + } } -static void compute_spcflag_copper(int hpos) +static void compute_spcflag_copper (int hpos) { int wasenabled = copper_enabled_thisline; copper_enabled_thisline = 0; - unset_special(SPCFLAG_COPPER); - if (!dmaen(DMA_COPPER) || cop_state.state == COP_stop || cop_state.state == COP_waitforever || cop_state.state == COP_bltwait || nocustom()) + unset_special (SPCFLAG_COPPER); + if (!dmaen (DMA_COPPER) || cop_state.state == COP_stop || cop_state.state == COP_waitforever || cop_state.state == COP_bltwait || nocustom()) return; - + if (cop_state.state == COP_wait) { - int vp = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80); - + int vp = vpos & (((cop_state.i2 >> 8) & 0x7F) | 0x80); + if (vp < cop_state.vcmp) return; } @@ -6293,8 +5043,8 @@ static void compute_spcflag_copper(int hpos) // (write to DMACON for example) hpos+1 for long lines if (!wasenabled && cop_state.hpos < hpos && hpos < maxhpos) { hpos = (hpos + 2) & ~1; - if (hpos >(maxhpos_short & ~1)) - hpos = maxhpos_short & ~1; + if (hpos > (maxhpos & ~1)) + hpos = maxhpos & ~1; cop_state.hpos = hpos; } @@ -6305,145 +5055,167 @@ static void compute_spcflag_copper(int hpos) cop_state.state = COP_strobe_delay1; copper_enabled_thisline = 1; - set_special(SPCFLAG_COPPER); + + if(currprefs.fast_copper) { + predict_copper (); + if (! eventtab[ev_copper].active) + set_special (SPCFLAG_COPPER); + } + else + set_special (SPCFLAG_COPPER); } -void blitter_done_notify(int hpos) +static void copper_handler (void) +{ + /* This will take effect immediately, within the same cycle. */ + set_special (SPCFLAG_COPPER); + + if (! copper_enabled_thisline) + return; + + eventtab[ev_copper].active = 0; +} + +void blitter_done_notify (void) { if (cop_state.state != COP_bltwait) return; - - int vp_wait = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80); + + int vp_wait = vpos & (((cop_state.i2 >> 8) & 0x7F) | 0x80); int vp = vpos; - hpos++; + int hpos = current_hpos() + 1; hpos &= ~1; if (hpos >= maxhpos) { hpos -= maxhpos; vp++; } cop_state.hpos = hpos; - cop_state.vpos = vp; cop_state.state = COP_wait; /* No need to check blitter state again */ - cop_state.saved_i2 |= 0x8000; + cop_state.i2 |= 0x8000; if (dmaen(DMA_COPPER) && vp_wait >= cop_state.vcmp) { copper_enabled_thisline = 1; set_special(SPCFLAG_COPPER); - } - else { - unset_special(SPCFLAG_COPPER); + } else { + unset_special (SPCFLAG_COPPER); } } -void do_copper(void) +void do_copper (void) { - int hpos = current_hpos(); - update_copper(hpos); + int hpos = current_hpos (); + update_copper (hpos); } /* ADDR is the address that is going to be read/written; this access is -the reason why we want to update the copper. This function is also -used from hsync_handler to finish up the line; for this case, we check -hpos against maxhpos. */ -STATIC_INLINE void sync_copper_with_cpu(int hpos, int do_schedule) + the reason why we want to update the copper. This function is also + used from hsync_handler to finish up the line; for this case, we check + hpos against maxhpos. */ +STATIC_INLINE void sync_copper_with_cpu (int hpos, int do_schedule, unsigned int addr) { + if (eventtab[ev_copper].active) { + if (hpos != maxhpos) { + /* There might be reasons why we don't actually need to bother + updating the copper. */ + if (hpos < cop_state.first_sync) + return; + + if ((cop_state.regtypes_modified & regtypes[addr & 0x1FE]) == 0) + return; + } + + eventtab[ev_copper].active = 0; + if (do_schedule) + events_schedule (); + set_special (SPCFLAG_COPPER); + } + /* Need to let the copper advance to the current position. */ if (copper_enabled_thisline) - update_copper(hpos); + update_copper (hpos); } -static void cursorsprite(void) +STATIC_INLINE uae_u16 sprite_fetch(struct sprite *s, uaecptr pt) { - if (!dmaen(DMA_SPRITE) || first_planes_vpos == 0) - return; - sprite_0 = spr[0].pt; - sprite_0_height = spr[0].vstop - spr[0].vstart; - sprite_0_colors[0] = 0; - sprite_0_doubled = 0; - if (sprres == 0) - sprite_0_doubled = 1; - if (currprefs.chipset_mask & CSMASK_AGA) { - int sbasecol = ((bplcon4 >> 4) & 15) << 4; - sprite_0_colors[1] = current_colors.color_regs_aga[sbasecol + 1]; - sprite_0_colors[2] = current_colors.color_regs_aga[sbasecol + 2]; - sprite_0_colors[3] = current_colors.color_regs_aga[sbasecol + 3]; - } - else { - sprite_0_colors[1] = xcolors[current_colors.color_regs_ecs[17]]; - sprite_0_colors[2] = xcolors[current_colors.color_regs_ecs[18]]; - sprite_0_colors[3] = xcolors[current_colors.color_regs_ecs[19]]; - } - sprite_0_width = sprite_width; - //if (currprefs.input_tablet && (currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC)) { - // if (currprefs.input_magic_mouse_cursor == MAGICMOUSE_HOST_ONLY && mousehack_alive()) - // magic_sprite_mask &= ~1; - // else - // magic_sprite_mask |= 1; - //} + last_custom_value1 = chipmem_wget_indirect (pt); + return last_custom_value1; } -static uae_u16 sprite_fetch(struct sprite *s, int dma, int hpos, int cycle, int mode) +STATIC_INLINE void sprite_fetch_full(struct sprite *s, int hpos, uae_u16 *v0, uae_u32 *v1, uae_u32 *v2) { - uae_u16 data = last_custom_value1; - if (dma) { - if (cycle && currprefs.cpu_memory_cycle_exact) - s->ptxhpos = hpos; - data = last_custom_value1 = chipmem_wget_indirect(s->pt); - alloc_cycle(hpos, CYCLE_SPRITE); + uae_u32 data321 = 0, data322 = 0; + uae_u16 data16; + + if (sprite_width == 16) { + + data16 = sprite_fetch (s, s->pt); + s->pt += 2; + + } else if (sprite_width == 64) { + + uaecptr pm = s->pt & ~7; + uaecptr pm1, pm2; + if (s->pt & 4) { + pm1 = pm + 4; + pm2 = pm + 4; + } else { + pm1 = pm; + pm2 = pm + 4; + } + data321 = sprite_fetch(s, pm1) << 16; + data321 |= chipmem_wget_indirect(pm1 + 2); + data322 = chipmem_wget_indirect(pm2) << 16; + data322 |= chipmem_wget_indirect(pm2 + 2); + if (s->pt & 2) { + data321 &= 0x0000ffff; + data322 &= 0x0000ffff; + data321 |= data321 << 16; + data322 |= data322 << 16; + } + data16 = data321 >> 16; + s->pt += 8; + + } else { // 32 + + uaecptr pm = s->pt & ~3; + data321 = sprite_fetch(s, pm) << 16; + data321 |= chipmem_wget_indirect(pm + 2); + if (s->pt & 2) { + data321 &= 0x0000ffff; + data321 |= data321 << 16; + } else if (fetchmode_fmode & 8) { + data321 &= 0xffff0000; + data321 |= data321 >> 16; + } + data16 = data321 >> 16; + s->pt += 4; + } - s->pt += 2; - return data; -} -static uae_u16 sprite_fetch2(struct sprite *s, int hpos, int cycle, int mode) -{ - uae_u16 data = chipmem_wget_indirect(s->pt); - s->pt += 2; - return data; + + *v0 = data16; + *v1 = data321; + *v2 = data322; } -static void do_sprites_1(int num, int cycle, int hpos) +STATIC_INLINE void do_sprites_1(int num, int cycle, int hpos) { struct sprite *s = &spr[num]; int posctl = 0; uae_u16 data; // fetch both sprite pairs even if DMA was switched off between sprites - int isdma = dmaen(DMA_SPRITE) || ((num & 1) && spr[num & ~1].dmacycle); + int isdma = dmaen (DMA_SPRITE) || ((num & 1) && spr[num & ~1].dmacycle); + bool unaligned = (spr[num].pt & 2) != 0; - if (cant_this_last_line()) - return; - - // see SPRxCTRL below - // if (isdma && vpos == sprite_vblank_endline) - // spr_arm (num, 0); - -#ifdef AGA if (isdma && s->dblscan && (fmode & 0x8000) && (vpos & 1) != (s->vstart & 1) && s->dmastate) { - spr_arm(num, 1); + spr_arm (num, 1); return; } -#endif -#if SPRITE_DEBUG >= 3 * 256 - if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY && (SPRITE_DEBUG & (1 << num))) - write_log(_T("%d:%d:slot%d:%d\n"), vpos, hpos, num, cycle); -#endif if (vpos == s->vstart) { -#if SPRITE_DEBUG > 0 - if (!s->dmastate && vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY && (SPRITE_DEBUG & (1 << num))) - write_log(_T("%d:%d:SPR%d START\n"), vpos, hpos, num); -#endif s->dmastate = 1; - if (s->ptxvpos2 == vpos && hpos < s->ptxhpos2) - return; - if (num == 0 && cycle == 0) - cursorsprite(); } if (vpos == s->vstop || vpos == sprite_vblank_endline) { -#if SPRITE_DEBUG > 0 - if (s->dmastate && vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY && (SPRITE_DEBUG & (1 << num))) - write_log(_T("%d:%d:SPR%d STOP\n"), vpos, hpos, num); -#endif s->dmastate = 0; } @@ -6457,248 +5229,151 @@ static void do_sprites_1(int num, int cycle, int hpos) s->dmastate = 0; posctl = 1; if (dma) { - data = sprite_fetch(s, dma, hpos, cycle, 0); - switch (sprite_width) - { - case 64: - sprite_fetch2(s, hpos, cycle, 0); - sprite_fetch2(s, hpos, cycle, 0); - case 32: - sprite_fetch2(s, hpos, cycle, 0); - break; - } + uae_u32 data321, data322; + sprite_fetch_full(s, hpos, &data, &data321, &data322); if (cycle == 0) { if (start_before_dma && s->armed) { maybe_decide_sprites(num, hpos); } - SPRxPOS_1(data, num, hpos); + SPRxPOS_1 (data, num); s->dmacycle = 1; - } - else { + } else { // This is needed to disarm previous field's sprite. // It can be seen on OCS Agnus + ECS Denise combination where // this cycle is disabled due to weird DDFTSTR=$18 copper list // which causes corrupted sprite to "wrap around" the display. - SPRxCTL_1(data, num, hpos); + SPRxCTL_1 (data, num); s->dmastate = 0; - sprstartstop(s); + sprstartstop (s); } } if (vpos == sprite_vblank_endline) { // s->vstart == sprite_vblank_endline won't enable the sprite. s->dmastate = 0; } -#if SPRITE_DEBUG >= 256 - if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY && (SPRITE_DEBUG & (1 << num))) { - write_log(_T("%d:%d:dma:P=%06X "), vpos, hpos, s->pt); - } -#endif } if (s->dmastate && !posctl && dma) { - data = sprite_fetch(s, dma, hpos, cycle, 1); -#if SPRITE_DEBUG >= 256 - if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY && (SPRITE_DEBUG & (1 << num))) { - write_log(_T("%d:%d:dma:P=%06X "), vpos, hpos, s->pt); - } -#endif + uae_u32 data321, data322; + sprite_fetch_full(s, hpos, &data, &data321, &data322); if (cycle == 0) { // if xpos is earlier than this cycle, decide it first. if (start_before_dma) { maybe_decide_sprites(num, hpos); } - SPRxDATA_1(data, num, hpos); + SPRxDATA_1 (data, num); s->dmacycle = 1; - } - else { + } else { // This is needed if xpos is between DATA and DATB fetches // Test does not need to be accurate, only purpose is to // not lose performance when sprites have "normal" positioning. if (start_before_dma) { maybe_decide_sprites(num, hpos); } - SPRxDATB_1(data, num, hpos); + SPRxDATB_1 (data, num); } -#ifdef AGA switch (sprite_width) { case 64: - { - uae_u16 data32 = sprite_fetch2(s, hpos, cycle, 1); - uae_u16 data641 = sprite_fetch2(s, hpos, cycle, 1); - uae_u16 data642 = sprite_fetch2(s, hpos, cycle, 1); - if (dma) { - if (cycle == 0) { - sprdata[num][3] = data642; - sprdata[num][2] = data641; - sprdata[num][1] = data32; - } - else { - sprdatb[num][3] = data642; - sprdatb[num][2] = data641; - sprdatb[num][1] = data32; - } + if (cycle == 0) { + sprdata[num][1] = data321; + sprdata[num][2] = data322 >> 16; + sprdata[num][3] = data322; + } else { + sprdatb[num][1] = data321; + sprdatb[num][2] = data322 >> 16; + sprdatb[num][3] = data322; } - } - break; + break; case 32: - { - uae_u16 data32 = sprite_fetch2(s, hpos, cycle, 1); - if (dma) { - if (cycle == 0) - sprdata[num][1] = data32; - else - sprdatb[num][1] = data32; - } - } - break; - } -#endif - } -} - -static void do_sprites(int hpos) -{ - int maxspr, minspr; - int i; - - if (vpos < sprite_vblank_endline) - return; - - if (doflickerfix() && interlace_seen && (next_lineno & 1)) - return; - - maxspr = hpos; - minspr = last_sprite_hpos + 1; - - if (minspr >= maxspr || last_sprite_hpos == hpos) - return; - - if (maxspr >= SPR0_HPOS + MAX_SPRITES * 4) - maxspr = SPR0_HPOS + MAX_SPRITES * 4 - 1; - if (minspr < SPR0_HPOS) - minspr = SPR0_HPOS; - - if (minspr == maxspr) - return; - - for (i = minspr; i <= maxspr; i++) { - int cycle = -1; - int num = (i - SPR0_HPOS) / 4; - switch ((i - SPR0_HPOS) & 3) - { - case 0: - cycle = 0; - spr[num].dmacycle = 0; - break; - case 2: - cycle = 1; + if (cycle == 0) + sprdata[num][1] = data321; + else + sprdatb[num][1] = data321; break; } - if (cycle >= 0) { - spr[num].ptxhpos = MAXHPOS; - do_sprites_1(num, cycle, i); - } } - - last_sprite_hpos = hpos; } -static void init_sprites(void) +static void do_sprites (int hpos) { - memset(sprpos, 0, sizeof sprpos); - memset(sprctl, 0, sizeof sprctl); + int maxspr, minspr; + int i; + + if (vpos < sprite_vblank_endline) + return; + + maxspr = hpos; + minspr = last_sprite_hpos + 1; + + if (minspr >= maxspr || last_sprite_hpos == hpos) + return; + + if (maxspr >= SPR0_HPOS + MAX_SPRITES * 4) + maxspr = SPR0_HPOS + MAX_SPRITES * 4 - 1; + if (minspr < SPR0_HPOS) + minspr = SPR0_HPOS; + + if (minspr == maxspr) + return; + + for (i = minspr; i <= maxspr; i++) { + int cycle = -1; + int num = (i - SPR0_HPOS) / 4; + switch ((i - SPR0_HPOS) & 3) + { + case 0: + cycle = 0; + spr[num].dmacycle = 0; + break; + case 2: + cycle = 1; + break; + } + if (cycle >= 0) { + do_sprites_1 (num, cycle, i); + } + } + + last_sprite_hpos = hpos; } -static void init_hardware_frame(void) +static void init_sprites (void) { - int i; - - first_bpl_vpos = -1; - next_lineno = 0; - prev_lineno = -1; - nextline_how = nln_normal; - diwstate = DIW_waiting_start; - ddfstate = DIW_waiting_start; - - if (first_bplcon0 != first_bplcon0_old) { - vertical_changed = horizontal_changed = true; - } - first_bplcon0_old = first_bplcon0; - - if (first_planes_vpos != first_planes_vpos_old || - last_planes_vpos != last_planes_vpos_old) { - vertical_changed = true; - } - first_planes_vpos_old = first_planes_vpos; - last_planes_vpos_old = last_planes_vpos; - - if (diwfirstword_total != diwfirstword_total_old || - diwlastword_total != diwlastword_total_old || - ddffirstword_total != ddffirstword_total_old || - ddflastword_total != ddflastword_total_old) { - horizontal_changed = true; - } - diwfirstword_total_old = diwfirstword_total; - diwlastword_total_old = diwlastword_total; - ddffirstword_total_old = ddffirstword_total; - ddflastword_total_old = ddflastword_total; - - first_planes_vpos = 0; - last_planes_vpos = 0; - diwfirstword_total = max_diwlastword; - diwlastword_total = 0; - ddffirstword_total = max_diwlastword; - ddflastword_total = 0; - plflastline_total = 0; - plffirstline_total = current_maxvpos(); - first_bplcon0 = 0; - autoscale_bordercolors = 0; - - for (i = 0; i < MAX_SPRITES; i++) { - spr[i].ptxhpos = MAXHPOS; - spr[i].ptxvpos2 = -1; - } - plf_state = plf_end; + memset (sprpos, 0, sizeof sprpos); + memset (sprctl, 0, sizeof sprctl); } -void init_hardware_for_drawing_frame(void) +static void init_hardware_frame (void) +{ + next_lineno = 0; + prev_lineno = -1; + diwstate = DIW_waiting_start; + ddfstate = DIW_waiting_start; + plf_state = plf_end; +} + +void init_hardware_for_drawing_frame (void) { /* Avoid this code in the first frame after a customreset. */ - if (prev_sprite_entries) { - int first_pixel = prev_sprite_entries[0].first_pixel; - int npixels = prev_sprite_entries[prev_next_sprite_entry].first_pixel - first_pixel; - memset(spixels + first_pixel, 0, npixels * sizeof *spixels); - memset(spixstate.bytes + first_pixel, 0, npixels * sizeof *spixstate.bytes); + if (next_sprite_entry > 0) { + int npixels = curr_sprite_entries[next_sprite_entry].first_pixel; + memset(spixels, 0, npixels * sizeof *spixels); + memset(spixstate.bytes, 0, npixels * sizeof *spixstate.bytes); } - prev_next_sprite_entry = next_sprite_entry; - + next_color_change = 0; next_sprite_entry = 0; next_color_entry = 0; remembered_color_entry = -1; - - prev_sprite_entries = sprite_entries[current_change_set]; - curr_sprite_entries = sprite_entries[current_change_set ^ 1]; - prev_color_changes = color_changes[current_change_set]; - curr_color_changes = color_changes[current_change_set ^ 1]; - prev_color_tables = color_tables[current_change_set]; - curr_color_tables = color_tables[current_change_set ^ 1]; - - prev_drawinfo = line_drawinfo[current_change_set]; - curr_drawinfo = line_drawinfo[current_change_set ^ 1]; - current_change_set ^= 1; - - color_src_match = color_dest_match = -1; - - /* Use both halves of the array in alternating fashion. */ - curr_sprite_entries[0].first_pixel = current_change_set * MAX_SPR_PIXELS; + + curr_sprite_entries[0].first_pixel = 0; next_sprite_forced = 1; } -static int rpt_vsync(int adjust) +static int rpt_vsync (void) { - frame_time_t curr_time = read_processor_time(); - int v = curr_time - vsyncwaittime + adjust; + frame_time_t curr_time = read_processor_time (); + int v = curr_time - vsyncwaittime; if (v > syncbase || v < -syncbase) { vsyncmintime = vsyncmaxtime = vsyncwaittime = curr_time; v = 0; @@ -6706,30 +5381,17 @@ static int rpt_vsync(int adjust) return v; } -static void rtg_vsync(void) +STATIC_INLINE void rtg_vsync (void) { #ifdef PICASSO96 frame_time_t start, end; - start = read_processor_time(); - picasso_handle_vsync(); - end = read_processor_time(); + start = read_processor_time (); + picasso_handle_vsync (); + end = read_processor_time (); frameskiptime += end - start; #endif } -static void rtg_vsynccheck(void) -{ - //if (vblank_found_rtg) { - // vblank_found_rtg = false; - rtg_vsync(); - //} -} - -static void maybe_process_pull_audio(void) -{ - //audio_finish_pull(); -} - // moving average algorithm #define MAVG_MAX_SIZE 128 struct mavg_data @@ -6740,20 +5402,19 @@ struct mavg_data int mavg; }; -static void mavg_clear(struct mavg_data *md) +static void mavg_clear (struct mavg_data *md) { md->size = 0; md->offset = 0; md->mavg = 0; } -static int mavg(struct mavg_data *md, int newval, int size) +static int mavg (struct mavg_data *md, int newval, int size) { if (md->size < size) { md->values[md->size++] = newval; md->mavg += newval; - } - else { + } else { md->mavg -= md->values[md->offset]; md->values[md->offset] = newval; md->mavg += newval; @@ -6766,69 +5427,45 @@ static int mavg(struct mavg_data *md, int newval, int size) #define MAVG_VSYNC_SIZE 128 -extern int log_vsync, debug_vsync_min_delay, debug_vsync_forced_delay; -static bool framewait(void) +static bool framewait (void) { - //return true always //TODO check if this is needed - return true; - frame_time_t curr_time; frame_time_t start; - int vs = isvsync_chipset(); + frame_time_t time_for_next_frame = vsynctimebase; + int vs = isvsync_chipset (); int status = 0; is_syncline = 0; static struct mavg_data ma_frameskipt; - int frameskipt_avg = mavg(&ma_frameskipt, frameskiptime, MAVG_VSYNC_SIZE); + int frameskipt_avg = mavg (&ma_frameskipt, frameskiptime, MAVG_VSYNC_SIZE); frameskiptime = 0; if (vs > 0) { - static struct mavg_data ma_legacy; - static frame_time_t vsync_time; - int t; + if(!nodraw()) { + if (!frame_rendered && !picasso_on) + frame_rendered = render_screen (false); + + if (!frame_shown) { + show_screen (1); + } + curr_time = target_lastsynctime(); + } else { + curr_time = target_lastsynctime() + vsynctimebase; + + if(read_processor_time () > curr_time) + time_for_next_frame = curr_time - read_processor_time (); + } - curr_time = read_processor_time(); vsyncwaittime = vsyncmaxtime = curr_time + vsynctimebase; - if (!frame_rendered && !picasso_on) { - updatedisplayarea(); - frame_rendered = true; - } - - start = read_processor_time(); - t = 0; - if (int(start) - int(vsync_time) >= 0 && int(start) - int(vsync_time) < vsynctimebase) - t += int(start) - int(vsync_time); - - if (!frame_shown) { - updatedisplayarea(); - if (currprefs.gfx_apmode[0].gfx_strobo) - updatedisplayarea(); - } - - maybe_process_pull_audio(); - - int legacy_avg = mavg(&ma_legacy, t, MAVG_VSYNC_SIZE); - if (t > legacy_avg) - legacy_avg = t; - t = legacy_avg; - - /*if (debug_vsync_min_delay && t < debug_vsync_min_delay * vsynctimebase / 100) - t = debug_vsync_min_delay * vsynctimebase / 100; - if (debug_vsync_forced_delay > 0) - t = debug_vsync_forced_delay * vsynctimebase / 100;*/ - - vsync_time = read_processor_time(); - if (t > vsynctimebase * 2 / 3) - t = vsynctimebase * 2 / 3; - + vsyncmintime = curr_time; + if (currprefs.m68k_speed < 0) { - vsynctimeperline = (vsynctimebase - t) / (maxvpos_display + 1); - } - else { - vsynctimeperline = (vsynctimebase - t) / 3; + vsynctimeperline = (time_for_next_frame) / (maxvpos_display + 1); + } else { + vsynctimeperline = (time_for_next_frame) / 3; } if (vsynctimeperline < 1) @@ -6836,256 +5473,59 @@ static bool framewait(void) frame_shown = true; return 1; - - } - else if (vs < 0) { - - int freetime; - extern int extraframewait, extraframewait2; - - if (!vblank_hz_state) - return status != 0; - - if (vs == -2 || vs == -3) { - - // fastest possible - int max, adjust, flipdelay, val; - frame_time_t now; - static struct mavg_data ma_skip, ma_adjust; - - val = 0; - - if (!frame_rendered && !picasso_on) { - frame_time_t start, end; - start = read_processor_time(); - updatedisplayarea(); - frame_rendered = true; - end = read_processor_time(); - val += end - start; - } - - curr_time = 0;//vsync_busywait_end(&flipdelay); // vsync time - status = 0; //vsync_busywait_do(NULL, (bplcon0 & 4) != 0 && !lof_changed && !lof_changing, lof_store != 0); - //vsync_busywait_start(); - - now = read_processor_time(); // current time - adjust = (int)now - (int)curr_time; - //write_log (_T("%d "), adjust); - if (adjust < 0 || adjust >= vsynctimebase) - adjust = 0; - if (adjust > vsynctimebase * 2 / 3) - adjust = vsynctimebase * 2 / 3; - - int adjust_avg = mavg(&ma_adjust, adjust, MAVG_VSYNC_SIZE); - - val += adjust_avg; - - int flipdelay_avg = mavg(&ma_skip, flipdelay, MAVG_VSYNC_SIZE); - if (flipdelay > flipdelay_avg) - flipdelay_avg = flipdelay; - if (currprefs.gfx_apmode[0].gfx_vflip == 0) { - val += flipdelay_avg; - //write_log (_T("%d "), skipcnt); - } - val += frameskipt_avg; - - //if (currprefs.gfx_apmode[0].gfx_vflip == 0) { - // if (debug_vsync_min_delay && val < debug_vsync_min_delay * vsynctimebase / 100) - // val = debug_vsync_min_delay * vsynctimebase / 100; - // if (debug_vsync_forced_delay > 0) - // val = debug_vsync_forced_delay * vsynctimebase / 100; - //} - - //write_log (_T("%d "), adjust); - - if (val > vsynctimebase * 2 / 3) - val = vsynctimebase * 2 / 3; - - max = (int)((vsynctimebase - val) * (1000.0 + currprefs.m68k_speed_throttle) / 1000.0); - if (max < 1) - max = 1; - - vsyncmintime = now; - vsyncwaittime = curr_time + (vsynctimebase - 0); - - vsynctimeperline = max / (maxvpos_display + 1); - if (status <= 0 || vsynctimeperline < 1) - vsynctimeperline = 1; - vsyncmaxtime = now + max; - - //if (0 || (log_vsync & 2)) { - // write_log(_T("%05d:%05d:%05d=%05d:%05d/%05d %03d%%\n"), adjust_avg, frameskipt_avg, flipdelay_avg, - // val, vsynctimeperline, vsynctimebase, val * 100 / vsynctimebase); - //} - - frame_shown = true; - - } - else { - - int max, adjust, flipdelay, flipdelay_avg; - static struct mavg_data ma_skip; - frame_time_t now; - - flipdelay = 0; - curr_time = 0;//vsync_busywait_end(&flipdelay); - if (!frame_rendered && !picasso_on) - { - updatedisplayarea(); - frame_rendered = true; - } - - - status = 0;//vsync_busywait_do(&freetime, (bplcon0 & 4) != 0 && !lof_changed && !lof_changing, lof_store != 0); - //vsync_busywait_start(); - - now = read_processor_time(); - - maybe_process_pull_audio(); - //if (extraframewait && !currprefs.turbo_emulation) { - // cpu_sleep_millis(-extraframewait); - // maybe_process_pull_audio(); - //} - //else if (extraframewait2 && !currprefs.turbo_emulation) { - // uae_time_t add = ((uae_s64)extraframewait2) * syncbase / (1000 * 1000); - // frame_time_t efw = read_processor_time() + add; - // for (;;) { - // frame_time_t nfw = read_processor_time(); - // if (audio_is_pull_event()) - // break; - // if ((int)efw - (int)nfw <= 0) - // break; - // } - // maybe_process_pull_audio(); - //} - - adjust = (int)now - (int)curr_time; - int adjustx = adjust; - if (adjust < 0) - adjust = 0; - if (adjust > vsynctimebase) - adjust = 0; - if (adjust > vsynctimebase / 2) - adjust = vsynctimebase / 2; - - vsyncmintime = now; - vsyncwaittime = curr_time + vsynctimebase; - - if (currprefs.gfx_apmode[0].gfx_vflip == 0) { - flipdelay_avg = mavg(&ma_skip, flipdelay, MAVG_VSYNC_SIZE); - if (flipdelay > flipdelay_avg) - flipdelay_avg = flipdelay; - } - else { - flipdelay_avg = 0; - } - - max = vsynctimebase - adjust - flipdelay_avg; - - //if (currprefs.gfx_apmode[0].gfx_vflip == 0) { - // int val = vsynctimebase - max; - // if (debug_vsync_min_delay && val < debug_vsync_min_delay * vsynctimebase / 100) - // val = debug_vsync_min_delay * vsynctimebase / 100; - // if (debug_vsync_forced_delay > 0) - // val = debug_vsync_forced_delay * vsynctimebase / 100; - // max = vsynctimebase - val; - //} - - vsynctimeperline = max / 3; - if (status <= 0 || vsynctimeperline < 1) - vsynctimeperline = 1; - vsyncmaxtime = now + max; - - //if (0 || (log_vsync & 2)) { - // write_log(_T("%06d:%06d:%06d:%06d %06d/%06d %03d%%\n"), frameskipt_avg, flipdelay_avg, adjust, adjustx, - // vsynctimeperline, vsynctimebase, (vsynctimebase - max) * 100 / vsynctimebase); - //} - - frame_shown = true; - - } - return status != 0; } status = 1; - int clockadjust = 0; int vstb = vsynctimebase; - //if (currprefs.m68k_speed < 0 && !cpu_sleepmode && !currprefs.cpu_memory_cycle_exact) { if (currprefs.m68k_speed < 0) { - if (!frame_rendered && !picasso_on) { - updatedisplayarea(); - frame_rendered = true; - } + if (!frame_rendered && !picasso_on) + frame_rendered = render_screen (false); - if (currprefs.m68k_speed_throttle) { - // this delay can safely overshoot frame time by 1-2 ms, following code will compensate for it. - for (;;) { - curr_time = read_processor_time(); - if ((int)vsyncwaittime - (int)curr_time <= 0 || (int)vsyncwaittime - (int)curr_time > 2 * vsynctimebase) - break; - rtg_vsynccheck(); - //if (cpu_sleep_millis(1) < 0) { - // curr_time = read_processor_time(); - // break; - //} - } - } - else { - curr_time = read_processor_time(); - } + curr_time = read_processor_time (); int max; int adjust = 0; if ((int)curr_time - (int)vsyncwaittime > 0 && (int)curr_time - (int)vsyncwaittime < vstb / 2) adjust += curr_time - vsyncwaittime; - adjust += clockadjust; - max = (int)(vstb * (1000.0 + currprefs.m68k_speed_throttle) / 1000.0 - adjust); + max = (int)(vstb * (1000.0) / 1000.0 - adjust); vsyncwaittime = curr_time + vstb - adjust; vsyncmintime = curr_time; if (max < 0) { max = 0; vsynctimeperline = 1; - } - else { + } else { vsynctimeperline = max / (maxvpos_display + 1); } vsyncmaxtime = curr_time + max; - } - else { + + } else { int t = 0; if (!frame_rendered && !picasso_on) { - start = read_processor_time(); - updatedisplayarea(); - frame_rendered = true; - t = read_processor_time() - start; + start = read_processor_time (); + frame_rendered = render_screen (false); + t = read_processor_time () - start; } - while (!currprefs.turbo_emulation) { - double v = rpt_vsync(clockadjust) / (syncbase / 1000.0); + while (1) { + float v = rpt_vsync () / (syncbase / 1000.0); if (v >= -2) break; - rtg_vsynccheck(); - maybe_process_pull_audio(); - //if (cpu_sleep_millis(1) < 0) - // break; - } - while (rpt_vsync(clockadjust) < 0) { - rtg_vsynccheck(); - //if (audio_is_pull_event()) - // break; } + curr_time = start = read_processor_time (); + while (rpt_vsync () < 0) + ; idletime += read_processor_time() - start; - curr_time = read_processor_time(); + curr_time = read_processor_time (); vsyncmintime = curr_time; vsyncmaxtime = vsyncwaittime = curr_time + vstb; if (frame_rendered) { - updatedisplayarea(); - t += read_processor_time() - curr_time; + show_screen (0); + t += read_processor_time () - curr_time; } t += frameskipt_avg; vsynctimeperline = (vstb - t) / 3; @@ -7093,212 +5533,123 @@ static bool framewait(void) vsynctimeperline = 0; else if (vsynctimeperline > vstb / 3) vsynctimeperline = vstb / 3; - + frame_shown = true; - - } + } return status != 0; } -static void reset_cpu_idle(void) -{ - cpu_sleepmode_cnt = 0; - if (cpu_sleepmode) { - cpu_sleepmode = 0; - } -} - #define FPSCOUNTER_MAVG_SIZE 10 static struct mavg_data fps_mavg, idle_mavg; -void fpscounter_reset(void) +void fpscounter_reset (void) { - mavg_clear(&fps_mavg); - mavg_clear(&idle_mavg); - bogusframe = 2; - lastframetime = read_processor_time(); + mavg_clear (&fps_mavg); + mavg_clear (&idle_mavg); + lastframetime = read_processor_time (); idletime = 0; } -static void fpscounter(bool frameok) +static void fpscounter (void) { - frame_time_t now, last; + frame_time_t now, last; - now = read_processor_time(); - last = now - lastframetime; - lastframetime = now; + now = read_processor_time (); + last = now - lastframetime; + lastframetime = now; - if (bogusframe || int(last) < 0) + if ((int)last < 0) return; - mavg(&fps_mavg, last / 10, FPSCOUNTER_MAVG_SIZE); - mavg(&idle_mavg, idletime / 10, FPSCOUNTER_MAVG_SIZE); + if(currprefs.gfx_framerate) + idletime >>= 1; + + mavg (&fps_mavg, last / 10, FPSCOUNTER_MAVG_SIZE); + mavg (&idle_mavg, idletime / 10, FPSCOUNTER_MAVG_SIZE); idletime = 0; - frametime += last; - timeframes++; + timeframes++; if ((timeframes & 7) == 0) { - double idle = 1000 - (idle_mavg.mavg == 0 ? 0.0 : double(idle_mavg.mavg) * 1000.0 / vsynctimebase); + float idle = 1000 - (idle_mavg.mavg == 0 ? 0.0 : (float)idle_mavg.mavg * 1000.0 / vsynctimebase); int fps = fps_mavg.mavg == 0 ? 0 : syncbase * 10 / fps_mavg.mavg; - if (fps > 99999) - fps = 99999; + if (fps > 9999) + fps = 9999; if (idle < 0) idle = 0; if (idle > 100 * 10) idle = 100 * 10; - if (fake_vblank_hz * 10 > fps) { - double mult = double(fake_vblank_hz) * 10.0 / fps; - idle *= mult; - } - if (currprefs.turbo_emulation && idle < 100 * 10) - idle = 100 * 10; gui_data.fps = fps; - gui_data.idle = int(idle); - gui_data.fps_color = frameok ? 0 : 1; - if ((timeframes & 15) == 0) { - gui_fps(fps, int(idle), frameok ? 0 : 1); - } - } + gui_data.idle = (int)idle; + } } // vsync functions that are not hardware timing related -static void vsync_handler_pre(void) +static void vsync_handler_pre (void) { - if (currprefs.m68k_speed < 0) { - if (regs.stopped) { - cpu_stopped_lines += maxvpos - cpu_last_stop_vpos; - } - int mv = 12 - currprefs.cpu_idle / 15; - if (mv >= 1 && mv <= 11) { - mv = 11 - mv; - if (cpu_stopped_lines >= maxvpos * (mv * 10) / 100) { - cpu_sleepmode_cnt++; - if (cpu_sleepmode_cnt >= 50) { - cpu_sleepmode_cnt = 50; - if (!cpu_sleepmode) { - cpu_sleepmode = 1; - //write_log(_T("sleep\n")); - } - } - } - else { - reset_cpu_idle(); - } - } - else { - reset_cpu_idle(); - } - } - if (regs.halted < 0) - reset_cpu_idle(); - cpu_last_stop_vpos = 0; - cpu_stopped_lines = 0; + config_check_vsync (); + if (timehack_alive > 0) + timehack_alive--; - if (bogusframe > 0) - bogusframe--; - - config_check_vsync(); - if (timehack_alive > 0) - timehack_alive--; - - //audio_vsync(); //TODO - blkdev_vsync(); - CIA_vsync_prehandler(); - inputdevice_vsync(); - filesys_vsync(); - //sampler_vsync(); //TODO - //clipboard_vsync(); //TODO + devices_vsync_pre(); #ifdef PICASSO96 - if (isvsync_rtg() >= 0) - rtg_vsync(); + rtg_vsync (); #endif if (!vsync_rendered) { frame_time_t start, end; - start = read_processor_time(); - vsync_handle_redraw(lof_store, lof_changed, bplcon0, bplcon3); + start = read_processor_time (); + vsync_handle_redraw (); vsync_rendered = true; - end = read_processor_time(); + end = read_processor_time (); frameskiptime += end - start; } - bool frameok = framewait(); - - //if (!picasso_on) { - // if (!frame_rendered && vblank_hz_state) { - // updatedisplayarea(); - // frame_rendered = true; - // } - // if (frame_rendered && !frame_shown) { - // updatedisplayarea(); - // frame_shown = true; - // } - //} - - fpscounter(frameok); - - bool waspaused = false; - //while (handle_events()) { - // if (!waspaused) { - // render_screen(true); - // show_screen(0); - // waspaused = true; - // } - // // we are paused, do all config checks but don't do any emulation - // if (vsync_handle_check()) { - // redraw_frame(); - // render_screen(true); - // show_screen(0); - // } - // config_check_vsync(); - //} - - if (quit_program > 0) { - /* prevent possible infinite loop at wait_cycles().. */ - framecnt = 0; - reset_decisions(); - return; + framewait (); + + if (!picasso_on && !nodraw()) { + if (!frame_rendered) { + frame_rendered = render_screen (false); + } + if (frame_rendered && !frame_shown) { + frame_shown = show_screen_maybe (true); + } } + if(!nodraw() || (picasso_on && picasso_rendered)) + fpscounter(); + + handle_events (); + + if (quit_program > 0) { + /* prevent possible infinite loop at wait_cycles().. */ + framecnt = 0; + reset_decisions (); + return; + } + vsync_rendered = false; frame_shown = false; frame_rendered = false; - if (vblank_hz_mult > 0) - vblank_hz_state ^= 1; - else - vblank_hz_state = 1; - - vsync_handle_check(); + vsync_handle_check (); } // emulated hardware vsync -static void vsync_handler_post(void) +static void vsync_handler_post (void) { - static frame_time_t prevtime; - prevtime = read_processor_time(); - - DISK_vsync(); - -#ifdef WITH_LUA - uae_lua_run_handler("on_uae_vsync"); -#endif + DISK_vsync (); if (bplcon0 & 4) { lof_store = lof_store ? 0 : 1; } - if ((bplcon0 & 2) && currprefs.genlock) { - genlockvtoggle = lof_store ? 1 : 0; - } if (lof_prev_lastline != lof_lastline) { if (lof_togglecnt_lace < LOF_TOGGLES_NEEDED) lof_togglecnt_lace++; if (lof_togglecnt_lace >= LOF_TOGGLES_NEEDED) lof_togglecnt_nlace = 0; - } - else { + } else { // only 1-2 vblanks with bplcon0 lace bit set? // lets check if lof has changed if (!(bplcon0 & 4) && lof_togglecnt_lace > 0 && lof_togglecnt_lace < LOF_TOGGLES_NEEDED && !interlace_seen) { @@ -7310,16 +5661,9 @@ static void vsync_handler_post(void) lof_prev_lastline = lof_lastline; lof_current = lof_store; if (lof_togglecnt_lace >= LOF_TOGGLES_NEEDED) { - interlace_changed = notice_interlace_seen(true); - if (interlace_changed) { - notice_screen_contents_lost(); - } - } - else if (lof_togglecnt_nlace >= LOF_TOGGLES_NEEDED) { - interlace_changed = notice_interlace_seen(false); - if (interlace_changed) { - notice_screen_contents_lost(); - } + interlace_changed = notice_interlace_seen (true); + } else if (lof_togglecnt_nlace >= LOF_TOGGLES_NEEDED) { + interlace_changed = notice_interlace_seen (false); } if (lof_changing) { // still same? Trigger change now. @@ -7338,249 +5682,99 @@ static void vsync_handler_post(void) lof_changed = 0; } lof_changing = 0; - } - else { + } else { lof_changed_previous_field = 0; lof_lace = false; } - -#ifdef PICASSO96 - if (p96refresh_active) { - vpos_count = p96refresh_active; - vtotal = vpos_count; - } -#endif -#ifdef GFXBOARD - if (!picasso_on) - gfxboard_vsync_handler(); -#endif - + if (varsync_changed || (beamcon0 & (0x10 | 0x20 | 0x80 | 0x100 | 0x200)) != (new_beamcon0 & (0x10 | 0x20 | 0x80 | 0x100 | 0x200))) { init_hz_normal(); - } - else if (vpos_count > 0 && abs(vpos_count - vpos_count_diff) > 1 && vposw_change < 4) { + } else if (vpos_count > 0 && abs (vpos_count - vpos_count_diff) > 1 && vposw_change < 4) { init_hz_vposw(); - } - else if (interlace_changed || changed_chipset_refresh() || lof_changed) { - compute_framesync(); - } + } else if (interlace_changed || changed_chipset_refresh () || lof_changed) { + compute_framesync (); + } lof_changed = 0; vposw_change = 0; - bplcon0_interlace_seen = false; - COPJMP(1, 1); - - init_hardware_frame(); - - vsync_cycles = get_cycles(); + eventtab[ev_copper].active = 0; + COPJMP (1, 1); + + init_hardware_frame (); } -static void copper_check(int n) -{ - if (cop_state.state == COP_wait) { - int vp = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80); - //if (vp < cop_state.vcmp) { - //if (copper_enabled_thisline) - // write_log(_T("COPPER BUG %d: vp=%d vpos=%d vcmp=%d thisline=%d\n"), n, vp, vpos, cop_state.vcmp, copper_enabled_thisline); - //} - } -} - -/* - -0 0 - -1 1 -- -2 2 - -3 3 -- -4 4 - -5 5 -- - -0 x - -1 0 -- -2 1 - -3 2 -- -4 3 - -5 4 -- - -*/ - -static void hsync_scandoubler(void) -{ - int i, idx1; - struct draw_info *dip1; - uaecptr bpltmp[8], bpltmpx[8]; - - if (lof_store && vpos >= maxvpos_nom - 1) - return; - - next_lineno++; - scandoubled_line = 1; -#ifdef DEBUGGER - debug_dma = 0; -#endif - - for (i = 0; i < 8; i++) { - int diff; - bpltmp[i] = bplpt[i]; - bpltmpx[i] = bplptx[i]; - if (prevbpl[lof_store][vpos][i] && prevbpl[1 - lof_store][vpos][i]) { - diff = prevbpl[lof_store][vpos][i] - prevbpl[1 - lof_store][vpos][i]; - if (lof_store) { - if (bplcon0 & 4) - bplpt[i] = prevbpl[lof_store][vpos][i] - diff; - } - else { - if (bplcon0 & 4) - bplpt[i] = prevbpl[lof_store][vpos][i]; - else - bplpt[i] = bplpt[i] - diff; - - } - } - } - - reset_decisions(); - plf_state = plf_idle; - plfr_state = plfr_idle; - - // copy color changes - dip1 = curr_drawinfo + next_lineno - 1; - for (idx1 = dip1->first_color_change; idx1 < dip1->last_color_change; idx1++) { - struct color_change *cs2 = &curr_color_changes[idx1]; - int regno = cs2->regno; - int hpos = cs2->linepos; - if (regno < 0x1000 && hpos < HBLANK_OFFSET && !(beamcon0 & 0x80) && prev_lineno >= 0) { - struct draw_info *pdip = curr_drawinfo + next_lineno - 1; - int idx = pdip->last_color_change; - pdip->last_color_change++; - pdip->nr_color_changes++; - curr_color_changes[idx].linepos = hpos + maxhpos + 1; - curr_color_changes[idx].regno = regno; - curr_color_changes[idx].value = cs2->value; - curr_color_changes[idx + 1].regno = -1; - } - else { - struct color_change *cs1 = &curr_color_changes[next_color_change]; - memcpy(cs1, cs2, sizeof(struct color_change)); - next_color_change++; - } - } - curr_color_changes[next_color_change].regno = -1; - - finish_decisions(); - hsync_record_line_state(next_lineno, nln_normal, thisline_changed); - hardware_line_completed(next_lineno); - scandoubled_line = 0; - - for (i = 0; i < 8; i++) { - bplpt[i] = bpltmp[i]; - bplptx[i] = bpltmpx[i]; - } -} - -static void events_dmal(int); static uae_u16 dmal, dmal_hpos; -static void dmal_emu(uae_u32 v) +static void dmal_func2 (void) { + event_remevent(ev_dmal); + // Disk and Audio DMA bits are ignored by Agnus, Agnus only checks DMAL and master bit if (!(dmacon & DMA_MASTER)) return; - int hpos = current_hpos(); - if (v >= 6) { - v -= 6; - int nr = v / 2; - uaecptr pt = audio_getpt(nr, (v & 1) != 0); - uae_u16 dat = chipmem_wget_indirect(pt); - last_custom_value1 = dat; - AUDxDAT(nr, dat, pt); - } - else { - uae_u16 dat; - int w = v & 1; - uaecptr pt = disk_getpt(); - // disk_fifostatus() needed in >100% disk speed modes - if (w) { - // write to disk - if (disk_fifostatus() <= 0) { - dat = chipmem_wget_indirect(pt); - last_custom_value1 = dat; - DSKDAT(dat); - } - } - else { - // read from disk - if (disk_fifostatus() >= 0) { - dat = DSKDATR(); - chipmem_wput_indirect(pt, dat); - } - } - - } -} - -static void dmal_func(uae_u32 v) -{ - dmal_emu(v); - events_dmal(0); -} - -static void dmal_func2(uae_u32 v) -{ while (dmal) { - if (dmal & 3) - dmal_emu(dmal_hpos + ((dmal & 2) ? 1 : 0)); + if (dmal & 3) { + if (dmal_hpos >= 6) { + int nr = (dmal_hpos - 6) >> 1; + audio_dmal_do (nr, (dmal & 2) ? true : false); + } else { + uae_u16 dat; + int w = (dmal & 2) ? 1 : 0; + uaecptr pt = disk_getpt (); + // disk_fifostatus() needed in >100% disk speed modes + if (w) { + // write to disk + if (disk_fifostatus () <= 0) { + dat = chipmem_wget_indirect (pt); + last_custom_value1 = dat; + DSKDAT (dat); + } + } else { + // read from disk + if (disk_fifostatus () >= 0) { + dat = DSKDATR (); + chipmem_wput_indirect (pt, dat); + } + } + } + } + dmal_hpos += 2; dmal >>= 2; } } -static void events_dmal(int hp) +STATIC_INLINE void events_dmal (void) { - if (!dmal) - return; - if (currprefs.cpu_memory_cycle_exact) { - while (dmal) { - if (dmal & 3) - break; - hp += 2; - dmal >>= 2; - dmal_hpos += 2; - } - event2_newevent2(hp, dmal_hpos + ((dmal & 2) ? 1 : 0), dmal_func); - dmal &= ~3; - } - else if (currprefs.cachesize) { - dmal_func2(0); - } - else { - event2_newevent2(hp, 13, dmal_func2); + if (currprefs.cachesize) { + dmal_func2 (); + } else { + event_newevent (ev_dmal, 7); } } -static void events_dmal_hsync(void) +static void events_dmal_hsync (void) { - if (dmal) - write_log(_T("DMAL error!? %04x\n"), dmal); - dmal = audio_dmal(); - dmal <<= 6; - dmal |= disk_dmal(); - if (!dmal) + uae_u16 dmal_disk = disk_dmal (); + + dmal = audio_dmal (); + if (!dmal && !dmal_disk) return; - dmal_hpos = 0; - if (currprefs.cpu_memory_cycle_exact) { - for (int i = 0; i < 6 + 8; i += 2) { - if (dmal & (3 << i)) { - alloc_cycle_ext(i + 7, CYCLE_MISC); - } - } - } - events_dmal(7); + + if(dmal_disk) + { + dmal_hpos = 0; + dmal <<= 6; + dmal |= dmal_disk; + } + else + dmal_hpos = 6; + events_dmal (); } -static bool is_custom_vsync(void) +static bool is_custom_vsync (void) { int vp = vpos + 1; int vpc = vpos_count + 1; @@ -7594,133 +5788,69 @@ static bool is_custom_vsync(void) return false; } -static void set_hpos(void) +static void set_hpos (void) { - maxhpos = maxhpos_short + lol; - hpos_offset = 0; - eventtab[ev_hsync].evtime = get_cycles() + HSYNCTIME; - eventtab[ev_hsync].oldcycles = get_cycles(); + eventtab[ev_hsync].evtime = get_cycles () + HSYNCTIME; + eventtab[ev_hsync].oldcycles = get_cycles (); } // this finishes current line -static void hsync_handler_pre(bool onvsync) +static void hsync_handler_pre (bool onvsync) { - int hpos = current_hpos(); + int hpos = current_hpos (); - if (!nocustom()) { - sync_copper_with_cpu(maxhpos, 0); + if (!nocustom()) { + /* Using 0x8A makes sure that we don't accidentally trip over the + modified_regtypes check. */ + sync_copper_with_cpu (maxhpos, 0, 0x8A); - // Seven Seas scrolling quick fix hack - // checks if copper is going to modify BPLCON1 in next cycle. - if (copper_enabled_thisline && cop_state.state == COP_read2 && (cop_state.i1 & 0x1fe) == 0x102) { - // it did, pre-load value for Denise shifter emulation - hpos_is_zero_bplcon1_hack = chipmem_wget_indirect(cop_state.ip); - // following finish_decision() is going to finish this line - // it is too late when copper actually does the move - } + finish_decisions (); + if (thisline_decision.plfleft >= 0) { + if (currprefs.collision_level > 1) + DO_SPRITE_COLLISIONS + if (currprefs.collision_level > 2) + DO_PLAYFIELD_COLLISIONS + } + hsync_record_line_state (next_lineno); + } + + devices_hsync(); - finish_decisions(); - if (thisline_decision.plfleft >= 0) { - if (currprefs.collision_level > 1) - DO_SPRITE_COLLISIONS - if (currprefs.collision_level > 2) - DO_PLAYFIELD_COLLISIONS - } - hsync_record_line_state(next_lineno, nextline_how, thisline_changed); - /* reset light pen latch */ - if (vpos == sprite_vblank_endline) { - lightpen_triggered = 0; - sprite_0 = 0; - } - if (lightpen_enabled && lightpen_cx > 0 && (bplcon0 & 8) && !lightpen_triggered && lightpen_cy == vpos) { - vpos_lpen = vpos; - hpos_lpen = lightpen_cx; - lightpen_triggered = 1; - } - hardware_line_completed(next_lineno); - if (doflickerfix() && interlace_seen > 0) - hsync_scandoubler(); - notice_resolution_seen(GET_RES_AGNUS(bplcon0), interlace_seen != 0); - } + hsync_counter++; -#ifdef A2065 - a2065_hsync_handler(); -#endif -#ifdef CD32 - AKIKO_hsync_handler(); -#endif -#ifdef CDTV - CDTV_hsync_handler(); -#endif - decide_blitter(-1); - -#ifdef PICASSO96 - picasso_handle_hsync(); -#endif - { - //void ahi_hsync(void); - //ahi_hsync(); - } - - DISK_hsync(); - if (currprefs.produce_sound) - audio_hsync(); - - hsync_counter++; - - refptr += 0x0200 * 4; - refptr_val += 0x0200 * 4; - - if (islinetoggle()) - lol ^= 1; - else - lol = 0; - - vpos++; + vpos++; vpos_count++; - if (vpos >= maxvpos_total) - vpos = 0; + if (vpos >= maxvpos_total) + vpos=0; if (onvsync) { vpos = 0; - vsync_counter++; } - set_hpos(); + set_hpos (); } -STATIC_INLINE bool is_last_line(void) +STATIC_INLINE bool is_last_line (void) { return vpos + 1 == maxvpos + lof_store; } // this prepares for new line -static void hsync_handler_post(bool onvsync) +static void hsync_handler_post (bool onvsync) { last_copper_hpos = 0; -#ifdef CPUEMU_13 - if (currprefs.cpu_memory_cycle_exact || currprefs.blitter_cycle_exact) { - memset(cycle_line, 0, sizeof cycle_line); - } -#endif - // genlock active: - // vertical: interlaced = toggles every other field, non-interlaced = both fields (normal) - // horizontal: PAL = every line, NTSC = every other line - genlockhtoggle = !genlockhtoggle; - bool ciahsyncs = !(bplcon0 & 2) || ((bplcon0 & 2) && currprefs.genlock && (!currprefs.ntscmode || genlockhtoggle)); - bool ciavsyncs = !(bplcon0 & 2) || ((bplcon0 & 2) && currprefs.genlock && genlockvtoggle); + bool ciahsyncs = !(bplcon0 & 2); + bool ciavsyncs = !(bplcon0 & 2); - CIA_hsync_posthandler(false, false); + CIA_hsync_posthandler(false); if (currprefs.cs_cd32cd) { - CIA_hsync_posthandler(true, true); + CIA_hsync_posthandler(true); CIAB_tod_handler(18); - } - else if (ciahsyncs) { - CIA_hsync_posthandler(true, ciahsyncs); + } else if (ciahsyncs) { + CIA_hsync_posthandler(true); if (beamcon0 & (0x80 | 0x100)) { if (hsstop < (maxhpos & ~1) && hsstrt < maxhpos) CIAB_tod_handler(hsstop); - } - else { + } else { CIAB_tod_handler(18); } } @@ -7730,431 +5860,293 @@ static void hsync_handler_post(bool onvsync) if (cia_hsync < maxhpos) { CIAA_tod_inc(cia_hsync); cia_hsync += (akiko_ntscmode() ? 262 : 313) * maxhpos; - } - else { + } else { cia_hsync -= maxhpos; } - } - else if (currprefs.cs_ciaatod > 0) { + } else if (currprefs.cs_ciaatod > 0) { if (cia_hsync < maxhpos) { int newcount; - CIAA_tod_inc(cia_hsync); - newcount = (vblank_hz * (2 * maxvpos + (interlace_seen ? 1 : 0)) * (2 * maxhpos + (islinetoggle() ? 1 : 0))) / ((currprefs.cs_ciaatod == 2 ? 60 : 50) * 4); + CIAA_tod_inc (cia_hsync); + newcount = (int)((vblank_hz * (2 * maxvpos + (interlace_seen ? 1 : 0)) * (2 * maxhpos + (currprefs.ntscmode ? 1 : 0))) / ((currprefs.cs_ciaatod == 2 ? 60 : 50) * 4)); cia_hsync += newcount; - } - else { + } else { cia_hsync -= maxhpos; } - } - else if (currprefs.cs_ciaatod == 0 && ciavsyncs) { + } else if (currprefs.cs_ciaatod == 0 && ciavsyncs) { // CIA-A TOD counter increases when vsync pulse ends if (beamcon0 & (0x80 | 0x200)) { if (vpos == vsstop && vsstrt <= maxvpos) - CIAA_tod_inc(lof_store ? hsstop : hsstop + hcenter); - } - else { + CIAA_tod_inc (lof_store ? hsstop : hsstop + hcenter); + } else { if (vpos == (currprefs.ntscmode ? VSYNC_ENDLINE_NTSC : VSYNC_ENDLINE_PAL)) { - CIAA_tod_inc(lof_store ? 132 : 18); + CIAA_tod_inc (lof_store ? 132 : 18); } } } - inputdevice_hsync(); + inputdevice_hsync (); - if (!nocustom()) { - if (!currprefs.blitter_cycle_exact && bltstate != BLT_done && dmaen(DMA_BITPLANE) && diwstate == DIW_waiting_stop) { - blitter_slowdown(thisline_decision.plfleft, thisline_decision.plfright - (16 << fetchmode), - cycle_diagram_total_cycles[fetchmode][GET_RES_AGNUS(bplcon0)][GET_PLANES_LIMIT(bplcon0)], - cycle_diagram_free_cycles[fetchmode][GET_RES_AGNUS(bplcon0)][GET_PLANES_LIMIT(bplcon0)]); - } - } + if (!nocustom()) { + if (bltstate != BLT_done && dmaen (DMA_BITPLANE) && diwstate == DIW_waiting_stop) { + blitter_slowdown (thisline_decision.plfleft, thisline_decision.plfright - (16 << fetchmode), + cycle_diagram_total_cycles[fetchmode][bplcon0_res][bplcon0_planes_limit], + cycle_diagram_free_cycles[fetchmode][bplcon0_res][bplcon0_planes_limit]); + } + } if (onvsync) { - // vpos_count >= MAXVPOS just to not crash if VPOSW writes prevent vsync completely - if ((bplcon0 & 8) && !lightpen_triggered) { - vpos_lpen = vpos - 1; - hpos_lpen = maxhpos; - lightpen_triggered = 1; - } vpos = 0; - vsync_handler_post(); + vsync_handler_post (); vpos_count = 0; - } - // A1000 DIP Agnus (8361): vblank interrupt is triggered on line 1! - if (currprefs.cs_dipagnus) { - if (vpos == 1) - send_interrupt(5, 1 * CYCLE_UNIT); - } - else { - if (vpos == 0) - send_interrupt(5, 1 * CYCLE_UNIT); - } + } + if (vpos == 0) + send_interrupt (5); + // lastline - 1? if (vpos + 1 == maxvpos + lof_store || vpos + 1 == maxvpos + lof_store + 1) { lof_lastline = lof_store != 0; } -#ifdef CPUEMU_13 - if (currprefs.cpu_memory_cycle_exact || currprefs.blitter_cycle_exact) { - int hp = maxhpos - 1, i; - for (i = 0; i < 4; i++) { - alloc_cycle(hp, i == 0 ? CYCLE_STROBE : CYCLE_REFRESH); /* strobe */ -#ifdef DEBUGGER - if (debug_dma) { - uae_u16 strobe = 0x3c; - if (vpos < equ_vblank_endline) - strobe = 0x38; - else if (vpos < minfirstline) - strobe = 0x3a; - else if (vpos + 1 == maxvpos + lof_store) - strobe = 0x38; - else if ((currprefs.chipset_mask & CSMASK_ECS_AGNUS) && lol) - strobe = 0x3e; - record_dma(i == 0 ? strobe : 0x1fe, 0xffff, 0xffffffff, hp, vpos, DMARECORD_REFRESH); - } -#endif - hp += 2; - if (hp >= maxhpos) - hp -= maxhpos; - } - } -#endif - - events_dmal_hsync(); - - if (currprefs.m68k_speed < 0) { - static int sleeps_remaining; - if (is_last_line()) { - sleeps_remaining = (165 - currprefs.cpu_idle) / 6; - if (sleeps_remaining < 0) - sleeps_remaining = 0; - /* really last line, just run the cpu emulation until whole vsync time has been used */ - if (regs.stopped && currprefs.cpu_idle) { - // CPU in STOP state: sleep if enough time left. - frame_time_t rpt = read_processor_time(); - //while (!vsync_isdone() && (int)vsyncmintime - (int)(rpt + vsynctimebase / 10) > 0 && (int)vsyncmintime - (int)rpt < vsynctimebase) { - // maybe_process_pull_audio(); - // if (!execute_other_cpu(rpt + vsynctimebase / 10)) { - // if (cpu_sleep_millis(1) < 0) - // break; - // } - // rpt = read_processor_time(); - //} - } - else if (currprefs.m68k_speed_throttle) { - vsyncmintime = read_processor_time(); /* end of CPU emulation time */ - is_syncline = 0; - maybe_process_pull_audio(); - } - else { - vsyncmintime = vsyncmaxtime; /* emulate if still time left */ - is_syncline_end = read_processor_time() + vsynctimebase; /* far enough in future, we never wait that long */ - is_syncline = 2; - maybe_process_pull_audio(); - } - } - else { - static int linecounter; - /* end of scanline, run cpu emulation as long as we still have time */ + events_dmal_hsync (); + + if (currprefs.m68k_speed < 0) { + if (is_last_line ()) { + /* really last line, just run the cpu emulation until whole vsync time has been used */ + vsyncmintime = vsyncmaxtime; /* emulate if still time left */ + if(vsyncmaxtime - read_processor_time () > -speedup_timelimit) + is_syncline = 2; + } else { + /* end of scanline, run cpu emulation as long as we still have time */ + vsyncmintime += vsynctimeperline; + is_syncline = 0; + if ((int)vsyncmaxtime - (int)vsyncmintime > 0) { + if ((int)vsyncwaittime - (int)vsyncmintime > 0) { + frame_time_t rpt = read_processor_time (); + /* Extra time left? Do some extra CPU emulation */ + if ((int)vsyncmintime - (int)rpt > -speedup_timelimit) { + is_syncline = 1; + } + } + } + } + } else { + if (vpos + 1 < maxvpos + lof_store && (vpos == maxvpos_display * 1 / 3 || vpos == maxvpos_display * 2 / 3)) { vsyncmintime += vsynctimeperline; - linecounter++; - is_syncline = 0; - //if (!vsync_isdone() && !currprefs.turbo_emulation) { - // if ((int)vsyncmaxtime - (int)vsyncmintime > 0) { - // if ((int)vsyncwaittime - (int)vsyncmintime > 0) { - // frame_time_t rpt = read_processor_time(); - // /* Extra time left? Do some extra CPU emulation */ - // if ((int)vsyncmintime - (int)rpt > 0) { - // if (regs.stopped && currprefs.cpu_idle && sleeps_remaining > 0) { - // // STOP STATE: sleep. - // cpu_sleep_millis(1); - // sleeps_remaining--; - // maybe_process_pull_audio(); - // } - // else { - // is_syncline = 1; - // /* limit extra time */ - // is_syncline_end = rpt + vsynctimeperline; - // linecounter = 0; - // } - // } - // } - // if (!isvsync()) { - // // extra cpu emulation time if previous 10 lines without extra time. - // if (!is_syncline && linecounter >= 10 && (!regs.stopped || !currprefs.cpu_idle)) { - // is_syncline = -1; - // is_syncline_end = read_processor_time() + vsynctimeperline; - // linecounter = 0; - // } - // } - // } - //} - //maybe_process_pull_audio(); } - } - else if (!currprefs.cpu_thread) { - static int nextwaitvpos; - if (vpos == 0) - nextwaitvpos = maxvpos_display * 1 / 4; - //if (audio_is_pull() > 0 && !currprefs.turbo_emulation) { - // maybe_process_pull_audio(); - // frame_time_t rpt = read_processor_time(); - // while (audio_pull_buffer() > 1 && (!isvsync() || (!vsync_isdone() && (int)vsyncmintime - (int)(rpt + vsynctimebase / 10) > 0 && (int)vsyncmintime - (int)rpt < vsynctimebase))) { - // cpu_sleep_millis(1); - // maybe_process_pull_audio(); - // rpt = read_processor_time(); - // } - //} - if (vpos + 1 < maxvpos + lof_store - && vpos >= nextwaitvpos && vpos < maxvpos - (maxvpos / 3) - //&& (audio_is_pull() <= 0 || (audio_is_pull() > 0 - // && audio_pull_buffer())) - ) - { - nextwaitvpos += maxvpos_display * 1 / 3; - vsyncmintime += vsynctimeperline; - //if (!vsync_isdone() && !currprefs.turbo_emulation) { - // frame_time_t rpt = read_processor_time(); - // // sleep if more than 2ms "free" time - // while (!vsync_isdone() && (int)vsyncmintime - (int)(rpt + vsynctimebase / 10) > 0 && (int)vsyncmintime - (int)rpt < vsynctimebase) { - // maybe_process_pull_audio(); - // if (!execute_other_cpu(rpt + vsynctimebase / 10)) { - // if (cpu_sleep_millis(1) < 0) - // break; - // } - // rpt = read_processor_time(); - // //write_log (_T("*")); - // } - //} - } - } + } - if (!nocustom()) { - int lineno = vpos; + if (!nocustom()) { + int lineno = vpos; if (lineno >= MAXVPOS) lineno %= MAXVPOS; - nextline_how = nln_normal; - if (doflickerfix() && interlace_seen > 0) { - lineno *= 2; - } - else if (!interlace_seen && doublescan <= 0 && currprefs.gfx_vresolution && currprefs.gfx_pscanlines > 1) { - lineno *= 2; - if (timeframes & 1) { - lineno++; - nextline_how = currprefs.gfx_pscanlines == 3 ? nln_lower_black_always : nln_lower_black; - } - else { - nextline_how = currprefs.gfx_pscanlines == 3 ? nln_upper_black_always : nln_upper_black; - } - } - else if ((doublescan <= 0 || interlace_seen > 0) && currprefs.gfx_vresolution && currprefs.gfx_iscanlines) { + if (currprefs.gfx_vresolution) { lineno *= 2; if (interlace_seen) { if (!lof_current) { lineno++; - nextline_how = currprefs.gfx_iscanlines == 2 ? nln_lower_black_always : nln_lower_black; } - else { - nextline_how = currprefs.gfx_iscanlines == 2 ? nln_upper_black_always : nln_upper_black; - } - } - else { - nextline_how = currprefs.gfx_vresolution > VRES_NONDOUBLE && currprefs.gfx_pscanlines == 1 ? nln_nblack : nln_doubled; } } - else if (currprefs.gfx_vresolution && (doublescan <= 0 || interlace_seen > 0)) { - lineno *= 2; - if (interlace_seen) { - if (!lof_current) { - lineno++; - nextline_how = nln_lower; - } - else { - nextline_how = nln_upper; - } - } - else { - nextline_how = currprefs.gfx_vresolution > VRES_NONDOUBLE && currprefs.gfx_pscanlines == 1 ? nln_nblack : nln_doubled; - } - } - prev_lineno = next_lineno; - next_lineno = lineno; - reset_decisions(); - } + prev_lineno = next_lineno; + next_lineno = lineno; + reset_decisions (); + } rethink_uae_int(); /* Default to no bitplane DMA overriding sprite DMA */ plfstrt_sprite = 0xff; - /* See if there's a chance of a copper wait ending this line. */ - cop_state.hpos = 0; - compute_spcflag_copper(maxhpos); - - if (GET_PLANES(bplcon0) > 0 && dmaen(DMA_BITPLANE)) { - if (first_bplcon0 == 0) - first_bplcon0 = bplcon0; - if (vpos > last_planes_vpos) - last_planes_vpos = vpos; - if (vpos >= minfirstline && first_planes_vpos == 0) { - first_planes_vpos = vpos > minfirstline ? vpos - 1 : vpos; - } - else if (vpos >= current_maxvpos() - 1) { - last_planes_vpos = current_maxvpos(); - } - } - if (diw_change == 0) { - if (vpos >= first_planes_vpos && vpos <= last_planes_vpos) { - if (diwlastword > diwlastword_total) { - diwlastword_total = diwlastword; - if (diwlastword_total > coord_diw_to_window_x(hsyncstartpos * 2)) - diwlastword_total = coord_diw_to_window_x(hsyncstartpos * 2); - } - if (diwfirstword < diwfirstword_total) { - diwfirstword_total = diwfirstword; - if (diwfirstword_total < coord_diw_to_window_x(hsyncendpos * 2)) - diwfirstword_total = coord_diw_to_window_x(hsyncendpos * 2); - firstword_bplcon1 = bplcon1; - } - } - if (diwstate == DIW_waiting_stop) { - int f = 8 << fetchmode; - if (plfstrt + f < ddffirstword_total + f) - ddffirstword_total = plfstrt + f; - if (plfstop + 2 * f > ddflastword_total + 2 * f) - ddflastword_total = plfstop + 2 * f; - } - if ((plffirstline < plffirstline_total || (plffirstline_total == minfirstline && vpos > minfirstline)) && plffirstline < vpos / 2) { - firstword_bplcon1 = bplcon1; - if (plffirstline < minfirstline) - plffirstline_total = minfirstline; - else - plffirstline_total = plffirstline; - } - if (plflastline > plflastline_total && plflastline > plffirstline_total && plflastline > maxvpos / 2) - plflastline_total = plflastline; - } - if (diw_change > 0) - diw_change--; + /* See if there's a chance of a copper wait ending this line. */ + cop_state.hpos = 0; + compute_spcflag_copper (maxhpos); /* fastest possible + last line and no vflip wait: render the frame as early as possible */ - if (is_last_line() && isvsync_chipset() <= -2 && !vsync_rendered && currprefs.gfx_apmode[0].gfx_vflip == 0) { + if (is_last_line () && isvsync_chipset () > 0 && !vsync_rendered) { frame_time_t start, end; - start = read_processor_time(); + start = read_processor_time (); vsync_rendered = true; - vsync_handle_redraw(lof_store, lof_changed, bplcon0, bplcon3); - //if (vblank_hz_state) { - // updatedisplayarea(); - // frame_rendered = true; - //} - end = read_processor_time(); + vsync_handle_redraw (); + frame_rendered = render_screen (true); + end = read_processor_time (); frameskiptime += end - start; } - - rtg_vsynccheck(); } -static void hsync_handler(void) +static void init_regtypes (void) { - bool vs = is_custom_vsync(); - hsync_handler_pre(vs); + int i; + for (i = 0; i < 512; i += 2) { + regtypes[i] = REGTYPE_ALL; + if ((i >= 0x20 && i < 0x26) || i == 0x7E) + regtypes[i] = REGTYPE_DISK; + else if (i >= 0x68 && i < 0x70) + regtypes[i] = REGTYPE_NONE; + else if (i >= 0x40 && i < 0x76) + regtypes[i] = REGTYPE_BLITTER; + else if (i >= 0xA0 && i < 0xE0 && (i & 0xF) < 0xC) + regtypes[i] = REGTYPE_AUDIO; + else if ((i >= 0xA0 && i < 0xE0) || (i >= 0x1C0 && i < 0x1E4) || (i >= 0x1E6 && i < 0x1FC)) + regtypes[i] = REGTYPE_NONE; + else if ((i >= 0xE0 && i < 0x100) || (i >= 0x110 && i < 0x120)) + regtypes[i] = REGTYPE_PLANE; + else if (i >= 0x120 && i < 0x180) + regtypes[i] = REGTYPE_SPRITE; + else if (i >= 0x180 && i < 0x1C0) + regtypes[i] = REGTYPE_COLOR; + else switch (i) { + case 0x00: + case 0x08: + case 0x18: + case 0x26: case 0x28: + case 0x30: case 0x32: + case 0x38: case 0x3A: case 0x3C: case 0x3E: + case 0x76: case 0x78: case 0x7A: case 0x7C: + case 0x8C: + case 0x1FE: + regtypes[i] = REGTYPE_NONE; + break; + case 0x02: + /* DMACONR - setting this to REGTYPE_BLITTER will cause it to + conflict with DMACON (since that is REGTYPE_ALL), and the + blitter registers (for the BBUSY bit), but nothing else, + which is (I think) what we want. */ + regtypes[i] = REGTYPE_BLITTER; + break; + case 0x04: case 0x06: case 0x2A: case 0x2C: + case 0x0A: case 0x0C: /* Mouse position is calculated with vpos */ + regtypes[i] = REGTYPE_POS; + break; + case 0x0E: + regtypes[i] = REGTYPE_SPRITE; + break; + case 0x10: case 0x9E: + regtypes[i] = REGTYPE_AUDIO | REGTYPE_DISK; + break; + case 0x12: case 0x14: case 0x16: + case 0x34: case 0x36: + regtypes[i] = REGTYPE_JOYPORT; + break; + case 0x1A: + regtypes[i] = REGTYPE_DISK; + break; + case 0x102: case 0x104: case 0x106: case 0x108: + case 0x10A: + regtypes[i] = REGTYPE_PLANE; + break; + case 0x10C: + regtypes[i] = REGTYPE_PLANE | REGTYPE_SPRITE; + break; + case 0x88: case 0x8A: + case 0x8E: case 0x90: case 0x92: case 0x94: + case 0x96: + case 0x100: + case 0x1FC: + regtypes[i] |= REGTYPE_FORCE; + break; + } + } +} + +static void hsync_handler (void) +{ + bool vs = is_custom_vsync (); + hsync_handler_pre (vs); if (vs) { - vsync_handler_pre(); - if (savestate_check()) { - uae_reset(0, 0); + vsync_handler_pre (); + if (savestate_check ()) { + uae_reset (0, 0); return; } } - hsync_handler_post(vs); + hsync_handler_post (vs); } -void init_eventtab(void) +void init_eventtab (void) { int i; - - nextevent = 0; + + nextevent = 0; for (i = 0; i < ev_max; i++) { - eventtab[i].active = false; - eventtab[i].oldcycles = get_cycles(); + eventtab[i].active = 0; + eventtab[i].oldcycles = get_cycles (); } - for (i = 0; i < ev2_max; i++) { - eventtab2[i].active = 0; + for (i = 0; i < ev2_max; i++) { + eventtab2[i].active = 0; } - + eventtab[ev_cia].handler = CIA_handler; eventtab[ev_hsync].handler = hsync_handler; - eventtab[ev_hsync].evtime = get_cycles() + HSYNCTIME; - eventtab[ev_hsync].active = true; - eventtab[ev_misc].handler = MISC_handler; + eventtab[ev_hsync].evtime = get_cycles () + HSYNCTIME; + eventtab[ev_hsync].active = 1; + eventtab[ev_copper].handler = copper_handler; + eventtab[ev_copper].active = 0; + eventtab[ev_misc].handler = MISC_handler; eventtab[ev_audio].handler = audio_evhandler; - eventtab2[ev2_blitter].handler = blitter_handler; - eventtab2[ev2_disk].handler = DISK_handler; + eventtab[ev_blitter].handler = blitter_handler; + eventtab[ev_dmal].handler = dmal_func2; - events_schedule(); + eventtab2[ev2_disk].handler = DISK_handler; + eventtab2[ev2_ciaa_tod].handler = CIAA_tod_handler; + eventtab2[ev2_ciab_tod].handler = CIAB_tod_inc_event; + eventtab2[ev2_disk_motor0].handler = DISK_motordelay_func; + eventtab2[ev2_disk_motor1].handler = DISK_motordelay_func; + eventtab2[ev2_disk_motor2].handler = DISK_motordelay_func; + eventtab2[ev2_disk_motor3].handler = DISK_motordelay_func; + + events_schedule (); } -void custom_prepare(void) +void custom_prepare (void) { - set_hpos(); - hsync_handler_post(true); + set_hpos (); + hsync_handler_post (true); } -void custom_reset(bool hardreset, bool keyboardreset) +void custom_reset (bool hardreset, bool keyboardreset) { - int i; + target_reset (); + reset_all_systems (); + write_log (_T("Reset at %08X. Chipset mask = %08X\n"), M68K_GETPC, currprefs.chipset_mask); - target_reset(); - reset_all_systems(); - //write_log(_T("Reset at %08X. Chipset mask = %08X\n"), M68K_GETPC, currprefs.chipset_mask); - //memory_map_dump(); - - //lightpen_active = -1; - //lightpen_triggered = 0; - //lightpen_cx = lightpen_cy = -1; nr_armed = 0; - if (!savestate_state) { + if (! savestate_state) { cia_hsync = 0; - extra_cycle = 0; - hsync_counter = 0; - vsync_counter = 0; + hsync_counter = 0; currprefs.chipset_mask = changed_prefs.chipset_mask; - update_mirrors(); - blitter_reset(); + update_mirrors(); if (hardreset) { - if (!aga_mode) { - uae_u16 c = (((currprefs.chipset_mask & CSMASK_ECS_DENISE) && !(currprefs.chipset_mask & CSMASK_AGA)) || currprefs.cs_denisenoehb) ? 0xfff : 0x000; - for (i = 0; i < 32; i++) { - current_colors.color_regs_ecs[i] = c; - current_colors.acolors[i] = getxcolor(c); - } -#ifdef AGA - } - else { + if (!aga_mode) { + uae_u16 c = ((currprefs.chipset_mask & CSMASK_ECS_DENISE) && !(currprefs.chipset_mask & CSMASK_AGA)) ? 0xfff : 0x000; + for (int i = 0; i < 32; i++) { + current_colors.color_regs_ecs[i] = c; + current_colors.acolors[i] = getxcolor (c); + } + } else { uae_u32 c = 0; - for (i = 0; i < 256; i++) { - current_colors.color_regs_aga[i] = c; - current_colors.acolors[i] = getxcolor(c); - } -#endif - } - lof_store = lof_current = 0; - lof_lace = false; - } + for (int i = 0; i < 256; i++) { + current_colors.color_regs_aga[i] = c; + current_colors.acolors[i] = getxcolor (c); + } + } + lof_store = lof_current = 0; + lof_lace = false; + } clxdat = 0; - + /* Clear the armed flags of all sprites. */ - memset(spr, 0, sizeof spr); - + memset (spr, 0, sizeof spr); + dmacon = 0; - intreq_internal = 0; - intena = intena_internal = 0; + intreq = 0; + intena = 0; copcon = 0; - DSKLEN(0, 0); - + DSKLEN (0, 0); + bplcon0 = 0; bplcon4 = 0x0011; /* Get AGA chipset into ECS compatibility mode */ bplcon3 = 0x0C00; @@ -8162,190 +6154,134 @@ void custom_reset(bool hardreset, bool keyboardreset) diwhigh = 0; diwhigh_written = 0; hdiwstate = DIW_waiting_start; // this does not reset at vblank - - refptr = 0xffff; - FMODE(0, 0); - CLXCON(0); - CLXCON2(0); - setup_fmodes(0); - sprite_width = GET_SPRITEWIDTH(fmode); + + FMODE (0, 0); + CLXCON (0); + CLXCON2 (0); + setup_fmodes (0); + sprite_width = GET_SPRITEWIDTH (fmode); beamcon0 = new_beamcon0 = currprefs.ntscmode ? 0x00 : 0x20; bltstate = BLT_done; blit_interrupt = 1; - init_sprites(); + init_sprites (); } + + devices_reset(hardreset); - //gayle_reset(hardreset); //TODO -#ifdef AUTOCONFIG - expamem_reset(); -#endif - //a1000_reset(); //TODO - DISK_reset(); - CIA_reset(); - //gayle_reset(0); //TODO -#ifdef A2091 - a2091_reset(); -#endif -#ifdef GFXBOARD - gfxboard_reset(); -#endif -#ifdef NCR - ncr_reset(); -#endif -#ifdef JIT - compemu_reset(); -#endif - unset_special(~(SPCFLAG_BRK | SPCFLAG_MODE_CHANGE)); - + unset_special (~(SPCFLAG_BRK | SPCFLAG_MODE_CHANGE)); + vpos = 0; vpos_count = vpos_count_diff = 0; - - inputdevice_reset(); - timehack_alive = 0; - - curr_sprite_entries = nullptr; - prev_sprite_entries = nullptr; - sprite_entries[0][0].first_pixel = 0; - sprite_entries[1][0].first_pixel = MAX_SPR_PIXELS; - sprite_entries[0][1].first_pixel = 0; - sprite_entries[1][1].first_pixel = MAX_SPR_PIXELS; - memset(spixels, 0, 2 * MAX_SPR_PIXELS * sizeof *spixels); - memset(&spixstate, 0, sizeof spixstate); + + inputdevice_reset(); + timehack_alive = 0; + + curr_sprite_entries[0].first_pixel = 0; + curr_sprite_entries[1].first_pixel = 0; + next_sprite_entry = 0; + memset (spixels, 0, sizeof spixels); + memset (&spixstate, 0, sizeof spixstate); toscr_delay_sh[0] = 0; toscr_delay_sh[1] = 0; - + cop_state.state = COP_stop; cop_state.movedelay = 0; cop_state.strobe = 0; cop_state.ignore_next = 0; diwstate = DIW_waiting_start; - + dmal = 0; + new_beamcon0 = currprefs.ntscmode ? 0x00 : 0x20; + time_per_frame = 1000 * 1000 / (currprefs.ntscmode ? 60 : 50); init_hz_normal(); // init_hz sets vpos_count vpos_count = 0; - vpos_lpen = -1; lof_changing = 0; lof_togglecnt_nlace = lof_togglecnt_lace = 0; - //nlace_cnt = NLACE_CNT_NEEDED; + + audio_reset (); + if (!isrestore ()) { + /* must be called after audio_reset */ + adkcon = 0; + audio_update_adkmasks (); + } + + init_hardware_frame (); + drawing_init (); + + reset_decisions (); + + init_regtypes (); - audio_reset(); - if (!isrestore()) { - /* must be called after audio_reset */ - adkcon = 0; - //serial_uartbreak(0); - audio_update_adkmasks(); - } - - init_hardware_frame(); - drawing_init(); - - reset_decisions(); - - bogusframe = 1; - - if (isrestore()) { + if (isrestore ()) { uae_u16 v; uae_u32 vv; - - audio_update_adkmasks(); - INTENA(0); - INTREQ(0); - COPJMP(1, 1); + + audio_update_adkmasks (); + INTENA (0); + INTREQ (0); + + if (diwhigh) + diwhigh_written = 1; + else + diwhigh_written = 0; + COPJMP (1, 1); v = bplcon0; - BPLCON0(0, 0); - BPLCON0(0, v); - FMODE(0, fmode); + BPLCON0 (0, 0); + BPLCON0 (0, v); + FMODE (0, fmode); + if (!(currprefs.chipset_mask & CSMASK_AGA)) { - for (i = 0; i < 32; i++) { + for(int i = 0 ; i < 32 ; i++) { vv = current_colors.color_regs_ecs[i]; - current_colors.color_regs_ecs[i] = -1; - record_color_change(0, i, vv); + current_colors.color_regs_ecs[i] = (unsigned short)-1; + record_color_change (0, i, vv); remembered_color_entry = -1; current_colors.color_regs_ecs[i] = vv; current_colors.acolors[i] = xcolors[vv]; } -#ifdef AGA - } - else { - for (i = 0; i < 256; i++) { + } else { + for(int i = 0 ; i < 256 ; i++) { vv = current_colors.color_regs_aga[i]; current_colors.color_regs_aga[i] = -1; - record_color_change(0, i, vv); + record_color_change (0, i, vv); remembered_color_entry = -1; current_colors.color_regs_aga[i] = vv; current_colors.acolors[i] = CONVERT_RGB(vv); } -#endif } - CLXCON(clxcon); - CLXCON2(clxcon2); - calcdiw(); - //v = serper; - //serper = 0; - //SERPER(v); - for (i = 0; i < 8; i++) { - SPRxCTLPOS(i); + CLXCON (clxcon); + CLXCON2 (clxcon2); + calcdiw (); + for (int i = 0; i < 8; i++) { + SPRxCTLPOS (i); nr_armed += spr[i].armed != 0; } - if (!currprefs.produce_sound) { - eventtab[ev_audio].active = false; - events_schedule(); - } - - //write_log(_T("CPU=%d Chipset=%s %s\n"), - // currprefs.cpu_model, - // (currprefs.chipset_mask & CSMASK_AGA) ? _T("AGA") : - // (currprefs.chipset_mask & (CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE)) == (CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE) ? _T("Full ECS") : - // (currprefs.chipset_mask & CSMASK_ECS_DENISE) ? _T("ECS Denise") : - // (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? _T("ECS") : - // _T("OCS"), currprefs.ntscmode ? _T("NTSC") : _T("PAL")); - //write_log(_T("State restored\n")); + if (! currprefs.produce_sound) { + eventtab[ev_audio].active = 0; + events_schedule (); + } } - sprres = expand_sprres(bplcon0, bplcon3); - sprite_width = GET_SPRITEWIDTH(fmode); - setup_fmodes(0); - shdelay_disabled = false; + sprres = expand_sprres (bplcon0, bplcon3); + sprite_width = GET_SPRITEWIDTH (fmode); + setup_fmodes (0); #ifdef ACTION_REPLAY /* Doing this here ensures we can use the 'reset' command from within AR */ - action_replay_reset(hardreset, keyboardreset); -#endif -#if defined(ENFORCER) - enforcer_disable(); + action_replay_reset (hardreset, keyboardreset); #endif - if (hardreset) - rtc_hardreset(); + if (hardreset) + rtc_hardreset(); #ifdef PICASSO96 - picasso_reset(); + picasso_reset (); #endif } -//void dumpcustom(void) -//{ -// write_log(_T("DMACON: %04x INTENA: %04x (%04x) INTREQ: %04x (%04x) VPOS: %x HPOS: %x\n"), DMACONR(current_hpos()), -// intena, intena_internal, intreq, intreq_internal, vpos, current_hpos()); -// write_log(_T("COP1LC: %08lx, COP2LC: %08lx COPPTR: %08lx\n"), (unsigned long)cop1lc, (unsigned long)cop2lc, cop_state.ip); -// write_log(_T("DIWSTRT: %04x DIWSTOP: %04x DDFSTRT: %04x DDFSTOP: %04x\n"), -// (unsigned int)diwstrt, (unsigned int)diwstop, (unsigned int)ddfstrt, (unsigned int)ddfstop); -// write_log(_T("BPLCON 0: %04x 1: %04x 2: %04x 3: %04x 4: %04x LOF=%d/%d HDIW=%d VDIW=%d\n"), -// bplcon0, bplcon1, bplcon2, bplcon3, bplcon4, -// lof_current, lof_store, -// hdiwstate == DIW_waiting_start ? 0 : 1, diwstate == DIW_waiting_start ? 0 : 1); -// if (timeframes) { -// write_log(_T("Average frame time: %.2f ms [frames: %d time: %d]\n"), -// double(frametime) / timeframes, timeframes, frametime); -// if (total_skipped) -// write_log(_T("Skipped frames: %d\n"), total_skipped); -// } -//} - -static void gen_custom_tables(void) +static void gen_custom_tables (void) { - int i; - for (i = 0; i < 256; i++) { + for (int i = 0; i < 256; i++) { sprtaba[i] = ((((i >> 7) & 1) << 0) | (((i >> 6) & 1) << 2) | (((i >> 5) & 1) << 4) @@ -8354,11 +6290,11 @@ static void gen_custom_tables(void) | (((i >> 2) & 1) << 10) | (((i >> 1) & 1) << 12) | (((i >> 0) & 1) << 14)); - sprtabb[i] = sprtaba[i] * 2; + sprtabb[i] = sprtaba[i] * 2; sprite_ab_merge[i] = (((i & 15) ? 1 : 0) | ((i & 240) ? 2 : 0)); } - for (i = 0; i < 16; i++) { + for (int i = 0; i < 16; i++) { clxmask[i] = (((i & 1) ? 0xF : 0x3) | ((i & 2) ? 0xF0 : 0x30) | ((i & 4) ? 0xF00 : 0x300) @@ -8372,510 +6308,490 @@ static void gen_custom_tables(void) } } -/* mousehack is now in "filesys boot rom" */ -static uae_u32 REGPARAM2 mousehack_helper_old(struct TrapContext *ctx) +static int allocate_sprite_tables (void) { - return 0; + if(curr_sprite_entries == 0) + curr_sprite_entries = xmalloc (struct sprite_entry, MAX_SPR_PIXELS / 16); + if(curr_color_changes == 0) + curr_color_changes = xmalloc (struct color_change, MAX_REG_CHANGE); + + return 1; } -int custom_init(void) +int custom_init (void) { + if (!allocate_sprite_tables()) + return 0; #ifdef AUTOCONFIG if (uae_boot_rom_type) { - uaecptr pos; - pos = here(); + uaecptr pos; + pos = here (); - org(rtarea_base + 0xFF70); - calltrap(deftrap(mousehack_helper_old)); - dw(RTS); + org (rtarea_base + 0xFFA0); + calltrap (deftrap (timehack_helper)); + dw (RTS); - org(rtarea_base + 0xFFA0); - calltrap(deftrap(timehack_helper)); - dw(RTS); - - org(pos); - } + org (pos); + } #endif - gen_custom_tables(); - build_blitfilltable(); + gen_custom_tables (); + build_blitfilltable (); - drawing_init(); + next_sprite_entry = 0; + drawing_init (); - create_cycle_diagram_table(); + create_cycle_diagram_table (); - return 1; + return 1; } /* Custom chip memory bank */ -static uae_u32 REGPARAM3 custom_lget(uaecptr) REGPARAM; -static uae_u32 REGPARAM3 custom_wget(uaecptr) REGPARAM; -static uae_u32 REGPARAM3 custom_bget(uaecptr) REGPARAM; -static uae_u32 REGPARAM3 custom_lgeti(uaecptr) REGPARAM; -static uae_u32 REGPARAM3 custom_wgeti(uaecptr) REGPARAM; -static void REGPARAM3 custom_lput(uaecptr, uae_u32) REGPARAM; -static void REGPARAM3 custom_wput(uaecptr, uae_u32) REGPARAM; -static void REGPARAM3 custom_bput(uaecptr, uae_u32) REGPARAM; +static uae_u32 REGPARAM3 custom_lget (uaecptr) REGPARAM; +static uae_u32 REGPARAM3 custom_wget (uaecptr) REGPARAM; +static uae_u32 REGPARAM3 custom_bget (uaecptr) REGPARAM; +static uae_u32 REGPARAM3 custom_lgeti (uaecptr) REGPARAM; +static uae_u32 REGPARAM3 custom_wgeti (uaecptr) REGPARAM; +static void REGPARAM3 custom_lput (uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 custom_wput (uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 custom_bput (uaecptr, uae_u32) REGPARAM; addrbank custom_bank = { - custom_lget, custom_wget, custom_bget, - custom_lput, custom_wput, custom_bput, - default_xlate, default_check, nullptr, nullptr, _T("Custom chipset"), + custom_lget, custom_wget, custom_bget, + custom_lput, custom_wput, custom_bput, + default_xlate, default_check, NULL, NULL, _T("Custom chipset"), custom_lgeti, custom_wgeti, - ABFLAG_IO, S_READ, S_WRITE, nullptr, 0x1ff, 0xdff000 + ABFLAG_IO, S_READ, S_WRITE, NULL, 0x1ff, 0xdff000 }; -static uae_u32 REGPARAM2 custom_wgeti(uaecptr addr) +static uae_u32 REGPARAM2 custom_wgeti (uaecptr addr) { - if (currprefs.cpu_model >= 68020) - return dummy_wgeti(addr); - return custom_wget(addr); + if (currprefs.cpu_model >= 68020) + return dummy_wgeti(addr); + return custom_wget(addr); } -static uae_u32 REGPARAM2 custom_lgeti(uaecptr addr) +static uae_u32 REGPARAM2 custom_lgeti (uaecptr addr) { - if (currprefs.cpu_model >= 68020) - return dummy_lgeti(addr); - return custom_lget(addr); + if (currprefs.cpu_model >= 68020) + return dummy_lgeti(addr); + return custom_lget(addr); } -static uae_u32 REGPARAM2 custom_wget_1(int hpos, uaecptr addr, int noput, bool isbyte) +STATIC_INLINE uae_u32 REGPARAM2 custom_wget_1 (uaecptr addr, int noput) { - uae_u16 v; + uae_u16 v; int missing; addr &= 0xfff; + switch (addr & 0x1fe) { + case 0x000: v = 0xffff; break; /* BPLDDAT */ + case 0x002: v = DMACONR (current_hpos ()); break; + case 0x004: v = VPOSR (); break; + case 0x006: v = VHPOSR (); break; - switch (addr & 0x1fe) { - case 0x002: v = DMACONR(hpos); break; - case 0x004: v = VPOSR(); break; - case 0x006: v = VHPOSR(); break; + case 0x008: v = 0xffff; break; - case 0x00A: v = JOY0DAT(); break; - case 0x00C: v = JOY1DAT(); break; - case 0x00E: v = CLXDAT(); break; - case 0x010: v = ADKCONR(); break; + case 0x00A: v = JOY0DAT (); break; + case 0x00C: v = JOY1DAT (); break; + case 0x00E: v = CLXDAT (); break; + case 0x010: v = ADKCONR (); break; - case 0x012: v = POT0DAT(); break; - case 0x014: v = POT1DAT(); break; - case 0x016: v = POTGOR(); break; - //case 0x018: v = SERDATR(); break; - case 0x01A: v = DSKBYTR(hpos); break; - case 0x01C: v = INTENAR(); break; - case 0x01E: v = INTREQR(); break; - case 0x07C: - v = DENISEID(&missing); - if (missing) - goto writeonly; - break; + case 0x012: v = POT0DAT (); break; + case 0x014: v = POT1DAT (); break; + case 0x016: v = POTGOR (); break; + case 0x018: v = 0x3000 /* no data */; break; + case 0x01A: v = DSKBYTR (current_hpos ()); break; + case 0x01C: v = INTENAR (); break; + case 0x01E: v = INTREQR (); break; + case 0x07C: + v = DENISEID (&missing); + if (missing) + goto writeonly; + break; -#ifdef AGA - case 0x180: case 0x182: case 0x184: case 0x186: case 0x188: case 0x18A: - case 0x18C: case 0x18E: case 0x190: case 0x192: case 0x194: case 0x196: - case 0x198: case 0x19A: case 0x19C: case 0x19E: case 0x1A0: case 0x1A2: - case 0x1A4: case 0x1A6: case 0x1A8: case 0x1AA: case 0x1AC: case 0x1AE: - case 0x1B0: case 0x1B2: case 0x1B4: case 0x1B6: case 0x1B8: case 0x1BA: - case 0x1BC: case 0x1BE: - if (!(currprefs.chipset_mask & CSMASK_AGA)) - goto writeonly; - v = COLOR_READ((addr & 0x3E) / 2); - break; -#endif + case 0x180: case 0x182: case 0x184: case 0x186: case 0x188: case 0x18A: + case 0x18C: case 0x18E: case 0x190: case 0x192: case 0x194: case 0x196: + case 0x198: case 0x19A: case 0x19C: case 0x19E: case 0x1A0: case 0x1A2: + case 0x1A4: case 0x1A6: case 0x1A8: case 0x1AA: case 0x1AC: case 0x1AE: + case 0x1B0: case 0x1B2: case 0x1B4: case 0x1B6: case 0x1B8: case 0x1BA: + case 0x1BC: case 0x1BE: + if (!(aga_mode)) + goto writeonly; + v = COLOR_READ ((addr & 0x3E) / 2); + break; - default: - writeonly: - /* OCS/ECS: - * reading write-only register causes write with last value in chip - * bus (custom registers, chipram, slowram) - * and finally returns either all ones or something weird if DMA happens - * in next (or previous) cycle.. FIXME. - * - * OCS-only special case: DFF000 (BLTDDAT) will always return whatever was left in bus - * - * AGA: - * Can also return last CPU accessed value - * Remembers old last_custom_value1 - */ - v = last_custom_value1; - SET_LINE_CYCLEBASED; - if (!noput) { - int r, c, bmdma; - uae_u16 l; + default: +writeonly: + /* OCS/ECS: + * reading write-only register causes write with last value in chip + * bus (custom registers, chipram, slowram) + * and finally returns either all ones or something weird if DMA happens + * in next (or previous) cycle.. FIXME. + * + * OCS-only special case: DFF000 (BLTDDAT) will always return whatever was left in bus + * + * AGA: + * Can also return last CPU accessed value + * Remembers old last_custom_value1 + */ + v = last_custom_value1; + SET_LINE_CYCLEBASED; + if (!noput) { + int bmdma; + uae_u16 l; + int hpos = current_hpos (); - if (currprefs.chipset_mask & CSMASK_AGA) { - l = 0; - } - else { - // last chip bus value (read or write) is written to register - if (currprefs.cpu_compatible && currprefs.cpu_model == 68000) { - if (isbyte) - l = (regs.chipset_latch_rw << 8) | (regs.chipset_latch_rw & 0xff); - else - l = regs.chipset_latch_rw; - } - else { - l = regs.chipset_latch_rw; - } - } - decide_line(hpos); - decide_fetch_safe(hpos); - //debug_wputpeek(0xdff000 + addr, l); - r = custom_wput_1(hpos, addr, l, 1); + if (aga_mode) { + l = 0; + } else { + l = currprefs.cpu_compatible && currprefs.cpu_model == 68000 ? regs.irc : 0xffff; + } + decide_line (hpos); + decide_fetch_safe (hpos); + custom_wput_1 (hpos, addr, l, 1); - // CPU gets back (OCS/ECS only): - // - if last cycle was DMA cycle: DMA cycle data - // - if last cycle was not DMA cycle: FFFF or some ANDed old data. - // -#ifdef CPUEMU_13 - c = cycle_line[hpos] & CYCLE_MASK; - bmdma = is_bitplane_dma(hpos); - if (currprefs.chipset_mask & CSMASK_AGA) { - if (bmdma || (c > CYCLE_REFRESH && c < CYCLE_CPU)) { - v = last_custom_value1; - } - else if (c == CYCLE_CPU) { - v = regs.db; - } - else { - v = last_custom_value1 >> ((addr & 2) ? 0 : 16); - } - } - else { - if (bmdma || (c > CYCLE_REFRESH && c < CYCLE_CPU)) { - v = last_custom_value1; - } - else { - // refresh checked because refresh cycles do not always - // set last_custom_value1 for performance reasons. - v = 0xffff; - } - } -#endif - return v; + // CPU gets back (OCS/ECS only): + // - if last cycle was DMA cycle: DMA cycle data + // - if last cycle was not DMA cycle: FFFF or some ANDed old data. + // + bmdma = is_bitplane_dma(hpos); + if (aga_mode) { + if (bmdma) { + v = last_custom_value1; + } else { + v = last_custom_value1 >> ((addr & 2) ? 0 : 16); + } + } else { + if (bmdma) { + v = last_custom_value1; + } else { + // refresh checked because refresh cycles do not always + // set last_custom_value1 for performance reasons. + v = 0xffff; + } + } + return v; } - } - return v; + } + return v; } -static uae_u32 custom_wget2(uaecptr addr, bool byte) +STATIC_INLINE uae_u32 custom_wget2 (uaecptr addr) { - uae_u32 v; - int hpos = current_hpos(); + uae_u32 v; + int hpos = current_hpos (); - sync_copper_with_cpu(hpos, 1); - v = custom_wget_1(hpos, addr, 0, byte); - return v; + sync_copper_with_cpu (hpos, 1, addr); + v = custom_wget_1 (addr, 0); +#ifdef ACTION_REPLAY +#ifdef ACTION_REPLAY_COMMON + addr &= 0x1ff; + ar_custom[addr + 0] = (uae_u8)(v >> 8); + ar_custom[addr + 1] = (uae_u8)(v); +#endif +#endif + return v; } -static uae_u32 REGPARAM2 custom_wget(uaecptr addr) +static uae_u32 REGPARAM2 custom_wget (uaecptr addr) { - uae_u32 v; + uae_u32 v; if ((addr & 0xffff) < 0x8000 && currprefs.cs_fatgaryrev >= 0) return dummy_get(addr, 2, false, 0); - if (addr & 1) { - /* think about move.w $dff005,d0.. (68020+ only) */ - addr &= ~1; - v = custom_wget2(addr, false) << 8; - v |= custom_wget2(addr + 2, false) >> 8; - return v; - } - return custom_wget2(addr, false); + if (addr & 1) { + /* think about move.w $dff005,d0.. (68020+ only) */ + addr &= ~1; + v = custom_wget2 (addr) << 8; + v |= custom_wget2 (addr + 2) >> 8; + return v & 0xFFFF; + } + return custom_wget2 (addr); } -static uae_u32 REGPARAM2 custom_bget(uaecptr addr) +static uae_u32 REGPARAM2 custom_bget (uaecptr addr) { uae_u32 v; if ((addr & 0xffff) < 0x8000 && currprefs.cs_fatgaryrev >= 0) return dummy_get(addr, 1, false, 0); - v = custom_wget2(addr & ~1, true); - v >>= (addr & 1 ? 0 : 8); - return v; + v = custom_wget2 (addr & ~1); + v >>= (addr & 1 ? 0 : 8); + return v & 0xFF; } -static uae_u32 REGPARAM2 custom_lget(uaecptr addr) +static uae_u32 REGPARAM2 custom_lget (uaecptr addr) { if ((addr & 0xffff) < 0x8000 && currprefs.cs_fatgaryrev >= 0) return dummy_get(addr, 4, false, 0); - return (uae_u32(custom_wget(addr)) << 16) | custom_wget(addr + 2); + return ((uae_u32)custom_wget (addr) << 16) | custom_wget (addr + 2); } -static int REGPARAM2 custom_wput_1(int hpos, uaecptr addr, uae_u32 value, int noget) +static int REGPARAM2 custom_wput_1 (int hpos, uaecptr addr, uae_u32 value, int noget) { - addr &= 0x1FE; - value &= 0xffff; - - switch (addr) { - case 0x00E: CLXDAT(); break; - - case 0x020: DSKPTH(value); break; - case 0x022: DSKPTL(value); break; - case 0x024: DSKLEN(value, hpos); break; - case 0x026: /* DSKDAT (value). Writing to DMA write registers won't do anything */; break; - case 0x028: REFPTR(value); break; - case 0x02A: VPOSW(value); break; - case 0x02C: VHPOSW(value); break; - case 0x02E: COPCON(value); break; - //case 0x030: SERDAT(value); break; - //case 0x032: SERPER(value); break; - case 0x034: POTGO(value); break; - - case 0x040: BLTCON0(hpos, value); break; - case 0x042: BLTCON1(hpos, value); break; - - case 0x044: BLTAFWM(hpos, value); break; - case 0x046: BLTALWM(hpos, value); break; - - case 0x050: BLTAPTH(hpos, value); break; - case 0x052: BLTAPTL(hpos, value); break; - case 0x04C: BLTBPTH(hpos, value); break; - case 0x04E: BLTBPTL(hpos, value); break; - case 0x048: BLTCPTH(hpos, value); break; - case 0x04A: BLTCPTL(hpos, value); break; - case 0x054: BLTDPTH(hpos, value); break; - case 0x056: BLTDPTL(hpos, value); break; - - case 0x058: BLTSIZE(hpos, value); break; - - case 0x064: BLTAMOD(hpos, value); break; - case 0x062: BLTBMOD(hpos, value); break; - case 0x060: BLTCMOD(hpos, value); break; - case 0x066: BLTDMOD(hpos, value); break; - - case 0x070: BLTCDAT(hpos, value); break; - case 0x072: BLTBDAT(hpos, value); break; - case 0x074: BLTADAT(hpos, value); break; - - case 0x07E: DSKSYNC(hpos, value); break; - - case 0x080: COP1LCH(value); break; - case 0x082: COP1LCL(value); break; - case 0x084: COP2LCH(value); break; - case 0x086: COP2LCL(value); break; - - case 0x088: COPJMP(1, 0); break; - case 0x08A: COPJMP(2, 0); break; - - case 0x08E: DIWSTRT(hpos, value); break; - case 0x090: DIWSTOP(hpos, value); break; - case 0x092: DDFSTRT(hpos, value); break; - case 0x094: DDFSTOP(hpos, value); break; - - case 0x096: DMACON(hpos, value); break; - case 0x098: CLXCON(value); break; - case 0x09A: INTENA(value); break; - case 0x09C: INTREQ(value); break; - case 0x09E: ADKCON(hpos, value); break; - - case 0x0A0: AUDxLCH(0, value); break; - case 0x0A2: AUDxLCL(0, value); break; - case 0x0A4: AUDxLEN(0, value); break; - case 0x0A6: AUDxPER(0, value); break; - case 0x0A8: AUDxVOL(0, value); break; - case 0x0AA: AUDxDAT(0, value); break; - - case 0x0B0: AUDxLCH(1, value); break; - case 0x0B2: AUDxLCL(1, value); break; - case 0x0B4: AUDxLEN(1, value); break; - case 0x0B6: AUDxPER(1, value); break; - case 0x0B8: AUDxVOL(1, value); break; - case 0x0BA: AUDxDAT(1, value); break; - - case 0x0C0: AUDxLCH(2, value); break; - case 0x0C2: AUDxLCL(2, value); break; - case 0x0C4: AUDxLEN(2, value); break; - case 0x0C6: AUDxPER(2, value); break; - case 0x0C8: AUDxVOL(2, value); break; - case 0x0CA: AUDxDAT(2, value); break; - - case 0x0D0: AUDxLCH(3, value); break; - case 0x0D2: AUDxLCL(3, value); break; - case 0x0D4: AUDxLEN(3, value); break; - case 0x0D6: AUDxPER(3, value); break; - case 0x0D8: AUDxVOL(3, value); break; - case 0x0DA: AUDxDAT(3, value); break; - - case 0x0E0: BPLxPTH(hpos, value, 0); break; - case 0x0E2: BPLxPTL(hpos, value, 0); break; - case 0x0E4: BPLxPTH(hpos, value, 1); break; - case 0x0E6: BPLxPTL(hpos, value, 1); break; - case 0x0E8: BPLxPTH(hpos, value, 2); break; - case 0x0EA: BPLxPTL(hpos, value, 2); break; - case 0x0EC: BPLxPTH(hpos, value, 3); break; - case 0x0EE: BPLxPTL(hpos, value, 3); break; - case 0x0F0: BPLxPTH(hpos, value, 4); break; - case 0x0F2: BPLxPTL(hpos, value, 4); break; - case 0x0F4: BPLxPTH(hpos, value, 5); break; - case 0x0F6: BPLxPTL(hpos, value, 5); break; - case 0x0F8: BPLxPTH(hpos, value, 6); break; - case 0x0FA: BPLxPTL(hpos, value, 6); break; - case 0x0FC: BPLxPTH(hpos, value, 7); break; - case 0x0FE: BPLxPTL(hpos, value, 7); break; - - case 0x100: BPLCON0(hpos, value); break; - case 0x102: BPLCON1(hpos, value); break; - case 0x104: BPLCON2(hpos, value); break; -#ifdef ECS_DENISE - case 0x106: BPLCON3(hpos, value); break; + addr &= 0x1FE; + value &= 0xffff; +#ifdef ACTION_REPLAY +#ifdef ACTION_REPLAY_COMMON + ar_custom[addr+0]=(uae_u8)(value>>8); + ar_custom[addr+1]=(uae_u8)(value); #endif - - case 0x108: BPL1MOD(hpos, value); break; - case 0x10A: BPL2MOD(hpos, value); break; -#ifdef AGA - case 0x10E: CLXCON2(value); break; #endif + switch (addr) { + case 0x00E: CLXDAT (); break; - case 0x110: BPLxDAT(hpos, 0, value); break; - case 0x112: BPLxDAT(hpos, 1, value); break; - case 0x114: BPLxDAT(hpos, 2, value); break; - case 0x116: BPLxDAT(hpos, 3, value); break; - case 0x118: BPLxDAT(hpos, 4, value); break; - case 0x11A: BPLxDAT(hpos, 5, value); break; - case 0x11C: BPLxDAT(hpos, 6, value); break; - case 0x11E: BPLxDAT(hpos, 7, value); break; + case 0x020: DSKPTH (value); break; + case 0x022: DSKPTL (value); break; + case 0x024: DSKLEN (value, hpos); break; + case 0x026: /* DSKDAT (value). Writing to DMA write registers won't do anything */; break; + case 0x028: break; + case 0x02A: VPOSW (value); break; + case 0x02C: VHPOSW (value); break; + case 0x02E: COPCON (value); break; + case 0x030: break; + case 0x032: break; + case 0x034: POTGO (value); break; + case 0x036: JOYTEST (value); break; - case 0x180: case 0x182: case 0x184: case 0x186: case 0x188: case 0x18A: - case 0x18C: case 0x18E: case 0x190: case 0x192: case 0x194: case 0x196: - case 0x198: case 0x19A: case 0x19C: case 0x19E: case 0x1A0: case 0x1A2: - case 0x1A4: case 0x1A6: case 0x1A8: case 0x1AA: case 0x1AC: case 0x1AE: - case 0x1B0: case 0x1B2: case 0x1B4: case 0x1B6: case 0x1B8: case 0x1BA: - case 0x1BC: case 0x1BE: - COLOR_WRITE(hpos, value & 0xFFF, (addr & 0x3E) / 2); - break; - case 0x120: case 0x124: case 0x128: case 0x12C: - case 0x130: case 0x134: case 0x138: case 0x13C: - SPRxPTH(hpos, value, (addr - 0x120) / 4); - break; - case 0x122: case 0x126: case 0x12A: case 0x12E: - case 0x132: case 0x136: case 0x13A: case 0x13E: - SPRxPTL(hpos, value, (addr - 0x122) / 4); - break; - case 0x140: case 0x148: case 0x150: case 0x158: - case 0x160: case 0x168: case 0x170: case 0x178: - SPRxPOS(hpos, value, (addr - 0x140) / 8); - break; - case 0x142: case 0x14A: case 0x152: case 0x15A: - case 0x162: case 0x16A: case 0x172: case 0x17A: - SPRxCTL(hpos, value, (addr - 0x142) / 8); - break; - case 0x144: case 0x14C: case 0x154: case 0x15C: - case 0x164: case 0x16C: case 0x174: case 0x17C: - SPRxDATA(hpos, value, (addr - 0x144) / 8); - break; - case 0x146: case 0x14E: case 0x156: case 0x15E: - case 0x166: case 0x16E: case 0x176: case 0x17E: - SPRxDATB(hpos, value, (addr - 0x146) / 8); - break; + case 0x040: BLTCON0 (value); break; + case 0x042: BLTCON1 (value); break; - case 0x36: JOYTEST(value); break; - case 0x5A: BLTCON0L(hpos, value); break; - case 0x5C: BLTSIZV(hpos, value); break; - case 0x5E: BLTSIZH(hpos, value); break; - case 0x1E4: DIWHIGH(hpos, value); break; -#ifdef AGA - case 0x10C: BPLCON4(hpos, value); break; -#endif + case 0x044: BLTAFWM (value); break; + case 0x046: BLTALWM (value); break; - case 0x1DC: BEAMCON0(value); break; - case 0x1C0: if (htotal != value) { htotal = value & (MAXHPOS_ROWS - 1); varsync(); } break; - case 0x1C2: if (hsstop != value) { hsstop = value & (MAXHPOS_ROWS - 1); varsync(); } break; - case 0x1C4: if (hbstrt != value) { hbstrt = value & (MAXHPOS_ROWS - 1); varsync(); } break; - case 0x1C6: if (hbstop != value) { hbstop = value & (MAXHPOS_ROWS - 1); varsync(); } break; - case 0x1C8: if (vtotal != value) { vtotal = value & (MAXVPOS_LINES_ECS - 1); varsync(); } break; - case 0x1CA: if (vsstop != value) { vsstop = value & (MAXVPOS_LINES_ECS - 1); varsync(); } break; - case 0x1CC: if (vbstrt < value || vbstrt >(value & (MAXVPOS_LINES_ECS - 1)) + 1) { vbstrt = value & (MAXVPOS_LINES_ECS - 1); varsync(); } break; - case 0x1CE: if (vbstop < value || vbstop >(value & (MAXVPOS_LINES_ECS - 1)) + 1) { vbstop = value & (MAXVPOS_LINES_ECS - 1); varsync(); } break; - case 0x1DE: if (hsstrt != value) { hsstrt = value & (MAXHPOS_ROWS - 1); varsync(); } break; - case 0x1E0: if (vsstrt != value) { vsstrt = value & (MAXVPOS_LINES_ECS - 1); varsync(); } break; - case 0x1E2: if (hcenter != value) { hcenter = value & (MAXHPOS_ROWS - 1); varsync(); } break; + case 0x048: BLTCPTH (value); break; + case 0x04A: BLTCPTL (value); break; + case 0x04C: BLTBPTH (value); break; + case 0x04E: BLTBPTL (value); break; + case 0x050: BLTAPTH (value); break; + case 0x052: BLTAPTL (value); break; + case 0x054: BLTDPTH (value); break; + case 0x056: BLTDPTL (value); break; -#ifdef AGA - case 0x1FC: FMODE(hpos, value); break; -#endif - case 0x1FE: FNULL(value); break; + case 0x058: BLTSIZE (value); break; + case 0x05A: BLTCON0L (value); break; + case 0x05C: BLTSIZV (value); break; + case 0x05E: BLTSIZH (value); break; - /* writing to read-only register causes read access */ - default: - if (!noget) { - custom_wget_1(hpos, addr, 1, false); - } - return 1; - } - return 0; + case 0x064: BLTAMOD (value); break; + case 0x062: BLTBMOD (value); break; + case 0x060: BLTCMOD (value); break; + case 0x066: BLTDMOD (value); break; + + case 0x070: BLTCDAT (value); break; + case 0x072: BLTBDAT (value); break; + case 0x074: BLTADAT (value); break; + + case 0x07E: DSKSYNC (hpos, value); break; + + case 0x080: COP1LCH (value); break; + case 0x082: COP1LCL (value); break; + case 0x084: COP2LCH (value); break; + case 0x086: COP2LCL (value); break; + + case 0x088: COPJMP (1, 0); break; + case 0x08A: COPJMP (2, 0); break; + + case 0x08E: DIWSTRT (hpos, value); break; + case 0x090: DIWSTOP (hpos, value); break; + case 0x092: DDFSTRT (hpos, value); break; + case 0x094: DDFSTOP (hpos, value); break; + + case 0x096: DMACON (hpos, value); break; + case 0x098: CLXCON (value); break; + case 0x09A: INTENA (value); break; + case 0x09C: INTREQ (value); break; + case 0x09E: ADKCON (hpos, value); break; + + case 0x0A0: AUDxLCH (0, value); break; + case 0x0A2: AUDxLCL (0, value); break; + case 0x0A4: AUDxLEN (0, value); break; + case 0x0A6: AUDxPER (0, value); break; + case 0x0A8: AUDxVOL (0, value); break; + case 0x0AA: AUDxDAT (0, value); break; + + case 0x0B0: AUDxLCH (1, value); break; + case 0x0B2: AUDxLCL (1, value); break; + case 0x0B4: AUDxLEN (1, value); break; + case 0x0B6: AUDxPER (1, value); break; + case 0x0B8: AUDxVOL (1, value); break; + case 0x0BA: AUDxDAT (1, value); break; + + case 0x0C0: AUDxLCH (2, value); break; + case 0x0C2: AUDxLCL (2, value); break; + case 0x0C4: AUDxLEN (2, value); break; + case 0x0C6: AUDxPER (2, value); break; + case 0x0C8: AUDxVOL (2, value); break; + case 0x0CA: AUDxDAT (2, value); break; + + case 0x0D0: AUDxLCH (3, value); break; + case 0x0D2: AUDxLCL (3, value); break; + case 0x0D4: AUDxLEN (3, value); break; + case 0x0D6: AUDxPER (3, value); break; + case 0x0D8: AUDxVOL (3, value); break; + case 0x0DA: AUDxDAT (3, value); break; + + case 0x0E0: BPLxPTH (hpos, value, 0); break; + case 0x0E2: BPLxPTL (hpos, value, 0); break; + case 0x0E4: BPLxPTH (hpos, value, 1); break; + case 0x0E6: BPLxPTL (hpos, value, 1); break; + case 0x0E8: BPLxPTH (hpos, value, 2); break; + case 0x0EA: BPLxPTL (hpos, value, 2); break; + case 0x0EC: BPLxPTH (hpos, value, 3); break; + case 0x0EE: BPLxPTL (hpos, value, 3); break; + case 0x0F0: BPLxPTH (hpos, value, 4); break; + case 0x0F2: BPLxPTL (hpos, value, 4); break; + case 0x0F4: BPLxPTH (hpos, value, 5); break; + case 0x0F6: BPLxPTL (hpos, value, 5); break; + case 0x0F8: BPLxPTH (hpos, value, 6); break; + case 0x0FA: BPLxPTL (hpos, value, 6); break; + case 0x0FC: BPLxPTH (hpos, value, 7); break; + case 0x0FE: BPLxPTL (hpos, value, 7); break; + + case 0x100: BPLCON0 (hpos, value); break; + case 0x102: BPLCON1 (hpos, value); break; + case 0x104: BPLCON2 (hpos, value); break; + case 0x106: BPLCON3 (hpos, value); break; + + case 0x108: BPL1MOD (hpos, value); break; + case 0x10A: BPL2MOD (hpos, value); break; + case 0x10C: BPLCON4 (hpos, value); break; + case 0x10E: CLXCON2 (value); break; + + case 0x110: BPLxDAT (hpos, 0, value); break; + case 0x112: BPLxDAT (hpos, 1, value); break; + case 0x114: BPLxDAT (hpos, 2, value); break; + case 0x116: BPLxDAT (hpos, 3, value); break; + case 0x118: BPLxDAT (hpos, 4, value); break; + case 0x11A: BPLxDAT (hpos, 5, value); break; + case 0x11C: BPLxDAT (hpos, 6, value); break; + case 0x11E: BPLxDAT (hpos, 7, value); break; + + case 0x180: case 0x182: case 0x184: case 0x186: case 0x188: case 0x18A: + case 0x18C: case 0x18E: case 0x190: case 0x192: case 0x194: case 0x196: + case 0x198: case 0x19A: case 0x19C: case 0x19E: case 0x1A0: case 0x1A2: + case 0x1A4: case 0x1A6: case 0x1A8: case 0x1AA: case 0x1AC: case 0x1AE: + case 0x1B0: case 0x1B2: case 0x1B4: case 0x1B6: case 0x1B8: case 0x1BA: + case 0x1BC: case 0x1BE: + COLOR_WRITE (hpos, value & 0xFFF, (addr & 0x3E) / 2); + break; + case 0x120: case 0x124: case 0x128: case 0x12C: + case 0x130: case 0x134: case 0x138: case 0x13C: + SPRxPTH (hpos, value, (addr - 0x120) / 4); + break; + case 0x122: case 0x126: case 0x12A: case 0x12E: + case 0x132: case 0x136: case 0x13A: case 0x13E: + SPRxPTL (hpos, value, (addr - 0x122) / 4); + break; + case 0x140: case 0x148: case 0x150: case 0x158: + case 0x160: case 0x168: case 0x170: case 0x178: + SPRxPOS (hpos, value, (addr - 0x140) / 8); + break; + case 0x142: case 0x14A: case 0x152: case 0x15A: + case 0x162: case 0x16A: case 0x172: case 0x17A: + SPRxCTL (hpos, value, (addr - 0x142) / 8); + break; + case 0x144: case 0x14C: case 0x154: case 0x15C: + case 0x164: case 0x16C: case 0x174: case 0x17C: + SPRxDATA (hpos, value, (addr - 0x144) / 8); + break; + case 0x146: case 0x14E: case 0x156: case 0x15E: + case 0x166: case 0x16E: case 0x176: case 0x17E: + SPRxDATB (hpos, value, (addr - 0x146) / 8); + break; + + case 0x1C0: if (htotal != value) { htotal = value & (MAXHPOS_ROWS - 1); varsync (); } break; + case 0x1C2: if (hsstop != value) { hsstop = value & (MAXHPOS_ROWS - 1); varsync (); } break; + case 0x1C4: if (hbstrt != value) { hbstrt = value & (MAXHPOS_ROWS - 1); varsync (); } break; + case 0x1C6: if (hbstop != value) { hbstop = value & (MAXHPOS_ROWS - 1); varsync (); } break; + case 0x1C8: if (vtotal != value) { vtotal = value & (MAXVPOS_LINES_ECS - 1); varsync (); } break; + case 0x1CA: if (vsstop != value) { vsstop = value & (MAXVPOS_LINES_ECS - 1); varsync (); } break; + case 0x1CC: if (vbstrt < value || vbstrt > (value & (MAXVPOS_LINES_ECS - 1)) + 1) { vbstrt = value & (MAXVPOS_LINES_ECS - 1); varsync (); } break; + case 0x1CE: if (vbstop < value || vbstop > (value & (MAXVPOS_LINES_ECS - 1)) + 1) { vbstop = value & (MAXVPOS_LINES_ECS - 1); varsync (); } break; + case 0x1DC: BEAMCON0 (value); break; + case 0x1DE: if (hsstrt != value) { hsstrt = value & (MAXHPOS_ROWS - 1); varsync (); } break; + case 0x1E0: if (vsstrt != value) { vsstrt = value & (MAXVPOS_LINES_ECS - 1); varsync (); } break; + case 0x1E2: if (hcenter != value) { hcenter = value & (MAXHPOS_ROWS - 1); varsync (); } break; + case 0x1E4: DIWHIGH (hpos, value); break; + + case 0x1FC: FMODE (hpos, value); break; + case 0x1FE: FNULL (value); break; + + /* writing to read-only register causes read access */ + default: + if (!noget) { + custom_wget_1 (addr, 1); + } + return 1; + } + return 0; } -static void REGPARAM2 custom_wput(uaecptr addr, uae_u32 value) +static void REGPARAM2 custom_wput (uaecptr addr, uae_u32 value) { - int hpos = current_hpos(); + int hpos = current_hpos (); if ((addr & 0xffff) < 0x8000 && currprefs.cs_fatgaryrev >= 0) { - dummy_put(addr, 2, value); return; } - - sync_copper_with_cpu(hpos, 1); - if (addr & 1) { - addr &= ~1; - custom_wput_1(hpos, addr, (value >> 8) | (value & 0xff00), 0); - custom_wput_1(hpos, addr + 2, (value << 8) | (value & 0x00ff), 0); - return; -} - custom_wput_1(hpos, addr, value, 0); + sync_copper_with_cpu (hpos, 1, addr); + if (addr & 1) { + addr &= ~1; + custom_wput_1 (hpos, addr, (value >> 8) | (value & 0xff00), 0); + custom_wput_1 (hpos, addr + 2, (value << 8) | (value & 0x00ff), 0); + return; + } + custom_wput_1 (hpos, addr, value, 0); } -static void REGPARAM2 custom_bput(uaecptr addr, uae_u32 value) +static void REGPARAM2 custom_bput (uaecptr addr, uae_u32 value) { uae_u16 rval; if ((addr & 0xffff) < 0x8000 && currprefs.cs_fatgaryrev >= 0) { - dummy_put(addr, 1, value); return; } - if (currprefs.chipset_mask & CSMASK_AGA) { - if (addr & 1) { - rval = value & 0xff; - } - else { - rval = (value << 8) | (value & 0xFF); - } - } - else { + if (aga_mode) { + if (addr & 1) { + rval = value & 0xff; + } else { + rval = (value << 8) | (value & 0xFF); + } + } else { rval = (value << 8) | (value & 0xff); } if (currprefs.cs_bytecustomwritebug) { if (addr & 1) - custom_wput(addr & ~1, rval); + custom_wput (addr & ~1, rval); else - custom_wput(addr, value << 8); - } - else { - custom_wput(addr & ~1, rval); + custom_wput (addr, value << 8); + } else { + custom_wput (addr & ~1, rval); } } static void REGPARAM2 custom_lput(uaecptr addr, uae_u32 value) { if ((addr & 0xffff) < 0x8000 && currprefs.cs_fatgaryrev >= 0) { - dummy_put(addr, 4, value); return; } - custom_wput(addr & 0xfffe, value >> 16); - custom_wput((addr + 2) & 0xfffe, (uae_u16)value); + custom_wput (addr & 0xfffe, value >> 16); + custom_wput ((addr + 2) & 0xfffe, (uae_u16)value); } #ifdef SAVESTATE -void custom_prepare_savestate(void) +void custom_prepare_savestate (void) { - int i; + int i; - for (i = 0; i < ev2_max; i++) { - if (eventtab2[i].active) { - eventtab2[i].active = false; - eventtab2[i].handler(eventtab2[i].data); - } - } + for (i = 0; i < ev2_max; i++) { + if (eventtab2[i].active) { + eventtab2[i].active = 0; + eventtab2[i].handler(eventtab2[i].data); + } + } } #define RB restore_u8 () @@ -8884,1006 +6800,484 @@ void custom_prepare_savestate(void) #define RW restore_u16 () #define RL restore_u32 () -uae_u8 *restore_custom(uae_u8 *src) +uae_u8 *restore_custom (uae_u8 *src) { - uae_u16 dsklen, dskbytr; - int dskpt; - int i; + uae_u16 dsklen, dskbytr, ru16; + int dskpt; + int i; - audio_reset(); + audio_reset (); - changed_prefs.chipset_mask = currprefs.chipset_mask = RL & CSMASK_MASK; - update_mirrors(); - RW; /* 000 BLTDDAT */ - RW; /* 002 DMACONR */ - RW; /* 004 VPOSR */ - RW; /* 006 VHPOSR */ - RW; /* 008 DSKDATR (dummy register) */ - JOYSET(0, RW); /* 00A JOY0DAT */ - JOYSET(1, RW); /* 00C JOY1DAT */ - clxdat = RW; /* 00E CLXDAT */ - RW; /* 010 ADKCONR */ - RW; /* 012 POT0DAT* */ - RW; /* 014 POT1DAT* */ - RW; /* 016 POTINP* */ - RW; /* 018 SERDATR* */ - dskbytr = RW; /* 01A DSKBYTR */ - RW; /* 01C INTENAR */ - RW; /* 01E INTREQR */ - dskpt = RL; /* 020-022 DSKPT */ - dsklen = RW; /* 024 DSKLEN */ - RW; /* 026 DSKDAT */ - refptr = RW; /* 028 REFPTR */ - i = RW; lof_store = lof_current = (i & 0x8000) ? 1 : 0; lol = (i & 0x0080) ? 1 : 0; /* 02A VPOSW */ - RW; /* 02C VHPOSW */ - COPCON(RW); /* 02E COPCON */ - RW; /* 030 SERDAT* */ - //serper = RW; /* 032 SERPER* */ - potgo_value = 0; POTGO(RW); /* 034 POTGO */ - RW; /* 036 JOYTEST* */ - RW; /* 038 STREQU */ - RW; /* 03A STRVHBL */ - RW; /* 03C STRHOR */ - RW; /* 03E STRLONG */ - BLTCON0(0, RW); /* 040 BLTCON0 */ - BLTCON1(0, RW); /* 042 BLTCON1 */ - BLTAFWM(0, RW); /* 044 BLTAFWM */ - BLTALWM(0, RW); /* 046 BLTALWM */ - BLTCPTH(0, RW); BLTCPTL(0, RW); /* 048-04B BLTCPT */ - BLTBPTH(0, RW); BLTBPTL(0, RW); /* 04C-04F BLTBPT */ - BLTAPTH(0, RW); BLTAPTL(0, RW); /* 050-053 BLTAPT */ - BLTDPTH(0, RW); BLTDPTL(0, RW); /* 054-057 BLTDPT */ - RW; /* 058 BLTSIZE */ - RW; /* 05A BLTCON0L */ - blt_info.vblitsize = RW;/* 05C BLTSIZV */ - blt_info.hblitsize = RW;/* 05E BLTSIZH */ - BLTCMOD(0, RW); /* 060 BLTCMOD */ - BLTBMOD(0, RW); /* 062 BLTBMOD */ - BLTAMOD(0, RW); /* 064 BLTAMOD */ - BLTDMOD(0, RW); /* 066 BLTDMOD */ - RW; /* 068 ? */ - RW; /* 06A ? */ - RW; /* 06C ? */ - RW; /* 06E ? */ - BLTCDAT(0, RW); /* 070 BLTCDAT */ - BLTBDAT(0, RW); /* 072 BLTBDAT */ - BLTADAT(0, RW); /* 074 BLTADAT */ - RW; /* 076 ? */ - RW; /* 078 ? */ - RW; /* 07A ? */ - RW; /* 07C LISAID */ - DSKSYNC(-1, RW); /* 07E DSKSYNC */ - cop1lc = RL; /* 080/082 COP1LC */ - cop2lc = RL; /* 084/086 COP2LC */ - RW; /* 088 ? */ - RW; /* 08A ? */ - RW; /* 08C ? */ - diwstrt = RW; /* 08E DIWSTRT */ - diwstop = RW; /* 090 DIWSTOP */ - ddfstrt = RW; /* 092 DDFSTRT */ - ddfstop = RW; /* 094 DDFSTOP */ - dmacon = RW & ~(0x2000 | 0x4000); /* 096 DMACON */ - CLXCON(RW); /* 098 CLXCON */ - intena = intena_internal = RW; /* 09A INTENA */ - intreq = RW; /* 09C INTREQ */ - intreq_internal = intreq; - adkcon = RW; /* 09E ADKCON */ - for (i = 0; i < 8; i++) - bplptx[i] = bplpt[i] = RL; - bplcon0 = RW; /* 100 BPLCON0 */ - bplcon1 = RW; /* 102 BPLCON1 */ - bplcon2 = RW; /* 104 BPLCON2 */ - bplcon3 = RW; /* 106 BPLCON3 */ - bpl1mod = RW; /* 108 BPL1MOD */ - bpl2mod = RW; /* 10A BPL2MOD */ - bplcon4 = RW; /* 10C BPLCON4 */ - clxcon2 = RW; /* 10E CLXCON2* */ - for (i = 0; i < 8; i++) - fetched[i] = RW; /* BPLXDAT */ - for (i = 0; i < 32; i++) { + changed_prefs.chipset_mask = currprefs.chipset_mask = RL & CSMASK_MASK; + update_mirrors(); + blt_info.bltddat = RW; /* 000 BLTDDAT */ + ru16 = RW; /* 002 DMACONR -> see also 096 */ + if((ru16 & 0x4000) == 0) + bltstate = BLT_done; + blt_info.blitzero = (ru16 & 0x2000 ? 1 : 0); + RW; /* 004 VPOSR */ + RW; /* 006 VHPOSR */ + RW; /* 008 DSKDATR (dummy register) */ + JOYSET(0, RW); /* 00A JOY0DAT */ + JOYSET(1, RW); /* 00C JOY1DAT */ + clxdat = RW; /* 00E CLXDAT */ + RW; /* 010 ADKCONR -> see 09E */ + RW; /* 012 POT0DAT */ + RW; /* 014 POT1DAT */ + RW; /* 016 POTINP -> see 034 */ + RW; /* 018 SERDATR* */ + dskbytr = RW; /* 01A DSKBYTR */ + RW; /* 01C INTENAR -> see 09A */ + RW; /* 01E INTREQR -> see 09C */ + dskpt = RL; /* 020-022 DSKPT */ + dsklen = RW; /* 024 DSKLEN */ + RW; /* 026 DSKDAT */ + RW; /* 028 REFPTR */ + i = RW; lof_store = lof_current = (i & 0x8000) ? 1 : 0; /* 02A VPOSW */ + RW; /* 02C VHPOSW */ + COPCON(RW); /* 02E COPCON */ + RW; /* 030 SERDAT */ + RW; /* 032 SERPER* */ + potgo_value = 0; POTGO (RW); /* 034 POTGO */ + RW; /* 036 JOYTEST* */ + RW; /* 038 STREQU */ + RW; /* 03A STRVHBL */ + RW; /* 03C STRHOR */ + RW; /* 03E STRLONG */ + BLTCON0(RW); /* 040 BLTCON0 */ + BLTCON1(RW); /* 042 BLTCON1 */ + BLTAFWM(RW); /* 044 BLTAFWM */ + BLTALWM(RW); /* 046 BLTALWM */ + bltcpt = RL; /* 048-04B BLTCPT */ + bltbpt = RL; /* 04C-04F BLTBPT */ + bltapt = RL; /* 050-053 BLTAPT */ + bltdpt = RL; /* 054-057 BLTDPT */ + RW; /* 058 BLTSIZE */ + RW; /* 05A BLTCON0L -> see 040 */ + blt_info.vblitsize=RW; /* 05C BLTSIZV */ + blt_info.hblitsize=RW; /* 05E BLTSIZH */ + blt_info.bltcmod = RW; /* 060 BLTCMOD */ + blt_info.bltbmod = RW; /* 062 BLTBMOD */ + blt_info.bltamod = RW; /* 064 BLTAMOD */ + blt_info.bltdmod = RW; /* 066 BLTDMOD */ + RW; /* 068 ? */ + RW; /* 06A ? */ + RW; /* 06C ? */ + RW; /* 06E ? */ + blt_info.bltcdat =RW; /* 070 BLTCDAT */ + BLTBDAT(RW); /* 072 BLTBDAT */ + blt_info.bltadat=RW; /* 074 BLTADAT */ + RW; /* 076 ? */ + RW; /* 078 ? */ + RW; /* 07A ? */ + RW; /* 07C LISAID */ + ru16=RW; DSKSYNC(-1, ru16); /* 07E DSKSYNC */ + cop1lc = RL; /* 080/082 COP1LC */ + cop2lc = RL; /* 084/086 COP2LC */ + RW; /* 088 COPJMP1 */ + RW; /* 08A COPJMP2 */ + RW; /* 08C COPINS */ + diwstrt = RW; /* 08E DIWSTRT */ + diwstop = RW; /* 090 DIWSTOP */ + ddfstrt = RW; /* 092 DDFSTRT */ + ddfstop = RW; /* 094 DDFSTOP */ + dmacon = RW & ~(0x2000|0x4000); /* 096 DMACON */ + CLXCON(RW); /* 098 CLXCON */ + intena = RW; /* 09A INTENA */ + intreq = RW; /* 09C INTREQ */ + adkcon = RW; /* 09E ADKCON */ + /* 0A0 - 0DE Audio regs */ + for (i = 0; i < 8; i++) + bplpt[i] = RL; + bplcon0 = RW; /* 100 BPLCON0 */ + bplcon1 = RW; /* 102 BPLCON1 */ + bplcon2 = RW; /* 104 BPLCON2 */ + bplcon3 = RW; /* 106 BPLCON3 */ + bpl1mod = RW; /* 108 BPL1MOD */ + bpl2mod = RW; /* 10A BPL2MOD */ + bplcon4 = RW; /* 10C BPLCON4 */ + CLXCON2(RW); /* 10E CLXCON2* */ + for(i = 0; i < 8; i++) + fetched[i] = RW; /* BPLXDAT */ + /* 120 - 17E Sprite regs */ + for(i = 0; i < 32; i++) { uae_u16 v = RW; - color_regs_genlock[i] = (v & 0x8000) != 0; - current_colors.color_regs_ecs[i] = v & 0xfff; /* 180 COLORxx */ - } - htotal = RW; /* 1C0 HTOTAL */ - hsstop = RW; /* 1C2 HSTOP ? */ - hbstrt = RW; /* 1C4 HBSTRT ? */ - hbstop = RW; /* 1C6 HBSTOP ? */ - vtotal = RW; /* 1C8 VTOTAL */ - vsstop = RW; /* 1CA VSSTOP */ - vbstrt = RW; /* 1CC VBSTRT */ - vbstop = RW; /* 1CE VBSTOP */ - RW; /* 1D0 ? */ - RW; /* 1D2 ? */ - RW; /* 1D4 ? */ - RW; /* 1D6 ? */ - RW; /* 1D8 ? */ - RW; /* 1DA ? */ - new_beamcon0 = RW; /* 1DC BEAMCON0 */ - hsstrt = RW; /* 1DE HSSTRT */ - vsstrt = RW; /* 1E0 VSSTT */ - hcenter = RW; /* 1E2 HCENTER */ - diwhigh = RW; /* 1E4 DIWHIGH */ - diwhigh_written = (diwhigh & 0x8000) ? 1 : 0; - hdiwstate = (diwhigh & 0x4000) ? DIW_waiting_stop : DIW_waiting_start; - diwhigh &= 0x3fff; - RW; /* 1E6 ? */ - RW; /* 1E8 ? */ - RW; /* 1EA ? */ - RW; /* 1EC ? */ - RW; /* 1EE ? */ - RW; /* 1F0 ? */ - RW; /* 1F2 ? */ - RW; /* 1F4 ? */ - RW; /* 1F6 ? */ - RW; /* 1F8 ? */ - i = RW; /* 1FA ? */ - if (i & 0x8000) - currprefs.ntscmode = changed_prefs.ntscmode = i & 1; + current_colors.color_regs_ecs[i] = v & 0xfff; /* 180-1BE COLORxx */ + } + htotal = RW; /* 1C0 HTOTAL */ + hsstop = RW; /* 1C2 HSTOP ? */ + hbstrt = RW; /* 1C4 HBSTRT ? */ + hbstop = RW; /* 1C6 HBSTOP ? */ + vtotal = RW; /* 1C8 VTOTAL */ + vsstop = RW; /* 1CA VSSTOP */ + vbstrt = RW; /* 1CC VBSTRT */ + vbstop = RW; /* 1CE VBSTOP */ + RW; /* 1D0 ? */ + RW; /* 1D2 ? */ + RW; /* 1D4 ? */ + RW; /* 1D6 ? */ + RW; /* 1D8 ? */ + RW; /* 1DA ? */ + new_beamcon0 = RW; /* 1DC BEAMCON0 */ + hsstrt = RW; /* 1DE HSSTRT */ + vsstrt = RW; /* 1E0 VSSTT */ + hcenter = RW; /* 1E2 HCENTER */ + diwhigh = RW; /* 1E4 DIWHIGH */ + diwhigh_written = (diwhigh & 0x8000) ? 1 : 0; + hdiwstate = (diwhigh & 0x4000) ? DIW_waiting_stop : DIW_waiting_start; + diwhigh &= 0x3fff; + RW; /* 1E6 ? */ + RW; /* 1E8 ? */ + RW; /* 1EA ? */ + RW; /* 1EC ? */ + RW; /* 1EE ? */ + RW; /* 1F0 ? */ + RW; /* 1F2 ? */ + RW; /* 1F4 ? */ + RW; /* 1F6 ? */ + RW; /* 1F8 ? */ + i = RW; /* 1FA ? */ + if (i & 0x8000) + currprefs.ntscmode = changed_prefs.ntscmode = i & 1; fmode = fmode_saved = RW; /* 1FC FMODE */ - last_custom_value1 = RW;/* 1FE ? */ + last_custom_value1 = RW; /* 1FE ? */ current_colors.extra = 0; - if (isbrdblank(-1, bplcon0, bplcon3)) + if (isbrdblank (-1, bplcon0, bplcon3)) current_colors.extra |= 1 << CE_BORDERBLANK; if (issprbrd(-1, bplcon0, bplcon3)) current_colors.extra |= 1 << CE_BORDERSPRITE; - if ((currprefs.chipset_mask & CSMASK_ECS_DENISE) && (bplcon0 & 1) && (bplcon3 & 0x10)) - current_colors.extra |= 1 << CE_BORDERNTRANS; - DISK_restore_custom(dskpt, dsklen, dskbytr); + DISK_restore_custom (dskpt, dsklen, dskbytr); - return src; + FMODE (0, fmode); + + return src; } -#endif /* SAVESTATE */ - -#if defined SAVESTATE || defined DEBUGGER - #define SB save_u8 #define SW save_u16 #define SL save_u32 -uae_u8 *save_custom(int *len, uae_u8 *dstptr, int full) +uae_u8 *save_custom (int *len, uae_u8 *dstptr, int full) { - uae_u8 *dstbak, *dst; + uae_u8 *dstbak, *dst; int i, dummy; - uae_u32 dskpt; - uae_u16 dsklen, dsksync, dskbytr; + uae_u32 dskpt; + uae_u16 dsklen, dsksync, dskbytr; - DISK_save_custom(&dskpt, &dsklen, &dsksync, &dskbytr); + DISK_save_custom (&dskpt, &dsklen, &dsksync, &dskbytr); - if (dstptr) - dstbak = dst = dstptr; - else - dstbak = dst = xmalloc(uae_u8, 8 + 256 * 2); + if (dstptr) + dstbak = dst = dstptr; + else + dstbak = dst = xmalloc (uae_u8, 8 + 256 * 2); - SL(currprefs.chipset_mask); - SW(0); /* 000 BLTDDAT */ - SW(dmacon); /* 002 DMACONR */ - SW(VPOSR()); /* 004 VPOSR */ - SW(VHPOSR()); /* 006 VHPOSR */ - SW(0); /* 008 DSKDATR */ - SW(JOYGET(0)); /* 00A JOY0DAT */ - SW(JOYGET(1)); /* 00C JOY1DAT */ - SW(clxdat | 0x8000); /* 00E CLXDAT */ - SW(ADKCONR()); /* 010 ADKCONR */ - SW(POT0DAT()); /* 012 POT0DAT */ - SW(POT1DAT()); /* 014 POT1DAT */ - SW(0); /* 016 POTINP * */ - SW(0); /* 018 SERDATR * */ - SW(dskbytr); /* 01A DSKBYTR */ - SW(INTENAR()); /* 01C INTENAR */ - SW(INTREQR()); /* 01E INTREQR */ - SL(dskpt); /* 020-023 DSKPT */ - SW(dsklen); /* 024 DSKLEN */ - SW(0); /* 026 DSKDAT */ - SW(refptr); /* 028 REFPTR */ - SW((lof_store ? 0x8001 : 0) | (lol ? 0x0080 : 0));/* 02A VPOSW */ - SW(0); /* 02C VHPOSW */ - SW(copcon); /* 02E COPCON */ - //SW(serdat); /* 030 SERDAT * */ - //SW(serper); /* 032 SERPER * */ - SW(potgo_value); /* 034 POTGO */ - SW(0); /* 036 JOYTEST * */ - SW(0); /* 038 STREQU */ - SW(0); /* 03A STRVBL */ - SW(0); /* 03C STRHOR */ - SW(0); /* 03E STRLONG */ - SW(bltcon0); /* 040 BLTCON0 */ - SW(bltcon1); /* 042 BLTCON1 */ - SW(blt_info.bltafwm); /* 044 BLTAFWM */ - SW(blt_info.bltalwm); /* 046 BLTALWM */ - SL(bltcpt); /* 048-04B BLTCPT */ - SL(bltbpt); /* 04C-04F BLTCPT */ - SL(bltapt); /* 050-053 BLTCPT */ - SL(bltdpt); /* 054-057 BLTCPT */ - SW(0); /* 058 BLTSIZE */ - SW(0); /* 05A BLTCON0L (use BLTCON0 instead) */ - SW(blt_info.vblitsize);/* 05C BLTSIZV */ - SW(blt_info.hblitsize);/* 05E BLTSIZH */ - SW(blt_info.bltcmod); /* 060 BLTCMOD */ - SW(blt_info.bltbmod); /* 062 BLTBMOD */ - SW(blt_info.bltamod); /* 064 BLTAMOD */ - SW(blt_info.bltdmod); /* 066 BLTDMOD */ - SW(0); /* 068 ? */ - SW(0); /* 06A ? */ - SW(0); /* 06C ? */ - SW(0); /* 06E ? */ - SW(blt_info.bltcdat); /* 070 BLTCDAT */ - SW(blt_info.bltbdat); /* 072 BLTBDAT */ - SW(blt_info.bltadat); /* 074 BLTADAT */ - SW(0); /* 076 ? */ - SW(0); /* 078 ? */ - SW(0); /* 07A ? */ - SW(DENISEID(&dummy)); /* 07C DENISEID/LISAID */ - SW(dsksync); /* 07E DSKSYNC */ - SL(cop1lc); /* 080-083 COP1LC */ - SL(cop2lc); /* 084-087 COP2LC */ - SW(0); /* 088 ? */ - SW(0); /* 08A ? */ - SW(0); /* 08C ? */ - SW(diwstrt); /* 08E DIWSTRT */ - SW(diwstop); /* 090 DIWSTOP */ - SW(ddfstrt); /* 092 DDFSTRT */ - SW(ddfstop); /* 094 DDFSTOP */ - SW(dmacon); /* 096 DMACON */ - SW(clxcon); /* 098 CLXCON */ - SW(intena); /* 09A INTENA */ - SW(intreq); /* 09C INTREQ */ - SW(adkcon); /* 09E ADKCON */ - for (i = 0; full && i < 32; i++) - SW(0); - for (i = 0; i < 8; i++) - SL(bplpt[i]); /* 0E0-0FE BPLxPT */ - SW(bplcon0); /* 100 BPLCON0 */ - SW(bplcon1); /* 102 BPLCON1 */ - SW(bplcon2); /* 104 BPLCON2 */ - SW(bplcon3); /* 106 BPLCON3 */ - SW(bpl1mod); /* 108 BPL1MOD */ - SW(bpl2mod); /* 10A BPL2MOD */ - SW(bplcon4); /* 10C BPLCON4 */ - SW(clxcon2); /* 10E CLXCON2 */ - for (i = 0; i < 8; i++) - SW(fetched[i]); /* 110 BPLxDAT */ - if (full) { - for (i = 0; i < 8; i++) { - SL(spr[i].pt); /* 120-13E SPRxPT */ + SL (currprefs.chipset_mask); + SW (blt_info.bltddat); /* 000 BLTDDAT */ + SW (dmacon); /* 002 DMACONR */ + SW (VPOSR()); /* 004 VPOSR */ + SW (VHPOSR()); /* 006 VHPOSR */ + SW (0); /* 008 DSKDATR */ + SW (JOYGET (0)); /* 00A JOY0DAT */ + SW (JOYGET (1)); /* 00C JOY1DAT */ + SW (clxdat | 0x8000); /* 00E CLXDAT */ + SW (ADKCONR()); /* 010 ADKCONR */ + SW (POT0DAT()); /* 012 POT0DAT */ + SW (POT1DAT()); /* 014 POT1DAT */ + SW (0) ; /* 016 POTINP * */ + SW (0); /* 018 SERDATR * */ + SW (dskbytr); /* 01A DSKBYTR */ + SW (INTENAR()); /* 01C INTENAR */ + SW (INTREQR()); /* 01E INTREQR */ + SL (dskpt); /* 020-023 DSKPT */ + SW (dsklen); /* 024 DSKLEN */ + SW (0); /* 026 DSKDAT */ + SW (0); /* 028 REFPTR */ + SW ((lof_store ? 0x8001 : 0)); /* 02A VPOSW */ + SW (0); /* 02C VHPOSW */ + SW (copcon); /* 02E COPCON */ + SW (0); /* 030 SERDAT * */ + SW (0); /* 032 SERPER * */ + SW (potgo_value); /* 034 POTGO */ + SW (0); /* 036 JOYTEST * */ + SW (0); /* 038 STREQU */ + SW (0); /* 03A STRVBL */ + SW (0); /* 03C STRHOR */ + SW (0); /* 03E STRLONG */ + SW (bltcon0); /* 040 BLTCON0 */ + SW (bltcon1); /* 042 BLTCON1 */ + SW (blt_info.bltafwm); /* 044 BLTAFWM */ + SW (blt_info.bltalwm); /* 046 BLTALWM */ + SL (bltcpt); /* 048-04B BLTCPT */ + SL (bltbpt); /* 04C-04F BLTBPT */ + SL (bltapt); /* 050-053 BLTAPT */ + SL (bltdpt); /* 054-057 BLTDPT */ + SW (0); /* 058 BLTSIZE */ + SW (0); /* 05A BLTCON0L (use BLTCON0 instead) */ + SW (blt_info.vblitsize); /* 05C BLTSIZV */ + SW (blt_info.hblitsize); /* 05E BLTSIZH */ + SW (blt_info.bltcmod); /* 060 BLTCMOD */ + SW (blt_info.bltbmod); /* 062 BLTBMOD */ + SW (blt_info.bltamod); /* 064 BLTAMOD */ + SW (blt_info.bltdmod); /* 066 BLTDMOD */ + SW (0); /* 068 ? */ + SW (0); /* 06A ? */ + SW (0); /* 06C ? */ + SW (0); /* 06E ? */ + SW (blt_info.bltcdat); /* 070 BLTCDAT */ + SW (blt_info.bltbdat); /* 072 BLTBDAT */ + SW (blt_info.bltadat); /* 074 BLTADAT */ + SW (0); /* 076 ? */ + SW (0); /* 078 ? */ + SW (0); /* 07A ? */ + SW (DENISEID (&dummy)); /* 07C DENISEID/LISAID */ + SW (dsksync); /* 07E DSKSYNC */ + SL (cop1lc); /* 080-083 COP1LC */ + SL (cop2lc); /* 084-087 COP2LC */ + SW (0); /* 088 COPJMP1 */ + SW (0); /* 08A COPJMP2 */ + SW (0); /* 08C COPINS */ + SW (diwstrt); /* 08E DIWSTRT */ + SW (diwstop); /* 090 DIWSTOP */ + SW (ddfstrt); /* 092 DDFSTRT */ + SW (ddfstop); /* 094 DDFSTOP */ + SW (dmacon); /* 096 DMACON */ + SW (clxcon); /* 098 CLXCON */ + SW (intena); /* 09A INTENA */ + SW (intreq); /* 09C INTREQ */ + SW (adkcon); /* 09E ADKCON */ + /* 0A0 - 0DE Audio regs */ + for (i = 0; full && i < 32; i++) + SW (0); + for (i = 0; i < 8; i++) + SL (bplpt[i]); /* 0E0-0FE BPLxPT */ + SW (bplcon0); /* 100 BPLCON0 */ + SW (bplcon1); /* 102 BPLCON1 */ + SW (bplcon2); /* 104 BPLCON2 */ + SW (bplcon3); /* 106 BPLCON3 */ + SW (bpl1mod); /* 108 BPL1MOD */ + SW (bpl2mod); /* 10A BPL2MOD */ + SW (bplcon4); /* 10C BPLCON4 */ + SW (clxcon2); /* 10E CLXCON2 */ + for (i = 0;i < 8; i++) + SW (fetched[i]); /* 110 BPLxDAT */ + /* 120 - 17E Sprite regs */ + if (full) { + for (i = 0; i < 8; i++) { + SL (spr[i].pt); /* 120-13E SPRxPT */ } for (i = 0; i < 8; i++) { - SW(sprpos[i]); /* 1x0 SPRxPOS */ - SW(sprctl[i]); /* 1x2 SPRxPOS */ - SW(sprdata[i][0]); /* 1x4 SPRxDATA */ - SW(sprdatb[i][0]); /* 1x6 SPRxDATB */ - } - } - for (i = 0; i < 32; i++) { - if (currprefs.chipset_mask & CSMASK_AGA) { - uae_u32 v = current_colors.color_regs_aga[i]; - uae_u16 v2; - v &= 0x00f0f0f0; - v2 = (v >> 4) & 15; - v2 |= ((v >> 12) & 15) << 4; - v2 |= ((v >> 20) & 15) << 8; - SW(v2); - } - else { - uae_u16 v = current_colors.color_regs_ecs[i]; - if (color_regs_genlock[i]) - v |= 0x8000; - SW(v); /* 180-1BE COLORxx */ - } - } - SW(htotal); /* 1C0 HTOTAL */ - SW(hsstop); /* 1C2 HSTOP*/ - SW(hbstrt); /* 1C4 HBSTRT */ - SW(hbstop); /* 1C6 HBSTOP */ - SW(vtotal); /* 1C8 VTOTAL */ - SW(vsstop); /* 1CA VSSTOP */ - SW(vbstrt); /* 1CC VBSTRT */ - SW(vbstop); /* 1CE VBSTOP */ - SW(0); /* 1D0 */ - SW(0); /* 1D2 */ - SW(0); /* 1D4 */ - SW(0); /* 1D6 */ - SW(0); /* 1D8 */ - SW(0); /* 1DA */ - SW(beamcon0); /* 1DC BEAMCON0 */ - SW(hsstrt); /* 1DE HSSTRT */ - SW(vsstrt); /* 1E0 VSSTRT */ - SW(hcenter); /* 1E2 HCENTER */ - SW(diwhigh | (diwhigh_written ? 0x8000 : 0) | (hdiwstate == DIW_waiting_stop ? 0x4000 : 0)); /* 1E4 DIWHIGH */ - SW(0); /* 1E6 */ - SW(0); /* 1E8 */ - SW(0); /* 1EA */ - SW(0); /* 1EC */ - SW(0); /* 1EE */ - SW(0); /* 1F0 */ - SW(0); /* 1F2 */ - SW(0); /* 1F4 */ - SW(0); /* 1F6 */ - SW(0); /* 1F8 */ - SW(0x8000 | (currprefs.ntscmode ? 1 : 0)); /* 1FA (re-used for NTSC) */ - SW(fmode); /* 1FC FMODE */ - SW(last_custom_value1); /* 1FE */ + SW (sprpos[i]); /* 1x0 SPRxPOS */ + SW (sprctl[i]); /* 1x2 SPRxPOS */ + SW (sprdata[i][0]); /* 1x4 SPRxDATA */ + SW (sprdatb[i][0]); /* 1x6 SPRxDATB */ + } + } + for ( i = 0; i < 32; i++) + SW (current_colors.color_regs_ecs[i]); /* 180-1BE COLORxx */ + SW (htotal); /* 1C0 HTOTAL */ + SW (hsstop); /* 1C2 HSTOP */ + SW (hbstrt); /* 1C4 HBSTRT */ + SW (hbstop); /* 1C6 HBSTOP */ + SW (vtotal); /* 1C8 VTOTAL */ + SW (vsstop); /* 1CA VSSTOP */ + SW (vbstrt); /* 1CC VBSTRT */ + SW (vbstop); /* 1CE VBSTOP */ + SW (0); /* 1D0 */ + SW (0); /* 1D2 */ + SW (0); /* 1D4 */ + SW (0); /* 1D6 */ + SW (0); /* 1D8 */ + SW (0); /* 1DA */ + SW (beamcon0); /* 1DC BEAMCON0 */ + SW (hsstrt); /* 1DE HSSTRT */ + SW (vsstrt); /* 1E0 VSSTRT */ + SW (hcenter); /* 1E2 HCENTER */ + SW (diwhigh | (diwhigh_written ? 0x8000 : 0) | (hdiwstate == DIW_waiting_stop ? 0x4000 : 0)); /* 1E4 DIWHIGH */ + SW (0); /* 1E6 */ + SW (0); /* 1E8 */ + SW (0); /* 1EA */ + SW (0); /* 1EC */ + SW (0); /* 1EE */ + SW (0); /* 1F0 */ + SW (0); /* 1F2 */ + SW (0); /* 1F4 */ + SW (0); /* 1F6 */ + SW (0); /* 1F8 */ + SW (0x8000 | (currprefs.ntscmode ? 1 : 0)); /* 1FA (re-used for NTSC) */ + SW (fmode); /* 1FC FMODE */ + SW (last_custom_value1); /* 1FE */ - *len = dst - dstbak; - return dstbak; + *len = dst - dstbak; + return dstbak; } -#endif /* SAVESTATE || DEBUGGER */ - -#ifdef SAVESTATE - -uae_u8 *restore_custom_agacolors(uae_u8 *src) +uae_u8 *restore_custom_agacolors (uae_u8 *src) { - int i; + int i; - for (i = 0; i < 256; i++) { -#ifdef AGA + for (i = 0; i < 256; i++) { uae_u32 v = RL; - color_regs_genlock[i] = 0; - if (v & 0x80000000) - color_regs_genlock[i] = 1; - v &= 0x80ffffff; - current_colors.color_regs_aga[i] = v; -#else - RL; -#endif - } - return src; + v &= 0x00ffffff; + current_colors.color_regs_aga[i] = v; + } + return src; } -uae_u8 *save_custom_agacolors(int *len, uae_u8 *dstptr) +uae_u8 *save_custom_agacolors (int *len, uae_u8 *dstptr) { - uae_u8 *dstbak, *dst; - int i; + uae_u8 *dstbak, *dst; - if (dstptr) - dstbak = dst = dstptr; - else - dstbak = dst = xmalloc(uae_u8, 256 * 4); - for (i = 0; i < 256; i++) -#ifdef AGA - SL(current_colors.color_regs_aga[i] | (color_regs_genlock[i] ? 0x80000000 : 0)); -#else - SL(0); -#endif - *len = dst - dstbak; - return dstbak; + if (dstptr) + dstbak = dst = dstptr; + else + dstbak = dst = xmalloc (uae_u8, 256 * 4); + for (int i = 0; i < 256; i++) + SL (current_colors.color_regs_aga[i]); + *len = dst - dstbak; + return dstbak; } -uae_u8 *restore_custom_sprite(int num, uae_u8 *src) +uae_u8 *restore_custom_sprite (int num, uae_u8 *src) { - memset(&spr[num], 0, sizeof(struct sprite)); - spr[num].pt = RL; /* 120-13E SPRxPT */ - sprpos[num] = RW; /* 1x0 SPRxPOS */ - sprctl[num] = RW; /* 1x2 SPRxPOS */ - sprdata[num][0] = RW; /* 1x4 SPRxDATA */ - sprdatb[num][0] = RW; /* 1x6 SPRxDATB */ - sprdata[num][1] = RW; - sprdatb[num][1] = RW; - sprdata[num][2] = RW; - sprdatb[num][2] = RW; - sprdata[num][3] = RW; - sprdatb[num][3] = RW; + memset (&spr[num], 0, sizeof (struct sprite)); + spr[num].pt = RL; /* 120-13E SPRxPT */ + sprpos[num] = RW; /* 1x0 SPRxPOS */ + sprctl[num] = RW; /* 1x2 SPRxPOS */ + sprdata[num][0] = RW; /* 1x4 SPRxDATA */ + sprdatb[num][0] = RW; /* 1x6 SPRxDATB */ + sprdata[num][1] = RW; + sprdatb[num][1] = RW; + sprdata[num][2] = RW; + sprdatb[num][2] = RW; + sprdata[num][3] = RW; + sprdatb[num][3] = RW; spr[num].armed = RB & 1; - return src; + return src; } uae_u8 *save_custom_sprite(int num, int *len, uae_u8 *dstptr) { - uae_u8 *dstbak, *dst; + uae_u8 *dstbak, *dst; - if (dstptr) - dstbak = dst = dstptr; - else - dstbak = dst = xmalloc(uae_u8, 30); - SL(spr[num].pt); /* 120-13E SPRxPT */ - SW(sprpos[num]); /* 1x0 SPRxPOS */ - SW(sprctl[num]); /* 1x2 SPRxPOS */ - SW(sprdata[num][0]); /* 1x4 SPRxDATA */ - SW(sprdatb[num][0]); /* 1x6 SPRxDATB */ - SW(sprdata[num][1]); - SW(sprdatb[num][1]); - SW(sprdata[num][2]); - SW(sprdatb[num][2]); - SW(sprdata[num][3]); - SW(sprdatb[num][3]); - SB(spr[num].armed ? 1 : 0); - *len = dst - dstbak; - return dstbak; + if (dstptr) + dstbak = dst = dstptr; + else + dstbak = dst = xmalloc (uae_u8, 30); + SL (spr[num].pt); /* 120-13E SPRxPT */ + SW (sprpos[num]); /* 1x0 SPRxPOS */ + SW (sprctl[num]); /* 1x2 SPRxPOS */ + SW (sprdata[num][0]); /* 1x4 SPRxDATA */ + SW (sprdatb[num][0]); /* 1x6 SPRxDATB */ + SW (sprdata[num][1]); + SW (sprdatb[num][1]); + SW (sprdata[num][2]); + SW (sprdatb[num][2]); + SW (sprdata[num][3]); + SW (sprdatb[num][3]); + SB (spr[num].armed ? 1 : 0); + *len = dst - dstbak; + return dstbak; } -uae_u8 *restore_custom_extra(uae_u8 *src) +uae_u8 *restore_custom_extra (uae_u8 *src) { - uae_u32 v = restore_u32(); + uae_u32 v = restore_u32 (); if (!(v & 1)) v = 0; currprefs.cs_compatible = changed_prefs.cs_compatible = v >> 24; - cia_set_overlay((v & 2) != 0); + cia_set_overlay ((v & 2) != 0); - currprefs.genlock = changed_prefs.genlock = RBB; currprefs.cs_rtc = changed_prefs.cs_rtc = RB; - currprefs.cs_rtc_adjust = changed_prefs.cs_rtc_adjust = RL; - - currprefs.cs_a1000ram = changed_prefs.cs_a1000ram = RBB; - currprefs.cs_slowmemisfast = changed_prefs.cs_slowmemisfast = RBB; - - RBB; - RBB; - currprefs.cs_cdtvscsi = changed_prefs.cs_cdtvscsi = RBB; currprefs.cs_pcmcia = changed_prefs.cs_pcmcia = RBB; currprefs.cs_ciaatod = changed_prefs.cs_ciaatod = RB; currprefs.cs_ciaoverlay = changed_prefs.cs_ciaoverlay = RBB; - currprefs.cs_agnusbltbusybug = changed_prefs.cs_agnusbltbusybug = RBB; - currprefs.cs_denisenoehb = changed_prefs.cs_denisenoehb = RBB; - - currprefs.cs_agnusrev = changed_prefs.cs_agnusrev = SRB; - currprefs.cs_deniserev = changed_prefs.cs_deniserev = SRB; currprefs.cs_fatgaryrev = changed_prefs.cs_fatgaryrev = SRB; currprefs.cs_ramseyrev = changed_prefs.cs_ramseyrev = SRB; currprefs.cs_cd32c2p = changed_prefs.cs_cd32c2p = RBB; currprefs.cs_cd32cd = changed_prefs.cs_cd32cd = RBB; currprefs.cs_cd32nvram = changed_prefs.cs_cd32nvram = RBB; - currprefs.cs_cdtvcd = changed_prefs.cs_cdtvcd = RBB; - currprefs.cs_cdtvram = changed_prefs.cs_cdtvram = RBB; - currprefs.cs_cdtvcard = changed_prefs.cs_cdtvcard = RB; currprefs.cs_df0idhw = changed_prefs.cs_df0idhw = RBB; - currprefs.cs_dipagnus = changed_prefs.cs_dipagnus = RBB; currprefs.cs_ide = changed_prefs.cs_ide = RB; - currprefs.cs_mbdmac = changed_prefs.cs_mbdmac = RB; currprefs.cs_ksmirror_a8 = changed_prefs.cs_ksmirror_a8 = RBB; currprefs.cs_ksmirror_e0 = changed_prefs.cs_ksmirror_e0 = RBB; - currprefs.cs_resetwarning = changed_prefs.cs_resetwarning = RBB; currprefs.cs_z3autoconfig = changed_prefs.cs_z3autoconfig = RBB; - currprefs.cs_1mchipjumper = changed_prefs.cs_1mchipjumper = RBB; return src; } -uae_u8 *save_custom_extra(int *len, uae_u8 *dstptr) +uae_u8 *save_custom_extra (int *len, uae_u8 *dstptr) { uae_u8 *dstbak, *dst; if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = xmalloc(uae_u8, 1000); + dstbak = dst = xmalloc (uae_u8, 1000); - SL((currprefs.cs_compatible << 24) | 1); - SB(currprefs.genlock ? 1 : 0); - SB(currprefs.cs_rtc); - SL(currprefs.cs_rtc_adjust); + SL ((currprefs.cs_compatible << 24) | (&get_mem_bank (0) != &chipmem_bank ? 2 : 0) | 1); + SB (currprefs.cs_rtc); - SB(currprefs.cs_a1000ram ? 1 : 0); - SB(currprefs.cs_slowmemisfast ? 1 : 0); + SB (currprefs.cs_pcmcia ? 1 : 0); + SB (currprefs.cs_ciaatod); + SB (currprefs.cs_ciaoverlay ? 1 : 0); - SB(is_board_enabled(&currprefs, ROMTYPE_A2091, 0) ? 1 : 0); - SB(is_board_enabled(&currprefs, ROMTYPE_A4091, 0) ? 1 : 0); - SB(currprefs.cs_cdtvscsi ? 1 : 0); + SB (currprefs.cs_fatgaryrev); + SB (currprefs.cs_ramseyrev); - SB(currprefs.cs_pcmcia ? 1 : 0); - SB(currprefs.cs_ciaatod); - SB(currprefs.cs_ciaoverlay ? 1 : 0); + SB (currprefs.cs_cd32c2p); + SB (currprefs.cs_cd32cd); + SB (currprefs.cs_cd32nvram); - SB(currprefs.cs_agnusbltbusybug ? 1 : 0); - SB(currprefs.cs_denisenoehb ? 1 : 0); - - SB(currprefs.cs_agnusrev); - SB(currprefs.cs_deniserev); - SB(currprefs.cs_fatgaryrev); - SB(currprefs.cs_ramseyrev); - - SB(currprefs.cs_cd32c2p); - SB(currprefs.cs_cd32cd); - SB(currprefs.cs_cd32nvram); - SB(currprefs.cs_cdtvcd ? 1 : 0); - SB(currprefs.cs_cdtvram ? 1 : 0); - SB(currprefs.cs_cdtvcard); - - SB(currprefs.cs_df0idhw ? 1 : 0); - SB(currprefs.cs_dipagnus ? 1 : 0); - SB(currprefs.cs_ide); - SB(currprefs.cs_mbdmac); - SB(currprefs.cs_ksmirror_a8 ? 1 : 0); - SB(currprefs.cs_ksmirror_e0 ? 1 : 0); - SB(currprefs.cs_resetwarning ? 1 : 0); - SB(currprefs.cs_z3autoconfig ? 1 : 0); - SB(currprefs.cs_1mchipjumper ? 1 : 0); + SB (currprefs.cs_df0idhw ? 1 : 0); + SB (currprefs.cs_ide); + SB (currprefs.cs_ksmirror_a8 ? 1 : 0); + SB (currprefs.cs_ksmirror_e0 ? 1 : 0); + SB (currprefs.cs_z3autoconfig ? 1 : 0); *len = dst - dstbak; return dstbak; } -uae_u8 *restore_custom_event_delay(uae_u8 *src) -{ - if (restore_u32() != 1) - return src; - int cnt = restore_u8(); - for (int i = 0; i < cnt; i++) { - uae_u8 type = restore_u8(); - evt e = restore_u64(); - uae_u32 data = restore_u32(); - if (type == 1) - event2_newevent_xx(-1, e, data, send_interrupt_do); - } - return src; -} -uae_u8 *save_custom_event_delay(int *len, uae_u8 *dstptr) -{ - uae_u8 *dstbak, *dst; - int cnt = 0; - - for (int i = ev2_misc; i < ev2_max; i++) { - struct ev2 *e = &eventtab2[i]; - if (e->active && e->handler == send_interrupt_do) { - cnt++; - } - } - if (cnt == 0) - return NULL; - - if (dstptr) - dstbak = dst = dstptr; - else - dstbak = dst = xmalloc(uae_u8, 1000); - - save_u32(1); - save_u8(cnt); - for (int i = ev2_misc; i < ev2_max; i++) { - struct ev2 *e = &eventtab2[i]; - if (e->active && e->handler == send_interrupt_do) { - save_u8(1); - save_u64(e->evtime - get_cycles()); - save_u32(e->data); - - } - } - - *len = dst - dstbak; - return dstbak; -} - - -uae_u8 *save_cycles(int *len, uae_u8 *dstptr) -{ - uae_u8 *dstbak, *dst; - if (dstptr) - dstbak = dst = dstptr; - else - dstbak = dst = xmalloc(uae_u8, 1000); - save_u32(1); - save_u32(CYCLE_UNIT); - save_u64(get_cycles()); - save_u32(extra_cycle); - write_log(_T("SAVECYCLES %08lX\n"), get_cycles()); - *len = dst - dstbak; - return dstbak; -} - -uae_u8 *restore_cycles(uae_u8 *src) -{ - if (restore_u32() != 1) - return src; - restore_u32(); - start_cycles = restore_u64(); - extra_cycle = restore_u32(); - if (extra_cycle < 0 || extra_cycle >= 2 * CYCLE_UNIT) - extra_cycle = 0; - write_log(_T("RESTORECYCLES %08lX\n"), start_cycles); - return src; -} - #endif /* SAVESTATE */ -void check_prefs_changed_custom(void) +void check_prefs_changed_custom (void) { if (!config_changed) return; - currprefs.gfx_framerate = changed_prefs.gfx_framerate; - if (currprefs.turbo_emulation_limit != changed_prefs.turbo_emulation_limit) { - currprefs.turbo_emulation_limit = changed_prefs.turbo_emulation_limit; - if (changed_prefs.turbo_emulation) { - warpmode(changed_prefs.turbo_emulation); - } - } - if (currprefs.turbo_emulation != changed_prefs.turbo_emulation) - warpmode(changed_prefs.turbo_emulation); - if (inputdevice_config_change_test()) - inputdevice_copyconfig(&changed_prefs, &currprefs); - currprefs.immediate_blits = changed_prefs.immediate_blits; + currprefs.gfx_framerate = changed_prefs.gfx_framerate; + if (inputdevice_config_change_test ()) + inputdevice_copyconfig (&changed_prefs, &currprefs); + currprefs.immediate_blits = changed_prefs.immediate_blits; currprefs.waiting_blits = changed_prefs.waiting_blits; - currprefs.collision_level = changed_prefs.collision_level; - if (!currprefs.keyboard_connected && changed_prefs.keyboard_connected) { - // send powerup sync - keyboard_connected(true); - } - else if (currprefs.keyboard_connected && !changed_prefs.keyboard_connected) { - keyboard_connected(false); - } - currprefs.keyboard_connected = changed_prefs.keyboard_connected; + currprefs.collision_level = changed_prefs.collision_level; + currprefs.fast_copper = changed_prefs.fast_copper; - currprefs.cs_ciaatod = changed_prefs.cs_ciaatod; + currprefs.cs_ciaatod = changed_prefs.cs_ciaatod; currprefs.cs_rtc = changed_prefs.cs_rtc; currprefs.cs_cd32cd = changed_prefs.cs_cd32cd; currprefs.cs_cd32c2p = changed_prefs.cs_cd32c2p; currprefs.cs_cd32nvram = changed_prefs.cs_cd32nvram; - currprefs.cs_cdtvcd = changed_prefs.cs_cdtvcd; currprefs.cs_ide = changed_prefs.cs_ide; currprefs.cs_pcmcia = changed_prefs.cs_pcmcia; currprefs.cs_fatgaryrev = changed_prefs.cs_fatgaryrev; currprefs.cs_ramseyrev = changed_prefs.cs_ramseyrev; - currprefs.cs_agnusrev = changed_prefs.cs_agnusrev; - currprefs.cs_deniserev = changed_prefs.cs_deniserev; - currprefs.cs_mbdmac = changed_prefs.cs_mbdmac; currprefs.cs_df0idhw = changed_prefs.cs_df0idhw; - currprefs.cs_slowmemisfast = changed_prefs.cs_slowmemisfast; - currprefs.cs_dipagnus = changed_prefs.cs_dipagnus; - currprefs.cs_denisenoehb = changed_prefs.cs_denisenoehb; currprefs.cs_z3autoconfig = changed_prefs.cs_z3autoconfig; - - if (currprefs.chipset_mask != changed_prefs.chipset_mask || - currprefs.picasso96_nocustom != changed_prefs.picasso96_nocustom || - currprefs.ntscmode != changed_prefs.ntscmode) { - currprefs.picasso96_nocustom = changed_prefs.picasso96_nocustom; - currprefs.chipset_mask = changed_prefs.chipset_mask; - if (currprefs.ntscmode != changed_prefs.ntscmode) { - currprefs.ntscmode = changed_prefs.ntscmode; - new_beamcon0 = currprefs.ntscmode ? 0x00 : 0x20; - } - init_custom(); - } -#ifdef GFXFILTER - struct gfx_filterdata *fd = &currprefs.gf[0]; - struct gfx_filterdata *fdcp = &changed_prefs.gf[0]; - - fd->gfx_filter_horiz_zoom = fdcp->gfx_filter_horiz_zoom; - fd->gfx_filter_vert_zoom = fdcp->gfx_filter_vert_zoom; - fd->gfx_filter_horiz_offset = fdcp->gfx_filter_horiz_offset; - fd->gfx_filter_vert_offset = fdcp->gfx_filter_vert_offset; - fd->gfx_filter_scanlines = fdcp->gfx_filter_scanlines; - - fd->gfx_filter_left_border = fdcp->gfx_filter_left_border; - fd->gfx_filter_right_border = fdcp->gfx_filter_right_border; - fd->gfx_filter_top_border = fdcp->gfx_filter_top_border; - fd->gfx_filter_bottom_border = fdcp->gfx_filter_bottom_border; -#endif -} - -#ifdef CPUEMU_13 - -STATIC_INLINE void sync_copper(int hpos) -{ - if (copper_enabled_thisline) - update_copper(hpos); -} - -STATIC_INLINE void decide_fetch_ce(int hpos) -{ - if ((line_cyclebased || blitter_dangerous_bpl) && vpos < current_maxvpos()) - decide_fetch(hpos); -} - -#define BLIT_NASTY 4 - -// blitter not in nasty mode = CPU gets one cycle if it has been waiting -// at least 4 cycles (all DMA cycles count, not just blitter cycles, even -// blitter idle cycles do count!) - -extern int cpu_tracer; -static int dma_cycle(void) -{ - int hpos, hpos_old; - - blitter_nasty = 1; - if (cpu_tracer < 0) - return current_hpos_safe(); - if (!currprefs.cpu_memory_cycle_exact) - return current_hpos_safe(); - while (currprefs.cpu_memory_cycle_exact) { - int bpldma; - int blitpri = dmacon & DMA_BLITPRI; - hpos_old = current_hpos_safe(); - hpos = hpos_old + 1; - decide_line(hpos); - sync_copper(hpos); - decide_fetch_ce(hpos); - bpldma = is_bitplane_dma(hpos_old); - if (bltstate != BLT_done) { - if (!blitpri && blitter_nasty >= BLIT_NASTY && (cycle_line[hpos_old] & CYCLE_MASK) == 0 && !bpldma) { - alloc_cycle(hpos_old, CYCLE_CPUNASTY); - break; - } - decide_blitter(hpos); - // copper may have been waiting for the blitter - sync_copper(hpos); - } - if ((cycle_line[hpos_old] & CYCLE_MASK) == 0 && !bpldma) { - alloc_cycle(hpos_old, CYCLE_CPU); - break; - } - do_cycles(1 * CYCLE_UNIT); - /* bus was allocated to dma channel, wait for next cycle.. */ - } - return hpos_old; -} - -STATIC_INLINE void checknasty(int hpos, int vpos) -{ - if (blitter_nasty >= BLIT_NASTY && !(dmacon & DMA_BLITPRI)) - record_dma_event(DMA_EVENT_BLITNASTY, hpos, vpos); -} - -static void sync_ce020(void) -{ - unsigned long c; - int extra; - - c = get_cycles(); - extra = c & (CYCLE_UNIT - 1); - if (extra) { - extra = CYCLE_UNIT - extra; - do_cycles(extra); - } -} - -#define SETIFCHIP \ - if (addr < 0xd80000) \ - last_custom_value1 = v; - -uae_u32 wait_cpu_cycle_read(uaecptr addr, int mode) -{ - uae_u32 v = 0; - int hpos; - - hpos = dma_cycle(); - x_do_cycles_pre(CYCLE_UNIT); - -#ifdef DEBUGGER - struct dma_rec *dr = NULL; - if (debug_dma) { - int reg = 0x1000; - if (mode < 0) - reg |= 4; - else if (mode > 0) - reg |= 2; - else - reg |= 1; - dr = record_dma(reg, v, addr, hpos, vpos, mode == -2 || mode == 2 ? DMARECORD_CPU_I : DMARECORD_CPU_D); - checknasty(hpos, vpos); - } -#endif - switch (mode) - { - case -1: - v = get_long(addr); - break; - case -2: - v = get_longi(addr); - break; - case 1: - v = get_word(addr); - break; - case 2: - v = get_wordi(addr); - break; - case 0: - v = get_byte(addr); - break; - } - -#ifdef DEBUGGER - if (debug_dma) - dr->dat = v; -#endif - - x_do_cycles_post(CYCLE_UNIT, v); - - regs.chipset_latch_rw = regs.chipset_latch_read = v; - SETIFCHIP - return v; -} - -uae_u32 wait_cpu_cycle_read_ce020(uaecptr addr, int mode) -{ - uae_u32 v = 0; - int hpos; - - sync_ce020(); - hpos = dma_cycle(); - x_do_cycles_pre(CYCLE_UNIT); - -#ifdef DEBUGGER - struct dma_rec *dr = NULL; - if (debug_dma) { - int reg = 0x1000; - if (mode < 0) - reg |= 4; - else if (mode > 0) - reg |= 2; - else - reg |= 1; - dr = record_dma(reg, v, addr, hpos, vpos, mode == -2 || mode == 2 ? DMARECORD_CPU_I : DMARECORD_CPU_D); - checknasty(hpos, vpos); - } -#endif - switch (mode) { - case -1: - v = get_long(addr); - break; - case -2: - v = get_longi(addr); - break; - case 1: - v = get_word(addr); - break; - case 2: - v = get_wordi(addr); - break; - case 0: - v = get_byte(addr); - break; - } - -#ifdef DEBUGGER - if (debug_dma) - dr->dat = v; -#endif - - x_do_cycles_post(CYCLE_UNIT, v); - - regs.chipset_latch_rw = regs.chipset_latch_read = v; - SETIFCHIP - return v; -} - -void wait_cpu_cycle_write(uaecptr addr, int mode, uae_u32 v) -{ - int hpos; - - hpos = dma_cycle(); - x_do_cycles_pre(CYCLE_UNIT); - -#ifdef DEBUGGER - if (debug_dma) { - int reg = 0x1100; - if (mode < 0) - reg |= 4; - else if (mode > 0) - reg |= 2; - else - reg |= 1; - record_dma(reg, v, addr, hpos, vpos, DMARECORD_CPU_D); - checknasty(hpos, vpos); - } -#endif - - if (mode < 0) - put_long(addr, v); - else if (mode > 0) - put_word(addr, v); - else if (mode == 0) - put_byte(addr, v); - - x_do_cycles_post(CYCLE_UNIT, v); - - regs.chipset_latch_rw = regs.chipset_latch_write = v; - SETIFCHIP -} - -void wait_cpu_cycle_write_ce020(uaecptr addr, int mode, uae_u32 v) -{ - int hpos; - - sync_ce020(); - hpos = dma_cycle(); - x_do_cycles_pre(CYCLE_UNIT); - -#ifdef DEBUGGER - if (debug_dma) { - int reg = 0x1100; - if (mode < 0) - reg |= 4; - else if (mode > 0) - reg |= 2; - else - reg |= 1; - record_dma(reg, v, addr, hpos, vpos, DMARECORD_CPU_D); - checknasty(hpos, vpos); - } -#endif - - if (mode < 0) - put_long(addr, v); - else if (mode > 0) - put_word(addr, v); - else if (mode == 0) - put_byte(addr, v); - - x_do_cycles_post(CYCLE_UNIT, v); - - regs.chipset_latch_rw = regs.chipset_latch_write = v; - SETIFCHIP -} - -void do_cycles_ce(unsigned long cycles) -{ - cycles += extra_cycle; - while (cycles >= CYCLE_UNIT) { - int hpos = current_hpos() + 1; - decide_line(hpos); - sync_copper(hpos); - decide_fetch_ce(hpos); - if (bltstate != BLT_done) - decide_blitter(hpos); - do_cycles(1 * CYCLE_UNIT); - cycles -= CYCLE_UNIT; - } - extra_cycle = cycles; -} - -void do_cycles_ce020(unsigned long cycles) -{ - unsigned long c; - int extra; - - if (!cycles) - return; - c = get_cycles(); - extra = c & (CYCLE_UNIT - 1); - if (extra) { - extra = CYCLE_UNIT - extra; - if (extra >= cycles) { - do_cycles(cycles); - return; - } - do_cycles(extra); - cycles -= extra; - } - c = cycles; - while (c) { - int hpos = current_hpos() + 1; - decide_line(hpos); - sync_copper(hpos); - decide_fetch_ce(hpos); - if (bltstate != BLT_done) - decide_blitter(hpos); - if (c < CYCLE_UNIT) - break; - do_cycles(1 * CYCLE_UNIT); - c -= CYCLE_UNIT; - } - if (c > 0) - do_cycles(c); -} - - -int is_cycle_ce(void) -{ - int hpos = current_hpos(); - return cycle_line[hpos] & CYCLE_MASK; -} - -#endif - -bool isvga(void) -{ - if (!(beamcon0 & 0x80)) - return false; - if (hblank_hz >= 20000) - return true; - return false; -} - -bool ispal(void) -{ - if (beamcon0 & 0x80) - return currprefs.ntscmode == 0; - return maxvpos_display >= MAXVPOS_NTSC + (MAXVPOS_PAL - MAXVPOS_NTSC) / 2; + + if (currprefs.chipset_mask != changed_prefs.chipset_mask || + currprefs.ntscmode != changed_prefs.ntscmode) { + currprefs.chipset_mask = changed_prefs.chipset_mask; + if (currprefs.ntscmode != changed_prefs.ntscmode) { + currprefs.ntscmode = changed_prefs.ntscmode; + new_beamcon0 = currprefs.ntscmode ? 0x00 : 0x20; + } + init_custom (); + } } diff --git a/src/devices.cpp b/src/devices.cpp index 5d383bad..7014f528 100644 --- a/src/devices.cpp +++ b/src/devices.cpp @@ -124,39 +124,39 @@ void reset_all_systems (void) uae_int_requested = 0; } -void do_leave_program (void) +void do_leave_program(void) { #ifdef JIT - compiler_exit(); + compiler_exit(); #endif - graphics_leave (); - inputdevice_close (); - DISK_free (); - close_sound (); - dump_counts (); + graphics_leave(); + inputdevice_close(); + DISK_free(); + close_sound(); + dump_counts(); #ifdef CD32 - akiko_free (); + akiko_free(); cd32_fmv_free(); #endif - gui_exit (); -#ifdef USE_SDL - SDL_Quit (); + gui_exit(); +#if defined (USE_SDL1) || defined(USE_SDL2) + SDL_Quit(); #endif - hardfile_reset(); + hardfile_reset(); #ifdef AUTOCONFIG - expansion_cleanup (); + expansion_cleanup(); #endif #ifdef FILESYS - filesys_cleanup (); + filesys_cleanup(); #endif #ifdef BSDSOCKET - bsdlib_reset (); + bsdlib_reset(); #endif - gayle_free (); - device_func_reset (); - memory_cleanup (); - cfgfile_addcfgparam (0); - machdep_free (); + gayle_free(); + device_func_reset(); + memory_cleanup(); + cfgfile_addcfgparam(0); + machdep_free(); rtarea_free(); } diff --git a/src/disk.cpp b/src/disk.cpp index 28806651..67db6ec2 100644 --- a/src/disk.cpp +++ b/src/disk.cpp @@ -1,4 +1,4 @@ -/* + /* * UAE - The Un*x Amiga Emulator * * Floppy disk emulation @@ -14,50 +14,34 @@ #include "sysconfig.h" #include "sysdeps.h" -int disk_debug_logging = 0; -int disk_debug_mode = 0; -int disk_debug_track = -1; - -#define REVOLUTION_DEBUG 0 #define MFM_VALIDATOR 0 #include "uae.h" #include "options.h" #include "memory.h" #include "custom.h" -#include "ersatz.h" #include "disk.h" #include "gui.h" #include "zfile.h" #include "newcpu.h" -#include "osemu.h" #include "execlib.h" #include "savestate.h" #include "cia.h" -#include "debug.h" #ifdef FDI2RAW #include "fdi2raw.h" #endif -#ifdef CAPS -#include "caps/caps_win32.h" -#endif -#ifdef SCP -#include "scp.h" -#endif #include "crc32.h" -#ifdef RETROPLATFORM -#include "rp.h" -#endif #include "fsdb.h" - -#undef CATWEASEL +#include "rommgr.h" static int longwritemode = 0; /* support HD floppies */ #define FLOPPY_DRIVE_HD /* writable track length with normal 2us bitcell/300RPM motor, 12667 PAL, 12797 NTSC */ -#define FLOPPY_WRITE_LEN (currprefs.floppy_write_length > 256 ? currprefs.floppy_write_length / 2 : (currprefs.ntscmode ? (12798 / 2) : (12668 / 2))) +#define FLOPPY_WRITE_LEN_PAL 12668 +#define FLOPPY_WRITE_LEN_NTSC 12798 +#define FLOPPY_WRITE_LEN (currprefs.floppy_write_length > 256 ? currprefs.floppy_write_length / 2 : (currprefs.ntscmode ? (FLOPPY_WRITE_LEN_NTSC / 2) : (FLOPPY_WRITE_LEN_PAL / 2))) #define FLOPPY_WRITE_MAXLEN 0x3800 /* This works out to 350 */ #define FLOPPY_GAP_LEN (FLOPPY_WRITE_LEN - 11 * 544) @@ -83,8 +67,8 @@ static int longwritemode = 0; * L track length in bits */ -static int side, direction; -static uae_u8 selected = 15, disabled = 0; +static int side, direction, reserved_side; +static uae_u8 selected = 15, disabled, reserved; static uae_u8 writebuffer[544 * MAX_SECTORS]; @@ -93,7 +77,7 @@ static uae_u8 writebuffer[544 * MAX_SECTORS]; #define DISK_REVOLUTION 4 /* 8,16,32,64 */ #define DSKREADY_UP_TIME 18 -#define DSKREADY_DOWN_TIME 45 +#define DSKREADY_DOWN_TIME 24 #define DSKDMA_OFF 0 #define DSKDMA_INIT 1 @@ -114,27 +98,17 @@ static unsigned long dsksync_cycles; int disk_hpos; static int disk_jitter; static int indexdecay; - static uae_u8 prev_data; static int prev_step; +static struct diskinfo disk_info_data = { 0 }; -typedef enum -{ - TRACK_AMIGADOS, - TRACK_RAW, - TRACK_RAW1, - TRACK_PCDOS, - TRACK_DISKSPARE, - TRACK_NONE -} image_tracktype; - -typedef struct -{ - uae_u16 len; - uae_u32 offs; - int bitlen, track; - uae_u16 sync; - image_tracktype type; +typedef enum { TRACK_AMIGADOS, TRACK_RAW, TRACK_RAW1, TRACK_PCDOS, TRACK_DISKSPARE, TRACK_NONE } image_tracktype; +typedef struct { + uae_u16 len; + uae_u32 offs; + int bitlen, track; + uae_u16 sync; + image_tracktype type; int revolutions; } trackid; @@ -155,94 +129,72 @@ typedef struct #define DRIVE_ID_35HD 0xAAAAAAAA #define DRIVE_ID_525SD 0x55555555 /* 40 track 5.25 drive , kickstart does not recognize this */ -typedef enum -{ - ADF_NONE = -1, - ADF_NORMAL, - ADF_EXT1, - ADF_EXT2, - ADF_FDI, - ADF_IPF, - ADF_SCP, - ADF_CATWEASEL, - ADF_PCDOS, - ADF_KICK, - ADF_SKICK -} drive_filetype; - -typedef struct -{ - struct zfile* diskfile; - struct zfile* writediskfile; - drive_filetype filetype; - trackid trackdata[MAX_TRACKS]; - trackid writetrackdata[MAX_TRACKS]; - int buffered_cyl, buffered_side; - int cyl; - bool motoroff; - int motordelay; /* dskrdy needs some clock cycles before it changes after switching off motor */ - bool state; - bool wrprot; +typedef enum { ADF_NONE = -1, ADF_NORMAL, ADF_EXT1, ADF_EXT2, ADF_FDI, ADF_SCP, ADF_PCDOS, ADF_KICK, ADF_SKICK } drive_filetype; +typedef struct { + struct zfile *diskfile; + struct zfile *writediskfile; + struct zfile *pcdecodedfile; + drive_filetype filetype; + trackid trackdata[MAX_TRACKS]; + trackid writetrackdata[MAX_TRACKS]; + int buffered_cyl, buffered_side; + int cyl; + bool motoroff; + int motordelay; /* dskrdy needs some clock cycles before it changes after switching off motor */ + bool state; + bool wrprot; bool forcedwrprot; - uae_u16 bigmfmbuf[0x4000 * DDHDMULT]; - uae_u16 tracktiming[0x4000 * DDHDMULT]; - int multi_revolution; + uae_u16 bigmfmbuf[0x4000 * DDHDMULT]; + uae_u16 tracktiming[0x4000 * DDHDMULT]; + int multi_revolution; int revolution_check; - int skipoffset; - int mfmpos; - int indexoffset; - int tracklen; - int revolutions; - int prevtracklen; - int trackspeed; - int num_tracks, write_num_tracks, num_secs; - int hard_num_cyls; - bool dskchange; - int dskchange_time; - bool dskready; - int dskready_up_time; - int dskready_down_time; - int writtento; - int steplimit; - frame_time_t steplimitcycle; - int indexhack, indexhackmode; - int ddhd; /* 1=DD 2=HD */ - int drive_id_scnt; /* drive id shift counter */ - int idbit; - unsigned long drive_id; /* drive id to be reported */ - TCHAR newname[256]; /* storage space for new filename during eject delay */ + int skipoffset; + int mfmpos; + int indexoffset; + int tracklen; + int revolutions; + int prevtracklen; + int trackspeed; + int num_tracks, write_num_tracks, num_secs, num_heads; + int hard_num_cyls; + bool dskeject; + bool dskchange; + int dskchange_time; + bool dskready; + int dskready_up_time; + int dskready_down_time; + int writtento; + int steplimit; + frame_time_t steplimitcycle; + int indexhack, indexhackmode; + int ddhd; /* 1=DD 2=HD */ + int drive_id_scnt; /* drive id shift counter */ + int idbit; + unsigned long drive_id; /* drive id to be reported */ + TCHAR newname[256]; /* storage space for new filename during eject delay */ bool newnamewriteprotected; - uae_u32 crc32; + uae_u32 crc32; #ifdef FDI2RAW FDI *fdi; #endif - int useturbo; - int floppybitcounter; /* number of bits left */ -#ifdef CATWEASEL - catweasel_drive *catweasel; -#else - int catweasel; - int amax; - int lastdataacesstrack; - int lastrev; - bool track_access_done; -#endif + int useturbo; + int floppybitcounter; /* number of bits left */ } drive; #define MIN_STEPLIMIT_CYCLE (CYCLE_UNIT * 140) static uae_u16 bigmfmbufw[0x4000 * DDHDMULT]; static drive floppy[MAX_FLOPPY_DRIVES]; -static TCHAR dfxhistory[2][MAX_PREVIOUS_FLOPPIES][MAX_DPATH]; +static TCHAR dfxhistory[HISTORY_MAX][MAX_PREVIOUS_IMAGES][MAX_DPATH]; -static uae_u8 exeheader[] = {0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00}; -static uae_u8 bootblock_ofs[] = { - 0x44,0x4f,0x53,0x00,0xc0,0x20,0x0f,0x19,0x00,0x00,0x03,0x70,0x43,0xfa,0x00,0x18, - 0x4e,0xae,0xff,0xa0,0x4a,0x80,0x67,0x0a,0x20,0x40,0x20,0x68,0x00,0x16,0x70,0x00, - 0x4e,0x75,0x70,0xff,0x60,0xfa,0x64,0x6f,0x73,0x2e,0x6c,0x69,0x62,0x72,0x61,0x72, - 0x79 +static uae_u8 exeheader[]={0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00}; +static uae_u8 bootblock_ofs[]={ + 0x44,0x4f,0x53,0x00,0xc0,0x20,0x0f,0x19,0x00,0x00,0x03,0x70,0x43,0xfa,0x00,0x18, + 0x4e,0xae,0xff,0xa0,0x4a,0x80,0x67,0x0a,0x20,0x40,0x20,0x68,0x00,0x16,0x70,0x00, + 0x4e,0x75,0x70,0xff,0x60,0xfa,0x64,0x6f,0x73,0x2e,0x6c,0x69,0x62,0x72,0x61,0x72, + 0x79 }; -static uae_u8 bootblock_ffs[] = { +static uae_u8 bootblock_ffs[]={ 0x44, 0x4F, 0x53, 0x01, 0xE3, 0x3D, 0x0E, 0x72, 0x00, 0x00, 0x03, 0x70, 0x43, 0xFA, 0x00, 0x3E, 0x70, 0x25, 0x4E, 0xAE, 0xFD, 0xD8, 0x4A, 0x80, 0x67, 0x0C, 0x22, 0x40, 0x08, 0xE9, 0x00, 0x06, 0x00, 0x22, 0x4E, 0xAE, 0xFE, 0x62, 0x43, 0xFA, 0x00, 0x18, 0x4E, 0xAE, 0xFF, 0xA0, 0x4A, 0x80, @@ -257,366 +209,332 @@ static uae_u8 bootblock_ffs[] = { #define FS_FLOPPY_TOTALBLOCKS 1760 #define FS_FLOPPY_RESERVED 2 -static void writeimageblock(struct zfile* dst, uae_u8* sector, int offset) +static void writeimageblock (struct zfile *dst, uae_u8 *sector, int offset) { - zfile_fseek(dst, offset, SEEK_SET); - zfile_fwrite(sector, FS_FLOPPY_BLOCKSIZE, 1, dst); + zfile_fseek (dst, offset, SEEK_SET); + zfile_fwrite (sector, FS_FLOPPY_BLOCKSIZE, 1, dst); } -static uae_u32 disk_checksum(uae_u8* p, uae_u8* c) +static uae_u32 disk_checksum (uae_u8 *p, uae_u8 *c) { - uae_u32 cs = 0; - int i; - for (i = 0; i < FS_FLOPPY_BLOCKSIZE; i += 4) - cs += (p[i] << 24) | (p[i + 1] << 16) | (p[i + 2] << 8) | (p[i + 3] << 0); - cs = -cs; - if (c) - { - c[0] = cs >> 24; - c[1] = cs >> 16; - c[2] = cs >> 8; - c[3] = cs >> 0; - } + uae_u32 cs = 0; + int i; + for (i = 0; i < FS_FLOPPY_BLOCKSIZE; i+= 4) + cs += (p[i] << 24) | (p[i+1] << 16) | (p[i+2] << 8) | (p[i+3] << 0); + cs = -cs; + if (c) { + c[0] = cs >> 24; c[1] = cs >> 16; c[2] = cs >> 8; c[3] = cs >> 0; + } return cs; } -static int dirhash(const uae_char* name) +static int dirhash (const uae_char *name) { - unsigned long hash; - int i; + unsigned long hash; + int i; - hash = strlen(name); - for (i = 0; i < strlen(name); i++) - { - hash = hash * 13; - hash = hash + toupper(name[i]); - hash = hash & 0x7ff; - } - hash = hash % ((FS_FLOPPY_BLOCKSIZE / 4) - 56); - return hash; + hash = strlen (name); + for(i = 0; i < strlen (name); i++) { + hash = hash * 13; + hash = hash + toupper (name[i]); + hash = hash & 0x7ff; + } + hash = hash % ((FS_FLOPPY_BLOCKSIZE / 4) - 56); + return hash; } -static void disk_date(uae_u8* p) +static void disk_date (uae_u8 *p) { static int pdays, pmins, pticks; int days, mins, ticks; struct timeval tv; struct mytimeval mtv; - gettimeofday(&tv, nullptr); + gettimeofday (&tv, NULL); tv.tv_sec -= _timezone; mtv.tv_sec = tv.tv_sec; mtv.tv_usec = tv.tv_usec; - timeval_to_amiga(&mtv, &days, &mins, &ticks); - if (days == pdays && mins == pmins && ticks == pticks) - { + timeval_to_amiga (&mtv, &days, &mins, &ticks, 50); + if (days == pdays && mins == pmins && ticks == pticks) { ticks++; - if (ticks >= 50 * 60) - { + if (ticks >= 50 * 60) { ticks = 0; mins++; if (mins >= 24 * 60) days++; - } + } } pdays = days; pmins = mins; pticks = ticks; - p[0] = days >> 24; - p[1] = days >> 16; - p[2] = days >> 8; - p[3] = days >> 0; - p[4] = mins >> 24; - p[5] = mins >> 16; - p[6] = mins >> 8; - p[7] = mins >> 0; - p[8] = ticks >> 24; - p[9] = ticks >> 16; - p[10] = ticks >> 8; - p[11] = ticks >> 0; + p[0] = days >> 24; p[1] = days >> 16; p[2] = days >> 8; p[3] = days >> 0; + p[4] = mins >> 24; p[5] = mins >> 16; p[6] = mins >> 8; p[7] = mins >> 0; + p[8] = ticks >> 24; p[9] = ticks >> 16; p[10] = ticks >> 8; p[11] = ticks >> 0; } -static void createbootblock(uae_u8* sector, int bootable) +static void createbootblock (uae_u8 *sector, int bootable) { - memset(sector, 0, FS_FLOPPY_BLOCKSIZE); - memcpy(sector, "DOS", 3); - if (bootable) - memcpy(sector, bootblock_ofs, sizeof bootblock_ofs); + memset (sector, 0, FS_FLOPPY_BLOCKSIZE); + memcpy (sector, "DOS", 3); + if (bootable) + memcpy (sector, bootblock_ofs, sizeof bootblock_ofs); } -static void createrootblock(uae_u8* sector, const TCHAR* disk_name) +static void createrootblock (uae_u8 *sector, const TCHAR *disk_name) { - char* dn = ua(disk_name); - char* dn2 = dn; - if (strlen(dn2) >= 30) - dn2[30] = 0; + char *dn = ua (disk_name); + if (strlen (dn) >= 30) + dn[30] = 0; + const char *dn2 = dn; if (dn2[0] == 0) dn2 = "empty"; - memset(sector, 0, FS_FLOPPY_BLOCKSIZE); - sector[0 + 3] = 2; - sector[12 + 3] = 0x48; - sector[312] = sector[313] = sector[314] = sector[315] = (uae_u8)0xff; - sector[316 + 2] = 881 >> 8; - sector[316 + 3] = 881 & 255; - sector[432] = strlen(dn2); - strcpy(reinterpret_cast(sector) + 433, dn2); - sector[508 + 3] = 1; - disk_date(sector + 420); - memcpy(sector + 472, sector + 420, 3 * 4); - memcpy(sector + 484, sector + 420, 3 * 4); + memset (sector, 0, FS_FLOPPY_BLOCKSIZE); + sector[0+3] = 2; + sector[12+3] = 0x48; + sector[312] = sector[313] = sector[314] = sector[315] = (uae_u8)0xff; + sector[316+2] = 881 >> 8; sector[316+3] = 881 & 255; + sector[432] = strlen (dn2); + strcpy ((char*)sector + 433, dn2); + sector[508 + 3] = 1; + disk_date (sector + 420); + memcpy (sector + 472, sector + 420, 3 * 4); + memcpy (sector + 484, sector + 420, 3 * 4); xfree (dn); } -static int getblock(uae_u8* bitmap, int* prev) +static int getblock (uae_u8 *bitmap, int *prev) { int i = *prev; - while (bitmap[i] != 0xff) - { - if (bitmap[i] == 0) - { - bitmap[i] = 1; + while (bitmap[i] != 0xff) { + if (bitmap[i] == 0) { + bitmap[i] = 1; *prev = i; return i; } i++; } i = 0; - while (bitmap[i] != 0xff) - { - if (bitmap[i] == 0) - { + while (bitmap[i] != 0xff) { + if (bitmap[i] == 0) { bitmap[i] = 1; *prev = i; - return i; - } - i++; - } - return -1; + return i; + } + i++; + } + return -1; } -static void pl(uae_u8* sector, int offset, uae_u32 v) +static void pl (uae_u8 *sector, int offset, uae_u32 v) { - sector[offset + 0] = v >> 24; - sector[offset + 1] = v >> 16; - sector[offset + 2] = v >> 8; - sector[offset + 3] = v >> 0; + sector[offset + 0] = v >> 24; + sector[offset + 1] = v >> 16; + sector[offset + 2] = v >> 8; + sector[offset + 3] = v >> 0; } -static int createdirheaderblock(uae_u8* sector, int parent, const char* filename, uae_u8* bitmap, int* prevblock) +static int createdirheaderblock (uae_u8 *sector, int parent, const char *filename, uae_u8 *bitmap, int *prevblock) { - int block = getblock(bitmap, prevblock); + int block = getblock (bitmap, prevblock); - memset(sector, 0, FS_FLOPPY_BLOCKSIZE); - pl(sector, 0, 2); - pl(sector, 4, block); - disk_date(sector + 512 - 92); - sector[512 - 80] = strlen(filename); - strcpy(reinterpret_cast(sector) + 512 - 79, filename); - pl(sector, 512 - 12, parent); - pl(sector, 512 - 4, 2); - return block; + memset (sector, 0, FS_FLOPPY_BLOCKSIZE); + pl (sector, 0, 2); + pl (sector, 4, block); + disk_date (sector + 512 - 92); + sector[512 - 80] = strlen (filename); + strcpy ((char *)sector + 512 - 79, filename); + pl (sector, 512 - 12, parent); + pl (sector, 512 - 4, 2); + return block; } -static int createfileheaderblock(struct zfile* z, uae_u8* sector, int parent, const char* filename, struct zfile* src, uae_u8* bitmap, int* prevblock) +static int createfileheaderblock (struct zfile *z,uae_u8 *sector, int parent, const char *filename, struct zfile *src, uae_u8 *bitmap, int *prevblock) { - uae_u8 sector2[FS_FLOPPY_BLOCKSIZE]; - uae_u8 sector3[FS_FLOPPY_BLOCKSIZE]; - int block = getblock(bitmap, prevblock); - int datablock = getblock(bitmap, prevblock); - int datasec = 1; - int extensions; - int extensionblock, extensioncounter, headerextension = 1; - int size; + uae_u8 sector2[FS_FLOPPY_BLOCKSIZE]; + uae_u8 sector3[FS_FLOPPY_BLOCKSIZE]; + int block = getblock (bitmap, prevblock); + int datablock = getblock (bitmap, prevblock); + int datasec = 1; + int extensions; + int extensionblock, extensioncounter, headerextension = 1; + int size; - zfile_fseek(src, 0, SEEK_END); - size = zfile_ftell(src); - zfile_fseek(src, 0, SEEK_SET); - extensions = (size + FS_OFS_DATABLOCKSIZE - 1) / FS_OFS_DATABLOCKSIZE; + zfile_fseek (src, 0, SEEK_END); + size = zfile_ftell (src); + zfile_fseek (src, 0, SEEK_SET); + extensions = (size + FS_OFS_DATABLOCKSIZE - 1) / FS_OFS_DATABLOCKSIZE; - memset(sector, 0, FS_FLOPPY_BLOCKSIZE); - pl(sector, 0, 2); - pl(sector, 4, block); - pl(sector, 8, extensions > FS_EXTENSION_BLOCKS ? FS_EXTENSION_BLOCKS : extensions); - pl(sector, 16, datablock); - pl(sector, FS_FLOPPY_BLOCKSIZE - 188, size); - disk_date(sector + FS_FLOPPY_BLOCKSIZE - 92); - sector[FS_FLOPPY_BLOCKSIZE - 80] = strlen(filename); - strcpy(reinterpret_cast(sector) + FS_FLOPPY_BLOCKSIZE - 79, filename); - pl(sector, FS_FLOPPY_BLOCKSIZE - 12, parent); - pl(sector, FS_FLOPPY_BLOCKSIZE - 4, -3); - extensioncounter = 0; - extensionblock = 0; + memset (sector, 0, FS_FLOPPY_BLOCKSIZE); + pl (sector, 0, 2); + pl (sector, 4, block); + pl (sector, 8, extensions > FS_EXTENSION_BLOCKS ? FS_EXTENSION_BLOCKS : extensions); + pl (sector, 16, datablock); + pl (sector, FS_FLOPPY_BLOCKSIZE - 188, size); + disk_date (sector + FS_FLOPPY_BLOCKSIZE - 92); + sector[FS_FLOPPY_BLOCKSIZE - 80] = strlen (filename); + strcpy ((char *)sector + FS_FLOPPY_BLOCKSIZE - 79, filename); + pl (sector, FS_FLOPPY_BLOCKSIZE - 12, parent); + pl (sector, FS_FLOPPY_BLOCKSIZE - 4, -3); + extensioncounter = 0; + extensionblock = 0; - while (size > 0) - { - int datablock2 = datablock; - int extensionblock2 = extensionblock; - if (extensioncounter == FS_EXTENSION_BLOCKS) - { - extensioncounter = 0; - extensionblock = getblock(bitmap, prevblock); - if (datasec > FS_EXTENSION_BLOCKS + 1) - { - pl(sector3, 8, FS_EXTENSION_BLOCKS); - pl(sector3, FS_FLOPPY_BLOCKSIZE - 8, extensionblock); - pl(sector3, 4, extensionblock2); - disk_checksum(sector3, sector3 + 20); - writeimageblock(z, sector3, extensionblock2 * FS_FLOPPY_BLOCKSIZE); - } - else - { - pl(sector, 512 - 8, extensionblock); - } - memset(sector3, 0, FS_FLOPPY_BLOCKSIZE); - pl(sector3, 0, 16); - pl(sector3, FS_FLOPPY_BLOCKSIZE - 12, block); - pl(sector3, FS_FLOPPY_BLOCKSIZE - 4, -3); - } - memset(sector2, 0, FS_FLOPPY_BLOCKSIZE); - pl(sector2, 0, 8); - pl(sector2, 4, block); - pl(sector2, 8, datasec++); - pl(sector2, 12, size > FS_OFS_DATABLOCKSIZE ? FS_OFS_DATABLOCKSIZE : size); - zfile_fread(sector2 + 24, size > FS_OFS_DATABLOCKSIZE ? FS_OFS_DATABLOCKSIZE : size, 1, src); - size -= FS_OFS_DATABLOCKSIZE; - datablock = 0; - if (size > 0) datablock = getblock(bitmap, prevblock); - pl(sector2, 16, datablock); - disk_checksum(sector2, sector2 + 20); - writeimageblock(z, sector2, datablock2 * FS_FLOPPY_BLOCKSIZE); - if (datasec <= FS_EXTENSION_BLOCKS + 1) - pl(sector, 512 - 204 - extensioncounter * 4, datablock2); - else - pl(sector3, 512 - 204 - extensioncounter * 4, datablock2); - extensioncounter++; - } - if (datasec > FS_EXTENSION_BLOCKS) - { - pl(sector3, 8, extensioncounter); - disk_checksum(sector3, sector3 + 20); - writeimageblock(z, sector3, extensionblock * FS_FLOPPY_BLOCKSIZE); - } - disk_checksum(sector, sector + 20); - writeimageblock(z, sector, block * FS_FLOPPY_BLOCKSIZE); - return block; + while (size > 0) { + int datablock2 = datablock; + int extensionblock2 = extensionblock; + if (extensioncounter == FS_EXTENSION_BLOCKS) { + extensioncounter = 0; + extensionblock = getblock (bitmap, prevblock); + if (datasec > FS_EXTENSION_BLOCKS + 1) { + pl (sector3, 8, FS_EXTENSION_BLOCKS); + pl (sector3, FS_FLOPPY_BLOCKSIZE - 8, extensionblock); + pl (sector3, 4, extensionblock2); + disk_checksum(sector3, sector3 + 20); + writeimageblock (z, sector3, extensionblock2 * FS_FLOPPY_BLOCKSIZE); + } else { + pl (sector, 512 - 8, extensionblock); + } + memset (sector3, 0, FS_FLOPPY_BLOCKSIZE); + pl (sector3, 0, 16); + pl (sector3, FS_FLOPPY_BLOCKSIZE - 12, block); + pl (sector3, FS_FLOPPY_BLOCKSIZE - 4, -3); + } + memset (sector2, 0, FS_FLOPPY_BLOCKSIZE); + pl (sector2, 0, 8); + pl (sector2, 4, block); + pl (sector2, 8, datasec++); + pl (sector2, 12, size > FS_OFS_DATABLOCKSIZE ? FS_OFS_DATABLOCKSIZE : size); + zfile_fread (sector2 + 24, size > FS_OFS_DATABLOCKSIZE ? FS_OFS_DATABLOCKSIZE : size, 1, src); + size -= FS_OFS_DATABLOCKSIZE; + datablock = 0; + if (size > 0) datablock = getblock (bitmap, prevblock); + pl (sector2, 16, datablock); + disk_checksum(sector2, sector2 + 20); + writeimageblock (z, sector2, datablock2 * FS_FLOPPY_BLOCKSIZE); + if (datasec <= FS_EXTENSION_BLOCKS + 1) + pl (sector, 512 - 204 - extensioncounter * 4, datablock2); + else + pl (sector3, 512 - 204 - extensioncounter * 4, datablock2); + extensioncounter++; + } + if (datasec > FS_EXTENSION_BLOCKS) { + pl (sector3, 8, extensioncounter); + disk_checksum(sector3, sector3 + 20); + writeimageblock (z, sector3, extensionblock * FS_FLOPPY_BLOCKSIZE); + } + disk_checksum(sector, sector + 20); + writeimageblock (z, sector, block * FS_FLOPPY_BLOCKSIZE); + return block; } -static void createbitmapblock(uae_u8* sector, uae_u8* bitmap) +static void createbitmapblock (uae_u8 *sector, uae_u8 *bitmap) { - int i, j; - memset(sector, 0, FS_FLOPPY_BLOCKSIZE); + int i, j; + memset (sector, 0, FS_FLOPPY_BLOCKSIZE); i = 0; - for (;;) - { + for (;;) { uae_u32 mask = 0; - for (j = 0; j < 32; j++) - { + for (j = 0; j < 32; j++) { if (bitmap[2 + i * 32 + j] == 0xff) break; if (!bitmap[2 + i * 32 + j]) mask |= 1 << j; - } + } sector[4 + i * 4 + 0] = mask >> 24; sector[4 + i * 4 + 1] = mask >> 16; - sector[4 + i * 4 + 2] = mask >> 8; - sector[4 + i * 4 + 3] = mask >> 0; + sector[4 + i * 4 + 2] = mask >> 8; + sector[4 + i * 4 + 3] = mask >> 0; if (bitmap[2 + i * 32 + j] == 0xff) break; i++; - } - disk_checksum(sector, sector + 0); + } + disk_checksum(sector, sector + 0); } -static int createimagefromexe(struct zfile* src, struct zfile* dst) +static int createimagefromexe (struct zfile *src, struct zfile *dst) { - uae_u8 sector1[FS_FLOPPY_BLOCKSIZE], sector2[FS_FLOPPY_BLOCKSIZE]; - uae_u8 bitmap[FS_FLOPPY_TOTALBLOCKS + 8]; - int exesize; - int blocksize = FS_OFS_DATABLOCKSIZE; - int blocks, extensionblocks; - int totalblocks; - int fblock1, dblock1; - char* fname1 = "runme.exe"; - TCHAR* fname1b = _T("runme.adf"); - char* fname2 = "startup-sequence"; - char* dirname1 = "s"; - struct zfile* ss; + uae_u8 sector1[FS_FLOPPY_BLOCKSIZE], sector2[FS_FLOPPY_BLOCKSIZE]; + uae_u8 bitmap[FS_FLOPPY_TOTALBLOCKS + 8]; + int exesize; + int blocksize = FS_OFS_DATABLOCKSIZE; + int blocks, extensionblocks; + int totalblocks; + int fblock1, dblock1; + const char *fname1 = "runme.exe"; + const TCHAR *fname1b = _T("runme.adf"); + const char *fname2 = "startup-sequence"; + const char *dirname1 = "s"; + struct zfile *ss; int prevblock; - memset(bitmap, 0, sizeof bitmap); - zfile_fseek(src, 0, SEEK_END); - exesize = zfile_ftell(src); - blocks = (exesize + blocksize - 1) / blocksize; - extensionblocks = (blocks + FS_EXTENSION_BLOCKS - 1) / FS_EXTENSION_BLOCKS; - /* bootblock=2, root=1, bitmap=1, startup-sequence=1+1, exefileheader=1 */ - totalblocks = 2 + 1 + 1 + 2 + 1 + blocks + extensionblocks; - if (totalblocks > FS_FLOPPY_TOTALBLOCKS) - return 0; + memset (bitmap, 0, sizeof bitmap); + zfile_fseek (src, 0, SEEK_END); + exesize = zfile_ftell (src); + blocks = (exesize + blocksize - 1) / blocksize; + extensionblocks = (blocks + FS_EXTENSION_BLOCKS - 1) / FS_EXTENSION_BLOCKS; + /* bootblock=2, root=1, bitmap=1, startup-sequence=1+1, exefileheader=1 */ + totalblocks = 2 + 1 + 1 + 2 + 1 + blocks + extensionblocks; + if (totalblocks > FS_FLOPPY_TOTALBLOCKS) + return 0; - bitmap[880] = 1; - bitmap[881] = 1; - bitmap[0] = 1; - bitmap[1] = 1; + bitmap[880] = 1; + bitmap[881] = 1; + bitmap[0] = 1; + bitmap[1] = 1; bitmap[1760] = -1; prevblock = 880; - dblock1 = createdirheaderblock(sector2, 880, dirname1, bitmap, &prevblock); - ss = zfile_fopen_empty(src, fname1b, strlen(fname1)); - zfile_fwrite(fname1, strlen(fname1), 1, ss); - fblock1 = createfileheaderblock(dst, sector1, dblock1, fname2, ss, bitmap, &prevblock); - zfile_fclose(ss); - pl(sector2, 24 + dirhash(fname2) * 4, fblock1); - disk_checksum(sector2, sector2 + 20); - writeimageblock(dst, sector2, dblock1 * FS_FLOPPY_BLOCKSIZE); + dblock1 = createdirheaderblock (sector2, 880, dirname1, bitmap, &prevblock); + ss = zfile_fopen_empty (src, fname1b, strlen(fname1)); + zfile_fwrite (fname1, strlen(fname1), 1, ss); + fblock1 = createfileheaderblock (dst, sector1, dblock1, fname2, ss, bitmap, &prevblock); + zfile_fclose (ss); + pl (sector2, 24 + dirhash (fname2) * 4, fblock1); + disk_checksum(sector2, sector2 + 20); + writeimageblock (dst, sector2, dblock1 * FS_FLOPPY_BLOCKSIZE); - fblock1 = createfileheaderblock(dst, sector1, 880, fname1, src, bitmap, &prevblock); + fblock1 = createfileheaderblock (dst, sector1, 880, fname1, src, bitmap, &prevblock); - createrootblock(sector1, zfile_getfilename(src)); - pl(sector1, 24 + dirhash(fname1) * 4, fblock1); - pl(sector1, 24 + dirhash(dirname1) * 4, dblock1); - disk_checksum(sector1, sector1 + 20); - writeimageblock(dst, sector1, 880 * FS_FLOPPY_BLOCKSIZE); + createrootblock (sector1, zfile_getfilename (src)); + pl (sector1, 24 + dirhash (fname1) * 4, fblock1); + pl (sector1, 24 + dirhash (dirname1) * 4, dblock1); + disk_checksum(sector1, sector1 + 20); + writeimageblock (dst, sector1, 880 * FS_FLOPPY_BLOCKSIZE); + + createbitmapblock (sector1, bitmap); + writeimageblock (dst, sector1, 881 * FS_FLOPPY_BLOCKSIZE); - createbitmapblock(sector1, bitmap); - writeimageblock(dst, sector1, 881 * FS_FLOPPY_BLOCKSIZE); + createbootblock (sector1, 1); + writeimageblock (dst, sector1, 0 * FS_FLOPPY_BLOCKSIZE); - createbootblock(sector1, 1); - writeimageblock(dst, sector1, 0 * FS_FLOPPY_BLOCKSIZE); - - return 1; + return 1; } -static bool isfloppysound(drive* drv) +static int get_floppy_speed (void) { - return drv->useturbo == 0; + int m = currprefs.floppy_speed; + if (m <= 10) + m = 100; + m = NORMAL_FLOPPY_SPEED * 100 / m; + return m; } -static int get_floppy_speed() +static int get_floppy_speed2 (drive *drv) { - int m = currprefs.floppy_speed; - if (m <= 10) - m = 100; - m = NORMAL_FLOPPY_SPEED * 100 / m; - return m; + int m = get_floppy_speed () * drv->tracklen / (2 * 8 * FLOPPY_WRITE_LEN * drv->ddhd); + if (m <= 0) + m = 1; + return m; } -static int get_floppy_speed2(drive* drv) +static const TCHAR *drive_id_name(drive *drv) { - int m = get_floppy_speed() * drv->tracklen / (2 * 8 * FLOPPY_WRITE_LEN * drv->ddhd); - if (m <= 0) - m = 1; - return m; -} - -static TCHAR* drive_id_name(drive* drv) -{ - switch (drv->drive_id) - { - case DRIVE_ID_35HD: return _T("3.5HD"); - case DRIVE_ID_525SD: return _T("5.25SD"); - case DRIVE_ID_35DD: return _T("3.5DD"); - case DRIVE_ID_NONE: return _T("NONE"); - } + switch (drv->drive_id) + { + case DRIVE_ID_35HD : return _T("3.5HD"); + case DRIVE_ID_525SD: return _T("5.25SD"); + case DRIVE_ID_35DD : return _T("3.5DD"); + case DRIVE_ID_NONE : return _T("NONE"); + } return _T("UNKNOWN"); } @@ -625,1152 +543,1067 @@ static TCHAR* drive_id_name(drive* drv) * disk or a 3.5 DD disk is inserted. Only 3.5 HD drive id is reported * when a real 3.5 HD disk is inserted. -Adil */ -static void drive_settype_id(drive* drv) +static void drive_settype_id (drive *drv) { - int t = currprefs.floppyslots[drv - &floppy[0]].dfxtype; + int t = currprefs.floppyslots[drv - &floppy[0]].dfxtype; - switch (t) - { - case DRV_35_HD: + switch (t) + { + case DRV_35_HD: #ifdef FLOPPY_DRIVE_HD - if (!drv->diskfile || drv->ddhd <= 1) - drv->drive_id = DRIVE_ID_35DD; - else - drv->drive_id = DRIVE_ID_35HD; + if (!drv->diskfile || drv->ddhd <= 1) + drv->drive_id = DRIVE_ID_35DD; + else + drv->drive_id = DRIVE_ID_35HD; #else drv->drive_id = DRIVE_ID_35DD; #endif - break; - case DRV_35_DD_ESCOM: - case DRV_35_DD: - default: - drv->drive_id = DRIVE_ID_35DD; - break; - case DRV_525_SD: - drv->drive_id = DRIVE_ID_525SD; - break; - case DRV_NONE: - drv->drive_id = DRIVE_ID_NONE; - break; - } + break; + case DRV_35_DD_ESCOM: + case DRV_35_DD: + default: + drv->drive_id = DRIVE_ID_35DD; + break; + case DRV_525_SD: + drv->drive_id = DRIVE_ID_525SD; + break; + case DRV_NONE: + case DRV_PC_ONLY_40: + case DRV_PC_ONLY_80: + drv->drive_id = DRIVE_ID_NONE; + break; + } } -static void drive_image_free(drive* drv) +static void drive_image_free (drive *drv) { switch (drv->filetype) { - case ADF_IPF: -#ifdef CAPS - caps_unloadimage(drv - floppy); -#endif - break; - case ADF_SCP: -#ifdef SCP - scp_close(drv - floppy); -#endif - break; - case ADF_FDI: + case ADF_FDI: #ifdef FDI2RAW - fdi2raw_header_free(drv->fdi); - drv->fdi = 0; + fdi2raw_header_free (drv->fdi); + drv->fdi = 0; #endif - break; - } - drv->filetype = ADF_NONE; - zfile_fclose(drv->diskfile); - drv->diskfile = nullptr; - zfile_fclose(drv->writediskfile); - drv->writediskfile = nullptr; + break; + } + drv->filetype = ADF_NONE; + zfile_fclose (drv->diskfile); + drv->diskfile = NULL; + zfile_fclose (drv->writediskfile); + drv->writediskfile = NULL; + zfile_fclose(drv->pcdecodedfile); + drv->pcdecodedfile = NULL; } -static int drive_insert(drive* drv, struct uae_prefs* p, int dnum, const TCHAR* fname, bool fake, bool writeprotected); +static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR *fname, bool fake, bool writeprotected); static void reset_drive_gui(int num) { - gui_data.drive_disabled[num] = 0; - gui_data.df[num][0] = 0; - gui_data.crc32[num] = 0; - if (currprefs.floppyslots[num].dfxtype < 0) - gui_data.drive_disabled[num] = 1; -} - -static void setamax() -{ -#ifdef AMAX - if (currprefs.amaxromfile[0]) { - /* Put A-Max as last drive in drive chain */ - int j; - for (j = 0; j < MAX_FLOPPY_DRIVES; j++) - if (floppy[j].amax) - return; - for (j = 0; j < MAX_FLOPPY_DRIVES; j++) { - if ((1 << j) & disabled) { - floppy[j].amax = 1; - write_log(_T("AMAX: drive %d\n"), j); - return; - } - } - } -#endif + gui_data.drive_disabled[num] = 0; + gui_data.df[num][0] = 0; + gui_data.crc32[num] = 0; + if (currprefs.floppyslots[num].dfxtype < 0) + gui_data.drive_disabled[num] = 1; } static void reset_drive(int num) { - drive* drv = &floppy[num]; + drive *drv = &floppy[num]; - drv->amax = 0; - drive_image_free(drv); - drv->motoroff = 1; - drv->idbit = 0; - drv->drive_id = 0; - drv->drive_id_scnt = 0; - drv->lastdataacesstrack = -1; - disabled &= ~(1 << num); - if (currprefs.floppyslots[num].dfxtype < 0) - disabled |= 1 << num; - reset_drive_gui(num); - /* most internal Amiga floppy drives won't enable - * diskready until motor is running at full speed - * and next indexsync has been passed - */ - drv->indexhackmode = 0; - if (num == 0 && currprefs.floppyslots[num].dfxtype == 0) - drv->indexhackmode = 1; - drv->dskchange_time = 0; - drv->dskchange = false; - drv->dskready_down_time = 0; - drv->dskready_up_time = 0; - drv->buffered_cyl = -1; - drv->buffered_side = -1; - gui_led(num + LED_DF0, 0); - drive_settype_id(drv); - _tcscpy (currprefs.floppyslots[num].df, changed_prefs.floppyslots[num].df); - drv->newname[0] = 0; + drive_image_free (drv); + drv->motoroff = 1; + drv->idbit = 0; + drv->drive_id = 0; + drv->drive_id_scnt = 0; + disabled &= ~(1 << num); + reserved &= ~(1 << num); + if (currprefs.floppyslots[num].dfxtype < 0 || currprefs.floppyslots[num].dfxtype >= DRV_PC_ONLY_40) + disabled |= 1 << num; + if (currprefs.floppyslots[num].dfxtype >= DRV_PC_ONLY_40) + reserved |= 1 << num; + reset_drive_gui(num); + /* most internal Amiga floppy drives won't enable + * diskready until motor is running at full speed + * and next indexsync has been passed + */ + drv->indexhackmode = 0; + if (num == 0 && currprefs.floppyslots[num].dfxtype == 0) + drv->indexhackmode = 1; + drv->dskchange_time = 0; + drv->dskchange = false; + drv->dskready_down_time = 0; + drv->dskready_up_time = 0; + drv->buffered_cyl = -1; + drv->buffered_side = -1; + gui_led (num + LED_DF0, 0, -1); + drive_settype_id (drv); + _tcscpy (currprefs.floppyslots[num].df, changed_prefs.floppyslots[num].df); + drv->newname[0] = 0; drv->newnamewriteprotected = false; - if (!drive_insert(drv, &currprefs, num, currprefs.floppyslots[num].df, false, false)) - disk_eject(num); + if (!drive_insert (drv, &currprefs, num, currprefs.floppyslots[num].df, false, false)) + disk_eject (num); } /* code for track display */ -static void update_drive_gui(int num, bool force) +static void update_drive_gui (int num, bool force) { - if (num >= currprefs.nr_floppies) - return; - drive* drv = floppy + num; - bool writ = dskdmaen == DSKDMA_WRITE && drv->state && !((selected | disabled) & (1 << num)); + if (num >= currprefs.nr_floppies) + return; + drive *drv = floppy + num; + bool writ = dskdmaen == DSKDMA_WRITE && drv->state && !((selected | disabled) & (1 << num)); if (!force && drv->state == gui_data.drive_motor[num] - && drv->cyl == gui_data.drive_track[num] - && side == gui_data.drive_side - && drv->crc32 == gui_data.crc32[num] - && writ == gui_data.drive_writing[num] - && !_tcscmp (gui_data.df[num], currprefs.floppyslots[num].df)) - return; - _tcscpy (gui_data.df[num], currprefs.floppyslots[num].df); - gui_data.crc32[num] = drv->crc32; - gui_data.drive_motor[num] = drv->state; - gui_data.drive_track[num] = drv->cyl; - gui_data.drive_side = side; - gui_data.drive_writing[num] = writ; - gui_led(num + LED_DF0, (gui_data.drive_motor[num] ? 1 : 0) | (gui_data.drive_writing[num] ? 2 : 0)); + && drv->cyl == gui_data.drive_track[num] + && side == gui_data.drive_side + && drv->crc32 == gui_data.crc32[num] + && writ == gui_data.drive_writing[num] + && !_tcscmp (gui_data.df[num], currprefs.floppyslots[num].df)) + return; + _tcscpy (gui_data.df[num], currprefs.floppyslots[num].df); + gui_data.crc32[num] = drv->crc32; + gui_data.drive_motor[num] = drv->state; + gui_data.drive_track[num] = drv->cyl; + if (reserved & (1 << num)) + gui_data.drive_side = reserved_side; + else + gui_data.drive_side = side; + gui_data.drive_writing[num] = writ; + gui_led (num + LED_DF0, (gui_data.drive_motor[num] ? 1 : 0) | (gui_data.drive_writing[num] ? 2 : 0), -1); } -static void drive_fill_bigbuf(drive* drv, int); +static void drive_fill_bigbuf (drive *drv, int); -int DISK_validate_filename(struct uae_prefs* p, const TCHAR* fname, int leave_open, bool* wrprot, uae_u32* crc32, struct zfile** zf) +int DISK_validate_filename (struct uae_prefs *p, const TCHAR *fname, int leave_open, bool *wrprot, uae_u32 *crc32, struct zfile **zf) { if (zf) - *zf = nullptr; - if (crc32) - *crc32 = 0; + *zf = NULL; + if (crc32) + *crc32 = 0; if (wrprot) - *wrprot = false; - if (leave_open || !zf) - { - struct zfile* f = zfile_fopen(fname, _T("r+b"), ZFD_NORMAL | ZFD_DISKHISTORY); - if (!f) - { - if (wrprot) - *wrprot = true; - f = zfile_fopen(fname, _T("rb"), ZFD_NORMAL | ZFD_DISKHISTORY); - } - if (f && crc32) - *crc32 = zfile_crc32(f); + *wrprot = p->floppy_read_only ? 1 : 0; + if (leave_open || !zf) { + struct zfile *f = zfile_fopen (fname, _T("r+b"), ZFD_NORMAL | ZFD_DISKHISTORY); + if (!f) { + if (wrprot) + *wrprot = 1; + f = zfile_fopen (fname, _T("rb"), ZFD_NORMAL | ZFD_DISKHISTORY); + } + if (f && crc32) + *crc32 = zfile_crc32 (f); if (!zf) - zfile_fclose(f); + zfile_fclose (f); else *zf = f; return f ? 1 : 0; - } - else - { - if (zfile_exists(fname)) - { - if (wrprot) - *wrprot = false; - if (crc32) - { - struct zfile* f = zfile_fopen(fname, _T("rb"), ZFD_NORMAL | ZFD_DISKHISTORY); - if (f) - *crc32 = zfile_crc32(f); - zfile_fclose(f); - } + } else { + if (zfile_exists (fname)) { + if (wrprot && !p->floppy_read_only) + *wrprot = 0; + if (crc32) { + struct zfile *f = zfile_fopen (fname, _T("rb"), ZFD_NORMAL | ZFD_DISKHISTORY); + if (f) + *crc32 = zfile_crc32 (f); + zfile_fclose (f); + } return 1; - } - else - { - if (wrprot) - *wrprot = true; - return 0; - } - } + } else { + if (wrprot) + *wrprot = 1; + return 0; + } + } } -static void updatemfmpos(drive* drv) +static void updatemfmpos (drive *drv) { - if (drv->prevtracklen) - { - drv->mfmpos = drv->mfmpos * (drv->tracklen * 1000 / drv->prevtracklen) / 1000; + if (drv->prevtracklen) { + drv->mfmpos = drv->mfmpos * (drv->tracklen * 1000 / drv->prevtracklen) / 1000; if (drv->mfmpos >= drv->tracklen) drv->mfmpos = drv->tracklen - 1; } - drv->mfmpos %= drv->tracklen; - drv->prevtracklen = drv->tracklen; + drv->mfmpos %= drv->tracklen; + drv->prevtracklen = drv->tracklen; } -static void track_reset(drive* drv) +static void track_reset (drive *drv) { - drv->tracklen = FLOPPY_WRITE_LEN * drv->ddhd * 2 * 8; + drv->tracklen = FLOPPY_WRITE_LEN * drv->ddhd * 2 * 8; drv->revolutions = 1; - drv->trackspeed = get_floppy_speed(); - drv->buffered_side = -1; - drv->skipoffset = -1; - drv->tracktiming[0] = 0; - memset(drv->bigmfmbuf, 0xaa, FLOPPY_WRITE_LEN * 2 * drv->ddhd); - updatemfmpos(drv); + drv->trackspeed = get_floppy_speed (); + drv->buffered_side = -1; + drv->skipoffset = -1; + drv->tracktiming[0] = 0; + memset (drv->bigmfmbuf, 0xaa, FLOPPY_WRITE_LEN * 2 * drv->ddhd); + updatemfmpos (drv); } -static int read_header_ext2(struct zfile* diskfile, trackid* trackdata, int* num_tracks, int* ddhd) +static int read_header_ext2 (struct zfile *diskfile, trackid *trackdata, int *num_tracks, int *ddhd) +{ + uae_u8 buffer[2 + 2 + 4 + 4]; + trackid *tid; + int offs; + int i; + + zfile_fseek (diskfile, 0, SEEK_SET); + zfile_fread (buffer, 1, 8, diskfile); + if (strncmp ((char *)buffer, "UAE-1ADF", 8)) + return 0; + zfile_fread (buffer, 1, 4, diskfile); + *num_tracks = buffer[2] * 256 + buffer[3]; + offs = 8 + 2 + 2 + (*num_tracks) * (2 + 2 + 4 + 4); + + for (i = 0; i < (*num_tracks); i++) { + tid = trackdata + i; + zfile_fread (buffer, 2 + 2 + 4 + 4, 1, diskfile); + tid->type = (image_tracktype)buffer[3]; + tid->revolutions = buffer[2] + 1; + tid->len = buffer[5] * 65536 + buffer[6] * 256 + buffer[7]; + tid->bitlen = buffer[9] * 65536 + buffer[10] * 256 + buffer[11]; + tid->offs = offs; + if (tid->len > 20000 && ddhd) + *ddhd = 2; + tid->track = i; + offs += tid->len; + } + return 1; +} + +static void saveimagecutpathpart(TCHAR *name) { - uae_u8 buffer[2 + 2 + 4 + 4]; - trackid* tid; - int offs; int i; - zfile_fseek(diskfile, 0, SEEK_SET); - zfile_fread(buffer, 1, 8, diskfile); - if (strncmp(reinterpret_cast(buffer), "UAE-1ADF", 8)) - return 0; - zfile_fread(buffer, 1, 4, diskfile); - *num_tracks = buffer[2] * 256 + buffer[3]; - offs = 8 + 2 + 2 + (*num_tracks) * (2 + 2 + 4 + 4); - - for (i = 0; i < (*num_tracks); i++) - { - tid = trackdata + i; - zfile_fread(buffer, 2 + 2 + 4 + 4, 1, diskfile); - tid->type = image_tracktype(buffer[3]); - tid->revolutions = buffer[2] + 1; - tid->len = buffer[5] * 65536 + buffer[6] * 256 + buffer[7]; - tid->bitlen = buffer[9] * 65536 + buffer[10] * 256 + buffer[11]; - tid->offs = offs; - if (tid->len > 20000 && ddhd) - *ddhd = 2; - tid->track = i; - offs += tid->len; + i = _tcslen (name) - 1; + while (i > 0) { + if (name[i] == '/' || name[i] == '\\') { + name[i] = 0; + break; + } + if (name[i] == '.') { + name[i] = 0; + break; + } + i--; + } + while (i > 0) { + if (name[i] == '/' || name[i] == '\\') { + name[i] = 0; + break; + } + i--; } - return 1; } -TCHAR* DISK_get_saveimagepath(const TCHAR* name) +static void saveimagecutfilepart(TCHAR *name) { - static TCHAR name1[MAX_DPATH]; - TCHAR name2[MAX_DPATH]; + TCHAR tmp[MAX_DPATH]; + int i; + + _tcscpy(tmp, name); + i = _tcslen (tmp) - 1; + while (i > 0) { + if (tmp[i] == '/' || tmp[i] == '\\') { + _tcscpy(name, tmp + i + 1); + break; + } + if (tmp[i] == '.') { + tmp[i] = 0; + break; + } + i--; + } + while (i > 0) { + if (tmp[i] == '/' || tmp[i] == '\\') { + _tcscpy(name, tmp + i + 1); + break; + } + i--; + } +} + +static void saveimageaddfilename(TCHAR *dst, const TCHAR *src, int type) +{ + _tcscat(dst, src); + if (type) + _tcscat(dst, _T(".save_adf")); + else + _tcscat(dst, _T("_save.adf")); +} + +static TCHAR *DISK_get_default_saveimagepath (const TCHAR *name) +{ + TCHAR name1[MAX_DPATH]; TCHAR path[MAX_DPATH]; - int i; - - _tcscpy (name2, name); - i = _tcslen (name2) - 1; - while (i > 0) - { - if (name2[i] == '.') - { - name2[i] = 0; - break; - } - i--; - } - while (i > 0) - { - if (name2[i] == '/' || name2[i] == '\\') - { - i++; - break; - } - i--; - } - fetch_saveimagepath(path, sizeof path / sizeof (TCHAR), 1); - _stprintf(name1, _T("%s%s_save.adf"), path, name2 + i); - return name1; + _tcscpy(name1, name); + saveimagecutfilepart(name1); + fetch_saveimagepath (path, sizeof path / sizeof (TCHAR), 1); + saveimageaddfilename(path, name1, 0); + return my_strdup(path); } -static struct zfile* getwritefile(struct uae_prefs* p, const TCHAR* name, bool* wrprot) +// -2 = existing, if not, use 0. +// -1 = as configured +// 0 = saveimages-dir +// 1 = image dir +TCHAR *DISK_get_saveimagepath(const TCHAR *name, int type) { - struct zfile* zf; - DISK_validate_filename(p, DISK_get_saveimagepath(name), 1, wrprot, nullptr, &zf); + int typev = type; + + for (int i = 0; i < 2; i++) { + if (typev == 1 || (typev == -2 && i == 1)) { + TCHAR si_name[MAX_DPATH], si_path[MAX_DPATH]; + _tcscpy(si_name, name); + _tcscpy(si_path, name); + saveimagecutfilepart(si_name); + saveimagecutpathpart(si_path); + _tcscat(si_path, FSDB_DIR_SEPARATOR_S); + saveimageaddfilename(si_path, si_name, 1); + if (typev != -2 || (typev == -2 && zfile_exists(si_path))) + return my_strdup(si_path); + } + if (typev == 2 || typev == -1 || typev == -2) { + TCHAR *p = DISK_get_default_saveimagepath(name); + if (typev != -2 || (typev == -2 && zfile_exists(p))) + return p; + xfree(p); + } + } + return DISK_get_saveimagepath(name, -1); +} + +static struct zfile *getexistingwritefile(struct uae_prefs *p, const TCHAR *name, bool *wrprot) +{ + struct zfile *zf = NULL; + TCHAR *path; + path = DISK_get_saveimagepath(name, 0); + DISK_validate_filename (p, path, 1, wrprot, NULL, &zf); + xfree(path); + if (zf) + return zf; + path = DISK_get_saveimagepath(name, -1); + DISK_validate_filename (p, path, 1, wrprot, NULL, &zf); + xfree(path); return zf; } -static int iswritefileempty(struct uae_prefs* p, const TCHAR* name) +static int iswritefileempty (struct uae_prefs *p, const TCHAR *name) { - struct zfile* zf; - bool wrprot; - uae_char buffer[8]; - trackid td[MAX_TRACKS]; - int tracks, ddhd, i, ret; + struct zfile *zf; + bool wrprot; + uae_char buffer[8]; + trackid td[MAX_TRACKS]; + int tracks, ddhd, i, ret; - zf = getwritefile(p, name, &wrprot); - if (!zf) return 1; - zfile_fread(buffer, sizeof (char), 8, zf); - if (strncmp(static_cast(buffer), "UAE-1ADF", 8)) - return 0; - ret = read_header_ext2(zf, td, &tracks, &ddhd); - zfile_fclose(zf); - if (!ret) - return 1; - for (i = 0; i < tracks; i++) - { - if (td[i].bitlen) return 0; - } - return 1; + zf = getexistingwritefile (p, name, &wrprot); + if (!zf) return 1; + zfile_fread (buffer, sizeof (char), 8, zf); + if (strncmp ((uae_char*)buffer, "UAE-1ADF", 8)) + return 0; + ret = read_header_ext2 (zf, td, &tracks, &ddhd); + zfile_fclose (zf); + if (!ret) + return 1; + for (i = 0; i < tracks; i++) { + if (td[i].bitlen) return 0; + } + return 1; } -static int openwritefile(struct uae_prefs* p, drive* drv, int create) +static int openwritefile (struct uae_prefs *p, drive *drv, int create) { - bool wrprot = false; + bool wrprot = 0; - drv->writediskfile = getwritefile(p, currprefs.floppyslots[drv - &floppy[0]].df, &wrprot); - if (drv->writediskfile) - { - drv->wrprot = wrprot; - if (!read_header_ext2(drv->writediskfile, drv->writetrackdata, &drv->write_num_tracks, nullptr)) - { - zfile_fclose(drv->writediskfile); - drv->writediskfile = nullptr; - drv->wrprot = true; - } - else - { - if (drv->write_num_tracks > drv->num_tracks) - drv->num_tracks = drv->write_num_tracks; - } - } - else if (zfile_iscompressed(drv->diskfile)) - { - drv->wrprot = true; - } - return drv->writediskfile ? 1 : 0; + drv->writediskfile = getexistingwritefile(p, currprefs.floppyslots[drv - &floppy[0]].df, &wrprot); + if (drv->writediskfile) { + drv->wrprot = wrprot; + if (!read_header_ext2 (drv->writediskfile, drv->writetrackdata, &drv->write_num_tracks, 0)) { + zfile_fclose (drv->writediskfile); + drv->writediskfile = 0; + drv->wrprot = 1; + } else { + if (drv->write_num_tracks > drv->num_tracks) + drv->num_tracks = drv->write_num_tracks; + } + } else if (zfile_iscompressed (drv->diskfile)) { + drv->wrprot = 1; + } + return drv->writediskfile ? 1 : 0; } -static bool diskfile_iswriteprotect(struct uae_prefs* p, const TCHAR* fname, int* needwritefile, drive_type* drvtype) +static bool diskfile_iswriteprotect (struct uae_prefs *p, const TCHAR *fname, int *needwritefile, drive_type *drvtype) { - struct zfile *zf1, *zf2; - bool wrprot1 = false, wrprot2 = true; - uae_char buffer[25]; - - *needwritefile = 0; - *drvtype = DRV_35_DD; - DISK_validate_filename(p, fname, 1, &wrprot1, nullptr, &zf1); - if (!zf1) - return true; - if (zfile_iscompressed(zf1)) - { - wrprot1 = true; - *needwritefile = 1; - } - zf2 = getwritefile(p, fname, &wrprot2); - zfile_fclose(zf2); - zfile_fread(buffer, sizeof (char), 25, zf1); - zfile_fclose(zf1); - if (strncmp(static_cast(buffer), "CAPS", 4) == 0) { - *needwritefile = 1; - return wrprot2; - } - if (strncmp(static_cast(buffer), "SCP", 3) == 0) { - *needwritefile = 1; - return wrprot2; - } - if (strncmp(static_cast(buffer), "Formatted Disk Image file", 25) == 0) - { - *needwritefile = 1; - return wrprot2; - } - if (strncmp(static_cast(buffer), "UAE-1ADF", 8) == 0) - { - if (wrprot1) - return wrprot2; - return wrprot1; - } - if (strncmp(static_cast(buffer), "UAE--ADF", 8) == 0) - { - *needwritefile = 1; - return wrprot2; - } - if (memcmp(exeheader, buffer, sizeof exeheader) == 0) - return false; - if (wrprot1) - return wrprot2; - return wrprot1; + struct zfile *zf1, *zf2; + bool wrprot1 = 0, wrprot2 = 1; + uae_char buffer[25]; + + *needwritefile = 0; + *drvtype = DRV_35_DD; + DISK_validate_filename (p, fname, 1, &wrprot1, NULL, &zf1); + if (!zf1) + return 1; + if (zfile_iscompressed (zf1)) { + wrprot1 = 1; + *needwritefile = 1; + } + zf2 = getexistingwritefile(p, fname, &wrprot2); + zfile_fclose (zf2); + zfile_fread (buffer, sizeof (char), 25, zf1); + zfile_fclose (zf1); + if (strncmp ((uae_char *) buffer, "Formatted Disk Image file", 25) == 0) { + *needwritefile = 1; + return wrprot2; + } + if (strncmp ((uae_char *) buffer, "UAE-1ADF", 8) == 0) { + if (wrprot1) + return wrprot2; + return wrprot1; + } + if (strncmp ((uae_char *) buffer, "UAE--ADF", 8) == 0) { + *needwritefile = 1; + return wrprot2; + } + if (memcmp (exeheader, buffer, sizeof exeheader) == 0) + return 0; + if (wrprot1) + return wrprot2; + return wrprot1; } -static bool isrecognizedext(const TCHAR* name) +static bool isrecognizedext (const TCHAR *name) { - const TCHAR* ext = _tcsrchr (name, '.'); - if (ext) - { - if (!_tcsicmp (ext + 1, _T("adf")) || !_tcsicmp (ext + 1, _T("adz")) || !_tcsicmp (ext + 1, _T("st")) || !_tcsicmp (ext + 1, _T("ima")) || !_tcsicmp (ext + 1, _T("img"))) + const TCHAR *ext = _tcsrchr (name, '.'); + if (ext) { + ext++; + if (!_tcsicmp (ext, _T("adf")) || !_tcsicmp (ext, _T("adz")) || !_tcsicmp (ext, _T("st")) || !_tcsicmp (ext, _T("ima")) || !_tcsicmp (ext, _T("img"))) return true; - } + } return false; } -static int drive_insert(drive* drv, struct uae_prefs* p, int dnum, const TCHAR* fname, bool fake, bool forcedwriteprotect) +static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR *fname, bool fake, bool forcedwriteprotect) { - uae_u8 buffer[2 + 2 + 4 + 4]; - trackid* tid; - int num_tracks, size; + uae_u8 buffer[2 + 2 + 4 + 4]; + trackid *tid; + int num_tracks, size; int canauto; - drive_image_free(drv); - DISK_validate_filename(p, fname, 1, &drv->wrprot, &drv->crc32, &drv->diskfile); + drive_image_free (drv); + if (!fake) + DISK_examine_image(p, dnum, &disk_info_data); + DISK_validate_filename (p, fname, 1, &drv->wrprot, &drv->crc32, &drv->diskfile); drv->forcedwrprot = forcedwriteprotect; if (drv->forcedwrprot) drv->wrprot = true; - drv->ddhd = 1; - drv->num_secs = 0; - drv->hard_num_cyls = p->floppyslots[dnum].dfxtype == DRV_525_SD ? 40 : 80; - drv->tracktiming[0] = 0; - drv->useturbo = 0; - drv->indexoffset = 0; + drv->ddhd = 1; + drv->num_heads = 2; + drv->num_secs = 0; + drv->hard_num_cyls = p->floppyslots[dnum].dfxtype == DRV_525_SD ? 40 : 80; + drv->tracktiming[0] = 0; + drv->useturbo = 0; + drv->indexoffset = 0; + if (!fake) { + drv->dskeject = false; + } - gui_disk_image_change(dnum, fname, drv->wrprot); - - if (!drv->motoroff) - { + if (!drv->motoroff) { drv->dskready_up_time = DSKREADY_UP_TIME * 312 + (uaerand() & 511); - drv->dskready_down_time = 0; + drv->dskready_down_time = 0; + } + + if (drv->diskfile == 0) { + track_reset (drv); + return 0; + } + + if (!fake) { + if (currprefs.floppyslots[dnum].df != fname) { + _tcsncpy (currprefs.floppyslots[dnum].df, fname, 255); + currprefs.floppyslots[dnum].df[255] = 0; + } + currprefs.floppyslots[dnum].forcedwriteprotect = forcedwriteprotect; + _tcsncpy (changed_prefs.floppyslots[dnum].df, fname, 255); + changed_prefs.floppyslots[dnum].df[255] = 0; + changed_prefs.floppyslots[dnum].forcedwriteprotect = forcedwriteprotect; + _tcscpy (drv->newname, fname); + drv->newnamewriteprotected = forcedwriteprotect; + gui_filename (dnum, fname); } - if (drv->diskfile == nullptr && !drv->catweasel) - { - track_reset(drv); - return 0; - } - - if (!fake) - { - //TODO: enable when we implement inputrecord.cpp - //inprec_recorddiskchange(dnum, fname, drv->wrprot); - _tcsncpy (currprefs.floppyslots[dnum].df, fname, 255); - currprefs.floppyslots[dnum].df[255] = 0; - currprefs.floppyslots[dnum].forcedwriteprotect = forcedwriteprotect; - _tcsncpy (changed_prefs.floppyslots[dnum].df, fname, 255); - changed_prefs.floppyslots[dnum].df[255] = 0; - changed_prefs.floppyslots[dnum].forcedwriteprotect = forcedwriteprotect; - _tcscpy (drv->newname, fname); - drv->newnamewriteprotected = forcedwriteprotect; - gui_filename(dnum, fname); - } - - memset(buffer, 0, sizeof buffer); - size = 0; - if (drv->diskfile) - { - zfile_fread(buffer, sizeof (char), 8, drv->diskfile); - zfile_fseek(drv->diskfile, 0, SEEK_END); - size = zfile_ftell(drv->diskfile); - zfile_fseek(drv->diskfile, 0, SEEK_SET); - } + memset (buffer, 0, sizeof buffer); + size = 0; + if (drv->diskfile) { + zfile_fread (buffer, sizeof (char), 8, drv->diskfile); + zfile_fseek (drv->diskfile, 0, SEEK_END); + size = zfile_ftell (drv->diskfile); + zfile_fseek (drv->diskfile, 0, SEEK_SET); + } canauto = 0; - if (isrecognizedext(fname)) + if (isrecognizedext (fname)) canauto = 1; - if (!canauto && drv->diskfile && isrecognizedext(zfile_getname(drv->diskfile))) + if (!canauto && drv->diskfile && isrecognizedext (zfile_getname (drv->diskfile))) + canauto = 1; + // if PC-only drive, make sure PC-like floppies are alwayss detected + if (!canauto && currprefs.floppyslots[dnum].dfxtype >= DRV_PC_ONLY_40) canauto = 1; - if (drv->catweasel) { + if (0) { - drv->wrprot = true; - drv->filetype = ADF_CATWEASEL; - drv->num_tracks = 80; - drv->ddhd = 1; - -#ifdef CAPS - } - else if (strncmp((char*)buffer, "CAPS", 4) == 0) { - - drv->wrprot = true; - if (!caps_loadimage(drv->diskfile, drv - floppy, &num_tracks)) { - zfile_fclose(drv->diskfile); - drv->diskfile = 0; - return 0; - } - drv->num_tracks = num_tracks; - drv->filetype = ADF_IPF; -#endif -#ifdef SCP - } - else if (strncmp((char*)buffer, "SCP", 3) == 0) { - drv->wrprot = true; - if (!scp_open(drv->diskfile, drv - floppy, &num_tracks)) { - zfile_fclose(drv->diskfile); - drv->diskfile = 0; - return 0; - } - drv->num_tracks = num_tracks; - drv->filetype = ADF_SCP; -#endif #ifdef FDI2RAW - } - else if (drv->fdi = fdi2raw_header(drv->diskfile)) { + } else if ((drv->fdi = fdi2raw_header (drv->diskfile))) { drv->wrprot = true; - drv->num_tracks = fdi2raw_get_last_track(drv->fdi); - drv->num_secs = fdi2raw_get_num_sector(drv->fdi); + drv->num_tracks = fdi2raw_get_last_track (drv->fdi); + drv->num_secs = fdi2raw_get_num_sector (drv->fdi); drv->filetype = ADF_FDI; #endif - } - else if (strncmp(reinterpret_cast(buffer), "UAE-1ADF", 8) == 0) - { - read_header_ext2(drv->diskfile, drv->trackdata, &drv->num_tracks, &drv->ddhd); - drv->filetype = ADF_EXT2; - drv->num_secs = 11; - if (drv->ddhd > 1) - drv->num_secs = 22; - } - else if (strncmp(reinterpret_cast(buffer), "UAE--ADF", 8) == 0) - { - int offs = 160 * 4 + 8; - int i; + } else if (strncmp ((char*)buffer, "UAE-1ADF", 8) == 0) { + + read_header_ext2 (drv->diskfile, drv->trackdata, &drv->num_tracks, &drv->ddhd); + drv->filetype = ADF_EXT2; + drv->num_secs = 11; + if (drv->ddhd > 1) + drv->num_secs = 22; + + } else if (strncmp ((char *) buffer, "UAE--ADF", 8) == 0) { + int offs = 160 * 4 + 8; + int i; drv->wrprot = true; - drv->filetype = ADF_EXT1; - drv->num_tracks = 160; - drv->num_secs = 11; + drv->filetype = ADF_EXT1; + drv->num_tracks = 160; + drv->num_secs = 11; - zfile_fseek(drv->diskfile, 8, SEEK_SET); - for (i = 0; i < 160; i++) - { - tid = &drv->trackdata[i]; - zfile_fread(buffer, 4, 1, drv->diskfile); - tid->sync = buffer[0] * 256 + buffer[1]; - tid->len = buffer[2] * 256 + buffer[3]; - tid->offs = offs; + zfile_fseek (drv->diskfile, 8, SEEK_SET); + for (i = 0; i < 160; i++) { + tid = &drv->trackdata[i]; + zfile_fread (buffer, 4, 1, drv->diskfile); + tid->sync = buffer[0] * 256 + buffer[1]; + tid->len = buffer[2] * 256 + buffer[3]; + tid->offs = offs; tid->revolutions = 1; - if (tid->sync == 0) - { - tid->type = TRACK_AMIGADOS; - tid->bitlen = 0; - } - else - { - tid->type = TRACK_RAW1; - tid->bitlen = tid->len * 8; - } - offs += tid->len; - } - } - else if (memcmp(exeheader, buffer, sizeof exeheader) == 0) - { - int i; - struct zfile* z = zfile_fopen_empty(nullptr, _T(""), 512 * 1760); - createimagefromexe(drv->diskfile, z); - drv->filetype = ADF_NORMAL; - zfile_fclose(drv->diskfile); - drv->diskfile = z; - drv->num_tracks = 160; - drv->num_secs = 11; - for (i = 0; i < drv->num_tracks; i++) - { - tid = &drv->trackdata[i]; - tid->type = TRACK_AMIGADOS; - tid->len = 512 * drv->num_secs; - tid->bitlen = 0; - tid->offs = i * 512 * drv->num_secs; - tid->revolutions = 1; - } - drv->useturbo = 1; - } - else if (canauto && ( + if (tid->sync == 0) { + tid->type = TRACK_AMIGADOS; + tid->bitlen = 0; + } else { + tid->type = TRACK_RAW1; + tid->bitlen = tid->len * 8; + } + offs += tid->len; + } - // double sided - size == 9 * 80 * 2 * 512 || size == 18 * 80 * 2 * 512 || size == 10 * 80 * 2 * 512 || size == 20 * 80 * 2 * 512 || - size == 9 * 81 * 2 * 512 || size == 18 * 81 * 2 * 512 || size == 10 * 81 * 2 * 512 || size == 20 * 81 * 2 * 512 || - size == 9 * 82 * 2 * 512 || size == 18 * 82 * 2 * 512 || size == 10 * 82 * 2 * 512 || size == 20 * 82 * 2 * 512 || - // single sided + } else if (memcmp (exeheader, buffer, sizeof exeheader) == 0) { + int i; + struct zfile *z = zfile_fopen_empty (NULL, _T(""), 512 * 1760); + createimagefromexe (drv->diskfile, z); + drv->filetype = ADF_NORMAL; + zfile_fclose (drv->diskfile); + drv->diskfile = z; + drv->num_tracks = 160; + drv->num_secs = 11; + for (i = 0; i < drv->num_tracks; i++) { + tid = &drv->trackdata[i]; + tid->type = TRACK_AMIGADOS; + tid->len = 512 * drv->num_secs; + tid->bitlen = 0; + tid->offs = i * 512 * drv->num_secs; + tid->revolutions = 1; + } + drv->useturbo = 1; + + } else if (canauto && ( + + // 320k double sided + size == 8 * 40 * 2 * 512 || + // 320k single sided + size == 8 * 40 * 1 * 512 || + + // 360k double sided + size == 9 * 40 * 2 * 512 || + // 360k single sided + size == 9 * 40 * 1 * 512 || + + // 1.2M double sided + size == 15 * 80 * 2 * 512 || + + // 720k/1440k double sided + size == 9 * 80 * 2 * 512 || size == 18 * 80 * 2 * 512 || size == 10 * 80 * 2 * 512 || size == 20 * 80 * 2 * 512 || size == 21 * 80 * 2 * 512 || + size == 9 * 81 * 2 * 512 || size == 18 * 81 * 2 * 512 || size == 10 * 81 * 2 * 512 || size == 20 * 81 * 2 * 512 || size == 21 * 81 * 2 * 512 || + size == 9 * 82 * 2 * 512 || size == 18 * 82 * 2 * 512 || size == 10 * 82 * 2 * 512 || size == 20 * 82 * 2 * 512 || size == 21 * 82 * 2 * 512 || + // 720k/1440k single sided size == 9 * 80 * 1 * 512 || size == 18 * 80 * 1 * 512 || size == 10 * 80 * 1 * 512 || size == 20 * 80 * 1 * 512 || size == 9 * 81 * 1 * 512 || size == 18 * 81 * 1 * 512 || size == 10 * 81 * 1 * 512 || size == 20 * 81 * 1 * 512 || - size == 9 * 82 * 1 * 512 || size == 18 * 82 * 1 * 512 || size == 10 * 82 * 1 * 512 || size == 20 * 82 * 1 * 512)) - { - /* PC formatted image */ - int i, side; + size == 9 * 82 * 1 * 512 || size == 18 * 82 * 1 * 512 || size == 10 * 82 * 1 * 512 || size == 20 * 82 * 1 * 512)) { + /* PC formatted image */ + int i, side; - for (side = 2; side > 0; side--) - { - if (size == 9 * 80 * side * 512 || size == 9 * 81 * side * 512 || size == 9 * 82 * side * 512) - { - drv->num_secs = 9; - drv->ddhd = 1; - break; - } - else if (size == 18 * 80 * side * 512 || size == 18 * 81 * side * 512 || size == 18 * 82 * side * 512) - { - drv->num_secs = 18; - drv->ddhd = 2; - break; - } - else if (size == 10 * 80 * side * 512 || size == 10 * 81 * side * 512 || size == 10 * 82 * side * 512) - { - drv->num_secs = 10; - drv->ddhd = 1; - break; - } - else if (size == 20 * 80 * side * 512 || size == 20 * 81 * side * 512 || size == 20 * 82 * side * 512) - { - drv->num_secs = 20; - drv->ddhd = 2; - break; - } - } - drv->num_tracks = size / (drv->num_secs * 512); + drv->num_secs = 9; + drv->ddhd = 1; - drv->filetype = ADF_PCDOS; - tid = &drv->trackdata[0]; - for (i = 0; i < drv->num_tracks; i++) - { - tid->type = TRACK_PCDOS; - tid->len = 512 * drv->num_secs; - tid->bitlen = 0; - tid->offs = i * 512 * drv->num_secs; - if (side == 1) - { - tid++; - tid->type = TRACK_NONE; - tid->len = 512 * drv->num_secs; - } - tid->revolutions = 1; - tid++; - } - if (side == 1) - drv->num_tracks *= 2; - } - else if ((size == 262144 || size == 524288) && buffer[0] == 0x11 && (buffer[1] == 0x11 || buffer[1] == 0x14)) - { - // 256k -> KICK disk, 512k -> SuperKickstart disk - drv->filetype = size == 262144 ? ADF_KICK : ADF_SKICK; - drv->num_tracks = 1760 / (drv->num_secs = 11); - for (int i = 0; i < drv->num_tracks; i++) - { - tid = &drv->trackdata[i]; - tid->type = TRACK_AMIGADOS; - tid->len = 512 * drv->num_secs; - tid->bitlen = 0; - tid->offs = i * 512 * drv->num_secs - (drv->filetype == ADF_KICK ? 512 : 262144 + 1024); - tid->track = i; - tid->revolutions = 1; - } - } - else - { - int i, ds; - - ds = 0; - drv->filetype = ADF_NORMAL; - - /* High-density or diskspare disk? */ - drv->num_tracks = 0; - if (size > 160 * 11 * 512 + 511) - { // larger than standard adf? - for (i = 80; i <= 83; i++) - { - if (size == i * 22 * 512 * 2) - { // HD + for (side = 2; side > 0; side--) { + if ( size == 9 * 80 * side * 512 || size == 9 * 81 * side * 512 || size == 9 * 82 * side * 512) { + drv->num_secs = 9; + drv->ddhd = 1; + break; + } else if (size == 18 * 80 * side * 512 || size == 18 * 81 * side * 512 || size == 18 * 82 * side * 512) { + drv->num_secs = 18; + drv->ddhd = 2; + break; + } else if (size == 10 * 80 * side * 512 || size == 10 * 81 * side * 512 || size == 10 * 82 * side * 512) { + drv->num_secs = 10; + drv->ddhd = 1; + break; + } else if (size == 20 * 80 * side * 512 || size == 20 * 81 * side * 512 || size == 20 * 82 * side * 512) { + drv->num_secs = 20; + drv->ddhd = 2; + break; + } else if (size == 21 * 80 * side * 512 || size == 21 * 81 * side * 512 || size == 21 * 82 * side * 512) { + drv->num_secs = 21; drv->ddhd = 2; - drv->num_tracks = size / (512 * (drv->num_secs = 22)); break; - } - if (size == i * 11 * 512 * 2) - { // >80 cyl DD - drv->num_tracks = size / (512 * (drv->num_secs = 11)); + } else if (size == 9 * 40 * side * 512) { + drv->num_secs = 9; + drv->ddhd = 1; break; - } - if (size == i * 12 * 512 * 2) - { // ds 12 sectors - drv->num_tracks = size / (512 * (drv->num_secs = 12)); - ds = 1; + } else if (size == 8 * 40 * side * 512) { + drv->num_secs = 8; + drv->ddhd = 1; break; - } - if (size == i * 24 * 512 * 2) - { // ds 24 sectors - drv->num_tracks = size / (512 * (drv->num_secs = 24)); - drv->ddhd = 2; - ds = 1; - break; - } - } - if (drv->num_tracks == 0) - { - drv->num_tracks = size / (512 * (drv->num_secs = 22)); - drv->ddhd = 2; - } - } - else - { - drv->num_tracks = size / (512 * (drv->num_secs = 11)); - } + } else if (size == 15 * 80 * side * 512) { + drv->num_secs = 15; + drv->ddhd = 1; + break; + } + } - if (!ds && drv->num_tracks > MAX_TRACKS) - write_log (_T("Your diskfile is too big, %d bytes!\n"), size); - for (i = 0; i < drv->num_tracks; i++) - { - tid = &drv->trackdata[i]; - tid->type = ds ? TRACK_DISKSPARE : TRACK_AMIGADOS; - tid->len = 512 * drv->num_secs; - tid->bitlen = 0; - tid->offs = i * 512 * drv->num_secs; + drv->num_tracks = size / (drv->num_secs * 512); + + drv->filetype = ADF_PCDOS; + tid = &drv->trackdata[0]; + for (i = 0; i < drv->num_tracks; i++) { + tid->type = TRACK_PCDOS; + tid->len = 512 * drv->num_secs; + tid->bitlen = 0; + tid->offs = i * 512 * drv->num_secs; + if (side == 1) { + tid++; + tid->type = TRACK_NONE; + tid->len = 512 * drv->num_secs; + } + tid->revolutions = 1; + tid++; + + } + drv->num_heads = side; + if (side == 1) + drv->num_tracks *= 2; + + } else if ((size == 262144 || size == 524288) && buffer[0] == 0x11 && (buffer[1] == 0x11 || buffer[1] == 0x14)) { + + // 256k -> KICK disk, 512k -> SuperKickstart disk + drv->filetype = size == 262144 ? ADF_KICK : ADF_SKICK; + drv->num_tracks = 1760 / (drv->num_secs = 11); + for (int i = 0; i < drv->num_tracks; i++) { + tid = &drv->trackdata[i]; + tid->type = TRACK_AMIGADOS; + tid->len = 512 * drv->num_secs; + tid->bitlen = 0; + tid->offs = i * 512 * drv->num_secs - (drv->filetype == ADF_KICK ? 512 : 262144 + 1024); + tid->track = i; + tid->revolutions = 1; + } + + } else { + + int i, ds; + + ds = 0; + drv->filetype = ADF_NORMAL; + + /* High-density or diskspare disk? */ + drv->num_tracks = 0; + if (size > 160 * 11 * 512 + 511) { // larger than standard adf? + for (i = 80; i <= 83; i++) { + if (size == i * 22 * 512 * 2) { // HD + drv->ddhd = 2; + drv->num_tracks = size / (512 * (drv->num_secs = 22)); + break; + } + if (size == i * 11 * 512 * 2) { // >80 cyl DD + drv->num_tracks = size / (512 * (drv->num_secs = 11)); + break; + } + if (size == i * 12 * 512 * 2) { // ds 12 sectors + drv->num_tracks = size / (512 * (drv->num_secs = 12)); + ds = 1; + break; + } + if (size == i * 24 * 512 * 2) { // ds 24 sectors + drv->num_tracks = size / (512 * (drv->num_secs = 24)); + drv->ddhd = 2; + ds = 1; + break; + } + } + if (drv->num_tracks == 0) { + drv->num_tracks = size / (512 * (drv->num_secs = 22)); + drv->ddhd = 2; + } + } else { + drv->num_tracks = size / (512 * (drv->num_secs = 11)); + } + + if (!ds &&drv->num_tracks > MAX_TRACKS) + write_log (_T("Your diskfile is too big, %d bytes!\n"), size); + for (i = 0; i < drv->num_tracks; i++) { + tid = &drv->trackdata[i]; + tid->type = ds ? TRACK_DISKSPARE : TRACK_AMIGADOS; + tid->len = 512 * drv->num_secs; + tid->bitlen = 0; + tid->offs = i * 512 * drv->num_secs; tid->revolutions = 1; - } + } + } + openwritefile (p, drv, 0); + drive_settype_id (drv); /* Set DD or HD drive */ + drive_fill_bigbuf (drv, 1); + drv->mfmpos = uaerand (); + drv->mfmpos |= (uaerand () << 16); + drv->mfmpos %= drv->tracklen; + drv->prevtracklen = 0; + if (!fake) { + update_drive_gui (drv - floppy, false); } - openwritefile(p, drv, 0); - drive_settype_id(drv); /* Set DD or HD drive */ - drive_fill_bigbuf(drv, 1); - drv->mfmpos = uaerand (); - drv->mfmpos |= uaerand () << 16; - drv->mfmpos %= drv->tracklen; - drv->prevtracklen = 0; - if (!fake) - { -#ifdef DRIVESOUND - if (isfloppysound(drv)) - driveclick_insert(drv - floppy, 0); -#endif - update_drive_gui(drv - floppy, false); - } - return 1; + return 1; } -static void rand_shifter(drive* drv) +static void rand_shifter (drive *drv) { - int r = (uaerand () >> 4 & 7) + 1; - while (r-- > 0) - { - word <<= 1; - word |= uaerand () & 0x1000 ? 1 : 0; - bitoffset++; - bitoffset &= 15; - } + int r = ((uaerand () >> 4) & 7) + 1; + while (r-- > 0) { + word <<= 1; + word |= (uaerand () & 0x1000) ? 1 : 0; + bitoffset++; + bitoffset &= 15; + } } -static void set_steplimit(drive* drv) +static void set_steplimit (drive *drv) { // emulate step limit only if cycle-exact or approximate CPU speed if (currprefs.m68k_speed != 0) return; drv->steplimit = 4; - drv->steplimitcycle = get_cycles(); + drv->steplimitcycle = get_cycles (); } -static int drive_empty(drive* drv) +static int drive_empty (drive * drv) { -#ifdef CATWEASEL - if (drv->catweasel) - return catweasel_disk_changed(drv->catweasel) == 0; -#endif - return drv->diskfile == nullptr && drv->dskchange_time >= 0; + return drv->diskfile == 0 && drv->dskchange_time >= 0; } -static void drive_step(drive* drv, int step_direction) +static void drive_step (drive * drv, int step_direction) { -#ifdef CATWEASEL - if (drv->catweasel) { - int dir = direction ? -1 : 1; - catweasel_step(drv->catweasel, dir); - drv->cyl += dir; - if (drv->cyl < 0) - drv->cyl = 0; - write_log(_T("%d -> %d\n"), dir, drv->cyl); - return; - } -#endif - if (!drive_empty(drv)) - drv->dskchange = false; - if (drv->steplimit && get_cycles() - drv->steplimitcycle < MIN_STEPLIMIT_CYCLE) - { - write_log(_T(" step ignored drive %d, %d\n"), - drv - floppy, (get_cycles() - drv->steplimitcycle) / CYCLE_UNIT); - return; - } - /* A1200's floppy drive needs at least 30 raster lines between steps - * but we'll use very small value for better compatibility with faster CPU emulation - * (stupid trackloaders with CPU delay loops) - */ - set_steplimit(drv); - if (step_direction) - { - if (drv->cyl) - { - drv->cyl--; -#ifdef DRIVESOUND - if (isfloppysound(drv)) - driveclick_click(drv - floppy, drv->cyl); -#endif - } - } - else - { - int maxtrack = drv->hard_num_cyls; - if (drv->cyl < maxtrack + 3) - { - drv->cyl++; -#ifdef CATWEASEL - if (drv->catweasel) - catweasel_step(drv->catweasel, 1); -#endif - } + if (!drive_empty (drv)) + drv->dskchange = 0; + if (drv->steplimit && get_cycles() - drv->steplimitcycle < MIN_STEPLIMIT_CYCLE) { + return; + } + /* A1200's floppy drive needs at least 30 raster lines between steps + * but we'll use very small value for better compatibility with faster CPU emulation + * (stupid trackloaders with CPU delay loops) + */ + set_steplimit (drv); + if (step_direction) { + if (drv->cyl) { + drv->cyl--; + } + } else { + int maxtrack = drv->hard_num_cyls; + if (drv->cyl < maxtrack + 3) { + drv->cyl++; + } if (drv->cyl >= maxtrack) write_log (_T("program tried to step over track %d\n"), maxtrack); -#ifdef DRIVESOUND - if (isfloppysound(drv)) - driveclick_click(drv - floppy, drv->cyl); -#endif - } - rand_shifter(drv); + } + rand_shifter (drv); } -static int drive_track0(drive* drv) +static int drive_track0 (drive * drv) { -#ifdef CATWEASEL - if (drv->catweasel) - return catweasel_track0(drv->catweasel); -#endif - return drv->cyl == 0; + return drv->cyl == 0; } -static int drive_writeprotected(drive* drv) +static int drive_writeprotected (drive * drv) { -#ifdef CATWEASEL - if (drv->catweasel) - return 1; -#endif - //TODO: enable when floppy_read_only is added in options.h - //return currprefs.floppy_read_only || drv->wrprot || drv->forcedwrprot || drv->diskfile == NULL; - return drv->wrprot || drv->forcedwrprot || drv->diskfile == nullptr; + return currprefs.floppy_read_only || drv->wrprot || drv->forcedwrprot || drv->diskfile == NULL; } -static int drive_running(drive* drv) +static int drive_running (drive * drv) { - return !drv->motoroff; + return !drv->motoroff; } void DISK_motordelay_func(uae_u32 v) { - floppy[v].motordelay = 0; + floppy[v].motordelay = 0; } -static void motordelay_func(uae_u32 v) +static void drive_motor (drive * drv, bool off) { - floppy[v].motordelay = 0; -} - -static void drive_motor(drive* drv, bool off) -{ - if (drv->motoroff && !off) - { + if (drv->motoroff && !off) { drv->dskready_up_time = DSKREADY_UP_TIME * 312 + (uaerand() & 511); - rand_shifter(drv); -#ifdef DRIVESOUND - if (isfloppysound(drv)) - driveclick_motor(drv - floppy, drv->dskready_down_time == 0 ? 2 : 1); -#endif - } - if (!drv->motoroff && off) - { - drv->drive_id_scnt = 0; /* Reset id shift reg counter */ - drv->dskready_down_time = DSKREADY_DOWN_TIME * 312 + (uaerand() & 511); -#ifdef DRIVESOUND - driveclick_motor(drv - floppy, 0); -#endif - if (currprefs.cpu_model <= 68010 && currprefs.m68k_speed == 0) - { - drv->motordelay = 1; - event2_newevent2(30, drv - floppy, motordelay_func); - } - } - drv->motoroff = off; - if (drv->motoroff) - { - drv->dskready = 0; + rand_shifter (drv); + } + if (!drv->motoroff && off) { + drv->drive_id_scnt = 0; /* Reset id shift reg counter */ + drv->dskready_down_time = DSKREADY_DOWN_TIME * 312 + (uaerand() & 511); + if (currprefs.cpu_model <= 68010 && currprefs.m68k_speed == 0) { + drv->motordelay = 1; + event2_newevent(ev2_disk_motor0 + (drv - floppy), 30, drv - floppy); + } + } + drv->motoroff = off; + if (drv->motoroff) { + drv->dskready = 0; drv->dskready_up_time = 0; - } - else - { + } else { drv->dskready_down_time = 0; - } -#ifdef CATWEASEL - if (drv->catweasel) - catweasel_set_motor(drv->catweasel, !drv->motoroff); -#endif + } } -static void read_floppy_data(struct zfile* diskfile, int type, trackid* tid, int offset, uae_u8* dst, int len) +static void read_floppy_data (struct zfile *diskfile, int type, trackid *tid, int offset, uae_u8 *dst, int len) { - if (len == 0) - return; - if (tid->track == 0) - { - if (type == ADF_KICK) - { - memset(dst, 0, len > 512 ? 512 : len); - if (offset == 0) - { - memcpy(dst, "KICK", 4); + if (len == 0) + return; + if (tid->track == 0) { + if (type == ADF_KICK) { + memset (dst, 0, len > 512 ? 512 : len); + if (offset == 0) { + memcpy (dst, "KICK", 4); len -= 512; } - } - else if (type == ADF_SKICK) - { - memset(dst, 0, len > 512 ? 512 : len); - if (offset == 0) - { - memcpy(dst, "KICKSUP0", 8); + } else if (type == ADF_SKICK) { + memset (dst, 0, len > 512 ? 512 : len); + if (offset == 0) { + memcpy (dst, "KICKSUP0", 8); len -= 1024; - } - else if (offset == 512) - { + } else if (offset == 512) { len -= 512; } } } int off = tid->offs + offset; - if (off >= 0 && len > 0) - { - zfile_fseek(diskfile, off, SEEK_SET); - zfile_fread(dst, 1, len, diskfile); + if (off >= 0 && len > 0) { + zfile_fseek (diskfile, off, SEEK_SET); + zfile_fread (dst, 1, len, diskfile); } } /* Megalomania does not like zero MFM words... */ -static void mfmcode(uae_u16* mfm, int words) +static void mfmcode (uae_u16 * mfm, int words) { - uae_u32 lastword = 0; - - while (words--) - { + uae_u32 lastword = 0; + while (words--) { uae_u32 v = (*mfm) & 0x55555555; - uae_u32 lv = (lastword << 16) | v; - uae_u32 nlv = 0x55555555 & ~lv; - uae_u32 mfmbits = (nlv << 1) & (nlv >> 1); - *mfm++ = v | mfmbits; - lastword = v; - } + uae_u32 lv = (lastword << 16) | v; + uae_u32 nlv = 0x55555555 & ~lv; + uae_u32 mfmbits = (nlv << 1) & (nlv >> 1); + *mfm++ = v | mfmbits; + lastword = v; + } } -static uae_u8 mfmencodetable[16] = { - 0x2a, 0x29, 0x24, 0x25, 0x12, 0x11, 0x14, 0x15, - 0x4a, 0x49, 0x44, 0x45, 0x52, 0x51, 0x54, 0x55 +static const uae_u8 mfmencodetable[16] = { + 0x2a, 0x29, 0x24, 0x25, 0x12, 0x11, 0x14, 0x15, + 0x4a, 0x49, 0x44, 0x45, 0x52, 0x51, 0x54, 0x55 }; static uae_u16 dos_encode_byte(uae_u8 byte) -{ - uae_u8 b2, b1; - uae_u16 word; +{ + uae_u8 b2, b1; + uae_u16 word; - b1 = byte; - b2 = b1 >> 4; - b1 &= 15; - word = mfmencodetable[b2] << 8 | mfmencodetable[b1]; - return (word | ((word & (256 | 64)) ? 0 : 128)); + b1 = byte; + b2 = b1 >> 4; + b1 &= 15; + word = mfmencodetable[b2] <<8 | mfmencodetable[b1]; + return (word | ((word & (256 | 64)) ? 0 : 128)); } -static uae_u16* mfmcoder(uae_u8* src, uae_u16* dest, int len) +static uae_u16 *mfmcoder(uae_u8 *src, uae_u16 *dest, int len) { - int i; + int i; - for (i = 0; i < len; i++) - { - *dest = dos_encode_byte(*src++); - *dest |= ((dest[-1] & 1) || (*dest & 0x4000)) ? 0 : 0x8000; - dest++; - } - return dest; + for (i = 0; i < len; i++) { + *dest = dos_encode_byte(*src++); + *dest |= ((dest[-1] & 1)||(*dest & 0x4000)) ? 0: 0x8000; + dest++; + } + return dest; } -static void decode_pcdos(drive* drv) +static void decode_pcdos (drive *drv) { - int i, len; - int tr = drv->cyl * 2 + side; - uae_u16 *dstmfmbuf, *mfm2; - uae_u8 secbuf[1000]; - uae_u16 crc16; - trackid* ti = drv->trackdata + tr; - int tracklen = 12500; + int i, len; + int tr = drv->cyl * 2 + side; + uae_u16 *dstmfmbuf, *mfm2; + uae_u8 secbuf[1000]; + uae_u16 crc16; + trackid *ti = drv->trackdata + tr; + int tracklen = 12500; - mfm2 = drv->bigmfmbuf; - *mfm2++ = 0x9254; - memset(secbuf, 0x4e, 40); - memset(secbuf + 40, 0x00, 12); - secbuf[52] = 0xc2; - secbuf[53] = 0xc2; - secbuf[54] = 0xc2; - secbuf[55] = 0xfc; - memset(secbuf + 56, 0x4e, 40); - dstmfmbuf = mfmcoder(secbuf, mfm2, 96); - mfm2[52] = 0x5224; - mfm2[53] = 0x5224; - mfm2[54] = 0x5224; - for (i = 0; i < drv->num_secs; i++) - { - mfm2 = dstmfmbuf; - memset(secbuf, 0x00, 12); - secbuf[12] = 0xa1; - secbuf[13] = 0xa1; - secbuf[14] = 0xa1; - secbuf[15] = 0xfe; - secbuf[16] = drv->cyl; - secbuf[17] = side; - secbuf[18] = 1 + i; - secbuf[19] = 2; // 128 << 2 = 512 - crc16 = get_crc16(secbuf + 12, 3 + 1 + 4); - secbuf[20] = crc16 >> 8; - secbuf[21] = crc16 & 0xff; - memset(secbuf + 22, 0x4e, 22); - memset(secbuf + 44, 0x00, 12); - secbuf[56] = 0xa1; - secbuf[57] = 0xa1; - secbuf[58] = 0xa1; - secbuf[59] = 0xfb; - read_floppy_data(drv->diskfile, drv->filetype, ti, i * 512, &secbuf[60], 512); - crc16 = get_crc16(secbuf + 56, 3 + 1 + 512); - secbuf[60 + 512] = crc16 >> 8; - secbuf[61 + 512] = crc16 & 0xff; - len = (tracklen / 2 - 96) / drv->num_secs - 574 / drv->ddhd; - if (len > 0) - memset(secbuf + 512 + 62, 0x4e, len); - dstmfmbuf = mfmcoder(secbuf, mfm2, 60 + 512 + 2 + 76 / drv->ddhd); - mfm2[12] = 0x4489; - mfm2[13] = 0x4489; - mfm2[14] = 0x4489; - mfm2[56] = 0x4489; - mfm2[57] = 0x4489; - mfm2[58] = 0x4489; - } - while (dstmfmbuf - drv->bigmfmbuf < tracklen / 2) - *dstmfmbuf++ = 0x9254; - drv->skipoffset = 0; - drv->tracklen = (dstmfmbuf - drv->bigmfmbuf) * 16; + mfm2 = drv->bigmfmbuf; + *mfm2++ = 0x9254; + memset (secbuf, 0x4e, 40); + memset (secbuf + 40, 0x00, 12); + secbuf[52] = 0xc2; + secbuf[53] = 0xc2; + secbuf[54] = 0xc2; + secbuf[55] = 0xfc; + memset (secbuf + 56, 0x4e, 40); + dstmfmbuf = mfmcoder (secbuf, mfm2, 96); + mfm2[52] = 0x5224; + mfm2[53] = 0x5224; + mfm2[54] = 0x5224; + for (i = 0; i < drv->num_secs; i++) { + mfm2 = dstmfmbuf; + memset (secbuf, 0x00, 12); + secbuf[12] = 0xa1; + secbuf[13] = 0xa1; + secbuf[14] = 0xa1; + secbuf[15] = 0xfe; + secbuf[16] = drv->cyl; + secbuf[17] = side; + secbuf[18] = 1 + i; + secbuf[19] = 2; // 128 << 2 = 512 + crc16 = get_crc16(secbuf + 12, 3 + 1 + 4); + secbuf[20] = crc16 >> 8; + secbuf[21] = crc16 & 0xff; + memset(secbuf + 22, 0x4e, 22); + memset(secbuf + 44, 0x00, 12); + secbuf[56] = 0xa1; + secbuf[57] = 0xa1; + secbuf[58] = 0xa1; + secbuf[59] = 0xfb; + read_floppy_data (drv->diskfile, drv->filetype, ti, i * 512, &secbuf[60], 512); + crc16 = get_crc16(secbuf + 56, 3 + 1 + 512); + secbuf[60 + 512] = crc16 >> 8; + secbuf[61 + 512] = crc16 & 0xff; + len = (tracklen / 2 - 96) / drv->num_secs - 574 / drv->ddhd; + if (len > 0) + memset(secbuf + 512 + 62, 0x4e, len); + dstmfmbuf = mfmcoder(secbuf, mfm2, 60 + 512 + 2 + 76 / drv->ddhd); + mfm2[12] = 0x4489; + mfm2[13] = 0x4489; + mfm2[14] = 0x4489; + mfm2[56] = 0x4489; + mfm2[57] = 0x4489; + mfm2[58] = 0x4489; + } + while (dstmfmbuf - drv->bigmfmbuf < tracklen / 2) + *dstmfmbuf++ = 0x9254; + drv->skipoffset = 0; + drv->tracklen = (dstmfmbuf - drv->bigmfmbuf) * 16; } -static void decode_amigados(drive* drv) +static void decode_amigados (drive *drv) { - /* Normal AmigaDOS format track */ - int tr = drv->cyl * 2 + side; - int sec; + /* Normal AmigaDOS format track */ + int tr = drv->cyl * 2 + side; + int sec; int dstmfmoffset = 0; - uae_u16* dstmfmbuf = drv->bigmfmbuf; - int len = drv->num_secs * 544 + FLOPPY_GAP_LEN; + uae_u16 *dstmfmbuf = drv->bigmfmbuf; + int len = drv->num_secs * 544 + FLOPPY_GAP_LEN; int prevbit; - trackid* ti = drv->trackdata + tr; - memset(dstmfmbuf, 0xaa, len * 2); + trackid *ti = drv->trackdata + tr; + memset (dstmfmbuf, 0xaa, len * 2); dstmfmoffset += FLOPPY_GAP_LEN; drv->skipoffset = (FLOPPY_GAP_LEN * 8) / 3 * 2; drv->tracklen = len * 2 * 8; prevbit = 0; - for (sec = 0; sec < drv->num_secs; sec++) - { - uae_u8 secbuf[544]; - uae_u16 mfmbuf[544 + 1]; - int i; - uae_u32 deven, dodd; - uae_u32 hck = 0, dck = 0; + for (sec = 0; sec < drv->num_secs; sec++) { + uae_u8 secbuf[544]; + uae_u16 mfmbuf[544 + 1]; + int i; + uae_u32 deven, dodd; + uae_u32 hck = 0, dck = 0; - secbuf[0] = secbuf[1] = 0x00; - secbuf[2] = secbuf[3] = 0xa1; - secbuf[4] = 0xff; - secbuf[5] = tr; - secbuf[6] = sec; - secbuf[7] = drv->num_secs - sec; + secbuf[0] = secbuf[1] = 0x00; + secbuf[2] = secbuf[3] = 0xa1; + secbuf[4] = 0xff; + secbuf[5] = tr; + secbuf[6] = sec; + secbuf[7] = drv->num_secs - sec; - for (i = 8; i < 24; i++) - secbuf[i] = 0; + for (i = 8; i < 24; i++) + secbuf[i] = 0; - read_floppy_data(drv->diskfile, drv->filetype, ti, sec * 512, &secbuf[32], 512); + read_floppy_data (drv->diskfile, drv->filetype, ti, sec * 512, &secbuf[32], 512); mfmbuf[0] = prevbit ? 0x2aaa : 0xaaaa; mfmbuf[1] = 0xaaaa; - mfmbuf[2] = mfmbuf[3] = 0x4489; + mfmbuf[2] = mfmbuf[3] = 0x4489; - deven = ((secbuf[4] << 24) | (secbuf[5] << 16) - | (secbuf[6] << 8) | (secbuf[7])); - dodd = deven >> 1; - deven &= 0x55555555; - dodd &= 0x55555555; + deven = ((secbuf[4] << 24) | (secbuf[5] << 16) + | (secbuf[6] << 8) | (secbuf[7])); + dodd = deven >> 1; + deven &= 0x55555555; + dodd &= 0x55555555; - mfmbuf[4] = dodd >> 16; - mfmbuf[5] = dodd; - mfmbuf[6] = deven >> 16; - mfmbuf[7] = deven; + mfmbuf[4] = dodd >> 16; + mfmbuf[5] = dodd; + mfmbuf[6] = deven >> 16; + mfmbuf[7] = deven; - for (i = 8; i < 48; i++) - mfmbuf[i] = 0xaaaa; - for (i = 0; i < 512; i += 4) - { - deven = ((secbuf[i + 32] << 24) | (secbuf[i + 33] << 16) - | (secbuf[i + 34] << 8) | (secbuf[i + 35])); - dodd = deven >> 1; - deven &= 0x55555555; - dodd &= 0x55555555; - mfmbuf[(i >> 1) + 32] = dodd >> 16; - mfmbuf[(i >> 1) + 33] = dodd; - mfmbuf[(i >> 1) + 256 + 32] = deven >> 16; - mfmbuf[(i >> 1) + 256 + 33] = deven; - } + for (i = 8; i < 48; i++) + mfmbuf[i] = 0xaaaa; + for (i = 0; i < 512; i += 4) { + deven = ((secbuf[i + 32] << 24) | (secbuf[i + 33] << 16) + | (secbuf[i + 34] << 8) | (secbuf[i + 35])); + dodd = deven >> 1; + deven &= 0x55555555; + dodd &= 0x55555555; + mfmbuf[(i >> 1) + 32] = dodd >> 16; + mfmbuf[(i >> 1) + 33] = dodd; + mfmbuf[(i >> 1) + 256 + 32] = deven >> 16; + mfmbuf[(i >> 1) + 256 + 33] = deven; + } - for (i = 4; i < 24; i += 2) - hck ^= (mfmbuf[i] << 16) | mfmbuf[i + 1]; + for (i = 4; i < 24; i += 2) + hck ^= (mfmbuf[i] << 16) | mfmbuf[i + 1]; - deven = dodd = hck; - dodd >>= 1; - mfmbuf[24] = dodd >> 16; - mfmbuf[25] = dodd; - mfmbuf[26] = deven >> 16; - mfmbuf[27] = deven; + deven = dodd = hck; + dodd >>= 1; + mfmbuf[24] = dodd >> 16; + mfmbuf[25] = dodd; + mfmbuf[26] = deven >> 16; + mfmbuf[27] = deven; - for (i = 32; i < 544; i += 2) - dck ^= (mfmbuf[i] << 16) | mfmbuf[i + 1]; + for (i = 32; i < 544; i += 2) + dck ^= (mfmbuf[i] << 16) | mfmbuf[i + 1]; - deven = dodd = dck; - dodd >>= 1; - mfmbuf[28] = dodd >> 16; - mfmbuf[29] = dodd; - mfmbuf[30] = deven >> 16; - mfmbuf[31] = deven; + deven = dodd = dck; + dodd >>= 1; + mfmbuf[28] = dodd >> 16; + mfmbuf[29] = dodd; + mfmbuf[30] = deven >> 16; + mfmbuf[31] = deven; mfmbuf[544] = 0; - mfmcode(mfmbuf + 4, 544 - 4 + 1); + mfmcode (mfmbuf + 4, 544 - 4 + 1); - for (i = 0; i < 544; i++) - { - dstmfmbuf[dstmfmoffset % len] = mfmbuf[i]; - dstmfmoffset++; - } + for (i = 0; i < 544; i++) { + dstmfmbuf[dstmfmoffset % len] = mfmbuf[i]; + dstmfmoffset++; + } prevbit = mfmbuf[i - 1] & 1; // so that final word has correct MFM encoding dstmfmbuf[dstmfmoffset % len] = mfmbuf[i]; - } + } } /* @@ -1784,236 +1617,188 @@ static void decode_amigados(drive* drv) * */ -static void decode_diskspare(drive* drv) +static void decode_diskspare (drive *drv) { - int tr = drv->cyl * 2 + side; - int sec; - int dstmfmoffset = 0; - int size = 512 + 8; - uae_u16* dstmfmbuf = drv->bigmfmbuf; - int len = drv->num_secs * size + FLOPPY_GAP_LEN; + int tr = drv->cyl * 2 + side; + int sec; + int dstmfmoffset = 0; + int size = 512 + 8; + uae_u16 *dstmfmbuf = drv->bigmfmbuf; + int len = drv->num_secs * size + FLOPPY_GAP_LEN; - trackid* ti = drv->trackdata + tr; - memset(dstmfmbuf, 0xaa, len * 2); - dstmfmoffset += FLOPPY_GAP_LEN; - drv->skipoffset = (FLOPPY_GAP_LEN * 8) / 3 * 2; - drv->tracklen = len * 2 * 8; + trackid *ti = drv->trackdata + tr; + memset (dstmfmbuf, 0xaa, len * 2); + dstmfmoffset += FLOPPY_GAP_LEN; + drv->skipoffset = (FLOPPY_GAP_LEN * 8) / 3 * 2; + drv->tracklen = len * 2 * 8; - for (sec = 0; sec < drv->num_secs; sec++) - { - uae_u8 secbuf[512 + 8]; - uae_u16 mfmbuf[512 + 8]; - int i; - uae_u32 deven, dodd; - uae_u16 chk; + for (sec = 0; sec < drv->num_secs; sec++) { + uae_u8 secbuf[512 + 8]; + uae_u16 mfmbuf[512 + 8]; + int i; + uae_u32 deven, dodd; + uae_u16 chk; - secbuf[0] = tr; - secbuf[1] = sec; - secbuf[2] = 0; - secbuf[3] = 0; + secbuf[0] = tr; + secbuf[1] = sec; + secbuf[2] = 0; + secbuf[3] = 0; - read_floppy_data(drv->diskfile, drv->filetype, ti, sec * 512, &secbuf[4], 512); + read_floppy_data (drv->diskfile, drv->filetype, ti, sec * 512, &secbuf[4], 512); - mfmbuf[0] = 0xaaaa; - mfmbuf[1] = 0x4489; - mfmbuf[2] = 0x4489; - mfmbuf[3] = 0x2aaa; + mfmbuf[0] = 0xaaaa; + mfmbuf[1] = 0x4489; + mfmbuf[2] = 0x4489; + mfmbuf[3] = 0x2aaa; - for (i = 0; i < 512; i += 4) - { - deven = ((secbuf[i + 4] << 24) | (secbuf[i + 5] << 16) - | (secbuf[i + 6] << 8) | (secbuf[i + 7])); - dodd = deven >> 1; - deven &= 0x55555555; - dodd &= 0x55555555; - mfmbuf[i + 8 + 0] = dodd >> 16; - mfmbuf[i + 8 + 1] = dodd; - mfmbuf[i + 8 + 2] = deven >> 16; - mfmbuf[i + 8 + 3] = deven; - } - mfmcode(mfmbuf + 8, 512); + for (i = 0; i < 512; i += 4) { + deven = ((secbuf[i + 4] << 24) | (secbuf[i + 5] << 16) + | (secbuf[i + 6] << 8) | (secbuf[i + 7])); + dodd = deven >> 1; + deven &= 0x55555555; + dodd &= 0x55555555; + mfmbuf[i + 8 + 0] = dodd >> 16; + mfmbuf[i + 8 + 1] = dodd; + mfmbuf[i + 8 + 2] = deven >> 16; + mfmbuf[i + 8 + 3] = deven; + } + mfmcode (mfmbuf + 8, 512); - i = 8; - chk = mfmbuf[i++] & 0x7fff; - while (i < 512 + 8) - chk ^= mfmbuf[i++]; - secbuf[2] = chk >> 8; - secbuf[3] = chk; + i = 8; + chk = mfmbuf[i++] & 0x7fff; + while (i < 512 + 8) + chk ^= mfmbuf[i++]; + secbuf[2] = chk >> 8; + secbuf[3] = chk; - deven = ((secbuf[0] << 24) | (secbuf[1] << 16) - | (secbuf[2] << 8) | (secbuf[3])); - dodd = deven >> 1; - deven &= 0x55555555; - dodd &= 0x55555555; + deven = ((secbuf[0] << 24) | (secbuf[1] << 16) + | (secbuf[2] << 8) | (secbuf[3])); + dodd = deven >> 1; + deven &= 0x55555555; + dodd &= 0x55555555; - mfmbuf[4] = dodd >> 16; - mfmbuf[5] = dodd; - mfmbuf[6] = deven >> 16; - mfmbuf[7] = deven; - mfmcode(mfmbuf + 4, 4); + mfmbuf[4] = dodd >> 16; + mfmbuf[5] = dodd; + mfmbuf[6] = deven >> 16; + mfmbuf[7] = deven; + mfmcode (mfmbuf + 4, 4); - for (i = 0; i < 512 + 8; i++) - { - dstmfmbuf[dstmfmoffset % len] = mfmbuf[i]; - dstmfmoffset++; - } - } + for (i = 0; i < 512 + 8; i++) { + dstmfmbuf[dstmfmoffset % len] = mfmbuf[i]; + dstmfmoffset++; + } + } } -static void drive_fill_bigbuf(drive* drv, int force) +static void drive_fill_bigbuf (drive * drv, int force) { - int tr = drv->cyl * 2 + side; - trackid* ti = drv->trackdata + tr; - bool retrytrack; + int tr = drv->cyl * 2 + side; + trackid *ti = drv->trackdata + tr; int rev = -1; - if (!drv->diskfile || tr >= drv->num_tracks) - { - track_reset(drv); - return; - } + if ((!drv->diskfile) || tr >= drv->num_tracks) { + track_reset (drv); + return; + } + + if (!force && drv->buffered_cyl == drv->cyl && drv->buffered_side == side) + return; + drv->indexoffset = 0; + drv->multi_revolution = 0; + drv->tracktiming[0] = 0; + drv->skipoffset = -1; + drv->revolutions = 1; - if (!force && drv->catweasel) { - drv->buffered_cyl = -1; - return; - } + if (drv->writediskfile && drv->writetrackdata[tr].bitlen > 0) { + int i; + trackid *wti = &drv->writetrackdata[tr]; + drv->tracklen = wti->bitlen; + drv->revolutions = wti->revolutions; + read_floppy_data (drv->writediskfile, drv->filetype, wti, 0, (uae_u8*)drv->bigmfmbuf, (wti->bitlen + 7) / 8); + for (i = 0; i < (drv->tracklen + 15) / 16; i++) { + uae_u16 *mfm = drv->bigmfmbuf + i; + uae_u8 *data = (uae_u8 *) mfm; + *mfm = 256 * *data + *(data + 1); + } - if (!force && drv->buffered_cyl == drv->cyl && drv->buffered_side == side) - return; - drv->indexoffset = 0; - drv->multi_revolution = 0; - drv->tracktiming[0] = 0; - drv->skipoffset = -1; - drv->revolutions = 1; - retrytrack = drv->lastdataacesstrack == drv->cyl * 2 + side; - if (!dskdmaen && !retrytrack) - drv->track_access_done = false; - //write_log (_T("%d:%d %d\n"), drv->cyl, side, retrytrack); - - if (drv->writediskfile && drv->writetrackdata[tr].bitlen > 0) - { - int i; - trackid* wti = &drv->writetrackdata[tr]; - drv->tracklen = wti->bitlen; - drv->revolutions = wti->revolutions; - read_floppy_data(drv->writediskfile, drv->filetype, wti, 0, reinterpret_cast(drv->bigmfmbuf), (wti->bitlen + 7) / 8); - for (i = 0; i < (drv->tracklen + 15) / 16; i++) - { - uae_u16* mfm = drv->bigmfmbuf + i; - uae_u8* data = reinterpret_cast(mfm); - *mfm = 256 * *data + *(data + 1); - } - } - else if (drv->filetype == ADF_CATWEASEL) { -#ifdef CATWEASEL - drv->tracklen = 0; - if (!catweasel_disk_changed(drv->catweasel)) { - drv->tracklen = catweasel_fillmfm(drv->catweasel, drv->bigmfmbuf, side, drv->ddhd, 0); - } - drv->buffered_cyl = -1; - if (!drv->tracklen) { - track_reset(drv); - return; - } -#endif - } - else if (drv->filetype == ADF_IPF) { - -#ifdef CAPS - caps_loadtrack(drv->bigmfmbuf, drv->tracktiming, drv - floppy, tr, &drv->tracklen, &drv->multi_revolution, &drv->skipoffset, &drv->lastrev, retrytrack); -#endif - - } - else if (drv->filetype == ADF_SCP) { - -#ifdef SCP - scp_loadtrack(drv->bigmfmbuf, drv->tracktiming, drv - floppy, tr, &drv->tracklen, &drv->multi_revolution, &drv->skipoffset, &drv->lastrev, retrytrack); -#endif - - } - else if (drv->filetype == ADF_FDI) { + } else if (drv->filetype == ADF_FDI) { #ifdef FDI2RAW - fdi2raw_loadtrack(drv->fdi, drv->bigmfmbuf, drv->tracktiming, tr, &drv->tracklen, &drv->indexoffset, &drv->multi_revolution, 1); + fdi2raw_loadtrack (drv->fdi, drv->bigmfmbuf, drv->tracktiming, tr, &drv->tracklen, &drv->indexoffset, &drv->multi_revolution, 1); #endif - } - else if (ti->type == TRACK_PCDOS) - { - decode_pcdos(drv); - } - else if (ti->type == TRACK_AMIGADOS) - { - decode_amigados(drv); - } - else if (ti->type == TRACK_DISKSPARE) - { - decode_diskspare(drv); - } - else if (ti->type == TRACK_NONE) - { - ; - } - else - { - int i; - int base_offset = ti->type == TRACK_RAW ? 0 : 1; - drv->tracklen = ti->bitlen + 16 * base_offset; - drv->bigmfmbuf[0] = ti->sync; - read_floppy_data(drv->diskfile, drv->filetype, ti, 0, reinterpret_cast(drv->bigmfmbuf + base_offset), (ti->bitlen + 7) / 8); - for (i = base_offset; i < (drv->tracklen + 15) / 16; i++) - { - uae_u16* mfm = drv->bigmfmbuf + i; - uae_u8* data = reinterpret_cast(mfm); - *mfm = 256 * *data + *(data + 1); - } - } - drv->buffered_side = side; - drv->buffered_cyl = drv->cyl; - if (drv->tracklen == 0) - { - drv->tracklen = FLOPPY_WRITE_LEN * drv->ddhd * 2 * 8; - memset(drv->bigmfmbuf, 0, FLOPPY_WRITE_LEN * 2 * drv->ddhd); - } - drv->trackspeed = get_floppy_speed2(drv); - updatemfmpos(drv); + } else if (ti->type == TRACK_PCDOS) { + + decode_pcdos(drv); + + } else if (ti->type == TRACK_AMIGADOS) { + + decode_amigados(drv); + + } else if (ti->type == TRACK_DISKSPARE) { + + decode_diskspare (drv); + + } else if (ti->type == TRACK_NONE) { + + ; + + } else { + int i; + int base_offset = ti->type == TRACK_RAW ? 0 : 1; + drv->tracklen = ti->bitlen + 16 * base_offset; + drv->bigmfmbuf[0] = ti->sync; + read_floppy_data (drv->diskfile, drv->filetype, ti, 0, (uae_u8*)(drv->bigmfmbuf + base_offset), (ti->bitlen + 7) / 8); + for (i = base_offset; i < (drv->tracklen + 15) / 16; i++) { + uae_u16 *mfm = drv->bigmfmbuf + i; + uae_u8 *data = (uae_u8 *) mfm; + *mfm = 256 * *data + *(data + 1); + } + } + drv->buffered_side = side; + drv->buffered_cyl = drv->cyl; + if (drv->tracklen == 0) { + drv->tracklen = FLOPPY_WRITE_LEN * drv->ddhd * 2 * 8; + memset (drv->bigmfmbuf, 0, FLOPPY_WRITE_LEN * 2 * drv->ddhd); + } + + drv->trackspeed = get_floppy_speed2 (drv); + updatemfmpos (drv); } /* Update ADF_EXT2 track header */ -static void diskfile_update(struct zfile* diskfile, trackid* ti, int len, image_tracktype type) +static void diskfile_update (struct zfile *diskfile, trackid *ti, int len, image_tracktype type) { - uae_u8 buf[2 + 2 + 4 + 4], *zerobuf; + uae_u8 buf[2 + 2 + 4 + 4], *zerobuf; - ti->revolutions = 1; - ti->bitlen = len; - zfile_fseek(diskfile, 8 + 4 + (2 + 2 + 4 + 4) * ti->track, SEEK_SET); - memset(buf, 0, sizeof buf); - ti->type = type; - buf[2] = 0; - buf[3] = ti->type; - do_put_mem_long(reinterpret_cast(buf + 4), ti->len); - do_put_mem_long(reinterpret_cast(buf + 8), ti->bitlen); - zfile_fwrite(buf, sizeof buf, 1, diskfile); - if (ti->len > (len + 7) / 8) - { - zerobuf = xmalloc (uae_u8, ti->len); - memset(zerobuf, 0, ti->len); - zfile_fseek(diskfile, ti->offs, SEEK_SET); - zfile_fwrite(zerobuf, 1, ti->len, diskfile); - free(zerobuf); - } + ti->revolutions = 1; + ti->bitlen = len; + zfile_fseek (diskfile, 8 + 4 + (2 + 2 + 4 + 4) * ti->track, SEEK_SET); + memset (buf, 0, sizeof buf); + ti->type = type; + buf[2] = 0; + buf[3] = ti->type; + do_put_mem_long ((uae_u32 *) (buf + 4), ti->len); + do_put_mem_long ((uae_u32 *) (buf + 8), ti->bitlen); + zfile_fwrite (buf, sizeof buf, 1, diskfile); + if (ti->len > (len + 7) / 8) { + zerobuf = xmalloc (uae_u8, ti->len); + memset (zerobuf, 0, ti->len); + zfile_fseek (diskfile, ti->offs, SEEK_SET); + zfile_fwrite (zerobuf, 1, ti->len, diskfile); + free (zerobuf); + } } #define MFMMASK 0x55555555 - -static uae_u16 getmfmword(uae_u16* mbuf, int shift) +static uae_u16 getmfmword (uae_u16 *mbuf, int shift) { - return (mbuf[0] << shift) | (mbuf[1] >> (16 - shift)); + return (mbuf[0] << shift) | (mbuf[1] >> (16 - shift)); } -static uae_u32 getmfmlong(uae_u16* mbuf, int shift) +static uae_u32 getmfmlong (uae_u16 *mbuf, int shift) { - return ((getmfmword(mbuf, shift) << 16) | getmfmword(mbuf + 1, shift)) & MFMMASK; + return ((getmfmword (mbuf, shift) << 16) | getmfmword (mbuf + 1, shift)) & MFMMASK; } #if MFM_VALIDATOR @@ -2029,321 +1814,302 @@ static void check_valid_mfm (uae_u16 *mbuf, int words, int sector) int databit = w & (1 << (bitoffset + 0)); if ((clockbit && databit) || (clockbit && !databit && prevbit) || (!clockbit && !databit && !prevbit)) { - write_log (L"illegal mfm sector %d data %04x %04x, bit %d:%d\n", sector, wp, w, wordoffset, bitoffset); + write_log (_T("illegal mfm sector %d data %04x %04x, bit %d:%d\n"), sector, wp, w, wordoffset, bitoffset); } prevbit = databit; } } #endif -static int decode_buffer(uae_u16* mbuf, int cyl, int drvsec, int ddhd, int filetype, int* drvsecp, int* sectable, int checkmode) +static int decode_buffer (uae_u16 *mbuf, int cyl, int drvsec, int ddhd, int filetype, int *drvsecp, int *sectable, int checkmode) { - int i, secwritten = 0; - int fwlen = FLOPPY_WRITE_LEN * ddhd; - int length = 2 * fwlen; - uae_u32 odd, even, chksum, id, dlong; - uae_u8* secdata; - uae_u8 secbuf[544]; + int i, secwritten = 0; + int fwlen = FLOPPY_WRITE_LEN * ddhd; + int length = 2 * fwlen; + uae_u32 odd, even, chksum, id, dlong; + uae_u8 *secdata; + uae_u8 secbuf[544]; uae_u16 *mend = mbuf + length, *mstart; uae_u32 sechead[4]; - int shift = 0; + int shift = 0; bool issechead; - memset(sectable, 0, MAX_SECTORS * sizeof (int)); + memset (sectable, 0, MAX_SECTORS * sizeof (int)); mstart = mbuf; - memcpy(mbuf + fwlen, mbuf, fwlen * sizeof (uae_u16)); - mend -= (4 + 16 + 8 + 512); - while (secwritten < drvsec) - { - int trackoffs; + memcpy (mbuf + fwlen, mbuf, fwlen * sizeof (uae_u16)); + mend -= (4 + 16 + 8 + 512); + while (secwritten < drvsec) { + int trackoffs; - while (getmfmword(mbuf, shift) != 0x4489) - { - if (mbuf >= mend) - return 1; - shift++; - if (shift == 16) - { - shift = 0; - mbuf++; - } - } - while (getmfmword(mbuf, shift) == 0x4489) - { - if (mbuf >= mend) - return 1; - mbuf++; - } + while (getmfmword (mbuf, shift) != 0x4489) { + if (mbuf >= mend) + return 1; + shift++; + if (shift == 16) { + shift = 0; + mbuf++; + } + } + while (getmfmword (mbuf, shift) == 0x4489) { + if (mbuf >= mend) + return 1; + mbuf++; + } - odd = getmfmlong(mbuf, shift); - even = getmfmlong(mbuf + 2, shift); - mbuf += 4; - id = (odd << 1) | even; + odd = getmfmlong (mbuf, shift); + even = getmfmlong (mbuf + 2, shift); + mbuf += 4; + id = (odd << 1) | even; - trackoffs = (id & 0xff00) >> 8; - if (trackoffs + 1 > drvsec) - { - write_log (_T("Disk decode: weird sector number %d (%08X, %d)\n"), trackoffs, id, mbuf - mstart); - if (filetype == ADF_EXT2) - return 2; - continue; - } + trackoffs = (id & 0xff00) >> 8; + if (trackoffs + 1 > drvsec) { + write_log (_T("Disk decode: weird sector number %d (%08x, %ld)\n"), trackoffs, id, mbuf - mstart); + if (filetype == ADF_EXT2) + return 2; + continue; + } #if MFM_VALIDATOR check_valid_mfm (mbuf - 4, 544 - 4 + 1, trackoffs); #endif issechead = false; - chksum = odd ^ even; - for (i = 0; i < 4; i++) - { - odd = getmfmlong(mbuf, shift); - even = getmfmlong(mbuf + 8, shift); - mbuf += 2; + chksum = odd ^ even; + for (i = 0; i < 4; i++) { + odd = getmfmlong (mbuf, shift); + even = getmfmlong (mbuf + 8, shift); + mbuf += 2; - dlong = (odd << 1) | even; - if (dlong && !checkmode) - { + dlong = (odd << 1) | even; + if (dlong && !checkmode) { issechead = true; } sechead[i] = dlong; chksum ^= odd ^ even; } - if (issechead) - { - if (filetype == ADF_EXT2) - return 6; - } - mbuf += 8; - odd = getmfmlong(mbuf, shift); - even = getmfmlong(mbuf + 2, shift); - mbuf += 4; - if (((odd << 1) | even) != chksum) - { + if (issechead) { + if (filetype == ADF_EXT2) + return 6; + } + mbuf += 8; + odd = getmfmlong (mbuf, shift); + even = getmfmlong (mbuf + 2, shift); + mbuf += 4; + if (((odd << 1) | even) != chksum) { write_log (_T("Disk decode: checksum error on sector %d header\n"), trackoffs); - if (filetype == ADF_EXT2) - return 3; - continue; - } - if (((id & 0x00ff0000) >> 16) != cyl * 2 + side) - { + if (filetype == ADF_EXT2) + return 3; + continue; + } + if (((id & 0x00ff0000) >> 16) != cyl * 2 + side) { write_log (_T("Disk decode: mismatched track (%d <> %d) on sector %d header (%08X)\n"), (id & 0x00ff0000) >> 16, cyl * 2 + side, trackoffs, id); - if (filetype == ADF_EXT2) - return 3; - continue; - } - odd = getmfmlong(mbuf, shift); - even = getmfmlong(mbuf + 2, shift); - mbuf += 4; - chksum = (odd << 1) | even; - secdata = secbuf + 32; - for (i = 0; i < 128; i++) - { - odd = getmfmlong(mbuf, shift); - even = getmfmlong(mbuf + 256, shift); - mbuf += 2; - dlong = (odd << 1) | even; - *secdata++ = dlong >> 24; - *secdata++ = dlong >> 16; - *secdata++ = dlong >> 8; - *secdata++ = dlong; - chksum ^= odd ^ even; - } - if (chksum) - { + if (filetype == ADF_EXT2) + return 3; + continue; + } + odd = getmfmlong (mbuf, shift); + even = getmfmlong (mbuf + 2, shift); + mbuf += 4; + chksum = (odd << 1) | even; + secdata = secbuf + 32; + for (i = 0; i < 128; i++) { + odd = getmfmlong (mbuf, shift); + even = getmfmlong (mbuf + 256, shift); + mbuf += 2; + dlong = (odd << 1) | even; + *secdata++ = dlong >> 24; + *secdata++ = dlong >> 16; + *secdata++ = dlong >> 8; + *secdata++ = dlong; + chksum ^= odd ^ even; + } + if (chksum) { write_log (_T("Disk decode: sector %d, data checksum error\n"), trackoffs); - if (filetype == ADF_EXT2) - return 4; - continue; - } - mbuf += 256; - sectable[trackoffs] = 1; - secwritten++; - memcpy(writebuffer + trackoffs * 512, secbuf + 32, 512); - } - if (filetype == ADF_EXT2 && (secwritten == 0 || secwritten < 0)) - return 5; - *drvsecp = drvsec; - return 0; + if (filetype == ADF_EXT2) + return 4; + continue; + } + mbuf += 256; + sectable[trackoffs] = 1; + secwritten++; + memcpy (writebuffer + trackoffs * 512, secbuf + 32, 512); + } + if (filetype == ADF_EXT2 && (secwritten == 0 || secwritten < 0)) + return 5; + if (secwritten == 0) + write_log (_T("Disk decode: unsupported format\n")); + if (secwritten < 0) + write_log (_T("Disk decode: sector labels ignored\n")); + *drvsecp = drvsec; + return 0; } -static uae_u8 mfmdecode(uae_u16** mfmp, int shift) +static uae_u8 mfmdecode(uae_u16 **mfmp, int shift) { - uae_u16 mfm = getmfmword(*mfmp, shift); - uae_u8 out = 0; - int i; + uae_u16 mfm = getmfmword (*mfmp, shift); + uae_u8 out = 0; + int i; - (*mfmp)++; - mfm &= 0x5555; - for (i = 0; i < 8; i++) - { - out >>= 1; - if (mfm & 1) - out |= 0x80; - mfm >>= 2; - } - return out; + (*mfmp)++; + mfm &= 0x5555; + for (i = 0; i < 8; i++) { + out >>= 1; + if (mfm & 1) + out |= 0x80; + mfm >>= 2; + } + return out; } -static int drive_write_pcdos(drive* drv) +static int drive_write_pcdos (drive *drv, struct zfile *zf, bool count) { - int i; - int drvsec = drv->num_secs; - int fwlen = FLOPPY_WRITE_LEN * drv->ddhd; - int length = 2 * fwlen; - uae_u16* mbuf = drv->bigmfmbuf; - uae_u16* mend = mbuf + length; - int secwritten = 0, shift = 0, sector = -1; - int sectable[18]; - uae_u8 secbuf[3 + 1 + 512]; - uae_u8 mark; - uae_u16 crc; + int i; + int drvsec = drv->num_secs; + int fwlen = FLOPPY_WRITE_LEN * drv->ddhd; + int length = 2 * fwlen; + uae_u16 *mbuf = drv->bigmfmbuf; + uae_u16 *mend = mbuf + length; + int secwritten = 0, seccnt = 0; + int shift = 0, sector = -1; + int sectable[24]; + uae_u8 secbuf[3 + 1 + 512]; + uae_u8 mark; + uae_u16 crc; - memset(sectable, 0, sizeof sectable); - memcpy(mbuf + fwlen, mbuf, fwlen * sizeof (uae_u16)); - mend -= 518; - secbuf[0] = secbuf[1] = secbuf[2] = 0xa1; - secbuf[3] = 0xfb; + memset (sectable, 0, sizeof sectable); + memcpy (mbuf + fwlen, mbuf, fwlen * sizeof (uae_u16)); + mend -= 518; + secbuf[0] = secbuf[1] = secbuf[2] = 0xa1; + secbuf[3] = 0xfb; - while (secwritten < drvsec) - { + while (seccnt < drvsec) { int mfmcount; mfmcount = 0; - while (getmfmword(mbuf, shift) != 0x4489) - { + while (getmfmword (mbuf, shift) != 0x4489) { mfmcount++; - if (mbuf >= mend) - return 1; - shift++; - if (shift == 16) - { - shift = 0; - mbuf++; - } + if (mbuf >= mend) + return -1; + shift++; + if (shift == 16) { + shift = 0; + mbuf++; + } if (sector >= 0 && mfmcount / 16 >= 43) sector = -1; - } + } mfmcount = 0; - while (getmfmword(mbuf, shift) == 0x4489) - { + while (getmfmword (mbuf, shift) == 0x4489) { mfmcount++; - if (mbuf >= mend) - return 1; - mbuf++; - } + if (mbuf >= mend) + return -1; + mbuf++; + } if (mfmcount < 3) // ignore if less than 3 sync markers continue; - mark = mfmdecode(&mbuf, shift); - if (mark == 0xfe) - { - uae_u8 tmp[8]; - uae_u8 cyl, head, size; + mark = mfmdecode(&mbuf, shift); + if (mark == 0xfe) { + uae_u8 tmp[8]; + uae_u8 cyl, head, size; - cyl = mfmdecode(&mbuf, shift); - head = mfmdecode(&mbuf, shift); - sector = mfmdecode(&mbuf, shift); - size = mfmdecode(&mbuf, shift); - crc = (mfmdecode(&mbuf, shift) << 8) | mfmdecode(&mbuf, shift); + cyl = mfmdecode(&mbuf, shift); + head = mfmdecode(&mbuf, shift); + sector = mfmdecode(&mbuf, shift); + size = mfmdecode(&mbuf, shift); + crc = (mfmdecode(&mbuf, shift) << 8) | mfmdecode(&mbuf, shift); - tmp[0] = 0xa1; - tmp[1] = 0xa1; - tmp[2] = 0xa1; - tmp[3] = mark; - tmp[4] = cyl; - tmp[5] = head; - tmp[6] = sector; - tmp[7] = size; + tmp[0] = 0xa1; tmp[1] = 0xa1; tmp[2] = 0xa1; tmp[3] = mark; + tmp[4] = cyl; tmp[5] = head; tmp[6] = sector; tmp[7] = size; // skip 28 bytes for (i = 0; i < 28; i++) - mfmdecode(&mbuf, shift); + mfmdecode (&mbuf, shift); - if (get_crc16(tmp, 8) != crc || cyl != drv->cyl || head != side || size != 2 || sector < 1 || sector > drv->num_secs) - { + if (get_crc16 (tmp, 8) != crc || cyl != drv->cyl || head != side || size != 2 || sector < 1 || sector > drv->num_secs || sector >= sizeof sectable) { write_log (_T("PCDOS: track %d, corrupted sector header\n"), drv->cyl * 2 + side); - return 1; - } - sector--; - continue; - } - if (mark != 0xfb && mark != 0xfa) - { + return -1; + } + sector--; + continue; + } + if (mark != 0xfb && mark != 0xfa) { write_log (_T("PCDOS: track %d: unknown address mark %02X\n"), drv->cyl * 2 + side, mark); - continue; - } - if (sector < 0) - continue; - for (i = 0; i < 512; i++) - secbuf[i + 4] = mfmdecode(&mbuf, shift); - crc = (mfmdecode(&mbuf, shift) << 8) | mfmdecode(&mbuf, shift); - if (get_crc16(secbuf, 3 + 1 + 512) != crc) - { + continue; + } + if (sector < 0) + continue; + for (i = 0; i < 512; i++) + secbuf[i + 4] = mfmdecode(&mbuf, shift); + crc = (mfmdecode(&mbuf, shift) << 8) | mfmdecode(&mbuf, shift); + if (get_crc16(secbuf, 3 + 1 + 512) != crc) { write_log (_T("PCDOS: track %d, sector %d data checksum error\n"), drv->cyl * 2 + side, sector + 1); - continue; + continue; + } + seccnt++; + if (count && sectable[sector]) + break; + if (!sectable[sector]) { + secwritten++; + sectable[sector] = 1; + zfile_fseek (zf, drv->trackdata[drv->cyl * 2 + side].offs + sector * 512, SEEK_SET); + zfile_fwrite (secbuf + 4, sizeof (uae_u8), 512, zf); } - sectable[sector] = 1; - secwritten++; - zfile_fseek(drv->diskfile, drv->trackdata[drv->cyl * 2 + side].offs + sector * 512, SEEK_SET); - zfile_fwrite(secbuf + 4, sizeof (uae_u8), 512, drv->diskfile); - write_log (_T("PCDOS: track %d sector %d written\n"), drv->cyl * 2 + side, sector + 1); - sector = -1; - } - if (secwritten != drv->num_secs) - write_log (_T("PCDOS: track %d, %d corrupted sectors ignored\n"), + sector = -1; + } + if (!count && secwritten != drv->num_secs) + write_log (_T("PCDOS: track %d, %d corrupted sectors ignored\n"), drv->cyl * 2 + side, drv->num_secs - secwritten); - return 0; + return secwritten; } -static int drive_write_adf_amigados(drive* drv) +static int drive_write_adf_amigados (drive * drv) { - int drvsec, i; - int sectable[MAX_SECTORS]; + int drvsec, i; + int sectable[MAX_SECTORS]; - if (decode_buffer(drv->bigmfmbuf, drv->cyl, drv->num_secs, drv->ddhd, drv->filetype, &drvsec, sectable, 0)) - return 2; - if (!drvsec) - return 2; + if (decode_buffer (drv->bigmfmbuf, drv->cyl, drv->num_secs, drv->ddhd, drv->filetype, &drvsec, sectable, 0)) + return 2; + if (!drvsec) + return 2; - if (drv->filetype == ADF_EXT2) - diskfile_update(drv->diskfile, &drv->trackdata[drv->cyl * 2 + side], drvsec * 512 * 8, TRACK_AMIGADOS); - for (i = 0; i < drvsec; i++) - { - zfile_fseek(drv->diskfile, drv->trackdata[drv->cyl * 2 + side].offs + i * 512, SEEK_SET); - zfile_fwrite(writebuffer + i * 512, sizeof (uae_u8), 512, drv->diskfile); - } + if (drv->filetype == ADF_EXT2) + diskfile_update (drv->diskfile, &drv->trackdata[drv->cyl * 2 + side], drvsec * 512 * 8, TRACK_AMIGADOS); + for (i = 0; i < drvsec; i++) { + zfile_fseek (drv->diskfile, drv->trackdata[drv->cyl * 2 + side].offs + i * 512, SEEK_SET); + zfile_fwrite (writebuffer + i * 512, sizeof (uae_u8), 512, drv->diskfile); + } - return 0; + return 0; } /* write raw track to disk file */ -static int drive_write_ext2(uae_u16* bigmfmbuf, struct zfile* diskfile, trackid* ti, int tracklen) +static int drive_write_ext2 (uae_u16 *bigmfmbuf, struct zfile *diskfile, trackid *ti, int tracklen) { - int len, i; + int len, i, offset; - len = (tracklen + 7) / 8; - if (len > ti->len) - { + offset = 0; + len = (tracklen + 7) / 8; + if (len > ti->len) { write_log (_T("disk raw write: image file's track %d is too small (%d < %d)!\n"), ti->track, ti->len, len); - len = ti->len; - } - diskfile_update(diskfile, ti, tracklen, TRACK_RAW); - for (i = 0; i < ti->len / 2; i++) - { - uae_u16* mfm = bigmfmbuf + i; - uae_u16* mfmw = bigmfmbufw + i; - uae_u8* data = reinterpret_cast(mfm); - *mfmw = 256 * *data + *(data + 1); - } - zfile_fseek(diskfile, ti->offs, SEEK_SET); - zfile_fwrite(bigmfmbufw, 1, len, diskfile); - return 1; + offset = (len - ti->len) / 2; + len = ti->len; + } + diskfile_update (diskfile, ti, tracklen, TRACK_RAW); + for (i = 0; i < ti->len / 2; i++) { + uae_u16 *mfm = bigmfmbuf + i + offset; + uae_u16 *mfmw = bigmfmbufw + i + offset; + uae_u8 *data = (uae_u8 *) mfm; + *mfmw = 256 * *data + *(data + 1); + } + zfile_fseek (diskfile, ti->offs, SEEK_SET); + zfile_fwrite (bigmfmbufw, 1, len, diskfile); + return 1; } -static void drive_write_data(drive * drv); +static void drive_write_data (drive * drv); -static bool convert_adf_to_ext2(drive *drv, int mode) +static bool convert_adf_to_ext2 (drive *drv, int mode) { TCHAR name[MAX_DPATH]; bool hd = drv->ddhd == 2; @@ -2351,570 +2117,480 @@ static bool convert_adf_to_ext2(drive *drv, int mode) if (drv->filetype != ADF_NORMAL) return false; - _tcscpy(name, currprefs.floppyslots[drv - floppy].df); + _tcscpy (name, currprefs.floppyslots[drv - floppy].df); if (!name[0]) return false; if (mode == 1) { - TCHAR *p = _tcsrchr(name, '.'); + TCHAR *p = _tcsrchr (name, '.'); if (!p) - p = name + _tcslen(name); - _tcscpy(p, _T(".extended.adf")); - if (!disk_creatediskfile(name, 1, hd ? DRV_35_HD : DRV_35_DD, nullptr, false, false, drv->diskfile)) + p = name + _tcslen (name); + _tcscpy (p, _T(".extended.adf")); + if (!disk_creatediskfile (&currprefs, name, 1, hd ? DRV_35_HD : DRV_35_DD, -1, NULL, false, false, drv->diskfile)) return false; - } - else if (mode == 2) { - struct zfile *tmp = zfile_fopen_load_zfile(drv->diskfile); + } else if (mode == 2) { + struct zfile *tmp = zfile_fopen_load_zfile (drv->diskfile); if (!tmp) return false; - zfile_fclose(drv->diskfile); - drv->diskfile = nullptr; - if (!disk_creatediskfile(name, 1, hd ? DRV_35_HD : DRV_35_DD, nullptr, false, false, tmp)) { - zfile_fclose(tmp); + zfile_fclose (drv->diskfile); + drv->diskfile = NULL; + if (!disk_creatediskfile (&currprefs, name, 1, hd ? DRV_35_HD : DRV_35_DD, -1, NULL, false, false, tmp)) { + zfile_fclose (tmp); return false; } - } - else { + } else { return false; } - f = zfile_fopen(name, _T("r+b")); + f = zfile_fopen (name, _T("r+b")); if (!f) return false; - _tcscpy(currprefs.floppyslots[drv - floppy].df, name); - _tcscpy(changed_prefs.floppyslots[drv - floppy].df, name); - zfile_fclose(drv->diskfile); + _tcscpy (currprefs.floppyslots[drv - floppy].df, name); + _tcscpy (changed_prefs.floppyslots[drv - floppy].df, name); + zfile_fclose (drv->diskfile); drv->diskfile = f; drv->filetype = ADF_EXT2; - read_header_ext2(drv->diskfile, drv->trackdata, &drv->num_tracks, &drv->ddhd); + read_header_ext2 (drv->diskfile, drv->trackdata, &drv->num_tracks, &drv->ddhd); - drive_write_data(drv); -#ifdef RETROPLATFORM - rp_disk_image_change(drv - &floppy[0], name, false); -#endif - drive_fill_bigbuf(drv, 1); + drive_write_data (drv); + drive_fill_bigbuf (drv, 1); return true; } -static void drive_write_data(drive* drv) +static void drive_write_data (drive * drv) { - int ret = -1; + int ret = -1; int tr = drv->cyl * 2 + side; - if (drive_writeprotected(drv) || drv->trackdata[tr].type == TRACK_NONE) - { - /* read original track back because we didn't really write anything */ - drv->buffered_side = 2; - return; - } - if (drv->writediskfile) - { - drive_write_ext2(drv->bigmfmbuf, drv->writediskfile, &drv->writetrackdata[tr], - longwritemode ? dsklength2 * 8 : drv->tracklen); - } - switch (drv->filetype) - { - case ADF_NORMAL: - if (drive_write_adf_amigados(drv)) - { - static int warned; - if (!warned) - notify_user(NUMSG_NEEDEXT2); - warned = 1; + if (drive_writeprotected (drv) || drv->trackdata[tr].type == TRACK_NONE) { + /* read original track back because we didn't really write anything */ + drv->buffered_side = 2; + return; + } + if (drv->writediskfile) { + drive_write_ext2 (drv->bigmfmbuf, drv->writediskfile, &drv->writetrackdata[tr], + longwritemode ? dsklength2 * 8 : drv->tracklen); + } + switch (drv->filetype) { + case ADF_NORMAL: + if (drv->ddhd > 1 && currprefs.floppyslots[drv - &floppy[0]].dfxtype != DRV_35_HD) { + // HD image in DD drive: ignore writing. + drv->buffered_side = 2; + } else { + if (drive_write_adf_amigados (drv)) { + if (currprefs.floppy_auto_ext2) { + convert_adf_to_ext2 (drv, currprefs.floppy_auto_ext2); + } else { + static int warned; + if (!warned) + notify_user (NUMSG_NEEDEXT2); + warned = 1; + } + } } - return; - case ADF_EXT1: - break; - case ADF_EXT2: - if (!longwritemode) - ret = drive_write_adf_amigados(drv); - if (ret) - { - write_log (_T("not an amigados track %d (error %d), writing as raw track\n"), drv->cyl * 2 + side, ret); - drive_write_ext2(drv->bigmfmbuf, drv->diskfile, &drv->trackdata[drv->cyl * 2 + side], - longwritemode ? dsklength2 * 8 : drv->tracklen); - } - return; - case ADF_IPF: - break; - case ADF_PCDOS: - ret = drive_write_pcdos(drv); - if (ret) - write_log (_T("not a PC formatted track %d (error %d)\n"), drv->cyl * 2 + side, ret); - break; - } - drv->tracktiming[0] = 0; + return; + case ADF_EXT1: + break; + case ADF_EXT2: + if (!longwritemode) + ret = drive_write_adf_amigados (drv); + if (ret) { + write_log (_T("not an amigados track %d (error %d), writing as raw track\n"), drv->cyl * 2 + side, ret); + drive_write_ext2 (drv->bigmfmbuf, drv->diskfile, &drv->trackdata[drv->cyl * 2 + side], + longwritemode ? dsklength2 * 8 : drv->tracklen); + } + return; + case ADF_PCDOS: + ret = drive_write_pcdos (drv, drv->diskfile, 0); + if (ret < 0) + write_log (_T("not a PC formatted track %d (error %d)\n"), drv->cyl * 2 + side, ret); + break; + } + drv->tracktiming[0] = 0; } -static void drive_eject(drive* drv) +static void drive_eject (drive * drv) { -#ifdef DRIVESOUND - if (isfloppysound(drv)) - driveclick_insert(drv - floppy, 1); -#endif - gui_disk_image_change(drv - floppy, nullptr, drv->wrprot); - drive_image_free(drv); - drv->dskchange = true; - drv->ddhd = 1; - drv->dskchange_time = 0; - drv->dskready = false; - drv->dskready_up_time = 0; - drv->dskready_down_time = 0; - drv->crc32 = 0; - drive_settype_id(drv); /* Back to 35 DD */ - //TODO: enable when inputrecording is implemented - //inprec_recorddiskchange(drv - floppy, NULL, false); + drive_image_free (drv); + drv->dskeject = false; + drv->dskchange = true; + drv->ddhd = 1; + drv->dskchange_time = 0; + drv->dskready = 0; + drv->dskready_up_time = 0; + drv->dskready_down_time = 0; + drv->crc32 = 0; + drive_settype_id (drv); /* Back to 35 DD */ } -/* We use this function if we have no Kickstart ROM. - * No error checking - we trust our luck. */ -void DISK_ersatz_read(int tr, int sec, uaecptr dest) +static void floppy_get_bootblock (uae_u8 *dst, bool ffs, bool bootable) { - uae_u8* dptr = get_real_address(dest); - zfile_fseek(floppy[0].diskfile, floppy[0].trackdata[tr].offs + sec * 512, SEEK_SET); - zfile_fread(dptr, 1, 512, floppy[0].diskfile); -} - -static void floppy_get_bootblock(uae_u8* dst, bool ffs, bool bootable) -{ - strcpy(reinterpret_cast(dst), "DOS"); + strcpy ((char*)dst, "DOS"); dst[3] = ffs ? 1 : 0; if (bootable) - memcpy(dst, ffs ? bootblock_ffs : bootblock_ofs, ffs ? sizeof bootblock_ffs : sizeof bootblock_ofs); + memcpy (dst, ffs ? bootblock_ffs : bootblock_ofs, ffs ? sizeof bootblock_ffs : sizeof bootblock_ofs); } - -static void floppy_get_rootblock(uae_u8* dst, int block, const TCHAR* disk_name, drive_type adftype) +static void floppy_get_rootblock (uae_u8 *dst, int block, const TCHAR *disk_name, bool hd) { - dst[0 + 3] = 2; - dst[12 + 3] = 0x48; - dst[312] = dst[313] = dst[314] = dst[315] = uae_u8(0xff); - dst[316 + 2] = (block + 1) >> 8; - dst[316 + 3] = (block + 1) & 255; - char* s = ua((disk_name && _tcslen (disk_name) > 0) ? disk_name : _T("empty")); - dst[432] = strlen(s); - strcpy(reinterpret_cast(dst) + 433, s); + dst[0+3] = 2; // primary type + dst[12+3] = 0x48; // size of hash table + dst[312] = dst[313] = dst[314] = dst[315] = (uae_u8)0xff; // bitmap valid + dst[316+2] = (block + 1) >> 8; dst[316+3] = (block + 1) & 255; // bitmap pointer + char *s = ua ((disk_name && _tcslen (disk_name) > 0) ? disk_name : _T("empty")); + dst[432] = strlen (s); // name length + strcpy ((char*)dst + 433, s); // name xfree (s); - dst[508 + 3] = 1; - disk_date(dst + 420); - memcpy(dst + 472, dst + 420, 3 * 4); - memcpy(dst + 484, dst + 420, 3 * 4); - disk_checksum(dst, dst + 20); + dst[508 + 3] = 1; // secondary type + disk_date (dst + 420); // root modification date + disk_date(dst + 484); // creation date + disk_checksum (dst, dst + 20); /* bitmap block */ - memset(dst + 512 + 4, 0xff, 2 * block / 8); - if (adftype == 0) + memset (dst + 512 + 4, 0xff, 2 * block / 8); + if (!hd) dst[512 + 0x72] = 0x3f; else dst[512 + 0xdc] = 0x3f; - disk_checksum(dst + 512, dst + 512); + disk_checksum (dst + 512, dst + 512); } /* type: 0=regular, 1=ext2adf */ -/* adftype: 0=DD,1=HD,2=DD PC,3=HD PC,4=525SD */ -bool disk_creatediskfile(const TCHAR* name, int type, drive_type adftype, const TCHAR* disk_name, bool ffs, bool bootable, struct zfile* copyfrom) +bool disk_creatediskfile (struct uae_prefs *p, const TCHAR *name, int type, drive_type adftype, int hd, const TCHAR *disk_name, bool ffs, bool bootable, struct zfile *copyfrom) { int size = 32768; - struct zfile* f; - int i, l, file_size, tracks, track_len, sectors; - uae_u8* chunk = nullptr; + struct zfile *f; + int i, l, file_size, tracks, track_len, sectors; + uae_u8 *chunk = NULL; int ddhd = 1; bool ok = false; uae_u64 pos; - if (type == 1) - tracks = 2 * 83; - else - tracks = 2 * 80; - file_size = 880 * 1024; - sectors = 11; - if (adftype == 2 || adftype == 3) - { - file_size = 720 * 1024; - sectors = 9; - } - track_len = FLOPPY_WRITE_LEN * 2; - if (adftype == 1 || adftype == 3) - { - file_size *= 2; - track_len *= 2; + if (type == 1) + tracks = 2 * 83; + else + tracks = 2 * 80; + file_size = 880 * 1024; + sectors = 11; + if (adftype == DRV_PC_ONLY_40 || adftype == DRV_PC_ONLY_80) { + file_size = 720 * 1024; + sectors = 9; + } + // largest needed + track_len = FLOPPY_WRITE_LEN_NTSC; + if (p->floppy_write_length > track_len && p->floppy_write_length < 2 * FLOPPY_WRITE_LEN_NTSC) + track_len = p->floppy_write_length; + if (adftype == DRV_35_HD || hd > 0) { + file_size *= 2; + track_len *= 2; ddhd = 2; - } - else if (adftype == 4) - { - file_size /= 2; - tracks /= 2; + } else if (adftype == DRV_PC_ONLY_40) { + file_size /= 2; + tracks /= 2; + } + + if (copyfrom) { + pos = zfile_ftell (copyfrom); + zfile_fseek (copyfrom, 0, SEEK_SET); } - if (copyfrom) - { - pos = zfile_ftell(copyfrom); - zfile_fseek(copyfrom, 0, SEEK_SET); - } - - f = zfile_fopen(name, _T("wb"), 0); - chunk = xmalloc (uae_u8, size); - if (f && chunk) - { - int cylsize = sectors * 2 * 512; - memset(chunk, 0, size); - if (type == 0) - { - for (i = 0; i < file_size; i += cylsize) - { - memset(chunk, 0, cylsize); - if (adftype <= 1) - { - if (i == 0) - { - /* boot block */ - floppy_get_bootblock(chunk, ffs, bootable); - } - else if (i == file_size / 2) - { - /* root block */ - floppy_get_rootblock(chunk, file_size / 1024, disk_name, adftype); - } - } - zfile_fwrite(chunk, cylsize, 1, f); - } + f = zfile_fopen (name, _T("wb"), 0); + chunk = xmalloc (uae_u8, size); + if (f && chunk) { + int cylsize = sectors * 2 * 512; + memset(chunk, 0 ,size); + if (type == 0) { + for (i = 0; i < file_size; i += cylsize) { + memset(chunk, 0, cylsize); + if (adftype == DRV_35_DD || adftype == DRV_35_HD) { + if (i == 0) { + /* boot block */ + floppy_get_bootblock (chunk, ffs, bootable); + } else if (i == file_size / 2) { + /* root block */ + floppy_get_rootblock (chunk, file_size / 1024, disk_name, ddhd > 1); + } + } + zfile_fwrite (chunk, cylsize, 1, f); + } ok = true; - } - else - { + } else { uae_u8 root[4]; uae_u8 rawtrack[3 * 4], dostrack[3 * 4]; - l = track_len; - zfile_fwrite("UAE-1ADF", 8, 1, f); - root[0] = 0; - root[1] = 0; /* flags (reserved) */ - root[2] = 0; - root[3] = tracks; /* number of tracks */ - zfile_fwrite(root, 4, 1, f); - rawtrack[0] = 0; - rawtrack[1] = 0; /* flags (reserved) */ - rawtrack[2] = 0; - rawtrack[3] = 1; /* track type */ - rawtrack[4] = 0; - rawtrack[5] = 0; - rawtrack[6] = uae_u8(l >> 8); - rawtrack[7] = uae_u8(l); - rawtrack[8] = 0; - rawtrack[9] = 0; - rawtrack[10] = 0; - rawtrack[11] = 0; - memcpy(dostrack, rawtrack, sizeof rawtrack); + l = track_len; + zfile_fwrite ("UAE-1ADF", 8, 1, f); + root[0] = 0; root[1] = 0; /* flags (reserved) */ + root[2] = 0; root[3] = tracks; /* number of tracks */ + zfile_fwrite (root, 4, 1, f); + rawtrack[0] = 0; rawtrack[1] = 0; /* flags (reserved) */ + rawtrack[2] = 0; rawtrack[3] = 1; /* track type */ + rawtrack[4] = 0; rawtrack[5] = 0; rawtrack[6]=(uae_u8)(l >> 8); rawtrack[7] = (uae_u8)l; + rawtrack[8] = 0; rawtrack[9] = 0; rawtrack[10] = 0; rawtrack[11] = 0; + memcpy (dostrack, rawtrack, sizeof rawtrack); dostrack[3] = 0; - dostrack[9] = (l * 8) >> 16; - dostrack[10] = (l * 8) >> 8; - dostrack[11] = (l * 8) >> 0; + dostrack[9] = (l * 8) >> 16; dostrack[10] = (l * 8) >> 8; dostrack[11] = (l * 8) >> 0; bool dodos = ffs || bootable || (disk_name && _tcslen (disk_name) > 0); - for (i = 0; i < tracks; i++) - { + for (i = 0; i < tracks; i++) { uae_u8 tmp[3 * 4]; - memcpy(tmp, rawtrack, sizeof rawtrack); + memcpy (tmp, rawtrack, sizeof rawtrack); if (dodos || copyfrom) - memcpy(tmp, dostrack, sizeof dostrack); - zfile_fwrite(tmp, sizeof tmp, 1, f); + memcpy (tmp, dostrack, sizeof dostrack); + zfile_fwrite (tmp, sizeof tmp, 1, f); } - for (i = 0; i < tracks; i++) - { - memset(chunk, 0, size); - if (copyfrom) - { - zfile_fread(chunk, 11 * ddhd, 512, copyfrom); + for (i = 0; i < tracks; i++) { + memset (chunk, 0, size); + if (copyfrom) { + zfile_fread (chunk, 11 * ddhd, 512, copyfrom); + } else { + if (dodos) { + if (i == 0) + floppy_get_bootblock (chunk, ffs, bootable); + else if (i == 80) + floppy_get_rootblock (chunk, 80 * 11 * ddhd, disk_name, adftype == DRV_35_HD); + } } - else - { - if (dodos) - { - if (i == 0) - floppy_get_bootblock(chunk, ffs, bootable); - else if (i == 80) - floppy_get_rootblock(chunk, 80 * 11 * ddhd, disk_name, adftype); - } - } - zfile_fwrite(chunk, l, 1, f); + zfile_fwrite (chunk, l, 1, f); } ok = true; - } - } - xfree (chunk); - zfile_fclose(f); + } + } + xfree (chunk); + zfile_fclose (f); if (copyfrom) - zfile_fseek(copyfrom, pos, SEEK_SET); + zfile_fseek (copyfrom, pos, SEEK_SET); return ok; } -int disk_getwriteprotect(struct uae_prefs* p, const TCHAR* name) +int disk_getwriteprotect (struct uae_prefs *p, const TCHAR *name) { - int needwritefile; - drive_type drvtype; - return diskfile_iswriteprotect(p, name, &needwritefile, &drvtype); + int needwritefile; + drive_type drvtype; + return diskfile_iswriteprotect (p, name, &needwritefile, &drvtype); } -static void diskfile_readonly(const TCHAR* name, bool readonly) +static void diskfile_readonly (const TCHAR *name, bool readonly) { struct mystat st; - int mode, oldmode; - - if (!my_stat(name, &st)) - { + int mode, oldmode; + + if (!my_stat (name, &st)) { write_log (_T("failed to access '%s'\n"), name); - return; + return; } + write_log(_T("'%s': old mode = %x\n"), name, st.mode); oldmode = mode = st.mode; - mode &= ~FILEFLAG_WRITE; - if (!readonly) - mode |= FILEFLAG_WRITE; - if (mode != oldmode) - { - if (!my_chmod(name, mode)) - write_log(_T("chmod failed!\n")); - } + mode &= ~FILEFLAG_WRITE; + if (!readonly) + mode |= FILEFLAG_WRITE; + if (mode != oldmode) { + if (!my_chmod (name, mode)) + write_log(_T("chmod failed!\n")); + } + write_log(_T("'%s': new mode = %x\n"), name, mode); } -static void setdskchangetime(drive* drv, int dsktime) +static void setdskchangetime(drive *drv, int dsktime) { - int i; - /* prevent multiple disk insertions at the same time */ - if (drv->dskchange_time > 0) - return; - for (i = 0; i < MAX_FLOPPY_DRIVES; i++) - { - if (&floppy[i] != drv && floppy[i].dskchange_time > 0 && floppy[i].dskchange_time + 1 >= dsktime) - { - dsktime = floppy[i].dskchange_time + 1; - } - } - drv->dskchange_time = dsktime; + int i; + /* prevent multiple disk insertions at the same time */ + if (drv->dskchange_time > 0) + return; + for (i = 0; i < MAX_FLOPPY_DRIVES; i++) { + if (&floppy[i] != drv && floppy[i].dskchange_time > 0 && floppy[i].dskchange_time + 1 >= dsktime) { + dsktime = floppy[i].dskchange_time + 1; + } + } + drv->dskchange_time = dsktime; } -void DISK_reinsert(int num) +void DISK_reinsert (int num) { - drive_eject(&floppy[num]); - setdskchangetime(&floppy[num], 2 * 50 * 312); + drive_eject (&floppy[num]); + setdskchangetime (&floppy[num], 2 * 50 * 312); } -int disk_setwriteprotect(struct uae_prefs* p, int num, const TCHAR* name, bool writeprotected) +int disk_setwriteprotect (struct uae_prefs *p, int num, const TCHAR *name, bool writeprotected) { - int needwritefile, oldprotect; - struct zfile *zf1, *zf2; - bool wrprot1, wrprot2; - int i; - TCHAR* name2; - drive_type drvtype; + int needwritefile, oldprotect; + struct zfile *zf1, *zf2; + bool wrprot1, wrprot2; + int i; + TCHAR *name2; + drive_type drvtype; write_log(_T("disk_setwriteprotect %d '%s' %d\n"), num, name, writeprotected); - oldprotect = diskfile_iswriteprotect(p, name, &needwritefile, &drvtype); - DISK_validate_filename(p, name, 1, &wrprot1, NULL, &zf1); - if (!zf1) + oldprotect = diskfile_iswriteprotect (p, name, &needwritefile, &drvtype); + DISK_validate_filename (p, name, 1, &wrprot1, NULL, &zf1); + if (!zf1) + return 0; + + write_log(_T("old = %d writeprot = %d master = %d\n"), oldprotect, wrprot1, p->floppy_read_only); + + if (wrprot1 && p->floppy_read_only) return 0; + if (zfile_iscompressed (zf1)) + wrprot1 = 1; + zfile_fclose (zf1); + zf2 = getexistingwritefile(p, name, &wrprot2); + name2 = DISK_get_saveimagepath(name, -2); - write_log(_T("old = %d writeprot = %d\n"), oldprotect, wrprot1); + if (needwritefile && zf2 == 0) + disk_creatediskfile (p, name2, 1, drvtype, -1, NULL, false, false, NULL); + zfile_fclose (zf2); + if (writeprotected && iswritefileempty (p, name)) { + for (i = 0; i < MAX_FLOPPY_DRIVES; i++) { + if (!_tcscmp (name, floppy[i].newname)) + drive_eject (&floppy[i]); + } + _wunlink (name2); + } - //TODO: Enable when floppy_read_only is implemented in options - //if (wrprot1 && p->floppy_read_only) - // return 0; - if (zfile_iscompressed(zf1)) - wrprot1 = true; - zfile_fclose(zf1); - zf2 = getwritefile(p, name, &wrprot2); - name2 = DISK_get_saveimagepath(name); - - if (needwritefile && zf2 == 0) - disk_creatediskfile(name2, 1, drvtype, nullptr, false, false, nullptr); - zfile_fclose(zf2); - if (writeprotected && iswritefileempty(p, name)) - { - for (i = 0; i < MAX_FLOPPY_DRIVES; i++) - { - if (!_tcscmp (name, floppy[i].newname)) - drive_eject(&floppy[i]); - } - _wunlink (name2); - } - - if (!needwritefile) - diskfile_readonly(name, writeprotected); - diskfile_readonly(name2, writeprotected); - DISK_reinsert(num); - return 1; + if (!needwritefile) + diskfile_readonly (name, writeprotected); + diskfile_readonly (name2, writeprotected); + return 1; } -void disk_eject(int num) +void disk_eject (int num) { - set_config_changed(); - gui_filename(num, _T("")); - drive_eject(floppy + num); - *currprefs.floppyslots[num].df = *changed_prefs.floppyslots[num].df = 0; - floppy[num].newname[0] = 0; - update_drive_gui(num, true); + set_config_changed (); + gui_filename (num, _T("")); + drive_eject (floppy + num); + *currprefs.floppyslots[num].df = *changed_prefs.floppyslots[num].df = 0; + floppy[num].newname[0] = 0; + update_drive_gui (num, true); } -int DISK_history_add(const TCHAR* name, int idx, int type, int donotcheck) +int DISK_history_add (const TCHAR *name, int idx, int type, int donotcheck) { - int i; + int i; - if (idx >= MAX_PREVIOUS_FLOPPIES) - return 0; - if (name == nullptr) - { - dfxhistory[type][idx][0] = 0; - return 1; - } - if (name[0] == 0) - return 0; - if (!donotcheck) - { - if (!zfile_exists(name)) - { - for (i = 0; i < MAX_PREVIOUS_FLOPPIES; i++) - { - if (!_tcsicmp (dfxhistory[type][i], name)) - { - while (i < MAX_PREVIOUS_FLOPPIES - 1) - { - _tcscpy (dfxhistory[type][i], dfxhistory[type][i + 1]); - i++; - } - dfxhistory[type][MAX_PREVIOUS_FLOPPIES - 1][0] = 0; - break; - } - } - return 0; - } - } - if (idx >= 0) - { - if (idx >= MAX_PREVIOUS_FLOPPIES) + if (idx >= MAX_PREVIOUS_IMAGES) + return 0; + if (name == NULL) { + if (idx < 0) return 0; dfxhistory[type][idx][0] = 0; - for (i = 0; i < MAX_PREVIOUS_FLOPPIES; i++) - { + return 1; + } + if (name[0] == 0) + return 0; + if (idx >= 0) { + if (idx >= MAX_PREVIOUS_IMAGES) + return 0; + dfxhistory[type][idx][0] = 0; + for (i = 0; i < MAX_PREVIOUS_IMAGES; i++) { if (!_tcsicmp (dfxhistory[type][i], name)) - return 0; - } + return 0; + } _tcscpy (dfxhistory[type][idx], name); - return 1; - } - for (i = 0; i < MAX_PREVIOUS_FLOPPIES; i++) - { - if (!_tcscmp (dfxhistory[type][i], name)) - { - while (i < MAX_PREVIOUS_FLOPPIES - 1) - { + return 1; + } + for (i = 0; i < MAX_PREVIOUS_IMAGES; i++) { + if (!_tcscmp (dfxhistory[type][i], name)) { + while (i < MAX_PREVIOUS_IMAGES - 1) { _tcscpy (dfxhistory[type][i], dfxhistory[type][i + 1]); - i++; - } - dfxhistory[type][MAX_PREVIOUS_FLOPPIES - 1][0] = 0; - break; - } - } - for (i = MAX_PREVIOUS_FLOPPIES - 2; i >= 0; i--) - _tcscpy (dfxhistory[type][i + 1], dfxhistory[type][i]); + i++; + } + dfxhistory[type][MAX_PREVIOUS_IMAGES - 1][0] = 0; + break; + } + } + for (i = MAX_PREVIOUS_IMAGES - 2; i >= 0; i--) + _tcscpy (dfxhistory[type][i + 1], dfxhistory[type][i]); _tcscpy (dfxhistory[type][0], name); - return 1; + return 1; } -TCHAR* DISK_history_get(int idx, int type) +TCHAR *DISK_history_get (int idx, int type) { - if (idx >= MAX_PREVIOUS_FLOPPIES) + if (idx >= MAX_PREVIOUS_IMAGES) return NULL; return dfxhistory[type][idx]; } -static void disk_insert_2(int num, const TCHAR* name, bool forced, bool forcedwriteprotect) +static void disk_insert_2 (int num, const TCHAR *name, bool forced, bool forcedwriteprotect) { - drive* drv = floppy + num; + drive *drv = floppy + num; - if (forced) - { - drive_insert(drv, &currprefs, num, name, false, forcedwriteprotect); - return; - } - if (!_tcscmp (currprefs.floppyslots[num].df, name)) - return; - _tcscpy (drv->newname, name); + if (forced) { + drive_insert (drv, &currprefs, num, name, false, forcedwriteprotect); + return; + } + if (!_tcscmp (currprefs.floppyslots[num].df, name)) + return; + drv->dskeject = false; + _tcscpy (drv->newname, name); drv->newnamewriteprotected = forcedwriteprotect; - _tcscpy (currprefs.floppyslots[num].df, name); + _tcscpy (currprefs.floppyslots[num].df, name); currprefs.floppyslots[num].forcedwriteprotect = forcedwriteprotect; - DISK_history_add(name, -1, HISTORY_FLOPPY, 0); - if (name[0] == 0) - { - disk_eject(num); - } - else if (!drive_empty(drv) || drv->dskchange_time > 0) - { - drive_eject(drv); - /* set dskchange_time, disk_insert() will be - * called from DISK_check_change() after 2 second delay - * this makes sure that all programs detect disk change correctly - */ - setdskchangetime(drv, 2 * 50 * 312); - } - else - { - setdskchangetime(drv, 1 * 312); + DISK_history_add (name, -1, HISTORY_FLOPPY, 0); + if (name[0] == 0) { + disk_eject (num); + } else if (!drive_empty(drv) || drv->dskchange_time > 0) { + // delay eject so that it is always called when emulation is active + drv->dskeject = true; + } else { + setdskchangetime (drv, 1 * 312); } } -void disk_insert(int num, const TCHAR* name, bool forcedwriteprotect) +void disk_insert (int num, const TCHAR *name, bool forcedwriteprotect) { - set_config_changed(); - //target_addtorecent(name, 0); - disk_insert_2(num, name, false, forcedwriteprotect); + set_config_changed (); + target_addtorecent (name, 0); + disk_insert_2 (num, name, 0, forcedwriteprotect); } -void disk_insert(int num, const TCHAR* name) +void disk_insert (int num, const TCHAR *name) { - set_config_changed(); - //target_addtorecent(name, 0); - disk_insert_2(num, name, false, false); + set_config_changed (); + target_addtorecent (name, 0); + disk_insert_2 (num, name, 0, false); +} +void disk_insert_force (int num, const TCHAR *name, bool forcedwriteprotect) +{ + disk_insert_2 (num, name, 1, forcedwriteprotect); } -void disk_insert_force(int num, const TCHAR* name, bool forcedwriteprotect) +static void DISK_check_change (void) { - disk_insert_2(num, name, true, forcedwriteprotect); -} - -static void DISK_check_change() -{ - if (currprefs.floppy_speed != changed_prefs.floppy_speed) - currprefs.floppy_speed = changed_prefs.floppy_speed; - //TODO: enable when floppy_read_only - /*if (currprefs.floppy_read_only != changed_prefs.floppy_read_only) - currprefs.floppy_read_only = changed_prefs.floppy_read_only;*/ - for (int i = 0; i < MAX_FLOPPY_DRIVES; i++) - { - drive* drv = floppy + i; - if (currprefs.floppyslots[i].dfxtype != changed_prefs.floppyslots[i].dfxtype) - { - currprefs.floppyslots[i].dfxtype = changed_prefs.floppyslots[i].dfxtype; - reset_drive(i); -#ifdef RETROPLATFORM - rp_floppy_device_enable(i, currprefs.floppyslots[i].dfxtype >= 0); -#endif + if (currprefs.floppy_speed != changed_prefs.floppy_speed) + currprefs.floppy_speed = changed_prefs.floppy_speed; + if (currprefs.floppy_read_only != changed_prefs.floppy_read_only) + currprefs.floppy_read_only = changed_prefs.floppy_read_only; + for (int i = 0; i < MAX_FLOPPY_DRIVES; i++) { + drive *drv = floppy + i; + if (drv->dskeject) { + drive_eject(drv); + /* set dskchange_time, disk_insert() will be + * called from DISK_check_change() after 2 second delay + * this makes sure that all programs detect disk change correctly + */ + setdskchangetime(drv, 2 * 50 * 312); } + if (currprefs.floppyslots[i].dfxtype != changed_prefs.floppyslots[i].dfxtype) { + currprefs.floppyslots[i].dfxtype = changed_prefs.floppyslots[i].dfxtype; + reset_drive (i); + } } } -void DISK_vsync() +void DISK_vsync (void) { - DISK_check_change(); - for (int i = 0; i < MAX_FLOPPY_DRIVES; i++) - { - drive* drv = floppy + i; - if (drv->dskchange_time == 0 && _tcscmp (currprefs.floppyslots[i].df, changed_prefs.floppyslots[i].df)) - disk_insert(i, changed_prefs.floppyslots[i].df, changed_prefs.floppyslots[i].forcedwriteprotect); - } + DISK_check_change (); + for (int i = 0; i < MAX_FLOPPY_DRIVES; i++) { + drive *drv = floppy + i; + if (drv->dskchange_time == 0 && _tcscmp (currprefs.floppyslots[i].df, changed_prefs.floppyslots[i].df)) + disk_insert (i, changed_prefs.floppyslots[i].df, changed_prefs.floppyslots[i].forcedwriteprotect); + } } -int disk_empty(int num) +int disk_empty (int num) { - return drive_empty(floppy + num); + return drive_empty (floppy + num); } -static TCHAR* tobin(uae_u8 v) +static TCHAR *tobin (uae_u8 v) { static TCHAR buf[9]; for (int i = 7; i >= 0; i--) @@ -2929,481 +2605,350 @@ static void fetch_DISK_select(uae_u8 data) direction = (data >> 1) & 1; } -void DISK_select_set(uae_u8 data) +void DISK_select_set (uae_u8 data) { prev_data = data; prev_step = data & 1; - fetch_DISK_select(data); + fetch_DISK_select (data); } -void DISK_select(uae_u8 data) +void DISK_select (uae_u8 data) { - int step_pulse, prev_selected, dr; + int step_pulse, prev_selected, dr; - prev_selected = selected; + prev_selected = selected; - fetch_DISK_select(data); - step_pulse = data & 1; + fetch_DISK_select (data); + step_pulse = data & 1; -#ifdef AMAX - if (currprefs.amaxromfile[0]) - amax_disk_select(data, prev_data); -#endif - - if ((prev_data & 0x80) != (data & 0x80)) - { - for (dr = 0; dr < 4; dr++) - { - if (floppy[dr].indexhackmode > 1 && !(selected & (1 << dr))) - { - floppy[dr].indexhack = 1; - } - } - } + if ((prev_data & 0x80) != (data & 0x80)) { + for (dr = 0; dr < 4; dr++) { + if (floppy[dr].indexhackmode > 1 && !((selected | disabled) & (1 << dr))) { + floppy[dr].indexhack = 1; + } + } + } // step goes high and drive was selected when step pulse changes: step - if (prev_step != step_pulse) - { - prev_step = step_pulse; - if (prev_step && !savestate_state) - { - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - if (!((prev_selected | disabled) & (1 << dr))) - { - drive_step(floppy + dr, direction); - if (floppy[dr].indexhackmode > 1 && (data & 0x80)) - floppy[dr].indexhack = 1; - } - } - } - } + if (prev_step != step_pulse) { + prev_step = step_pulse; + if (prev_step && !savestate_state) { + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + if (!((prev_selected | disabled) & (1 << dr))) { + drive_step (floppy + dr, direction); + if (floppy[dr].indexhackmode > 1 && (data & 0x80)) + floppy[dr].indexhack = 1; + } + } + } + } - if (!savestate_state) - { - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv = floppy + dr; - /* motor on/off workings tested with small assembler code on real Amiga 1200. */ - /* motor/id flipflop is set only when drive select goes from high to low */ - if (!(selected & (1 << dr)) && (prev_selected & (1 << dr))) - { - drv->drive_id_scnt++; - drv->drive_id_scnt &= 31; - drv->idbit = (drv->drive_id & (1L << (31 - drv->drive_id_scnt))) ? 1 : 0; - if (!(disabled & (1 << dr))) - { - if ((prev_data & 0x80) == 0 || (data & 0x80) == 0) - { - /* motor off: if motor bit = 0 in prevdata or data -> turn motor on */ - drive_motor(drv, false); - } - else if (prev_data & 0x80) - { - /* motor on: if motor bit = 1 in prevdata only (motor flag state in data has no effect) - -> turn motor off */ - drive_motor(drv, 1); - } - } - //TODO: uncomment when cs_df0idhw is added in options - if (/*!currprefs.cs_df0idhw &&*/ dr == 0) - drv->idbit = 0; - } - } - } + if (!savestate_state) { + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + drive *drv = floppy + dr; + /* motor on/off workings tested with small assembler code on real Amiga 1200. */ + /* motor/id flipflop is set only when drive select goes from high to low */ + if (!((selected | disabled) & (1 << dr)) && (prev_selected & (1 << dr)) ) { + drv->drive_id_scnt++; + drv->drive_id_scnt &= 31; + drv->idbit = (drv->drive_id & (1L << (31 - drv->drive_id_scnt))) ? 1 : 0; + if (!(disabled & (1 << dr))) { + if ((prev_data & 0x80) == 0 || (data & 0x80) == 0) { + /* motor off: if motor bit = 0 in prevdata or data -> turn motor on */ + drive_motor (drv, 0); + } else if (prev_data & 0x80) { + /* motor on: if motor bit = 1 in prevdata only (motor flag state in data has no effect) + -> turn motor off */ + drive_motor (drv, 1); + } + } + if (!currprefs.cs_df0idhw && dr == 0) + drv->idbit = 0; + } + } + } - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - floppy[dr].state = (!(selected & (1 << dr))) | !floppy[dr].motoroff; - update_drive_gui(dr, false); - } - prev_data = data; + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + floppy[dr].state = (!(selected & (1 << dr))) | !floppy[dr].motoroff; + update_drive_gui (dr, false); + } + prev_data = data; } -uae_u8 DISK_status() +uae_u8 DISK_status_ciaa(void) { - uae_u8 st = 0x3c; - int dr; + uae_u8 st = 0x3c; - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv = floppy + dr; - if (drv->amax) { - //TODO: enable when amax is implemented - //st = amax_disk_status(); - } - else if (!((selected | disabled) & (1 << dr))) - { - if (drive_running(drv)) - { - if (drv->catweasel) { -#ifdef CATWEASEL - if (catweasel_diskready(drv->catweasel)) - st &= ~0x20; -#endif - } - else - { - if (drv->dskready && !drv->indexhack && currprefs.floppyslots[dr].dfxtype != DRV_35_DD_ESCOM) - st &= ~0x20; - } - } - else - { - if (/*currprefs.cs_df0idhw ||*/ dr > 0) - { - /* report drive ID */ - if (drv->idbit && currprefs.floppyslots[dr].dfxtype != DRV_35_DD_ESCOM) - st &= ~0x20; - } - else - { - /* non-ID internal drive: mirror real dskready */ - if (drv->dskready) - st &= ~0x20; - } - /* dskrdy needs some cycles after switching the motor off.. (Pro Tennis Tour) */ - if (/*!currprefs.cs_df0idhw &&*/ dr == 0 && drv->motordelay) - st &= ~0x20; - } - if (drive_track0(drv)) - st &= ~0x10; - if (drive_writeprotected(drv)) - st &= ~8; - if (drv->catweasel) { -#ifdef CATWEASEL - if (catweasel_disk_changed(drv->catweasel)) - st &= ~4; -#endif - } - else if (drv->dskchange && currprefs.floppyslots[dr].dfxtype != DRV_525_SD) - { - st &= ~4; - } - } - else if (!(selected & (1 << dr))) - { - if (drv->idbit) - st &= ~0x20; - } - } - return st; + for (int dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + drive *drv = floppy + dr; + if (!((selected | disabled) & (1 << dr))) { + if (drive_running (drv)) { + if (drv->dskready && !drv->indexhack && currprefs.floppyslots[dr].dfxtype != DRV_35_DD_ESCOM) + st &= ~0x20; + } else { + if (currprefs.cs_df0idhw || dr > 0) { + /* report drive ID */ + if (drv->idbit && currprefs.floppyslots[dr].dfxtype != DRV_35_DD_ESCOM) + st &= ~0x20; + } else { + /* non-ID internal drive: mirror real dskready */ + if (drv->dskready) + st &= ~0x20; + } + /* dskrdy needs some cycles after switching the motor off.. (Pro Tennis Tour) */ + if (!currprefs.cs_df0idhw && dr == 0 && drv->motordelay) + st &= ~0x20; + } + if (drive_track0 (drv)) + st &= ~0x10; + if (drive_writeprotected (drv)) + st &= ~8; + if (drv->dskchange && currprefs.floppyslots[dr].dfxtype != DRV_525_SD) { + st &= ~4; + } + } else if (!((selected | disabled) & (1 << dr))) { + if (drv->idbit) + st &= ~0x20; + } + } + + return st; } -static bool unformatted(drive* drv) +static bool unformatted (drive *drv) { - int tr = drv->cyl * 2 + side; - if (tr >= drv->num_tracks) - return true; - if (drv->filetype == ADF_EXT2 && drv->trackdata[tr].bitlen == 0 && drv->trackdata[tr].type != TRACK_AMIGADOS) - return true; + int tr = drv->cyl * 2 + side; + if (tr >= drv->num_tracks) + return true; + if (drv->filetype == ADF_EXT2 && drv->trackdata[tr].bitlen == 0 && drv->trackdata[tr].type != TRACK_AMIGADOS) + return true; if (drv->trackdata[tr].type == TRACK_NONE) return true; - return false; + return false; } /* get one bit from MFM bit stream */ -STATIC_INLINE uae_u32 getonebit(uae_u16* mfmbuf, int mfmpos) +STATIC_INLINE uae_u32 getonebit (uae_u16 * mfmbuf, int mfmpos) { - uae_u16* buf; + uae_u16 *buf; - buf = &mfmbuf[mfmpos >> 4]; - return (buf[0] & (1 << (15 - (mfmpos & 15)))) ? 1 : 0; + buf = &mfmbuf[mfmpos >> 4]; + return (buf[0] & (1 << (15 - (mfmpos & 15)))) ? 1 : 0; } -void dumpdisk() +static void disk_dmafinished (void) { - int i, j, k; - uae_u16 w; - - for (i = 0; i < MAX_FLOPPY_DRIVES; i++) { - drive *drv = &floppy[i]; - if (!(disabled & (1 << i))) { - console_out(_T("Drive %d: motor %s cylinder %2d sel %s %s mfmpos %d/%d\n"), - i, drv->motoroff ? _T("off") : _T(" on"), drv->cyl, (selected & (1 << i)) ? _T("no") : _T("yes"), - drive_writeprotected(drv) ? _T("ro") : _T("rw"), drv->mfmpos, drv->tracklen); - if (drv->motoroff == 0) { - w = word; - for (j = 0; j < 15; j++) { - console_out(_T("%04X "), w); - for (k = 0; k < 16; k++) { - w <<= 1; - w |= getonebit(drv->bigmfmbuf, drv->mfmpos + j * 16 + k); - } - } - console_out(_T("\n")); - } - } - } - console_out(_T("side %d dma %d off %d word %04X pt %08X len %04X bytr %04X adk %04X sync %04X\n"), - side, dskdmaen, bitoffset, word, dskpt, dsklen, dskbytr_val, adkcon, dsksync); -} - -static void disk_dmafinished() -{ - INTREQ(0x8000 | 0x0002); - longwritemode = 0; - dskdmaen = DSKDMA_OFF; + INTREQ (0x8000 | 0x0002); + longwritemode = 0; + dskdmaen = DSKDMA_OFF; dsklength = 0; + dsklen = 0; } -static void fetchnextrevolution(drive* drv) +static void fetchnextrevolution (drive *drv) { if (drv->revolution_check) return; - drv->trackspeed = get_floppy_speed2(drv); + drv->trackspeed = get_floppy_speed2 (drv); drv->revolution_check = 2; - if (!drv->multi_revolution) - return; + if (!drv->multi_revolution) + return; switch (drv->filetype) { - case ADF_IPF: -#ifdef CAPS - caps_loadrevolution(drv->bigmfmbuf, drv->tracktiming, drv - floppy, drv->cyl * 2 + side, &drv->tracklen, &drv->lastrev, drv->track_access_done); -#endif - break; - case ADF_SCP: -#ifdef SCP - scp_loadrevolution(drv->bigmfmbuf, drv - floppy, drv->tracktiming, &drv->tracklen); -#endif - break; - case ADF_FDI: + case ADF_FDI: #ifdef FDI2RAW - fdi2raw_loadrevolution(drv->fdi, drv->bigmfmbuf, drv->tracktiming, drv->cyl * 2 + side, &drv->tracklen, 1); + fdi2raw_loadrevolution(drv->fdi, drv->bigmfmbuf, drv->tracktiming, drv->cyl * 2 + side, &drv->tracklen, 1); #endif - break; + break; } } -static void do_disk_index() +static void do_disk_index (void) { - if (!indexdecay) - { + if (!indexdecay) { indexdecay = 2; - cia_diskindex(); + cia_diskindex (); } } -void DISK_handler(uae_u32 data) +void DISK_handler (uae_u32 data) { int flag = data & 255; int disk_sync_cycle = data >> 8; - int hpos = current_hpos(); + int hpos = current_hpos (); - event2_remevent(ev2_disk); - DISK_update(disk_sync_cycle); - if (!dskdmaen) - { - if (flag & (DISK_REVOLUTION << 0)) - fetchnextrevolution(&floppy[0]); - if (flag & (DISK_REVOLUTION << 1)) - fetchnextrevolution(&floppy[1]); - if (flag & (DISK_REVOLUTION << 2)) - fetchnextrevolution(&floppy[2]); - if (flag & (DISK_REVOLUTION << 3)) - fetchnextrevolution(&floppy[3]); + event2_remevent(ev2_disk); + DISK_update (disk_sync_cycle); + if (!dskdmaen) { + if (flag & (DISK_REVOLUTION << 0)) + fetchnextrevolution (&floppy[0]); + if (flag & (DISK_REVOLUTION << 1)) + fetchnextrevolution (&floppy[1]); + if (flag & (DISK_REVOLUTION << 2)) + fetchnextrevolution (&floppy[2]); + if (flag & (DISK_REVOLUTION << 3)) + fetchnextrevolution (&floppy[3]); } - if (flag & DISK_WORDSYNC) - INTREQ(0x8000 | 0x1000); + if (flag & DISK_WORDSYNC) + INTREQ (0x8000 | 0x1000); if (flag & DISK_INDEXSYNC) - do_disk_index(); + do_disk_index (); } -static void disk_doupdate_write(drive* drv, int floppybits) +static void disk_doupdate_write (drive * drv, int floppybits) { - int dr; - int drives[4]; + int dr; + int drives[4]; + + for (dr = 0; dr < MAX_FLOPPY_DRIVES ; dr++) { + drive *drv2 = &floppy[dr]; + drives[dr] = 0; + if (drv2->motoroff) + continue; + if ((selected | disabled) & (1 << dr)) + continue; + drives[dr] = 1; + } - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv2 = &floppy[dr]; - drives[dr] = 0; - if (drv2->motoroff) - continue; - if (selected & (1 << dr)) - continue; - drives[dr] = 1; - } - - while (floppybits >= drv->trackspeed) - { - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - if (drives[dr]) - { - floppy[dr].mfmpos++; - floppy[dr].mfmpos %= drv->tracklen; - } - } - if (dmaen(DMA_DISK) && dskdmaen == DSKDMA_WRITE && dsklength > 0 && fifo_filled) - { - bitoffset++; - bitoffset &= 15; - if (!bitoffset) - { + while (floppybits >= drv->trackspeed) { + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + if (drives[dr]) { + floppy[dr].mfmpos++; + floppy[dr].mfmpos %= drv->tracklen; + } + } + if (dmaen (DMA_DISK) && dskdmaen == DSKDMA_WRITE && dsklength > 0 && fifo_filled) { + bitoffset++; + bitoffset &= 15; + if (!bitoffset) { // fast disk modes, fill the fifo instantly - if (currprefs.floppy_speed > 100 && !fifo_inuse[0] && !fifo_inuse[1] && !fifo_inuse[2]) - { - while (!fifo_inuse[2]) - { - uae_u16 w = chipmem_wget_indirect(dskpt); - DSKDAT(w); + if (currprefs.floppy_speed > 100 && !fifo_inuse[0] && !fifo_inuse[1] && !fifo_inuse[2]) { + while (!fifo_inuse[2]) { + uae_u16 w = chipmem_wget_indirect (dskpt); + DSKDAT (w); dskpt += 2; } } - if (disk_fifostatus() >= 0) - { - uae_u16 w = DSKDATR(); - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv2 = &floppy[dr]; - if (drives[dr]) - { - drv2->bigmfmbuf[drv2->mfmpos >> 4] = w; - drv2->bigmfmbuf[(drv2->mfmpos >> 4) + 1] = 0x5555; - drv2->writtento = 1; - } -#ifdef AMAX - if (currprefs.amaxromfile[0]) - amax_diskwrite(w); -#endif - } - dsklength--; - if (dsklength <= 0) - { - disk_dmafinished(); - for (int dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv = &floppy[dr]; - drv->writtento = 0; - if (drv->motoroff) - continue; - if (selected & (1 << dr)) - continue; - drive_write_data(drv); - } - } - } - } - } - floppybits -= drv->trackspeed; - } + if (disk_fifostatus () >= 0) { + uae_u16 w = DSKDATR (); + for (dr = 0; dr < MAX_FLOPPY_DRIVES ; dr++) { + drive *drv2 = &floppy[dr]; + if (drives[dr]) { + drv2->bigmfmbuf[drv2->mfmpos >> 4] = w; + drv2->bigmfmbuf[(drv2->mfmpos >> 4) + 1] = 0x5555; + drv2->writtento = 1; + } + } + dsklength--; + if (dsklength <= 0) { + disk_dmafinished (); + for (int dr = 0; dr < MAX_FLOPPY_DRIVES ; dr++) { + drive *drv = &floppy[dr]; + drv->writtento = 0; + if (drv->motoroff) + continue; + if ((selected | disabled) & (1 << dr)) + continue; + drive_write_data (drv); + } + } + } + } + } + floppybits -= drv->trackspeed; + } } -static void update_jitter() +static void update_jitter (void) { disk_jitter = ((uaerand () >> 4) % 3) + 1; - //TODO: enable the below when the relevant options are implemented - //if (currprefs.floppy_random_bits_max > 0) - // disk_jitter = ((uaerand() >> 4) % (currprefs.floppy_random_bits_max - currprefs.floppy_random_bits_min + 1)) + currprefs.floppy_random_bits_min; - //else - // disk_jitter = 0; } -static void updatetrackspeed(drive* drv, int mfmpos) +static void updatetrackspeed (drive *drv, int mfmpos) { - if (dskdmaen < DSKDMA_WRITE) - { + if (dskdmaen < DSKDMA_WRITE) { int t = drv->tracktiming[mfmpos / 8]; - int ts = get_floppy_speed2(drv) * t / 1000; - if (ts < 700 || ts > 3000) - { - static int warned; - warned++; - if (warned < 50) - write_log(_T("corrupted trackspeed value %d %d (%d/%d)\n"), t, ts, mfmpos, drv->tracklen); - } - else - { + int ts = get_floppy_speed2 (drv) * t / 1000; + if (ts < 700 || ts > 3000) { + } else { drv->trackspeed = ts; } - } + } } -static void disk_doupdate_predict(int startcycle) +static void disk_doupdate_predict (int startcycle) { int finaleventcycle = maxhpos << 8; int finaleventflag = 0; - for (int dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv = &floppy[dr]; + for (int dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + drive *drv = &floppy[dr]; if (drv->motoroff) continue; if (!drv->trackspeed) continue; - if (selected & (1 << dr)) + if ((selected | disabled) & (1 << dr)) continue; int mfmpos = drv->mfmpos; if (drv->tracktiming[0]) - updatetrackspeed(drv, mfmpos); + updatetrackspeed (drv, mfmpos); int diskevent_flag = 0; - uae_u32 tword = word; + uae_u32 tword = word; //int diff = drv->floppybitcounter % drv->trackspeed; int countcycle = startcycle; // + (diff ? drv->trackspeed - diff : 0); - while (countcycle < (maxhpos << 8)) - { - if (drv->tracktiming[0]) - updatetrackspeed(drv, mfmpos); + while (countcycle < (maxhpos << 8)) { + if (drv->tracktiming[0]) + updatetrackspeed (drv, mfmpos); countcycle += drv->trackspeed; - if (dskdmaen != DSKDMA_WRITE || (dskdmaen == DSKDMA_WRITE && !dma_enable)) - { - tword <<= 1; - if (!drive_empty(drv)) - { - if (unformatted(drv)) - tword |= (uaerand() & 0x1000) ? 1 : 0; - else - tword |= getonebit(drv->bigmfmbuf, mfmpos); - } + if (dskdmaen != DSKDMA_WRITE || (dskdmaen == DSKDMA_WRITE && !dma_enable)) { + tword <<= 1; + if (!drive_empty (drv)) { + if (unformatted (drv)) + tword |= (uaerand() & 0x1000) ? 1 : 0; + else + tword |= getonebit (drv->bigmfmbuf, mfmpos); + } if (dskdmaen != DSKDMA_READ && (tword & 0xffff) == dsksync && dsksync != 0) - diskevent_flag |= DISK_WORDSYNC; + diskevent_flag |= DISK_WORDSYNC; + } + mfmpos++; + mfmpos %= drv->tracklen; + if (!dskdmaen) { + if (mfmpos == 0) + diskevent_flag |= DISK_REVOLUTION << (drv - floppy); + if (mfmpos == drv->indexoffset) + diskevent_flag |= DISK_INDEXSYNC; } - mfmpos++; - mfmpos %= drv->tracklen; - if (!dskdmaen) - { - if (mfmpos == 0) - diskevent_flag |= DISK_REVOLUTION << (drv - floppy); - if (mfmpos == drv->indexoffset) - diskevent_flag |= DISK_INDEXSYNC; - } - if (dskdmaen != DSKDMA_WRITE && mfmpos == drv->skipoffset) - { - update_jitter(); - int skipcnt = disk_jitter; - while (skipcnt-- > 0) - { - mfmpos++; - mfmpos %= drv->tracklen; - if (!dskdmaen) - { - if (mfmpos == 0) - diskevent_flag |= DISK_REVOLUTION << (drv - floppy); - if (mfmpos == drv->indexoffset) - diskevent_flag |= DISK_INDEXSYNC; - } - } + if (dskdmaen != DSKDMA_WRITE && mfmpos == drv->skipoffset) { + int skipcnt = disk_jitter; + while (skipcnt-- > 0) { + mfmpos++; + mfmpos %= drv->tracklen; + if (!dskdmaen) { + if (mfmpos == 0) + diskevent_flag |= DISK_REVOLUTION << (drv - floppy); + if (mfmpos == drv->indexoffset) + diskevent_flag |= DISK_INDEXSYNC; + } + } } if (diskevent_flag) break; - } - if (drv->tracktiming[0]) - updatetrackspeed(drv, drv->mfmpos); - if (diskevent_flag && countcycle < finaleventcycle) - { + } + if (drv->tracktiming[0]) + updatetrackspeed (drv, drv->mfmpos); + if (diskevent_flag && countcycle < finaleventcycle) { finaleventcycle = countcycle; finaleventflag = diskevent_flag; } } - if (finaleventflag && (finaleventcycle >> 8) < maxhpos) - { - event2_newevent(ev2_disk, (finaleventcycle - startcycle) >> 8, ((finaleventcycle >> 8) << 8) | finaleventflag); - } + if (finaleventflag && (finaleventcycle >> 8) < maxhpos) { + event2_newevent (ev2_disk, (finaleventcycle - startcycle) >> 8, ((finaleventcycle >> 8) << 8) | finaleventflag); + } } -int disk_fifostatus() +int disk_fifostatus (void) { if (fifo_inuse[0] && fifo_inuse[1] && fifo_inuse[2]) return 1; @@ -3412,559 +2957,527 @@ int disk_fifostatus() return 0; } -static int doreaddma() +static int doreaddma (void) { - if (dmaen(DMA_DISK) && bitoffset == 15 && dma_enable && dskdmaen == DSKDMA_READ && dsklength >= 0) - { - if (dsklength > 0) - { + if (dmaen (DMA_DISK) && bitoffset == 15 && dma_enable && dskdmaen == DSKDMA_READ && dsklength >= 0) { + if (dsklength > 0) { // DSKLEN == 1: finish without DMA transfer. - if (dsklength == 1 && dsklength2 == 1) - { - disk_dmafinished(); + if (dsklength == 1 && dsklength2 == 1) { + disk_dmafinished (); return 0; } // fast disk modes, just flush the fifo - if (currprefs.floppy_speed > 100 && fifo_inuse[0] && fifo_inuse[1] && fifo_inuse[2]) - { - while (fifo_inuse[0]) - { - uae_u16 w = DSKDATR(); - chipmem_wput_indirect(dskpt, w); + if (currprefs.floppy_speed > 100 && fifo_inuse[0] && fifo_inuse[1] && fifo_inuse[2]) { + while (fifo_inuse[0]) { + uae_u16 w = DSKDATR (); + chipmem_wput_indirect (dskpt, w); dskpt += 2; } } - if (disk_fifostatus() > 0) - { + if (disk_fifostatus () > 0) { write_log (_T("doreaddma() fifo overflow detected, retrying..\n")); return -1; - } - else - { - DSKDAT(word); - dsklength--; - } - } + } else { + DSKDAT (word); + dsklength--; + } + } return 1; } return 0; } -static void disk_doupdate_read_nothing(int floppybits) +static void disk_doupdate_read_nothing (int floppybits) { - int j = 0, k = 1, l = 0; + while (floppybits >= get_floppy_speed()) { + word <<= 1; + doreaddma (); + if ((bitoffset & 7) == 7) { + dskbytr_val = word & 0xff; + dskbytr_val |= 0x8000; + } + bitoffset++; + bitoffset &= 15; + floppybits -= get_floppy_speed(); + } +} - while (floppybits >= get_floppy_speed()) - { - word <<= 1; - doreaddma(); - if ((bitoffset & 7) == 7) - { - dskbytr_val = word & 0xff; - dskbytr_val |= 0x8000; - } - bitoffset++; - bitoffset &= 15; - floppybits -= get_floppy_speed(); +static void wordsync_detected(bool startup) +{ + dsksync_cycles = get_cycles () + WORDSYNC_TIME * CYCLE_UNIT; + if (dskdmaen != DSKDMA_OFF) { + if (!startup) + dma_enable = 1; + INTREQ (0x8000 | 0x1000); + } + if (adkcon & 0x0400) { + bitoffset = 15; } } -static void disk_doupdate_read(drive* drv, int floppybits) +static void disk_doupdate_read (drive * drv, int floppybits) { - int j = 0, k = 1, l = 0; + /* + uae_u16 *mfmbuf = drv->bigmfmbuf; + dsksync = 0x4444; + adkcon |= 0x400; + drv->mfmpos = 0; + memset (mfmbuf, 0, 1000); + cycles = 0x1000000; + // 4444 4444 4444 aaaa aaaaa 4444 4444 4444 + // 4444 aaaa aaaa 4444 + mfmbuf[0] = 0x4444; + mfmbuf[1] = 0x4444; + mfmbuf[2] = 0x4444; + mfmbuf[3] = 0xaaaa; + mfmbuf[4] = 0xaaaa; + mfmbuf[5] = 0x4444; + mfmbuf[6] = 0x4444; + mfmbuf[7] = 0x4444; + */ + while (floppybits >= drv->trackspeed) { + if (drv->tracktiming[0]) + updatetrackspeed (drv, drv->mfmpos); + word <<= 1; - while (floppybits >= drv->trackspeed) - { - if (drv->tracktiming[0]) - updatetrackspeed(drv, drv->mfmpos); - word <<= 1; - if (!drive_empty(drv)) - { - if (unformatted(drv)) - word |= (uaerand() & 0x1000) ? 1 : 0; - else - word |= getonebit(drv->bigmfmbuf, drv->mfmpos); - } - if (doreaddma() < 0) - { + if (!drive_empty (drv)) { + if (unformatted (drv)) + word |= (uaerand() & 0x1000) ? 1 : 0; + else + word |= getonebit (drv->bigmfmbuf, drv->mfmpos); + } + if (doreaddma () < 0) { word >>= 1; return; } - drv->mfmpos++; - drv->mfmpos %= drv->tracklen; - if (drv->mfmpos == drv->indexoffset) - { - drv->indexhack = 0; - do_disk_index(); - } - if (drv->mfmpos == 0) - { - fetchnextrevolution(drv); + drv->mfmpos++; + drv->mfmpos %= drv->tracklen; + if (drv->mfmpos == drv->indexoffset) { + drv->indexhack = 0; + do_disk_index (); + } + if (drv->mfmpos == 0) { + fetchnextrevolution (drv); if (drv->tracktiming[0]) - updatetrackspeed(drv, drv->mfmpos); + updatetrackspeed (drv, drv->mfmpos); } - if (drv->mfmpos == drv->skipoffset) - { - update_jitter(); + if (drv->mfmpos == drv->skipoffset) { int skipcnt = disk_jitter; - while (skipcnt-- > 0) - { + while (skipcnt-- > 0) { drv->mfmpos++; - drv->mfmpos %= drv->tracklen; - if (drv->mfmpos == drv->indexoffset) - { + drv->mfmpos %= drv->tracklen; + if (drv->mfmpos == drv->indexoffset) { drv->indexhack = 0; - do_disk_index(); - } - if (drv->mfmpos == 0) - { - fetchnextrevolution(drv); + do_disk_index (); + } + if (drv->mfmpos == 0) { + fetchnextrevolution (drv); if (drv->tracktiming[0]) - updatetrackspeed(drv, drv->mfmpos); + updatetrackspeed (drv, drv->mfmpos); } } - } - if ((bitoffset & 7) == 7) - { - dskbytr_val = word & 0xff; - dskbytr_val |= 0x8000; - } + } + if ((bitoffset & 7) == 7) { + dskbytr_val = word & 0xff; + dskbytr_val |= 0x8000; + } if (word == dsksync) - { - dsksync_cycles = get_cycles() + WORDSYNC_TIME * CYCLE_UNIT; - if (dskdmaen != DSKDMA_OFF) - { - dma_enable = 1; - INTREQ(0x8000 | 0x1000); - } - if (adkcon & 0x400) - { - bitoffset = 15; - } - } - bitoffset++; - bitoffset &= 15; - floppybits -= drv->trackspeed; - } -} - -static void disk_dma_debugmsg(void) -{ - write_log(_T("LEN=%04X (%d) SYNC=%04X PT=%08X ADKCON=%04X INTREQ=%04X PC=%08X\n"), - dsklength, dsklength, (adkcon & 0x400) ? dsksync : 0xffff, dskpt, adkcon, intreq, M68K_GETPC); + wordsync_detected(false); + bitoffset++; + bitoffset &= 15; + floppybits -= drv->trackspeed; + } } /* this is very unoptimized. DSKBYTR is used very rarely, so it should not matter. */ -uae_u16 DSKBYTR(int hpos) +uae_u16 DSKBYTR (int hpos) { - uae_u16 v; - - DISK_update(hpos); - v = dskbytr_val; - dskbytr_val &= ~0x8000; - if (word == dsksync && cycles_in_range(dsksync_cycles)) - v |= 0x1000; - if (dskdmaen != DSKDMA_OFF && dmaen(DMA_DISK)) - v |= 0x4000; - if (dsklen & 0x4000) - v |= 0x2000; + uae_u16 v; + DISK_update (hpos); + v = dskbytr_val; + dskbytr_val &= ~0x8000; + if (word == dsksync && cycles_in_range (dsksync_cycles)) { + v |= 0x1000; + } + if (dskdmaen != DSKDMA_OFF && dmaen (DMA_DISK)) + v |= 0x4000; + if (dsklen & 0x4000) + v |= 0x2000; for (int dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { drive *drv = &floppy[dr]; if (drv->motoroff) continue; - if (!(selected & (1 << dr))) { - drv->lastdataacesstrack = drv->cyl * 2 + side; - drv->track_access_done = true; - } } - return v; + return v; } -static void DISK_start() +static void DISK_start (void) { - int dr; + int dr; for (int i = 0; i < 3; i++) fifo_inuse[i] = false; - fifo_filled = false; - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv = &floppy[dr]; - if (!(selected & (1 << dr))) - { - int tr = drv->cyl * 2 + side; - trackid* ti = drv->trackdata + tr; + fifo_filled = 0; - if (dskdmaen == DSKDMA_WRITE) - { - drv->tracklen = longwritemode ? FLOPPY_WRITE_MAXLEN : FLOPPY_WRITE_LEN * drv->ddhd * 8 * 2; - drv->trackspeed = get_floppy_speed(); - drv->skipoffset = -1; - updatemfmpos(drv); - } - /* Ugh. A nasty hack. Assume ADF_EXT1 tracks are always read - from the start. */ - if (ti->type == TRACK_RAW1) - { - drv->mfmpos = 0; + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + drive *drv = &floppy[dr]; + if (!((selected | disabled) & (1 << dr))) { + int tr = drv->cyl * 2 + side; + trackid *ti = drv->trackdata + tr; + + if (dskdmaen == DSKDMA_WRITE) { + word = 0; + drv->tracklen = longwritemode ? FLOPPY_WRITE_MAXLEN : FLOPPY_WRITE_LEN * drv->ddhd * 8 * 2; + drv->trackspeed = get_floppy_speed(); + drv->skipoffset = -1; + updatemfmpos (drv); + } + /* Ugh. A nasty hack. Assume ADF_EXT1 tracks are always read + from the start. */ + if (ti->type == TRACK_RAW1) { + drv->mfmpos = 0; bitoffset = 0; + word = 0; } - if (drv->catweasel) - drive_fill_bigbuf(drv, 1); - } - drv->floppybitcounter = 0; - } + } + drv->floppybitcounter = 0; + } + dma_enable = (adkcon & 0x400) ? 0 : 1; + if (word == dsksync) + wordsync_detected(true); } static int linecounter; -void DISK_hsync() +void DISK_hsync (void) { - int dr; + int dr; - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv = &floppy[dr]; - if (drv->steplimit) - drv->steplimit--; + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + drive *drv = &floppy[dr]; + if (drv->steplimit) + drv->steplimit--; if (drv->revolution_check) drv->revolution_check--; if (drv->dskready_down_time > 0) drv->dskready_down_time--; /* emulate drive motor turn on time */ - if (drv->dskready_up_time > 0 && !drive_empty(drv)) - { + if (drv->dskready_up_time > 0 && !drive_empty (drv)) { drv->dskready_up_time--; if (drv->dskready_up_time == 0 && !drv->motoroff) drv->dskready = true; } /* delay until new disk image is inserted */ - if (drv->dskchange_time > 0) - { + if (drv->dskchange_time > 0) { drv->dskchange_time--; - if (drv->dskchange_time == 0) - { - drive_insert(drv, &currprefs, dr, drv->newname, false, drv->newnamewriteprotected); - update_drive_gui(dr, false); + if (drv->dskchange_time == 0) { + drive_insert (drv, &currprefs, dr, drv->newname, false, drv->newnamewriteprotected); + update_drive_gui (dr, false); } } - } + } if (indexdecay) indexdecay--; - if (linecounter) - { - linecounter--; - if (! linecounter) - disk_dmafinished(); - return; - } - DISK_update(maxhpos); + if (linecounter) { + linecounter--; + if (! linecounter) + disk_dmafinished (); + return; + } + DISK_update (maxhpos); } -void DISK_update(int tohpos) +void DISK_update (int tohpos) { - int dr; + int dr; int cycles; - int startcycle = disk_hpos; - if (disk_hpos < 0) - { + if (disk_hpos < 0) { disk_hpos = - disk_hpos; return; } cycles = (tohpos << 8) - disk_hpos; - if (cycles <= 0) - return; - disk_hpos += cycles; - if (disk_hpos >= (maxhpos << 8)) + if (cycles <= 0) + return; + disk_hpos += cycles; + if (disk_hpos >= (maxhpos << 8)) disk_hpos %= 1 << 8; - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv = &floppy[dr]; + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + drive *drv = &floppy[dr]; - if (drv->motoroff || !drv->tracklen || !drv->trackspeed) - continue; - drv->floppybitcounter += cycles; - if (selected & (1 << dr)) - { - drv->mfmpos += drv->floppybitcounter / drv->trackspeed; - drv->mfmpos %= drv->tracklen; - drv->floppybitcounter %= drv->trackspeed; - continue; - } - if (drv->diskfile) - drive_fill_bigbuf(drv, 0); - drv->mfmpos %= drv->tracklen; - } + if (drv->motoroff || !drv->tracklen || !drv->trackspeed) + continue; + drv->floppybitcounter += cycles; + if ((selected | disabled) & (1 << dr)) { + drv->mfmpos += drv->floppybitcounter / drv->trackspeed; + drv->mfmpos %= drv->tracklen; + drv->floppybitcounter %= drv->trackspeed; + continue; + } + if (drv->diskfile) + drive_fill_bigbuf (drv, 0); + drv->mfmpos %= drv->tracklen; + } int didaccess = 0; - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv = &floppy[dr]; - if (drv->motoroff || !drv->trackspeed) - continue; - if (selected & (1 << dr)) - continue; + bool done_jitter = false; + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + drive *drv = &floppy[dr]; + if (drv->motoroff || !drv->trackspeed) + continue; + if ((selected | disabled) & (1 << dr)) + continue; + if (!done_jitter) { + update_jitter(); + done_jitter = true; + } /* write dma and wordsync enabled: read until wordsync match found */ if (dskdmaen == DSKDMA_WRITE && dma_enable) - disk_doupdate_write(drv, drv->floppybitcounter); - else - disk_doupdate_read(drv, drv->floppybitcounter); - drv->floppybitcounter %= drv->trackspeed; + disk_doupdate_write (drv, drv->floppybitcounter); + else + disk_doupdate_read (drv, drv->floppybitcounter); + + drv->floppybitcounter %= drv->trackspeed; didaccess = 1; - } - /* no floppy selected but read dma */ - if (!didaccess && dskdmaen == DSKDMA_READ) - { - disk_doupdate_read_nothing(cycles); - } + } + /* no floppy selected but read dma */ + if (!didaccess && dskdmaen == DSKDMA_READ) { + disk_doupdate_read_nothing (cycles); + } /* instantly finish dma if dsklen==0 and wordsync detected */ if (dskdmaen != DSKDMA_OFF && dma_enable && dsklength2 == 0 && dsklength == 0) - disk_dmafinished(); + disk_dmafinished (); - disk_doupdate_predict(disk_hpos); + if (!done_jitter) { + update_jitter(); + done_jitter = true; + } + disk_doupdate_predict (disk_hpos); } -void DSKLEN(uae_u16 v, int hpos) +void DSKLEN (uae_u16 v, int hpos) { - int dr, prev = dsklen; - int noselected = 0; - int motormask; + int dr, prev = dsklen; + int noselected = 0; + int motormask; - DISK_update(hpos); + DISK_update (hpos); - if ((v & 0x8000) && (dsklen & 0x8000)) - { - dskdmaen = DSKDMA_READ; - DISK_start(); - } - if (!(v & 0x8000)) - { - if (dskdmaen != DSKDMA_OFF) - { - /* Megalomania and Knightmare does this */ - if (dskdmaen == DSKDMA_WRITE) - { - write_log (_T("warning: Disk write DMA aborted, %d words left PC=%x\n"), dsklength, M68K_GETPC); - // did program write something that needs to be stored to file? - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv2 = &floppy[dr]; - if (!drv2->writtento) - continue; - drive_write_data(drv2); - } - } - dskdmaen = DSKDMA_OFF; - } - } dsklen = v; dsklength2 = dsklength = dsklen & 0x3fff; - if (dskdmaen == DSKDMA_OFF) - return; - - if (dsklength == 0 && dma_enable) - { - disk_dmafinished(); - return; - } - - if ((v & 0x4000) && (prev & 0x4000)) - { - if (dsklength == 0) + if ((v & 0x8000) && (prev & 0x8000)) { + if (dskdmaen == DSKDMA_READ) { + // update only currently active DMA length, don't change DMA state + write_log(_T("warning: Disk read DMA length rewrite %d -> %d. (%04x) PC=%08x\n"), prev & 0x3fff, v & 0x3fff, v, M68K_GETPC); return; - if (dsklength == 1) - { - disk_dmafinished(); + } + dskdmaen = DSKDMA_READ; + DISK_start (); + } + if (!(v & 0x8000)) { + if (dskdmaen != DSKDMA_OFF) { + /* Megalomania and Knightmare does this */ + if (dskdmaen == DSKDMA_WRITE) { + write_log (_T("warning: Disk write DMA aborted, %d words left PC=%x\n"), dsklength, M68K_GETPC); + // did program write something that needs to be stored to file? + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + drive *drv2 = &floppy[dr]; + if (!drv2->writtento) + continue; + drive_write_data (drv2); + } + } + dskdmaen = DSKDMA_OFF; + } + } + + if (dskdmaen == DSKDMA_OFF) + return; + + if (dsklength == 0 && dma_enable) { + disk_dmafinished (); + return; + } + + if ((v & 0x4000) && (prev & 0x4000)) { + if (dsklength == 0) + return; + if (dsklength == 1) { + disk_dmafinished(); + return; + } + if (dskdmaen == DSKDMA_WRITE) { + write_log(_T("warning: Disk write DMA length rewrite %d -> %d\n"), prev & 0x3fff, v & 0x3fff); return; } dskdmaen = DSKDMA_WRITE; - DISK_start(); - } + DISK_start (); + } - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv = &floppy[dr]; + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + drive *drv = &floppy[dr]; if (drv->motoroff) continue; if (selected & (1 << dr)) continue; - if (dskdmaen == DSKDMA_READ) - { - drv->lastdataacesstrack = drv->cyl * 2 + side; - drv->track_access_done = true; - } } + motormask = 0; + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + drive *drv = &floppy[dr]; + drv->writtento = 0; + if (drv->motoroff) + continue; + motormask |= 1 << dr; + if ((selected & (1 << dr)) == 0) + break; + } + if (dr == 4) { + noselected = 1; + } - motormask = 0; - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv = &floppy[dr]; - drv->writtento = 0; - if (drv->motoroff) - continue; - motormask |= 1 << dr; - if ((selected & (1 << dr)) == 0) - break; - } - if (dr == 4) - { - write_log (_T("disk %s DMA started, drvmask=%x motormask=%x PC=%08x\n"), - dskdmaen == DSKDMA_WRITE ? _T("write") : _T("read"), selected ^ 15, motormask, M68K_GETPC); - noselected = 1; - } + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) + update_drive_gui (dr, false); - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - update_drive_gui(dr, false); - - /* Try to make floppy access from Kickstart faster. */ + /* Try to make floppy access from Kickstart faster. */ if (dskdmaen != DSKDMA_READ && dskdmaen != DSKDMA_WRITE) - return; + return; - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv = &floppy[dr]; - if (selected & (1 << dr)) - continue; + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + drive *drv = &floppy[dr]; + if (selected & (1 << dr)) + continue; if (drv->filetype != ADF_NORMAL && drv->filetype != ADF_KICK && drv->filetype != ADF_SKICK) - break; - } - if (dr < MAX_FLOPPY_DRIVES) /* no turbo mode if any selected drive has non-standard ADF */ - return; - { - int done = 0; - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv = &floppy[dr]; - int pos, i; + break; + } + if (dr < MAX_FLOPPY_DRIVES) /* no turbo mode if any selected drive has non-standard ADF */ + return; + { + int done = 0; + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + drive *drv = &floppy[dr]; + bool floppysupported = (drv->ddhd < 2) || (drv->ddhd > 1 && currprefs.floppyslots[dr].dfxtype == DRV_35_HD); + int pos, i; - if (drv->motoroff) - continue; - if (!drv->useturbo && currprefs.floppy_speed > 0) - continue; - if (selected & (1 << dr)) - continue; + if (drv->motoroff) + continue; + if (!drv->useturbo && currprefs.floppy_speed > 0) + continue; + if (selected & (1 << dr)) + continue; - pos = drv->mfmpos & ~15; - drive_fill_bigbuf(drv, 0); + pos = drv->mfmpos & ~15; + drive_fill_bigbuf (drv, 0); - if (dskdmaen == DSKDMA_READ) - { /* TURBO read */ - if (adkcon & 0x400) - { - for (i = 0; i < drv->tracklen; i += 16) - { - pos += 16; + if (dskdmaen == DSKDMA_READ) { /* TURBO read */ + + if ((adkcon & 0x400) && floppysupported) { + for (i = 0; i < drv->tracklen; i += 16) { + pos += 16; + pos %= drv->tracklen; + if (drv->bigmfmbuf[pos >> 4] == dsksync) { + /* must skip first disk sync marker */ + pos += 16; + pos %= drv->tracklen; + break; + } + } + if (i >= drv->tracklen) + return; + } + // read nothing if not supported and MFMSYNC is on. + if ((floppysupported) || (!floppysupported && !(adkcon & 0x400))) { + while (dsklength-- > 0) { + chipmem_wput_indirect (dskpt, floppysupported ? drv->bigmfmbuf[pos >> 4] : uaerand()); + dskpt += 2; + pos += 16; pos %= drv->tracklen; - if (drv->bigmfmbuf[pos >> 4] == dsksync) - { - /* must skip first disk sync marker */ - pos += 16; - pos %= drv->tracklen; - break; - } } - if (i >= drv->tracklen) - return; - } - while (dsklength-- > 0) - { - chipmem_wput_indirect(dskpt, drv->bigmfmbuf[pos >> 4]); - dskpt += 2; - pos += 16; - pos %= drv->tracklen; - } + } else { + pos += uaerand(); + pos %= drv->tracklen; + } drv->mfmpos = pos; - INTREQ(0x8000 | 0x1000); - done = 1; - } - else if (dskdmaen == DSKDMA_WRITE) - { /* TURBO write */ + if (floppysupported) + INTREQ (0x8000 | 0x1000); + done = 2; - for (i = 0; i < dsklength; i++) - { - uae_u16 w = chipmem_wget_indirect(dskpt + i * 2); - drv->bigmfmbuf[pos >> 4] = w; -#ifdef AMAX - if (currprefs.amaxromfile[0]) - amax_diskwrite(w); -#endif - pos += 16; + } else if (dskdmaen == DSKDMA_WRITE) { /* TURBO write */ + + if (floppysupported) { + for (i = 0; i < dsklength; i++) { + uae_u16 w = chipmem_wget_indirect (dskpt + i * 2); + drv->bigmfmbuf[pos >> 4] = w; + pos += 16; + pos %= drv->tracklen; + } + drv->mfmpos = pos; + drive_write_data (drv); + done = 2; + } else { + pos += uaerand(); pos %= drv->tracklen; + drv->mfmpos = pos; + done = 2; } - drv->mfmpos = pos; - drive_write_data(drv); - done = 1; - } - } - if (!done && noselected) - { - while (dsklength-- > 0) - { - if (dskdmaen == DSKDMA_WRITE) - { - uae_u16 w = chipmem_wget_indirect(dskpt); -#ifdef AMAX - if (currprefs.amaxromfile[0]) - amax_diskwrite(w); -#endif - } - else - { - chipmem_wput_indirect(dskpt, 0); - } - dskpt += 2; - } - INTREQ(0x8000 | 0x1000); - done = 1; - } + } + } + if (!done && noselected) { + while (dsklength-- > 0) { + if (dskdmaen == DSKDMA_WRITE) { + uae_u16 w = chipmem_wget_indirect (dskpt); + } else { + chipmem_wput_indirect (dskpt, 0); + } + dskpt += 2; + } + INTREQ (0x8000 | 0x1000); + done = 2; + } - if (done) - { - linecounter = 2; + if (done) { + linecounter = done; dskdmaen = DSKDMA_OFF; - return; - } - } + return; + } + } } -void DISK_update_adkcon(int hpos, uae_u16 v) +void DISK_update_adkcon (int hpos, uae_u16 v) { uae_u16 vold = adkcon; uae_u16 vnew = adkcon; if (v & 0x8000) - vnew |= v & 0x7FFF; + vnew |= v & 0x7FFF; else vnew &= ~v; if ((vnew & 0x400) && !(vold & 0x400)) bitoffset = 0; } -void DSKSYNC(int hpos, uae_u16 v) +void DSKSYNC (int hpos, uae_u16 v) { - if (v == dsksync) - return; - DISK_update(hpos); - dsksync = v; + if (v == dsksync) + return; + DISK_update (hpos); + dsksync = v; } -STATIC_INLINE bool iswrite() +STATIC_INLINE bool iswrite (void) { - return dskdmaen == 3; + return dskdmaen == DSKDMA_WRITE; } -void DSKDAT(uae_u16 v) +void DSKDAT (uae_u16 v) { - if (fifo_inuse[2]) - { + if (fifo_inuse[2]) { write_log (_T("DSKDAT: FIFO overflow!\n")); return; } @@ -3972,229 +3485,199 @@ void DSKDAT(uae_u16 v) fifo[2] = fifo[1]; fifo_inuse[1] = fifo_inuse[0]; fifo[1] = fifo[0]; - fifo_inuse[0] = iswrite() ? 2 : 1; + fifo_inuse[0] = iswrite () ? 2 : 1; fifo[0] = v; - fifo_filled = true; + fifo_filled = 1; } - -uae_u16 DSKDATR() +uae_u16 DSKDATR (void) { int i; uae_u16 v = 0; - for (i = 2; i >= 0; i--) - { - if (fifo_inuse[i]) - { + for (i = 2; i >= 0; i--) { + if (fifo_inuse[i]) { fifo_inuse[i] = 0; v = fifo[i]; break; } } - if (i < 0) - { + if (i < 0) { write_log (_T("DSKDATR: FIFO underflow!\n")); - } - else if (dskdmaen > 0 && dskdmaen < 3 && dsklength <= 0 && disk_fifostatus() < 0) - { - disk_dmafinished(); + } else if (dskdmaen > 0 && dskdmaen < 3 && dsklength <= 0 && disk_fifostatus () < 0) { + disk_dmafinished (); } return v; } -uae_u16 disk_dmal() +uae_u16 disk_dmal (void) { uae_u16 dmal = 0; - if (dskdmaen) - { - if (dskdmaen == 3) - { + if (dskdmaen) { + if (dskdmaen == 3) { dmal = (1 + 2) * (fifo_inuse[0] ? 1 : 0) + (4 + 8) * (fifo_inuse[1] ? 1 : 0) + (16 + 32) * (fifo_inuse[2] ? 1 : 0); dmal ^= 63; if (dsklength == 2) dmal &= ~(16 + 32); if (dsklength == 1) dmal &= ~(16 + 32 + 4 + 8); - } - else - { + } else { dmal = 16 * (fifo_inuse[0] ? 1 : 0) + 4 * (fifo_inuse[1] ? 1 : 0) + 1 * (fifo_inuse[2] ? 1 : 0); } } return dmal; } - -uaecptr disk_getpt() +uaecptr disk_getpt (void) { uaecptr pt = dskpt; dskpt += 2; return pt; } - -void DSKPTH(uae_u16 v) +void DSKPTH (uae_u16 v) { - dskpt = (dskpt & 0xffff) | (uae_u32(v) << 16); + dskpt = (dskpt & 0xffff) | ((uae_u32) v << 16); } -void DSKPTL(uae_u16 v) +void DSKPTL (uae_u16 v) { - dskpt = (dskpt & ~0xffff) | (v); + dskpt = (dskpt & ~0xffff) | (v); } -void DISK_free() +void DISK_free (void) { - int dr; - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv = &floppy[dr]; - drive_image_free(drv); - } + for (int dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + drive *drv = &floppy[dr]; + drive_image_free (drv); + } } -void DISK_init() +void DISK_init (void) { - int dr; - - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) - { - drive* drv = &floppy[dr]; - /* reset all drive types to 3.5 DD */ - drive_settype_id(drv); - if (!drive_insert(drv, &currprefs, dr, currprefs.floppyslots[dr].df, false, currprefs.floppyslots[dr].forcedwriteprotect)) - disk_eject(dr); - } - if (disk_empty(0)) + for (int dr = MAX_FLOPPY_DRIVES - 1; dr >= 0; dr--) { + drive *drv = &floppy[dr]; + /* reset all drive types to 3.5 DD */ + drive_settype_id (drv); + if (!drive_insert (drv, &currprefs, dr, currprefs.floppyslots[dr].df, false, currprefs.floppyslots[dr].forcedwriteprotect)) + disk_eject (dr); + } + if (disk_empty (0)) write_log (_T("No disk in drive 0.\n")); - //TODO: enable when AMAX is implemented - //amax_init(); } -void DISK_reset() +void DISK_reset (void) { - int i; + if (savestate_state) + return; - if (savestate_state) - return; - - disk_hpos = 0; - dskdmaen = 0; - disabled = 0; - for (i = 0; i < MAX_FLOPPY_DRIVES; i++) - reset_drive(i); - setamax(); + disk_hpos = 0; + dskdmaen = 0; + disabled = 0; + memset(&disk_info_data, 0, sizeof disk_info_data); + for (int dr = MAX_FLOPPY_DRIVES - 1; dr >= 0; dr--) { + reset_drive (dr); + } } -static void load_track(int num, int cyl, int side, int* sectable) +static void load_track (int num, int cyl, int side, int *sectable) { int oldcyl, oldside, drvsec; - drive* drv = &floppy[num]; + drive *drv = &floppy[num]; oldcyl = drv->cyl; oldside = side; drv->cyl = cyl; side = 0; drv->buffered_cyl = -1; - drive_fill_bigbuf(drv, 1); - decode_buffer(drv->bigmfmbuf, drv->cyl, 11, drv->ddhd, drv->filetype, &drvsec, sectable, 1); + drive_fill_bigbuf (drv, 1); + decode_buffer (drv->bigmfmbuf, drv->cyl, 11, drv->ddhd, drv->filetype, &drvsec, sectable, 1); drv->cyl = oldcyl; side = oldside; drv->buffered_cyl = -1; } -int DISK_examine_image(struct uae_prefs* p, int num, struct diskinfo* di) +int DISK_examine_image (struct uae_prefs *p, int num, struct diskinfo *di) { - int drvsec; - int ret, i; - drive* drv = &floppy[num]; - uae_u32 dos, crc, crc2; - int wasdelayed = drv->dskchange_time; - int sectable[MAX_SECTORS]; + int drvsec; + int ret, i; + drive *drv = &floppy[num]; + uae_u32 dos, crc, crc2; + int wasdelayed = drv->dskchange_time; + int sectable[MAX_SECTORS]; int oldcyl, oldside; - uae_u32 v; + uae_u32 v = 0; - ret = 0; - memset(di, 0, sizeof (struct diskinfo)); + ret = 0; + memset (di, 0, sizeof (struct diskinfo)); di->unreadable = true; oldcyl = drv->cyl; oldside = side; - drv->cyl = 0; - side = 0; - if (!drive_insert(drv, p, num, p->floppyslots[num].df, true, true) || !drv->diskfile) - { + drv->cyl = 0; + side = 0; + if (!drive_insert (drv, p, num, p->floppyslots[num].df, true, true) || !drv->diskfile) { drv->cyl = oldcyl; side = oldside; - return 1; + return 1; } - di->crc32 = zfile_crc32(drv->diskfile); + di->crc32 = zfile_crc32 (drv->diskfile); di->unreadable = false; - decode_buffer(drv->bigmfmbuf, drv->cyl, 11, drv->ddhd, drv->filetype, &drvsec, sectable, 1); - di->hd = drvsec == 22; + decode_buffer (drv->bigmfmbuf, drv->cyl, 11, drv->ddhd, drv->filetype, &drvsec, sectable, 1); + di->hd = drv->ddhd == 2; drv->cyl = oldcyl; side = oldside; - if (sectable[0] == 0 || sectable[1] == 0) - { - ret = 2; + if (sectable[0] == 0 || sectable[1] == 0) { + ret = 2; goto end2; - } - crc = crc2 = 0; - for (i = 0; i < 1024; i += 4) - { + } + crc = crc2 = 0; + for (i = 0; i < 1024; i += 4) { di->bootblock[i + 0] = writebuffer[i + 0]; di->bootblock[i + 1] = writebuffer[i + 1]; di->bootblock[i + 2] = writebuffer[i + 2]; di->bootblock[i + 3] = writebuffer[i + 3]; - v = (writebuffer[i] << 24) | (writebuffer[i + 1] << 16) | (writebuffer[i + 2] << 8) | writebuffer[i + 3]; - if (i == 0) - dos = v; - if (i == 4) - { - crc2 = v; - v = 0; - } - if (crc + v < crc) - crc++; - crc += v; - } - if (dos == 0x4b49434b) - { /* KICK */ - ret = 10; - goto end; - } - crc ^= 0xffffffff; - if (crc != crc2) - { - ret = 3; - goto end; - } + v = (writebuffer[i] << 24) | (writebuffer[i + 1] << 16) | (writebuffer[i + 2] << 8) | writebuffer[i + 3]; + if (i == 0) + dos = v; + if (i == 4) { + crc2 = v; + v = 0; + } + if (crc + v < crc) + crc++; + crc += v; + } + if (dos == 0x4b49434b) { /* KICK */ + ret = 10; + goto end; + } + crc ^= 0xffffffff; + if (crc != crc2) { + ret = 3; + goto end; + } di->bb_crc_valid = true; writebuffer[4] = writebuffer[5] = writebuffer[6] = writebuffer[7] = 0; - if (get_crc32(writebuffer, 0x31) == 0xae5e282c) - { + if (get_crc32 (writebuffer, 0x31) == 0xae5e282c) { di->bootblocktype = 1; } - if (dos == 0x444f5300) - ret = 10; - else if (dos == 0x444f5301 || dos == 0x444f5302 || dos == 0x444f5303) - ret = 11; - else if (dos == 0x444f5304 || dos == 0x444f5305 || dos == 0x444f5306 || dos == 0x444f5307) - ret = 12; - else - ret = 4; - v = get_crc32(writebuffer + 8, 0x5c - 8); - if (ret >= 10 && v == 0xe158ca4b) - { + if (dos == 0x444f5300) + ret = 10; + else if (dos == 0x444f5301 || dos == 0x444f5302 || dos == 0x444f5303) + ret = 11; + else if (dos == 0x444f5304 || dos == 0x444f5305 || dos == 0x444f5306 || dos == 0x444f5307) + ret = 12; + else + ret = 4; + v = get_crc32 (writebuffer + 8, 0x5c - 8); + if (ret >= 10 && v == 0xe158ca4b) { di->bootblocktype = 2; } end: - load_track(num, 40, 0, sectable); - if (sectable[0]) - { - if (!disk_checksum(writebuffer, nullptr) && + load_track (num, 40, 0, sectable); + if (sectable[0]) { + if (!disk_checksum (writebuffer, NULL) && writebuffer[0] == 0 && writebuffer[1] == 0 && writebuffer[2] == 0 && writebuffer[3] == 2 && - writebuffer[508] == 0 && writebuffer[509] == 0 && writebuffer[510] == 0 && writebuffer[511] == 1) - { + writebuffer[508] == 0 && writebuffer[509] == 0 && writebuffer[510] == 0 && writebuffer[511] == 1) { writebuffer[512 - 20 * 4 + 1 + writebuffer[512 - 20 * 4]] = 0; - TCHAR* n = au(reinterpret_cast(writebuffer + 512 - 20 * 4 + 1)); + TCHAR *n = au ((const char*)(writebuffer + 512 - 20 * 4 + 1)); if (_tcslen (n) >= sizeof (di->diskname)) n[sizeof (di->diskname) - 1] = 0; _tcscpy (di->diskname, n); @@ -4202,179 +3685,165 @@ end: } } end2: - drive_image_free(drv); - if (wasdelayed > 1) - { - drive_eject(drv); - currprefs.floppyslots[num].df[0] = 0; - drv->dskchange_time = wasdelayed; - disk_insert(num, drv->newname); - } - return ret; + drive_image_free (drv); + if (wasdelayed > 1) { + drive_eject (drv); + currprefs.floppyslots[num].df[0] = 0; + drv->dskchange_time = wasdelayed; + disk_insert (num, drv->newname); + } + return ret; } /* Disk save/restore code */ -#if defined SAVESTATE || defined DEBUGGER +#if defined SAVESTATE -void DISK_save_custom(uae_u32* pdskpt, uae_u16* pdsklength, uae_u16* pdsksync, uae_u16* pdskbytr) +void DISK_save_custom (uae_u32 *pdskpt, uae_u16 *pdsklength, uae_u16 *pdsksync, uae_u16 *pdskbytr) { - if (pdskpt) - *pdskpt = dskpt; - if (pdsklength) - *pdsklength = dsklen; - if (pdsksync) - *pdsksync = dsksync; - if (pdskbytr) - *pdskbytr = dskbytr_val; + if (pdskpt) + *pdskpt = dskpt; + if (pdsklength) + *pdsklength = dsklen; + if (pdsksync) + *pdsksync = dsksync; + if(pdskbytr) + *pdskbytr = dskbytr_val; } -#endif /* SAVESTATE || DEBUGGER */ +#endif /* SAVESTATE */ -static uae_u32 getadfcrc(drive* drv) +static uae_u32 getadfcrc (drive *drv) { - uae_u8* b; + uae_u8 *b; uae_u32 crc32; int size; if (!drv->diskfile) return 0; - zfile_fseek(drv->diskfile, 0, SEEK_END); - size = zfile_ftell(drv->diskfile); + zfile_fseek (drv->diskfile, 0, SEEK_END); + size = zfile_ftell (drv->diskfile); b = xmalloc (uae_u8, size); if (!b) return 0; - zfile_fseek(drv->diskfile, 0, SEEK_SET); - zfile_fread(b, 1, size, drv->diskfile); - crc32 = get_crc32(b, size); - free(b); + zfile_fseek (drv->diskfile, 0, SEEK_SET); + zfile_fread (b, 1, size, drv->diskfile); + crc32 = get_crc32 (b, size); + free (b); return crc32; } #ifdef SAVESTATE -void DISK_restore_custom(uae_u32 pdskpt, uae_u16 pdsklength, uae_u16 pdskbytr) +void DISK_restore_custom (uae_u32 pdskpt, uae_u16 pdsklength, uae_u16 pdskbytr) { - dskpt = pdskpt; - dsklen = pdsklength; - dskbytr_val = pdskbytr; + dskpt = pdskpt; + dsklen = pdsklength; + dskbytr_val = pdskbytr; } -void restore_disk_finish() +void restore_disk_finish (void) { int cnt = 0; - for (int i = 0; i < MAX_FLOPPY_DRIVES; i++) - { - if (currprefs.floppyslots[i].dfxtype >= 0) - { - update_drive_gui(i, true); + for (int i = 0; i < MAX_FLOPPY_DRIVES; i++) { + if (currprefs.floppyslots[i].dfxtype >= 0) { + update_drive_gui (i, true); cnt++; } } currprefs.nr_floppies = changed_prefs.nr_floppies = cnt; - DISK_check_change(); - setamax(); + DISK_check_change (); } -uae_u8* restore_disk(int num, uae_u8* src) +uae_u8 *restore_disk(int num,uae_u8 *src) { - drive* drv; - int state, dfxtype; - TCHAR old[MAX_DPATH]; - TCHAR* s; - int newis; + drive *drv; + int state; + TCHAR old[MAX_DPATH]; + TCHAR *s; + int newis; + drive_type dfxtype; - drv = &floppy[num]; - disabled &= ~(1 << num); - drv->drive_id = restore_u32 (); - drv->motoroff = true; - drv->idbit = 0; - state = restore_u8 (); - if (state & 2) - { - disabled |= 1 << num; - if (changed_prefs.nr_floppies > num) - changed_prefs.nr_floppies = num; - changed_prefs.floppyslots[num].dfxtype = -1; - } - else - { - drv->motoroff = (state & 1) ? 0 : 1; + drv = &floppy[num]; + disabled &= ~(1 << num); + drv->drive_id = restore_u32 (); + drv->motoroff = 1; + drv->idbit = 0; + state = restore_u8 (); + if (state & 2) { + disabled |= 1 << num; + if (changed_prefs.nr_floppies > num) + changed_prefs.nr_floppies = num; + changed_prefs.floppyslots[num].dfxtype = -1; + } else { + drv->motoroff = (state & 1) ? 0 : 1; drv->idbit = (state & 4) ? 1 : 0; - switch (drv->drive_id) - { - case DRIVE_ID_35HD: - dfxtype = DRV_35_HD; - break; - case DRIVE_ID_525SD: - dfxtype = DRV_525_SD; - break; - default: - dfxtype = DRV_35_DD; - break; - } - currprefs.floppyslots[num].dfxtype = changed_prefs.floppyslots[num].dfxtype = dfxtype; + switch (drv->drive_id) + { + case DRIVE_ID_35HD: + dfxtype = DRV_35_HD; + break; + case DRIVE_ID_525SD: + dfxtype = DRV_525_SD; + break; + default: + dfxtype = DRV_35_DD; + break; + } + currprefs.floppyslots[num].dfxtype = changed_prefs.floppyslots[num].dfxtype = dfxtype; } drv->dskchange = (state & 8) != 0; - side = (state & 16) ? 1 : 0; - drv->indexhackmode = 0; - if (num == 0 && currprefs.floppyslots[num].dfxtype == 0) - drv->indexhackmode = 1; - drv->buffered_cyl = -1; - drv->buffered_side = -1; - drv->cyl = restore_u8 (); - drv->dskready = restore_u8 () != 0; - drv->drive_id_scnt = restore_u8 (); - int mfmpos = restore_u32 (); - drv->dskchange_time = 0; - restore_u32 (); - s = restore_path (SAVESTATE_PATH_FLOPPY); - _tcscpy (old, currprefs.floppyslots[num].df); - _tcsncpy(changed_prefs.floppyslots[num].df, s,255); - xfree (s); - int dskready_up_time = restore_u16 (); - int dskready_down_time = restore_u16 (); - newis = changed_prefs.floppyslots[num].df[0] ? 1 : 0; - if (!(disabled & (1 << num))) - { - if (!newis && old[0]) - { + side = (state & 16) ? 1 : 0; + drv->indexhackmode = 0; + if (num == 0 && currprefs.floppyslots[num].dfxtype == 0) + drv->indexhackmode = 1; + drv->buffered_cyl = -1; + drv->buffered_side = -1; + drv->cyl = restore_u8 (); + drv->dskready = restore_u8 () != 0; + drv->drive_id_scnt = restore_u8 (); + int mfmpos = restore_u32 (); + drv->dskchange_time = 0; + restore_u32 (); + s = restore_path (SAVESTATE_PATH_FLOPPY); + _tcscpy (old, currprefs.floppyslots[num].df); + _tcsncpy(changed_prefs.floppyslots[num].df, s,255); + xfree (s); + int dskready_up_time = restore_u16 (); + int dskready_down_time = restore_u16 (); + newis = changed_prefs.floppyslots[num].df[0] ? 1 : 0; + if (!(disabled & (1 << num))) { + if (!newis && old[0]) { *currprefs.floppyslots[num].df = *changed_prefs.floppyslots[num].df = 0; drv->dskchange = false; - } - else if (newis) - { - drive_insert(floppy + num, &currprefs, num, changed_prefs.floppyslots[num].df, false, false); - if (drive_empty(floppy + num)) - { - if (newis && old[0]) - { - _tcscpy (changed_prefs.floppyslots[num].df, old); - drive_insert(floppy + num, &currprefs, num, changed_prefs.floppyslots[num].df, false, false); - if (drive_empty(floppy + num)) + } else if (newis) { + drive_insert (floppy + num, &currprefs, num, changed_prefs.floppyslots[num].df, false, false); + if (drive_empty (floppy + num)) { + if (newis && old[0]) { + _tcscpy (changed_prefs.floppyslots[num].df, old); + drive_insert (floppy + num, &currprefs, num, changed_prefs.floppyslots[num].df, false, false); + if (drive_empty (floppy + num)) drv->dskchange = true; - } - else - { + } else { drv->dskchange_time = -1; - } - } - } - } + _tcscpy(drv->newname, changed_prefs.floppyslots[num].df); + } + } + } + } drv->mfmpos = mfmpos; drv->prevtracklen = drv->tracklen; drv->dskready_up_time = dskready_up_time; drv->dskready_down_time = dskready_down_time; - reset_drive_gui(num); - return src; + reset_drive_gui(num); + return src; } -uae_u8* restore_disk2(int num, uae_u8* src) +uae_u8 *restore_disk2 (int num,uae_u8 *src) { - drive* drv = &floppy[num]; + drive *drv = &floppy[num]; uae_u32 m = restore_u32 (); - if (m) - { + if (m) { drv->floppybitcounter = restore_u16 (); drv->tracklen = restore_u32 (); drv->trackspeed = restore_u16 (); @@ -4382,33 +3851,32 @@ uae_u8* restore_disk2(int num, uae_u8* src) drv->indexoffset = restore_u32 (); drv->buffered_cyl = drv->cyl; drv->buffered_side = side; - for (int j = 0; j < (drv->tracklen + 15) / 16; j++) - { + for (int j = 0; j < (drv->tracklen + 15) / 16; j++) { drv->bigmfmbuf[j] = restore_u16 (); if (m & 2) drv->tracktiming[j] = restore_u16 (); } drv->revolutions = restore_u16 (); } - return src; + return src; } -uae_u8* save_disk(int num, int* len, uae_u8* dstptr, bool usepath) +uae_u8 *save_disk (int num, int *len, uae_u8 *dstptr, bool usepath) { - uae_u8 *dstbak, *dst; - drive* drv = &floppy[num]; + uae_u8 *dstbak,*dst; + drive *drv = &floppy[num]; - if (dstptr) - dstbak = dst = dstptr; - else - dstbak = dst = xmalloc (uae_u8, 2 + 1 + 1 + 1 + 1 + 4 + 4 + 256); - save_u32 (drv->drive_id); /* drive type ID */ + if (dstptr) + dstbak = dst = dstptr; + else + dstbak = dst = xmalloc (uae_u8, 2 + 1 + 1 + 1 + 1 + 4 + 4 + 256); + save_u32 (drv->drive_id); /* drive type ID */ save_u8 ((drv->motoroff ? 0 : 1) | ((disabled & (1 << num)) ? 2 : 0) | (drv->idbit ? 4 : 0) | (drv->dskchange ? 8 : 0) | (side ? 16 : 0) | (drv->wrprot ? 32 : 0)); - save_u8 (drv->cyl); /* cylinder */ - save_u8 (drv->dskready); /* dskready */ - save_u8 (drv->drive_id_scnt); /* id mode position */ - save_u32 (drv->mfmpos); /* disk position */ - save_u32 (getadfcrc (drv)); /* CRC of disk image */ + save_u8 (drv->cyl); /* cylinder */ + save_u8 (drv->dskready); /* dskready */ + save_u8 (drv->drive_id_scnt); /* id mode position */ + save_u32 (drv->mfmpos); /* disk position */ + save_u32 (getadfcrc (drv)); /* CRC of disk image */ save_path (usepath ? currprefs.floppyslots[num].df : _T(""), SAVESTATE_PATH_FLOPPY);/* image name */ save_u16 (drv->dskready_up_time); save_u16 (drv->dskready_down_time); @@ -4416,27 +3884,26 @@ uae_u8* save_disk(int num, int* len, uae_u8* dstptr, bool usepath) return dstbak; } -uae_u8* save_disk2(int num, int* len, uae_u8* dstptr) +uae_u8 *save_disk2 (int num, int *len, uae_u8 *dstptr) { - uae_u8 *dstbak, *dst; - drive* drv = &floppy[num]; + uae_u8 *dstbak,*dst; + drive *drv = &floppy[num]; int m = 0; int size = 0; - if (drv->motoroff == 0 && drv->buffered_side >= 0 && drv->tracklen > 0) - { + if (drv->motoroff == 0 && drv->buffered_side >= 0 && drv->tracklen > 0) { m = 1; if (drv->tracktiming[0]) m |= 2; size += ((drv->tracklen + 15) * 2) / 8; } if (!m) - return nullptr; + return NULL; if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = xmalloc(uae_u8, 2 + 4 + 2 + 4 + 4 + size); + dstbak = dst = xmalloc (uae_u8, 4 + 2 + 4 + 2 + 4 + 4 + size + 2); save_u32 (m); save_u16 (drv->floppybitcounter); @@ -4444,29 +3911,27 @@ uae_u8* save_disk2(int num, int* len, uae_u8* dstptr) save_u16 (drv->trackspeed); save_u32 (drv->skipoffset); save_u32 (drv->indexoffset); - for (int j = 0; j < (drv->tracklen + 15) / 16; j++) - { + for (int j = 0; j < (drv->tracklen + 15) / 16; j++) { save_u16 (drv->bigmfmbuf[j]); if (drv->tracktiming[0]) save_u16 (drv->tracktiming[j]); } save_u16 (drv->revolutions); - *len = dst - dstbak; - return dstbak; + *len = dst - dstbak; + return dstbak; } /* internal floppy controller variables */ -uae_u8* restore_floppy(uae_u8* src) +uae_u8 *restore_floppy(uae_u8 *src) { - word = restore_u16(); - bitoffset = restore_u8(); - dma_enable = restore_u8(); + word = restore_u16(); + bitoffset = restore_u8(); + dma_enable = restore_u8(); disk_hpos = restore_u8 () & 0xff; - dskdmaen = restore_u8(); - for (int i = 0; i < 3; i++) - { + dskdmaen = restore_u8(); + for (int i = 0; i < 3; i++) { fifo[i] = restore_u16 (); fifo_inuse[i] = restore_u8 (); if (dskdmaen == 0) @@ -4474,212 +3939,30 @@ uae_u8* restore_floppy(uae_u8* src) } fifo_filled = fifo_inuse[0] || fifo_inuse[1] || fifo_inuse[2]; dsklength = restore_u16 (); - return src; + return src; } -uae_u8* save_floppy(int* len, uae_u8* dstptr) +uae_u8 *save_floppy(int *len, uae_u8 *dstptr) { - uae_u8 *dstbak, *dst; + uae_u8 *dstbak, *dst; - if (dstptr) - dstbak = dst = dstptr; - else + if (dstptr) + dstbak = dst = dstptr; + else dstbak = dst = xmalloc (uae_u8, 100); - save_u16 (word); /* shift register */ - save_u8 (bitoffset); /* dma bit offset */ - save_u8 (dma_enable); /* disk sync found */ - save_u8 (disk_hpos & 0xff); /* next bit read position */ - save_u8 (dskdmaen); /* dma status */ - for (int i = 0; i < 3; i++) - { + save_u16 (word); /* shift register */ + save_u8 (bitoffset); /* dma bit offset */ + save_u8 (dma_enable); /* disk sync found */ + save_u8 (disk_hpos & 0xff); /* next bit read position */ + save_u8 (dskdmaen); /* dma status */ + for (int i = 0; i < 3; i++) { save_u16 (fifo[i]); save_u8 (fifo_inuse[i]); } save_u16 (dsklength); - *len = dst - dstbak; - return dstbak; + *len = dst - dstbak; + return dstbak; } #endif /* SAVESTATE */ - -#define MAX_DISKENTRIES 4 -int disk_prevnext_name(TCHAR *imgp, int dir) -{ - TCHAR img[MAX_DPATH], *ext, *p, *p2, *ps, *dst[MAX_DISKENTRIES]; - int num = -1; - int cnt, i; - TCHAR imgl[MAX_DPATH]; - int ret, gotone, wrapped; - TCHAR *old; - - old = my_strdup(imgp); - - struct zfile *zf = zfile_fopen(imgp, _T("rb"), ZFD_NORMAL); - if (zf) { - _tcscpy(img, zfile_getname(zf)); - zfile_fclose(zf); - zf = zfile_fopen(img, _T("rb"), ZFD_NORMAL); - if (!zf) // oops, no directory support in this archive type - _tcscpy(img, imgp); - zfile_fclose(zf); - } - else { - _tcscpy(img, imgp); - } - - wrapped = 0; -retry: - _tcscpy(imgl, img); - to_lower(imgl, sizeof imgl / sizeof(TCHAR)); - gotone = 0; - ret = 0; - ps = imgl; - cnt = 0; - dst[cnt] = nullptr; - for (;;) { - // disk x of y - p = _tcsstr(ps, _T("(disk ")); - if (p && _istdigit(p[6])) { - p2 = p - imgl + img; - num = _tstoi(p + 6); - dst[cnt++] = p2 + 6; - if (cnt >= MAX_DISKENTRIES - 1) - break; - gotone = 1; - ps = p + 6; - continue; - } - if (gotone) - break; - p = _tcsstr(ps, _T("disk")); - if (p && _istdigit(p[4])) { - p2 = p - imgl + img; - num = _tstoi(p + 4); - dst[cnt++] = p2 + 4; - if (cnt >= MAX_DISKENTRIES - 1) - break; - gotone = 1; - ps = p + 4; - continue; - } - if (gotone) - break; - ext = _tcsrchr(ps, '.'); - if (!ext || ext - ps < 4) - break; - TCHAR *ext2 = ext - imgl + img; - // name_x.ext - if (ext[-3] == '_' && !_istdigit(ext[-2]) && _istdigit(ext[-1])) { - num = _tstoi(ext - 1); - dst[cnt++] = ext2 - 1; - // name_x.ext, name-x.ext, name x.ext - } - else if ((ext[-2] == '_' || ext[-2] == '-' || ext[-2] == ' ') && _istdigit(ext[-1])) { - num = _tstoi(ext - 1); - dst[cnt++] = ext2 - 1; - // name_a.ext, name-a.ext, name a .ext - } - else if ((ext[-2] == '_' || ext[-2] == '-' || ext[-2] == ' ') && ext[-1] >= 'a' && ext[-1] <= 'z') { - num = ext[-1] - 'a' + 1; - dst[cnt++] = ext2 - 1; - // nameA.ext - } - else if (ext2[-2] >= 'a' && ext2[-2] <= 'z' && ext2[-1] >= 'A' && ext2[-1] <= 'Z') { - num = ext[-1] - 'a' + 1; - dst[cnt++] = ext2 - 1; - // namex.ext - } - else if (!_istdigit(ext2[-2]) && _istdigit(ext[-1])) { - num = ext[-1] - '0'; - dst[cnt++] = ext2 - 1; - } - break; - } - dst[cnt] = nullptr; - if (num <= 0 || num >= 19) - goto end; - num += dir; - if (num > 9) - goto end; - if (num == 9) - num = 1; - else if (num == 0) - num = 9; - for (i = 0; i < cnt; i++) { - if (!_istdigit(dst[i][0])) { - int capital = dst[i][0] >= 'A' && dst[i][0] <= 'Z'; - dst[i][0] = (num - 1) + (capital ? 'A' : 'a'); - } - else { - dst[i][0] = num + '0'; - } - } - if (zfile_exists(img)) { - ret = 1; - goto end; - } - if (gotone) { // was (disk x but no match, perhaps there are extra tags.. - TCHAR *old2 = my_strdup(img); - for (;;) { - ext = _tcsrchr(img, '.'); - if (!ext) - break; - if (ext == img) - break; - if (ext[-1] != ']') - break; - TCHAR *t = _tcsrchr(img, '['); - if (!t) - break; - t[0] = 0; - if (zfile_exists(img)) { - ret = 1; - goto end; - } - } - _tcscpy(img, old2); - xfree(old2); - } - if (!wrapped) { - for (i = 0; i < cnt; i++) { - if (!_istdigit(dst[i][0])) - dst[i][0] = dst[i][0] >= 'A' && dst[i][0] <= 'Z' ? 'A' : 'a'; - else - dst[i][0] = '1'; - if (dir < 0) - dst[i][0] += 8; - } - wrapped++; - } - if (zfile_exists(img)) { - ret = -1; - goto end; - } - if (dir < 0 && wrapped < 2) - goto retry; - _tcscpy(img, old); - -end: - _tcscpy(imgp, img); - xfree(old); - return ret; -} - -int disk_prevnext(int drive, int dir) -{ - TCHAR img[MAX_DPATH]; - - _tcscpy(img, currprefs.floppyslots[drive].df); - - if (!img[0]) - return 0; - disk_prevnext_name(img, dir); - _tcscpy(changed_prefs.floppyslots[drive].df, img); - return 1; -} - -int getdebug() -{ - return floppy[0].mfmpos; -} diff --git a/src/drawing.cpp b/src/drawing.cpp index 099c5729..6a7e2066 100644 --- a/src/drawing.cpp +++ b/src/drawing.cpp @@ -1,4 +1,4 @@ -/* + /* * UAE - The Un*x Amiga Emulator * * Screen drawing functions @@ -8,7 +8,6 @@ * Copyright 2000-2008 Toni Wilen */ - /* There are a couple of concepts of "coordinates" in this file. - DIW coordinates - DDF coordinates (essentially cycles, resolution lower than lores by a factor of 2) @@ -46,41 +45,40 @@ #include "drawing.h" #include "savestate.h" #include "statusline.h" -#include "amiberry_gfx.h" +#include "cd32_fmv.h" +#include "audio.h" +#include "devices.h" + +#define VERTICAL_OFFSET 18 + +#define RENDER_SIGNAL_PARTIAL 1 +#define RENDER_SIGNAL_FRAME_DONE 2 +#define RENDER_SIGNAL_QUIT 3 +static uae_thread_id render_tid = 0; +static smp_comm_pipe *volatile render_pipe = 0; +static uae_sem_t render_sem = 0; +static bool volatile render_thread_busy = false; extern int sprite_buffer_res; -static int lores_factor; int lores_shift; static void pfield_set_linetoscr(void); -int debug_bpl_mask = 0xff, debug_bpl_mask_one; - static void lores_set(int lores) { - int old = lores; + int old = lores_shift; lores_shift = lores; if (lores_shift != old) pfield_set_linetoscr(); } -static void lores_reset(void) +static void lores_reset (void) { - lores_factor = currprefs.gfx_resolution ? 2 : 1; lores_set(currprefs.gfx_resolution); - if (doublescan > 0) { - if (lores_shift < 2) - lores_shift++; - lores_factor = 2; - lores_set(lores_shift); - } sprite_buffer_res = currprefs.gfx_resolution; - if (doublescan > 0 && sprite_buffer_res < RES_SUPERHIRES) - sprite_buffer_res++; } bool aga_mode; /* mirror of chipset_mask & CSMASK_AGA */ -bool direct_rgb; /* The shift factor to apply when converting between Amiga coordinates and window coordinates. Zero if the resolution is the same, positive if window coordinates @@ -88,17 +86,9 @@ bool direct_rgb; coordinates have a lower resolution (i.e. we're shrinking the image). */ static int res_shift; -static int linedbl, linedbld; +static int linedbl; int interlace_seen; -int detected_screen_resolution; - -#define AUTO_LORES_FRAMES 10 -static int can_use_lores = 0, frame_res, frame_res_lace; -static int resolution_count[RES_MAX + 1], lines_count; -static bool center_reset; -static bool init_genlock_data; -bool need_genlock_data; /* Lookup tables for dual playfields. The dblpf_*1 versions are for the case that playfield 1 has the priority, dbplpf_*2 are used if playfield 2 has @@ -108,47 +98,39 @@ bool need_genlock_data; foreground being at bit offset 0, the one used if pf2 is in front being at offset 16. */ -static int dblpf_ms1[256], dblpf_ms2[256], dblpf_ms[256]; +static int dblpf_ms1[256], dblpf_ms2[256]; static int dblpf_ind1[256], dblpf_ind2[256]; static int dblpf_2nd1[256], dblpf_2nd2[256]; static const int dblpfofs[] = { 0, 2, 4, 8, 16, 32, 64, 128 }; -static int sprite_offs[256]; - +static int sprite_col_nat[65536]; +static int sprite_col_at[65536]; +static int sprite_bit[65536]; static uae_u32 clxtab[256]; /* Video buffer description structure. Filled in by the graphics system * dependent code. */ - struct vidbuf_description gfxvidinfo; /* OCS/ECS color lookup table. */ xcolnr xcolors[4096]; -struct spritepixelsbuf -{ +struct spritepixelsbuf { uae_u8 attach; uae_u8 stdata; uae_u16 data; }; - static struct spritepixelsbuf spritepixels_buffer[MAX_PIXELS_PER_LINE]; static struct spritepixelsbuf *spritepixels; static int sprite_first_x, sprite_last_x; -#ifdef AGA /* AGA mode color lookup tables */ +#ifndef ARMV6_ASSEMBLY unsigned int xredcolors[256], xgreencolors[256], xbluecolors[256]; -static int dblpf_ind1_aga[256], dblpf_ind2_aga[256]; -#else -static uae_u8 spriteagadpfpixels[1]; -static int dblpf_ind1_aga[1], dblpf_ind2_aga[1]; #endif -int xredcolor_s, xredcolor_b, xredcolor_m; -int xgreencolor_s, xgreencolor_b, xgreencolor_m; -int xbluecolor_s, xbluecolor_b, xbluecolor_m; +static int dblpf_ind1_aga[256], dblpf_ind2_aga[256]; struct color_entry colors_for_drawing; static struct color_entry direct_colors_for_drawing; @@ -157,553 +139,111 @@ static xcolnr *p_acolors; static xcolnr *p_xcolors; /* The size of these arrays is pretty arbitrary; it was chosen to be "more -than enough". The coordinates used for indexing into these arrays are -almost, but not quite, Amiga coordinates (there's a constant offset). */ -static union { - /* Let's try to align this thing. */ - double uupzuq; - long int cruxmedo; - uae_u8 apixels[MAX_PIXELS_PER_LINE * 2]; - uae_u16 apixels_w[MAX_PIXELS_PER_LINE * 2 / sizeof(uae_u16)]; - uae_u32 apixels_l[MAX_PIXELS_PER_LINE * 2 / sizeof(uae_u32)]; + than enough". The coordinates used for indexing into these arrays are + almost, but not quite, Amiga coordinates (there's a constant offset). */ +static union pixdata_u { + uae_u8 apixels[MAX_PIXELS_PER_LINE * 2]; + uae_u16 apixels_w[MAX_PIXELS_PER_LINE * 2 / sizeof (uae_u16)]; + uae_u32 apixels_l[MAX_PIXELS_PER_LINE * 2 / sizeof (uae_u32)]; } pixdata; -static uae_u8 *refresh_indicator_buffer; -static uae_u8 *refresh_indicator_changed, *refresh_indicator_changed_prev; -static int refresh_indicator_height; - uae_u16 spixels[2 * MAX_SPR_PIXELS]; /* Eight bits for every pixel. */ union sps_union spixstate; -static uae_u32 ham_linebuf[MAX_PIXELS_PER_LINE * 2]; -static uae_u8 *real_bplpt[8]; +static uae_u16 ham_linebuf[MAX_PIXELS_PER_LINE * 2]; -static uae_u8 all_ones[MAX_PIXELS_PER_LINE]; -static uae_u8 all_zeros[MAX_PIXELS_PER_LINE]; - -uae_u8 *xlinebuffer, *xlinebuffer_genlock; +static uae_u8 *xlinebuffer; static int *amiga2aspect_line_map, *native2amiga_line_map; static uae_u8 **row_map; -static uae_u8 *row_map_genlock_buffer; static uae_u8 row_tmp[MAX_PIXELS_PER_LINE * 32 / 8]; static int max_drawn_amiga_line; -uae_u8 **row_map_genlock; -uae_u8 *row_map_color_burst_buffer; /* line_draw_funcs: pfield_do_linetoscr, pfield_do_fill_line, decode_ham */ -typedef void(*line_draw_func)(int, int, bool); +typedef void (*line_draw_func)(int, int, bool); -#define LINE_UNDECIDED 1 -#define LINE_DECIDED 2 -#define LINE_DECIDED_DOUBLE 3 -#define LINE_AS_PREVIOUS 4 -#define LINE_BLACK 5 -#define LINE_REMEMBERED_AS_BLACK 6 -#define LINE_DONE 7 -#define LINE_DONE_AS_PREVIOUS 8 -#define LINE_REMEMBERED_AS_PREVIOUS 9 - -#define LINESTATE_SIZE ((MAXVPOS + 2) * 2 + 1) - -static uae_u8 linestate[LINESTATE_SIZE]; +static bool screenlocked = false; +static int next_line_to_render = 0; +static int linestate_first_undecided = 0; +static bool nextline_as_previous = false; uae_u8 line_data[(MAXVPOS + 2) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2]; -/* Centering variables. */ -static int min_diwstart, max_diwstop; /* The visible window: VISIBLE_LEFT_BORDER contains the left border of the visible -area, VISIBLE_RIGHT_BORDER the right border. These are in window coordinates. */ -int visible_left_border, visible_right_border; -/* Pixels outside of visible_start and visible_stop are always black */ -static int visible_left_start, visible_right_stop; -static int visible_top_start, visible_bottom_stop; -/* same for hblank */ -static int hblank_left_start, hblank_right_stop; + area, VISIBLE_RIGHT_BORDER the right border. These are in window coordinates. */ +static int visible_left_border, visible_right_border; static int linetoscr_x_adjust_pixbytes, linetoscr_x_adjust_pixels; static int thisframe_y_adjust; static int thisframe_y_adjust_real, max_ypos_thisframe, min_ypos_for_screen; -int thisframe_first_drawn_line, thisframe_last_drawn_line; - -/* A frame counter that forces a redraw after at least one skipped frame in -interlace mode. */ -static int last_redraw_point; #define MAX_STOP 30000 -static int first_drawn_line, last_drawn_line; -static int first_block_line, last_block_line; - -#define NO_BLOCK -3 /* These are generated by the drawing code from the line_decisions array for -each line that needs to be drawn. These are basically extracted out of -bit fields in the hardware registers. */ + each line that needs to be drawn. These are basically extracted out of + bit fields in the hardware registers. */ static int bplehb, bplham, bpldualpf, bpldualpfpri, bpldualpf2of, bplplanecnt, ecsshres; -static int bplbypass, bplcolorburst, bplcolorburst_field; -static bool issprites; +static int bplbypass; static int bplres; -static int plf1pri, plf2pri, bplxor, bpland, bpldelay_sh; +static int plf1pri, plf2pri, bplxor, bpland; static uae_u32 plf_sprite_mask; +static uae_u32 plf_sprite_mask_n16; static int sbasecol[2] = { 16, 16 }; static int hposblank; -static bool specialmonitoron; -static bool ecs_genlock_features_active; -static uae_u8 ecs_genlock_features_mask; -static bool ecs_genlock_features_colorkey; -static int hsync_shift_hack; bool picasso_requested_on, picasso_requested_forced_on, picasso_on; int inhibit_frame; -int framecnt; -int custom_frame_redraw_necessary; -static int frame_redraw_necessary; -static int picasso_redraw_necessary; +int framecnt = 0; -/* Calculate idle time (time to wait for vsync) */ -int idletime_percent = 0; - -#define xlinecheck(start, end) - -static void clearbuffer(struct vidbuffer *dst) +STATIC_INLINE void count_frame (void) { - if (!dst->bufmem_allocated) - return; - uae_u8 *p = dst->bufmem_allocated; - for (int y = 0; y < dst->height_allocated; y++) { - memset(p, 0, dst->width_allocated * dst->pixbytes); - p += dst->rowbytes; - } -} - -static void reset_decision_table(void) -{ - for (int i = 0; i < sizeof linestate / sizeof *linestate; i++) { - linestate[i] = LINE_UNDECIDED; - } -} - -STATIC_INLINE void count_frame() -{ - framecnt++; - if (framecnt > currprefs.gfx_framerate) + framecnt++; + if (framecnt > currprefs.gfx_framerate) framecnt = 0; - if (inhibit_frame) - framecnt = 1; + if (inhibit_frame) + framecnt = 1; } -STATIC_INLINE int xshift(int x, int shift) +STATIC_INLINE int xshift (int x, int shift) { - if (shift < 0) - return x >> (-shift); - return x << shift; + if (shift < 0) + return x >> (-shift); + else + return x << shift; } -int coord_native_to_amiga_x(int x) +int coord_native_to_amiga_x (int x) { - x += visible_left_border; - x = xshift(x, 1 - lores_shift); - return x + 2 * DISPLAY_LEFT_SHIFT - 2 * DIW_DDF_OFFSET; + x += visible_left_border; + x = xshift (x, 1 - lores_shift); + return x + 2*DISPLAY_LEFT_SHIFT - 2*DIW_DDF_OFFSET; } -int coord_native_to_amiga_y(int y) +int coord_native_to_amiga_y (int y) { return native2amiga_line_map[y] + thisframe_y_adjust - minfirstline; } -STATIC_INLINE int res_shift_from_window(int x) +STATIC_INLINE int res_shift_from_window (int x) { - if (res_shift >= 0) + if (res_shift >= 0) return x >> res_shift; - return x << -res_shift; + return x << -res_shift; } -STATIC_INLINE int res_shift_from_amiga(int x) +STATIC_INLINE int res_shift_from_amiga (int x) { - if (res_shift >= 0) + if (res_shift >= 0) return x >> res_shift; - return x << -res_shift; + return x << -res_shift; } -void notice_screen_contents_lost(void) -{ - picasso_redraw_necessary = 1; - frame_redraw_necessary = 2; -} - -bool isnativevidbuf(void) -{ - // we always use the SDL surface as the drawbuffer - return true; -} - -extern int plffirstline_total, plflastline_total; -extern int first_planes_vpos, last_planes_vpos; -extern int diwfirstword_total, diwlastword_total; -extern int ddffirstword_total, ddflastword_total; -extern bool vertical_changed, horizontal_changed; -extern int firstword_bplcon1; -extern int lof_store; - -#define MIN_DISPLAY_W 256 -#define MIN_DISPLAY_H 192 -#define MAX_DISPLAY_W 362 -#define MAX_DISPLAY_H 283 - -static int gclow, gcloh, gclox, gcloy, gclorealh; -static int stored_left_start, stored_top_start, stored_width, stored_height; - -void get_custom_topedge(int *xp, int *yp, bool max) -{ - if (isnativevidbuf() && !max) { - int x, y; - x = visible_left_border + (DISPLAY_LEFT_SHIFT << currprefs.gfx_resolution); - y = minfirstline << currprefs.gfx_vresolution; - - *xp = x; - *yp = y; - } - else { - *xp = 0; - *yp = 0; - } -} - -static void reset_custom_limits(void) -{ - gclow = gcloh = gclox = gcloy = 0; - gclorealh = -1; - center_reset = true; -} - -static void set_blanking_limits(void) -{ - hblank_left_start = visible_left_start; - hblank_right_stop = visible_right_stop; - - //if (programmedmode) { - // if (hblank_left_start < coord_hw_to_window_x(hsyncendpos * 2)) - // hblank_left_start = coord_hw_to_window_x(hsyncendpos * 2); - // if (hblank_right_stop > coord_hw_to_window_x(hsyncstartpos * 2)) - // hblank_right_stop = coord_hw_to_window_x(hsyncstartpos * 2); - //} -} - -void get_custom_raw_limits(int *pw, int *ph, int *pdx, int *pdy) -{ - if (stored_width > 0) { - *pw = stored_width; - *ph = stored_height; - *pdx = stored_left_start; - *pdy = stored_top_start; - } - else { - int x = visible_left_border; - if (x < visible_left_start) - x = visible_left_start; - *pdx = x; - int x2 = visible_right_border; - if (x2 > visible_right_stop) - x2 = visible_right_stop; - *pw = x2 - x; - int y = min_ypos_for_screen; - if (y < visible_top_start) - y = visible_top_start; - *pdy = y; - int y2 = max_ypos_thisframe; - if (y2 > visible_bottom_stop) - y2 = visible_bottom_stop; - *ph = y2 - y; - } -} - -void set_custom_limits(int w, int h, int dx, int dy) -{ - int vls = visible_left_start; - int vrs = visible_right_stop; - int vts = visible_top_start; - int vbs = visible_bottom_stop; - - if (w <= 0 || dx < 0) { - visible_left_start = 0; - visible_right_stop = MAX_STOP; - } - else { - visible_left_start = visible_left_border + dx; - visible_right_stop = visible_left_start + w; - } - if (h <= 0 || dy < 0) { - visible_top_start = 0; - visible_bottom_stop = MAX_STOP; - } - else { - visible_top_start = min_ypos_for_screen + dy; - visible_bottom_stop = visible_top_start + h; - } - if (vls != visible_left_start || vrs != visible_right_stop || - vts != visible_top_start || vbs != visible_bottom_stop) - notice_screen_contents_lost(); - - set_blanking_limits(); -} - -void store_custom_limits(int w, int h, int x, int y) -{ - stored_left_start = x; - stored_top_start = y; - stored_width = w; - stored_height = h; -} - -int get_custom_limits(int *pw, int *ph, int *pdx, int *pdy, int *prealh) -{ - int w, h, dx, dy, y1, y2, dbl1, dbl2; - int ret = 0; - - if (!pw || !ph || !pdx || !pdy) { - reset_custom_limits(); - return 0; - } - - if (!isnativevidbuf()) { - *pw = gfxvidinfo.outwidth; - *ph = gfxvidinfo.outheight; - *pdx = 0; - *pdy = 0; - *prealh = -1; - return 1; - } - - *pw = gclow; - *ph = gcloh; - *pdx = gclox; - *pdy = gcloy; - *prealh = gclorealh; - - if (gclow > 0 && gcloh > 0) - ret = -1; - - if (interlace_seen) { - static int interlace_count; - // interlace = only use long frames - if (lof_store && (interlace_count & 1) == 0) - interlace_count++; - if (!lof_store && (interlace_count & 1) != 0) - interlace_count++; - if (interlace_count < 3) - return ret; - if (!lof_store) - return ret; - interlace_count = 0; - /* program may have set last visible line as last possible line (CD32 boot screen) */ - if (last_planes_vpos < maxvpos) - last_planes_vpos++; - if (plflastline_total < maxvpos) - plflastline_total++; - } - - if (plflastline_total < 4) - plflastline_total = last_planes_vpos; - - ddffirstword_total = coord_hw_to_window_x(ddffirstword_total * 2 + DIW_DDF_OFFSET); - ddflastword_total = coord_hw_to_window_x(ddflastword_total * 2 + DIW_DDF_OFFSET); - - if (doublescan <= 0 && !programmedmode) { - int min = coord_diw_to_window_x(92); - int max = coord_diw_to_window_x(460); - if (diwfirstword_total < min) - diwfirstword_total = min; - if (diwlastword_total > max) - diwlastword_total = max; - if (ddffirstword_total < min) - ddffirstword_total = min; - if (ddflastword_total > max) - ddflastword_total = max; - } - - w = diwlastword_total - diwfirstword_total; - dx = diwfirstword_total - visible_left_border; - - y2 = plflastline_total; - if (y2 > last_planes_vpos) - y2 = last_planes_vpos; - y1 = plffirstline_total; - if (first_planes_vpos > y1) - y1 = first_planes_vpos; - if (minfirstline > y1) - y1 = minfirstline; - - dbl2 = dbl1 = currprefs.gfx_vresolution; - if (doublescan > 0 && interlace_seen <= 0) { - dbl1--; - dbl2--; - } - - h = y2 - y1; - dy = y1 - minfirstline; - - if (first_planes_vpos == 0) { - // no planes enabled during frame - if (ret < 0) - return 1; - h = currprefs.ntscmode ? 200 : 240; - w = 320 << currprefs.gfx_resolution; - dy = 36 / 2; - dx = 58; - } - - if (dx < 0) - dx = 0; - - *prealh = -1; - if (!programmedmode && first_planes_vpos) { - int th = (maxvpos - minfirstline) * 95 / 100; - if (th > h) { - th = xshift(th, dbl1); - *prealh = th; - } - } - - dy = xshift(dy, dbl2); - h = xshift(h, dbl1); - - if (w == 0 || h == 0) - return 0; - - if (doublescan <= 0 && !programmedmode) { - if ((w >> currprefs.gfx_resolution) < MIN_DISPLAY_W) { - dx += (w - (MIN_DISPLAY_W << currprefs.gfx_resolution)) / 2; - w = MIN_DISPLAY_W << currprefs.gfx_resolution; - } - if ((h >> dbl1) < MIN_DISPLAY_H) { - dy += (h - (MIN_DISPLAY_H << dbl1)) / 2; - h = MIN_DISPLAY_H << dbl1; - } - if ((w >> currprefs.gfx_resolution) > MAX_DISPLAY_W) { - dx += (w - (MAX_DISPLAY_W << currprefs.gfx_resolution)) / 2; - w = MAX_DISPLAY_W << currprefs.gfx_resolution; - } - if ((h >> dbl1) > MAX_DISPLAY_H) { - dy += (h - (MAX_DISPLAY_H << dbl1)) / 2; - h = MAX_DISPLAY_H << dbl1; - } - } - - if (gclow == w && gcloh == h && gclox == dx && gcloy == dy) - return ret; - - if (w <= 0 || h <= 0 || dx < 0 || dy < 0) - return ret; - if (doublescan <= 0 && !programmedmode) { - if (dx > gfxvidinfo.outwidth / 3) - return ret; - if (dy > gfxvidinfo.outheight / 3) - return ret; - } - - gclow = w; - gcloh = h; - gclox = dx; - gcloy = dy; - gclorealh = *prealh; - *pw = w; - *ph = h; - *pdx = dx; - *pdy = dy; -#if 1 - write_log(_T("Display Size: %dx%d Offset: %dx%d\n"), w, h, dx, dy); - write_log(_T("First: %d Last: %d MinV: %d MaxV: %d Min: %d\n"), - plffirstline_total, plflastline_total, - first_planes_vpos, last_planes_vpos, minfirstline); -#endif - center_reset = true; - return 1; -} - -void get_custom_mouse_limits(int *pw, int *ph, int *pdx, int *pdy, int dbl) -{ - int delay1, delay2; - int w, h, dx, dy, dbl1, dbl2, y1, y2; - - w = diwlastword_total - diwfirstword_total; - dx = diwfirstword_total - visible_left_border; - - y2 = plflastline_total; - if (y2 > last_planes_vpos) - y2 = last_planes_vpos; - y1 = plffirstline_total; - if (first_planes_vpos > y1) - y1 = first_planes_vpos; - if (minfirstline > y1) - y1 = minfirstline; - - h = y2 - y1; - dy = y1 - minfirstline; - - if (*pw > 0) - w = *pw; - - w = xshift(w, res_shift); - - if (*ph > 0) - h = *ph; - - delay1 = (firstword_bplcon1 & 0x0f) | ((firstword_bplcon1 & 0x0c00) >> 6); - delay2 = ((firstword_bplcon1 >> 4) & 0x0f) | (((firstword_bplcon1 >> 4) & 0x0c00) >> 6); - // if (delay1 == delay2) - // dx += delay1; - - dx = xshift(dx, res_shift); - - dbl2 = dbl1 = currprefs.gfx_vresolution; - if ((doublescan > 0 || interlace_seen > 0) && !dbl) { - dbl1--; - dbl2--; - } - if (interlace_seen > 0) - dbl2++; - if (interlace_seen <= 0 && dbl) - dbl2--; - h = xshift(h, dbl1); - dy = xshift(dy, dbl2); - - if (w < 1) - w = 1; - if (h < 1) - h = 1; - if (dx < 0) - dx = 0; - if (dy < 0) - dy = 0; - *pw = w; *ph = h; - *pdx = dx; *pdy = dy; -} - -static struct decision* dp_for_drawing; -static struct draw_info* dip_for_drawing; - -/* Record DIW of the current line for use by centering code. */ -void record_diw_line(int plfstrt, int first, int last) -{ - if (last > max_diwstop) - max_diwstop = last; - if (first < min_diwstart) { - min_diwstart = first; - } -} - -STATIC_INLINE int get_shdelay_add(void) -{ - if (bplres == RES_SUPERHIRES) - return 0; - int add = bpldelay_sh; - add >>= RES_MAX - currprefs.gfx_resolution; - return add; -} +static struct decision *dp_for_drawing; +static struct draw_info *dip_for_drawing; /* * Screen update macros/functions @@ -717,7 +257,6 @@ static int playfield_start, playfield_end; static int real_playfield_start, real_playfield_end; static int sprite_playfield_start; static bool may_require_hard_way; -static int linetoscr_diw_start, linetoscr_diw_end; static int native_ddf_left, native_ddf_right; static int pixels_offset; @@ -725,7 +264,7 @@ static int src_pixel; /* How many pixels in window coordinates which are to the left of the left border. */ static int unpainted; -STATIC_INLINE xcolnr getbgc(bool blank) +STATIC_INLINE xcolnr getbgc (bool blank) { return (blank || hposblank || ce_is_borderblank(colors_for_drawing.extra)) ? 0 : colors_for_drawing.acolors[0]; } @@ -739,35 +278,31 @@ static void set_res_shift(int shift) } /* Initialize the variables necessary for drawing a line. -* This involves setting up start/stop positions and display window -* borders. */ -static void pfield_init_linetoscr(bool border) + * This involves setting up start/stop positions and display window + * borders. */ +static void pfield_init_linetoscr (bool border) { /* First, get data fetch start/stop in DIW coordinates. */ int ddf_left = dp_for_drawing->plfleft * 2 + DIW_DDF_OFFSET; int ddf_right = dp_for_drawing->plfright * 2 + DIW_DDF_OFFSET; int leftborderhidden; - int native_ddf_left2; - - hsync_shift_hack = 0; + bool expanded = false; if (border) ddf_left = DISPLAY_LEFT_SHIFT; /* Compute datafetch start/stop in pixels; native display coordinates. */ - native_ddf_left = coord_hw_to_window_x(ddf_left); - native_ddf_right = coord_hw_to_window_x(ddf_right); + native_ddf_left = coord_hw_to_window_x (ddf_left); + native_ddf_right = coord_hw_to_window_x (ddf_right); - // Blerkenwiegel/Scoopex workaround - native_ddf_left2 = native_ddf_left; if (native_ddf_left < 0) native_ddf_left = 0; if (native_ddf_right < native_ddf_left) native_ddf_right = native_ddf_left; - linetoscr_diw_start = dp_for_drawing->diwfirstword; - linetoscr_diw_end = dp_for_drawing->diwlastword; + int linetoscr_diw_start = dp_for_drawing->diwfirstword; + int linetoscr_diw_end = dp_for_drawing->diwlastword; /* Perverse cases happen. */ if (linetoscr_diw_end < linetoscr_diw_start) @@ -802,25 +337,30 @@ static void pfield_init_linetoscr(bool border) if (dip_for_drawing->nr_sprites) { if (!ce_is_borderblank(colors_for_drawing.extra)) { /* bordersprite off or not supported: sprites are visible until diw_end */ - if (playfield_end < linetoscr_diw_end && hblank_right_stop > playfield_end) { + if (playfield_end < linetoscr_diw_end && MAX_STOP > playfield_end) { playfield_end = linetoscr_diw_end; } - int left = coord_hw_to_window_x(dp_for_drawing->plfleft * 2); + int left = coord_hw_to_window_x (dp_for_drawing->plfleft * 2); if (left < visible_left_border) left = visible_left_border; if (left < playfield_start && left >= linetoscr_diw_start) { playfield_start = left; } - } - else { + } else { sprite_playfield_start = 0; - if (playfield_end < linetoscr_diw_end && hblank_right_stop > playfield_end) { + if (playfield_end < linetoscr_diw_end && MAX_STOP > playfield_end) { playfield_end = linetoscr_diw_end; } } } -#ifdef AGA + // if BPLCON4 is non-zero: it will affect background color until end of DIW. + if (dp_for_drawing->xor_seen) { + if (playfield_end < linetoscr_diw_end && MAX_STOP > playfield_end) { + playfield_end = linetoscr_diw_end; + expanded = true; + } + } may_require_hard_way = false; if (dp_for_drawing->bordersprite_seen && !ce_is_borderblank(colors_for_drawing.extra) && dip_for_drawing->nr_sprites) { int min = visible_right_border, max = visible_left_border, i; @@ -834,8 +374,8 @@ static void pfield_init_linetoscr(bool border) if (x > max) max = x; } - min = coord_hw_to_window_x(min >> sprite_buffer_res) + (DIW_DDF_OFFSET << lores_shift); - max = coord_hw_to_window_x(max >> sprite_buffer_res) + (DIW_DDF_OFFSET << lores_shift); + min = coord_hw_to_window_x (min >> sprite_buffer_res) + (DIW_DDF_OFFSET << lores_shift); + max = coord_hw_to_window_x (max >> sprite_buffer_res) + (DIW_DDF_OFFSET << lores_shift); if (min < playfield_start) playfield_start = min; @@ -848,10 +388,9 @@ static void pfield_init_linetoscr(bool border) sprite_playfield_start = 0; may_require_hard_way = true; } -#endif unpainted = visible_left_border < playfield_start ? 0 : visible_left_border - playfield_start; - unpainted = res_shift_from_window(unpainted); + unpainted = res_shift_from_window (unpainted); int first_x = sprite_first_x; int last_x = sprite_last_x; @@ -867,107 +406,87 @@ static void pfield_init_linetoscr(bool border) if (last_x > MAX_PIXELS_PER_LINE - 2) last_x = MAX_PIXELS_PER_LINE - 2; if (first_x < last_x) - memset(spritepixels + first_x, 0, sizeof(struct spritepixelsbuf) * (last_x - first_x + 1)); + memset (spritepixels + first_x, 0, sizeof (struct spritepixelsbuf) * (last_x - first_x + 1)); } - sprite_last_x = 0; - sprite_first_x = MAX_PIXELS_PER_LINE - 1; + sprite_last_x = 0; + sprite_first_x = MAX_PIXELS_PER_LINE - 1; /* Now, compute some offsets. */ ddf_left -= DISPLAY_LEFT_SHIFT; + if (ddf_left < 0) + ddf_left = 0; pixels_offset = MAX_PIXELS_PER_LINE - (ddf_left << bplres); ddf_left <<= bplres; - leftborderhidden = playfield_start - native_ddf_left2; - if (hblank_left_start > playfield_start) - leftborderhidden += hblank_left_start - playfield_start; - src_pixel = MAX_PIXELS_PER_LINE + res_shift_from_window(leftborderhidden); + leftborderhidden = playfield_start - native_ddf_left; + src_pixel = MAX_PIXELS_PER_LINE + res_shift_from_window (leftborderhidden); - if (dip_for_drawing->nr_sprites == 0) + if (dip_for_drawing->nr_sprites == 0 && !expanded) return; - if (aga_mode) { - int add = get_shdelay_add(); - if (add) { - if (sprite_playfield_start > 0) { - sprite_playfield_start -= add; - } - else { - ;// this is most likely wrong: playfield_start -= add; - } - } - } - /* We need to clear parts of apixels. */ if (linetoscr_diw_start < native_ddf_left) { - int size = res_shift_from_window(native_ddf_left - linetoscr_diw_start); + int size = res_shift_from_window (native_ddf_left - linetoscr_diw_start); linetoscr_diw_start = native_ddf_left; - memset(pixdata.apixels + MAX_PIXELS_PER_LINE - size, 0, size); + memset (pixdata.apixels + MAX_PIXELS_PER_LINE - size, 0, size); } if (linetoscr_diw_end > native_ddf_right) { - int pos = res_shift_from_window(native_ddf_right - native_ddf_left); - int size = res_shift_from_window(linetoscr_diw_end - native_ddf_right); + int pos = res_shift_from_window (native_ddf_right - native_ddf_left); + int size = res_shift_from_window (linetoscr_diw_end - native_ddf_right); + if (pos + size > MAX_PIXELS_PER_LINE) + size = MAX_PIXELS_PER_LINE - pos; + if (size > 0) + memset (pixdata.apixels + MAX_PIXELS_PER_LINE + pos, 0, size); linetoscr_diw_start = native_ddf_left; - memset(pixdata.apixels + MAX_PIXELS_PER_LINE + pos, 0, size); } } // erase sprite graphics in pixdata if they were outside of ddf -static void pfield_erase_hborder_sprites(void) +static void pfield_erase_hborder_sprites (void) { if (sprite_first_x < native_ddf_left) { - int size = res_shift_from_window(native_ddf_left - sprite_first_x); - memset(pixdata.apixels + MAX_PIXELS_PER_LINE - size, 0, size); + int size = res_shift_from_window (native_ddf_left - sprite_first_x); + memset (pixdata.apixels + MAX_PIXELS_PER_LINE - size, 0, size); } if (sprite_last_x > native_ddf_right) { - int pos = res_shift_from_window(native_ddf_right - native_ddf_left); - int size = res_shift_from_window(sprite_last_x - native_ddf_right); - memset(pixdata.apixels + MAX_PIXELS_PER_LINE + pos, 0, size); + int pos = res_shift_from_window (native_ddf_right - native_ddf_left); + int size = res_shift_from_window (sprite_last_x - native_ddf_right); + if (pos + size > MAX_PIXELS_PER_LINE) + size = MAX_PIXELS_PER_LINE - pos; + if (size > 0) + memset (pixdata.apixels + MAX_PIXELS_PER_LINE + pos, 0, size); } } // erase whole viewable area if sprite in upper or lower border -static void pfield_erase_vborder_sprites(void) +static void pfield_erase_vborder_sprites (void) { if (visible_right_border <= visible_left_border) return; int pos = 0; int size = 0; if (visible_left_border < native_ddf_left) { - size = res_shift_from_window(native_ddf_left - visible_left_border); + size = res_shift_from_window (native_ddf_left - visible_left_border); pos = -size; } if (visible_right_border > native_ddf_left) - size += res_shift_from_window(visible_right_border - native_ddf_left); - memset(pixdata.apixels + MAX_PIXELS_PER_LINE - pos, 0, size); + size += res_shift_from_window (visible_right_border - native_ddf_left); + memset (pixdata.apixels + MAX_PIXELS_PER_LINE - pos, 0, size); } -STATIC_INLINE uae_u16 merge_2pixel16(uae_u16 p1, uae_u16 p2) -{ - uae_u16 v = ((((p1 >> xredcolor_s) & xredcolor_m) + ((p2 >> xredcolor_s) & xredcolor_m)) / 2) << xredcolor_s; - v |= ((((p1 >> xbluecolor_s) & xbluecolor_m) + ((p2 >> xbluecolor_s) & xbluecolor_m)) / 2) << xbluecolor_s; - v |= ((((p1 >> xgreencolor_s) & xgreencolor_m) + ((p2 >> xgreencolor_s) & xgreencolor_m)) / 2) << xgreencolor_s; - return v; -} -STATIC_INLINE uae_u32 merge_2pixel32(uae_u32 p1, uae_u32 p2) -{ - uae_u32 v = ((((p1 >> 16) & 0xff) + ((p2 >> 16) & 0xff)) / 2) << 16; - v |= ((((p1 >> 8) & 0xff) + ((p2 >> 8) & 0xff)) / 2) << 8; - v |= ((((p1 >> 0) & 0xff) + ((p2 >> 0) & 0xff)) / 2) << 0; - return v; -} -STATIC_INLINE void fill_line_16(uae_u8 *buf, int start, int stop, bool blank) +STATIC_INLINE void fill_line_16 (uae_u8 *buf, int start, int stop, bool blank) { uae_u16 *b = (uae_u16 *)buf; unsigned int i; unsigned int rem = 0; - xcolnr col = getbgc(blank); - if (((uintptr_t)&b[start]) & 1) - b[start++] = (uae_u16)col; + xcolnr col = getbgc (blank); + if (((uintptr_t)&b[start]) & 3) + b[start++] = (uae_u16) col; if (start >= stop) return; - if (((uintptr_t)&b[stop]) & 1) { + if (((uintptr_t)&b[stop]) & 3) { rem++; stop--; } @@ -979,55 +498,36 @@ STATIC_INLINE void fill_line_16(uae_u8 *buf, int start, int stop, bool blank) b[stop] = (uae_u16)col; } -STATIC_INLINE void fill_line_32(uae_u8 *buf, int start, int stop, bool blank) -{ - uae_u32 *b = (uae_u32 *)buf; - unsigned int i; - xcolnr col = getbgc(blank); - for (i = start; i < stop; i++) - b[i] = col; -} - -static void pfield_do_fill_line(int start, int stop, bool blank) +static void pfield_do_fill_line (int start, int stop, bool blank) { if (stop <= start) return; - switch (gfxvidinfo.pixbytes) { - case 2: fill_line_16(xlinebuffer, start, stop, blank); break; - case 4: fill_line_32(xlinebuffer, start, stop, blank); break; - } - if (need_genlock_data) { - memset(xlinebuffer_genlock + start, 0, stop - start); - } + fill_line_16 (xlinebuffer, start, stop, blank); } -static void fill_line2(int startpos, int len) +static void fill_line2 (int startpos, int len) { int shift; int nints, nrem; int *start; xcolnr val; - shift = 0; - if (gfxvidinfo.pixbytes == 2) shift = 1; - if (gfxvidinfo.pixbytes == 4) - shift = 2; nints = len >> (2 - shift); nrem = nints & 7; nints &= ~7; start = (int *)(((uae_u8*)xlinebuffer) + (startpos << shift)); - val = getbgc(false); + val = getbgc (false); for (; nints > 0; nints -= 8, start += 8) { *start = val; - *(start + 1) = val; - *(start + 2) = val; - *(start + 3) = val; - *(start + 4) = val; - *(start + 5) = val; - *(start + 6) = val; - *(start + 7) = val; + *(start+1) = val; + *(start+2) = val; + *(start+3) = val; + *(start+4) = val; + *(start+5) = val; + *(start+6) = val; + *(start+7) = val; } switch (nrem) { @@ -1048,126 +548,72 @@ static void fill_line2(int startpos, int len) } } -static void fill_line_border(int lineno) +STATIC_INLINE void fill_line_border (int lineno) { int lastpos = visible_left_border; - int endpos = visible_left_border + gfxvidinfo.outwidth; - - if (lineno < visible_top_start || lineno >= visible_bottom_stop) { - int b = hposblank; - hposblank = 3; - fill_line2(lastpos, gfxvidinfo.outwidth); - if (need_genlock_data) { - memset(xlinebuffer_genlock + lastpos, 0, gfxvidinfo.outwidth); - } - hposblank = b; - return; - } + int endpos = visible_left_border + gfxvidinfo.drawbuffer.outwidth; // full hblank if (hposblank) { hposblank = 3; - fill_line2(lastpos, gfxvidinfo.outwidth); - if (need_genlock_data) { - memset(xlinebuffer_genlock + lastpos, 0, gfxvidinfo.outwidth); - } - return; - } - // hblank not visible - if (hblank_left_start <= lastpos && hblank_right_stop >= endpos) { - fill_line2(lastpos, gfxvidinfo.outwidth); - if (need_genlock_data) { - memset(xlinebuffer_genlock + lastpos, 0, gfxvidinfo.outwidth); - } + fill_line2(lastpos, gfxvidinfo.drawbuffer.outwidth); return; } - // left, right or both hblanks visible - if (lastpos < hblank_left_start) { - int t = hblank_left_start < endpos ? hblank_left_start : endpos; - pfield_do_fill_line(lastpos, t, true); - lastpos = t; - } - if (lastpos < hblank_right_stop) { - int t = hblank_right_stop < endpos ? hblank_right_stop : endpos; - pfield_do_fill_line(lastpos, t, false); - lastpos = t; + // hblank not visible + if (0 <= lastpos && MAX_STOP >= endpos) { + fill_line2(lastpos, gfxvidinfo.drawbuffer.outwidth); + return; } + if (lastpos < endpos) { pfield_do_fill_line(lastpos, endpos, true); } } -static int sprite_shdelay; -#define SPRITE_DEBUG 0 -static uae_u8 render_sprites(int pos, int dualpf, uae_u8 apixel, int aga) +static uae_u8 render_sprites (int pos, int dualpf, uae_u8 apixel, int aga) { struct spritepixelsbuf *spb = &spritepixels[pos]; unsigned int v = spb->data; - int *shift_lookup = dualpf ? (bpldualpfpri ? dblpf_ms2 : dblpf_ms1) : dblpf_ms; + int *shift_lookup = bpldualpfpri ? dblpf_ms2 : dblpf_ms1; int maskshift, plfmask; - // shdelay hack, above &spritepixels[pos] is correct. - pos += sprite_shdelay; /* The value in the shift lookup table is _half_ the shift count we need. This is because we can't shift 32 bits at once (undefined behaviour in C). */ - maskshift = shift_lookup[apixel]; - plfmask = (plf_sprite_mask >> maskshift) >> maskshift; - v &= ~plfmask; - /* Extra 1 sprite pixel at DDFSTRT is only possible if at least 1 plane is active */ - if ((bplplanecnt > 0 || pos >= sprite_playfield_start) && (v != 0 || SPRITE_DEBUG)) { - unsigned int vlo, vhi, col; - unsigned int v1 = v & 255; - /* OFFS determines the sprite pair with the highest priority that has - any bits set. E.g. if we have 0xFF00 in the buffer, we have sprite - pairs 01 and 23 cleared, and pairs 45 and 67 set, so OFFS will - have a value of 4. - 2 * OFFS is the bit number in V of the sprite pair, and it also - happens to be the color offset for that pair. - */ - int offs; - if (v1 == 0) - offs = 4 + sprite_offs[v >> 8]; - else - offs = sprite_offs[v1]; - /* Shift highest priority sprite pair down to bit zero. */ - v >>= offs * 2; - v &= 15; -#if SPRITE_DEBUG > 0 - v ^= 8; -#endif - if (spb->attach && (spb->stdata & (3 << offs))) { - col = v; - if (aga) - col += sbasecol[1]; + if(dualpf) { + maskshift = shift_lookup[apixel]; + plfmask = (plf_sprite_mask >> maskshift) >> maskshift; + v &= ~plfmask; + } else { + if(apixel) + v &= plf_sprite_mask_n16; + } + + /* Extra 1 sprite pixel at DDFSTRT is only possible if at least 1 plane is active */ + if ((bplplanecnt > 0 || pos >= sprite_playfield_start) && (v != 0)) { + unsigned int col; + + if (spb->attach) { + int offs = sprite_bit[v]; + if (spb->stdata & offs) { + if (aga) + col = sprite_col_at[v] + sbasecol[1]; + else + col = sprite_col_at[v] + 16; + return col; + } + } + + if (aga) { + int offs = sprite_bit[v]; + if (offs & 0x55) + col = sprite_col_nat[v] + sbasecol[0]; else - col += 16; - } - else { - /* This sequence computes the correct color value. We have to select - either the lower-numbered or the higher-numbered sprite in the pair. - We have to select the high one if the low one has all bits zero. - If the lower-numbered sprite has any bits nonzero, (VLO - 1) is in - the range of 0..2, and with the mask and shift, VHI will be zero. - If the lower-numbered sprite is zero, (VLO - 1) is a mask of - 0xFFFFFFFF, and we select the bits of the higher numbered sprite - in VHI. - This is _probably_ more efficient than doing it with branches. */ - vlo = v & 3; - vhi = (v & (vlo - 1)) >> 2; - col = (vlo | vhi); - if (aga) { - if (vhi > 0) - col += sbasecol[1]; - else - col += sbasecol[0]; - } - else { - col += 16; - } - col += offs * 2; + col = sprite_col_nat[v] + sbasecol[1]; + } else { + col = sprite_col_nat[v] + 16; } return col; @@ -1176,58 +622,22 @@ static uae_u8 render_sprites(int pos, int dualpf, uae_u8 apixel, int aga) return 0; } -static bool get_genlock_very_rare_and_complex_case(uae_u8 v) -{ - // border color without BRDNTRAN bit set = transparent - if (v == 0 && !ce_is_borderntrans(colors_for_drawing.extra)) - return false; - if (ecs_genlock_features_colorkey) { - // color key match? - if (currprefs.chipset_mask & CSMASK_AGA) { - if (colors_for_drawing.color_regs_aga[v] & 0x80000000) - return false; - } - else { - if (colors_for_drawing.color_regs_ecs[v] & 0x8000) - return false; - } - } - // plane mask match? - if (v & ecs_genlock_features_mask) - return false; - return true; -} -// false = transparent -STATIC_INLINE bool get_genlock_transparency(uae_u8 v) -{ - if (!ecs_genlock_features_active) { - if (v == 0) - return false; - return true; - } - else { - return get_genlock_very_rare_and_complex_case(v); - } -} - #include "linetoscr.cpp" -#define LTPARMS src_pixel, start, stop - /* ECS SuperHires special cases */ #define PUTBPIX(x) buf[dpix] = (x); -STATIC_INLINE uae_u32 shsprite(int dpix, uae_u32 spix_val, uae_u32 v, int spr) +STATIC_INLINE uae_u32 shsprite (int dpix, uae_u32 spix_val, uae_u32 v, int spr) { uae_u8 sprcol; uae_u16 scol; if (!spr) return v; - sprcol = render_sprites(dpix, 0, spix_val, 0); + sprcol = render_sprites (dpix, 0, spix_val, 0); if (!sprcol) return v; - /* good enough for now.. */ + /* good enough for now.. */ scol = colors_for_drawing.color_regs_ecs[sprcol] & 0xccc; scol |= scol >> 2; return xcolors[scol]; @@ -1235,7 +645,7 @@ STATIC_INLINE uae_u32 shsprite(int dpix, uae_u32 spix_val, uae_u32 v, int spr) static int NOINLINE linetoscr_16_sh_func(int spix, int dpix, int stoppos, int spr) { - uae_u16 *buf = (uae_u16 *)xlinebuffer; + uae_u16 *buf = (uae_u16 *) xlinebuffer; while (dpix < stoppos) { uae_u16 spix_val1, spix_val2; @@ -1244,13 +654,13 @@ static int NOINLINE linetoscr_16_sh_func(int spix, int dpix, int stoppos, int sp spix_val1 = pixdata.apixels[spix++]; spix_val2 = pixdata.apixels[spix++]; off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16); - v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0; + v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0; v |= v >> 2; - PUTBPIX(shsprite(dpix, spix_val1, xcolors[v], spr)); + PUTBPIX(shsprite (dpix, spix_val1, xcolors[v], spr)); dpix++; - v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2; + v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2; v |= v >> 2; - PUTBPIX(shsprite(dpix, spix_val2, xcolors[v], spr)); + PUTBPIX(shsprite (dpix, spix_val2, xcolors[v], spr)); dpix++; } return spix; @@ -1263,106 +673,20 @@ static int linetoscr_16_sh(int spix, int dpix, int stoppos) { return linetoscr_16_sh_func(spix, dpix, stoppos, false); } -static int NOINLINE linetoscr_32_sh_func(int spix, int dpix, int stoppos, int spr) -{ - uae_u32 *buf = (uae_u32 *)xlinebuffer; - - while (dpix < stoppos) { - uae_u32 spix_val1, spix_val2; - uae_u16 v; - int off; - spix_val1 = pixdata.apixels[spix++]; - spix_val2 = pixdata.apixels[spix++]; - off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16); - v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0; - v |= v >> 2; - PUTBPIX(shsprite(dpix, spix_val1, xcolors[v], spr)); - dpix++; - v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2; - v |= v >> 2; - PUTBPIX(shsprite(dpix, spix_val2, xcolors[v], spr)); - dpix++; - } - return spix; -} -static int linetoscr_32_sh_spr(int spix, int dpix, int stoppos) -{ - return linetoscr_32_sh_func(spix, dpix, stoppos, true); -} -static int linetoscr_32_sh(int spix, int dpix, int stoppos) -{ - return linetoscr_32_sh_func(spix, dpix, stoppos, false); -} -static int NOINLINE linetoscr_32_shrink1_sh_func(int spix, int dpix, int stoppos, int spr) -{ - uae_u32 *buf = (uae_u32 *)xlinebuffer; - - while (dpix < stoppos) { - uae_u32 spix_val1, spix_val2; - uae_u16 v; - int off; - spix_val1 = pixdata.apixels[spix++]; - spix_val2 = pixdata.apixels[spix++]; - off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16); - v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0; - v |= v >> 2; - PUTBPIX(shsprite(dpix, spix_val1, xcolors[v], spr)); - dpix++; - } - return spix; -} -static int linetoscr_32_shrink1_sh_spr(int spix, int dpix, int stoppos) -{ - return linetoscr_32_shrink1_sh_func(spix, dpix, stoppos, true); -} -static int linetoscr_32_shrink1_sh(int spix, int dpix, int stoppos) -{ - return linetoscr_32_shrink1_sh_func(spix, dpix, stoppos, false); -} -static int NOINLINE linetoscr_32_shrink1f_sh_func(int spix, int dpix, int stoppos, int spr) -{ - uae_u32 *buf = (uae_u32 *)xlinebuffer; - - while (dpix < stoppos) { - uae_u32 spix_val1, spix_val2, dpix_val1, dpix_val2; - uae_u16 v; - int off; - spix_val1 = pixdata.apixels[spix++]; - spix_val2 = pixdata.apixels[spix++]; - off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16); - v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0; - v |= v >> 2; - dpix_val1 = xcolors[v]; - v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2; - v |= v >> 2; - dpix_val2 = xcolors[v]; - PUTBPIX(shsprite(dpix, spix_val1, merge_2pixel32(dpix_val1, dpix_val2), spr)); - dpix++; - } - return spix; -} -static int linetoscr_32_shrink1f_sh_spr(int spix, int dpix, int stoppos) -{ - return linetoscr_32_shrink1f_sh_func(spix, dpix, stoppos, true); -} -static int linetoscr_32_shrink1f_sh(int spix, int dpix, int stoppos) -{ - return linetoscr_32_shrink1f_sh_func(spix, dpix, stoppos, false); -} static int NOINLINE linetoscr_16_shrink1_sh_func(int spix, int dpix, int stoppos, int spr) { - uae_u16 *buf = (uae_u16 *)xlinebuffer; + uae_u16 *buf = (uae_u16 *) xlinebuffer; while (dpix < stoppos) { uae_u16 spix_val1, spix_val2; uae_u16 v; int off; - spix_val1 = pixdata.apixels[spix++]; - spix_val2 = pixdata.apixels[spix++]; - off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16); - v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0; - v |= v >> 2; - PUTBPIX(shsprite(dpix, spix_val1, xcolors[v], spr)); + spix_val1 = pixdata.apixels[spix++]; + spix_val2 = pixdata.apixels[spix++]; + off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16); + v = (colors_for_drawing.color_regs_ecs[off] & 0xccc); + v |= v >> 2; + PUTBPIX(shsprite (dpix, spix_val1, xcolors[v], spr)); dpix++; } return spix; @@ -1375,119 +699,21 @@ static int linetoscr_16_shrink1_sh(int spix, int dpix, int stoppos) { return linetoscr_16_shrink1_sh_func(spix, dpix, stoppos, false); } -static int NOINLINE linetoscr_16_shrink1f_sh_func(int spix, int dpix, int stoppos, int spr) -{ - uae_u16 *buf = (uae_u16 *)xlinebuffer; - - while (dpix < stoppos) { - uae_u16 spix_val1, spix_val2, dpix_val1, dpix_val2; - uae_u16 v; - int off; - spix_val1 = pixdata.apixels[spix++]; - spix_val2 = pixdata.apixels[spix++]; - off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16); - v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0; - v |= v >> 2; - dpix_val1 = xcolors[v]; - v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2; - v |= v >> 2; - dpix_val2 = xcolors[v]; - PUTBPIX(shsprite(dpix, spix_val1, merge_2pixel16(dpix_val1, dpix_val2), spr)); - dpix++; - } - return spix; -} -static int linetoscr_16_shrink1f_sh_spr(int spix, int dpix, int stoppos) -{ - return linetoscr_16_shrink1f_sh_func(spix, dpix, stoppos, true); -} -static int linetoscr_16_shrink1f_sh(int spix, int dpix, int stoppos) -{ - return linetoscr_16_shrink1f_sh_func(spix, dpix, stoppos, false); -} -static int NOINLINE linetoscr_32_shrink2_sh_func(int spix, int dpix, int stoppos, int spr) -{ - uae_u32 *buf = (uae_u32 *)xlinebuffer; - - while (dpix < stoppos) { - uae_u32 spix_val1, spix_val2; - uae_u16 v; - int off; - spix_val1 = pixdata.apixels[spix++]; - spix_val2 = pixdata.apixels[spix++]; - off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16); - v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0; - v |= v >> 2; - PUTBPIX(shsprite(dpix, spix_val1, xcolors[v], spr)); - spix += 2; - dpix++; - } - return spix; -} -static int linetoscr_32_shrink2_sh_spr(int spix, int dpix, int stoppos) -{ - return linetoscr_32_shrink2_sh_func(spix, dpix, stoppos, true); -} -static int linetoscr_32_shrink2_sh(int spix, int dpix, int stoppos) -{ - return linetoscr_32_shrink2_sh_func(spix, dpix, stoppos, false); -} -static int NOINLINE linetoscr_32_shrink2f_sh_func(int spix, int dpix, int stoppos, int spr) -{ - uae_u32 *buf = (uae_u32 *)xlinebuffer; - - while (dpix < stoppos) { - uae_u32 spix_val1, spix_val2, dpix_val1, dpix_val2, dpix_val3, dpix_val4; - uae_u16 v; - int off; - spix_val1 = pixdata.apixels[spix++]; - spix_val2 = pixdata.apixels[spix++]; - off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16); - v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0; - v |= v >> 2; - dpix_val1 = xcolors[v]; - v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2; - v |= v >> 2; - dpix_val2 = xcolors[v]; - dpix_val3 = merge_2pixel32(dpix_val1, dpix_val2); - spix_val1 = pixdata.apixels[spix++]; - spix_val2 = pixdata.apixels[spix++]; - off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16); - v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0; - v |= v >> 2; - dpix_val1 = xcolors[v]; - v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2; - v |= v >> 2; - dpix_val2 = xcolors[v]; - dpix_val4 = merge_2pixel32(dpix_val1, dpix_val2); - PUTBPIX(shsprite(dpix, spix_val1, merge_2pixel32(dpix_val3, dpix_val4), spr)); - dpix++; - } - return spix; -} -static int linetoscr_32_shrink2f_sh_spr(int spix, int dpix, int stoppos) -{ - return linetoscr_32_shrink2f_sh_func(spix, dpix, stoppos, true); -} -static int linetoscr_32_shrink2f_sh(int spix, int dpix, int stoppos) -{ - return linetoscr_32_shrink2f_sh_func(spix, dpix, stoppos, false); -} static int NOINLINE linetoscr_16_shrink2_sh_func(int spix, int dpix, int stoppos, int spr) { - uae_u16 *buf = (uae_u16 *)xlinebuffer; + uae_u16 *buf = (uae_u16 *) xlinebuffer; while (dpix < stoppos) { uae_u16 spix_val1, spix_val2; uae_u16 v; int off; - spix_val1 = pixdata.apixels[spix++]; - spix_val2 = pixdata.apixels[spix++]; - off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16); - v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0; + spix_val1 = pixdata.apixels[spix++]; + spix_val2 = pixdata.apixels[spix++]; + off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16); + v = (colors_for_drawing.color_regs_ecs[off] & 0xccc); v |= v >> 2; - PUTBPIX(shsprite(dpix, spix_val1, xcolors[v], spr)); - spix += 2; + PUTBPIX(shsprite (dpix, spix_val1, xcolors[v], spr)); + spix+=2; dpix++; } return spix; @@ -1500,47 +726,6 @@ static int linetoscr_16_shrink2_sh(int spix, int dpix, int stoppos) { return linetoscr_16_shrink2_sh_func(spix, dpix, stoppos, false); } -static int NOINLINE linetoscr_16_shrink2f_sh_func(int spix, int dpix, int stoppos, int spr) -{ - uae_u16 *buf = (uae_u16 *)xlinebuffer; - - while (dpix < stoppos) { - uae_u16 spix_val1, spix_val2, dpix_val1, dpix_val2, dpix_val3, dpix_val4; - uae_u16 v; - int off; - spix_val1 = pixdata.apixels[spix++]; - spix_val2 = pixdata.apixels[spix++]; - off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16); - v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0; - v |= v >> 2; - dpix_val1 = xcolors[v]; - v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2; - v |= v >> 2; - dpix_val2 = xcolors[v]; - dpix_val3 = merge_2pixel32(dpix_val1, dpix_val2); - spix_val1 = pixdata.apixels[spix++]; - spix_val2 = pixdata.apixels[spix++]; - off = ((spix_val2 & 3) * 4) + (spix_val1 & 3) + ((spix_val1 | spix_val2) & 16); - v = (colors_for_drawing.color_regs_ecs[off] & 0xccc) << 0; - v |= v >> 2; - dpix_val1 = xcolors[v]; - v = (colors_for_drawing.color_regs_ecs[off] & 0x333) << 2; - v |= v >> 2; - dpix_val2 = xcolors[v]; - dpix_val4 = merge_2pixel32(dpix_val1, dpix_val2); - PUTBPIX(shsprite(dpix, spix_val1, merge_2pixel16(dpix_val3, dpix_val4), spr)); - dpix++; - } - return spix; -} -static int linetoscr_16_shrink2f_sh_spr(int spix, int dpix, int stoppos) -{ - return linetoscr_16_shrink2f_sh_func(spix, dpix, stoppos, true); -} -static int linetoscr_16_shrink2f_sh(int spix, int dpix, int stoppos) -{ - return linetoscr_16_shrink2f_sh_func(spix, dpix, stoppos, false); -} typedef int(*call_linetoscr)(int spix, int dpix, int dpix_end); @@ -1561,57 +746,8 @@ static int pfield_do_nothing(int a, int b, int c) return a; } -/* AGA subpixel delay hack */ -static call_linetoscr pfield_do_linetoscr_shdelay_normal; -static call_linetoscr pfield_do_linetoscr_shdelay_sprite; - -static int pfield_do_linetoscr_normal_shdelay(int spix, int dpix, int dpix_end) +static void pfield_set_linetoscr (void) { - int add = get_shdelay_add(); - int add2 = add * gfxvidinfo.pixbytes; - if (add) { - // Clear skipped pixel(s). - pfield_do_linetoscr_shdelay_sprite(spix, dpix, dpix + add); - } - xlinebuffer += add2; - int out = pfield_do_linetoscr_shdelay_normal(spix, dpix, dpix_end); - xlinebuffer -= add2; - return out; -} -static int pfield_do_linetoscr_sprite_shdelay(int spix, int dpix, int dpix_end) -{ - int out = spix; - if (dpix < real_playfield_start && dpix_end > real_playfield_start) { - // Crosses real_playfield_start. - // Render only from dpix to real_playfield_start. - int len = real_playfield_start - dpix; - out = pfield_do_linetoscr_spriteonly(out, dpix, dpix + len); - dpix = real_playfield_start; - } - else if (dpix_end <= real_playfield_start) { - // Does not cross real_playfield_start, nothing special needed. - out = pfield_do_linetoscr_spriteonly(out, dpix, dpix_end); - return out; - } - // Render bitplane with subpixel scroll, from real_playfield_start to end. - int add = get_shdelay_add(); - int add2 = add * gfxvidinfo.pixbytes; - if (add) { - pfield_do_linetoscr_shdelay_sprite(out, dpix, dpix + add); - } - sprite_shdelay = add; - spritepixels += add; - xlinebuffer += add2; - out = pfield_do_linetoscr_shdelay_sprite(out, dpix, dpix_end); - xlinebuffer -= add2; - spritepixels -= add; - sprite_shdelay = 0; - return out; -} - -static void pfield_set_linetoscr(void) -{ - xlinecheck(start, stop); p_acolors = colors_for_drawing.acolors; p_xcolors = xcolors; bpland = 0xff; @@ -1620,535 +756,268 @@ static void pfield_set_linetoscr(void) } spritepixels = spritepixels_buffer; pfield_do_linetoscr_spriteonly = pfield_do_nothing; -#ifdef AGA + if (currprefs.chipset_mask & CSMASK_AGA) { if (res_shift == 0) { - switch (gfxvidinfo.pixbytes) { - case 2: pfield_do_linetoscr_normal = linetoscr_16_aga; pfield_do_linetoscr_sprite = linetoscr_16_aga_spr; pfield_do_linetoscr_spriteonly = linetoscr_16_aga_spronly; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32_aga; - pfield_do_linetoscr_sprite = linetoscr_32_aga_spr; - pfield_do_linetoscr_spriteonly = linetoscr_32_aga_spronly; - break; - } - } - else if (res_shift == 2) { - switch (gfxvidinfo.pixbytes) { - case 2: - pfield_do_linetoscr_normal = linetoscr_16_stretch2_aga; - pfield_do_linetoscr_sprite = linetoscr_16_stretch2_aga_spr; - pfield_do_linetoscr_spriteonly = linetoscr_16_stretch2_aga_spronly; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32_stretch2_aga; - pfield_do_linetoscr_sprite = linetoscr_32_stretch2_aga_spr; - pfield_do_linetoscr_spriteonly = linetoscr_32_stretch2_aga_spronly; - break; - } - } - else if (res_shift == 1) { - switch (gfxvidinfo.pixbytes) { - case 2: + } else if (res_shift == 2) { + } else if (res_shift == 1) { pfield_do_linetoscr_normal = linetoscr_16_stretch1_aga; pfield_do_linetoscr_sprite = linetoscr_16_stretch1_aga_spr; pfield_do_linetoscr_spriteonly = linetoscr_16_stretch1_aga_spronly; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32_stretch1_aga; - pfield_do_linetoscr_sprite = linetoscr_32_stretch1_aga_spr; - pfield_do_linetoscr_spriteonly = linetoscr_32_stretch1_aga_spronly; - break; - } - } - else if (res_shift == -1) { - if (currprefs.gfx_lores_mode) { - switch (gfxvidinfo.pixbytes) { - case 2: - pfield_do_linetoscr_normal = linetoscr_16_shrink1f_aga; - pfield_do_linetoscr_sprite = linetoscr_16_shrink1f_aga_spr; - pfield_do_linetoscr_spriteonly = linetoscr_16_shrink1f_aga_spronly; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32_shrink1f_aga; - pfield_do_linetoscr_sprite = linetoscr_32_shrink1f_aga_spr; - pfield_do_linetoscr_spriteonly = linetoscr_32_shrink1f_aga_spronly; - break; - } - } - else { - switch (gfxvidinfo.pixbytes) { - case 2: - pfield_do_linetoscr_normal = linetoscr_16_shrink1_aga; - pfield_do_linetoscr_sprite = linetoscr_16_shrink1_aga_spr; - pfield_do_linetoscr_spriteonly = linetoscr_16_shrink1_aga_spronly; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32_shrink1_aga; - pfield_do_linetoscr_sprite = linetoscr_32_shrink1_aga_spr; - pfield_do_linetoscr_spriteonly = linetoscr_32_shrink1_aga_spronly; - break; - } - } - } - else if (res_shift == -2) { - if (currprefs.gfx_lores_mode) { - switch (gfxvidinfo.pixbytes) { - case 2: - pfield_do_linetoscr_normal = linetoscr_16_shrink2f_aga; - pfield_do_linetoscr_sprite = linetoscr_16_shrink2f_aga_spr; - pfield_do_linetoscr_spriteonly = linetoscr_16_shrink2f_aga_spronly; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32_shrink2f_aga; - pfield_do_linetoscr_sprite = linetoscr_32_shrink2f_aga_spr; - pfield_do_linetoscr_spriteonly = linetoscr_32_shrink2f_aga_spronly; - break; - } - } - else { - switch (gfxvidinfo.pixbytes) { - case 2: - pfield_do_linetoscr_normal = linetoscr_16_shrink2_aga; - pfield_do_linetoscr_sprite = linetoscr_16_shrink2_aga_spr; - pfield_do_linetoscr_spriteonly = linetoscr_16_shrink2_aga_spronly; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32_shrink2_aga; - pfield_do_linetoscr_sprite = linetoscr_32_shrink2_aga_spr; - pfield_do_linetoscr_spriteonly = linetoscr_32_shrink2_aga_spronly; - break; - } - } - } - if (get_shdelay_add()) { - pfield_do_linetoscr_shdelay_normal = pfield_do_linetoscr_normal; - pfield_do_linetoscr_shdelay_sprite = pfield_do_linetoscr_sprite; - pfield_do_linetoscr_normal = pfield_do_linetoscr_normal_shdelay; - pfield_do_linetoscr_sprite = pfield_do_linetoscr_sprite_shdelay; + } else if (res_shift == -1) { + pfield_do_linetoscr_normal = linetoscr_16_shrink1_aga; + pfield_do_linetoscr_sprite = linetoscr_16_shrink1_aga_spr; + pfield_do_linetoscr_spriteonly = linetoscr_16_shrink1_aga_spronly; + } else if (res_shift == -2) { + pfield_do_linetoscr_normal = linetoscr_16_shrink2_aga; + pfield_do_linetoscr_sprite = linetoscr_16_shrink2_aga_spr; + pfield_do_linetoscr_spriteonly = linetoscr_16_shrink2_aga_spronly; } } -#endif -#ifdef ECS_DENISE + if (!(currprefs.chipset_mask & CSMASK_AGA) && ecsshres) { - // TODO: genlock support if (res_shift == 0) { - switch (gfxvidinfo.pixbytes) { - case 2: pfield_do_linetoscr_normal = linetoscr_16_sh; pfield_do_linetoscr_sprite = linetoscr_16_sh_spr; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32_sh; - pfield_do_linetoscr_sprite = linetoscr_32_sh_spr; - break; - } - } - else if (res_shift == -1) { - if (currprefs.gfx_lores_mode) { - switch (gfxvidinfo.pixbytes) { - case 2: - pfield_do_linetoscr_normal = linetoscr_16_shrink1f_sh; - pfield_do_linetoscr_sprite = linetoscr_16_shrink1f_sh_spr; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32_shrink1f_sh; - pfield_do_linetoscr_sprite = linetoscr_32_shrink1f_sh_spr; - break; - } - } - else { - switch (gfxvidinfo.pixbytes) { - case 2: - pfield_do_linetoscr_normal = linetoscr_16_shrink1_sh; - pfield_do_linetoscr_sprite = linetoscr_16_shrink1_sh_spr; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32_shrink1_sh; - pfield_do_linetoscr_sprite = linetoscr_32_shrink1_sh_spr; - break; - } - } - } - else if (res_shift == -2) { - if (currprefs.gfx_lores_mode) { - switch (gfxvidinfo.pixbytes) { - case 2: - pfield_do_linetoscr_normal = linetoscr_16_shrink2f_sh; - pfield_do_linetoscr_sprite = linetoscr_16_shrink2f_sh_spr; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32_shrink2f_sh; - pfield_do_linetoscr_sprite = linetoscr_32_shrink2f_sh_spr; - break; - } - } - else { - switch (gfxvidinfo.pixbytes) { - case 2: - pfield_do_linetoscr_normal = linetoscr_16_shrink2_sh; - pfield_do_linetoscr_sprite = linetoscr_16_shrink2_sh_spr; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32_shrink2_sh; - pfield_do_linetoscr_sprite = linetoscr_32_shrink2_sh_spr; - break; - } - } + } else if (res_shift == -1) { + pfield_do_linetoscr_normal = linetoscr_16_shrink1_sh; + pfield_do_linetoscr_sprite = linetoscr_16_shrink1_sh_spr; + } else if (res_shift == -2) { + pfield_do_linetoscr_normal = linetoscr_16_shrink2_sh; + pfield_do_linetoscr_sprite = linetoscr_16_shrink2_sh_spr; } } -#endif + if (!(currprefs.chipset_mask & CSMASK_AGA) && !ecsshres) { if (res_shift == 0) { - switch (gfxvidinfo.pixbytes) { - case 2: pfield_do_linetoscr_normal = linetoscr_16; pfield_do_linetoscr_sprite = linetoscr_16_spr; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32; - pfield_do_linetoscr_sprite = linetoscr_32_spr; - break; - } - } - else if (res_shift == 2) { - switch (gfxvidinfo.pixbytes) { - case 2: - pfield_do_linetoscr_normal = linetoscr_16_stretch2; - pfield_do_linetoscr_sprite = linetoscr_16_stretch2_spr; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32_stretch2; - pfield_do_linetoscr_sprite = linetoscr_32_stretch2_spr; - break; - } - } - else if (res_shift == 1) { - switch (gfxvidinfo.pixbytes) { - case 2: + } else if (res_shift == 2) { + } else if (res_shift == 1) { pfield_do_linetoscr_normal = linetoscr_16_stretch1; pfield_do_linetoscr_sprite = linetoscr_16_stretch1_spr; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32_stretch1; - pfield_do_linetoscr_sprite = linetoscr_32_stretch1_spr; - break; - } - } - else if (res_shift == -1) { - if (currprefs.gfx_lores_mode) { - switch (gfxvidinfo.pixbytes) { - case 2: - pfield_do_linetoscr_normal = linetoscr_16_shrink1f; - pfield_do_linetoscr_sprite = linetoscr_16_shrink1f_spr; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32_shrink1f; - pfield_do_linetoscr_sprite = linetoscr_32_shrink1f_spr; - break; - } - } - else { - switch (gfxvidinfo.pixbytes) { - case 2: - pfield_do_linetoscr_normal = linetoscr_16_shrink1; - pfield_do_linetoscr_sprite = linetoscr_16_shrink1_spr; - break; - case 4: - pfield_do_linetoscr_normal = linetoscr_32_shrink1; - pfield_do_linetoscr_sprite = linetoscr_32_shrink1_spr; - break; - } - } + } else if (res_shift == -1) { + pfield_do_linetoscr_normal = linetoscr_16_shrink1; + pfield_do_linetoscr_sprite = linetoscr_16_shrink1_spr; } } } // left or right AGA border sprite -static void pfield_do_linetoscr_bordersprite_aga(int start, int stop, bool blank) +static void pfield_do_linetoscr_bordersprite_aga (int start, int stop, bool blank) { if (blank) { - pfield_do_fill_line(start, stop, blank); + pfield_do_fill_line (start, stop, blank); return; } pfield_do_linetoscr_spriteonly(src_pixel, start, stop); } -static void dummy_worker(int start, int stop, bool blank) +static void dummy_worker (int start, int stop, bool blank) { } #ifdef ARMV6T2 STATIC_INLINE int DECODE_HAM8_1(int col, int pv) { - __asm__( - "ubfx %[pv], %[pv], #3, #5 \n\t" - "bfi %[col], %[pv], #0, #5 \n\t" - : [col] "+r"(col), - [pv] "+r"(pv)); - return col; + __asm__ ( + "ubfx %[pv], %[pv], #3, #5 \n\t" + "bfi %[col], %[pv], #0, #5 \n\t" + : [col] "+r" (col) , [pv] "+r" (pv) ); + return col; } - STATIC_INLINE int DECODE_HAM8_2(int col, int pv) { - __asm__( - "ubfx %[pv], %[pv], #3, #5 \n\t" - "bfi %[col], %[pv], #11, #5 \n\t" - : [col] "+r"(col), - [pv] "+r"(pv)); - return col; + __asm__ ( + "ubfx %[pv], %[pv], #3, #5 \n\t" + "bfi %[col], %[pv], #11, #5 \n\t" + : [col] "+r" (col) , [pv] "+r" (pv) ); + return col; } - STATIC_INLINE int DECODE_HAM8_3(int col, int pv) { - __asm__( - "ubfx %[pv], %[pv], #2, #6 \n\t" - "bfi %[col], %[pv], #5, #6 \n\t" - : [col] "+r"(col), - [pv] "+r"(pv)); - return col; + __asm__ ( + "ubfx %[pv], %[pv], #2, #6 \n\t" + "bfi %[col], %[pv], #5, #6 \n\t" + : [col] "+r" (col) , [pv] "+r" (pv) ); + return col; } STATIC_INLINE int DECODE_HAM6_1(int col, int pv) { - __asm__( - "lsl %[pv], %[pv], #1 \n\t" - "bfi %[col], %[pv], #0, #5 \n\t" - : [col] "+r"(col), - [pv] "+r"(pv)); - return (col); + __asm__ ( + "bfi %[col], %[pv], #1, #4 \n\t" + : [col] "+r" (col) : [pv] "r" (pv) ); + return (col); } - STATIC_INLINE int DECODE_HAM6_2(int col, int pv) { - __asm__( - "lsl %[pv], %[pv], #1 \n\t" - "bfi %[col], %[pv], #11, #5 \n\t" - : [col] "+r"(col), - [pv] "+r"(pv)); - return (col); + __asm__ ( + "bfi %[col], %[pv], #12, #4 \n\t" + : [col] "+r" (col) : [pv] "r" (pv) ); + return (col); } - STATIC_INLINE int DECODE_HAM6_3(int col, int pv) { - __asm__( - "lsl %[pv], %[pv], #2 \n\t" - "bfi %[col], %[pv], #5, #6 \n\t" - : [col] "+r"(col), - [pv] "+r"(pv)); - return (col); + __asm__ ( + "bfi %[col], %[pv], #7, #4 \n\t" + : [col] "+r" (col) : [pv] "r" (pv) ); + return (col); } #endif static int ham_decode_pixel; -static unsigned int ham_lastcolor; +static uae_u16 ham_lastcolor; /* Decode HAM in the invisible portion of the display (left of VISIBLE_LEFT_BORDER), * but don't draw anything in. This is done to prepare HAM_LASTCOLOR for later, * when decode_ham runs. * */ -static void init_ham_decoding(void) +static void init_ham_decoding (void) { - int unpainted_amiga = unpainted; - - ham_decode_pixel = src_pixel; - ham_lastcolor = color_reg_get(&colors_for_drawing, 0); + int unpainted_amiga = unpainted; + ham_decode_pixel = src_pixel; + ham_lastcolor = colors_for_drawing.acolors[0]; + if (!bplham) { if (unpainted_amiga > 0) { int pv = pixdata.apixels[ham_decode_pixel + unpainted_amiga - 1]; -#ifdef AGA - if (currprefs.chipset_mask & CSMASK_AGA) - ham_lastcolor = colors_for_drawing.color_regs_aga[pv ^ bplxor] & 0xffffff; + if (aga_mode) + ham_lastcolor = colors_for_drawing.acolors[pv ^ bplxor]; else -#endif - ham_lastcolor = colors_for_drawing.color_regs_ecs[pv] & 0xfff; + ham_lastcolor = colors_for_drawing.acolors[pv]; } - } - else if (currprefs.chipset_mask & CSMASK_AGA) - { - if (bplplanecnt >= 7) - { /* AGA mode HAM8 */ - while (unpainted_amiga-- > 0) - { - int pw = pixdata.apixels[ham_decode_pixel++]; - int pv = pw ^ bplxor; - int pc = pv >> 2; - switch (pv & 0x3) - { - case 0x0: ham_lastcolor = colors_for_drawing.color_regs_aga[pc] & 0xffffff; break; - break; -#ifdef NO_ARMV6T2 - case 0x1: ham_lastcolor = DECODE_HAM8_1(ham_lastcolor, pv); - break; - case 0x2: ham_lastcolor = DECODE_HAM8_2(ham_lastcolor, pv); - break; - case 0x3: ham_lastcolor = DECODE_HAM8_3(ham_lastcolor, pv); - break; + } else if (aga_mode) { + if (bplplanecnt >= 7) { /* AGA mode HAM8 */ + while (unpainted_amiga-- > 0) { + int pv = pixdata.apixels[ham_decode_pixel++] ^ bplxor; + switch (pv & 0x3) + { + case 0x0: ham_lastcolor = colors_for_drawing.acolors[pv >> 2]; break; +#ifdef ARMV6T2 + case 0x1: ham_lastcolor = DECODE_HAM8_1(ham_lastcolor, pv); break; + case 0x2: ham_lastcolor = DECODE_HAM8_2(ham_lastcolor, pv); break; + case 0x3: ham_lastcolor = DECODE_HAM8_3(ham_lastcolor, pv); break; #else - case 0x1: ham_lastcolor &= 0xFFFF03; ham_lastcolor |= (pw & 0xFC); break; - case 0x2: ham_lastcolor &= 0x03FFFF; ham_lastcolor |= (pw & 0xFC) << 16; break; - case 0x3: ham_lastcolor &= 0xFF03FF; ham_lastcolor |= (pw & 0xFC) << 8; break; + case 0x1: ham_lastcolor &= 0xFFFF03; ham_lastcolor |= (pv & 0xFC); break; + case 0x2: ham_lastcolor &= 0x03FFFF; ham_lastcolor |= (pv & 0xFC) << 16; break; + case 0x3: ham_lastcolor &= 0xFF03FF; ham_lastcolor |= (pv & 0xFC) << 8; break; +#endif + } + } + } else { /* AGA mode HAM6 */ + while (unpainted_amiga-- > 0) { + int pv = pixdata.apixels[ham_decode_pixel++] ^ bplxor; + uae_u32 pc = ((pv & 0xf) << 0) | ((pv & 0xf) << 4); + switch (pv & 0x30) + { + case 0x00: ham_lastcolor = colors_for_drawing.acolors[pv]; break; +#ifdef ARMV6T2 + case 0x10: ham_lastcolor = DECODE_HAM8_1(ham_lastcolor, pc); break; + case 0x20: ham_lastcolor = DECODE_HAM8_2(ham_lastcolor, pc); break; + case 0x30: ham_lastcolor = DECODE_HAM8_3(ham_lastcolor, pc); break; +#else + case 0x10: ham_lastcolor &= 0xFFFF00; ham_lastcolor |= (pc & 0xF) << 4; break; + case 0x20: ham_lastcolor &= 0x00FFFF; ham_lastcolor |= (pc & 0xF) << 20; break; + case 0x30: ham_lastcolor &= 0xFF00FF; ham_lastcolor |= (pc & 0xF) << 12; break; #endif } } } - else - { /* AGA mode HAM6 */ - while (unpainted_amiga-- > 0) - { - int pw = pixdata.apixels[ham_decode_pixel++]; - int pv = pw ^ bplxor; - uae_u32 pc = ((pw & 0xf) << 0) | ((pw & 0xf) << 4); - switch (pv & 0x30) - { - case 0x00: ham_lastcolor = colors_for_drawing.color_regs_aga[pv & 0x0f] & 0xffffff; break; - break; -#ifdef NO_ARMV6T2 - case 0x10: ham_lastcolor = DECODE_HAM6_1(ham_lastcolor, pv); - break; - case 0x20: ham_lastcolor = DECODE_HAM6_2(ham_lastcolor, pv); - break; - case 0x30: ham_lastcolor = DECODE_HAM6_3(ham_lastcolor, pv); - break; -#else - case 0x10: ham_lastcolor &= 0xFFFF00; ham_lastcolor |= pc << 0; break; - case 0x20: ham_lastcolor &= 0x00FFFF; ham_lastcolor |= pc << 16; break; - case 0x30: ham_lastcolor &= 0xFF00FF; ham_lastcolor |= pc << 8; break; -#endif - } - } - } - } - else - { + } else { /* OCS/ECS mode HAM6 */ - while (unpainted_amiga-- > 0) - { + while (unpainted_amiga-- > 0) { int pv = pixdata.apixels[ham_decode_pixel++]; - switch (pv & 0x30) - { - case 0x00: ham_lastcolor = colors_for_drawing.color_regs_ecs[pv] & 0xfff; break; - break; -#ifdef NO_ARMV6T2 - case 0x10: ham_lastcolor = DECODE_HAM6_1(ham_lastcolor, pv); - break; - case 0x20: ham_lastcolor = DECODE_HAM6_2(ham_lastcolor, pv); - break; - case 0x30: ham_lastcolor = DECODE_HAM6_3(ham_lastcolor, pv); - break; + switch (pv & 0x30) + { + case 0x00: ham_lastcolor = colors_for_drawing.acolors[pv]; break; +#ifdef ARMV6T2 + case 0x10: ham_lastcolor = DECODE_HAM6_1(ham_lastcolor, pv); break; + case 0x20: ham_lastcolor = DECODE_HAM6_2(ham_lastcolor, pv); break; + case 0x30: ham_lastcolor = DECODE_HAM6_3(ham_lastcolor, pv); break; #else - case 0x10: ham_lastcolor &= 0xFF0; ham_lastcolor |= (pv & 0xF); break; - case 0x20: ham_lastcolor &= 0x0FF; ham_lastcolor |= (pv & 0xF) << 8; break; - case 0x30: ham_lastcolor &= 0xF0F; ham_lastcolor |= (pv & 0xF) << 4; break; + case 0x10: ham_lastcolor &= 0xFF0; ham_lastcolor |= (pv & 0xF); break; + case 0x20: ham_lastcolor &= 0x0FF; ham_lastcolor |= (pv & 0xF) << 8; break; + case 0x30: ham_lastcolor &= 0xF0F; ham_lastcolor |= (pv & 0xF) << 4; break; #endif } } } } -static void decode_ham(int pix, int stoppos, bool blank) +static void decode_ham (int pix, int stoppos, bool blank) { - int todraw_amiga = res_shift_from_window(stoppos - pix); - int hdp = ham_decode_pixel; - - if (!bplham) - { - while (todraw_amiga-- > 0) - { + int todraw_amiga = res_shift_from_window (stoppos - pix); + + if (!bplham) { + while (todraw_amiga-- > 0) { int pv = pixdata.apixels[ham_decode_pixel]; -#ifdef AGA - if (currprefs.chipset_mask & CSMASK_AGA) - ham_lastcolor = colors_for_drawing.color_regs_aga[pv ^ bplxor] & 0xffffff; + if (aga_mode) + ham_lastcolor = colors_for_drawing.acolors[pv ^ bplxor]; else -#endif - ham_lastcolor = colors_for_drawing.color_regs_ecs[pv] & 0xfff; - + ham_lastcolor = colors_for_drawing.acolors[pv]; + ham_linebuf[ham_decode_pixel++] = ham_lastcolor; } - } - else if (currprefs.chipset_mask & CSMASK_AGA) - { - if (bplplanecnt >= 7) - { /* AGA mode HAM8 */ - while (todraw_amiga-- > 0) - { - int pw = pixdata.apixels[ham_decode_pixel]; - int pv = pw ^ bplxor; - int pc = pv >> 2; - switch (pv & 0x3) - { - case 0x0: ham_lastcolor = colors_for_drawing.color_regs_aga[pc] & 0xffffff; break; - break; -#ifdef NO_ARMV6T2 - case 0x1: ham_lastcolor = DECODE_HAM8_1(ham_lastcolor, pv); - break; - case 0x2: ham_lastcolor = DECODE_HAM8_2(ham_lastcolor, pv); - break; - case 0x3: ham_lastcolor = DECODE_HAM8_3(ham_lastcolor, pv); - break; + } else if (aga_mode) { + if (bplplanecnt >= 7) { /* AGA mode HAM8 */ + while (todraw_amiga-- > 0) { + int pv = pixdata.apixels[ham_decode_pixel] ^ bplxor; + switch (pv & 0x3) + { + case 0x0: ham_lastcolor = colors_for_drawing.acolors[pv >> 2]; break; +#ifdef ARMV6T2 + case 0x1: ham_lastcolor = DECODE_HAM8_1(ham_lastcolor, pv); break; + case 0x2: ham_lastcolor = DECODE_HAM8_2(ham_lastcolor, pv); break; + case 0x3: ham_lastcolor = DECODE_HAM8_3(ham_lastcolor, pv); break; #else - case 0x1: ham_lastcolor &= 0xFFFF03; ham_lastcolor |= (pw & 0xFC); break; - case 0x2: ham_lastcolor &= 0x03FFFF; ham_lastcolor |= (pw & 0xFC) << 16; break; - case 0x3: ham_lastcolor &= 0xFF03FF; ham_lastcolor |= (pw & 0xFC) << 8; break; + case 0x1: ham_lastcolor &= 0xFFFF03; ham_lastcolor |= (pv & 0xFC); break; + case 0x2: ham_lastcolor &= 0x03FFFF; ham_lastcolor |= (pv & 0xFC) << 16; break; + case 0x3: ham_lastcolor &= 0xFF03FF; ham_lastcolor |= (pv & 0xFC) << 8; break; +#endif + } + ham_linebuf[ham_decode_pixel++] = ham_lastcolor; + } + } else { /* AGA mode HAM6 */ + while (todraw_amiga-- > 0) { + int pv = pixdata.apixels[ham_decode_pixel] ^ bplxor; + uae_u32 pc = ((pv & 0xf) << 0) | ((pv & 0xf) << 4); + switch (pv & 0x30) + { + case 0x00: ham_lastcolor = colors_for_drawing.acolors[pv]; break; +#ifdef ARMV6T2 + case 0x10: ham_lastcolor = DECODE_HAM8_1(ham_lastcolor, pc); break; + case 0x20: ham_lastcolor = DECODE_HAM8_2(ham_lastcolor, pc); break; + case 0x30: ham_lastcolor = DECODE_HAM8_3(ham_lastcolor, pc); break; +#else + case 0x10: ham_lastcolor &= 0xFFFF00; ham_lastcolor |= (pc & 0xF) << 4; break; + case 0x20: ham_lastcolor &= 0x00FFFF; ham_lastcolor |= (pc & 0xF) << 20; break; + case 0x30: ham_lastcolor &= 0xFF00FF; ham_lastcolor |= (pc & 0xF) << 12; break; #endif } ham_linebuf[ham_decode_pixel++] = ham_lastcolor; } } - else - { /* AGA mode HAM6 */ - while (todraw_amiga-- > 0) - { - int pw = pixdata.apixels[ham_decode_pixel]; - int pv = pw ^ bplxor; - uae_u32 pc = ((pw & 0xf) << 0) | ((pw & 0xf) << 4); - switch (pv & 0x30) - { - case 0x00: ham_lastcolor = colors_for_drawing.color_regs_aga[pv & 0x0f] & 0xffffff; break; - break; -#ifdef NO_ARMV6T2 - case 0x10: ham_lastcolor = DECODE_HAM6_1(ham_lastcolor, pv); - break; - case 0x20: ham_lastcolor = DECODE_HAM6_2(ham_lastcolor, pv); - break; - case 0x30: ham_lastcolor = DECODE_HAM6_3(ham_lastcolor, pv); - break; -#else - case 0x10: ham_lastcolor &= 0xFFFF00; ham_lastcolor |= pc << 0; break; - case 0x20: ham_lastcolor &= 0x00FFFF; ham_lastcolor |= pc << 16; break; - case 0x30: ham_lastcolor &= 0xFF00FF; ham_lastcolor |= pc << 8; break; -#endif - } - ham_linebuf[ham_decode_pixel++] = ham_lastcolor; - } - } - } - else - { + } else { /* OCS/ECS mode HAM6 */ - while (todraw_amiga-- > 0) - { + while (todraw_amiga-- > 0) { int pv = pixdata.apixels[ham_decode_pixel]; - switch (pv & 0x30) - { - case 0x00: ham_lastcolor = colors_for_drawing.color_regs_ecs[pv] & 0xfff; break; - break; -#ifdef NO_ARMV6T2 - case 0x10: ham_lastcolor = DECODE_HAM6_1(ham_lastcolor, pv); - break; - case 0x20: ham_lastcolor = DECODE_HAM6_2(ham_lastcolor, pv); - break; - case 0x30: ham_lastcolor = DECODE_HAM6_3(ham_lastcolor, pv); - break; + switch (pv & 0x30) + { + case 0x00: ham_lastcolor = colors_for_drawing.acolors[pv]; break; +#ifdef ARMV6T2 + case 0x10: ham_lastcolor = DECODE_HAM6_1(ham_lastcolor, pv); break; + case 0x20: ham_lastcolor = DECODE_HAM6_2(ham_lastcolor, pv); break; + case 0x30: ham_lastcolor = DECODE_HAM6_3(ham_lastcolor, pv); break; #else - case 0x10: ham_lastcolor &= 0xFF0; ham_lastcolor |= (pv & 0xF); break; - case 0x20: ham_lastcolor &= 0x0FF; ham_lastcolor |= (pv & 0xF) << 8; break; - case 0x30: ham_lastcolor &= 0xF0F; ham_lastcolor |= (pv & 0xF) << 4; break; + case 0x10: ham_lastcolor &= 0xFF0; ham_lastcolor |= (pv & 0xF); break; + case 0x20: ham_lastcolor &= 0x0FF; ham_lastcolor |= (pv & 0xF) << 8; break; + case 0x30: ham_lastcolor &= 0xF0F; ham_lastcolor |= (pv & 0xF) << 4; break; #endif } ham_linebuf[ham_decode_pixel++] = ham_lastcolor; @@ -2156,18 +1025,7 @@ static void decode_ham(int pix, int stoppos, bool blank) } } -static void erase_ham_right_border(int pix, int stoppos, bool blank) -{ - if (stoppos < playfield_end) - return; - // erase right border in HAM modes or old HAM data may be visible - // if DDFSTOP < DIWSTOP (Uridium II title screen) - int todraw_amiga = res_shift_from_window(stoppos - pix); - while (todraw_amiga-- > 0) - ham_linebuf[ham_decode_pixel++] = 0; -} - -static void gen_pfield_tables(void) +static void gen_pfield_tables (void) { int i; @@ -2177,16 +1035,12 @@ static void gen_pfield_tables(void) dblpf_2nd1[i] = plane1 == 0 && plane2 != 0; dblpf_2nd2[i] = plane2 != 0; - -#ifdef AGA + dblpf_ind1_aga[i] = plane1 == 0 ? plane2 : plane1; dblpf_ind2_aga[i] = plane2 == 0 ? plane1 : plane2; -#endif - + dblpf_ms1[i] = plane1 == 0 ? (plane2 == 0 ? 16 : 8) : 0; dblpf_ms2[i] = plane2 == 0 ? (plane1 == 0 ? 16 : 0) : 8; - dblpf_ms[i] = i == 0 ? 16 : 8; - if (plane2 > 0) plane2 += 8; dblpf_ind1[i] = i >= 128 ? i & 0x7F : (plane1 == 0 ? plane2 : plane1); @@ -2200,48 +1054,69 @@ static void gen_pfield_tables(void) dblpf_ind1[i] = 0; } - sprite_offs[i] = (i & 15) ? 0 : 2; - clxtab[i] = ((((i & 3) && (i & 12)) << 9) - | (((i & 3) && (i & 48)) << 10) - | (((i & 3) && (i & 192)) << 11) - | (((i & 12) && (i & 48)) << 12) - | (((i & 12) && (i & 192)) << 13) - | (((i & 48) && (i & 192)) << 14)); - + | (((i & 3) && (i & 48)) << 10) + | (((i & 3) && (i & 192)) << 11) + | (((i & 12) && (i & 48)) << 12) + | (((i & 12) && (i & 192)) << 13) + | (((i & 48) && (i & 192)) << 14)); } - memset(all_ones, 0xff, MAX_PIXELS_PER_LINE); - + for(i=0; i<65536; ++i) + { + sprite_col_nat[i] = + (i & 0x0003) ? ((i >> 0) & 3) + 0 : + (i & 0x000C) ? ((i >> 2) & 3) + 0 : + (i & 0x0030) ? ((i >> 4) & 3) + 4 : + (i & 0x00C0) ? ((i >> 6) & 3) + 4 : + (i & 0x0300) ? ((i >> 8) & 3) + 8 : + (i & 0x0C00) ? ((i >> 10) & 3) + 8 : + (i & 0x3000) ? ((i >> 12) & 3) + 12 : + (i & 0xC000) ? ((i >> 14) & 3) + 12 : 0; + sprite_col_at[i] = + (i & 0x000F) ? ((i >> 0) & 0x000F) : + (i & 0x00F0) ? ((i >> 4) & 0x000F) : + (i & 0x0F00) ? ((i >> 8) & 0x000F) : + (i & 0xF000) ? ((i >> 12) & 0x000F) : 0; + sprite_bit[i] = + (i & 0x0003) ? 0x01 : + (i & 0x000C) ? 0x02 : + (i & 0x0030) ? 0x04 : + (i & 0x00C0) ? 0x08 : + (i & 0x0300) ? 0x10 : + (i & 0x0C00) ? 0x20 : + (i & 0x3000) ? 0x40 : + (i & 0xC000) ? 0x80 : 0; + } } /* When looking at this function and the ones that inline it, bear in mind -what an optimizing compiler will do with this code. All callers of this -function only pass in constant arguments (except for E). This means -that many of the if statements will go away completely after inlining. */ -STATIC_INLINE void draw_sprites_1(struct sprite_entry *e, int dualpf, int has_attach) + what an optimizing compiler will do with this code. All callers of this + function only pass in constant arguments (except for E). This means + that many of the if statements will go away completely after inlining. */ +STATIC_INLINE void draw_sprites_1 (struct sprite_entry *e, const int dualpf, const int has_attach) { - uae_u16 *buf = spixels + e->first_pixel; - uae_u8 *stbuf = spixstate.bytes + e->first_pixel; - int spr_pos, pos; + uae_u16 *buf = spixels + e->first_pixel; + uae_u8 *stbuf = spixstate.bytes + e->first_pixel; + int spr_pos, pos; int epos = e->pos; int emax = e->max; - buf -= epos; - stbuf -= epos; + buf -= epos; + stbuf -= epos; - spr_pos = epos + ((DIW_DDF_OFFSET - DISPLAY_LEFT_SHIFT) << sprite_buffer_res); + spr_pos = epos + ((DIW_DDF_OFFSET - DISPLAY_LEFT_SHIFT) << sprite_buffer_res); if (spr_pos < sprite_first_x) sprite_first_x = spr_pos; - for (pos = epos; pos < emax; pos++, spr_pos++) { + for (pos = epos; pos < emax; pos++, spr_pos++) { if (spr_pos >= 0 && spr_pos < MAX_PIXELS_PER_LINE) { spritepixels[spr_pos].data = buf[pos]; spritepixels[spr_pos].stdata = stbuf[pos]; spritepixels[spr_pos].attach = has_attach; } - } + } if (spr_pos > sprite_last_x) sprite_last_x = spr_pos; @@ -2250,38 +1125,34 @@ STATIC_INLINE void draw_sprites_1(struct sprite_entry *e, int dualpf, int has_at /* See comments above. Do not touch if you don't know what's going on. * (We do _not_ want the following to be inlined themselves). */ /* lores bitplane, lores sprites */ -static void NOINLINE draw_sprites_normal_sp_nat(struct sprite_entry *e) { draw_sprites_1(e, 0, 0); } -static void NOINLINE draw_sprites_normal_dp_nat(struct sprite_entry *e) { draw_sprites_1(e, 1, 0); } -static void NOINLINE draw_sprites_normal_sp_at(struct sprite_entry *e) { draw_sprites_1(e, 0, 1); } -static void NOINLINE draw_sprites_normal_dp_at(struct sprite_entry *e) { draw_sprites_1(e, 1, 1); } +static void NOINLINE draw_sprites_normal_sp_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0); } +static void NOINLINE draw_sprites_normal_dp_nat (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0); } +static void NOINLINE draw_sprites_normal_sp_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1); } +static void NOINLINE draw_sprites_normal_dp_at (struct sprite_entry *e) { draw_sprites_1 (e, 1, 1); } -#ifdef AGA /* not very optimized */ -STATIC_INLINE void draw_sprites_aga(struct sprite_entry *e, int aga) +STATIC_INLINE void draw_sprites_aga (struct sprite_entry *e, int aga) { - draw_sprites_1(e, bpldualpf, e->has_attached); + draw_sprites_1 (e, bpldualpf, e->has_attached); } -#endif -STATIC_INLINE void draw_sprites_ecs(struct sprite_entry *e) +STATIC_INLINE void draw_sprites_ecs (struct sprite_entry *e) { if (e->has_attached) { if (bpldualpf) - draw_sprites_normal_dp_at(e); + draw_sprites_normal_dp_at (e); else - draw_sprites_normal_sp_at(e); - } - else { + draw_sprites_normal_sp_at (e); + } else { if (bpldualpf) - draw_sprites_normal_dp_nat(e); + draw_sprites_normal_dp_nat (e); else - draw_sprites_normal_sp_nat(e); + draw_sprites_normal_sp_nat (e); } } -#ifdef AGA /* clear possible bitplane data outside DIW area */ -static void clear_bitplane_border_aga(void) +static void clear_bitplane_border_aga (void) { int len, shift = res_shift; uae_u8 v = 0; @@ -2289,20 +1160,18 @@ static void clear_bitplane_border_aga(void) if (shift < 0) { shift = -shift; len = (real_playfield_start - playfield_start) << shift; - memset(pixdata.apixels + pixels_offset + (playfield_start << shift), v, len); + memset (pixdata.apixels + pixels_offset + (playfield_start << shift), v, len); len = (playfield_end - real_playfield_end) << shift; - memset(pixdata.apixels + pixels_offset + (real_playfield_end << shift), v, len); - } - else { + memset (pixdata.apixels + pixels_offset + (real_playfield_end << shift), v, len); + } else { len = (real_playfield_start - playfield_start) >> shift; - memset(pixdata.apixels + pixels_offset + (playfield_start >> shift), v, len); + memset (pixdata.apixels + pixels_offset + (playfield_start >> shift), v, len); len = (playfield_end - real_playfield_end) >> shift; - memset(pixdata.apixels + pixels_offset + (real_playfield_end >> shift), v, len); + memset (pixdata.apixels + pixels_offset + (real_playfield_end >> shift), v, len); } } -#endif -static void weird_bitplane_fix(int start, int end) +static void weird_bitplane_fix (int start, int end) { int sh = lores_shift; uae_u8 *p = pixdata.apixels + pixels_offset; @@ -2315,15 +1184,13 @@ static void weird_bitplane_fix(int start, int end) if (p[i] & 16) p[i] = 16; } - } - else if (bpldualpf && bpldualpfpri) { + } else if (bpldualpf && bpldualpfpri) { /* in dualplayfield mode this feature is even more strange.. */ for (int i = start; i < end; i++) { if (p[i] & (2 | 8 | 32)) p[i] |= 0x40; } - } - else if (bpldualpf && !bpldualpfpri) { + } else if (bpldualpf && !bpldualpfpri) { for (int i = start; i < end; i++) { p[i] &= ~(2 | 8 | 32); } @@ -2344,24 +1211,23 @@ Don't touch this if you don't know what you are doing. */ #define DATA_POINTER(n) (line_data[lineno] + (n) * MAX_WORDS_PER_LINE * 2) -//TODO Test if this is actually faster -#ifdef NO_USE_ARMNEON +#if defined(USE_ARMNEON) && !defined(ANDROID) +// FIXME: these neon helper functions caused text rel problem on android #ifdef __cplusplus -extern "C" -{ + extern "C" { #endif - void ARM_doline_n1(uae_u32* pixels, int wordcount, int lineno); - void NEON_doline_n2(uae_u32* pixels, int wordcount, int lineno); - void NEON_doline_n3(uae_u32* pixels, int wordcount, int lineno); - void NEON_doline_n4(uae_u32* pixels, int wordcount, int lineno); - void NEON_doline_n6(uae_u32* pixels, int wordcount, int lineno); - void NEON_doline_n8(uae_u32* pixels, int wordcount, int lineno); + void ARM_doline_n1(uae_u32 *pixels, int wordcount, int lineno); + void NEON_doline_n2(uae_u32 *pixels, int wordcount, int lineno); + void NEON_doline_n3(uae_u32 *pixels, int wordcount, int lineno); + void NEON_doline_n4(uae_u32 *pixels, int wordcount, int lineno); + void NEON_doline_n6(uae_u32 *pixels, int wordcount, int lineno); + void NEON_doline_n8(uae_u32 *pixels, int wordcount, int lineno); #ifdef __cplusplus -} + } #endif -static void pfield_doline_n0(uae_u32* pixels, int wordcount, int lineno) +static void pfield_doline_n0 (uae_u32 *pixels, int wordcount, int lineno) { memset(pixels, 0, wordcount << 5); } @@ -2372,343 +1238,266 @@ static void pfield_doline_n0(uae_u32* pixels, int wordcount, int lineno) b ^= (tmp << shift); \ } -static void pfield_doline_n5(uae_u32* pixels, int wordcount, int lineno) +static void pfield_doline_n5 (uae_u32 *pixels, int wordcount, int lineno) { - uae_u8* real_bplpt[5]; + uae_u8 *real_bplpt[5]; - real_bplpt[0] = DATA_POINTER(0); - real_bplpt[1] = DATA_POINTER(1); - real_bplpt[2] = DATA_POINTER(2); - real_bplpt[3] = DATA_POINTER(3); - real_bplpt[4] = DATA_POINTER(4); + real_bplpt[0] = DATA_POINTER (0); + real_bplpt[1] = DATA_POINTER (1); + real_bplpt[2] = DATA_POINTER (2); + real_bplpt[3] = DATA_POINTER (3); + real_bplpt[4] = DATA_POINTER (4); - while (wordcount-- > 0) - { - uae_u32 b0, b1, b2, b3, b4, b5, b6, b7; - b3 = GETLONG(reinterpret_cast(real_bplpt[4])); - real_bplpt[4] += 4; - b4 = GETLONG(reinterpret_cast(real_bplpt[3])); - real_bplpt[3] += 4; - b5 = GETLONG(reinterpret_cast(real_bplpt[2])); - real_bplpt[2] += 4; - b6 = GETLONG(reinterpret_cast(real_bplpt[1])); - real_bplpt[1] += 4; - b7 = GETLONG(reinterpret_cast(real_bplpt[0])); - real_bplpt[0] += 4; + while (wordcount-- > 0) { + uae_u32 b0,b1,b2,b3,b4,b5,b6,b7; + b3 = GETLONG ((uae_u32 *)real_bplpt[4]); real_bplpt[4] += 4; + b4 = GETLONG ((uae_u32 *)real_bplpt[3]); real_bplpt[3] += 4; + b5 = GETLONG ((uae_u32 *)real_bplpt[2]); real_bplpt[2] += 4; + b6 = GETLONG ((uae_u32 *)real_bplpt[1]); real_bplpt[1] += 4; + b7 = GETLONG ((uae_u32 *)real_bplpt[0]); real_bplpt[0] += 4; - MERGE_0(b2, b3, 0x55555555, 1); - MERGE(b4, b5, 0x55555555, 1); - MERGE(b6, b7, 0x55555555, 1); + MERGE_0(b2, b3, 0x55555555, 1); + MERGE (b4, b5, 0x55555555, 1); + MERGE (b6, b7, 0x55555555, 1); - MERGE_0(b0, b2, 0x33333333, 2); - MERGE_0(b1, b3, 0x33333333, 2); - MERGE(b4, b6, 0x33333333, 2); - MERGE(b5, b7, 0x33333333, 2); + MERGE_0(b0, b2, 0x33333333, 2); + MERGE_0(b1, b3, 0x33333333, 2); + MERGE (b4, b6, 0x33333333, 2); + MERGE (b5, b7, 0x33333333, 2); - MERGE(b0, b4, 0x0f0f0f0f, 4); - MERGE(b1, b5, 0x0f0f0f0f, 4); - MERGE(b2, b6, 0x0f0f0f0f, 4); - MERGE(b3, b7, 0x0f0f0f0f, 4); + MERGE (b0, b4, 0x0f0f0f0f, 4); + MERGE (b1, b5, 0x0f0f0f0f, 4); + MERGE (b2, b6, 0x0f0f0f0f, 4); + MERGE (b3, b7, 0x0f0f0f0f, 4); - MERGE(b0, b1, 0x00ff00ff, 8); - MERGE(b2, b3, 0x00ff00ff, 8); - MERGE(b4, b5, 0x00ff00ff, 8); - MERGE(b6, b7, 0x00ff00ff, 8); + MERGE (b0, b1, 0x00ff00ff, 8); + MERGE (b2, b3, 0x00ff00ff, 8); + MERGE (b4, b5, 0x00ff00ff, 8); + MERGE (b6, b7, 0x00ff00ff, 8); - MERGE(b0, b2, 0x0000ffff, 16); - do_put_mem_long(pixels, b0); - do_put_mem_long(pixels + 4, b2); - MERGE(b1, b3, 0x0000ffff, 16); - do_put_mem_long(pixels + 2, b1); - do_put_mem_long(pixels + 6, b3); - MERGE(b4, b6, 0x0000ffff, 16); - do_put_mem_long(pixels + 1, b4); - do_put_mem_long(pixels + 5, b6); - MERGE(b5, b7, 0x0000ffff, 16); - do_put_mem_long(pixels + 3, b5); - do_put_mem_long(pixels + 7, b7); - pixels += 8; - } + MERGE (b0, b2, 0x0000ffff, 16); + do_put_mem_long(pixels, b0); + do_put_mem_long(pixels + 4, b2); + MERGE (b1, b3, 0x0000ffff, 16); + do_put_mem_long(pixels + 2, b1); + do_put_mem_long(pixels + 6, b3); + MERGE (b4, b6, 0x0000ffff, 16); + do_put_mem_long(pixels + 1, b4); + do_put_mem_long(pixels + 5, b6); + MERGE (b5, b7, 0x0000ffff, 16); + do_put_mem_long(pixels + 3, b5); + do_put_mem_long(pixels + 7, b7); + pixels += 8; + } } -static void pfield_doline_n7(uae_u32* pixels, int wordcount, int lineno) +static void pfield_doline_n7 (uae_u32 *pixels, int wordcount, int lineno) { - uae_u8* real_bplpt[7]; - real_bplpt[0] = DATA_POINTER(0); - real_bplpt[1] = DATA_POINTER(1); - real_bplpt[2] = DATA_POINTER(2); - real_bplpt[3] = DATA_POINTER(3); - real_bplpt[4] = DATA_POINTER(4); - real_bplpt[5] = DATA_POINTER(5); - real_bplpt[6] = DATA_POINTER(6); + uae_u8 *real_bplpt[7]; + real_bplpt[0] = DATA_POINTER (0); + real_bplpt[1] = DATA_POINTER (1); + real_bplpt[2] = DATA_POINTER (2); + real_bplpt[3] = DATA_POINTER (3); + real_bplpt[4] = DATA_POINTER (4); + real_bplpt[5] = DATA_POINTER (5); + real_bplpt[6] = DATA_POINTER (6); - while (wordcount-- > 0) - { - uae_u32 b0, b1, b2, b3, b4, b5, b6, b7; - b1 = GETLONG(reinterpret_cast(real_bplpt[6])); - real_bplpt[6] += 4; - b2 = GETLONG(reinterpret_cast(real_bplpt[5])); - real_bplpt[5] += 4; - b3 = GETLONG(reinterpret_cast(real_bplpt[4])); - real_bplpt[4] += 4; - b4 = GETLONG(reinterpret_cast(real_bplpt[3])); - real_bplpt[3] += 4; - b5 = GETLONG(reinterpret_cast(real_bplpt[2])); - real_bplpt[2] += 4; - b6 = GETLONG(reinterpret_cast(real_bplpt[1])); - real_bplpt[1] += 4; - b7 = GETLONG(reinterpret_cast(real_bplpt[0])); - real_bplpt[0] += 4; + while (wordcount-- > 0) { + uae_u32 b0,b1,b2,b3,b4,b5,b6,b7; + b1 = GETLONG ((uae_u32 *)real_bplpt[6]); real_bplpt[6] += 4; + b2 = GETLONG ((uae_u32 *)real_bplpt[5]); real_bplpt[5] += 4; + b3 = GETLONG ((uae_u32 *)real_bplpt[4]); real_bplpt[4] += 4; + b4 = GETLONG ((uae_u32 *)real_bplpt[3]); real_bplpt[3] += 4; + b5 = GETLONG ((uae_u32 *)real_bplpt[2]); real_bplpt[2] += 4; + b6 = GETLONG ((uae_u32 *)real_bplpt[1]); real_bplpt[1] += 4; + b7 = GETLONG ((uae_u32 *)real_bplpt[0]); real_bplpt[0] += 4; - MERGE_0(b0, b1, 0x55555555, 1); - MERGE(b2, b3, 0x55555555, 1); - MERGE(b4, b5, 0x55555555, 1); - MERGE(b6, b7, 0x55555555, 1); + MERGE_0(b0, b1, 0x55555555, 1); + MERGE (b2, b3, 0x55555555, 1); + MERGE (b4, b5, 0x55555555, 1); + MERGE (b6, b7, 0x55555555, 1); - MERGE(b0, b2, 0x33333333, 2); - MERGE(b1, b3, 0x33333333, 2); - MERGE(b4, b6, 0x33333333, 2); - MERGE(b5, b7, 0x33333333, 2); + MERGE (b0, b2, 0x33333333, 2); + MERGE (b1, b3, 0x33333333, 2); + MERGE (b4, b6, 0x33333333, 2); + MERGE (b5, b7, 0x33333333, 2); - MERGE(b0, b4, 0x0f0f0f0f, 4); - MERGE(b1, b5, 0x0f0f0f0f, 4); - MERGE(b2, b6, 0x0f0f0f0f, 4); - MERGE(b3, b7, 0x0f0f0f0f, 4); + MERGE (b0, b4, 0x0f0f0f0f, 4); + MERGE (b1, b5, 0x0f0f0f0f, 4); + MERGE (b2, b6, 0x0f0f0f0f, 4); + MERGE (b3, b7, 0x0f0f0f0f, 4); - MERGE(b0, b1, 0x00ff00ff, 8); - MERGE(b2, b3, 0x00ff00ff, 8); - MERGE(b4, b5, 0x00ff00ff, 8); - MERGE(b6, b7, 0x00ff00ff, 8); + MERGE (b0, b1, 0x00ff00ff, 8); + MERGE (b2, b3, 0x00ff00ff, 8); + MERGE (b4, b5, 0x00ff00ff, 8); + MERGE (b6, b7, 0x00ff00ff, 8); - MERGE(b0, b2, 0x0000ffff, 16); - do_put_mem_long(pixels, b0); - do_put_mem_long(pixels + 4, b2); - MERGE(b1, b3, 0x0000ffff, 16); - do_put_mem_long(pixels + 2, b1); - do_put_mem_long(pixels + 6, b3); - MERGE(b4, b6, 0x0000ffff, 16); - do_put_mem_long(pixels + 1, b4); - do_put_mem_long(pixels + 5, b6); - MERGE(b5, b7, 0x0000ffff, 16); - do_put_mem_long(pixels + 3, b5); - do_put_mem_long(pixels + 7, b7); - pixels += 8; - } + MERGE (b0, b2, 0x0000ffff, 16); + do_put_mem_long(pixels, b0); + do_put_mem_long(pixels + 4, b2); + MERGE (b1, b3, 0x0000ffff, 16); + do_put_mem_long(pixels + 2, b1); + do_put_mem_long(pixels + 6, b3); + MERGE (b4, b6, 0x0000ffff, 16); + do_put_mem_long(pixels + 1, b4); + do_put_mem_long(pixels + 5, b6); + MERGE (b5, b7, 0x0000ffff, 16); + do_put_mem_long(pixels + 3, b5); + do_put_mem_long(pixels + 7, b7); + pixels += 8; + } } -typedef void (*pfield_doline_func)(uae_u32*, int, int); +typedef void (*pfield_doline_func)(uae_u32 *, int, int); -static pfield_doline_func pfield_doline_n[9] = { - pfield_doline_n0, - ARM_doline_n1, - NEON_doline_n2, - NEON_doline_n3, - NEON_doline_n4, - pfield_doline_n5, - NEON_doline_n6, - pfield_doline_n7, +static pfield_doline_func pfield_doline_n[9]={ + pfield_doline_n0, ARM_doline_n1, NEON_doline_n2, NEON_doline_n3, + NEON_doline_n4, pfield_doline_n5, NEON_doline_n6, pfield_doline_n7, NEON_doline_n8 }; #else -STATIC_INLINE void pfield_doline_1(uae_u32 *pixels, int wordcount, int planes) +static uae_u8 *real_bplpt[8]; + +STATIC_INLINE void pfield_doline_1 (uae_u32 *pixels, int wordcount, int planes) { - while (wordcount-- > 0) { - uae_u32 b0, b1, b2, b3, b4, b5, b6, b7; + while (wordcount-- > 0) { + uae_u32 b0,b1,b2,b3,b4,b5,b6,b7; - b0 = 0, b1 = 0, b2 = 0, b3 = 0, b4 = 0, b5 = 0, b6 = 0, b7 = 0; - switch (planes) { -#ifdef AGA - case 8: b0 = GETLONG(real_bplpt[7]); real_bplpt[7] += 4; - case 7: b1 = GETLONG(real_bplpt[6]); real_bplpt[6] += 4; -#endif - case 6: b2 = GETLONG(real_bplpt[5]); real_bplpt[5] += 4; - case 5: b3 = GETLONG(real_bplpt[4]); real_bplpt[4] += 4; - case 4: b4 = GETLONG(real_bplpt[3]); real_bplpt[3] += 4; - case 3: b5 = GETLONG(real_bplpt[2]); real_bplpt[2] += 4; - case 2: b6 = GETLONG(real_bplpt[1]); real_bplpt[1] += 4; - case 1: b7 = GETLONG(real_bplpt[0]); real_bplpt[0] += 4; - } + b0 = 0, b1 = 0, b2 = 0, b3 = 0, b4 = 0, b5 = 0, b6 = 0, b7 = 0; + switch (planes) { + case 8: b0 = GETLONG (real_bplpt[7]); real_bplpt[7] += 4; + case 7: b1 = GETLONG (real_bplpt[6]); real_bplpt[6] += 4; + case 6: b2 = GETLONG (real_bplpt[5]); real_bplpt[5] += 4; + case 5: b3 = GETLONG (real_bplpt[4]); real_bplpt[4] += 4; + case 4: b4 = GETLONG (real_bplpt[3]); real_bplpt[3] += 4; + case 3: b5 = GETLONG (real_bplpt[2]); real_bplpt[2] += 4; + case 2: b6 = GETLONG (real_bplpt[1]); real_bplpt[1] += 4; + case 1: b7 = GETLONG (real_bplpt[0]); real_bplpt[0] += 4; + } - MERGE(b0, b1, 0x55555555, 1); - MERGE(b2, b3, 0x55555555, 1); - MERGE(b4, b5, 0x55555555, 1); - MERGE(b6, b7, 0x55555555, 1); + MERGE (b0, b1, 0x55555555, 1); + MERGE (b2, b3, 0x55555555, 1); + MERGE (b4, b5, 0x55555555, 1); + MERGE (b6, b7, 0x55555555, 1); - MERGE(b0, b2, 0x33333333, 2); - MERGE(b1, b3, 0x33333333, 2); - MERGE(b4, b6, 0x33333333, 2); - MERGE(b5, b7, 0x33333333, 2); + MERGE (b0, b2, 0x33333333, 2); + MERGE (b1, b3, 0x33333333, 2); + MERGE (b4, b6, 0x33333333, 2); + MERGE (b5, b7, 0x33333333, 2); - MERGE(b0, b4, 0x0f0f0f0f, 4); - MERGE(b1, b5, 0x0f0f0f0f, 4); - MERGE(b2, b6, 0x0f0f0f0f, 4); - MERGE(b3, b7, 0x0f0f0f0f, 4); + MERGE (b0, b4, 0x0f0f0f0f, 4); + MERGE (b1, b5, 0x0f0f0f0f, 4); + MERGE (b2, b6, 0x0f0f0f0f, 4); + MERGE (b3, b7, 0x0f0f0f0f, 4); - MERGE(b0, b1, 0x00ff00ff, 8); - MERGE(b2, b3, 0x00ff00ff, 8); - MERGE(b4, b5, 0x00ff00ff, 8); - MERGE(b6, b7, 0x00ff00ff, 8); + MERGE (b0, b1, 0x00ff00ff, 8); + MERGE (b2, b3, 0x00ff00ff, 8); + MERGE (b4, b5, 0x00ff00ff, 8); + MERGE (b6, b7, 0x00ff00ff, 8); - MERGE(b0, b2, 0x0000ffff, 16); - do_put_mem_long(pixels, b0); - do_put_mem_long(pixels + 4, b2); - MERGE(b1, b3, 0x0000ffff, 16); - do_put_mem_long(pixels + 2, b1); - do_put_mem_long(pixels + 6, b3); - MERGE(b4, b6, 0x0000ffff, 16); - do_put_mem_long(pixels + 1, b4); - do_put_mem_long(pixels + 5, b6); - MERGE(b5, b7, 0x0000ffff, 16); - do_put_mem_long(pixels + 3, b5); - do_put_mem_long(pixels + 7, b7); - pixels += 8; - } + MERGE (b0, b2, 0x0000ffff, 16); + do_put_mem_long (pixels, b0); + do_put_mem_long (pixels + 4, b2); + MERGE (b1, b3, 0x0000ffff, 16); + do_put_mem_long (pixels + 2, b1); + do_put_mem_long (pixels + 6, b3); + MERGE (b4, b6, 0x0000ffff, 16); + do_put_mem_long (pixels + 1, b4); + do_put_mem_long (pixels + 5, b6); + MERGE (b5, b7, 0x0000ffff, 16); + do_put_mem_long (pixels + 3, b5); + do_put_mem_long (pixels + 7, b7); + pixels += 8; + } } /* See above for comments on inlining. These functions should _not_ -be inlined themselves. */ -static void NOINLINE pfield_doline_n1(uae_u32 *data, int count) { pfield_doline_1(data, count, 1); } -static void NOINLINE pfield_doline_n2(uae_u32 *data, int count) { pfield_doline_1(data, count, 2); } -static void NOINLINE pfield_doline_n3(uae_u32 *data, int count) { pfield_doline_1(data, count, 3); } -static void NOINLINE pfield_doline_n4(uae_u32 *data, int count) { pfield_doline_1(data, count, 4); } -static void NOINLINE pfield_doline_n5(uae_u32 *data, int count) { pfield_doline_1(data, count, 5); } -static void NOINLINE pfield_doline_n6(uae_u32 *data, int count) { pfield_doline_1(data, count, 6); } -#ifdef AGA -static void NOINLINE pfield_doline_n7(uae_u32 *data, int count) { pfield_doline_1(data, count, 7); } -static void NOINLINE pfield_doline_n8(uae_u32 *data, int count) { pfield_doline_1(data, count, 8); } -#endif + be inlined themselves. */ +static void NOINLINE pfield_doline_n1 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 1); } +static void NOINLINE pfield_doline_n2 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 2); } +static void NOINLINE pfield_doline_n3 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 3); } +static void NOINLINE pfield_doline_n4 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 4); } +static void NOINLINE pfield_doline_n5 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 5); } +static void NOINLINE pfield_doline_n6 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 6); } +static void NOINLINE pfield_doline_n7 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 7); } +static void NOINLINE pfield_doline_n8 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 8); } #endif /* USE_ARMNEON */ -static void pfield_doline(int lineno) +static void pfield_doline (int lineno) { - int wordcount = dp_for_drawing->plflinelen; - uae_u32 *data = pixdata.apixels_l + MAX_PIXELS_PER_LINE / 4; - - //TODO Test if this is actually faster -#ifdef NO_USE_ARMNEON - pfield_doline_n[bplplanecnt](data, wordcount, lineno); + int wordcount = dp_for_drawing->plflinelen; + uae_u32 *data = pixdata.apixels_l + MAX_PIXELS_PER_LINE / 4; + +#if defined(USE_ARMNEON) && !defined(ANDROID) + pfield_doline_n[bplplanecnt](data, wordcount, lineno); #else -#ifdef SMART_UPDATE -//#define DATA_POINTER(n) ((debug_bpl_mask & (1 << n)) ? (line_data[lineno] + (n) * MAX_WORDS_PER_LINE * 2) : (debug_bpl_mask_one ? all_ones : all_zeros)) - real_bplpt[0] = DATA_POINTER(0); - real_bplpt[1] = DATA_POINTER(1); - real_bplpt[2] = DATA_POINTER(2); - real_bplpt[3] = DATA_POINTER(3); - real_bplpt[4] = DATA_POINTER(4); - real_bplpt[5] = DATA_POINTER(5); -#ifdef AGA - real_bplpt[6] = DATA_POINTER(6); - real_bplpt[7] = DATA_POINTER(7); -#endif -#endif + real_bplpt[0] = DATA_POINTER (0); + real_bplpt[1] = DATA_POINTER (1); + real_bplpt[2] = DATA_POINTER (2); + real_bplpt[3] = DATA_POINTER (3); + real_bplpt[4] = DATA_POINTER (4); + real_bplpt[5] = DATA_POINTER (5); + real_bplpt[6] = DATA_POINTER (6); + real_bplpt[7] = DATA_POINTER (7); - switch (bplplanecnt) { - default: break; - case 0: memset(data, 0, wordcount * 32); break; - case 1: pfield_doline_n1(data, wordcount); break; - case 2: pfield_doline_n2(data, wordcount); break; - case 3: pfield_doline_n3(data, wordcount); break; - case 4: pfield_doline_n4(data, wordcount); break; - case 5: pfield_doline_n5(data, wordcount); break; - case 6: pfield_doline_n6(data, wordcount); break; -#ifdef AGA - case 7: pfield_doline_n7(data, wordcount); break; - case 8: pfield_doline_n8(data, wordcount); break; -#endif -} + switch (bplplanecnt) { + default: break; + case 0: memset (data, 0, wordcount * 32); break; + case 1: pfield_doline_n1 (data, wordcount); break; + case 2: pfield_doline_n2 (data, wordcount); break; + case 3: pfield_doline_n3 (data, wordcount); break; + case 4: pfield_doline_n4 (data, wordcount); break; + case 5: pfield_doline_n5 (data, wordcount); break; + case 6: pfield_doline_n6 (data, wordcount); break; + case 7: pfield_doline_n7 (data, wordcount); break; + case 8: pfield_doline_n8 (data, wordcount); break; + } #endif /* USE_ARMNEON */ - - if (refresh_indicator_buffer && refresh_indicator_height > lineno) { - uae_u8 *opline = refresh_indicator_buffer + lineno * MAX_PIXELS_PER_LINE * 2; - wordcount *= 32; - if (!memcmp(opline, data, wordcount)) { - if (refresh_indicator_changed[lineno] != 0xff) { - refresh_indicator_changed[lineno]++; - if (refresh_indicator_changed[lineno] > refresh_indicator_changed_prev[lineno]) { - refresh_indicator_changed_prev[lineno] = refresh_indicator_changed[lineno]; - } - } - } - else { - memcpy(opline, data, wordcount); - if (refresh_indicator_changed[lineno] != refresh_indicator_changed_prev[lineno]) - refresh_indicator_changed_prev[lineno] = 0; - refresh_indicator_changed[lineno] = 0; - } - } } -void init_row_map(void) +void init_row_map (void) { static uae_u8 *oldbufmem; static int oldheight, oldpitch; - static bool oldgenlock; int i, j; - if (gfxvidinfo.outheight > max_uae_height) - { - write_log(_T("Resolution too high, aborting\n")); - abort(); - } if (!row_map) { row_map = xmalloc(uae_u8*, max_uae_height + 1); - row_map_genlock = xmalloc(uae_u8*, max_uae_height + 1); } - if (oldbufmem && oldbufmem == gfxvidinfo.bufmem && - oldheight == gfxvidinfo.outheight && - oldpitch == gfxvidinfo.rowbytes && - oldgenlock == init_genlock_data) + if (oldbufmem && oldbufmem == gfxvidinfo.drawbuffer.bufmem && + oldheight == gfxvidinfo.drawbuffer.outheight && + oldpitch == gfxvidinfo.drawbuffer.rowbytes) return; - xfree(row_map_genlock_buffer); - row_map_genlock_buffer = NULL; - if (init_genlock_data) { - row_map_genlock_buffer = xcalloc(uae_u8, gfxvidinfo.outwidth * (gfxvidinfo.outheight + 2)); - } - xfree(row_map_color_burst_buffer); - row_map_color_burst_buffer = NULL; - //if (currprefs.cs_color_burst) { - // row_map_color_burst_buffer = xcalloc(uae_u8, gfxvidinfo.outheight + 2); - //} j = oldheight == 0 ? max_uae_height : oldheight; - for (i = gfxvidinfo.outheight; i < max_uae_height + 1 && i < j + 1; i++) { + for (i = gfxvidinfo.drawbuffer.outheight; i < max_uae_height + 1 && i < j + 1; i++) { row_map[i] = row_tmp; - row_map_genlock[i] = row_tmp; } - for (i = 0, j = 0; i < gfxvidinfo.outheight; i++, j += gfxvidinfo.rowbytes) { - row_map[i] = gfxvidinfo.bufmem + j; - if (init_genlock_data) { - row_map_genlock[i] = row_map_genlock_buffer + gfxvidinfo.outwidth * (i + 1); - } - else { - row_map_genlock[i] = NULL; - } + for (i = 0, j = 0; i < gfxvidinfo.drawbuffer.outheight; i++, j += gfxvidinfo.drawbuffer.rowbytes) { + row_map[i] = gfxvidinfo.drawbuffer.bufmem + j; } - oldbufmem = gfxvidinfo.bufmem; - oldheight = gfxvidinfo.outheight; - oldpitch = gfxvidinfo.rowbytes; - oldgenlock = init_genlock_data; + oldbufmem = gfxvidinfo.drawbuffer.bufmem; + oldheight = gfxvidinfo.drawbuffer.outheight; + oldpitch = gfxvidinfo.drawbuffer.rowbytes; } -static void init_aspect_maps() +static void init_aspect_maps (void) { - int i, maxl, h; + int i, maxl, h; - h = gfxvidinfo.outheight; + linedbl = currprefs.gfx_vresolution; + maxl = (MAXVPOS + 1) << linedbl; + min_ypos_for_screen = minfirstline << linedbl; + max_drawn_amiga_line = -1; + h = gfxvidinfo.drawbuffer.outheight; if (h == 0) - /* Do nothing if the gfx driver hasn't initialized the screen yet */ + /* Do nothing if the gfx driver hasn't initialized the screen yet */ return; - linedbld = linedbl = currprefs.gfx_vresolution; - if (doublescan > 0 && interlace_seen <= 0) { - linedbl = 0; - linedbld = 1; - } - if (native2amiga_line_map) xfree(native2amiga_line_map); if (amiga2aspect_line_map) @@ -2718,9 +1507,6 @@ static void init_aspect_maps() amiga2aspect_line_map = xmalloc(int, (MAXVPOS + 1) * 2 + 1); native2amiga_line_map = xmalloc(int, h); - maxl = (MAXVPOS + 1) << linedbld; - min_ypos_for_screen = minfirstline << linedbl; - max_drawn_amiga_line = -1; for (i = 0; i < maxl; i++) { int v = i - min_ypos_for_screen; if (v >= h && max_drawn_amiga_line < 0) @@ -2740,89 +1526,51 @@ static void init_aspect_maps() if (amiga2aspect_line_map[i] == -1) continue; for (j = amiga2aspect_line_map[i]; j < h && native2amiga_line_map[j] == -1; j++) - native2amiga_line_map[j] = i >> linedbl; + native2amiga_line_map[j] = (i + VERTICAL_OFFSET) >> linedbl; } - - visible_left_start = 0; - visible_right_stop = MAX_STOP; - visible_top_start = 0; - visible_bottom_stop = MAX_STOP; - set_blanking_limits(); } /* -* A raster line has been built in the graphics buffer. Tell the graphics code -* to do anything necessary to display it. -*/ -static void do_flush_line_1(int lineno) + * One drawing frame has been finished. Tell the graphics code about it. + */ +STATIC_INLINE void do_flush_screen () { - if (lineno < first_drawn_line) - first_drawn_line = lineno; - if (lineno > last_drawn_line) - last_drawn_line = lineno; - - //if (gfxvidinfo.maxblocklines == 0) - // flush_line(vb, lineno); - //else { - // if ((last_block_line + 2) < lineno) { - // if (first_block_line != NO_BLOCK) - // flush_block(vb, first_block_line, last_block_line); - // first_block_line = lineno; - // } - // last_block_line = lineno; - // if (last_block_line - first_block_line >= gfxvidinfo.maxblocklines) { - // flush_block(vb, first_block_line, last_block_line); - // first_block_line = last_block_line = NO_BLOCK; - // } - //} -} - -STATIC_INLINE void do_flush_line(int lineno) -{ - do_flush_line_1(lineno); -} - -/* -* One drawing frame has been finished. Tell the graphics code about it. -* Note that the actual flush_screen() call is a no-op for all reasonable -* systems. -*/ -STATIC_INLINE void do_flush_screen() -{ - flush_screen(); /* vsync mode */ + unlockscr (); + screenlocked = false; } /* We only save hardware registers during the hardware frame. Now, when * drawing the frame, we expand the data into a slightly more useful * form. */ -static void pfield_expand_dp_bplcon(void) +static void pfield_expand_dp_bplcon (void) { bool pfield_mode_changed = false; - bplres = dp_for_drawing->bplres; - bplplanecnt = dp_for_drawing->nr_planes; - bplham = dp_for_drawing->ham_seen; - bplehb = dp_for_drawing->ehb_seen; + bplres = dp_for_drawing->bplres; + bplplanecnt = dp_for_drawing->nr_planes; + bplham = dp_for_drawing->ham_seen; + if (aga_mode) { + bplehb = (dp_for_drawing->bplcon0 & 0x7010) == 0x6000; + bpldualpf2of = (dp_for_drawing->bplcon3 >> 10) & 7; + sbasecol[0] = ((dp_for_drawing->bplcon4 >> 4) & 15) << 4; + sbasecol[1] = ((dp_for_drawing->bplcon4 >> 0) & 15) << 4; + bplxor = dp_for_drawing->bplcon4 >> 8; + } else + bplehb = (dp_for_drawing->bplcon0 & 0xFC00) == 0x6000 || (dp_for_drawing->bplcon0 & 0xFC00) == 0x7000; if ((currprefs.chipset_mask & CSMASK_ECS_DENISE) && (dp_for_drawing->bplcon2 & 0x0200)) bplehb = 0; - issprites = dip_for_drawing->nr_sprites > 0; - bplcolorburst = (dp_for_drawing->bplcon0 & 0x200) != 0; - if (!bplcolorburst) - bplcolorburst_field = 0; -#ifdef ECS_DENISE int oecsshres = ecsshres; ecsshres = bplres == RES_SUPERHIRES && (currprefs.chipset_mask & CSMASK_ECS_DENISE) && !(currprefs.chipset_mask & CSMASK_AGA); pfield_mode_changed = oecsshres != ecsshres; -#endif + + plf1pri = dp_for_drawing->bplcon2 & 7; + plf2pri = (dp_for_drawing->bplcon2 >> 3) & 7; + plf_sprite_mask = 0xFFFF0000 << (4 * plf2pri); + plf_sprite_mask |= (0x0000FFFF << (4 * plf1pri)) & 0xFFFF; + plf_sprite_mask_n16 = ~(plf_sprite_mask >> 16); + bpldualpf = (dp_for_drawing->bplcon0 & 0x400) == 0x400; + bpldualpfpri = (dp_for_drawing->bplcon2 & 0x40) == 0x40; - plf1pri = dp_for_drawing->bplcon2 & 7; - plf2pri = (dp_for_drawing->bplcon2 >> 3) & 7; - plf_sprite_mask = 0xFFFF0000 << (4 * plf2pri); - plf_sprite_mask |= (0x0000FFFF << (4 * plf1pri)) & 0xFFFF; - bpldualpf = (dp_for_drawing->bplcon0 & 0x400) == 0x400; - bpldualpfpri = (dp_for_drawing->bplcon2 & 0x40) == 0x40; - -#ifdef AGA // BYPASS: HAM and EHB select bits are ignored if (bplbypass != (dp_for_drawing->bplcon0 & 0x20) != 0) { bpland = 0xff; @@ -2839,81 +1587,56 @@ static void pfield_expand_dp_bplcon(void) bpland = 31; bplehb = 0; } - bpldualpf2of = (dp_for_drawing->bplcon3 >> 10) & 7; - sbasecol[0] = ((dp_for_drawing->bplcon4 >> 4) & 15) << 4; - sbasecol[1] = ((dp_for_drawing->bplcon4 >> 0) & 15) << 4; - bplxor = dp_for_drawing->bplcon4 >> 8; - int sh = (colors_for_drawing.extra >> CE_SHRES_DELAY) & 3; - if (sh != bpldelay_sh) { - bpldelay_sh = sh; - pfield_mode_changed = true; - } -#endif - ecs_genlock_features_active = (currprefs.chipset_mask & CSMASK_ECS_DENISE) && ((dp_for_drawing->bplcon2 & 0x0c00) || ce_is_borderntrans(colors_for_drawing.extra)) ? 1 : 0; - if (ecs_genlock_features_active) { - ecs_genlock_features_colorkey = false; - ecs_genlock_features_mask = 0; - if (dp_for_drawing->bplcon3 & 0x0800) { - ecs_genlock_features_mask = 1 << ((dp_for_drawing->bplcon2 >> 12) & 7); - } - if (dp_for_drawing->bplcon3 & 0x0400) { - ecs_genlock_features_colorkey = true; - } - } + if (pfield_mode_changed) pfield_set_linetoscr(); } -static bool isham(uae_u16 bplcon0) +static bool isham (uae_u16 bplcon0) { - int p = GET_PLANES(bplcon0); - if (!(bplcon0 & 0x800)) - return 0; - if (currprefs.chipset_mask & CSMASK_AGA) { - // AGA only has 6 or 8 plane HAM - if (p == 6 || p == 8) - return 1; - } - else { - // OCS/ECS also supports 5 plane HAM - if (GET_RES_DENISE(bplcon0) > 0) - return 0; - if (p >= 5) - return 1; - } - return 0; + int p = GET_PLANES (bplcon0); + if (!(bplcon0 & 0x800)) + return 0; + if (aga_mode) { + // AGA only has 6 or 8 plane HAM + if (p == 6 || p == 8) + return 1; + } else { + // OCS/ECS also supports 5 plane HAM + if (GET_RES_DENISE (bplcon0) > 0) + return 0; + if (p >= 5) + return 1; + } + return 0; } -static void pfield_expand_dp_bplconx(int regno, int v) +static void pfield_expand_dp_bplconx (int regno, int v) { if (regno == 0xffff) { hposblank = 1; return; } - regno -= 0x1000; - switch (regno) - { - case 0x100: // BPLCON0 - dp_for_drawing->bplcon0 = v; - dp_for_drawing->bplres = GET_RES_DENISE(v); - dp_for_drawing->nr_planes = GET_PLANES(v); - dp_for_drawing->ham_seen = isham(v); - break; - case 0x104: // BPLCON2 - dp_for_drawing->bplcon2 = v; - break; -#ifdef ECS_DENISE - case 0x106: // BPLCON3 - dp_for_drawing->bplcon3 = v; - break; -#endif -#ifdef AGA - case 0x10c: // BPLCON4 - dp_for_drawing->bplcon4 = v; - break; -#endif - } - pfield_expand_dp_bplcon(); + regno -= 0x1000; + switch (regno) + { + case 0x100: // BPLCON0 + dp_for_drawing->bplcon0 = v; + dp_for_drawing->bplres = GET_RES_DENISE(v); + dp_for_drawing->nr_planes = GET_PLANES(v); + dp_for_drawing->ham_seen = isham (v); + break; + case 0x104: // BPLCON2 + dp_for_drawing->bplcon2 = v; + break; + case 0x106: // BPLCON3 + dp_for_drawing->bplcon3 = v; + break; + case 0x10c: // BPLCON4 + dp_for_drawing->bplcon4 = v; + break; + } + pfield_expand_dp_bplcon(); set_res_shift(lores_shift - bplres); } @@ -2921,31 +1644,29 @@ static int drawing_color_matches; static enum { color_match_acolors, color_match_full } color_match_type; /* Set up colors_for_drawing to the state at the beginning of the currently drawn -line. Try to avoid copying color tables around whenever possible. */ -static void adjust_drawing_colors(int ctable, int need_full) + line. Try to avoid copying color tables around whenever possible. */ +static void adjust_drawing_colors (int ctable, int need_full) { if (drawing_color_matches != ctable || need_full < 0) { - if (need_full) { - color_reg_cpy(&colors_for_drawing, curr_color_tables + ctable); + if (need_full) { + color_reg_cpy (&colors_for_drawing, curr_color_tables + ctable); color_match_type = color_match_full; - } - else { - memcpy(colors_for_drawing.acolors, curr_color_tables[ctable].acolors, - sizeof colors_for_drawing.acolors); + } else { + memcpy (colors_for_drawing.acolors, curr_color_tables[ctable].acolors, + sizeof colors_for_drawing.acolors); colors_for_drawing.extra = curr_color_tables[ctable].extra; color_match_type = color_match_acolors; - } + } drawing_color_matches = ctable; - } - else if (need_full && color_match_type != color_match_full) { - color_reg_cpy(&colors_for_drawing, &curr_color_tables[ctable]); + } else if (need_full && color_match_type != color_match_full) { + color_reg_cpy (&colors_for_drawing, &curr_color_tables[ctable]); color_match_type = color_match_full; - } + } } static void playfield_hard_way(line_draw_func worker_pfield, int first, int last) { - if (first < real_playfield_start) { + if (first < real_playfield_start) { int next = last < real_playfield_start ? last : real_playfield_start; int diff = next - first; pfield_do_linetoscr_bordersprite_aga(first, next, false); @@ -2961,112 +1682,67 @@ static void playfield_hard_way(line_draw_func worker_pfield, int first, int last pfield_do_linetoscr_bordersprite_aga(real_playfield_end, last, false); } -static void do_color_changes(line_draw_func worker_border, line_draw_func worker_pfield, int vp) +STATIC_INLINE void do_color_changes (line_draw_func worker_border, line_draw_func worker_pfield) { - int i; - int lastpos = visible_left_border; - int endpos = visible_left_border + gfxvidinfo.outwidth; + int i; + int lastpos = visible_left_border; + int endpos = visible_right_border; - for (i = dip_for_drawing->first_color_change; i <= dip_for_drawing->last_color_change; i++) { + for (i = dip_for_drawing->first_color_change; i <= dip_for_drawing->last_color_change; i++) { int regno = curr_color_changes[i].regno; unsigned int value = curr_color_changes[i].value; - int nextpos, nextpos_in_range; + int nextpos, nextpos_in_range; - if (i == dip_for_drawing->last_color_change) - nextpos = endpos; - else - nextpos = coord_hw_to_window_x(curr_color_changes[i].linepos); + if (i == dip_for_drawing->last_color_change) + nextpos = endpos; + else + nextpos = shres_coord_hw_to_window_x (curr_color_changes[i].linepos); - nextpos_in_range = nextpos; - if (nextpos > endpos) - nextpos_in_range = endpos; - - // left hblank (left edge to hblank end) - if (nextpos_in_range > lastpos && lastpos < hblank_left_start) { - int t = nextpos_in_range <= hblank_left_start ? nextpos_in_range : hblank_left_start; - (*worker_border) (lastpos, t, true); - lastpos = t; - } + nextpos_in_range = nextpos; + if (nextpos > endpos) + nextpos_in_range = endpos; // left border (hblank end to playfield start) - if (nextpos_in_range > lastpos && lastpos < playfield_start) { - int t = nextpos_in_range <= playfield_start ? nextpos_in_range : playfield_start; - (*worker_border) (lastpos, t, false); - lastpos = t; - } + if (nextpos_in_range > lastpos && lastpos < playfield_start) { + int t = nextpos_in_range <= playfield_start ? nextpos_in_range : playfield_start; + (*worker_border) (lastpos, t, false); + lastpos = t; + } // playfield - if (nextpos_in_range > lastpos && lastpos >= playfield_start && lastpos < playfield_end) { - int t = nextpos_in_range <= playfield_end ? nextpos_in_range : playfield_end; + if (nextpos_in_range > lastpos && lastpos >= playfield_start && lastpos < playfield_end) { + int t = nextpos_in_range <= playfield_end ? nextpos_in_range : playfield_end; if (plf2pri > 5 && !(currprefs.chipset_mask & CSMASK_AGA)) - weird_bitplane_fix(lastpos, t); + weird_bitplane_fix (lastpos, t); if (bplxor && may_require_hard_way && worker_pfield != pfield_do_linetoscr_bordersprite_aga) playfield_hard_way(worker_pfield, lastpos, t); else - (*worker_pfield) (lastpos, t, false); - lastpos = t; - } + (*worker_pfield) (lastpos, t, false); + lastpos = t; + } // right border (playfield end to hblank start) - if (nextpos_in_range > lastpos && lastpos >= playfield_end) { - int t = nextpos_in_range <= hblank_right_stop ? nextpos_in_range : hblank_right_stop; - (*worker_border) (lastpos, t, false); - lastpos = t; - } + if (nextpos_in_range > lastpos && lastpos >= playfield_end) { + (*worker_border) (lastpos, nextpos_in_range, false); + lastpos = nextpos_in_range; + } - // right hblank (hblank start to right edge, hblank start may be earlier than playfield end) - if (nextpos_in_range > hblank_right_stop) { - (*worker_border) (hblank_right_stop, nextpos_in_range, true); - lastpos = nextpos_in_range; - } - - if (regno >= 0x1000) { - pfield_expand_dp_bplconx(regno, value); - } - else if (regno >= 0 && !(value & COLOR_CHANGE_MASK)) { - color_reg_set(&colors_for_drawing, regno, value); - colors_for_drawing.acolors[regno] = getxcolor(value); - } - else if (regno == 0 && (value & COLOR_CHANGE_MASK)) { + if (regno >= 0x1000) { + pfield_expand_dp_bplconx (regno, value); + } else if (regno >= 0 && !(value & COLOR_CHANGE_MASK)) { + color_reg_set (&colors_for_drawing, regno, value); + colors_for_drawing.acolors[regno] = getxcolor (value); + } else if (regno == 0 && (value & COLOR_CHANGE_MASK)) { if (value & COLOR_CHANGE_BRDBLANK) { colors_for_drawing.extra &= ~(1 << CE_BORDERBLANK); - colors_for_drawing.extra &= ~(1 << CE_BORDERNTRANS); colors_for_drawing.extra &= ~(1 << CE_BORDERSPRITE); colors_for_drawing.extra |= (value & 1) != 0 ? (1 << CE_BORDERBLANK) : 0; colors_for_drawing.extra |= (value & 3) == 2 ? (1 << CE_BORDERSPRITE) : 0; - colors_for_drawing.extra |= (value & 5) == 4 ? (1 << CE_BORDERNTRANS) : 0; - } - else if (value & COLOR_CHANGE_SHRES_DELAY) { - colors_for_drawing.extra &= ~(1 << CE_SHRES_DELAY); - colors_for_drawing.extra &= ~(1 << (CE_SHRES_DELAY + 1)); - colors_for_drawing.extra |= (value & 3) << CE_SHRES_DELAY; - pfield_expand_dp_bplcon(); - } - else if (value & COLOR_CHANGE_HSYNC_HACK) { - hsync_shift_hack = (uae_s8)value; - } - } - if (lastpos >= endpos) - break; - } - - if (vp < visible_top_start || vp >= visible_bottom_stop) { - // outside of visible area - // Just overwrite with black. Above code needs to run because of custom registers, - // not worth the trouble for separate code path just for max 10 lines or so - (*worker_border) (visible_left_border, visible_left_border + gfxvidinfo.outwidth, true); - } - - if (hsync_shift_hack > 0) { - // hpos shift hack - int shift = (hsync_shift_hack << lores_shift) * gfxvidinfo.pixbytes; - if (shift) { - int firstpos = visible_left_border * gfxvidinfo.pixbytes; - int lastpos = (visible_left_border + gfxvidinfo.outwidth) * gfxvidinfo.pixbytes; - memmove(xlinebuffer + firstpos, xlinebuffer + firstpos + shift, lastpos - firstpos - shift); - memset(xlinebuffer + lastpos - shift, 0, shift); - } - } + } + } + if (lastpos >= endpos) + break; + } } STATIC_INLINE bool is_color_changes(struct draw_info *di) @@ -3076,80 +1752,31 @@ STATIC_INLINE bool is_color_changes(struct draw_info *di) return changes > 1 || (changes == 1 && regno != 0xffff && regno != -1); } -enum double_how { - dh_buf, - dh_line, - dh_emerg -}; - static void pfield_draw_line(int lineno, int gfx_ypos, int follow_ypos) { - static int warned = 0; int border = 0; int do_double = 0; bool have_color_changes; - enum double_how dh; - int ls = linestate[lineno]; dp_for_drawing = line_decisions + lineno; dip_for_drawing = curr_drawinfo + lineno; - if (dp_for_drawing->plfleft >= 0) { - lines_count++; - resolution_count[dp_for_drawing->bplres]++; - } - - switch (ls) - { - case LINE_REMEMBERED_AS_PREVIOUS: - // if (!warned) // happens when program messes up with VPOSW - // write_log (_T("Shouldn't get here... this is a bug.\n")), warned++; - return; - - case LINE_BLACK: - linestate[lineno] = LINE_REMEMBERED_AS_BLACK; - border = -1; - break; - - case LINE_REMEMBERED_AS_BLACK: - return; - - case LINE_AS_PREVIOUS: - dp_for_drawing--; - dip_for_drawing--; - linestate[lineno] = LINE_DONE_AS_PREVIOUS; - if (dp_for_drawing->plfleft < 0) - border = 1; - break; - - case LINE_DONE_AS_PREVIOUS: - /* fall through */ - case LINE_DONE: - return; - - case LINE_DECIDED_DOUBLE: - if (follow_ypos >= 0) { - do_double = 1; - linestate[lineno + 1] = LINE_DONE_AS_PREVIOUS; + if (currprefs.gfx_vresolution && !interlace_seen) { + if (nextline_as_previous) { + nextline_as_previous = false; + return; } - - /* fall through */ - default: - if (dp_for_drawing->plfleft < 0) - border = 1; - linestate[lineno] = LINE_DONE; - break; + nextline_as_previous = true; + if (follow_ypos >= 0) + do_double = 1; } + if (dp_for_drawing->plfleft < 0) + border = 1; have_color_changes = is_color_changes(dip_for_drawing); - dh = dh_line; - xlinebuffer = row_map[gfx_ypos], dh = dh_buf; + xlinebuffer = row_map[gfx_ypos]; xlinebuffer -= linetoscr_x_adjust_pixbytes; - xlinebuffer_genlock = row_map_genlock[gfx_ypos] - linetoscr_x_adjust_pixels; - - if (row_map_color_burst_buffer) - row_map_color_burst_buffer[gfx_ypos] = bplcolorburst; if (border == 0) { @@ -3167,7 +1794,7 @@ static void pfield_draw_line(int lineno, int gfx_ypos, int follow_ypos) uae_u8 b3 = dp_for_drawing->bplcon3; uae_u8 b4 = dp_for_drawing->bplcon4; init_ham_decoding(); - do_color_changes(dummy_worker, decode_ham, lineno); + do_color_changes(dummy_worker, decode_ham); if (have_color_changes) { // do_color_changes() did color changes and register changes, restore them. adjust_drawing_colors(dp_for_drawing->ctable, -1); @@ -3184,59 +1811,42 @@ static void pfield_draw_line(int lineno, int gfx_ypos, int follow_ypos) if (dip_for_drawing->nr_sprites) { int i; -#ifdef AGA if (ce_is_bordersprite(colors_for_drawing.extra) && dp_for_drawing->bordersprite_seen && !ce_is_borderblank(colors_for_drawing.extra)) clear_bitplane_border_aga(); -#endif for (i = 0; i < dip_for_drawing->nr_sprites; i++) { -#ifdef AGA if (currprefs.chipset_mask & CSMASK_AGA) draw_sprites_aga(curr_sprite_entries + dip_for_drawing->first_sprite_entry + i, 1); else -#endif draw_sprites_ecs(curr_sprite_entries + dip_for_drawing->first_sprite_entry + i); } } -#ifdef AGA if (dip_for_drawing->nr_sprites && ce_is_bordersprite(colors_for_drawing.extra) && !ce_is_borderblank(colors_for_drawing.extra) && dp_for_drawing->bordersprite_seen) - do_color_changes(pfield_do_linetoscr_bordersprite_aga, pfield_do_linetoscr_spr, lineno); + do_color_changes(pfield_do_linetoscr_bordersprite_aga, pfield_do_linetoscr_spr); else -#endif - do_color_changes(pfield_do_fill_line, dip_for_drawing->nr_sprites ? pfield_do_linetoscr_spr : pfield_do_linetoscr, lineno); + do_color_changes(pfield_do_fill_line, dip_for_drawing->nr_sprites ? pfield_do_linetoscr_spr : pfield_do_linetoscr); - if (dh == dh_emerg) - memcpy(row_map[gfx_ypos], xlinebuffer + linetoscr_x_adjust_pixbytes, gfxvidinfo.pixbytes * gfxvidinfo.outwidth); - - do_flush_line(gfx_ypos); if (do_double) { - if (dh == dh_emerg) - memcpy(row_map[follow_ypos], xlinebuffer + linetoscr_x_adjust_pixbytes, gfxvidinfo.pixbytes * gfxvidinfo.outwidth); - else if (dh == dh_buf) - memcpy(row_map[follow_ypos], row_map[gfx_ypos], gfxvidinfo.pixbytes * gfxvidinfo.outwidth); - if (need_genlock_data) - memcpy(row_map_genlock[follow_ypos], row_map_genlock[gfx_ypos], gfxvidinfo.outwidth); - do_flush_line(follow_ypos); + memcpy(row_map[follow_ypos], row_map[gfx_ypos], gfxvidinfo.drawbuffer.pixbytes * gfxvidinfo.drawbuffer.outwidth); } if (dip_for_drawing->nr_sprites) pfield_erase_hborder_sprites(); + } - else if (border > 0) { // border > 0: top or bottom border + else { // border > 0: top or bottom border bool dosprites = false; adjust_drawing_colors(dp_for_drawing->ctable, 0); -#ifdef AGA /* this makes things complex.. */ if (dp_for_drawing->bordersprite_seen && !ce_is_borderblank(colors_for_drawing.extra) && dip_for_drawing->nr_sprites) { dosprites = true; pfield_expand_dp_bplcon(); pfield_init_linetoscr(true); pfield_erase_vborder_sprites(); } -#endif if (!dosprites && !have_color_changes) { if (dp_for_drawing->plfleft < -1) { @@ -3251,122 +1861,57 @@ static void pfield_draw_line(int lineno, int gfx_ypos, int follow_ypos) fill_line_border(lineno); } - do_flush_line(gfx_ypos); if (do_double) { - if (dh == dh_buf) { - xlinebuffer = row_map[follow_ypos] - linetoscr_x_adjust_pixbytes; - xlinebuffer_genlock = row_map_genlock[follow_ypos] - linetoscr_x_adjust_pixels; - fill_line_border(lineno); - } - /* If dh == dh_line, do_flush_line will re-use the rendered line - * from linemem. */ - do_flush_line(follow_ypos); + xlinebuffer = row_map[follow_ypos] - linetoscr_x_adjust_pixbytes; + fill_line_border(lineno); } return; } -#ifdef AGA if (dosprites) { for (int i = 0; i < dip_for_drawing->nr_sprites; i++) draw_sprites_aga(curr_sprite_entries + dip_for_drawing->first_sprite_entry + i, 1); - do_color_changes(pfield_do_linetoscr_bordersprite_aga, pfield_do_linetoscr_bordersprite_aga, lineno); -#else - if (0) { -#endif + do_color_changes(pfield_do_linetoscr_bordersprite_aga, pfield_do_linetoscr_bordersprite_aga); } else { playfield_start = visible_right_border; playfield_end = visible_right_border; - do_color_changes(pfield_do_fill_line, pfield_do_fill_line, lineno); + do_color_changes(pfield_do_fill_line, pfield_do_fill_line); } - if (dh == dh_emerg) - memcpy(row_map[gfx_ypos], xlinebuffer + linetoscr_x_adjust_pixbytes, gfxvidinfo.pixbytes * gfxvidinfo.outwidth); - do_flush_line(gfx_ypos); if (do_double) { - if (dh == dh_emerg) - memcpy(row_map[follow_ypos], xlinebuffer + linetoscr_x_adjust_pixbytes, gfxvidinfo.pixbytes * gfxvidinfo.outwidth); - else if (dh == dh_buf) - memcpy(row_map[follow_ypos], row_map[gfx_ypos], gfxvidinfo.pixbytes * gfxvidinfo.outwidth); - if (need_genlock_data) - memcpy(row_map_genlock[follow_ypos], row_map_genlock[gfx_ypos], gfxvidinfo.outwidth); - do_flush_line(follow_ypos); + memcpy(row_map[follow_ypos], row_map[gfx_ypos], gfxvidinfo.drawbuffer.pixbytes * gfxvidinfo.drawbuffer.outwidth); } - } else { - - // top or bottom blanking region - int tmp = hposblank; - hposblank = 1; - fill_line_border(lineno); - hposblank = tmp; - do_flush_line(gfx_ypos); - } } -static void center_image() +static void center_image(void) { - int prev_x_adjust = visible_left_border; - int prev_y_adjust = thisframe_y_adjust; + const int deltaToBorder = (gfxvidinfo.drawbuffer.outwidth >> currprefs.gfx_resolution) - 320; - int w = gfxvidinfo.outwidth; - if (max_diwstop > 0) { - - if (max_diwstop - min_diwstart < w )//&& currprefs.gfx_xcenter == 2) - /* Try to center. */ - visible_left_border = (max_diwstop - min_diwstart - w) / 2 + min_diwstart; - else - visible_left_border = max_diwstop - w - (max_diwstop - min_diwstart - w) / 2; - visible_left_border &= ~((xshift(1, lores_shift)) - 1); - - if (!center_reset && !vertical_changed) { - /* Would the old value be good enough? If so, leave it as it is if we want to be clever. */ - if (visible_left_border < prev_x_adjust && prev_x_adjust < min_diwstart && min_diwstart - visible_left_border <= 32) - visible_left_border = prev_x_adjust; - } - } - else - { - visible_left_border = 0; - } - - if (visible_left_border > max_diwlastword - 32) - visible_left_border = max_diwlastword - 32; - if (visible_left_border < 0) - visible_left_border = 0; - visible_left_border &= ~((xshift(1, lores_shift)) - 1); + visible_left_border = 73 - (deltaToBorder >> 1); + visible_right_border = 393 + (deltaToBorder >> 1); + visible_left_border <<= lores_shift; + visible_right_border <<= lores_shift; linetoscr_x_adjust_pixels = visible_left_border; - linetoscr_x_adjust_pixbytes = linetoscr_x_adjust_pixels * gfxvidinfo.pixbytes; - - visible_right_border = visible_left_border + w; - if (visible_right_border > max_diwlastword) - visible_right_border = max_diwlastword; + linetoscr_x_adjust_pixbytes = linetoscr_x_adjust_pixels * gfxvidinfo.drawbuffer.pixbytes; int max_drawn_amiga_line_tmp = max_drawn_amiga_line; - if (max_drawn_amiga_line_tmp > gfxvidinfo.outheight) - max_drawn_amiga_line_tmp = gfxvidinfo.outheight; + if (max_drawn_amiga_line_tmp > gfxvidinfo.drawbuffer.outheight) + max_drawn_amiga_line_tmp = gfxvidinfo.drawbuffer.outheight; max_drawn_amiga_line_tmp >>= linedbl; - thisframe_y_adjust = minfirstline; - if (thisframe_first_drawn_line >= 0) { - if (thisframe_last_drawn_line - thisframe_first_drawn_line < max_drawn_amiga_line_tmp )//&& currprefs.gfx_ycenter == 2) - thisframe_y_adjust = (thisframe_last_drawn_line - thisframe_first_drawn_line - max_drawn_amiga_line_tmp) / 2 + thisframe_first_drawn_line; - else - thisframe_y_adjust = thisframe_first_drawn_line; - /* Would the old value be good enough? If so, leave it as it is if we want to be clever. */ - if (!center_reset && !horizontal_changed) { - if (thisframe_y_adjust != prev_y_adjust) { - if (prev_y_adjust <= thisframe_first_drawn_line && prev_y_adjust + max_drawn_amiga_line_tmp > thisframe_last_drawn_line) - thisframe_y_adjust = prev_y_adjust; - } - } - } +#ifdef PANDORA + thisframe_y_adjust = minfirstline + currprefs.pandora_vertical_offset; +#else + thisframe_y_adjust = minfirstline + VERTICAL_OFFSET; +#endif /* Make sure the value makes sense */ if (thisframe_y_adjust + max_drawn_amiga_line_tmp > maxvpos + maxvpos / 2) @@ -3376,357 +1921,84 @@ static void center_image() thisframe_y_adjust_real = thisframe_y_adjust << linedbl; max_ypos_thisframe = (maxvpos_display - minfirstline + 1) << linedbl; - - if (prev_x_adjust != visible_left_border || prev_y_adjust != thisframe_y_adjust) { - int redraw = interlace_seen > 0 && linedbl ? 2 : 1; - if (redraw > frame_redraw_necessary) - frame_redraw_necessary = redraw; - } - - max_diwstop = 0; - min_diwstart = MAX_STOP; - - center_reset = false; - horizontal_changed = false; - vertical_changed = false; } -static int frame_res_cnt; -static int autoswitch_old_resolution; -static void init_drawing_frame(void) +static void init_drawing_frame (void) { - int i, maxline; - static int frame_res_old; - - int largest_res = 0; - int largest_count = 0; - int largest_count_res = 0; - for (int i = 0; i <= RES_MAX; i++) { - if (resolution_count[i]) - largest_res = i; - if (resolution_count[i] >= largest_count) { - largest_count = resolution_count[i]; - largest_count_res = i; - } - } - if (currprefs.gfx_resolution == changed_prefs.gfx_resolution && lines_count > 0) { - detected_screen_resolution = largest_res; - } - -#if 0 - if (currprefs.gfx_resolution == changed_prefs.gfx_resolution && lines_count > 0) { - - if (currprefs.gfx_autoresolution_vga && programmedmode && gfxvidinfo.gfx_resolution_reserved >= RES_HIRES && gfxvidinfo.gfx_vresolution_reserved >= VRES_DOUBLE) { - if (largest_res == RES_SUPERHIRES && (gfxvidinfo.gfx_resolution_reserved < RES_SUPERHIRES || gfxvidinfo.gfx_vresolution_reserved < 1)) { - // enable full doubling/superhires support if programmed mode. It may be "half-width" only and may fit in normal display window. - gfxvidinfo.gfx_resolution_reserved = RES_SUPERHIRES; - gfxvidinfo.gfx_vresolution_reserved = VRES_DOUBLE; - graphics_reset(false); - } - int newres = largest_res; - if (htotal < 190) - newres = largest_res + 1; - if (newres < RES_HIRES) - newres = RES_HIRES; - if (newres > RES_MAX) - newres = RES_MAX; - if (changed_prefs.gfx_resolution != newres) { - autoswitch_old_resolution = RES_HIRES; - write_log(_T("Programmed mode autores = %d -> %d (%d)\n"), changed_prefs.gfx_resolution, newres, largest_res); - changed_prefs.gfx_resolution = newres; - set_config_changed(); - return; - } - } - else if (autoswitch_old_resolution == RES_HIRES) { - autoswitch_old_resolution = 0; - if (changed_prefs.gfx_resolution != RES_HIRES) { - changed_prefs.gfx_resolution = RES_HIRES; - set_config_changed(); - return; - } - } - - if (currprefs.gfx_autoresolution) { - int frame_res_detected; - int frame_res_lace_detected = frame_res_lace; - - if (currprefs.gfx_autoresolution == 1 || currprefs.gfx_autoresolution >= 100) - frame_res_detected = largest_res; - else if (largest_count * 100 / lines_count >= currprefs.gfx_autoresolution) - frame_res_detected = largest_count_res; - else - frame_res_detected = largest_count_res - 1; - if (frame_res_detected < 0) - frame_res_detected = 0; - - if (frame_res_detected >= 0 && frame_res_lace_detected >= 0) { - if (frame_res_cnt > 0 && frame_res_old == frame_res_detected * 2 + frame_res_lace_detected) { - frame_res_cnt--; - if (frame_res_cnt == 0) { - int m = frame_res_detected * 2 + frame_res_lace_detected; - struct wh *dst = currprefs.gfx_apmode[0].gfx_fullscreen ? &changed_prefs.gfx_size_fs : &changed_prefs.gfx_size_win; - while (m < 3 * 2) { - struct wh *src = currprefs.gfx_apmode[0].gfx_fullscreen ? &currprefs.gfx_size_fs_xtra[m] : &currprefs.gfx_size_win_xtra[m]; - if ((src->width > 0 && src->height > 0) || (currprefs.gfx_api || currprefs.gf[0].gfx_filter > 0)) { - int nr = m >> 1; - int nl = (m & 1) == 0 ? 0 : 1; - int nr_o = nr; - int nl_o = nl; - - if (currprefs.gfx_autoresolution >= 100 && nl == 0 && nr > 0) { - nl = 1; - } - - if (currprefs.gfx_autoresolution_minh < 0) { - if (nr < nl) - nr = nl; - } - else if (nr < currprefs.gfx_autoresolution_minh) { - nr = currprefs.gfx_autoresolution_minh; - } - if (currprefs.gfx_autoresolution_minv < 0) { - if (nl < nr) - nl = nr; - } - else if (nl < currprefs.gfx_autoresolution_minv) { - nl = currprefs.gfx_autoresolution_minv; - } - - if (nr > gfxvidinfo.gfx_resolution_reserved) - nr = gfxvidinfo.gfx_resolution_reserved; - if (nl > gfxvidinfo.gfx_vresolution_reserved) - nl = gfxvidinfo.gfx_vresolution_reserved; - - if (changed_prefs.gfx_resolution != nr || changed_prefs.gfx_vresolution != nl) { - changed_prefs.gfx_resolution = nr; - changed_prefs.gfx_vresolution = nl; - - write_log(_T("RES -> %d (%d) LINE -> %d (%d) (%d - %d, %d - %d)\n"), nr, nr_o, nl, nl_o, - currprefs.gfx_autoresolution_minh, currprefs.gfx_autoresolution_minv, - gfxvidinfo.gfx_resolution_reserved, gfxvidinfo.gfx_vresolution_reserved); - set_config_changed(); - } - if (src->width > 0 && src->height > 0) { - if (memcmp(dst, src, sizeof *dst)) { - *dst = *src; - set_config_changed(); - } - } - break; - } - m++; - } - frame_res_cnt = currprefs.gfx_autoresolution_delay; - } - } - else { - frame_res_old = frame_res_detected * 2 + frame_res_lace_detected; - frame_res_cnt = currprefs.gfx_autoresolution_delay; - if (frame_res_cnt <= 0) - frame_res_cnt = 1; - } - } - } - } -#endif - for (int i = 0; i <= RES_MAX; i++) - resolution_count[i] = 0; - lines_count = 0; - frame_res = -1; - frame_res_lace = 0; - - if (can_use_lores > AUTO_LORES_FRAMES && 0) { - lores_factor = 1; - lores_set(0); - } - else { - can_use_lores++; - lores_reset(); - } + lores_reset(); init_hardware_for_drawing_frame(); - if (thisframe_first_drawn_line < 0) - thisframe_first_drawn_line = minfirstline; - if (thisframe_first_drawn_line > thisframe_last_drawn_line) - thisframe_last_drawn_line = thisframe_first_drawn_line; - - maxline = ((maxvpos_display + 1) << linedbl) + 2; -#ifdef SMART_UPDATE - for (i = 0; i < maxline; i++) { - int ls = linestate[i]; - switch (ls) { - case LINE_DONE_AS_PREVIOUS: - linestate[i] = LINE_REMEMBERED_AS_PREVIOUS; - break; - case LINE_REMEMBERED_AS_BLACK: - break; - default: - linestate[i] = LINE_UNDECIDED; - break; - } -} -#else - memset(linestate, LINE_UNDECIDED, maxline); -#endif - last_drawn_line = 0; - first_drawn_line = 32767; - - first_block_line = last_block_line = NO_BLOCK; - if (frame_redraw_necessary) { - reset_decision_table(); - custom_frame_redraw_necessary = 1; - frame_redraw_necessary--; - } - else { - custom_frame_redraw_necessary = 0; - } + linestate_first_undecided = 0; + nextline_as_previous = false; center_image(); - thisframe_first_drawn_line = -1; - thisframe_last_drawn_line = -1; - drawing_color_matches = -1; } -static int lightpen_y1, lightpen_y2; -static int statusbar_y1, statusbar_y2; - -void putpixel(uae_u8 *buf, uae_u8 *genlockbuf, int bpp, int x, xcolnr c8, int opaq) +static void draw_status_line (int line, int statusy) { - if (x <= 0) - return; + uae_u8 *buf; - if (genlockbuf) - genlockbuf[x] = 0xff; - - switch (bpp) { - case 1: - buf[x] = (uae_u8)c8; - break; - case 2: - { - uae_u16 *p = (uae_u16*)buf + x; - *p = (uae_u16)c8; - break; - } - case 3: - /* no 24 bit yet */ - break; - case 4: - { - int i; - if (1 || opaq || currprefs.gf[0].gfx_filter == 0) { - uae_u32 *p = (uae_u32*)buf + x; - *p = c8; - } - else { - for (i = 0; i < 4; i++) { - int v1 = buf[i + bpp * x]; - int v2 = (c8 >> (i * 8)) & 255; - v1 = (v1 * 2 + v2 * 3) / 5; - if (v1 > 255) - v1 = 255; - buf[i + bpp * x] = v1; - } - } - break; - } - } + xlinebuffer = row_map[line]; + buf = xlinebuffer; + draw_status_line_single (buf, statusy, gfxvidinfo.drawbuffer.outwidth); } -static uae_u8 *status_line_ptr(int line) +static void partial_draw_frame(void) { - int y; - - y = line - (gfxvidinfo.outheight - TD_TOTAL_HEIGHT); - xlinebuffer = row_map[line]; - xlinebuffer_genlock = row_map_genlock[line]; - return xlinebuffer; -} - -static void draw_status_line(int line, int statusy) -{ - uae_u8 *buf = status_line_ptr(line); - if (!buf) - return; - //if (statusy < 0) - // statusline_render(buf, gfxvidinfo.pixbytes, gfxvidinfo.rowbytes, gfxvidinfo.outwidth, TD_TOTAL_HEIGHT, xredcolors, xgreencolors, xbluecolors, NULL); - //else - draw_status_line_single(buf, statusy, gfxvidinfo.outwidth); -} - -static void refresh_indicator_init(void) -{ - xfree(refresh_indicator_buffer); - refresh_indicator_buffer = NULL; - xfree(refresh_indicator_changed); - refresh_indicator_changed = NULL; - xfree(refresh_indicator_changed_prev); - refresh_indicator_changed_prev = NULL; - - //if (!currprefs.refresh_indicator) - return; - - refresh_indicator_height = 600; - refresh_indicator_buffer = xcalloc(uae_u8, MAX_PIXELS_PER_LINE * 2 * refresh_indicator_height); - refresh_indicator_changed = xcalloc(uae_u8, refresh_indicator_height); - refresh_indicator_changed_prev = xcalloc(uae_u8, refresh_indicator_height); -} - -static const int refresh_indicator_colors[] = { 0x777, 0x0f0, 0x00f, 0xff0, 0xf0f }; - -static void refresh_indicator_update() -{ - for (int i = 0; i < max_ypos_thisframe; i++) { - int i1 = i + min_ypos_for_screen; - int line = i + thisframe_y_adjust_real; - int whereline = amiga2aspect_line_map[i1]; - int wherenext = amiga2aspect_line_map[i1 + 1]; - - if (whereline >= gfxvidinfo.outheight) - break; - if (whereline < 0) - continue; - if (line >= refresh_indicator_height) - break; - - xlinebuffer = row_map[whereline]; - uae_u8 pixel = refresh_indicator_changed_prev[line]; - if (wherenext >= 0) { - pixel = refresh_indicator_changed_prev[line & ~1]; + if (framecnt == 0) { + if (!screenlocked) { + if (!lockscr()) + return; + screenlocked = true; } - int color1 = 0; - int color2 = 0; - if (pixel <= 4) { - color1 = color2 = refresh_indicator_colors[pixel]; - } - else if (pixel <= 8) { - color2 = refresh_indicator_colors[pixel - 5]; - } - for (int x = 0; x < 8; x++) { - putpixel(xlinebuffer, NULL, gfxvidinfo.pixbytes, x, xcolors[color1], 1); - } - for (int x = 8; x < 16; x++) { - putpixel(xlinebuffer, NULL, gfxvidinfo.pixbytes, x, xcolors[color2], 1); + struct vidbuffer *vb = &gfxvidinfo.drawbuffer; + for (; next_line_to_render < max_ypos_thisframe; ++next_line_to_render) { + int i1 = next_line_to_render + min_ypos_for_screen; + int line = next_line_to_render + thisframe_y_adjust_real; + int whereline = amiga2aspect_line_map[i1]; + int wherenext = amiga2aspect_line_map[i1 + 1]; + + if (whereline >= vb->outheight || line >= linestate_first_undecided) + break; + if (whereline < 0) + continue; + + hposblank = 0; + pfield_draw_line(line, whereline, wherenext); } } } -static void draw_frame2() +void halt_draw_frame(void) +{ + if(screenlocked) { + unlockscr(); + screenlocked = false; + } +} + +static void finish_drawing_frame (void) { int i; + struct vidbuffer *vb = &gfxvidinfo.drawbuffer; - for (i = 0; i < max_ypos_thisframe; i++) { + if (!screenlocked) { + if (!lockscr()) + return; + screenlocked = true; + } + + for (i = next_line_to_render; i < max_ypos_thisframe; i++) { int i1 = i + min_ypos_for_screen; int line = i + thisframe_y_adjust_real; int whereline = amiga2aspect_line_map[i1]; int wherenext = amiga2aspect_line_map[i1 + 1]; - if (whereline >= gfxvidinfo.outheight) + if (whereline >= vb->outheight || line >= linestate_first_undecided) break; if (whereline < 0) continue; @@ -3734,231 +2006,117 @@ static void draw_frame2() hposblank = 0; pfield_draw_line(line, whereline, wherenext); } -} -static void finish_drawing_frame() -{ - int i; - - draw_frame2(); - - if (currprefs.leds_on_screen) - { - for (i = 0; i < TD_TOTAL_HEIGHT; i++) - { - int line = gfxvidinfo.outheight - TD_TOTAL_HEIGHT + i; + if (currprefs.leds_on_screen) { + for (i = 0; i < TD_TOTAL_HEIGHT; i++) { + int line = gfxvidinfo.drawbuffer.outheight - TD_TOTAL_HEIGHT + i; draw_status_line(line, i); - do_flush_line(line); } } - if (refresh_indicator_buffer) - refresh_indicator_update(); + if (currprefs.cs_cd32fmv) { + if (cd32_fmv_active) { + cd32_fmv_genlock(vb, &gfxvidinfo.drawbuffer); + } + } do_flush_screen(); -} - -void hardware_line_completed(int lineno) -{ -#ifndef SMART_UPDATE - { - int i, where; - /* l is the line that has been finished for drawing. */ - i = lineno - thisframe_y_adjust_real; - if (i >= 0 && i < max_ypos_thisframe) { - where = amiga2aspect_line_map[i + min_ypos_for_screen]; - if (where < gfxvidinfo.drawbuffer.outheight && where >= 0) - pfield_draw_line(lineno, where, amiga2aspect_line_map[i + min_ypos_for_screen + 1]); - } - } -#endif + next_line_to_render = 0; } void check_prefs_picasso(void) { #ifdef PICASSO96 - if (picasso_on && picasso_redraw_necessary) - picasso_refresh(); - picasso_redraw_necessary = 0; + if (picasso_on) + picasso_refresh (); - if (picasso_requested_on == picasso_on && !picasso_requested_forced_on) - return; - - if (picasso_requested_on) { - picasso_requested_forced_on = false; - picasso_on = false; - picasso_requested_on = false; - return; - } + if (picasso_requested_on == picasso_on && !picasso_requested_forced_on) + return; picasso_requested_forced_on = false; - picasso_on = picasso_requested_on; + picasso_on = picasso_requested_on; - if (!picasso_on) - clear_inhibit_frame(IHF_PICASSO); - else - set_inhibit_frame(IHF_PICASSO); + if (!picasso_on) + clear_inhibit_frame (IHF_PICASSO); + else + set_inhibit_frame (IHF_PICASSO); - gfx_set_picasso_state(picasso_on); - picasso_enablescreen(picasso_requested_on); + gfx_set_picasso_state (picasso_on); + picasso_enablescreen (picasso_requested_on); - notice_screen_contents_lost(); - notice_new_xcolors(); - count_frame(); - compute_framesync(); + notice_new_xcolors (); + count_frame (); #endif } -void redraw_frame(void) +bool vsync_handle_check (void) { - last_drawn_line = 0; - first_drawn_line = 32767; - finish_drawing_frame(); - flush_screen(); -} - -bool vsync_handle_check(void) -{ - int changed = check_prefs_changed_gfx(); - if (changed > 0) { - reset_drawing(); - init_row_map(); - init_aspect_maps(); - notice_screen_contents_lost(); - notice_new_xcolors(); - } - else if (changed < 0) { - reset_drawing(); - init_row_map(); - init_aspect_maps(); - notice_screen_contents_lost(); - notice_new_xcolors(); - } - check_prefs_changed_cd(); - check_prefs_changed_audio(); - check_prefs_changed_custom(); - check_prefs_changed_cpu(); - check_prefs_picasso(); + int changed = check_prefs_changed_gfx (); + if (changed) { + reset_drawing (); + notice_new_xcolors (); + } + device_check_config(); return changed != 0; } -void vsync_handle_redraw(int long_field, int lof_changed, uae_u16 bplcon0p, uae_u16 bplcon3p) +void vsync_handle_redraw (void) { - last_redraw_point++; - if (lof_changed || interlace_seen <= 0 || (currprefs.gfx_iscanlines && interlace_seen > 0) || last_redraw_point >= 2 || long_field) { - last_redraw_point = 0; + if (framecnt == 0) { + if(render_tid) { + while(render_thread_busy) + sleep_millis(1); + write_comm_pipe_u32 (render_pipe, RENDER_SIGNAL_FRAME_DONE, 1); + uae_sem_wait (&render_sem); + } + } - if (framecnt == 0) - finish_drawing_frame(); + if (quit_program < 0) { + if(render_tid) { + while(render_thread_busy) + sleep_millis(1); + write_comm_pipe_u32 (render_pipe, RENDER_SIGNAL_QUIT, 1); + while(render_tid != 0) { + sleep_millis(10); + } + destroy_comm_pipe(render_pipe); + xfree(render_pipe); + render_pipe = 0; + uae_sem_destroy(&render_sem); + render_sem = 0; + } - if (quit_program < 0) - { quit_program = -quit_program; - set_inhibit_frame(IHF_QUIT_PROGRAM); + set_inhibit_frame (IHF_QUIT_PROGRAM); set_special(SPCFLAG_BRK | SPCFLAG_MODE_CHANGE); return; } - count_frame(); + count_frame (); if (framecnt == 0) - init_drawing_frame(); - else if (currprefs.cpu_memory_cycle_exact) - init_hardware_for_drawing_frame(); - } - else { - if (isvsync_chipset()) - flush_screen(); /* vsync mode */ - } + init_drawing_frame (); - gui_flicker_led(-1, 0, 0); + gui_flicker_led (-1, 0, 0); } -void hsync_record_line_state(int lineno, enum nln_how how, int changed) +void hsync_record_line_state(int lineno) { - uae_u8 *state; - if (framecnt != 0) return; - state = linestate + lineno; - changed |= frame_redraw_necessary != 0 || refresh_indicator_buffer != NULL || - ((lineno >= lightpen_y1 && lineno < lightpen_y2) || - (lineno >= statusbar_y1 && lineno < statusbar_y2)); + linestate_first_undecided = lineno + 1; - switch (how) { - case nln_normal: - *state = changed ? LINE_DECIDED : LINE_DONE; - break; - case nln_doubled: - *state = changed ? LINE_DECIDED_DOUBLE : LINE_DONE; - changed |= state[1] != LINE_REMEMBERED_AS_PREVIOUS; - state[1] = changed ? LINE_AS_PREVIOUS : LINE_DONE_AS_PREVIOUS; - break; - case nln_nblack: - *state = changed ? LINE_DECIDED : LINE_DONE; - if (state[1] != LINE_REMEMBERED_AS_BLACK) { - state[1] = LINE_BLACK; + if (render_tid && linestate_first_undecided > 3 && !render_thread_busy) { + if (currprefs.gfx_vresolution) { + if (!(linestate_first_undecided & 0x3e)) + write_comm_pipe_u32(render_pipe, RENDER_SIGNAL_PARTIAL, 1); } - break; - case nln_lower: - if (lineno > 0 && state[-1] == LINE_UNDECIDED) { - state[-1] = LINE_DECIDED; //LINE_BLACK; - } - *state = changed ? LINE_DECIDED : LINE_DONE; - break; - case nln_upper: - *state = changed ? LINE_DECIDED : LINE_DONE; - if (state[1] == LINE_UNDECIDED - || state[1] == LINE_REMEMBERED_AS_PREVIOUS - || state[1] == LINE_AS_PREVIOUS) - state[1] = LINE_DECIDED; //LINE_BLACK; - break; - case nln_lower_black_always: - state[1] = LINE_BLACK; - *state = LINE_DECIDED; - // if (lineno == (maxvpos + lof_store) * 2 - 1) - // *state = LINE_BLACK; - break; - case nln_lower_black: - changed |= state[0] != LINE_DONE; - state[1] = LINE_DONE; - *state = changed ? LINE_DECIDED : LINE_DONE; - // if (lineno == (maxvpos + lof_store) * 2 - 1) - // *state = LINE_BLACK; - break; - //case nln_upper_black_always: - // *state = LINE_DECIDED; - // if (lineno > 0) { - // state[-1] = LINE_BLACK; - // } - // if (!interlace_seen && lineno == (maxvpos + lof_store) * 2 - 2) { - // state[1] = LINE_BLACK; - // } - // break; - //case nln_upper_black: - // changed |= state[0] != LINE_DONE; - // *state = changed ? LINE_DECIDED : LINE_DONE; - // if (lineno > 0) { - // state[-1] = LINE_DONE; - // } - // if (!interlace_seen && lineno == (maxvpos + lof_store) * 2 - 2) { - // state[1] = LINE_DONE; - // } - // break; + else if (!(linestate_first_undecided & 0x1f)) + write_comm_pipe_u32(render_pipe, RENDER_SIGNAL_PARTIAL, 1); } } -void notice_resolution_seen(int res, bool lace) -{ - if (res > frame_res) - frame_res = res; - if (res > 0) - can_use_lores = 0; - if (!frame_res_lace && lace) - frame_res_lace = lace; -} - bool notice_interlace_seen(bool lace) { bool changed = false; @@ -3966,111 +2124,95 @@ bool notice_interlace_seen(bool lace) if (lace) { if (interlace_seen == 0) { changed = true; - //write_log (_T("->lace PC=%x\n"), m68k_getpc ()); } interlace_seen = currprefs.gfx_vresolution ? 1 : -1; } else { if (interlace_seen) { changed = true; - //write_log (_T("->non-lace PC=%x\n"), m68k_getpc ()); } interlace_seen = 0; } return changed; } -void reset_drawing() +void reset_drawing(void) { - max_diwstop = 0; - lores_reset(); - reset_decision_table(); + linestate_first_undecided = 0; + nextline_as_previous = false; init_aspect_maps(); init_row_map(); - last_redraw_point = 0; - memset(spixels, 0, sizeof spixels); memset(&spixstate, 0, sizeof spixstate); init_drawing_frame(); pfield_set_linetoscr(); - - notice_screen_contents_lost(); - frame_res_cnt = currprefs.gfx_autoresolution_delay; - lightpen_y1 = lightpen_y2 = -1; - - reset_custom_limits(); - - center_reset = true; - bplcolorburst_field = 1; - hsync_shift_hack = 0; } static void gen_direct_drawing_table(void) { -#ifdef AGA // BYPASS color table for (int i = 0; i < 256; i++) { uae_u32 v = (i << 16) | (i << 8) | i; direct_colors_for_drawing.acolors[i] = CONVERT_RGB(v); } -#endif } -void drawing_init(void) +static void *render_thread (void *unused) { - refresh_indicator_init(); + for(;;) { + render_thread_busy = false; + uae_u32 signal = read_comm_pipe_u32_blocking(render_pipe); + render_thread_busy = true; + switch(signal) { + case RENDER_SIGNAL_PARTIAL: + partial_draw_frame(); + break; - gen_pfield_tables(); + case RENDER_SIGNAL_FRAME_DONE: + finish_drawing_frame(); + uae_sem_post (&render_sem); + break; + + case RENDER_SIGNAL_QUIT: + render_tid = 0; + return 0; + } + } +} + +void drawing_init (void) +{ + gen_pfield_tables(); gen_direct_drawing_table(); + if(render_pipe == 0) { + render_pipe = xmalloc (smp_comm_pipe, 1); + init_comm_pipe(render_pipe, 20, 1); + } + if(render_sem == 0) { + uae_sem_init (&render_sem, 0, 0); + } + if(render_tid == 0 && render_pipe != 0 && render_sem != 0) { + uae_start_thread(_T("render"), render_thread, NULL, &render_tid); + } + #ifdef PICASSO96 - if (!isrestore()) { - picasso_on = false; - picasso_requested_on = false; - gfx_set_picasso_state(0); - } + if (!isrestore ()) { + picasso_on = 0; + picasso_requested_on = 0; + gfx_set_picasso_state (0); + } #endif - xlinebuffer = gfxvidinfo.bufmem; - xlinebuffer_genlock = nullptr; + xlinebuffer = gfxvidinfo.drawbuffer.bufmem; - inhibit_frame = 0; + inhibit_frame = 0; - reset_drawing(); -} - -int isvsync_chipset(void) -{ - if (picasso_on || currprefs.gfx_apmode[0].gfx_vsync <= 0) - return 0; - if (currprefs.gfx_apmode[0].gfx_vsyncmode == 0) - return 1; - if (currprefs.m68k_speed >= 0) - return -1; - return currprefs.cachesize ? -3 : -2; -} - -int isvsync_rtg(void) -{ - if (!picasso_on || currprefs.gfx_apmode[1].gfx_vsync <= 0) - return 0; - if (currprefs.gfx_apmode[1].gfx_vsyncmode == 0) - return 1; - if (currprefs.m68k_speed >= 0) - return -1; - return currprefs.cachesize ? -3 : -2; -} - -int isvsync(void) -{ - if (picasso_on) - return isvsync_rtg(); - else - return isvsync_chipset(); + reset_drawing (); } diff --git a/src/events.cpp b/src/events.cpp index 7c68e217..447ca2b0 100644 --- a/src/events.cpp +++ b/src/events.cpp @@ -14,202 +14,121 @@ #include "options.h" #include "include/memory.h" #include "newcpu.h" -#include "events.h" - -static const int pissoff_nojit_value = 256 * CYCLE_UNIT; - -unsigned long int event_cycles, nextevent, currcycle; -int is_syncline, is_syncline_end; -long cycles_to_next_event; -long max_cycles_to_next_event; -long cycles_to_hsync_event; -unsigned long start_cycles; -bool event_wait; +unsigned long int nextevent, currcycle; +int is_syncline; frame_time_t vsyncmintime, vsyncmaxtime, vsyncwaittime; int vsynctimebase; -int event2_count; void events_schedule (void) { - int i; + int i; - unsigned long int mintime = ~0L; - for (i = 0; i < ev_max; i++) - { - if (eventtab[i].active) - { - unsigned long int eventtime = eventtab[i].evtime - currcycle; - if (eventtime < mintime) - mintime = eventtime; - } - } - nextevent = currcycle + mintime; + unsigned long int mintime = ~0L; + for (i = 0; i < ev_max; i++) { + if (eventtab[i].active) { + unsigned long int eventtime = eventtab[i].evtime - currcycle; + if (eventtime < mintime) + mintime = eventtime; + } + } + nextevent = currcycle + mintime; } void do_cycles_cpu_fastest (unsigned long cycles_to_add) { - if ((pissoff -= cycles_to_add) > 0) - return; + if ((regs.pissoff -= cycles_to_add) > 0) + return; - cycles_to_add = -pissoff; - pissoff = 0; + cycles_to_add = -regs.pissoff; + regs.pissoff = 0; - if (is_syncline && eventtab[ev_hsync].evtime - currcycle <= cycles_to_add) - { - int rpt = read_processor_time(); - int v = rpt - vsyncmintime; - if (v > syncbase || v < -syncbase) - vsyncmintime = rpt; - if (v < speedup_timelimit) - { - pissoff = pissoff_value; - return; - } - is_syncline = 0; - } + /* Keep only CPU emulation running while waiting for sync point. */ + if (is_syncline) { + int rpt = read_processor_time (); + int v = rpt - vsyncmintime; + if (v > vsynctimebase || v < -vsynctimebase) { + v = 0; + } + if (v < speedup_timelimit) { + regs.pissoff = pissoff_value; + return; + } + is_syncline = 0; + } - while ((nextevent - currcycle) <= cycles_to_add) - { - int i; - cycles_to_add -= (nextevent - currcycle); - currcycle = nextevent; + while ((nextevent - currcycle) <= cycles_to_add) { + int i; - for (i = 0; i < ev_max; i++) - { - if (eventtab[i].active && eventtab[i].evtime == currcycle) - { - (*eventtab[i].handler)(); - } - } - events_schedule(); - } - currcycle += cycles_to_add; + cycles_to_add -= (nextevent - currcycle); + currcycle = nextevent; + + for (i = 0; i < ev_max; i++) { + if (eventtab[i].active && eventtab[i].evtime == currcycle) { + (*eventtab[i].handler)(); + } + } + events_schedule(); + } + currcycle += cycles_to_add; } void do_cycles_cpu_norm (unsigned long cycles_to_add) { - while ((nextevent - currcycle) <= cycles_to_add) - { - int i; - cycles_to_add -= (nextevent - currcycle); - currcycle = nextevent; + while ((nextevent - currcycle) <= cycles_to_add) { + int i; - for (i = 0; i < ev_max; i++) - { - if (eventtab[i].active && eventtab[i].evtime == currcycle) - { - (*eventtab[i].handler)(); - } - } - events_schedule(); - } - currcycle += cycles_to_add; + cycles_to_add -= (nextevent - currcycle); + currcycle = nextevent; + + for (i = 0; i < ev_max; i++) { + if (eventtab[i].active && eventtab[i].evtime == currcycle) { + (*eventtab[i].handler)(); + } + } + events_schedule(); + } + currcycle += cycles_to_add; } do_cycles_func do_cycles = do_cycles_cpu_norm; void MISC_handler(void) { - int i; - evt mintime; - evt ct = get_cycles(); - static int recursive; + int i; + evt mintime; + evt ct = get_cycles(); + static int recursive; - if (recursive) - { - return; + if (recursive) { + return; + } + recursive++; + eventtab[ev_misc].active = 0; + + mintime = ~0L; + for (i = 0; i < ev2_max; i++) { + if (eventtab2[i].active) { + if (eventtab2[i].evtime == ct) { + eventtab2[i].active = false; + eventtab2[i].handler(eventtab2[i].data); + if (eventtab2[i].active) { + evt eventtime = eventtab2[i].evtime - ct; + if (eventtime < mintime) + mintime = eventtime; + } + } else { + evt eventtime = eventtab2[i].evtime - ct; + if (eventtime < mintime) + mintime = eventtime; + } } - recursive++; - eventtab[ev_misc].active = 0; + } - mintime = ~0L; - for (i = 0; i < ev2_max; i++) - { - if (eventtab2[i].active) - { - if (eventtab2[i].evtime == ct) - { - eventtab2[i].active = false; - eventtab2[i].handler(eventtab2[i].data); - if (eventtab2[i].active) - { - evt eventtime = eventtab2[i].evtime - ct; - if (eventtime < mintime) - mintime = eventtime; - } - } - else - { - evt eventtime = eventtab2[i].evtime - ct; - if (eventtime < mintime) - mintime = eventtime; - } - } - } - - if (mintime != ~0L) - { - eventtab[ev_misc].active = true; - eventtab[ev_misc].evtime = ct + mintime; - events_schedule(); - } - recursive--; + if (mintime != ~0UL) { + eventtab[ev_misc].active = true; + eventtab[ev_misc].evtime = ct + mintime; + events_schedule(); + } + recursive--; } - -void event2_newevent_xx(int no, evt t, uae_u32 data, evfunc2 func) -{ - evt et; - static int next = ev2_misc; - - et = t + get_cycles(); - if (no < 0) { - no = next; - for (;;) { - if (!eventtab2[no].active) { - event2_count++; - break; - } - if (eventtab2[no].evtime == et && eventtab2[no].handler == func && eventtab2[no].data == data) - break; - no++; - if (no == ev2_max) - no = ev2_misc; - if (no == next) { - write_log(_T("out of event2's!\n")); - return; - } - } - next = no; - } - eventtab2[no].active = true; - eventtab2[no].evtime = et; - eventtab2[no].handler = func; - eventtab2[no].data = data; - MISC_handler(); -} - -void event2_newevent_x_replace(evt t, uae_u32 data, evfunc2 func) -{ - for (int i = 0; i < ev2_max; i++) { - if (eventtab2[i].active && eventtab2[i].handler == func) { - eventtab2[i].active = false; - } - } - if (int(t) <= 0) { - func(data); - return; - } - event2_newevent_xx(-1, t * CYCLE_UNIT, data, func); -} - - -int current_hpos(void) -{ - int hp = current_hpos_safe(); - if (hp < 0 || hp > 256) { - gui_message(_T("hpos = %d!?\n"), hp); - hp = 0; - } - return hp; -} \ No newline at end of file diff --git a/src/expansion.cpp b/src/expansion.cpp index 9b691635..7d4610f0 100644 --- a/src/expansion.cpp +++ b/src/expansion.cpp @@ -1,55 +1,34 @@ -/* -* UAE - The Un*x Amiga Emulator -* -* AutoConfig (tm) Expansions (ZorroII/III) -* -* Copyright 1996,1997 Stefan Reinauer -* Copyright 1997 Brian King -* - added gfxcard code -* -*/ + /* + * UAE - The Un*x Amiga Emulator + * + * AutoConfig (tm) Expansions (ZorroII/III) + * + * Copyright 1996,1997 Stefan Reinauer + * Copyright 1997 Brian King + * - added gfxcard code + * + */ #include "sysconfig.h" #include "sysdeps.h" #include "options.h" #include "uae.h" -//#include "traps.h" -#include "include/memory.h" +#include "traps.h" +#include "memory.h" #include "rommgr.h" #include "custom.h" #include "newcpu.h" #include "savestate.h" #include "zfile.h" -//#include "catweasel.h" -//#include "cdtv.h" -//#include "cdtvcr.h" #include "threaddep/thread.h" -//#include "a2091.h" -//#include "a2065.h" #include "gfxboard.h" -//#include "cd32_fmv.h" -//#include "ncr_scsi.h" -//#include "ncr9x_scsi.h" -#include "scsi.h" -#include "debug.h" -//#include "gayle.h" -//#include "idecontrollers.h" -//#include "cpuboard.h" -//#include "sndboard.h" -//#include "uae/ppc.h" +#include "cd32_fmv.h" +#include "gayle.h" #include "autoconf.h" -//#include "specialmonitors.h" -#include "inputdevice.h" -//#include "pci.h" -//#include "x86.h" #include "filesys.h" -//#include "ethernet.h" -//#include "sana2.h" - #define CARD_FLAG_CAN_Z3 1 -#define CARD_FLAG_CHILD 8 // More information in first revision HRM Appendix_G #define BOARD_PROTOAUTOCONFIG 1 @@ -63,22 +42,20 @@ #define KS12_BOOT_HACK 1 -#define EXP_DEBUG 0 - #define MAX_EXPANSION_BOARD_SPACE 16 /* ********************************************************** */ /* 00 / 02 */ /* er_Type */ -#define Z2_MEM_8MB 0x00 /* Size of Memory Block */ -#define Z2_MEM_4MB 0x07 -#define Z2_MEM_2MB 0x06 -#define Z2_MEM_1MB 0x05 +#define Z2_MEM_8MB 0x00 /* Size of Memory Block */ +#define Z2_MEM_4MB 0x07 +#define Z2_MEM_2MB 0x06 +#define Z2_MEM_1MB 0x05 #define Z2_MEM_512KB 0x04 #define Z2_MEM_256KB 0x03 #define Z2_MEM_128KB 0x02 -#define Z2_MEM_64KB 0x01 +#define Z2_MEM_64KB 0x01 /* extended definitions */ #define Z3_MEM_16MB 0x00 #define Z3_MEM_32MB 0x01 @@ -108,10 +85,10 @@ #define hackers_id 2011 /* Special ID for test cards */ /* Card Type */ -#define commodore_a2091 3 /* A2091 / A590 Card from C= */ +#define commodore_a2091 3 /* A2091 / A590 Card from C= */ #define commodore_a2091_ram 10 /* A2091 / A590 Ram on HD-Card */ #define commodore_a2232 70 /* A2232 Multiport Expansion */ -#define ass_nexus_scsi 1 /* Nexus SCSI Controller */ +#define ass_nexus_scsi 1 /* Nexus SCSI Controller */ #define gvp_series_2_scsi 11 #define gvp_iv_24_gfx 32 @@ -174,15 +151,15 @@ static bool chipdone; static int do_mount; #define FILESYS_DIAGPOINT 0x01e0 -#define FILESYS_BOOTPOINT 0x01e6 +#define FILESYS_BOOTPOINT 0x01f0 #define FILESYS_DIAGAREA 0x2000 /* ********************************************************** */ struct card_data { - bool(*initrc)(struct autoconfig_info*); - bool(*initnum)(struct autoconfig_info*); + bool (*initrc)(struct autoconfig_info*); + bool (*initnum)(struct autoconfig_info*); addrbank *(*map)(struct autoconfig_info*); struct romconfig *rc; const TCHAR *name; @@ -192,7 +169,6 @@ struct card_data uae_u32 size; // parsing updated fields const struct expansionromtype *ert; - const struct cpuboardsubtype *cst; struct autoconfig_info aci; }; @@ -225,27 +201,26 @@ static bool ks11orolder(void) /* ********************************************************** */ /* Please note: ZorroIII implementation seems to work different -* than described in the HRM. This claims that ZorroIII config -* address is 0xff000000 while the ZorroII config space starts -* at 0x00e80000. In reality, both, Z2 and Z3 cards are -* configured in the ZorroII config space. Kickstart 3.1 doesn't -* even do a single read or write access to the ZorroIII space. -* The original Amiga include files tell the same as the HRM. -* ZorroIII: If you set ext_size in er_Flags and give a Z2-size -* in er_Type you can very likely add some ZorroII address space -* to a ZorroIII card on a real Amiga. This is not implemented -* yet. -* -- Stefan -* -* Surprising that 0xFF000000 isn't used. Maybe it depends on the -* ROM. Anyway, the HRM says that Z3 cards may appear in Z2 config -* space, so what we are doing here is correct. -* -- Bernd -*/ + * than described in the HRM. This claims that ZorroIII config + * address is 0xff000000 while the ZorroII config space starts + * at 0x00e80000. In reality, both, Z2 and Z3 cards are + * configured in the ZorroII config space. Kickstart 3.1 doesn't + * even do a single read or write access to the ZorroIII space. + * The original Amiga include files tell the same as the HRM. + * ZorroIII: If you set ext_size in er_Flags and give a Z2-size + * in er_Type you can very likely add some ZorroII address space + * to a ZorroIII card on a real Amiga. This is not implemented + * yet. + * -- Stefan + * + * Surprising that 0xFF000000 isn't used. Maybe it depends on the + * ROM. Anyway, the HRM says that Z3 cards may appear in Z2 config + * space, so what we are doing here is correct. + * -- Bernd + */ /* Autoconfig address space at 0xE80000 */ static uae_u8 expamem[65536]; -static uae_u8 expamem_write_space[65536]; #define AUTOMATIC_AUTOCONFIG_MAX_ADDRESS 0x80 static int expamem_autoconfig_mode; static addrbank*(*expamem_map)(struct autoconfig_info*); @@ -273,36 +248,36 @@ bool expamem_z3hack(struct uae_prefs *p) return true; if (z3hack_override == Z3MAPPING_REAL) return false; - return p->z3_mapping_mode == Z3MAPPING_UAE; //|| cpuboard_memorytype(p) == BOARD_MEMORY_BLIZZARD_12xx; + return p->z3_mapping_mode == Z3MAPPING_UAE; } /* Ugly hack for >2M chip RAM in single pool -* We can't add it any later or early boot menu -* stops working because it sets kicktag at the end -* of chip ram... -*/ -static void addextrachip(uae_u32 sysbase) + * We can't add it any later or early boot menu + * stops working because it sets kicktag at the end + * of chip ram... + */ +static void addextrachip (uae_u32 sysbase) { if (currprefs.chipmem_size <= 0x00200000) return; if (sysbase & 0x80000001) return; - if (!valid_address(sysbase, 1000)) + if (!valid_address (sysbase, 1000)) return; - uae_u32 ml = get_long(sysbase + 322); - if (!valid_address(ml, 32)) + uae_u32 ml = get_long (sysbase + 322); + if (!valid_address (ml, 32)) return; uae_u32 next; - while ((next = get_long(ml))) { - if (!valid_address(ml, 32)) + while ((next = get_long (ml))) { + if (!valid_address (ml, 32)) return; - uae_u32 upper = get_long(ml + 24); - uae_u32 lower = get_long(ml + 20); + uae_u32 upper = get_long (ml + 24); + uae_u32 lower = get_long (ml + 20); if (lower & ~0xffff) { ml = next; continue; } - uae_u16 attr = get_word(ml + 14); + uae_u16 attr = get_word (ml + 14); if ((attr & 0x8002) != 2) { ml = next; continue; @@ -310,41 +285,32 @@ static void addextrachip(uae_u32 sysbase) if (upper >= currprefs.chipmem_size) return; uae_u32 added = currprefs.chipmem_size - upper; - uae_u32 first = get_long(ml + 16); - put_long(ml + 24, currprefs.chipmem_size); // mh_Upper - put_long(ml + 28, get_long(ml + 28) + added); // mh_Free + uae_u32 first = get_long (ml + 16); + put_long (ml + 24, currprefs.chipmem_size); // mh_Upper + put_long (ml + 28, get_long (ml + 28) + added); // mh_Free uae_u32 next; while (first) { next = first; - first = get_long(next); + first = get_long (next); } - uae_u32 bytes = get_long(next + 4); + uae_u32 bytes = get_long (next + 4); if (next + bytes == 0x00200000) { - put_long(next + 4, currprefs.chipmem_size - next); - } - else { - put_long(0x00200000 + 0, 0); - put_long(0x00200000 + 4, added); - put_long(next, 0x00200000); + put_long (next + 4, currprefs.chipmem_size - next); + } else { + put_long (0x00200000 + 0, 0); + put_long (0x00200000 + 4, added); + put_long (next, 0x00200000); } return; } } -addrbank expamem_null, expamem_none; +addrbank expamem_null; -DECLARE_MEMORY_FUNCTIONS(expamem_write); -addrbank expamem_write_bank = { - expamem_write_lget, expamem_write_wget, expamem_write_bget, - expamem_write_lput, expamem_write_wput, expamem_write_bput, - default_xlate, default_check, NULL, NULL, _T("Autoconfig Z2 WRITE"), - dummy_lgeti, dummy_wgeti, - ABFLAG_IO | ABFLAG_SAFE | ABFLAG_PPCIOSPACE, S_READ, S_WRITE -}; DECLARE_MEMORY_FUNCTIONS(expamem); addrbank expamem_bank = { - expamem_lget, expamem_wget, expamem_bget, - expamem_lput, expamem_wput, expamem_bput, + expamem_lget, expamem_wget, expamem_bget, + expamem_lput, expamem_wput, expamem_bput, default_xlate, default_check, NULL, NULL, _T("Autoconfig Z2"), dummy_lgeti, dummy_wgeti, ABFLAG_IO | ABFLAG_SAFE | ABFLAG_PPCIOSPACE, S_READ, S_WRITE @@ -358,26 +324,26 @@ static addrbank expamemz3_bank = { ABFLAG_IO | ABFLAG_SAFE | ABFLAG_PPCIOSPACE, S_READ, S_WRITE }; -static addrbank *expamem_map_clear(void) +static addrbank *expamem_map_clear (void) { - write_log(_T("expamem_map_clear() got called. Shouldn't happen.\n")); + write_log (_T("expamem_map_clear() got called. Shouldn't happen.\n")); return NULL; } -static void expamem_init_clear(void) +static void expamem_init_clear (void) { - memset(expamem, 0xff, sizeof expamem); + memset (expamem, 0xff, sizeof expamem); + expamem_hi = expamem_lo = 0; expamem_map = NULL; } /* autoconfig area is "non-existing" after last device */ -static void expamem_init_clear_zero(void) +static void expamem_init_clear_zero (void) { if (currprefs.cpu_model < 68020) { - map_banks(&dummy_bank, 0xe8, 1, 0); - if (!currprefs.address_space_24) - map_banks(&dummy_bank, AUTOCONFIG_Z3 >> 16, 1, 0); - } - else { + map_banks (&dummy_bank, 0xe8, 1, 0); + if (!currprefs.address_space_24) + map_banks (&dummy_bank, AUTOCONFIG_Z3 >> 16, 1, 0); + } else { map_banks(&expamem_bank, 0xe8, 1, 0); if (!currprefs.address_space_24) map_banks(&expamemz3_bank, AUTOCONFIG_Z3 >> 16, 1, 0); @@ -385,19 +351,17 @@ static void expamem_init_clear_zero(void) expamem_bank_current = NULL; } -static void expamem_init_clear2(void) +static void expamem_init_clear2 (void) { expamem_bank.name = _T("Autoconfig Z2"); expamemz3_bank.name = _T("Autoconfig Z3"); - expamem_init_clear_zero(); - ecard = cardno; + expamem_init_clear_zero(); + ecard = cardno; } -static addrbank *expamem_init_last(void) +static addrbank *expamem_init_last (void) { - expamem_init_clear2(); - write_log(_T("Memory map after autoconfig:\n")); - //memory_map_dump(); + expamem_init_clear2(); return NULL; } @@ -410,82 +374,52 @@ static uae_u8 REGPARAM2 expamem_read(int addr) return b; } -static void REGPARAM2 expamem_write(uaecptr addr, uae_u32 value) +static void REGPARAM2 expamem_write (uaecptr addr, uae_u32 value) { - addr &= 0xffff; - if (addr == 00 || addr == 02 || addr == 0x40 || addr == 0x42) { + addr &= 0xffff; + if (addr == 00 || addr == 02 || addr == 0x40 || addr == 0x42) { expamem[addr] = (value & 0xf0); expamem[addr + 2] = (value & 0x0f) << 4; - } - else { + } else { expamem[addr] = ~(value & 0xf0); expamem[addr + 2] = ~((value & 0x0f) << 4); - } + } } -static int REGPARAM2 expamem_type(void) +static int REGPARAM2 expamem_type (void) { return expamem_read(0) & 0xc0; } -void expansion_cpu_fallback(void) -{ - if (ecard < cardno) { - card_data *cd = cards[ecard]; - if (cd->cst && (cd->cst->deviceflags & EXPANSIONTYPE_FALLBACK_DISABLE)) { - expamem_next(NULL, NULL); - } - } -} - static void call_card_init(int index) -{ +{ addrbank *ab, *abe; card_data *cd = cards[ecard]; struct autoconfig_info *aci = &cd->aci; bool ok = false; - if (currprefs.address_space_24 && cd->cst && (cd->cst->deviceflags & EXPANSIONTYPE_FALLBACK_DISABLE)) { - write_log(_T("Card %d: skipping autoconfig (fallback mode)\n"), ecard); - expamem_next(NULL, NULL); - return; - } - expamem_bank.name = cd->name ? cd->name : _T("None"); aci->prefs = &currprefs; aci->doinit = true; aci->devnum = (cd->flags >> 16) & 255; aci->ert = cd->ert; - aci->cst = cd->cst; aci->rc = cd->rc; aci->zorro = cd->zorro; memset(aci->autoconfig_raw, 0xff, sizeof aci->autoconfig_raw); if (cd->initnum) { ok = cd->initnum(aci); - } - else { + } else { ok = cd->initrc(aci); } if (ok) { ab = NULL; if (!cd->map) - ab = aci->Addrbank; - } - else { + ab = aci->addrbankp; + } else { write_log(_T("Card %d: skipping autoconfig (init failed)\n"), ecard); expamem_next(NULL, NULL); return; } - if (ab == &expamem_none) { - write_log(_T("Card %d: skipping autoconfig (none)\n"), ecard); - expamem_init_clear(); - expamem_init_clear_zero(); - map_banks(&expamem_bank, 0xE8, 1, 0); - if (!currprefs.address_space_24) - map_banks(&dummy_bank, AUTOCONFIG_Z3 >> 16, 1, 0); - expamem_bank_current = NULL; - return; - } if (ab == &expamem_null || cd->zorro < 1 || cd->zorro > 3 || aci->zorro < 0) { write_log(_T("Card %d: skipping autoconfig (not autoconfig)\n"), ecard); expamem_next(NULL, NULL); @@ -507,55 +441,45 @@ static void call_card_init(int index) expamem_write(i * 4, aci->autoconfig_bytes[i]); } expamem_autoconfig_mode = 1; - } - else if (aci->autoconfig_bytes) { + } else if (aci->autoconfig_bytes) { memset(expamem, 0xff, AUTOMATIC_AUTOCONFIG_MAX_ADDRESS); for (int i = 0; i < 16; i++) { expamem_write(i * 4, aci->autoconfig_bytes[i]); } expamem_autoconfig_mode = 1; - } - else if (aci->autoconfig_raw) { + } else if (aci->autoconfig_raw) { memcpy(expamem, aci->autoconfig_raw, sizeof aci->autoconfig_raw); } - } - else { + } else { for (int i = 0; i < 16 * 4; i++) { expamem[i] = abe->sub_banks ? abe->sub_banks[0].bank->bget(i) : abe->bget(i); } } } - if (aci->write_bank_address && aci->write_bank_address != 0xffffffff) { - map_banks(&expamem_write_bank, aci->write_bank_address >> 16, aci->size >> 16, 0); - } - if (ab) { // non-NULL: not using expamem_bank expamem_bank_current = ab; if ((cd->flags & CARD_FLAG_CAN_Z3) && currprefs.cs_z3autoconfig && !currprefs.address_space_24) { map_banks(&expamemz3_bank, AUTOCONFIG_Z3 >> 16, 1, 0); map_banks(&dummy_bank, 0xE8, 1, 0); - } - else { - map_banks(&expamem_bank, 0xE8, 1, 0); - if (!currprefs.address_space_24) - map_banks(&dummy_bank, AUTOCONFIG_Z3 >> 16, 1, 0); - } - } - else { + } else { + map_banks(&expamem_bank, 0xE8, 1, 0); + if (!currprefs.address_space_24) + map_banks(&dummy_bank, AUTOCONFIG_Z3 >> 16, 1, 0); + } + } else { if ((cd->flags & CARD_FLAG_CAN_Z3) && currprefs.cs_z3autoconfig && !currprefs.address_space_24) { map_banks(&expamemz3_bank, AUTOCONFIG_Z3 >> 16, 1, 0); map_banks(&dummy_bank, 0xE8, 1, 0); expamem_bank_current = &expamem_bank; + } else { + map_banks(&expamem_bank, 0xE8, 1, 0); + if (!currprefs.address_space_24) + map_banks(&dummy_bank, AUTOCONFIG_Z3 >> 16, 1, 0); + expamem_bank_current = NULL; } - else { - map_banks(&expamem_bank, 0xE8, 1, 0); - if (!currprefs.address_space_24) - map_banks(&dummy_bank, AUTOCONFIG_Z3 >> 16, 1, 0); - expamem_bank_current = NULL; - } - } + } } static void boardmessage(addrbank *mapped, bool success) @@ -569,18 +493,12 @@ static void boardmessage(addrbank *mapped, bool success) sizemod = 'M'; size /= 1024; } - write_log(_T("Card %d: Z%d 0x%08x %4d%c %s %s%s\n"), + write_log (_T("Card %d: Z%d 0x%08x %4d%c %s %s%s\n"), ecard + 1, (type & 0xc0) == zorroII ? 2 : ((type & 0xc0) == zorroIII ? 3 : 1), expamem_board_pointer, size, sizemod, type & rom_card ? _T("ROM") : (type & add_memory ? _T("RAM") : _T("IO ")), mapped->name, success ? _T("") : _T(" [SHUT UP]")); -#if 0 - for (int i = 0; i < 16; i++) { - write_log(_T("%s%02X"), i > 0 ? _T(".") : _T(""), expamem_read(i * 4)); - } - write_log(_T("\n")); -#endif } void expamem_shutup(addrbank *mapped) @@ -596,7 +514,7 @@ void expamem_next(addrbank *mapped, addrbank *next) if (mapped) boardmessage(mapped, mapped->start != 0xffffffff); - expamem_init_clear(); + expamem_init_clear(); expamem_init_clear_zero(); for (;;) { ++ecard; @@ -614,8 +532,7 @@ void expamem_next(addrbank *mapped, addrbank *next) aci.prefs = &currprefs; aci.rc = cards[ecard]->rc; ec->initrc(&aci); - } - else { + } else { call_card_init(ecard); break; } @@ -626,43 +543,20 @@ void expamem_next(addrbank *mapped, addrbank *next) } } -// only for custom autoconfig device development purposes, not in use in any normal config -static uae_u32 REGPARAM2 expamem_write_lget(uaecptr addr) +static void expamemz3_map(void) { - addr &= 0xffff; - return (expamem_write_space[addr + 0] << 24) | (expamem_write_space[addr + 1] << 16) | (expamem_write_space[addr + 2] << 8) | (expamem_write_space[addr + 3] << 0); -} -static uae_u32 REGPARAM2 expamem_write_wget(uaecptr addr) -{ - addr &= 0xffff; - return (expamem_write_space[addr + 0] << 8) | (expamem_write_space[addr + 1] << 0); -} -static uae_u32 REGPARAM2 expamem_write_bget(uaecptr addr) -{ - addr &= 0xffff; - return expamem_write_space[addr]; -} -static void REGPARAM2 expamem_write_lput(uaecptr addr, uae_u32 value) -{ - addr &= 0xffff; - expamem_write_space[addr + 0] = value >> 24; - expamem_write_space[addr + 1] = value >> 16; - expamem_write_space[addr + 2] = value >> 8; - expamem_write_space[addr + 3] = value >> 0; -} -static void REGPARAM2 expamem_write_wput(uaecptr addr, uae_u32 value) -{ - addr &= 0xffff; - expamem_write_space[addr + 0] = value >> 8; - expamem_write_space[addr + 1] = value; -} -static void REGPARAM2 expamem_write_bput(uaecptr addr, uae_u32 value) -{ - addr &= 0xffff; - expamem_write_space[addr] = value; + uaecptr addr = ((expamem_hi << 8) | expamem_lo) << 16; + if (!expamem_z3hack(&currprefs)) { + expamem_board_pointer = addr; + } else { + if (addr != expamem_board_pointer) { + put_word (regs.regs[11] + 0x20, expamem_board_pointer >> 16); + put_word (regs.regs[11] + 0x28, expamem_board_pointer >> 16); + } + } } -static uae_u32 REGPARAM2 expamem_lget(uaecptr addr) +static uae_u32 REGPARAM2 expamem_lget (uaecptr addr) { if (expamem_bank_current && expamem_bank_current != &expamem_bank) { if (expamem_autoconfig_mode && (addr & 0xffff) < AUTOMATIC_AUTOCONFIG_MAX_ADDRESS) { @@ -670,11 +564,11 @@ static uae_u32 REGPARAM2 expamem_lget(uaecptr addr) } return expamem_bank_current->sub_banks ? expamem_bank_current->sub_banks[0].bank->lget(addr) : expamem_bank_current->lget(addr); } - write_log(_T("warning: Z2 READ.L from address $%08x PC=%x\n"), addr, M68K_GETPC); - return (expamem_wget(addr) << 16) | expamem_wget(addr + 2); + write_log (_T("warning: Z2 READ.L from address $%08x PC=%x\n"), addr, M68K_GETPC); + return (expamem_wget (addr) << 16) | expamem_wget (addr + 2); } -static uae_u32 REGPARAM2 expamem_wget(uaecptr addr) +static uae_u32 REGPARAM2 expamem_wget (uaecptr addr) { if (expamem_bank_current && expamem_bank_current != &expamem_bank) { if (expamem_autoconfig_mode && (addr & 0xffff) < AUTOMATIC_AUTOCONFIG_MAX_ADDRESS) { @@ -686,22 +580,17 @@ static uae_u32 REGPARAM2 expamem_wget(uaecptr addr) if (expamem_bank_current && expamem_bank_current != &expamem_bank) return expamem_bank_current->bget(addr) << 8; } - uae_u32 v = (expamem_bget(addr) << 8) | expamem_bget(addr + 1); - if (cpuboards[currprefs.cpuboard_type].subtypes[currprefs.cpuboard_subtype].e8) { - uae_u32 val = v; - cpuboards[currprefs.cpuboard_type].subtypes[currprefs.cpuboard_subtype].e8(addr, &val, 2, false); - v = val; - } - write_log(_T("warning: READ.W from address $%08x=%04x PC=%x\n"), addr, v & 0xffff, M68K_GETPC); - return v; + uae_u32 v = (expamem_bget (addr) << 8) | expamem_bget (addr + 1); + write_log (_T("warning: READ.W from address $%08x=%04x PC=%x\n"), addr, v & 0xffff, M68K_GETPC); + return v; } -static uae_u32 REGPARAM2 expamem_bget(uaecptr addr) +static uae_u32 REGPARAM2 expamem_bget (uaecptr addr) { - uae_u8 b; + uae_u8 b; if (!chipdone) { chipdone = true; - addextrachip(get_long(4)); + addextrachip (get_long (4)); } if (expamem_bank_current && expamem_bank_current != &expamem_bank) { if (expamem_autoconfig_mode && (addr & 0xffff) < AUTOMATIC_AUTOCONFIG_MAX_ADDRESS) { @@ -709,20 +598,12 @@ static uae_u32 REGPARAM2 expamem_bget(uaecptr addr) } return expamem_bank_current->sub_banks ? expamem_bank_current->sub_banks[0].bank->bget(addr) : expamem_bank_current->bget(addr); } - addr &= 0xFFFF; - b = expamem[addr]; - if (cpuboards[currprefs.cpuboard_type].subtypes[currprefs.cpuboard_subtype].e8) { - uae_u32 val = b; - cpuboards[currprefs.cpuboard_type].subtypes[currprefs.cpuboard_subtype].e8(addr, &val, 1, false); - b = val; - } -#if EXP_DEBUG - write_log(_T("expamem_bget %x %x\n"), addr, b); -#endif - return b; + addr &= 0xFFFF; + b = expamem[addr]; + return b; } -static void REGPARAM2 expamem_lput(uaecptr addr, uae_u32 value) +static void REGPARAM2 expamem_lput (uaecptr addr, uae_u32 value) { if (expamem_bank_current && expamem_bank_current != &expamem_bank) { if (expamem_autoconfig_mode && (addr & 0xffff) < AUTOMATIC_AUTOCONFIG_MAX_ADDRESS) { @@ -731,160 +612,149 @@ static void REGPARAM2 expamem_lput(uaecptr addr, uae_u32 value) expamem_bank_current->sub_banks ? expamem_bank_current->sub_banks[0].bank->lput(addr, value) : expamem_bank_current->lput(addr, value); return; } - write_log(_T("warning: Z2 WRITE.L to address $%08x : value $%08x\n"), addr, value); + write_log (_T("warning: Z2 WRITE.L to address $%08x : value $%08x\n"), addr, value); } -static void REGPARAM2 expamem_wput(uaecptr addr, uae_u32 value) +static void REGPARAM2 expamem_wput (uaecptr addr, uae_u32 value) { -#if EXP_DEBUG - write_log(_T("expamem_wput %x %x\n"), addr, value); -#endif - value &= 0xffff; - if (cpuboards[currprefs.cpuboard_type].subtypes[currprefs.cpuboard_subtype].e8) { - if (cpuboards[currprefs.cpuboard_type].subtypes[currprefs.cpuboard_subtype].e8(addr, &value, 2, true)) - return; - } - if (ecard >= cardno) - return; + value &= 0xffff; + if (ecard >= cardno) + return; card_data *cd = cards[ecard]; if (!expamem_map) expamem_map = cd->map; - if (expamem_type() != zorroIII) { - write_log(_T("warning: WRITE.W to address $%08x : value $%x PC=%08x\n"), addr, value, M68K_GETPC); + if (expamem_type () != zorroIII) { + write_log (_T("warning: WRITE.W to address $%08x : value $%x PC=%08x\n"), addr, value, M68K_GETPC); } switch (addr & 0xff) { - case 0x48: - // A2630 boot rom writes WORDs to Z2 boards! - if (expamem_type() == zorroII) { - expamem_lo = 0; - expamem_hi = (value >> 8) & 0xff; - expamem_board_pointer = (expamem_hi | (expamem_lo >> 4)) << 16; - if (expamem_map) { - expamem_next(expamem_map(&cd->aci), NULL); - return; - } - if (expamem_bank_current && expamem_bank_current != &expamem_bank) { - expamem_bank_current->sub_banks ? expamem_bank_current->sub_banks[0].bank->bput(addr, value >> 8) : expamem_bank_current->bput(addr, value >> 8); - return; - } - } - break; - case 0x44: - if (expamem_type() == zorroIII) { - uaecptr addr; - expamem_hi = value & 0xff00; - addr = (expamem_hi | (expamem_lo >> 4)) << 16; - if (!expamem_z3hack(&currprefs)) { - expamem_board_pointer = addr; - } - else { - if (addr != expamem_board_pointer) { - put_word(regs.regs[11] + 0x20, expamem_board_pointer >> 16); - put_word(regs.regs[11] + 0x28, expamem_board_pointer >> 16); - } - } - } - if (expamem_map) { - expamem_next(expamem_map(&cd->aci), NULL); - return; - } - if (expamem_autoconfig_mode) { - map_banks_z3(cd->aci.Addrbank, expamem_board_pointer >> 16, expamem_board_size >> 16); - cd->aci.postinit = true; - cd->initrc(&cd->aci); - expamem_next(cd->aci.Addrbank, NULL); - return; - } - break; - case 0x4c: - if (expamem_map) { - expamem_next(NULL, NULL); - return; - } - break; - } + case 0x48: + // A2630 boot rom writes WORDs to Z2 boards! + if (expamem_type() == zorroII) { + expamem_lo = 0; + expamem_hi = (value >> 8) & 0xff; + expamem_board_pointer = (expamem_hi | (expamem_lo >> 4)) << 16; + if (expamem_map) { + expamem_next(expamem_map(&cd->aci), NULL); + return; + } + if (expamem_bank_current && expamem_bank_current != &expamem_bank) { + expamem_bank_current->sub_banks ? expamem_bank_current->sub_banks[0].bank->bput(addr, value >> 8) : expamem_bank_current->bput(addr, value >> 8); + return; + } + } + // Z3 = do nothing + break; + case 0x44: + if (expamem_type() == zorroIII) { + expamem_hi = (value & 0xff00) >> 8; + expamem_lo = value & 0x00ff; + expamemz3_map(); + } + if (expamem_map) { + expamem_next(expamem_map(&cd->aci), NULL); + return; + } + if (expamem_autoconfig_mode) { + map_banks_z3(cd->aci.addrbankp, expamem_board_pointer >> 16, expamem_board_size >> 16); + cd->initrc(&cd->aci); + expamem_next(cd->aci.addrbankp, NULL); + return; + } + break; + case 0x4c: + if (expamem_map) { + expamem_next (NULL, NULL); + return; + } + break; + } if (expamem_bank_current && expamem_bank_current != &expamem_bank) { expamem_bank_current->sub_banks ? expamem_bank_current->sub_banks[0].bank->wput(addr, value) : expamem_bank_current->wput(addr, value); } } -static void REGPARAM2 expamem_bput(uaecptr addr, uae_u32 value) +static void REGPARAM2 expamem_bput (uaecptr addr, uae_u32 value) { -#if EXP_DEBUG - write_log(_T("expamem_bput %x %x\n"), addr, value); -#endif - value &= 0xff; - if (cpuboards[currprefs.cpuboard_type].subtypes[currprefs.cpuboard_subtype].e8) { - if (cpuboards[currprefs.cpuboard_type].subtypes[currprefs.cpuboard_subtype].e8(addr, &value, 1, true)) - return; - } - if (ecard >= cardno) - return; + value &= 0xff; + if (ecard >= cardno) + return; card_data *cd = cards[ecard]; if (!expamem_map) expamem_map = cd->map; if (expamem_type() == protoautoconfig) { switch (addr & 0xff) { - case 0x22: - expamem_hi = value & 0x7f; - expamem_board_pointer = AUTOCONFIG_Z2 | (expamem_hi * 4096); - if (expamem_map) { - expamem_next(expamem_map(&cd->aci), NULL); - return; - } - break; + case 0x22: + expamem_hi = value & 0x7f; + expamem_board_pointer = AUTOCONFIG_Z2 | (expamem_hi * 4096); + if (expamem_map) { + expamem_next(expamem_map(&cd->aci), NULL); + return; + } + break; } - } - else { - switch (addr & 0xff) { - case 0x48: - if (expamem_type() == zorroII) { - expamem_hi = value & 0xff; - expamem_board_pointer = (expamem_hi | (expamem_lo >> 4)) << 16; - if (expamem_map) { - expamem_next(expamem_map(&cd->aci), NULL); - return; - } - if (expamem_autoconfig_mode) { - map_banks_z2(cd->aci.Addrbank, expamem_board_pointer >> 16, expamem_board_size >> 16); - cd->aci.postinit = true; - cd->initrc(&cd->aci); - expamem_next(cd->aci.Addrbank, NULL); - return; - } - } - else { - expamem_lo = value & 0xff; - } - break; + } else { + switch (addr & 0xff) { + case 0x48: + if (expamem_type () == zorroII) { + expamem_hi = value & 0xff; + expamem_board_pointer = (expamem_hi | (expamem_lo >> 4)) << 16; + if (expamem_map) { + expamem_next(expamem_map(&cd->aci), NULL); + return; + } + if (expamem_autoconfig_mode) { + map_banks_z2(cd->aci.addrbankp, expamem_board_pointer >> 16, expamem_board_size >> 16); + cd->initrc(&cd->aci); + expamem_next(cd->aci.addrbankp, NULL); + return; + } + } else { + expamem_lo = value & 0xff; + } + break; + case 0x44: + if (expamem_type() == zorroIII) { + expamem_hi = value & 0xff; + expamemz3_map(); + if (expamem_map) { + expamem_next(expamem_map(&cd->aci), NULL); + return; + } + if (expamem_autoconfig_mode) { + map_banks_z3(cd->aci.addrbankp, expamem_board_pointer >> 16, expamem_board_size >> 16); + cd->initrc(&cd->aci); + expamem_next(cd->aci.addrbankp, NULL); + return; + } + } + break; + case 0x4a: + if (expamem_type () == zorroII) { + expamem_lo = value & 0xff; + } + if (expamem_autoconfig_mode) + return; + break; - case 0x4a: - if (expamem_type() == zorroII) { - expamem_lo = value & 0xff; - } - if (expamem_autoconfig_mode) - return; - break; - - case 0x4c: - if (expamem_map) { - expamem_hi = expamem_lo = 0xff; - expamem_board_pointer = 0xffffffff; - addrbank *ab = expamem_map(&cd->aci); - if (ab) - ab->start = 0xffffffff; - expamem_next(ab, NULL); - return; - } - break; - } + case 0x4c: + if (expamem_map) { + expamem_hi = expamem_lo = 0xff; + expamem_board_pointer = 0xffffffff; + addrbank *ab = expamem_map(&cd->aci); + if (ab) + ab->start = 0xffffffff; + expamem_next(ab, NULL); + return; + } + break; + } } if (expamem_bank_current && expamem_bank_current != &expamem_bank) { expamem_bank_current->sub_banks ? expamem_bank_current->sub_banks[0].bank->bput(addr, value) : expamem_bank_current->bput(addr, value); } } -static uae_u32 REGPARAM2 expamemz3_bget(uaecptr addr) +static uae_u32 REGPARAM2 expamemz3_bget (uaecptr addr) { int reg = addr & 0xff; if (!expamem_bank_current) @@ -894,20 +764,20 @@ static uae_u32 REGPARAM2 expamemz3_bget(uaecptr addr) return expamem_bank_current->bget(reg + 0); } -static uae_u32 REGPARAM2 expamemz3_wget(uaecptr addr) +static uae_u32 REGPARAM2 expamemz3_wget (uaecptr addr) { - uae_u32 v = (expamemz3_bget(addr) << 8) | expamemz3_bget(addr + 1); - write_log(_T("warning: Z3 READ.W from address $%08x=%04x PC=%x\n"), addr, v & 0xffff, M68K_GETPC); + uae_u32 v = (expamemz3_bget (addr) << 8) | expamemz3_bget (addr + 1); + write_log (_T("warning: Z3 READ.W from address $%08x=%04x PC=%x\n"), addr, v & 0xffff, M68K_GETPC); return v; } -static uae_u32 REGPARAM2 expamemz3_lget(uaecptr addr) +static uae_u32 REGPARAM2 expamemz3_lget (uaecptr addr) { - write_log(_T("warning: Z3 READ.L from address $%08x PC=%x\n"), addr, M68K_GETPC); - return (expamemz3_wget(addr) << 16) | expamemz3_wget(addr + 2); + write_log (_T("warning: Z3 READ.L from address $%08x PC=%x\n"), addr, M68K_GETPC); + return (expamemz3_wget (addr) << 16) | expamemz3_wget (addr + 2); } -static void REGPARAM2 expamemz3_bput(uaecptr addr, uae_u32 value) +static void REGPARAM2 expamemz3_bput (uaecptr addr, uae_u32 value) { int reg = addr & 0xff; if (!expamem_bank_current) @@ -918,19 +788,22 @@ static void REGPARAM2 expamemz3_bput(uaecptr addr, uae_u32 value) if (expamem_type() == zorroII) { expamem_hi = value & 0xff; expamem_board_pointer = (expamem_hi | (expamem_lo >> 4)) << 16; - } - else { + } else { expamem_lo = value & 0xff; } - } - else if (reg == 0x4a) { + } else if (reg == 0x44) { + if (expamem_type() == zorroIII) { + expamem_hi = value & 0xff; + expamemz3_map(); + } + } else if (reg == 0x4a) { if (expamem_type() == zorroII) expamem_lo = value & 0xff; } expamem_bank_current->bput(reg, value); } -static void REGPARAM2 expamemz3_wput(uaecptr addr, uae_u32 value) +static void REGPARAM2 expamemz3_wput (uaecptr addr, uae_u32 value) { int reg = addr & 0xff; if (!expamem_bank_current) @@ -939,35 +812,26 @@ static void REGPARAM2 expamemz3_wput(uaecptr addr, uae_u32 value) reg += 2; if (reg == 0x44) { if (expamem_type() == zorroIII) { - uaecptr addr; - expamem_hi = value & 0xff00; - addr = (expamem_hi | (expamem_lo >> 4)) << 16;; - if (!expamem_z3hack(&currprefs)) { - expamem_board_pointer = addr; - } - else { - if (addr != expamem_board_pointer) { - put_word(regs.regs[11] + 0x20, expamem_board_pointer >> 16); - put_word(regs.regs[11] + 0x28, expamem_board_pointer >> 16); - } - } + expamem_hi = (value & 0xff00) >> 8; + expamem_lo = value & 0x00ff; + expamemz3_map(); } } expamem_bank_current->wput(reg, value); } -static void REGPARAM2 expamemz3_lput(uaecptr addr, uae_u32 value) +static void REGPARAM2 expamemz3_lput (uaecptr addr, uae_u32 value) { - write_log(_T("warning: Z3 WRITE.L to address $%08x : value $%08x\n"), addr, value); + write_log (_T("warning: Z3 WRITE.L to address $%08x : value $%08x\n"), addr, value); } #ifdef CD32 -static bool expamem_init_cd32fmv(struct autoconfig_info *aci) +static bool expamem_init_cd32fmv (struct autoconfig_info *aci) { - expamem_init_clear(); + expamem_init_clear (); load_rom_rc(aci->rc, ROMTYPE_CD32CART, 262144, 0, expamem, 128, 0); memcpy(aci->autoconfig_raw, expamem, sizeof aci->autoconfig_raw); - //expamem_map = cd32_fmv_init; + expamem_map = cd32_fmv_init; return true; } @@ -976,14 +840,10 @@ static bool expamem_init_cd32fmv(struct autoconfig_info *aci) /* ********************************************************** */ /* -* Fast Memory -*/ - + * Fast Memory + */ MEMORY_ARRAY_FUNCTIONS(fastmem, 0); -MEMORY_ARRAY_FUNCTIONS(fastmem, 1); -MEMORY_ARRAY_FUNCTIONS(fastmem, 2); -MEMORY_ARRAY_FUNCTIONS(fastmem, 3); addrbank fastmem_bank[MAX_RAM_BOARDS] = { @@ -993,143 +853,14 @@ addrbank fastmem_bank[MAX_RAM_BOARDS] = fastmem0_xlate, fastmem0_check, NULL, _T("*"), _T("Fast memory"), fastmem0_lget, fastmem0_wget, ABFLAG_RAM | ABFLAG_THREADSAFE, 0, 0 - }, - { - fastmem1_lget, fastmem1_wget, fastmem1_bget, - fastmem1_lput, fastmem1_wput, fastmem1_bput, - fastmem1_xlate, fastmem1_check, NULL, _T("*"), _T("Fast memory 2"), - fastmem1_lget, fastmem1_wget, - ABFLAG_RAM | ABFLAG_THREADSAFE, 0, 0 - }, - { - fastmem2_lget, fastmem2_wget, fastmem2_bget, - fastmem2_lput, fastmem2_wput, fastmem2_bput, - fastmem2_xlate, fastmem2_check, NULL, _T("*"), _T("Fast memory 3"), - fastmem2_lget, fastmem2_wget, - ABFLAG_RAM | ABFLAG_THREADSAFE, 0, 0 - }, - { - fastmem3_lget, fastmem3_wget, fastmem3_bget, - fastmem3_lput, fastmem3_wput, fastmem3_bput, - fastmem3_xlate, fastmem3_check, NULL, _T("*"), _T("Fast memory 4"), - fastmem3_lget, fastmem3_wget, - ABFLAG_RAM | ABFLAG_THREADSAFE, 0, 0 } }; -#ifdef CATWEASEL - -/* -* Catweasel ZorroII -*/ - -DECLARE_MEMORY_FUNCTIONS(catweasel); - -static uae_u32 catweasel_mask; -static uae_u32 catweasel_start; - -static uae_u32 REGPARAM2 catweasel_lget(uaecptr addr) -{ - write_log(_T("catweasel_lget @%08X!\n"), addr); - return 0; -} - -static uae_u32 REGPARAM2 catweasel_wget(uaecptr addr) -{ - write_log(_T("catweasel_wget @%08X!\n"), addr); - return 0; -} - -static uae_u32 REGPARAM2 catweasel_bget(uaecptr addr) -{ - addr -= catweasel_start & catweasel_mask; - addr &= catweasel_mask; - return catweasel_do_bget(addr); -} - -static void REGPARAM2 catweasel_lput(uaecptr addr, uae_u32 l) -{ - write_log(_T("catweasel_lput @%08X=%08X!\n"), addr, l); -} - -static void REGPARAM2 catweasel_wput(uaecptr addr, uae_u32 w) -{ - write_log(_T("catweasel_wput @%08X=%04X!\n"), addr, w); -} - -static void REGPARAM2 catweasel_bput(uaecptr addr, uae_u32 b) -{ - addr -= catweasel_start & catweasel_mask; - addr &= catweasel_mask; - catweasel_do_bput(addr, b); -} - -static int REGPARAM2 catweasel_check(uaecptr addr, uae_u32 size) -{ - return 0; -} - -static uae_u8 *REGPARAM2 catweasel_xlate(uaecptr addr) -{ - write_log(_T("catweasel_xlate @%08X size %08X\n"), addr); - return 0; -} - -static Addrbank catweasel_bank = { - catweasel_lget, catweasel_wget, catweasel_bget, - catweasel_lput, catweasel_wput, catweasel_bput, - catweasel_xlate, catweasel_check, NULL, NULL, _T("Catweasel"), - dummy_lgeti, dummy_wgeti, - ABFLAG_IO, S_READ, S_WRITE -}; - -static Addrbank *expamem_map_catweasel(int devnum) -{ - catweasel_start = expamem_board_pointer; - map_banks_z2(&catweasel_bank, catweasel_start >> 16, 1); - return &catweasel_bank; -} - -static bool expamem_init_catweasel(struct autoconfig_info *aci) -{ - uae_u8 productid = cwc.type >= CATWEASEL_TYPE_MK3 ? 66 : 200; - uae_u16 vendorid = cwc.type >= CATWEASEL_TYPE_MK3 ? 4626 : 5001; - - catweasel_mask = (cwc.type >= CATWEASEL_TYPE_MK3) ? 0xffff : 0x1ffff; - - expamem_init_clear(); - - expamem_write(0x00, (cwc.type >= CATWEASEL_TYPE_MK3 ? Z2_MEM_64KB : Z2_MEM_128KB) | zorroII); - - expamem_write(0x04, productid); - - expamem_write(0x08, 0); - - expamem_write(0x10, vendorid >> 8); - expamem_write(0x14, vendorid & 0xff); - - expamem_write(0x18, 0x00); /* ser.no. Byte 0 */ - expamem_write(0x1c, 0x00); /* ser.no. Byte 1 */ - expamem_write(0x20, 0x00); /* ser.no. Byte 2 */ - expamem_write(0x24, 0x00); /* ser.no. Byte 3 */ - - expamem_write(0x28, 0x00); /* Rom-Offset hi */ - expamem_write(0x2c, 0x00); /* ROM-Offset lo */ - - expamem_write(0x40, 0x00); /* Ctrl/Statusreg.*/ - - memcpy(aci->autoconfig_raw, expamem, sizeof aci->autoconfig_raw); - - return true; -} - -#endif - #ifdef FILESYS /* * Filesystem device ROM/RAM space -*/ + */ DECLARE_MEMORY_FUNCTIONS(filesys); addrbank filesys_bank = { @@ -1145,53 +876,43 @@ static bool filesys_write(uaecptr addr) return addr >= 0x4000; } -static uae_u32 REGPARAM2 filesys_lget(uaecptr addr) +static uae_u32 REGPARAM2 filesys_lget (uaecptr addr) { - uae_u8 *m; - addr -= filesys_bank.start & 65535; - addr &= 65535; - m = filesys_bank.baseaddr + addr; -#if EXP_DEBUG - write_log(_T("filesys_lget %x %x\n"), addr, do_get_mem_long((uae_u32 *)m)); -#endif - return do_get_mem_long((uae_u32 *)m); + uae_u8 *m; + addr -= filesys_bank.start; + addr &= 65535; + m = filesys_bank.baseaddr + addr; + return do_get_mem_long ((uae_u32 *)m); } -static uae_u32 REGPARAM2 filesys_wget(uaecptr addr) +static uae_u32 REGPARAM2 filesys_wget (uaecptr addr) { - uae_u8 *m; - addr -= filesys_bank.start & 65535; - addr &= 65535; - m = filesys_bank.baseaddr + addr; -#if EXP_DEBUG - write_log(_T("filesys_wget %x %x\n"), addr, do_get_mem_word((uae_u16 *)m)); -#endif - return do_get_mem_word((uae_u16 *)m); + uae_u8 *m; + addr -= filesys_bank.start; + addr &= 65535; + m = filesys_bank.baseaddr + addr; + return do_get_mem_word ((uae_u16 *)m); } -static uae_u32 REGPARAM2 filesys_bget(uaecptr addr) +static uae_u32 REGPARAM2 filesys_bget (uaecptr addr) { - addr -= filesys_bank.start & 65535; - addr &= 65535; -#if EXP_DEBUG - write_log(_T("filesys_bget %x %x\n"), addr, filesys_bank.baseaddr[addr]); -#endif - return filesys_bank.baseaddr[addr]; + addr -= filesys_bank.start; + addr &= 65535; + return filesys_bank.baseaddr[addr]; } - static void REGPARAM2 filesys_bput(uaecptr addr, uae_u32 b) { - addr -= filesys_bank.start & 65535; + addr -= filesys_bank.start; addr &= 65535; if (!filesys_write(addr)) return; filesys_bank.baseaddr[addr] = b; } -static void REGPARAM2 filesys_lput(uaecptr addr, uae_u32 l) +static void REGPARAM2 filesys_lput (uaecptr addr, uae_u32 l) { - addr -= filesys_bank.start & 65535; + addr -= filesys_bank.start; addr &= 65535; if (!filesys_write(addr)) return; @@ -1201,9 +922,9 @@ static void REGPARAM2 filesys_lput(uaecptr addr, uae_u32 l) filesys_bank.baseaddr[addr + 3] = l >> 0; } -static void REGPARAM2 filesys_wput(uaecptr addr, uae_u32 w) +static void REGPARAM2 filesys_wput (uaecptr addr, uae_u32 w) { - addr -= filesys_bank.start & 65535; + addr -= filesys_bank.start; addr &= 65535; if (!filesys_write(addr)) return; @@ -1213,13 +934,13 @@ static void REGPARAM2 filesys_wput(uaecptr addr, uae_u32 w) static int REGPARAM2 filesys_check(uaecptr addr, uae_u32 size) { - addr -= filesys_bank.start & 65535; + addr -= filesys_bank.start; addr &= 65535; return (addr + size) <= filesys_bank.allocated_size; } static uae_u8 *REGPARAM2 filesys_xlate(uaecptr addr) { - addr -= filesys_bank.start & 65535; + addr -= filesys_bank.start; addr &= 65535; return filesys_bank.baseaddr + addr; } @@ -1232,40 +953,16 @@ addrbank uaeboard_bank = { uaeboard_lput, uaeboard_wput, uaeboard_bput, uaeboard_xlate, uaeboard_check, NULL, _T("*"), _T("UAE Board"), dummy_lgeti, dummy_wgeti, - ABFLAG_IO | ABFLAG_SAFE | ABFLAG_PPCIOSPACE, S_READ, S_WRITE + ABFLAG_IO | ABFLAG_SAFE, S_READ, S_WRITE }; uae_u32 uaeboard_base; /* Determined by the OS */ -static uae_u32 uaeboard_ram_start; #define UAEBOARD_WRITEOFFSET 0x4000 uae_u8 *uaeboard_map_ram(uaecptr p) { - if (currprefs.uaeboard > 1) { - p -= uaeboard_base; - return uaeboard_bank.baseaddr + p; - } - else { - p -= filesys_bank.start; - return filesys_bank.baseaddr + p; - } -} - -uaecptr uaeboard_alloc_ram(uae_u32 size) -{ - uaecptr p; - size += 7; - size &= ~7; - if (currprefs.uaeboard > 1) { - p = uaeboard_ram_start + uaeboard_base; - memset(uaeboard_bank.baseaddr + uaeboard_ram_start, 0, size); - } - else { - p = uaeboard_ram_start + filesys_bank.start; - memset(filesys_bank.baseaddr + uaeboard_ram_start, 0, size); - } - uaeboard_ram_start += size; - return p; + p -= filesys_bank.start; + return filesys_bank.baseaddr + p; } static bool uaeboard_write(uaecptr addr) @@ -1340,19 +1037,14 @@ static uae_u8 *REGPARAM2 uaeboard_xlate(uaecptr addr) { addr -= uaeboard_base & 65535; addr &= 65535; - return filesys_bank.baseaddr + addr; + return uaeboard_bank.baseaddr + addr; } static addrbank *expamem_map_uaeboard(struct autoconfig_info *aci) { uaeboard_base = expamem_board_pointer; - uaeboard_ram_start = UAEBOARD_WRITEOFFSET; uaeboard_bank.start = uaeboard_base; map_banks_z2(&uaeboard_bank, uaeboard_base >> 16, 1); - if (currprefs.uaeboard > 1) { - rtarea_bank.start = uaeboard_base + 65536; - map_banks_z2(&rtarea_bank, (uaeboard_base + 65536) >> 16, 1); - } return &uaeboard_bank; } @@ -1371,16 +1063,14 @@ static bool expamem_init_uaeboard(struct autoconfig_info *aci) { bool ks12 = ks12orolder(); struct uae_prefs *p = aci->prefs; - bool hide = p->uae_hide_autoconfig; - bool rom = p->uaeboard > 1; aci->label = _T("UAE Boot ROM"); - aci->Addrbank = &uaeboard_bank; + aci->addrbankp = &uaeboard_bank; aci->get_params = get_params_filesys; aci->set_params = set_params_filesys; expamem_init_clear(); - expamem_write(0x00, (p->uaeboard > 1 ? Z2_MEM_128KB : Z2_MEM_64KB) | zorroII | (ks12 || !rom ? 0 : rom_card)); + expamem_write(0x00, Z2_MEM_64KB | zorroII | (ks12)); expamem_write(0x08, no_shutup); @@ -1395,53 +1085,8 @@ static bool expamem_init_uaeboard(struct autoconfig_info *aci) uae_u8 *ptr = uaeboard_bank.baseaddr; - if (rom) { - - int diagoffset = 0x80; - int diagpoint = 24; - int bootpoint = diagpoint + 16; - /* struct DiagArea - the size has to be large enough to store several device ROMTags */ - const uae_u8 diagarea[] = { - 0x90, 0x00, /* da_Config, da_Flags */ - 0x03, 0x00, /* da_Size */ - (uae_u8)(diagpoint >> 8), (uae_u8)diagpoint, - (uae_u8)(bootpoint >> 8), (uae_u8)bootpoint, - 0, (uae_u8)(hide ? 0 : 14), // Name offset - 0, 0, 0, 0, - (uae_u8)(hide ? 0 : 'U'), (uae_u8)(hide ? 0 : 'A'), (uae_u8)(hide ? 0 : 'E'), 0 - }; - expamem_write(0x28, diagoffset >> 8); /* ROM-Offset hi */ - expamem_write(0x2c, diagoffset & 0xff); /* ROM-Offset lo */ - /* Build a DiagArea */ - memcpy(expamem + diagoffset, diagarea, sizeof diagarea); - diagpoint += diagoffset; - bootpoint += diagoffset; - - if (aci->doinit) { - if (p->uaeboard > 2) { - /* Call hwtrap_install */ - put_word_host(expamem + diagpoint + 0, 0x4EB9); /* JSR */ - put_long_host(expamem + diagpoint + 2, filesys_get_entry(9)); - diagpoint += 6; - } - /* Call DiagEntry */ - put_word_host(expamem + diagpoint + 0, 0x4EF9); /* JMP */ - put_long_host(expamem + diagpoint + 2, ROM_filesys_diagentry); - - /* What comes next is a plain bootblock */ - put_word_host(expamem + bootpoint + 0, 0x4EF9); /* JMP */ - put_long_host(expamem + bootpoint + 2, EXPANSION_bootcode); - - put_long_host(rtarea_bank.baseaddr + RTAREA_FSBOARD, uaeboard_bank.start + 0x2000); - } - - } - else { - - expamem_write(0x28, 0x00); /* ROM-Offset hi */ - expamem_write(0x2c, 0x00); /* ROM-Offset lo */ - - } + expamem_write(0x28, 0x00); /* ROM-Offset hi */ + expamem_write(0x2c, 0x00); /* ROM-Offset lo */ memcpy(aci->autoconfig_raw, expamem, sizeof aci->autoconfig_raw); @@ -1454,13 +1099,10 @@ static bool expamem_init_uaeboard(struct autoconfig_info *aci) } /* -* Z3fastmem Memory -*/ + * Z3fastmem Memory + */ MEMORY_ARRAY_FUNCTIONS(z3fastmem, 0); -MEMORY_ARRAY_FUNCTIONS(z3fastmem, 1); -MEMORY_ARRAY_FUNCTIONS(z3fastmem, 2); -MEMORY_ARRAY_FUNCTIONS(z3fastmem, 3); addrbank z3fastmem_bank[MAX_RAM_BOARDS] = { @@ -1470,45 +1112,14 @@ addrbank z3fastmem_bank[MAX_RAM_BOARDS] = z3fastmem0_xlate, z3fastmem0_check, NULL, _T("*"), _T("Zorro III Fast RAM"), z3fastmem0_lget, z3fastmem0_wget, ABFLAG_RAM | ABFLAG_THREADSAFE, 0, 0 - }, - { - z3fastmem1_lget, z3fastmem1_wget, z3fastmem1_bget, - z3fastmem1_lput, z3fastmem1_wput, z3fastmem1_bput, - z3fastmem1_xlate, z3fastmem1_check, NULL, _T("*"), _T("Zorro III Fast RAM #2"), - z3fastmem1_lget, z3fastmem1_wget, - ABFLAG_RAM | ABFLAG_THREADSAFE, 0, 0 - }, - { - z3fastmem2_lget, z3fastmem2_wget, z3fastmem2_bget, - z3fastmem2_lput, z3fastmem2_wput, z3fastmem2_bput, - z3fastmem2_xlate, z3fastmem2_check, NULL, _T("*"), _T("Zorro III Fast RAM #3"), - z3fastmem2_lget, z3fastmem2_wget, - ABFLAG_RAM | ABFLAG_THREADSAFE, 0, 0 - }, - { - z3fastmem3_lget, z3fastmem3_wget, z3fastmem3_bget, - z3fastmem3_lput, z3fastmem3_wput, z3fastmem3_bput, - z3fastmem3_xlate, z3fastmem3_check, NULL, _T("*"), _T("Zorro III Fast RAM #4"), - z3fastmem3_lget, z3fastmem3_wget, - ABFLAG_RAM | ABFLAG_THREADSAFE, 0, 0 - } -}; - -MEMORY_FUNCTIONS(z3chipmem); - -addrbank z3chipmem_bank = { - z3chipmem_lget, z3chipmem_wget, z3chipmem_bget, - z3chipmem_lput, z3chipmem_wput, z3chipmem_bput, - z3chipmem_xlate, z3chipmem_check, NULL, _T("*"), _T("MegaChipRAM"), - z3chipmem_lget, z3chipmem_wget, - ABFLAG_RAM | ABFLAG_THREADSAFE, 0, 0 + } }; /* ********************************************************** */ /* * Expansion Card (ZORRO II) for 64/128/256/512KB 1/2/4/8MB of Fast Memory -*/ + */ static addrbank *expamem_map_fastcard(struct autoconfig_info *aci) { @@ -1519,52 +1130,19 @@ static addrbank *expamem_map_fastcard(struct autoconfig_info *aci) uae_u32 size = ab->allocated_size; ab->start = start; if (ab->start && size) { - map_banks_z2(ab, ab->start >> 16, size >> 16); - } + map_banks_z2 (ab, ab->start >> 16, size >> 16); + } return ab; } static bool fastmem_autoconfig(struct uae_prefs *p, struct autoconfig_info *aci, int zorro, uae_u8 type, uae_u32 serial, int allocated) { - uae_u16 mid = 0; - uae_u8 pid; + uae_u16 mid = 0; + uae_u8 pid; uae_u8 flags = 0; - DEVICE_MEMORY_CALLBACK dmc = NULL; - struct romconfig *dmc_rc = NULL; uae_u8 ac[16] = { 0 }; int boardnum = aci->devnum; - if (aci->cst) { - mid = aci->cst->memory_mid; - pid = aci->cst->memory_pid; - serial = aci->cst->memory_serial; - } - else if (aci->ert) { - const struct expansionromtype *ert = aci->ert; - struct romconfig *rc = get_device_romconfig(p, ert->romtype, 0); - if (ert->subtypes) { - const struct expansionsubromtype *srt = &ert->subtypes[rc->subtype]; - if (srt->memory_mid) { - mid = srt->memory_mid; - pid = srt->memory_pid; - serial = srt->memory_serial; - if (!srt->memory_after) - type |= chainedconfig; - } - } - else { - if (ert->memory_mid) { - mid = ert->memory_mid; - pid = ert->memory_pid; - serial = ert->memory_serial; - if (!ert->memory_after) - type |= chainedconfig; - } - } - dmc = ert->memory_callback; - dmc_rc = rc; - } - uae_u8 *forceac = NULL; struct ramboard *rb = NULL; @@ -1573,34 +1151,29 @@ static bool fastmem_autoconfig(struct uae_prefs *p, struct autoconfig_info *aci, rb = &p->fastmem[boardnum]; if (rb->autoconfig[0]) { forceac = rb->autoconfig; - } - else if (rb->manufacturer) { + } else if (rb->manufacturer) { mid = rb->manufacturer; pid = rb->product; serial = 0; + } else { + pid = 81; } - else { - pid = p->maprom && !p->cpuboard_type ? 1 : 81; - } - } - else { + } else { int subsize = (allocated == 0x100000 ? Z3_SS_MEM_1MB - : allocated == 0x200000 ? Z3_SS_MEM_2MB - : allocated == 0x400000 ? Z3_SS_MEM_4MB - : allocated == 0x800000 ? Z3_SS_MEM_8MB - : Z3_SS_MEM_SAME); - struct ramboard *rb = &p->z3fastmem[boardnum]; + : allocated == 0x200000 ? Z3_SS_MEM_2MB + : allocated == 0x400000 ? Z3_SS_MEM_4MB + : allocated == 0x800000 ? Z3_SS_MEM_8MB + : Z3_SS_MEM_SAME); + rb = &p->z3fastmem[boardnum]; if (rb->autoconfig[0]) { forceac = rb->autoconfig; - } - else if (rb->manufacturer) { + } else if (rb->manufacturer) { mid = rb->manufacturer; pid = rb->product; serial = 0; - } - else { - pid = p->maprom && !p->cpuboard_type ? 3 : 83; - } + } else { + pid = 83; + } flags |= care_addr | force_z3 | (allocated > 0x800000 ? ext_size : subsize); } } @@ -1617,21 +1190,17 @@ static bool fastmem_autoconfig(struct uae_prefs *p, struct autoconfig_info *aci, if (flags) ac[0x08 / 4] = flags; } + } else { + ac[0x00 / 4] = type; + ac[0x04 / 4] = pid; + ac[0x08 / 4] = flags; + ac[0x10 / 4] = mid >> 8; + ac[0x14 / 4] = (uae_u8)mid; + ac[0x18 / 4] = serial >> 24; + ac[0x1c / 4] = serial >> 16; + ac[0x20 / 4] = serial >> 8; + ac[0x24 / 4] = serial >> 0; } - else { - ac[0x00 / 4] = type; - ac[0x04 / 4] = pid; - ac[0x08 / 4] = flags; - ac[0x10 / 4] = mid >> 8; - ac[0x14 / 4] = (uae_u8)mid; - ac[0x18 / 4] = serial >> 24; - ac[0x1c / 4] = serial >> 16; - ac[0x20 / 4] = serial >> 8; - ac[0x24 / 4] = serial >> 0; - } - - if (dmc && dmc_rc) - dmc(dmc_rc, ac, allocated); expamem_write(0x00, ac[0x00 / 4]); expamem_write(0x04, ac[0x04 / 4]); @@ -1644,29 +1213,11 @@ static bool fastmem_autoconfig(struct uae_prefs *p, struct autoconfig_info *aci, expamem_write(0x20, ac[0x20 / 4]); /* ser.no. Byte 2 */ expamem_write(0x24, ac[0x24 / 4]); /* ser.no. Byte 3 */ - expamem_write(0x28, 0x00); /* ROM-Offset hi */ - expamem_write(0x2c, 0x00); /* ROM-Offset lo */ + expamem_write (0x28, 0x00); /* ROM-Offset hi */ + expamem_write (0x2c, 0x00); /* ROM-Offset lo */ - expamem_write(0x40, 0x00); /* Ctrl/Statusreg.*/ + expamem_write (0x40, 0x00); /* Ctrl/Statusreg.*/ - if (rb && rb->manual_config) { - aci->start = rb->start_address; - aci->size = rb->end_address - rb->start_address + 1; - memcpy(&aci->autoconfig_bytes, ac, sizeof ac); - return false; - } - - return true; -} - -static const uae_u8 a2630_autoconfig[] = { 0xe7, 0x51, 0x40, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static bool megachipram_init(struct autoconfig_info *aci) -{ - aci->zorro = 0; - aci->start = 0x10000000; - aci->size = aci->prefs->z3chipmem_size; - aci->label = _T("32-bit Chip RAM"); return true; } @@ -1680,7 +1231,7 @@ static bool expamem_init_fastcard_2(struct autoconfig_info *aci, int zorro) aci->label = zorro == 1 ? _T("Z1 Fast RAM") : _T("Z2 Fast RAM"); aci->zorro = zorro; - expamem_init_clear(); + expamem_init_clear (); if (size == 65536) type |= Z2_MEM_64KB; else if (size == 131072) @@ -1698,39 +1249,14 @@ static bool expamem_init_fastcard_2(struct autoconfig_info *aci, int zorro) else if (size == 0x800000) type |= Z2_MEM_8MB; - aci->Addrbank = bank; - aci->write_bank_address = p->fastmem[aci->devnum].write_address; - -#ifndef AMIBERRY - if (aci->devnum == 0) { - if (ISCPUBOARDP(p, BOARD_COMMODORE, BOARD_COMMODORE_SUB_A26x0)) { - expamem_write(1 * 4, p->cpu_model <= 68020 ? 0x50 : 0x51); - for (int i = 2; i < 16; i++) - expamem_write(i * 4, a2630_autoconfig[i]); - type &= 7; - type |= a2630_autoconfig[0] & ~7; - expamem_write(0, type); - memcpy(aci->autoconfig_raw, expamem, sizeof aci->autoconfig_raw); - return true; - } - } -#endif + aci->addrbankp = bank; if (!fastmem_autoconfig(p, aci, BOARD_AUTOCONFIG_Z2, type, 1, size)) { aci->zorro = -1; } - if (expamem_write_space[0] != 0x00 && expamem_write_space[0] != 0xff && aci->write_bank_address) { - memcpy(expamem, expamem_write_space, 65536); - memcpy(bank->baseaddr, expamem_write_space, 65536); - } - memcpy(aci->autoconfig_raw, expamem, sizeof aci->autoconfig_raw); - if (p->fastmem[aci->devnum].no_reset_unmap && bank->allocated_size) { - map_banks_z2(bank, bank->start >> 16, size >> 16); - } - return true; } @@ -1743,11 +1269,6 @@ static bool expamem_init_fastcard_z1(struct autoconfig_info *aci) return expamem_init_fastcard_2(aci, 1); } -bool expansion_is_next_board_fastram(void) -{ - return ecard + 1 < MAX_EXPANSION_BOARD_SPACE && cards[ecard + 1] && cards[ecard + 1]->map == expamem_map_fastcard; -} - /* ********************************************************** */ #ifdef FILESYS @@ -1756,14 +1277,14 @@ static bool expamem_rtarea_init(struct autoconfig_info *aci) { aci->start = rtarea_base; aci->size = 65536; - aci->Addrbank = &rtarea_bank; + aci->addrbankp = &rtarea_bank; aci->label = _T("UAE Boot ROM"); return true; } -/* -* Filesystem device -*/ +/* + * Filesystem device + */ static void expamem_map_filesys_update(void) { @@ -1774,23 +1295,15 @@ static void expamem_map_filesys_update(void) org(a); } -static addrbank *expamem_map_filesys(struct autoconfig_info *aci) +static addrbank *expamem_map_filesys (struct autoconfig_info *aci) { - // Warn if PPC doing autoconfig and UAE expansion enabled - static bool warned; - if (!warned && regs.halted < 0) { - warned = true; - // can't show dialogs from PPC thread, deadlock danger. - regs.halted = -2; - } mapped_free(&filesys_bank); filesys_bank.start = expamem_board_pointer; filesys_bank.mask = filesys_bank.reserved_size - 1; if (expamem_board_pointer == 0xffffffff) return &filesys_bank; mapped_malloc(&filesys_bank); - memcpy(filesys_bank.baseaddr, expamem, 0x3000); - uaeboard_ram_start = UAEBOARD_WRITEOFFSET; + memcpy (filesys_bank.baseaddr, expamem, 0x3000); map_banks_z2(&filesys_bank, filesys_bank.start >> 16, 1); expamem_map_filesys_update(); return &filesys_bank; @@ -1833,70 +1346,66 @@ static void add_ks12_boot_hack(void) static bool expamem_init_filesys(struct autoconfig_info *aci) { bool ks12 = ks12orolder(); - bool hide = currprefs.uae_hide_autoconfig; if (aci) { aci->label = ks12 ? _T("Pre-KS 1.3 UAE FS ROM") : _T("UAE FS ROM"); aci->get_params = get_params_filesys; aci->set_params = set_params_filesys; - aci->Addrbank = &filesys_bank; + aci->addrbankp = &filesys_bank; } -#if 0 - FILE *f = fopen("d:\\amiga\\amiga\\source\\acap\\autoconf", "rb"); - fread(expamem, 1, 256, f); - fclose(f); - memcpy(filesys_bank.baseaddr, expamem, 0x3000); - return NULL; -#endif - - /* struct DiagArea - the size has to be large enough to store several device ROMTags */ + /* struct DiagArea - the size has to be large enough to store several device ROMTags */ const uae_u8 diagarea[] = { 0x90, 0x00, /* da_Config, da_Flags */ - 0x02, 0x00, /* da_Size */ + 0x02, 0x00, /* da_Size */ FILESYS_DIAGPOINT >> 8, FILESYS_DIAGPOINT & 0xff, FILESYS_BOOTPOINT >> 8, FILESYS_BOOTPOINT & 0xff, - 0, (uae_u8)(hide ? 0 : 14), // Name offset + 0, (uae_u8)(14), // Name offset 0, 0, 0, 0, - (uae_u8)(hide ? 0 : 'U'), (uae_u8)(hide ? 0 : 'A'), (uae_u8)(hide ? 0 : 'E'), 0 - }; + (uae_u8)('U'), (uae_u8)('A'), (uae_u8)('E'), 0 + }; - expamem_init_clear(); - expamem_write(0x00, Z2_MEM_64KB | zorroII | (ks12 || !do_mount ? 0 : rom_card)); + expamem_init_clear(); + expamem_write (0x00, Z2_MEM_64KB | zorroII | (ks12 || !do_mount ? 0 : rom_card)); - expamem_write(0x08, no_shutup); + expamem_write (0x08, no_shutup); - expamem_write(0x04, currprefs.maprom && !currprefs.cpuboard_type ? 2 : 82); - expamem_write(0x10, uae_id >> 8); - expamem_write(0x14, uae_id & 0xff); + expamem_write (0x04, 82); + expamem_write (0x10, uae_id >> 8); + expamem_write (0x14, uae_id & 0xff); - expamem_write(0x18, 0x00); /* ser.no. Byte 0 */ - expamem_write(0x1c, 0x00); /* ser.no. Byte 1 */ - expamem_write(0x20, 0x00); /* ser.no. Byte 2 */ - expamem_write(0x24, 0x01); /* ser.no. Byte 3 */ + expamem_write (0x18, 0x00); /* ser.no. Byte 0 */ + expamem_write (0x1c, 0x00); /* ser.no. Byte 1 */ + expamem_write (0x20, 0x00); /* ser.no. Byte 2 */ + expamem_write (0x24, 0x01); /* ser.no. Byte 3 */ - /* er_InitDiagVec */ - expamem_write(0x28, 0x20); /* ROM-Offset hi */ - expamem_write(0x2c, 0x00); /* ROM-Offset lo */ + /* er_InitDiagVec */ + expamem_write (0x28, 0x20); /* ROM-Offset hi */ + expamem_write (0x2c, 0x00); /* ROM-Offset lo */ - expamem_write(0x40, 0x00); /* Ctrl/Statusreg.*/ + expamem_write (0x40, 0x00); /* Ctrl/Statusreg.*/ if (aci && !aci->doinit) { memcpy(aci->autoconfig_raw, expamem, sizeof aci->autoconfig_raw); return true; } - /* Build a DiagArea */ - memcpy(expamem + FILESYS_DIAGAREA, diagarea, sizeof diagarea); + /* Build a DiagArea */ + memcpy (expamem + FILESYS_DIAGAREA, diagarea, sizeof diagarea); - /* Call DiagEntry */ - put_word_host(expamem + FILESYS_DIAGAREA + FILESYS_DIAGPOINT, 0x4EF9); /* JMP */ - put_long_host(expamem + FILESYS_DIAGAREA + FILESYS_DIAGPOINT + 2, ROM_filesys_diagentry); + put_word_host(expamem + FILESYS_DIAGAREA + FILESYS_DIAGPOINT + 0, + 0x7000 | 2); // MOVEQ #x,D0 + /* Call hwtrap_install */ + put_word_host(expamem + FILESYS_DIAGAREA + FILESYS_DIAGPOINT + 2, 0x4EB9); /* JSR */ + put_long_host(expamem + FILESYS_DIAGAREA + FILESYS_DIAGPOINT + 4, filesys_get_entry(9)); + /* Call DiagEntry */ + put_word_host(expamem + FILESYS_DIAGAREA + FILESYS_DIAGPOINT + 8, 0x4EF9); /* JMP */ + put_long_host(expamem + FILESYS_DIAGAREA + FILESYS_DIAGPOINT + 10, ROM_filesys_diagentry); - /* What comes next is a plain bootblock */ + /* What comes next is a plain bootblock */ put_word_host(expamem + FILESYS_DIAGAREA + FILESYS_BOOTPOINT, 0x4EF9); /* JMP */ put_long_host(expamem + FILESYS_DIAGAREA + FILESYS_BOOTPOINT + 2, EXPANSION_bootcode); - + if (ks12) add_ks12_boot_hack(); @@ -1906,10 +1415,10 @@ static bool expamem_init_filesys(struct autoconfig_info *aci) #endif /* -* Zorro III expansion memory -*/ + * Zorro III expansion memory + */ -static addrbank *expamem_map_z3fastmem(struct autoconfig_info *aci) +static addrbank *expamem_map_z3fastmem (struct autoconfig_info *aci) { int devnum = aci->devnum; addrbank *ab = &z3fastmem_bank[devnum]; @@ -1924,7 +1433,7 @@ static addrbank *expamem_map_z3fastmem(struct autoconfig_info *aci) static bool expamem_init_z3fastmem(struct autoconfig_info *aci) { addrbank *bank = &z3fastmem_bank[aci->devnum]; - + uae_u32 size = aci->prefs->z3fastmem[aci->devnum].size; aci->label = _T("Z3 Fast RAM"); @@ -1944,29 +1453,30 @@ static bool expamem_init_z3fastmem(struct autoconfig_info *aci) if (size < 0x1000000) code = Z3_MEM_16MB; /* Z3 physical board size is always at least 16M */ - expamem_init_clear(); - fastmem_autoconfig(aci->prefs, aci, BOARD_AUTOCONFIG_Z3, add_memory | zorroIII | code, 1, size); + expamem_init_clear(); + if (!fastmem_autoconfig(aci->prefs, aci, BOARD_AUTOCONFIG_Z3, add_memory | zorroIII | code, 1, size)) + aci->zorro = -1; memcpy(aci->autoconfig_raw, expamem, sizeof aci->autoconfig_raw); - aci->Addrbank = bank; + aci->addrbankp = bank; if (!aci->doinit) return true; uae_u32 start = bank->start; - bool alwaysmapz3 = aci->prefs->z3_mapping_mode != Z3MAPPING_REAL || aci->prefs->z3fastmem[aci->devnum].no_reset_unmap; + bool alwaysmapz3 = aci->prefs->z3_mapping_mode != Z3MAPPING_REAL; if ((alwaysmapz3 || expamem_z3hack(aci->prefs)) && bank->allocated_size) { - map_banks_z3(bank, start >> 16, size >> 16); - } + map_banks_z3(bank, start >> 16, size >> 16); + } return true; } #ifdef PICASSO96 /* -* Fake Graphics Card (ZORRO III) - BDK -*/ + * Fake Graphics Card (ZORRO III) - BDK + */ -static addrbank *expamem_map_gfxcard_z3(struct autoconfig_info *aci) +static addrbank *expamem_map_gfxcard_z3 (struct autoconfig_info *aci) { int devnum = aci->devnum; gfxmem_banks[devnum]->start = expamem_board_pointer; @@ -1974,7 +1484,7 @@ static addrbank *expamem_map_gfxcard_z3(struct autoconfig_info *aci) return gfxmem_banks[devnum]; } -static addrbank *expamem_map_gfxcard_z2(struct autoconfig_info *aci) +static addrbank *expamem_map_gfxcard_z2 (struct autoconfig_info *aci) { int devnum = aci->devnum; gfxmem_banks[devnum]->start = expamem_board_pointer; @@ -1982,27 +1492,27 @@ static addrbank *expamem_map_gfxcard_z2(struct autoconfig_info *aci) return gfxmem_banks[devnum]; } -static bool expamem_init_gfxcard(struct autoconfig_info *aci, bool z3) +static bool expamem_init_gfxcard (struct autoconfig_info *aci, bool z3) { int devnum = aci->devnum; struct uae_prefs *p = aci->prefs; int size = p->rtgboards[devnum].rtgmem_size; - int code = (size == 0x100000 ? Z2_MEM_1MB - : size == 0x200000 ? Z2_MEM_2MB - : size == 0x400000 ? Z2_MEM_4MB - : size == 0x800000 ? Z2_MEM_8MB - : size == 0x1000000 ? Z3_MEM_16MB - : size == 0x2000000 ? Z3_MEM_32MB - : size == 0x4000000 ? Z3_MEM_64MB - : size == 0x8000000 ? Z3_MEM_128MB - : size == 0x10000000 ? Z3_MEM_256MB - : size == 0x20000000 ? Z3_MEM_512MB - : Z3_MEM_1GB); - int subsize = (size == 0x100000 ? Z3_SS_MEM_1MB - : size == 0x200000 ? Z3_SS_MEM_2MB - : size == 0x400000 ? Z3_SS_MEM_4MB - : size == 0x800000 ? Z3_SS_MEM_8MB - : Z3_SS_MEM_SAME); + int code = (size == 0x100000 ? Z2_MEM_1MB + : size == 0x200000 ? Z2_MEM_2MB + : size == 0x400000 ? Z2_MEM_4MB + : size == 0x800000 ? Z2_MEM_8MB + : size == 0x1000000 ? Z3_MEM_16MB + : size == 0x2000000 ? Z3_MEM_32MB + : size == 0x4000000 ? Z3_MEM_64MB + : size == 0x8000000 ? Z3_MEM_128MB + : size == 0x10000000 ? Z3_MEM_256MB + : size == 0x20000000 ? Z3_MEM_512MB + : Z3_MEM_1GB); + int subsize = (size == 0x100000 ? Z3_SS_MEM_1MB + : size == 0x200000 ? Z3_SS_MEM_2MB + : size == 0x400000 ? Z3_SS_MEM_4MB + : size == 0x800000 ? Z3_SS_MEM_8MB + : Z3_SS_MEM_SAME); aci->label = _T("UAE RTG"); aci->direct_vram = true; @@ -2010,51 +1520,51 @@ static bool expamem_init_gfxcard(struct autoconfig_info *aci, bool z3) if (size < 0x1000000 && z3) code = Z3_MEM_16MB; /* Z3 physical board size is always at least 16M */ - expamem_init_clear(); - expamem_write(0x00, (z3 ? zorroIII : zorroII) | code); + expamem_init_clear(); + expamem_write (0x00, (z3 ? zorroIII : zorroII) | code); - expamem_write(0x08, care_addr | (z3 ? (force_z3 | (size > 0x800000 ? ext_size : subsize)) : 0)); - expamem_write(0x04, 96); + expamem_write (0x08, care_addr | (z3 ? (force_z3 | (size > 0x800000 ? ext_size: subsize)) : 0)); + expamem_write (0x04, 96); - expamem_write(0x10, uae_id >> 8); - expamem_write(0x14, uae_id & 0xff); + expamem_write (0x10, uae_id >> 8); + expamem_write (0x14, uae_id & 0xff); - expamem_write(0x18, 0x00); /* ser.no. Byte 0 */ - expamem_write(0x1c, 0x00); /* ser.no. Byte 1 */ - expamem_write(0x20, 0x00); /* ser.no. Byte 2 */ - expamem_write(0x24, 0x01); /* ser.no. Byte 3 */ + expamem_write (0x18, 0x00); /* ser.no. Byte 0 */ + expamem_write (0x1c, 0x00); /* ser.no. Byte 1 */ + expamem_write (0x20, 0x00); /* ser.no. Byte 2 */ + expamem_write (0x24, 0x01); /* ser.no. Byte 3 */ - expamem_write(0x28, 0x00); /* ROM-Offset hi */ - expamem_write(0x2c, 0x00); /* ROM-Offset lo */ + expamem_write (0x28, 0x00); /* ROM-Offset hi */ + expamem_write (0x2c, 0x00); /* ROM-Offset lo */ - expamem_write(0x40, 0x00); /* Ctrl/Statusreg.*/ + expamem_write (0x40, 0x00); /* Ctrl/Statusreg.*/ memcpy(aci->autoconfig_raw, expamem, sizeof aci->autoconfig_raw); - aci->Addrbank = gfxmem_banks[devnum]; + aci->addrbankp = gfxmem_banks[devnum]; return true; } static bool expamem_init_gfxcard_z3(struct autoconfig_info *aci) { - return expamem_init_gfxcard(aci, true); + return expamem_init_gfxcard (aci, true); } -static bool expamem_init_gfxcard_z2(struct autoconfig_info *aci) +static bool expamem_init_gfxcard_z2 (struct autoconfig_info *aci) { - return expamem_init_gfxcard(aci, false); + return expamem_init_gfxcard (aci, false); } #endif #ifdef SAVESTATE static size_t fast_filepos[MAX_RAM_BOARDS], z3_filepos[MAX_RAM_BOARDS]; -static size_t z3_fileposchip, p96_filepos; +static size_t p96_filepos; #endif -void free_fastmemory(int boardnum) +void free_fastmemory (int boardnum) { - mapped_free(&fastmem_bank[boardnum]); + mapped_free (&fastmem_bank[boardnum]); } -static bool mapped_malloc_dynamic(uae_u32 *currpsize, uae_u32 *changedpsize, addrbank *bank, int max, const TCHAR *label) +static bool mapped_malloc_dynamic (uae_u32 *currpsize, uae_u32 *changedpsize, addrbank *bank, int max, const TCHAR *label) { int alloc = *currpsize; @@ -2068,12 +1578,12 @@ static bool mapped_malloc_dynamic(uae_u32 *currpsize, uae_u32 *changedpsize, add bank->mask = alloc - 1; bank->label = label ? label : _T("*"); - if (mapped_malloc(bank)) { + if (mapped_malloc (bank)) { *currpsize = alloc; *changedpsize = alloc; return true; } - write_log(_T("Out of memory for %s, %d bytes.\n"), label ? label : _T("?"), alloc); + write_log (_T("Out of memory for %s, %d bytes.\n"), label ? label : _T("?"), alloc); return false; } @@ -2084,8 +1594,7 @@ uaecptr expansion_startaddress(struct uae_prefs *p, uaecptr addr, uae_u32 size) return addr; if (addr < 0x10000000) { return (addr + size - 1) & ~(size - 1); - } - else { + } else { if (size < 16 * 1024 * 1024) size = 16 * 1024 * 1024; if (!expamem_z3hack(p)) @@ -2094,61 +1603,48 @@ uaecptr expansion_startaddress(struct uae_prefs *p, uaecptr addr, uae_u32 size) return addr; } -static void allocate_expamem(void) +static void allocate_expamem (void) { for (int i = 0; i < MAX_RTG_BOARDS; i++) { memcpy(&currprefs.rtgboards[i], &changed_prefs.rtgboards[i], sizeof(struct rtgboardconfig)); } - currprefs.z3chipmem_size = changed_prefs.z3chipmem_size; for (int i = 0; i < MAX_RAM_BOARDS; i++) { - currprefs.fastmem[i].size = changed_prefs.fastmem[i].size; - currprefs.z3fastmem[i].size = changed_prefs.z3fastmem[i].size; - } - - z3chipmem_bank.start = Z3BASE_UAE; - - if (currprefs.mbresmem_high_size >= 128 * 1024 * 1024) - z3chipmem_bank.start += (currprefs.mbresmem_high_size - 128 * 1024 * 1024) + 16 * 1024 * 1024; - - if (currprefs.z3chipmem_size && z3fastmem_bank[0].start - z3chipmem_bank.start < currprefs.z3chipmem_size) - currprefs.z3chipmem_size = changed_prefs.z3chipmem_size = 0; + currprefs.fastmem[i].size = changed_prefs.fastmem[i].size; + currprefs.z3fastmem[i].size = changed_prefs.z3fastmem[i].size; + } for (int i = 0; i < MAX_RAM_BOARDS; i++) { - if (fastmem_bank[i].reserved_size != currprefs.fastmem[i].size) { - free_fastmemory(i); + if (fastmem_bank[i].reserved_size != currprefs.fastmem[i].size) { + free_fastmemory (i); if (fastmem_bank[i].start == 0xffffffff) { fastmem_bank[i].reserved_size = 0; + } else { + fastmem_bank[i].reserved_size = currprefs.fastmem[i].size; + fastmem_bank[i].mask = fastmem_bank[i].reserved_size - 1; + if (fastmem_bank[i].reserved_size && fastmem_bank[i].start != 0xffffffff) { + mapped_malloc (&fastmem_bank[i]); + if (fastmem_bank[i].baseaddr == 0) { + write_log (_T("Out of memory for fastmem card.\n")); + } + } } - else { - fastmem_bank[i].reserved_size = currprefs.fastmem[i].size; - fastmem_bank[i].mask = fastmem_bank[i].reserved_size - 1; - if (currprefs.fastmem[i].manual_config) { - fastmem_bank[i].start = currprefs.fastmem[i].start_address; - } - if (fastmem_bank[i].reserved_size && fastmem_bank[i].start != 0xffffffff) { - mapped_malloc(&fastmem_bank[i]); - if (fastmem_bank[i].baseaddr == 0) { - write_log(_T("Out of memory for fastmem card.\n")); - } - } - } - memory_hardreset(1); - } - } + memory_hardreset(1); + } + } - if (z3fastmem_bank[0].reserved_size != currprefs.z3fastmem[0].size) { - mapped_free(&z3fastmem_bank[0]); - mapped_malloc_dynamic(&currprefs.z3fastmem[0].size, &changed_prefs.z3fastmem[0].size, &z3fastmem_bank[0], 1, _T("*")); - memory_hardreset(1); + if (z3fastmem_bank[0].reserved_size != currprefs.z3fastmem[0].size) { + mapped_free (&z3fastmem_bank[0]); + mapped_malloc_dynamic (&currprefs.z3fastmem[0].size, &changed_prefs.z3fastmem[0].size, &z3fastmem_bank[0], 1, _T("*")); + memory_hardreset(1); } for (int i = 1; i < MAX_RAM_BOARDS; i++) { if (currprefs.z3fastmem[i].size && z3fastmem_bank[i].start == 0xffffffff) { z3fastmem_bank[i].start = expansion_startaddress(&currprefs, z3fastmem_bank[i - 1].start, currprefs.z3fastmem[i - 1].size); } if (z3fastmem_bank[i].reserved_size != currprefs.z3fastmem[i].size) { - mapped_free(&z3fastmem_bank[i]); + mapped_free (&z3fastmem_bank[i]); z3fastmem_bank[i].reserved_size = currprefs.z3fastmem[i].size; z3fastmem_bank[i].mask = z3fastmem_bank[i].reserved_size - 1; @@ -2156,113 +1652,77 @@ static void allocate_expamem(void) if (z3fastmem_bank[i].reserved_size) { mapped_malloc(&z3fastmem_bank[i]); if (z3fastmem_bank[i].baseaddr == 0) { - write_log(_T("Out of memory for 32 bit fast memory #%d.\n"), i); + write_log (_T("Out of memory for 32 bit fast memory #%d.\n"), i); } } - memory_hardreset(1); + memory_hardreset (1); } - } - if (z3chipmem_bank.reserved_size != currprefs.z3chipmem_size) { - mapped_free(&z3chipmem_bank); - mapped_malloc_dynamic(&currprefs.z3chipmem_size, &changed_prefs.z3chipmem_size, &z3chipmem_bank, 16, _T("*")); - memory_hardreset(1); - } + } #ifdef PICASSO96 struct rtgboardconfig *rbc = &currprefs.rtgboards[0]; if (gfxmem_banks[0]->reserved_size != rbc->rtgmem_size) { - mapped_free(gfxmem_banks[0]); - if (rbc->rtgmem_type < GFXBOARD_HARDWARE) - mapped_malloc_dynamic(&rbc->rtgmem_size, &changed_prefs.rtgboards[0].rtgmem_size, gfxmem_banks[0], 1, NULL); - memory_hardreset(1); - } + mapped_free (gfxmem_banks[0]); + mapped_malloc_dynamic (&rbc->rtgmem_size, &changed_prefs.rtgboards[0].rtgmem_size, gfxmem_banks[0], 1, NULL); + memory_hardreset(1); + } #endif #ifdef SAVESTATE - if (savestate_state == STATE_RESTORE) { + if (savestate_state == STATE_RESTORE) { for (int i = 0; i < MAX_RAM_BOARDS; i++) { - if (fastmem_bank[i].allocated_size > 0) { - restore_ram(fast_filepos[i], fastmem_bank[i].baseaddr); - if (!fastmem_bank[i].start) { - // old statefile compatibility support - fastmem_bank[i].start = 0x00200000; - } - map_banks(&fastmem_bank[i], fastmem_bank[i].start >> 16, currprefs.fastmem[i].size >> 16, - fastmem_bank[i].allocated_size); - } - if (z3fastmem_bank[i].allocated_size > 0) { - restore_ram(z3_filepos[i], z3fastmem_bank[i].baseaddr); - map_banks(&z3fastmem_bank[i], z3fastmem_bank[i].start >> 16, currprefs.z3fastmem[i].size >> 16, - z3fastmem_bank[i].allocated_size); - } - } - if (z3chipmem_bank.allocated_size > 0) { - restore_ram(z3_fileposchip, z3chipmem_bank.baseaddr); - map_banks(&z3chipmem_bank, z3chipmem_bank.start >> 16, currprefs.z3chipmem_size >> 16, - z3chipmem_bank.allocated_size); - } + if (fastmem_bank[i].allocated_size > 0) { + restore_ram (fast_filepos[i], fastmem_bank[i].baseaddr); + if (!fastmem_bank[i].start) { + // old statefile compatibility support + fastmem_bank[i].start = 0x00200000; + } + map_banks (&fastmem_bank[i], fastmem_bank[i].start >> 16, currprefs.fastmem[i].size >> 16, + fastmem_bank[i].allocated_size); + } + if (z3fastmem_bank[i].allocated_size > 0) { + restore_ram (z3_filepos[i], z3fastmem_bank[i].baseaddr); + map_banks (&z3fastmem_bank[i], z3fastmem_bank[i].start >> 16, currprefs.z3fastmem[i].size >> 16, + z3fastmem_bank[i].allocated_size); + } + } #ifdef PICASSO96 if (gfxmem_banks[0]->allocated_size > 0 && gfxmem_banks[0]->start > 0) { - restore_ram(p96_filepos, gfxmem_banks[0]->baseaddr); + restore_ram (p96_filepos, gfxmem_banks[0]->baseaddr); map_banks(gfxmem_banks[0], gfxmem_banks[0]->start >> 16, currprefs.rtgboards[0].rtgmem_size >> 16, gfxmem_banks[0]->allocated_size); - } + } #endif - } + } #endif /* SAVESTATE */ } -static uaecptr check_boot_rom(struct uae_prefs *p, int *boot_rom_type) +static uaecptr check_boot_rom (struct uae_prefs *p, int *boot_rom_type) { - uaecptr b = RTAREA_DEFAULT; - addrbank *ab; + uaecptr b = RTAREA_DEFAULT; + addrbank *ab; - if (p->uaeboard > 1) { - *boot_rom_type = 2; - return uaeboard_bank.start ? uaeboard_bank.start + 0x10000 : 0x00eb0000; - } *boot_rom_type = 0; if (p->boot_rom == 1) return 0; *boot_rom_type = 1; - if (p->cs_cdtvcd || is_device_rom(p, ROMTYPE_CDTVSCSI, 0) >= 0 || p->uae_hide > 1) - b = RTAREA_BACKUP; - if (p->cs_mbdmac == 1 || p->cpuboard_type) - b = RTAREA_BACKUP; -#ifndef AMIBERRY - // CSPPC enables MMU at boot and remaps 0xea0000->0xeffff. - if (ISCPUBOARDP(p, BOARD_BLIZZARD, BOARD_BLIZZARD_SUB_PPC)) - b = RTAREA_BACKUP_2; -#endif - ab = &get_mem_bank(RTAREA_DEFAULT); - if (ab) { - if (valid_address(RTAREA_DEFAULT, 65536)) - b = RTAREA_BACKUP; - } - if (nr_directory_units(NULL)) - return b; - if (nr_directory_units(p)) - return b; + ab = &get_mem_bank (RTAREA_DEFAULT); + if (ab) { + if (valid_address (RTAREA_DEFAULT, 65536)) + b = RTAREA_BACKUP; + } + if (nr_directory_units (NULL)) + return b; + if (nr_directory_units (p)) + return b; if (p->socket_emu) return b; - if (p->uaeserial) - return b; - if (p->scsi == 1) - return b; - if (p->sana2) - return b; if (p->input_tablet > 0) + return b; + if (p->rtgboards[0].rtgmem_size) return b; - if (p->rtgboards[0].rtgmem_size && p->rtgboards[0].rtgmem_type < GFXBOARD_HARDWARE) - return b; -#ifndef AMIBERRY - if (p->win32_automount_removable) - return b; -#endif if (p->chipmem_size > 2 * 1024 * 1024) - return b; - if (p->z3chipmem_size) - return b; + return b; if (p->boot_rom >= 3) return b; if (p->boot_rom == 2 && b == 0xf00000) { @@ -2270,62 +1730,20 @@ static uaecptr check_boot_rom(struct uae_prefs *p, int *boot_rom_type) return b; } *boot_rom_type = 0; - return 0; + return 0; } -uaecptr need_uae_boot_rom(struct uae_prefs *p) +uaecptr need_uae_boot_rom (struct uae_prefs *p) { - uaecptr v; + uaecptr v; - uae_boot_rom_type = 0; - v = check_boot_rom(p, &uae_boot_rom_type); - if (!rtarea_base) { - uae_boot_rom_type = 0; - v = 0; - } - return v; -} - -static void add_cpu_expansions(struct uae_prefs *p, int zorro, int *fastmem_nump) -{ - int fastmem_num = MAX_RAM_BOARDS; - if (fastmem_nump) - fastmem_num = *fastmem_nump; - - const struct cpuboardsubtype *cst = &cpuboards[p->cpuboard_type].subtypes[p->cpuboard_subtype]; - if (cst->init && cst->initzorro == zorro) { - int idx; - struct boardromconfig *brc = get_device_rom(p, ROMTYPE_CPUBOARD, 0, &idx); - if (brc) { - struct romconfig *rc = &brc->roms[idx]; - cards_set[cardno].flags = cst->initflag; - cards_set[cardno].name = cst->name; - cards_set[cardno].initrc = cst->init; - cards_set[cardno].rc = rc; - cards_set[cardno].zorro = zorro; - cards_set[cardno].cst = cst; - cards_set[cardno++].map = NULL; - if (cst->init2) { - cards_set[cardno].flags = cst->initflag | CARD_FLAG_CHILD; - cards_set[cardno].name = cst->name; - cards_set[cardno].initrc = cst->init2; - cards_set[cardno].zorro = zorro; - cards_set[cardno].cst = cst; - cards_set[cardno++].map = NULL; - } - if (fastmem_num < MAX_RAM_BOARDS && zorro == 2 && cst->memory_mid && p->fastmem[fastmem_num].size) { - cards_set[cardno].flags = (fastmem_num << 16) | CARD_FLAG_CHILD; - cards_set[cardno].name = _T("Z2Fast"); - cards_set[cardno].initnum = expamem_init_fastcard; - cards_set[cardno].zorro = zorro; - cards_set[cardno].cst = cst; - cards_set[cardno++].map = expamem_map_fastcard; - fastmem_num++; - } - } - } - if (fastmem_nump) - *fastmem_nump = fastmem_num; + uae_boot_rom_type = 0; + v = check_boot_rom (p, &uae_boot_rom_type); + if (!rtarea_base) { + uae_boot_rom_type = 0; + v = 0; + } + return v; } static void add_expansions(struct uae_prefs *p, int zorro, int *fastmem_nump, int mode) @@ -2339,81 +1757,15 @@ static void add_expansions(struct uae_prefs *p, int zorro, int *fastmem_nump, in for (int j = 0; j < MAX_DUPLICATE_EXPANSION_BOARDS; j++) { struct romconfig *rc = get_device_romconfig(p, ert->romtype, j); if (rc) { - int mid = ert->memory_mid; - bool memory_after = ert->memory_after; - bool added = false; - if (ert->subtypes) { - const struct expansionsubromtype *srt = &ert->subtypes[rc->subtype]; - mid = srt->memory_mid; - memory_after = srt->memory_after; - } - - if (mode == 1 && ert->memory_mid) + if (mode == 2) continue; - if (mode == 2 && !ert->memory_mid) - continue; - if (fastmem_num < MAX_RAM_BOARDS && zorro == 2 && mid && !memory_after && p->fastmem[fastmem_num].size) { - cards_set[cardno].flags = (fastmem_num << 16); - cards_set[cardno].name = _T("Z2Fast"); - cards_set[cardno].initnum = expamem_init_fastcard; - cards_set[cardno].zorro = zorro; - cards_set[cardno].ert = ert; - cards_set[cardno++].map = expamem_map_fastcard; - fastmem_num++; - added = true; - } - if (fastmem_num < MAX_RAM_BOARDS && zorro == 3 && mid && !memory_after && p->z3fastmem[fastmem_num].size) { - cards_set[cardno].flags = CARD_FLAG_CAN_Z3 | (fastmem_num << 16); - cards_set[cardno].name = _T("Z3Fast"); - cards_set[cardno].initnum = expamem_init_z3fastmem; - cards_set[cardno].zorro = zorro; - cards_set[cardno].ert = ert; - cards_set[cardno++].map = expamem_map_z3fastmem; - fastmem_num++; - added = true; - } - cards_set[cardno].flags = added ? CARD_FLAG_CHILD : 0; + cards_set[cardno].flags = 0; cards_set[cardno].name = ert->name; cards_set[cardno].initrc = ert->init; cards_set[cardno].rc = rc; cards_set[cardno].zorro = zorro; cards_set[cardno].ert = ert; cards_set[cardno++].map = NULL; - if (ert->init2) { - cards_set[cardno].flags = CARD_FLAG_CHILD; - cards_set[cardno].name = ert->name; - cards_set[cardno].initrc = ert->init2; - cards_set[cardno].rc = rc; - cards_set[cardno].zorro = zorro; - cards_set[cardno++].map = NULL; - } - if (fastmem_num < MAX_RAM_BOARDS && zorro == 1 && mid && p->fastmem[fastmem_num].size) { - cards_set[cardno].flags = (fastmem_num << 16) | CARD_FLAG_CHILD; - cards_set[cardno].name = _T("Z1Fast"); - cards_set[cardno].initnum = expamem_init_fastcard_z1; - cards_set[cardno].zorro = zorro; - cards_set[cardno].ert = ert; - cards_set[cardno++].map = NULL; - fastmem_num++; - } - if (fastmem_num < MAX_RAM_BOARDS && zorro == 2 && mid && memory_after && p->fastmem[fastmem_num].size) { - cards_set[cardno].flags = (fastmem_num << 16) | CARD_FLAG_CHILD; - cards_set[cardno].name = _T("Z2Fast"); - cards_set[cardno].initnum = expamem_init_fastcard; - cards_set[cardno].zorro = zorro; - cards_set[cardno].ert = ert; - cards_set[cardno++].map = expamem_map_fastcard; - fastmem_num++; - } - if (fastmem_num < MAX_RAM_BOARDS && zorro == 3 && mid && memory_after && p->z3fastmem[fastmem_num].size) { - cards_set[cardno].flags = CARD_FLAG_CAN_Z3 | (fastmem_num << 16) | CARD_FLAG_CHILD; - cards_set[cardno].name = _T("Z3Fast"); - cards_set[cardno].initnum = expamem_init_z3fastmem; - cards_set[cardno].zorro = zorro; - cards_set[cardno].ert = ert; - cards_set[cardno++].map = expamem_map_z3fastmem; - fastmem_num++; - } } } } @@ -2422,21 +1774,6 @@ static void add_expansions(struct uae_prefs *p, int zorro, int *fastmem_nump, in *fastmem_nump = fastmem_num; } -uae_u32 expansion_board_size(addrbank *ab) -{ - uae_u32 size = 0; - uae_u8 code = (ab->bget(0) & 0xf0) | ((ab->bget(2) & 0xf0) >> 4); - if ((code & 0xc0) == zorroII) { - // Z2 - code &= 7; - if (code == 0) - size = 8 * 1024 * 1024; - else - size = 32768 << code; - } - return size; -} - static uae_u8 autoconfig_read(const uae_u8 *autoconfig, int offset) { uae_u8 b = (autoconfig[offset] & 0xf0) | (autoconfig[offset + 2] >> 4); @@ -2496,8 +1833,7 @@ static void expansion_parse_autoconfig(struct card_data *cd, const uae_u8 *autoc break; } - } - else if ((code & 0xc0) == zorroIII) { + } else if ((code & 0xc0) == zorroIII) { // Z3 cd->zorro = 3; @@ -2515,8 +1851,7 @@ static void expansion_parse_autoconfig(struct card_data *cd, const uae_u8 *autoc expamem_board_pointer = expamem_z3hack(cd->aci.prefs) ? expamem_z3_pointer_uae : expamem_z3_pointer_real; expamem_board_size = expamem_z3_size; - } - else if ((code & 0xc0) == 0x40) { + } else if ((code & 0xc0) == 0x40) { cd->zorro = 1; // 0x40 = "Box without init/diagnostic code" // proto autoconfig "box" size. @@ -2544,7 +1879,6 @@ static void reset_ac_data(struct uae_prefs *p) if (p->mbresmem_high_size >= 128 * 1024 * 1024) expamem_z3_pointer_uae += (p->mbresmem_high_size - 128 * 1024 * 1024) + 16 * 1024 * 1024; - expamem_z3_pointer_uae += p->z3chipmem_size; expamem_board_pointer = 0; expamem_board_size = 0; memset(slots_20, 0, sizeof slots_20); @@ -2557,25 +1891,22 @@ static void reset_ac(struct uae_prefs *p) do_mount = 1; if (need_uae_boot_rom(p) == 0) - do_mount = 0; + do_mount = 0; if (uae_boot_rom_type <= 0) do_mount = 0; - /* check if Kickstart version is below 1.3 */ - if (ks12orolder() && do_mount && p->uaeboard < 2) { - /* warn user */ + /* check if Kickstart version is below 1.3 */ + if (ks12orolder() && do_mount) { + /* warn user */ #if KS12_BOOT_HACK do_mount = -1; #else - write_log(_T("Kickstart version is below 1.3! Disabling automount devices.\n")); - do_mount = 0; + write_log (_T("Kickstart version is below 1.3! Disabling automount devices.\n")); + do_mount = 0; #endif - } + } - if (p->uae_hide) - uae_id = commodore; - else - uae_id = hackers_id; + uae_id = hackers_id; for (int i = 0; i < MAX_EXPANSION_BOARD_SPACE; i++) { memset(&cards_set[i], 0, sizeof(struct card_data)); @@ -2592,21 +1923,6 @@ void expansion_generate_autoconfig_info(struct uae_prefs *p) expansion_scan_autoconfig(p, true); } -bool alloc_expansion_bank(addrbank *bank, struct autoconfig_info *aci) -{ - bank->start = aci->start; - bank->reserved_size = aci->size; - aci->Addrbank = bank; - return mapped_malloc(bank); -} - -void free_expansion_bank(addrbank *bank) -{ - mapped_free(bank); - bank->start = NULL; - bank->reserved_size = 0; -} - struct autoconfig_info *expansion_get_autoconfig_data(struct uae_prefs *p, int index) { if (index >= cardno) @@ -2625,7 +1941,7 @@ struct autoconfig_info *expansion_get_autoconfig_by_address(struct uae_prefs *p, return NULL; } -struct autoconfig_info *expansion_get_autoconfig_info(struct uae_prefs *p, int romtype, int devnum) +struct autoconfig_info *expansion_get_autoconfig_info(struct uae_prefs *p,int romtype, int devnum) { for (int i = 0; i < cardno; i++) { struct card_data *cd = cards[i]; @@ -2633,12 +1949,7 @@ struct autoconfig_info *expansion_get_autoconfig_info(struct uae_prefs *p, int r if (cd->rc->back->device_type == romtype && cd->rc->back->device_num == devnum) { return &cd->aci; } - } - else if (cd->cst) { - if ((romtype & ROMTYPE_CPUBOARD) && (cd->cst->romtype & ROMTYPE_CPUBOARD)) - return &cd->aci; - } - else { + } else { // z2 and z3 ram boards are "fake" if ((romtype == ROMTYPE_RAMZ2 && !_tcsicmp(cd->name, _T("Z2Fast"))) || (romtype == ROMTYPE_RAMZ3 && !_tcsicmp(cd->name, _T("Z3Fast"))) @@ -2666,20 +1977,16 @@ static void expansion_init_cards(struct uae_prefs *p) aci->devnum = (cd->flags >> 16) & 255; aci->prefs = p; aci->ert = cd->ert; - aci->cst = cd->cst; aci->start = 0xffffffff; aci->zorro = cd->zorro; if (cd->initnum) { ok = cd->initnum(aci); - } - else { + } else { aci->rc = cd->rc; ok = cd->initrc(aci); } - if (cd->flags & CARD_FLAG_CHILD) - aci->parent_of_previous = true; - - if ((aci->zorro == 1 || aci->zorro == 2 || aci->zorro == 3) && aci->Addrbank != &expamem_null && aci->Addrbank != &expamem_none && (aci->autoconfig_raw[0] != 0xff || aci->autoconfigp)) { + + if ((aci->zorro == 1 || aci->zorro == 2 || aci->zorro == 3) && (aci->autoconfig_raw[0] != 0xff || aci->autoconfigp)) { uae_u8 ac2[16]; const uae_u8 *a = aci->autoconfigp; if (!a) { @@ -2730,10 +2037,6 @@ static int get_order(struct uae_prefs *p, struct card_data *cd) { if (!cd) return EXPANSION_ORDER_MAX - 1; - if (cd->cst) - return -4; // Accelerator must be always first - if (cd->aci.hardwired) - return -3; if (cd->aci.get_params) { struct expansion_params parms; if (cd->aci.get_params(p, &parms)) @@ -2757,19 +2060,6 @@ static int get_order(struct uae_prefs *p, struct card_data *cd) return EXPANSION_ORDER_MAX - 1; } -bool expansion_can_move(struct uae_prefs *p, int index) -{ - if (index < 0 || index >= cardno) - return false; - struct card_data *cd = cards[index]; - if (cd->aci.parent_of_previous) - return false; - int order1 = get_order(p, cd); - if (order1 < 0 || order1 >= EXPANSION_ORDER_MAX - 1) - return false; - return true; -} - static void expansion_parse_cards(struct uae_prefs *p, bool log) { if (log) @@ -2786,13 +2076,11 @@ static void expansion_parse_cards(struct uae_prefs *p, bool log) aci->devnum = (cd->flags >> 16) & 255; aci->prefs = p; aci->ert = cd->ert; - aci->cst = cd->cst; aci->zorro = cd->zorro; aci->start = 0xffffffff; if (cd->initnum) { ok = cd->initnum(aci); - } - else { + } else { aci->rc = cd->rc; ok = cd->initrc(aci); } @@ -2806,22 +2094,6 @@ static void expansion_parse_cards(struct uae_prefs *p, bool log) if (ok) { TCHAR label[MAX_DPATH]; label[0] = 0; - if (aci->cst && !label[0]) { -#if 0 - const TCHAR *man = NULL; - for (int i = 0; cpuboards[i].name && man == NULL; i++) { - const struct cpuboardtype *cbt = &cpuboards[i]; - if (cbt->subtypes) { - for (int j = 0; cbt->subtypes[j].name && man == NULL; j++) { - if (&cbt->subtypes[j] == aci->cst) - man = cpuboards[i].name; - } - } - } - _stprintf(label, _T("%s (%s)"), aci->cst->name, man); -#endif - _tcscpy(label, aci->cst->name); - } if (cd->rc && !label[0]) { const struct expansionromtype *ert = get_device_expansion_rom(cd->rc->back->device_type); if (ert) { @@ -2831,11 +2103,9 @@ static void expansion_parse_cards(struct uae_prefs *p, bool log) if (!label[0]) { if (aci->label) { _tcscpy(label, aci->label); - } - else if (aci->Addrbank && aci->Addrbank->label) { - _tcscpy(label, aci->Addrbank->label); - } - else { + } else if (aci->addrbankp && aci->addrbankp->label) { + _tcscpy(label, aci->addrbankp->label); + } else { _tcscpy(label, _T("")); } } @@ -2844,7 +2114,7 @@ static void expansion_parse_cards(struct uae_prefs *p, bool log) _stprintf(s, _T(" [%d]"), aci->devnum + 1); } - if ((aci->zorro == 1 || aci->zorro == 2 || aci->zorro == 3) && aci->Addrbank != &expamem_none && (aci->autoconfig_raw[0] != 0xff || aci->autoconfigp)) { + if ((aci->zorro == 1 || aci->zorro == 2 || aci->zorro == 3) && (aci->autoconfig_raw[0] != 0xff || aci->autoconfigp)) { uae_u8 ac2[16]; const uae_u8 *a = aci->autoconfigp; if (!a) { @@ -2885,16 +2155,15 @@ static void expansion_parse_cards(struct uae_prefs *p, bool log) cd->size = expamem_board_size; if ((type & 0xc0) == zorroIII) { aci->start = expamem_z3hack(p) ? expamem_z3_pointer_uae : expamem_z3_pointer_real; - } - else { + } else { aci->start = expamem_board_pointer; } aci->size = cd->size; memcpy(aci->autoconfig_bytes, a, sizeof aci->autoconfig_bytes); - if (aci->Addrbank) { - aci->Addrbank->start = expamem_board_pointer; - if (aci->Addrbank->reserved_size == 0 && !(type & add_memory) && expamem_board_size < 524288) { - aci->Addrbank->reserved_size = expamem_board_size; + if (aci->addrbankp) { + aci->addrbankp->start = expamem_board_pointer; + if (aci->addrbankp->reserved_size == 0 && !(type & add_memory) && expamem_board_size < 524288) { + aci->addrbankp->reserved_size = expamem_board_size; } } aci->zorro = cd->zorro; @@ -2902,21 +2171,18 @@ static void expansion_parse_cards(struct uae_prefs *p, bool log) if (expamem_z3_pointer_real + expamem_board_size < expamem_z3_pointer_real) { expamem_z3_pointer_real = 0xffffffff; expamem_z3_highram_real = 0xffffffff; - } - else { + } else { expamem_z3_pointer_real += expamem_board_size; } if (expamem_z3_pointer_uae + expamem_board_size < expamem_z3_pointer_uae) { expamem_z3_pointer_uae = 0xffffffff; expamem_z3_highram_uae = 0xffffffff; - } - else { + } else { expamem_z3_pointer_uae += expamem_board_size; } if (expamem_board_pointer + expamem_board_size < expamem_board_pointer) { expamem_board_pointer = 0xffffffff; - } - else { + } else { expamem_board_pointer += expamem_board_size; } if ((type & add_memory) || aci->direct_vram) { @@ -2927,18 +2193,14 @@ static void expansion_parse_cards(struct uae_prefs *p, bool log) } } - } - else { + } else { cd->base = aci->start; cd->size = aci->size; if (log) write_log(_T("'%s' no autoconfig %08x - %08x.\n"), aci->label ? aci->label : _T(""), cd->base, cd->base + cd->size - 1); } _tcscpy(aci->name, label); - if (cd->flags & CARD_FLAG_CHILD) - aci->parent_of_previous = true; - } - else { + } else { if (log) write_log(_T("init failed.\n"), i); } @@ -2947,159 +2209,12 @@ static void expansion_parse_cards(struct uae_prefs *p, bool log) write_log(_T("END\n")); } -int expansion_autoconfig_move(struct uae_prefs *p, int index, int dir, bool test) -{ - if (index < 0 || index >= cardno) - return -1; - if (!dir) - return -1; - struct card_data *cd1 = cards[index]; - int order1 = get_order(p, cd1); - if (order1 < 0 || order1 >= EXPANSION_ORDER_MAX - 1) - return -1; - struct card_data *cd2; - int order2; - for (;;) { - if (index + dir < 0 || index + dir >= cardno) - return -1; - cd2 = cards[index + dir]; - if (cd1->aci.parent_of_previous && !cd2->aci.parent_of_previous) - return -1; - order2 = get_order(p, cd2); - if (order2 >= 0 && order2 < EXPANSION_ORDER_MAX - 1) { - if (!cd1->aci.parent_of_previous && !cd2->aci.parent_of_previous) - break; - } - dir += dir < 0 ? -1 : 1; - } - if (test) { - return 0; - } - set_order(p, cd1, order2); - set_order(p, cd2, order1); - if (p != &currprefs) - expansion_scan_autoconfig(p, false); - for (int i = 0; i < cardno; i++) { - if (cards[i] == cd1) - return i; - } - return -1; -} - -static void expansion_recalc_order(struct uae_prefs *p) -{ - int ordermin = 1; - for (;;) { - int order = EXPANSION_ORDER_MAX; - int idx = -1; - for (int i = 0; i < cardno; i++) { - struct card_data *cdc = cards[i]; - int o = get_order(p, cdc); - if (o >= ordermin && order > o) { - order = o; - idx = i; - } - } - if (idx < 0) - break; - set_order(p, cards[idx], ordermin); - ordermin++; - } -} - -void expansion_set_autoconfig_sort(struct uae_prefs *p) -{ - for (int i = 0; i < cardno; i++) { - set_order(p, cards[i], i + 1); - } - expansion_recalc_order(p); -} - -static bool ischild(struct card_data *cd) -{ - if (cd->aci.parent_name) - return true; - if (cd->aci.parent_address_space) - return true; - if (cd->aci.parent_of_previous) - return true; - if (cd->aci.parent_romtype) - return true; - return false; -} - -static void check_card_child(int index, bool *inuse, int *new_cardnop) -{ - struct card_data *cd = &cards_set[index]; - int new_cardno = *new_cardnop; - // address space "conflict" parent? - for (int i = 0; i < cardno; i++) { - struct card_data *cdc = &cards_set[i]; - if (inuse[i]) - continue; - if (!cdc->aci.parent_address_space) - continue; - if (cd->aci.start && cd->aci.size && cdc->aci.start >= cd->aci.start && cdc->aci.start < cd->aci.start + cd->aci.size) { - cards[new_cardno++] = cdc; - cdc->aci.parent_of_previous = true; - inuse[i] = true; - } - } - // romtype parent? - for (int i = 0; i < cardno; i++) { - struct card_data *cdc = &cards_set[i]; - if (inuse[i]) - continue; - const int *parent = cdc->aci.parent_romtype; - if (!parent) - continue; - for (int j = 0; parent[j]; j++) { - if (cd->rc && parent[j] == (cd->rc->back->device_type & ROMTYPE_MASK)) { - cards[new_cardno++] = cdc; - cdc->aci.parent_of_previous = true; - inuse[i] = true; - } - } - } - // named parent - for (int i = 0; i < cardno; i++) { - struct card_data *cdc = &cards_set[i]; - if (inuse[i]) - continue; - if (cdc->aci.parent_name && cd->name && !_tcsicmp(cdc->aci.parent_name, cd->name)) { - cards[new_cardno++] = cdc; - cdc->aci.parent_of_previous = true; - inuse[i] = true; - } - } - *new_cardnop = new_cardno; -} - static bool add_card_sort(int index, bool *inuse, int *new_cardnop) { struct card_data *cd = &cards_set[index]; - if (ischild(cd)) - return false; int new_cardno = *new_cardnop; cards[new_cardno++] = cd; inuse[index] = true; - int index2 = index + 1; - // any children? - while (index2 < cardno) { - struct card_data *cdc = &cards_set[index2]; - struct autoconfig_info *aci = &cdc->aci; - if (inuse[index2]) - break; - if (!ischild(cdc)) - break; - if (aci->parent_of_previous) { - cards[new_cardno++] = cdc; - inuse[index2] = true; - check_card_child(index2, inuse, &new_cardno); - } - index2++; - } - check_card_child(index, inuse, &new_cardno); *new_cardnop = new_cardno; return true; } @@ -3133,13 +2248,9 @@ static void expansion_autoconfig_sort(struct uae_prefs *p) if (inuse2[i]) continue; struct card_data *cd = &cards_set[i]; - if (ischild(cd)) - continue; if (cd->zorro != z) continue; int order = get_order(p, cd); - if (cd->aci.hardwired) - order = -1; if (order >= 0) continue; if (testorder > order) { @@ -3163,8 +2274,6 @@ static void expansion_autoconfig_sort(struct uae_prefs *p) if (inuse2[i]) continue; struct card_data *cd = &cards_set[i]; - if (ischild(cd)) - continue; if (cd->zorro != z) continue; if (get_order(p, cd) < EXPANSION_ORDER_MAX - 1) @@ -3185,8 +2294,6 @@ static void expansion_autoconfig_sort(struct uae_prefs *p) if (inuse2[i]) continue; struct card_data *cd = &cards_set[i]; - if (ischild(cd)) - continue; if (cd->zorro != z) continue; inuse2[i] = true; @@ -3203,124 +2310,37 @@ static void expansion_autoconfig_sort(struct uae_prefs *p) for (int i = 0; i < cardno; i++) { struct autoconfig_info *aci = &cards[i]->aci; tcards[i] = cards[i]; - tcards[i]->aci.can_sort = !aci->hardwired && !aci->parent_of_previous && get_order(p, cards[i]) < EXPANSION_ORDER_MAX - 1 && get_order(p, cards[i]) >= 0; + tcards[i]->aci.can_sort = get_order(p, cards[i]) < EXPANSION_ORDER_MAX - 1 && get_order(p, cards[i]) >= 0; } - if (!p->autoconfig_custom_sort) { + new_cardno = 0; - new_cardno = 0; - - // accelerator and hardwired first - for (int idx = 0; idx < cardno; idx++) { - struct card_data *cd = tcards[idx]; - if (!cd) - continue; - if (cd->cst || cd->aci.hardwired) { - cards[new_cardno++] = cd; - tcards[idx] = NULL; - for (int j = idx + 1; j < cardno; j++) { - struct card_data *cdc = tcards[j]; - if (!cdc || !ischild(cdc)) - break; - cards[new_cardno++] = cdc; - tcards[j] = NULL; - } - } + // re-sort by board size + for (int idx = 0; idx < cardno; idx++) { + struct card_data *cd = tcards[idx]; + if (!cd) + continue; + int z = cd->zorro; + if (z != 2 && z != 3) { + cards[new_cardno++] = cd; + tcards[idx] = NULL; } - // re-sort by board size - for (int idx = 0; idx < cardno; idx++) { - struct card_data *cd = tcards[idx]; - if (!cd) - continue; - int z = cd->zorro; - if ((z != 2 && z != 3 && !ischild(cd)) || cd->cst) { - cards[new_cardno++] = cd; - tcards[idx] = NULL; - for (int j = idx + 1; j < cardno; j++) { - struct card_data *cdc = tcards[j]; - if (!cdc || !ischild(cdc)) - break; - cards[new_cardno++] = cdc; - tcards[j] = NULL; - } - } - } - for (int z = 2; z <= 3; z++) { - for (;;) { - int idx2 = -1; - uae_u32 size = 0; - for (int j = 0; j < cardno; j++) { - struct card_data *cdc = tcards[j]; - if (cdc && cdc->size > size && cdc->zorro == z && !ischild(cdc)) { - size = cdc->size; - idx2 = j; - } - } - if (idx2 < 0) - break; - cards[new_cardno++] = tcards[idx2]; - tcards[idx2] = NULL; - for (int j = idx2 + 1; j < cardno; j++) { - struct card_data *cdc = tcards[j]; - if (!cdc || !ischild(cdc)) - break; - cards[new_cardno++] = cdc; - tcards[j] = NULL; - } - } - } - } - else { - - // re-sort by configuration data - new_cardno = 0; + for (int z = 2; z <= 3; z++) { for (;;) { - int order = EXPANSION_ORDER_MAX; - int idx = -1; - for (int i = 0; i < cardno; i++) { - struct card_data *cd = tcards[i]; - if (cd && get_order(p, cd) < order && !cd->aci.parent_of_previous) { - order = get_order(p, cd); - idx = i; + int idx2 = -1; + uae_u32 size = 0; + for (int j = 0; j < cardno; j++) { + struct card_data *cdc = tcards[j]; + if (cdc && cdc->size > size && cdc->zorro == z) { + size = cdc->size; + idx2 = j; } } - if (idx >= 0) { - struct card_data *cd = tcards[idx]; - struct autoconfig_info *aci = &cd->aci; - cards[new_cardno++] = cd; - tcards[idx] = NULL; - // sort children, if any - int child = 0; - for (int j = idx + 1; j < cardno; j++) { - struct card_data *cdc = tcards[j]; - if (!cdc || !cdc->aci.parent_of_previous) - break; - child++; - } - for (;;) { - order = EXPANSION_ORDER_MAX; - int cidx = -1; - for (int j = 0; j < child; j++) { - struct card_data *cdc = tcards[j + idx + 1]; - if (cdc && get_order(p, cdc) < order) { - order = get_order(p, cdc); - cidx = j; - } - } - if (cidx < 0) - break; - cards[new_cardno++] = tcards[idx + 1 + cidx]; - tcards[idx + 1 + cidx] = NULL; - } - for (int j = 0; j < child; j++) { - if (tcards[idx + 1 + j]) { - cards[new_cardno++] = tcards[idx + 1 + j]; - } - } - } - if (idx < 0) + if (idx2 < 0) break; + cards[new_cardno++] = tcards[idx2]; + tcards[idx2] = NULL; } } @@ -3338,37 +2358,14 @@ static void expansion_add_autoconfig(struct uae_prefs *p) reset_ac(p); - if (p->cpuboard_type) { - // This may require first 128k slot. - cards_set[cardno].flags = 1; - cards_set[cardno].name = _T("CPUBoard"); -#ifndef AMIBERRY - cards_set[cardno].initrc = cpuboard_autoconfig_init; -#endif - cards_set[cardno].zorro = BOARD_NONAUTOCONFIG_BEFORE; - cards_set[cardno].cst = &cpuboards[p->cpuboard_type].subtypes[p->cpuboard_subtype];; - cards_set[cardno++].map = NULL; - } - - if (p->z3chipmem_size) { - cards_set[cardno].flags = 0; - cards_set[cardno].name = _T("MegaChipRAM"); - cards_set[cardno].initrc = megachipram_init; - cards_set[cardno].zorro = BOARD_NONAUTOCONFIG_BEFORE; - cards_set[cardno++].map = NULL; - } - // add possible non-autoconfig boards - add_cpu_expansions(p, BOARD_NONAUTOCONFIG_BEFORE, NULL); add_expansions(p, BOARD_NONAUTOCONFIG_BEFORE, NULL, 0); fastmem_num = 0; add_expansions(p, BOARD_PROTOAUTOCONFIG, &fastmem_num, 0); - add_cpu_expansions(p, BOARD_AUTOCONFIG_Z2, &fastmem_num); // immediately after Z2Fast so that it can be emulated as A590/A2091 with fast ram. add_expansions(p, BOARD_AUTOCONFIG_Z2, &fastmem_num, 0); - add_cpu_expansions(p, BOARD_NONAUTOCONFIG_AFTER_Z2, NULL); add_expansions(p, BOARD_NONAUTOCONFIG_AFTER_Z2, NULL, 0); while (fastmem_num < MAX_RAM_BOARDS) { @@ -3380,10 +2377,10 @@ static void expansion_add_autoconfig(struct uae_prefs *p) cards_set[cardno++].map = expamem_map_fastcard; } fastmem_num++; - } + } #ifdef FILESYS - if (do_mount && p->uaeboard >= 0 && p->uaeboard < 2) { + if (do_mount && p->uaeboard >= 0) { cards_set[cardno].flags = 0; cards_set[cardno].name = _T("UAEFS"); cards_set[cardno].zorro = 2; @@ -3397,14 +2394,13 @@ static void expansion_add_autoconfig(struct uae_prefs *p) cards_set[cardno].initnum = expamem_init_uaeboard; cards_set[cardno++].map = expamem_map_uaeboard; } - if (do_mount && p->uaeboard < 2) { + if (do_mount) { cards_set[cardno].flags = 0; cards_set[cardno].name = _T("UAEBOOTROM"); cards_set[cardno].zorro = BOARD_NONAUTOCONFIG_BEFORE; cards_set[cardno].initnum = expamem_rtarea_init; cards_set[cardno++].map = NULL; - - } + } #endif #ifdef PICASSO96 for (int i = 0; i < MAX_RTG_BOARDS; i++) { @@ -3416,54 +2412,13 @@ static void expansion_add_autoconfig(struct uae_prefs *p) cards_set[cardno].initnum = expamem_init_gfxcard_z2; cards_set[cardno++].map = expamem_map_gfxcard_z2; } - } -#endif -#ifdef GFXBOARD - for (int i = 0; i < MAX_RTG_BOARDS; i++) { - struct rtgboardconfig *rbc = &p->rtgboards[i]; - if (rbc->rtgmem_size && rbc->rtgmem_type >= GFXBOARD_HARDWARE && gfxboard_get_configtype(rbc) <= 2) { - cards_set[cardno].flags = 4 | (i << 16); - if (gfxboard_get_func(rbc)) { - cards_set[cardno].name = _T("Z2RTG"); - cards_set[cardno].zorro = 2; - cards_set[cardno].flags = (i << 16); - cards_set[cardno++].initnum = gfxboard_init_board; - } - else { - cards_set[cardno].name = _T("Z2RTG"); - cards_set[cardno].zorro = 2; - cards_set[cardno++].initnum = gfxboard_init_memory; - if (gfxboard_num_boards(rbc) == 3) { - cards_set[cardno].flags = (i << 16) | CARD_FLAG_CHILD; - cards_set[cardno].name = _T("Gfxboard VRAM Zorro II Extra"); - cards_set[cardno].zorro = 2; - cards_set[cardno++].initnum = gfxboard_init_memory_p4_z2; - } - if (gfxboard_is_registers(rbc)) { - cards_set[cardno].flags = (i << 16) | CARD_FLAG_CHILD; - cards_set[cardno].name = _T("Gfxboard Registers"); - cards_set[cardno].zorro = 2; - cards_set[cardno++].initnum = gfxboard_init_registers; - } - } - } - } -#endif -#ifndef AMIBERRY - if (p->monitoremu == MONITOREMU_FIRECRACKER24) { - cards_set[cardno].flags = 0; - cards_set[cardno].name = _T("FireCracker24"); - cards_set[cardno].zorro = 2; - cards_set[cardno++].initnum = specialmonitor_autoconfig_init; - } + } #endif /* Z3 boards last */ fastmem_num = 0; - add_cpu_expansions(p, BOARD_AUTOCONFIG_Z3, &fastmem_num); - // add combo Z3 boards (something + Z3 RAM) add_expansions(p, BOARD_AUTOCONFIG_Z3, &fastmem_num, 2); @@ -3487,32 +2442,13 @@ static void expansion_add_autoconfig(struct uae_prefs *p) cards_set[cardno].initnum = expamem_init_gfxcard_z3; cards_set[cardno++].map = expamem_map_gfxcard_z3; } - } -#endif -#ifdef GFXBOARD - for (int i = 0; i < MAX_RTG_BOARDS; i++) { - struct rtgboardconfig *rbc = &p->rtgboards[i]; - if (rbc->rtgmem_size && rbc->rtgmem_type >= GFXBOARD_HARDWARE && gfxboard_get_configtype(rbc) == 3) { - cards_set[cardno].flags = 4 | CARD_FLAG_CAN_Z3 | (i << 16); - cards_set[cardno].name = _T("Z3RTG"); - cards_set[cardno].zorro = 3; - cards_set[cardno++].initnum = gfxboard_init_memory; - if (gfxboard_is_registers(rbc)) { - cards_set[cardno].flags = 1 | (i << 16) | CARD_FLAG_CHILD; - cards_set[cardno].zorro = 3; - cards_set[cardno].name = _T("Gfxboard Registers"); - cards_set[cardno++].initnum = gfxboard_init_registers; - } - } - } + } #endif // add non-memory Z3 boards add_expansions(p, BOARD_AUTOCONFIG_Z3, NULL, 1); - add_cpu_expansions(p, BOARD_NONAUTOCONFIG_AFTER_Z3, NULL); add_expansions(p, BOARD_NONAUTOCONFIG_AFTER_Z3, NULL, 0); - } void expansion_scan_autoconfig(struct uae_prefs *p, bool log) @@ -3524,13 +2460,13 @@ void expansion_scan_autoconfig(struct uae_prefs *p, bool log) expansion_parse_cards(p, log); } -void expamem_reset(void) +void expamem_reset (void) { reset_ac(&currprefs); chipdone = false; - allocate_expamem(); + allocate_expamem (); expamem_bank.name = _T("Autoconfig [reset]"); expansion_add_autoconfig(&currprefs); @@ -3538,21 +2474,21 @@ void expamem_reset(void) expansion_autoconfig_sort(&currprefs); expansion_parse_cards(&currprefs, true); - if (cardno == 0 || savestate_state) - expamem_init_clear_zero(); - else + if (cardno == 0 || savestate_state) + expamem_init_clear_zero (); + else call_card_init(0); } -void expansion_init(void) +void expansion_init (void) { if (savestate_state != STATE_RESTORE) { - for (int i = 0; i < MAX_RAM_BOARDS; i++) { - fastmem_bank[i].reserved_size = 0; + for (int i = 0; i < MAX_RAM_BOARDS; i++) { + fastmem_bank[i].reserved_size = 0; fastmem_bank[i].mask = 0; - fastmem_bank[i].baseaddr = NULL; - } + fastmem_bank[i].baseaddr = NULL; + } #ifdef PICASSO96 for (int i = 0; i < MAX_RTG_BOARDS; i++) { @@ -3562,22 +2498,14 @@ void expansion_init(void) } #endif -#ifdef CATWEASEL - catweasel_mask = catweasel_start = 0; -#endif - for (int i = 0; i < MAX_RAM_BOARDS; i++) { - z3fastmem_bank[i].reserved_size = 0; + z3fastmem_bank[i].reserved_size = 0; z3fastmem_bank[i].mask = 0; - z3fastmem_bank[i].baseaddr = NULL; - } - - z3chipmem_bank.reserved_size = 0; - z3chipmem_bank.mask = z3chipmem_bank.start = 0; - z3chipmem_bank.baseaddr = NULL; - } - - allocate_expamem(); + z3fastmem_bank[i].baseaddr = NULL; + } + } + + allocate_expamem (); if (currprefs.uaeboard) { uaeboard_bank.reserved_size = 0x10000; @@ -3586,57 +2514,31 @@ void expansion_init(void) } -void expansion_cleanup(void) +void expansion_cleanup (void) { for (int i = 0; i < MAX_RAM_BOARDS; i++) { - mapped_free(&fastmem_bank[i]); - mapped_free(&z3fastmem_bank[i]); - } - mapped_free(&z3chipmem_bank); + mapped_free (&fastmem_bank[i]); + mapped_free (&z3fastmem_bank[i]); + } #ifdef PICASSO96 for (int i = 0; i < MAX_RTG_BOARDS; i++) { - if (currprefs.rtgboards[i].rtgmem_type < GFXBOARD_HARDWARE) { - mapped_free(gfxmem_banks[i]); - } + mapped_free (gfxmem_banks[i]); } #endif #ifdef FILESYS - mapped_free(&filesys_bank); + mapped_free (&filesys_bank); #endif if (currprefs.uaeboard) { mapped_free(&uaeboard_bank); } - -#ifdef CATWEASEL - catweasel_free(); -#endif } void expansion_map(void) { map_banks(&expamem_bank, 0xE8, 1, 0); // map non-autoconfig ram boards - for (int i = 0; i < MAX_RAM_BOARDS; i++) { - struct ramboard *rb = &currprefs.fastmem[i]; - if (rb->manual_config) { - map_banks(&fastmem_bank[i], rb->start_address >> 16, (rb->end_address - rb->start_address + 1) >> 16, 0); - } - else if (rb->no_reset_unmap && rb->start_address) { - map_banks(&fastmem_bank[i], rb->start_address >> 16, rb->size >> 16, 0); - } - rb = &currprefs.z3fastmem[i]; - if (rb->manual_config) { - map_banks(&z3fastmem_bank[i], rb->start_address >> 16, (rb->end_address - rb->start_address + 1) >> 16, 0); - } - else if (rb->no_reset_unmap && rb->start_address) { - map_banks(&z3fastmem_bank[i], rb->start_address >> 16, rb->size >> 16, 0); - } - } - if (currprefs.z3chipmem_size) { - map_banks_z3(&z3chipmem_bank, z3chipmem_bank.start >> 16, currprefs.z3chipmem_size >> 16); - } if (do_mount < 0 && ks11orolder()) { filesys_bank.start = 0xe90000; mapped_free(&filesys_bank); @@ -3647,22 +2549,21 @@ void expansion_map(void) } } -static void clear_bank(addrbank *ab) +static void clear_bank (addrbank *ab) { if (!ab->baseaddr || !ab->allocated_size) return; - memset(ab->baseaddr, 0, ab->allocated_size > 0x800000 ? 0x800000 : ab->allocated_size); + memset (ab->baseaddr, 0, ab->allocated_size > 0x800000 ? 0x800000 : ab->allocated_size); } void expansion_clear(void) { for (int i = 0; i < MAX_RAM_BOARDS; i++) { - clear_bank(&fastmem_bank[i]); - clear_bank(&z3fastmem_bank[i]); - } - clear_bank(&z3chipmem_bank); + clear_bank (&fastmem_bank[i]); + clear_bank (&z3fastmem_bank[i]); + } for (int i = 0; i < MAX_RTG_BOARDS; i++) { - clear_bank(gfxmem_banks[i]); + clear_bank (gfxmem_banks[i]); } } @@ -3670,78 +2571,68 @@ void expansion_clear(void) /* State save/restore code. */ -uae_u8 *save_fram(int *len, int num) +uae_u8 *save_fram (int *len, int num) { - *len = fastmem_bank[num].allocated_size; - return fastmem_bank[num].baseaddr; + *len = fastmem_bank[num].allocated_size; + return fastmem_bank[num].baseaddr; } -uae_u8 *save_zram(int *len, int num) +uae_u8 *save_zram (int *len, int num) { - if (num < 0) { - *len = z3chipmem_bank.allocated_size; - return z3chipmem_bank.baseaddr; - } - *len = z3fastmem_bank[num].allocated_size; - return z3fastmem_bank[num].baseaddr; + *len = z3fastmem_bank[num].allocated_size; + return z3fastmem_bank[num].baseaddr; } -uae_u8 *save_pram(int *len) +uae_u8 *save_pram (int *len) { *len = gfxmem_banks[0]->allocated_size; return gfxmem_banks[0]->baseaddr; } -void restore_fram(int len, size_t filepos, int num) +void restore_fram (int len, size_t filepos, int num) { fast_filepos[num] = filepos; - changed_prefs.fastmem[num].size = len; + changed_prefs.fastmem[num].size = len; } -void restore_zram(int len, size_t filepos, int num) +void restore_zram (int len, size_t filepos, int num) { - if (num == -1) { - z3_fileposchip = filepos; - changed_prefs.z3chipmem_size = len; - } - else { - z3_filepos[num] = filepos; - changed_prefs.z3fastmem[num].size = len; - } + z3_filepos[num] = filepos; + changed_prefs.z3fastmem[num].size = len; } -void restore_pram(int len, size_t filepos) +void restore_pram (int len, size_t filepos) { - p96_filepos = filepos; + p96_filepos = filepos; changed_prefs.rtgboards[0].rtgmem_size = len; } -uae_u8 *save_expansion(int *len, uae_u8 *dstptr) +uae_u8 *save_expansion (int *len, uae_u8 *dstptr) { uae_u8 *dst, *dstbak; - if (dstptr) - dst = dstbak = dstptr; - else - dstbak = dst = xmalloc(uae_u8, 6 * 4); - save_u32(fastmem_bank[0].start); - save_u32(z3fastmem_bank[0].start); - save_u32(gfxmem_banks[0]->start); - save_u32(rtarea_base); - save_u32(fastmem_bank[1].start); - *len = 4 + 4 + 4 + 4 + 4; - return dstbak; + if (dstptr) + dst = dstbak = dstptr; + else + dstbak = dst = xmalloc (uae_u8, 6 * 4); + save_u32 (fastmem_bank[0].start); + save_u32 (z3fastmem_bank[0].start); + save_u32 (gfxmem_banks[0]->start); + save_u32 (rtarea_base); + save_u32 (0 /* fastmem_bank[1].start */); + *len = dst - dstbak; + return dstbak; } -uae_u8 *restore_expansion(uae_u8 *src) +uae_u8 *restore_expansion (uae_u8 *src) { - fastmem_bank[0].start = restore_u32(); - z3fastmem_bank[0].start = restore_u32(); - gfxmem_banks[0]->start = restore_u32(); - rtarea_base = restore_u32(); - fastmem_bank[1].start = restore_u32(); - if (rtarea_base != 0 && rtarea_base != RTAREA_DEFAULT && rtarea_base != RTAREA_BACKUP && rtarea_base != RTAREA_BACKUP_2) - rtarea_base = 0; - return src; + fastmem_bank[0].start = restore_u32 (); + z3fastmem_bank[0].start = restore_u32 (); + gfxmem_banks[0]->start = restore_u32 (); + rtarea_base = restore_u32 (); + restore_u32 (); /* ignore fastmem_bank[1].start */ + if (rtarea_base != 0 && rtarea_base != RTAREA_DEFAULT && rtarea_base != RTAREA_BACKUP && rtarea_base != RTAREA_BACKUP_2) + rtarea_base = 0; + return src; } uae_u8 *save_expansion_info(int *len, uae_u8 *dstptr) @@ -3761,8 +2652,7 @@ uae_u8 *save_expansion_info(int *len, uae_u8 *dstptr) save_u32(ec->rc->back->device_num); save_string(ec->rc->romfile); save_string(ec->rc->romident); - } - else { + } else { save_u32(0xffffffff); } save_u32(ec->base); @@ -3799,1885 +2689,24 @@ uae_u8 *restore_expansion_info(uae_u8 *src) #endif /* SAVESTATE */ -#if 0 -static const struct expansionsubromtype a2090_sub[] = { - { - _T("A2090a"), _T("a2090a"), - 0, 0, 0, - { 0 }, - }, - { - _T("A2090a + 1M RAM"), _T("a2090a_2"), - 0, 0, 0, - { 0 }, - }, - { - NULL - } -}; -#endif -static const struct expansionsubromtype a2091_sub[] = { - { - _T("DMAC-01"), _T("dmac01"), 0, - commodore, commodore_a2091_ram, 0, true, - { 0 } - }, - { - _T("DMAC-02"), _T("dmac02"), 0, - commodore, commodore_a2091_ram, 0, true, - { 0 } - }, - { - NULL - } -}; -static const struct expansionsubromtype gvp1_sub[] = { - { - _T("Impact A2000-1/X"), _T("a2000-1"), 0, - 1761, 8, 0, false, - { 0 } - }, - { - _T("Impact A2000-HC"), _T("a2000-hc"), 0, - 1761, 8, 0, false, - { 0 } - }, - { - _T("Impact A2000-HC+2"), _T("a2000-hc+"), 0, - 1761, 8, 0, false, - { 0 } - }, - { - NULL - } -}; -static const struct expansionsubromtype masoboshi_sub[] = { - { - _T("MC-302"), _T("mc-302"), 0, - 2157, 3, 0, false, - { 0 } - }, - { - _T("MC-702"), _T("mc-702"), 0, - 2157, 3, 0, false, - { 0 } - }, - { - NULL - } -}; -static const struct expansionsubromtype rochard_sub[] = { - { - _T("IDE"), _T("ide"), 0, - 2144, 2, 0, false, - { 0 } - }, - { - _T("IDE+SCSI"), _T("scsi"), 0, - 2144, 2, 0, false, - { 0 } - }, - { - NULL - } -}; -static const struct expansionsubromtype supra_sub[] = { - { - _T("A500 ByteSync/XP"), _T("bytesync"), ROMTYPE_NONE | ROMTYPE_SUPRA, - 1056, 9, 0, false, - { 0xd1, 13, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 }, - }, - { - _T("A2000 Word Sync"), _T("wordsync"), ROMTYPE_NONE | ROMTYPE_SUPRA, - 1056, 9, 0, false, - { 0xd1, 12, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 }, - }, - { - _T("A500 Autoboot"), _T("500"), ROMTYPE_NONE | ROMTYPE_SUPRA, - 1056, 5, 0, false, - { 0xd1, 8, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 }, - }, - { - _T("Non Autoboot (4x4)"), _T("4x4"), ROMTYPE_NOT | ROMTYPE_SUPRA, - 1056, 2, 0, false, - { 0xc1, 1, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - }, - { - _T("A2000 DMA"), _T("dma"), ROMTYPE_NONE | ROMTYPE_SUPRADMA, - 1056, 2, 0, false, - { 0xd1, 3, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00 }, - }, - { - NULL - } -}; - -static const struct expansionsubromtype mediator_sub[] = { - { - _T("1200"), _T("1200"), ROMTYPE_NOT | ROMTYPE_MEDIATOR - }, - { - _T("1200SX"), _T("1200sx"), ROMTYPE_NOT | ROMTYPE_MEDIATOR - }, - { - _T("1200TX"), _T("1200tx"), ROMTYPE_NOT | ROMTYPE_MEDIATOR - }, - { - _T("4000MK2"), _T("4000mkii"), ROMTYPE_NOT | ROMTYPE_MEDIATOR - }, - { - NULL - } -}; -static const struct expansionboardsettings mediator_settings[] = { - { - _T("Full PCI DMA"), - _T("fulldma") - }, - { - _T("Win Size"), - _T("winsize") - }, - { - _T("Swap Config"), - _T("swapconfig") - }, - { - NULL - } -}; -static const struct expansionboardsettings bridge_settings[] = { - { - _T("Full PCI DMA"), - _T("fulldma") - }, - { - NULL - } -}; - -static const struct expansionboardsettings x86at286_bridge_settings[] = { - { - // 14 - _T("Default video\0") _T("Monochrome\0") _T("Color\0"), - _T("video\0") _T("mono\0") _T("color\0"), - true, false, 14 - }, - { - // 15 - _T("Keyboard lock"), - _T("keylock"), - false - }, - { // 16 - 18 - _T("Memory\0") _T("1M\0") _T("2M\0") _T("4M\0") _T("8M\0") _T("16M\0"), - _T("memory\0") _T("1M\0") _T("2M\0") _T("4M\0") _T("8M\0") _T("16M\0"), - true, false, 0 - }, - { // 19 - 20 - _T("CPU core\0") _T("DOSBox simple\0") _T("DOSBox normal\0") _T("DOSBox full\0") _T("DOSBox auto\0"), - _T("cpu\0") _T("dbsimple\0") _T("dbnormal\0") _T("dbfull\0") _T("dbauto\0"), - true, false, 0 - }, - { // 22 - _T("FPU"), - _T("fpu"), - false, false, 1 - }, - { // 23 - 25 - _T("CPU Arch\0") _T("auto\0") _T("386\0") _T("386_prefetch\0") _T("386_slow\0") _T("486_slow\0") _T("486_prefetch\0") _T("pentium_slow\0"), - _T("cpuarch\0") _T("auto\0") _T("386\0") _T("386_prefetch\0") _T("386_slow\0") _T("486_slow\0") _T("486_prefetch\0") _T("pentium_slow\0"), - true, false, 0 - }, - { - NULL - } -}; - -static const struct expansionboardsettings x86at386_bridge_settings[] = { - { - // 15 - _T("Keyboard lock"), - _T("keylock"), - false, false, 15 - }, - { // 16 - 18 - _T("Memory\0") _T("1M\0") _T("2M\0") _T("4M\0") _T("8M\0") _T("16M\0") _T("32M\0") _T("64M\0"), - _T("memory\0") _T("1M\0") _T("2M\0") _T("4M\0") _T("8M\0") _T("16M\0") _T("32M\0") _T("64M\0"), - true, false, 0 - }, - { // 19 - 20 - _T("CPU core\0") _T("DOSBox simple\0") _T("DOSBox normal\0") _T("DOSBox full\0") _T("DOSBox auto\0"), - _T("cpu\0") _T("dbsimple\0") _T("dbnormal\0") _T("dbfull\0") _T("dbauto\0"), - true, false, 0 - }, - { // 22 - _T("FPU"), - _T("fpu"), - false, false, 1 - }, - { // 23 - 25 - _T("CPU Arch\0") _T("auto\0") _T("386\0") _T("386_prefetch\0") _T("386_slow\0") _T("486_slow\0") _T("486_prefetch\0") _T("pentium_slow\0"), - _T("cpuarch\0") _T("auto\0") _T("386\0") _T("386_prefetch\0") _T("386_slow\0") _T("486_slow\0") _T("486_prefetch\0") _T("pentium_slow\0"), - true, false, 0 - }, - { - NULL - } -}; - -static const struct expansionboardsettings x86_bridge_settings[] = { - { - // 2-3 - _T("Memory (SW1:3-4)\0") _T("128K\0") _T("256K\0") _T("512K\0") _T("640K\0"), - _T("memory\0") _T("128k\0") _T("256k\0") _T("512k\0") _T("640k\0"), - true, false, 2 - }, - { - // 4-5 - _T("Default video (J1)\0") _T("Monochrome\0") _T("Color 40x25\0") _T("Color 80x25\0") _T("None\0"), - _T("video\0") _T("mono\0") _T("color40\0") _T("color80\0") _T("none\0"), - true, false, 0 - }, - { // 19 - 21 - _T("CPU core\0") _T("Fake86\0") _T("DOSBox simple\0") _T("DOSBox normal\0") _T("DOSBox full\0") _T("DOSBox auto\0"), - _T("cpu\0") _T("fake86\0") _T("dbsimple\0") _T("dbnormal\0") _T("dbfull\0") _T("dbauto\0"), - true, false, 19 - 6 - }, - { // 22 - _T("FPU (DOSBox CPU only)"), - _T("fpu") - }, - { // 23 - 25 - _T("CPU Arch (DOSBox CPU only)\0") _T("auto") _T("386\0") _T("386_prefetch\0") _T("386_slow\0") _T("486_slow\0") _T("486_prefetch\0") _T("pentium_slow\0"), - _T("cpuarch\0") _T("auto") _T("386\0") _T("386_prefetch\0") _T("386_slow\0") _T("486_slow\0") _T("486_prefetch\0") _T("pentium_slow\0"), - true, false, 0 - }, - { - NULL - } -}; - -static const struct expansionboardsettings x86_bridge_sidecar_settings[] = { - { - // 0 - _T("System Diagnostics (SW1:1)"), - _T("diagnostics"), - }, - { - // 1 - _T("8037 installed (SW1:2)"), - _T("fpu"), - }, - { - // 2-3 - _T("Memory (SW1:3-4)\0") _T("128K\0") _T("256K\0") _T("512K\0") _T("640K\0"), - _T("memory\0") _T("128k\0") _T("256k\0") _T("512k\0") _T("640k\0"), - true - }, - { - // 4-5 - _T("Default video (SW1:5-6)\0") _T("Monochrome\0") _T("Color 40x25\0") _T("Color 80x25\0") _T("None\0"), - _T("video\0") _T("mono\0") _T("color40\0") _T("color80\0") _T("none\0"), - true - }, - { - // 6-7 - _T("Floppy drives (SW1:7-8)\0") _T("1\0") _T("2\0") _T("3\0") _T("4\0"), - _T("floppy\0") _T("floppy1\0") _T("floppy2\0") _T("floppy3\0") _T("floppy4\0"), - true - }, - { - // 8 - _T("Disable mono video emulation (SW2:1)"), - _T("mono_card") - }, - { - // 9 - _T("Disable color video emulation (SW2:2)"), - _T("color_card") - }, - { - // 10-11 - _T("Address sector (SW2:3-4)\0") _T("A0000-AFFFF (1)\0") _T("A0000-AFFFF (2)\0") _T("D0000-DFFFF\0") _T("E0000-EFFFF\0"), - _T("memory\0") _T("sector_a0000_1\0") _T("sector_a0000_2\0") _T("sector_d0000\0") _T("sector_e0000\0"), - true - }, - { - // 12 - _T("Disable parallel port emulation (J11)"), - _T("parport_card") - }, - { // 19 - 21 - _T("CPU core\0") _T("Fake86\0") _T("DOSBox simple\0") _T("DOSBox normal\0") _T("DOSBox full\0") _T("DOSBox auto\0"), - _T("cpu\0") _T("fake86\0") _T("dbsimple\0") _T("dbnormal\0") _T("dbfull\0") _T("dbauto\0"), - true, false, 19 - 13 - }, - { // 22 - _T("FPU (DOSBox CPU only)"), - _T("fpu") - }, - { // 23 - 25 - _T("CPU Arch (DOSBox CPU only)\0") _T("auto") _T("386\0") _T("386_prefetch\0") _T("386_slow\0") _T("486_slow\0") _T("486_prefetch\0") _T("pentium_slow\0"), - _T("cpuarch\0") _T("auto") _T("386\0") _T("386_prefetch\0") _T("386_slow\0") _T("486_slow\0") _T("486_prefetch\0") _T("pentium_slow\0"), - true, false, 0 - }, - { - NULL - } -}; - -static const struct expansionboardsettings toccata_soundcard_settings[] = { - { - _T("Paula/CD audio mixer"), - _T("mixer") - }, - { - NULL - } -}; - -static const struct expansionboardsettings x86_athdxt_settings[] = { - { - _T("ROM Address\0") _T("0xCC000\0") _T("0xDC000\0") _T("0xEC000\0"), - _T("baseaddress\0") _T("0xcc000\0") _T("0xdc000\0") _T("0xec000\0"), - true - }, - { - NULL - } -}; - - -static const struct expansionboardsettings harlequin_settings[] = { - { - _T("Model\0") _T("Harlequin (PAL)\0") _T("Harlequin (NTSC)\0") _T("Harlequin Plus (PAL)\0") _T("Harlequin Plus (NTSC)\0"), - _T("model\0") _T("pal\0") _T("ntsc\0") _T("pluspal\0") _T("plusntsc\0"), - true - }, - { - _T("VRAM\0") _T("1.5M\0") _T("2M\0") _T("3M\0") _T("4M\0"), - _T("vram\0") _T("1.5m\0") _T("2m\0") _T("3m\0") _T("4m\0"), - true - }, - { - _T("Genlock"), - _T("genlock") - }, - { - NULL - } -}; - -static struct expansionboardsettings ne2k_isa_settings[] = { - { - _T("IO\0") _T("240\0") _T("260\0") _T("280\0") _T("2A0\0") _T("300\0") _T("320\0") _T("340\0") _T("360\0"), - _T("io\0") _T("240\0") _T("260\0") _T("280\0") _T("2A0\0") _T("300\0") _T("320\0") _T("340\0") _T("360\0"), - true, false, 0 - }, - { - _T("IRQ\0") _T("3\0") _T("4\0") _T("5\0") _T("7\0") _T("9\0") _T("10\0") _T("11\0") _T("12\0") _T("15\0"), - _T("irq\0") _T("3\0") _T("4\0") _T("5\0") _T("7\0") _T("9\0") _T("10\0") _T("11\0") _T("12\0") _T("15\0"), - true, false, 0 - }, - { - NULL, NULL, - true, false, 4 - }, - { - NULL - } -}; - -static struct expansionboardsettings lanrover_settings[] = { - { - _T("Interrupt level\0") _T("2\0") _T("6\0"), - _T("irq\0") _T("2\0") _T("6\0"), - true, false, 0 - }, - { - _T("MAC\0"), - _T("mac\0"), - 2, false, 0 - }, - { - NULL, NULL, - true, false, 15 - }, - { - NULL - } -}; -static struct expansionboardsettings ethernet_settings[] = { - { - _T("MAC\0"), - _T("mac\0"), - 2, false, 0 - }, - { - NULL, NULL, - true, false, 16 - }, - { - NULL - } -}; - -static struct expansionboardsettings *netsettings[] = { - ethernet_settings, - lanrover_settings, - ne2k_isa_settings, - NULL -}; - -struct netdriverdata **target_ethernet_enumerate(void); - -uae_u32 ethernet_getselection(const TCHAR *name) -{ -#ifndef AMIBERRY - struct netdriverdata **ndd = target_ethernet_enumerate(); - if (!ndd) - return 0; - for (int i = 0; ndd && i < MAX_TOTAL_NET_DEVICES; i++) { - if (ndd[i] && !_tcsicmp(ndd[i]->name, name)) - return i << 16; - } -#endif - return 0; -} - -const TCHAR *ethernet_getselectionname(uae_u32 settings) -{ -#ifndef AMIBERRY - struct netdriverdata **ndd = target_ethernet_enumerate(); - if (!ndd) - return 0; - settings = (settings >> 16) & 255; - for (int i = 0; ndd && i < MAX_TOTAL_NET_DEVICES; i++) { - if (i == settings) - return ndd[i]->name; - } -#endif - return _T("slirp"); -} - -void ethernet_updateselection(void) -{ -#ifndef AMIBERRY - static int updated; - if (updated) - return; - updated = 1; - struct netdriverdata **ndd = target_ethernet_enumerate(); - if (!ndd) - return; - static TCHAR tmp1[MAX_DPATH]; - static TCHAR tmp2[MAX_DPATH]; - _tcscpy(tmp1, _T("Network mode")); - _tcscpy(tmp2, _T("netmode")); - TCHAR *p1 = tmp1 + _tcslen(tmp1) + 1; - TCHAR *p2 = tmp2 + _tcslen(tmp2) + 1; - for (int i = 0; ndd && i < MAX_TOTAL_NET_DEVICES; i++) { - if (ndd[i]) { - TCHAR mac[20]; - mac[0] = 0; - if (ndd[i]->type == UAENET_SLIRP || ndd[i]->type == UAENET_SLIRP_INBOUND) { - _stprintf(mac, _T(" xx:xx:xx:%02X:%02X:%02X"), - ndd[i]->mac[3], ndd[i]->mac[4], ndd[i]->mac[5]); - } - _stprintf(p1, _T("%s%s"), ndd[i]->desc, mac[0] ? mac : _T("")); - p1 += _tcslen(p1) + 1; - _tcscpy(p2, ndd[i]->name); - p2 += _tcslen(p2) + 1; - } - } - *p1 = 0; - *p2 = 0; - for (int i = 0; netsettings[i]; i++) { - struct expansionboardsettings *ebs = netsettings[i]; - int j; - for (j = 0; ebs[j].name; j++); - ebs[j].name = tmp1; - ebs[j].configname = tmp2; - } -#endif -} - -static void fastlane_memory_callback(struct romconfig *rc, uae_u8 *ac, int size) -{ - struct zfile *z = read_device_from_romconfig(rc, NULL); - if (z) { - // load autoconfig data from rom file - uae_u8 act[16] = { 0 }; - zfile_fseek(z, 0x80, SEEK_SET); - zfile_fread(act, 1, 16, z); - zfile_fclose(z); - for (int i = 1; i < 16; i++) { - ac[i] = ~act[i]; - act[i] = ~act[i]; - } - // don't overwrite uae configured memory size - ac[0] = (ac[0] & 7) | (act[0] & 0xf8); - ac[2] = (ac[2] & 0x0f) | (act[2] & 0xf0); - } -} -static void hda506_memory_callback(struct romconfig *rc, uae_u8 *ac, int size) -{ - if (currprefs.cs_a1000ram) - ac[1] = 1; - else - ac[1] = 2; -} -static void nexus_memory_callback(struct romconfig *rc, uae_u8 *ac, int size) -{ - if (rc->device_settings & 1) - ac[0] &= ~(1 << 5); - if (size <= 2 * 1024 * 1024) - ac[1] = 2; - else if (size <= 4 * 1024 * 1024) - ac[1] = 4; - else - ac[1] = 8; -} -static const struct expansionboardsettings golemfast_settings[] = { - { - _T("IDE"), - _T("ide") - }, - { - NULL - } -}; -static const struct expansionboardsettings nexus_settings[] = { - { - _T("MEM TEST"), - _T("memtest") - }, - { - NULL - } -}; -static const struct expansionboardsettings buddha_settings[] = { - { - _T("Model\0") _T("Buddha\0") _T("Catweasel Z2\0"), - _T("model\0") _T("buddha\0") _T("cwz2\0"), - true, false, 0 - }, - { - NULL - } -}; - -static const struct expansionboardsettings adscsi2000_settings[] = { - { - _T("Cache (B)"), - _T("B") - }, - { - NULL - } -}; -static const struct expansionboardsettings warpengine_settings[] = { - { - _T("Jumper H"), - _T("jumper_h") - }, - { - _T("Jumper J"), - _T("jumper_j") - }, - { - _T("Jumper K"), - _T("jumper_k") - }, - { - NULL - } -}; -static const struct expansionboardsettings a4091_settings[] = { - { - _T("Fast Bus"), - _T("fastbus"), - }, - { - _T("Delayed autoboot"), - _T("delayedautoboot") - }, - { - _T("Syncronous mode"), - _T("syncmode") - }, - { - _T("Termination"), - _T("term") - }, - { - _T("LUN"), - _T("lun") - }, - { - NULL - } -}; -static const struct expansionboardsettings dataflyersplus_settings[] = { - { - _T("Configuration\0") _T("SCSI+IDE\0") _T("SCSI\0") _T("IDE\0"), - _T("config\0") _T("scsiide") _T("scsi\0") _T("ide\0"), - true - }, - { - NULL - } -}; - const struct expansionromtype expansionroms[] = { -#if 0 - { - _T("cpuboard"), _T("Accelerator"), _T("Accelerator"), - NULL, NULL, add_cpuboard_unit, ROMTYPE_CPUBOARD, 0, 0, 0, true, - NULL, 0, - false, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_IDE - }, - - /* PCI Bridgeboards */ - - { - _T("grex"), _T("G-REX"), _T("DCE"), - grex_init, NULL, NULL, ROMTYPE_GREX | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_PCI_BRIDGE - }, - { - _T("mediator"), _T("Mediator"), _T("Elbox"), - mediator_init, mediator_init2, NULL, ROMTYPE_MEDIATOR | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, false, - mediator_sub, 0, - false, EXPANSIONTYPE_PCI_BRIDGE, - 0, 0, 0, false, NULL, - false, 0, mediator_settings - }, - { - _T("prometheus"), _T("Prometheus"), _T("Matay"), - prometheus_init, NULL, NULL, ROMTYPE_PROMETHEUS | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z3, false, - NULL, 0, - false, EXPANSIONTYPE_PCI_BRIDGE, - 0, 0, 0, false, NULL, - false, 0, bridge_settings - }, - - /* SCSI/IDE expansion */ - - { - _T("apollo"), _T("Apollo 500/2000"), _T("3-State"), - apollo_init_hd, NULL, apollo_add_scsi_unit, ROMTYPE_APOLLOHD, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - false, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_IDE, - 8738, 0, 0 - }, - { - _T("add500"), _T("ADD-500"), _T("Archos"), - add500_init, NULL, add500_add_scsi_unit, ROMTYPE_ADD500, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - false, EXPANSIONTYPE_SCSI, - 8498, 27, 0, true, NULL - }, - { - _T("blizzardscsikitiii"), _T("SCSI Kit III"), _T("Phase 5"), - NULL, NULL, cpuboard_ncr9x_add_scsi_unit, ROMTYPE_BLIZKIT3, 0, 0, 0, true, - NULL, 0, - false, EXPANSIONTYPE_SCSI - }, - { - _T("blizzardscsikitiv"), _T("SCSI Kit IV"), _T("Phase 5"), - NULL, NULL, cpuboard_ncr9x_add_scsi_unit, ROMTYPE_BLIZKIT4, 0, 0, 0, true, - NULL, 0, - false, EXPANSIONTYPE_SCSI - }, - { - _T("oktagon2008"), _T("Oktagon 2008"), _T("BSC/Alfa Data"), - ncr_oktagon_autoconfig_init, NULL, oktagon_add_scsi_unit, ROMTYPE_OKTAGON, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - true, EXPANSIONTYPE_SCSI - }, - { - _T("alfapower"), _T("AlfaPower/AT-Bus 2008"), _T("BSC/Alfa Data"), - alf_init, NULL, alf_add_ide_unit, ROMTYPE_ALFA, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - false, EXPANSIONTYPE_IDE, - 2092, 8, 0 - }, - { - _T("alfapowerplus"), _T("AlfaPower Plus"), _T("BSC/Alfa Data"), - alf_init, NULL, alf_add_ide_unit, ROMTYPE_ALFAPLUS, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - false, EXPANSIONTYPE_IDE, - 2092, 8, 0 - }, - { - _T("cltda1000scsi"), _T("A1000/A2000 SCSI"), _T("C-Ltd"), - cltda1000scsi_init, NULL, cltda1000scsi_add_scsi_unit, ROMTYPE_CLTDSCSI | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - false, EXPANSIONTYPE_SCSI, - 0, 0, 0, false, NULL, - false, 0, NULL, - { 0xc1, 0x0c, 0x00, 0x00, 0x03, 0xec, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - }, - { - _T("a2090a"), _T("A2090a"), _T("Commodore"), - a2090_init, NULL, a2090_add_scsi_unit, ROMTYPE_A2090 | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_CUSTOM_SECONDARY - }, - { - _T("a2091"), _T("A590/A2091"), _T("Commodore"), - a2091_init, NULL, a2091_add_scsi_unit, ROMTYPE_A2091 | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, false, - a2091_sub, 1, - true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_CUSTOM_SECONDARY, - commodore, commodore_a2091, 0, true, NULL - }, - { - _T("a4091"), _T("A4091"), _T("Commodore"), - ncr710_a4091_autoconfig_init, NULL, a4091_add_scsi_unit, ROMTYPE_A4091, 0, 0, BOARD_AUTOCONFIG_Z3, false, - NULL, 0, - false, EXPANSIONTYPE_SCSI, - 0, 0, 0, false, NULL, - true, 0, a4091_settings - }, - { - _T("dataflyerscsiplus"), _T("DataFlyer SCSI+"), _T("Expansion Systems"), - dataflyer_init, NULL, dataflyer_add_scsi_unit, ROMTYPE_DATAFLYERP | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_SCSI - }, - { - _T("dataflyerplus"), _T("DataFlyer Plus"), _T("Expansion Systems"), - dataflyerplus_init, NULL, dataflyerplus_add_idescsi_unit, ROMTYPE_DATAFLYER, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_IDE, - 0, 0, 0, false, NULL, - false, 0, dataflyersplus_settings - }, - { - _T("gvp1"), _T("GVP Series I"), _T("Great Valley Products"), - gvp_init_s1, NULL, gvp_s1_add_scsi_unit, ROMTYPE_GVPS1 | ROMTYPE_NONE, ROMTYPE_GVPS12, 0, BOARD_AUTOCONFIG_Z2, false, - gvp1_sub, 1, - true, EXPANSIONTYPE_SCSI - }, - { - _T("gvp"), _T("GVP Series II"), _T("Great Valley Products"), - gvp_init_s2, NULL, gvp_s2_add_scsi_unit, ROMTYPE_GVPS2 | ROMTYPE_NONE, ROMTYPE_GVPS12, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - true, EXPANSIONTYPE_SCSI, - 2017, 10, 0 - }, - { - _T("vector"), _T("Vector Falcon 8000"), _T("HK-Computer"), - vector_init, NULL, vector_add_scsi_unit, ROMTYPE_VECTOR, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - false, EXPANSIONTYPE_SCSI - }, - { - _T("adide"), _T("AdIDE"), _T("ICD"), - adide_init, NULL, adide_add_ide_unit, ROMTYPE_ADIDE | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - true, EXPANSIONTYPE_IDE - }, - { - _T("adscsi2000"), _T("AdSCSI Advantage 2000"), _T("ICD"), - adscsi_init, NULL, adscsi_add_scsi_unit, ROMTYPE_ADSCSI, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - false, EXPANSIONTYPE_SCSI, - 0, 0, 0, false, NULL, - true, 0, adscsi2000_settings - }, - { - _T("buddha"), _T("Buddha"), _T("Individual Computers"), - buddha_init, NULL, buddha_add_ide_unit, ROMTYPE_BUDDHA, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - false, EXPANSIONTYPE_IDE, - 0, 0, 0, false, NULL, - false, 4, buddha_settings, - { 0xd1, 0x00, 0x00, 0x00, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00 }, - }, - { - _T("trumpcardpro"), _T("Grand Slam"), _T("IVS"), - trumpcardpro_init, NULL, trumpcardpro_add_scsi_unit, ROMTYPE_IVSTPRO, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - true, EXPANSIONTYPE_SCSI, - 2112, 4, 0, false, NULL, - true, 0, NULL, - { 0xd1, 0x34, 0x00, 0x00, 0x08, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 }, - }, - { - _T("kommos"), _T("Kommos A500/A2000 SCSI"), _T("Jürgen Kommos"), - kommos_init, NULL, kommos_add_scsi_unit, ROMTYPE_KOMMOS, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_SCSI - }, - { - _T("golem"), _T("Golem SCSI II"), _T("Kupke"), - golem_init, NULL, golem_add_scsi_unit, ROMTYPE_GOLEM, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - true, EXPANSIONTYPE_SCSI, - 2079, 3, 0 - }, - { - _T("golemfast"), _T("Golem Fast SCSI/IDE"), _T("Kupke"), - golemfast_init, NULL, golemfast_add_idescsi_unit, ROMTYPE_GOLEMFAST, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_IDE, - 0, 0, 0, false, NULL, - true, 0, golemfast_settings - }, - { - _T("multievolution"), _T("Multi Evolution 500/2000"), _T("MacroSystem"), - ncr_multievolution_init, NULL, multievolution_add_scsi_unit, ROMTYPE_MEVOLUTION, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_SCSI, - 18260, 8, 0, true - }, - { - _T("scram8490"), _T("SCRAM (DP8490V)"), _T("MegaMicro"), - scram5380_init, NULL, scram5380_add_scsi_unit, ROMTYPE_SCRAM5380, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - true, EXPANSIONTYPE_SCSI, - 4096, 4, 0, false, NULL, - false, 0, NULL, - { 0xd1, 3, 0x40, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00 } - }, - { - _T("scram5394"), _T("SCRAM (NCR53C94)"), _T("MegaMicro"), - ncr_scram5394_init, NULL, scram5394_add_scsi_unit, ROMTYPE_SCRAM5394, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - true, EXPANSIONTYPE_SCSI, - 4096, 4, 0, false, NULL, - false, 0, NULL, - { 0xd1, 7, 0x40, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00 } - }, - { - _T("paradox"), _T("Paradox SCSI"), _T("Mainhattan Data"), - paradox_init, NULL, paradox_add_scsi_unit, ROMTYPE_PARADOX | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, false, - NULL, 0, - true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_PARALLEL_ADAPTER - }, - { - _T("ateam"), _T("A-Team"), _T("Mainhattan Data"), - ateam_init, NULL, ateam_add_ide_unit, ROMTYPE_ATEAM, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - true, EXPANSIONTYPE_IDE - }, - { - _T("mtecat"), _T("AT 500"), _T("M-Tec"), - mtec_init, NULL, mtec_add_ide_unit, ROMTYPE_MTEC, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - true, EXPANSIONTYPE_IDE - }, - { - _T("masoboshi"), _T("MasterCard"), _T("Masoboshi"), - masoboshi_init, NULL, masoboshi_add_idescsi_unit, ROMTYPE_MASOBOSHI | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, false, - masoboshi_sub, 0, - true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_IDE - }, - { - _T("hardframe"), _T("HardFrame"), _T("Microbotics"), - hardframe_init, NULL, hardframe_add_scsi_unit, ROMTYPE_HARDFRAME, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - true, EXPANSIONTYPE_SCSI, - 0, 0, 0, false, NULL, - true - }, - { - _T("stardrive"), _T("StarDrive"), _T("Microbotics"), - stardrive_init, NULL, stardrive_add_scsi_unit, ROMTYPE_STARDRIVE | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_SCSI, - 1010, 0, 0, false, NULL, - false, 0, NULL, - { 0xc1, 2, 0x00, 0x00, 0x03, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - - }, - { - _T("filecard2000"), _T("Filecard 2000/OSSI 500"), _T("Otronic"), - ossi_init, NULL, ossi_add_scsi_unit, ROMTYPE_OSSI, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - true, EXPANSIONTYPE_SCSI, - 0, 0, 0, false, NULL, - false, 0, NULL, - { 0xc1, 1, 0x00, 0x00, 0x07, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } - }, - { - _T("fastlane"), _T("Fastlane"), _T("Phase 5"), - ncr_fastlane_autoconfig_init, NULL, fastlane_add_scsi_unit, ROMTYPE_FASTLANE, 0, 0, BOARD_AUTOCONFIG_Z3, false, - NULL, 0, - false, EXPANSIONTYPE_SCSI, - 8512, 10, 0, false, fastlane_memory_callback - }, - { - _T("phoenixboard"), _T("Phoenix Board SCSI"), _T("Phoenix Microtechnologies"), - phoenixboard_init, NULL, phoenixboard_add_scsi_unit, ROMTYPE_PHOENIXB, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - true, EXPANSIONTYPE_SCSI, - }, - { - _T("ptnexus"), _T("Nexus"), _T("Preferred Technologies"), - ptnexus_init, NULL, ptnexus_add_scsi_unit, ROMTYPE_PTNEXUS | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - false, EXPANSIONTYPE_SCSI, - 2102, 4, 0, false, nexus_memory_callback, - false, 0, nexus_settings, - { 0xd1, 0x01, 0x00, 0x00, 0x08, 0x36, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 }, - }, - { - _T("protar"), _T("A500 HD"), _T("Protar"), - protar_init, NULL, protar_add_ide_unit, ROMTYPE_PROTAR, 0, 0, BOARD_AUTOCONFIG_Z2, false, - NULL, 0, - true, EXPANSIONTYPE_SCSI, - 4149, 51, 0 - }, - { - _T("rochard"), _T("RocHard RH800C"), _T("Roctec"), - rochard_init, NULL, rochard_add_idescsi_unit, ROMTYPE_ROCHARD | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, false, - rochard_sub, 0, - true, EXPANSIONTYPE_IDE | EXPANSIONTYPE_SCSI, - 2144, 2, 0, false, NULL, - false, 2, NULL - }, - { - _T("supradrive"), _T("SupraDrive"), _T("Supra Corporation"), - supra_init, NULL, supra_add_scsi_unit, ROMTYPE_SUPRA | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, false, - supra_sub, 0, - true, EXPANSIONTYPE_SCSI - }, -#if 0 /* driver is MIA, 3rd party ScottDevice driver is not enough for full implementation. */ - { - _T("microforge"), _T("Hard Disk"), _T("Micro Forge"), - microforge_init, NULL, microforge_add_scsi_unit, ROMTYPE_MICROFORGE | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_SASI | EXPANSIONTYPE_SCSI - }, -#endif - - { - _T("omtiadapter"), _T("OMTI-Adapter"), _T("C't"), - omtiadapter_init, NULL, omtiadapter_scsi_unit, ROMTYPE_OMTIADAPTER | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_CUSTOM | EXPANSIONTYPE_SCSI - }, - { - _T("alf1"), _T("A.L.F."), _T("Elaborate Bytes"), - alf1_init, NULL, alf1_add_scsi_unit, ROMTYPE_ALF1 | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_CUSTOM | EXPANSIONTYPE_SCSI - }, - { - _T("promigos"), _T("Promigos"), _T("Flesch und Hörnemann"), - promigos_init, NULL, promigos_add_scsi_unit, ROMTYPE_PROMIGOS | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_CUSTOM | EXPANSIONTYPE_SCSI - }, - { - _T("tecmar"), _T("T-Card/T-Disk"), _T("Tecmar"), - tecmar_init, NULL, tecmar_add_scsi_unit, ROMTYPE_TECMAR | ROMTYPE_NOT, 0, 0, BOARD_PROTOAUTOCONFIG, true, - NULL, 0, - false, EXPANSIONTYPE_SASI | EXPANSIONTYPE_SCSI, - 1001, 1, 0 - }, - { - _T("system2000"), _T("System 2000"), _T("Vortex"), - system2000_init, NULL, system2000_add_scsi_unit, ROMTYPE_SYSTEM2000 | ROMTYPE_NONE, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_CUSTOM | EXPANSIONTYPE_SCSI - }, - { - _T("xebec"), _T("9720H"), _T("Xebec"), - xebec_init, NULL, xebec_add_scsi_unit, ROMTYPE_XEBEC | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_SASI | EXPANSIONTYPE_SCSI - }, -#if 0 - { - _T("kronos"), _T("Kronos"), _T("C-Ltd"), - kronos_init, kronos_add_scsi_unit, ROMTYPE_KRONOS, 0, 0, 2, false, - NULL, 0, - false, EXPANSIONTYPE_SCSI, - 0, 0, 0, - { 0xd1, 4, 0x00, 0x00, 0x03, 0xec, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 }, - }, -#endif - { - _T("hda506"), _T("HDA-506"), _T("Spirit Technology"), - hda506_init, NULL, hda506_add_scsi_unit, ROMTYPE_HDA506 | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_CUSTOM | EXPANSIONTYPE_SCSI, - 0, 0, 0, false, NULL, - false, 0, NULL, - { 0xc1, 0x04, 0x00, 0x00, 0x07, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } - }, - { - _T("amax"), _T("AMAX ROM dongle"), _T("ReadySoft"), - NULL, NULL, NULL, ROMTYPE_AMAX | ROMTYPE_NONE, 0, 0, 0, false - }, - -#if 0 - { - _T("x86_xt_hd"), _T("x86 XT"), _T("x86"), - x86_xt_hd_init, NULL, x86_add_xt_hd_unit, ROMTYPE_X86_HD | ROMTYPE_NONE, 0, 0, BOARD_NONAUTOCONFIG_AFTER_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_CUSTOM | EXPANSIONTYPE_SCSI - }, -#endif - { - _T("x86athdprimary"), _T("AT IDE Primary"), _T("x86"), - x86_at_hd_init_1, NULL, x86_add_at_hd_unit_1, ROMTYPE_X86_AT_HD1 | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_AFTER_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_IDE - }, - { - _T("x86athdsecondary"), _T("AT IDE Secondary"), _T("x86"), - x86_at_hd_init_2, NULL, x86_add_at_hd_unit_2, ROMTYPE_X86_AT_HD2 | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_AFTER_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_IDE - }, - { - _T("x86athdxt"), _T("XTIDE Universal BIOS HD"), _T("x86"), - x86_at_hd_init_xt, NULL, x86_add_at_hd_unit_xt, ROMTYPE_X86_XT_IDE | ROMTYPE_NONE, 0, 0, BOARD_NONAUTOCONFIG_AFTER_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_IDE, - 0, 0, 0, false, NULL, - false, 0, x86_athdxt_settings - }, - - /* PC Bridgeboards */ - - { - _T("a1060"), _T("A1060 Sidecar"), _T("Commodore"), - a1060_init, NULL, NULL, ROMTYPE_A1060 | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_X86_BRIDGE, - 0, 0, 0, false, NULL, - false, 0, x86_bridge_sidecar_settings - }, - { - _T("a2088"), _T("A2088"), _T("Commodore"), - a2088xt_init, NULL, NULL, ROMTYPE_A2088 | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_X86_BRIDGE, - 0, 0, 0, false, NULL, - false, 0, x86_bridge_settings - }, - { - _T("a2088t"), _T("A2088T"), _T("Commodore"), - a2088t_init, NULL, NULL, ROMTYPE_A2088T | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_X86_BRIDGE, - 0, 0, 0, false, NULL, - false, 0, x86_bridge_settings - }, - { - _T("a2286"), _T("A2286"), _T("Commodore"), - a2286_init, NULL, NULL, ROMTYPE_A2286 | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_X86_BRIDGE, - 0, 0, 0, false, NULL, - false, 0, x86at286_bridge_settings - }, - { - _T("a2386"), _T("A2386SX"), _T("Commodore"), - a2386_init, NULL, NULL, ROMTYPE_A2386 | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_X86_BRIDGE, - 0, 0, 0, false, NULL, - false, 0, x86at386_bridge_settings - }, - - // only here for rom selection and settings - { - _T("picassoiv"), _T("Picasso IV"), _T("Village Tronic"), - NULL, NULL, NULL, ROMTYPE_PICASSOIV | ROMTYPE_NONE, 0, 0, BOARD_IGNORE, true, - NULL, 0, - false, EXPANSIONTYPE_RTG - }, - { - _T("x86vga"), _T("x86 VGA"), _T("x86"), - NULL, NULL, NULL, ROMTYPE_x86_VGA | ROMTYPE_NONE, 0, 0, BOARD_IGNORE, true, - NULL, 0, - false, EXPANSIONTYPE_RTG - }, - { - _T("harlequin"), _T("Harlequin"), _T("ACS"), - NULL, NULL, NULL, ROMTYPE_HARLEQUIN | ROMTYPE_NOT, 0, 0, BOARD_IGNORE, false, - NULL, 0, - false, EXPANSIONTYPE_RTG, - 0, 0, 0, false, NULL, - false, 0, harlequin_settings - }, - - /* Sound Cards */ - - { - _T("toccata"), _T("Toccata"), _T("MacroSystem"), - sndboard_init, NULL, NULL, ROMTYPE_TOCCATA | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_SOUND, - 0, 0, 0, false, NULL, - false, 0, toccata_soundcard_settings, - { 0xc1, 12, 0, 0, 18260 >> 8, 18260 & 255 } - }, - { - _T("es1370"), _T("ES1370 PCI"), _T("Ensoniq"), - pci_expansion_init, NULL, NULL, ROMTYPE_ES1370 | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_SOUND - }, - { - _T("fm801"), _T("FM801 PCI"), _T("Fortemedia"), - pci_expansion_init, NULL, NULL, ROMTYPE_FM801 | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_SOUND - }, - { - _T("uaesnd_z2"), _T("UAESND Z2"), NULL, - uaesndboard_init_z2, NULL, NULL, ROMTYPE_UAESNDZ2 | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_SOUND, - 0, 0, 0, false, NULL, - false, 0, NULL, - { 0xc1, 2, 0x00, 0x00, 6502 >> 8, 6502 & 255, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } - }, - { - _T("uaesnd_z3"), _T("UAESND Z3"), NULL, - uaesndboard_init_z3, NULL, NULL, ROMTYPE_UAESNDZ3 | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z3, true, - NULL, 0, - false, EXPANSIONTYPE_SOUND, - 0, 0, 0, false, NULL, - false, 0, NULL, - { 0x80, 2, 0x10, 0x00, 6502 >> 8, 6502 & 255, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } - }, -#if 0 - { - _T("pmx"), _T("pmx"), NULL, - pmx_init, NULL, NULL, ROMTYPE_PMX | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_SOUND, - 0, 0, 0, false, NULL, - false, 0, NULL, - { 0xc1, 0x30, 0x00, 0x00, 0x0e, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } - }, -#endif - - /* Network */ - { - _T("a2065"), _T("A2065"), _T("Commodore"), - a2065_init, NULL, NULL, ROMTYPE_A2065 | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_NET, - 0, 0, 0, false, NULL, - false, 0, ethernet_settings, - { 0xc1, 0x70, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } - }, - { - _T("ariadne"), _T("Ariadne"), _T("Village Tronic"), - ariadne_init, NULL, NULL, ROMTYPE_ARIADNE | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_NET, - 0, 0, 0, false, NULL, - false, 0, ethernet_settings, - { 0xc1, 0xc9, 0x00, 0x00, 2167 >> 8, 2167 & 255, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } - }, - { - _T("ariadne2"), _T("Ariadne II"), _T("Village Tronic"), - ariadne2_init, NULL, NULL, ROMTYPE_ARIADNE2 | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_NET, - 0, 0, 0, false, NULL, - false, 0, ethernet_settings, - { 0xc1, 0xca, 0x00, 0x00, 2167 >> 8, 2167 & 255, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } - }, - { - _T("hydra"), _T("AmigaNet"), _T("Hydra Systems"), - hydra_init, NULL, NULL, ROMTYPE_HYDRA | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_NET, - 0, 0, 0, false, NULL, - false, 0, ethernet_settings, - { 0xc1, 0x01, 0x00, 0x00, 2121 >> 8, 2121 & 255, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } - }, - { - _T("eb920"), _T("LAN Rover/EB920"), _T("ASDG"), - lanrover_init, NULL, NULL, ROMTYPE_LANROVER | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_NET, - 0, 0, 0, false, NULL, - false, 0, lanrover_settings, - { 0xc1, 0xfe, 0x00, 0x00, 1023 >> 8, 1023 & 255, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } - }, - { - _T("xsurf"), _T("X-Surf"), _T("Individual Computers"), - xsurf_init, NULL, NULL, ROMTYPE_XSURF | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_NET, - 0, 0, 0, false, NULL, - false, 0, ethernet_settings, - { 0xc1, 0x17, 0x00, 0x00, 4626 >> 8, 4626 & 255, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } - }, - { - _T("xsurf100z2"), _T("X-Surf-100 Z2"), _T("Individual Computers"), - xsurf100_init, NULL, NULL, ROMTYPE_XSURF100Z2 | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_NET, - 0, 0, 0, false, NULL, - false, 0, ethernet_settings, - { 0xc1, 0x64, 0x10, 0x00, 4626 >> 8, 4626 & 255, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00 } - }, - { - _T("xsurf100z3"), _T("X-Surf-100 Z3"), _T("Individual Computers"), - xsurf100_init, NULL, NULL, ROMTYPE_XSURF100Z3 | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z3, true, - NULL, 0, - false, EXPANSIONTYPE_NET, - 0, 0, 0, false, NULL, - false, 0, ethernet_settings, - { 0x82, 0x64, 0x32, 0x00, 4626 >> 8, 4626 & 255, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00 } - }, - { - _T("ne2000_pcmcia"), _T("RTL8019 PCMCIA (NE2000 compatible)"), NULL, - gayle_init_ne2000_pcmcia, NULL, NULL, ROMTYPE_NE2KPCMCIA | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_NET, - 0, 0, 0, false, NULL, - false, 0, ethernet_settings, - }, - { - _T("ne2000_pci"), _T("RTL8029 PCI (NE2000 compatible)"), NULL, - pci_expansion_init, NULL, NULL, ROMTYPE_NE2KPCI | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_NET, - 0, 0, 0, false, NULL, - false, 0, ethernet_settings, - }, - { - _T("ne2000_isa"), _T("RTL8019 ISA (NE2000 compatible)"), NULL, - isa_expansion_init, NULL, NULL, ROMTYPE_NE2KISA | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_NET, - 0, 0, 0, false, NULL, - false, 0, ne2k_isa_settings - }, - - /* Catweasel */ - { - _T("catweasel"), _T("Catweasel"), _T("Individual Computers"), - expamem_init_catweasel, NULL, NULL, ROMTYPE_CATWEASEL | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_FLOPPY - }, - - /* built-in controllers */ + /* built-in controllers */ { _T("cd32fmv"), _T("CD32 FMV"), _T("Commodore"), expamem_init_cd32fmv, NULL, NULL, ROMTYPE_CD32CART, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_INTERNAL - }, - { - _T("cdtvdmac"), _T("CDTV DMAC"), _T("Commodore"), - cdtv_init, NULL, NULL, ROMTYPE_CDTVDMAC | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_INTERNAL - }, - { - _T("cdtvscsi"), _T("CDTV SCSI"), _T("Commodore"), - cdtvscsi_init, NULL, cdtv_add_scsi_unit, ROMTYPE_CDTVSCSI | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_AFTER_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_INTERNAL | EXPANSIONTYPE_SCSI - }, - { - _T("cdtvcr"), _T("CDTV-CR"), _T("Commodore"), - cdtvcr_init, NULL, NULL, ROMTYPE_CDTVCR | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_AFTER_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_INTERNAL - }, - { - _T("scsi_a3000"), _T("A3000 SCSI"), _T("Commodore"), - a3000scsi_init, NULL, a3000_add_scsi_unit, ROMTYPE_SCSI_A3000 | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_AFTER_Z2, true, - NULL, 0, - false, EXPANSIONTYPE_INTERNAL | EXPANSIONTYPE_SCSI - }, - { - _T("scsi_a4000t"), _T("A4000T SCSI"), _T("Commodore"), - a4000t_scsi_init, NULL, a4000t_add_scsi_unit, ROMTYPE_SCSI_A4000T | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_INTERNAL | EXPANSIONTYPE_SCSI + EXPANSIONTYPE_INTERNAL }, { _T("ide_mb"), _T("A600/A1200/A4000 IDE"), _T("Commodore"), gayle_ide_init, NULL, gayle_add_ide_unit, ROMTYPE_MB_IDE | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_INTERNAL | EXPANSIONTYPE_IDE + EXPANSIONTYPE_INTERNAL | EXPANSIONTYPE_IDE }, { _T("pcmcia_mb"), _T("A600/A1200 PCMCIA"), _T("Commodore"), gayle_pcmcia_init, NULL, gayle_add_pcmcia_unit, ROMTYPE_MB_PCMCIA | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, - NULL, 0, - false, EXPANSIONTYPE_INTERNAL - }, -#endif - - { - NULL - } -}; - -static const struct expansionboardsettings blizzardboard_settings[] = { - { - _T("MapROM"), - _T("maprom") - }, - { - NULL - } -}; - -static const struct expansionboardsettings blizzardboard_settings_mk2[] = { - { - _T("MapROM"), - _T("maprom") - }, - { - _T("SCSI Kit II"), - _T("scsikitii") - }, - { - NULL - } -}; - -static const struct cpuboardsubtype gvpboard_sub[] = { -#if 0 - - { - _T("A3001 Series I"), - _T("A3001SI"), - ROMTYPE_CB_A3001S1, 0, - gvp_add_ide_unit, EXPANSIONTYPE_IDE | EXPANSIONTYPE_24BIT, - BOARD_MEMORY_Z2, - 8 * 1024 * 1024, - 0, - gvp_ide_rom_autoconfig_init, NULL, BOARD_AUTOCONFIG_Z2, 0 - }, - { - _T("A3001 Series II"), - _T("A3001SII"), - 0, 0, - gvp_add_ide_unit, EXPANSIONTYPE_IDE | EXPANSIONTYPE_24BIT, - BOARD_MEMORY_Z2, - 8 * 1024 * 1024, - 0, - gvp_ide_rom_autoconfig_init, gvp_ide_controller_autoconfig_init, BOARD_AUTOCONFIG_Z2, 0 - }, - { - _T("A530"), - _T("GVPA530"), - ROMTYPE_GVPS2, 0, - gvp_s2_add_accelerator_scsi_unit, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_24BIT, - BOARD_MEMORY_Z2, - 8 * 1024 * 1024, - 0, - gvp_init_accelerator, NULL, BOARD_AUTOCONFIG_Z2, 1, - NULL, NULL, - 2017, 9, 0, false - }, - { - _T("G-Force 030"), - _T("GVPGFORCE030"), - ROMTYPE_GVPS2, ROMTYPE_GVPS12, - gvp_s2_add_accelerator_scsi_unit, EXPANSIONTYPE_SCSI, - BOARD_MEMORY_25BITMEM, - 128 * 1024 * 1024, - 0, - gvp_init_accelerator, NULL, BOARD_AUTOCONFIG_Z2, 1 - }, - { - _T("Tek Magic 2040/2060"), - _T("TekMagic"), - ROMTYPE_CB_TEKMAGIC, 0, - tekmagic_add_scsi_unit, EXPANSIONTYPE_SCSI, - BOARD_MEMORY_HIGHMEM, - 128 * 1024 * 1024 - }, -#endif - { - NULL - } -}; -static const struct cpuboardsubtype blizzardboard_sub[] = { -#if 0 - { - _T("Blizzard 1230 II"), - _T("Blizzard1230II"), - ROMTYPE_CB_B1230MK2, 0, - cpuboard_ncr9x_add_scsi_unit, EXPANSIONTYPE_SCSI, - BOARD_MEMORY_BLIZZARD_12xx, - 64 * 1024 * 1024, - 0, - NULL, NULL, 0, 0, - blizzardboard_settings_mk2 - }, - { - _T("Blizzard 1230 III"), - _T("Blizzard1230III"), - ROMTYPE_CB_B1230MK3, 0, - NULL, 0, - BOARD_MEMORY_BLIZZARD_12xx, - 32 * 1024 * 1024, - 0, - NULL, NULL, 0, 0, - blizzardboard_settings - }, - { - _T("Blizzard 1230 IV"), - _T("Blizzard1230IV"), - ROMTYPE_CB_BLIZ1230, 0, - NULL, EXPANSIONTYPE_FALLBACK_DISABLE | EXPANSIONTYPE_HAS_FALLBACK, - BOARD_MEMORY_BLIZZARD_12xx, - 256 * 1024 * 1024, - 0, - NULL, NULL, 0, 0, - blizzardboard_settings - }, - { - _T("Blizzard 1260"), - _T("Blizzard1260"), - ROMTYPE_CB_BLIZ1260, 0, - NULL, EXPANSIONTYPE_FALLBACK_DISABLE | EXPANSIONTYPE_HAS_FALLBACK, - BOARD_MEMORY_BLIZZARD_12xx, - 256 * 1024 * 1024, - 0, - NULL, NULL, 0, 0, - blizzardboard_settings - }, - { - _T("Blizzard 2060"), - _T("Blizzard2060"), - ROMTYPE_CB_BLIZ2060, 0, - cpuboard_ncr9x_add_scsi_unit, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_FALLBACK_DISABLE | EXPANSIONTYPE_HAS_FALLBACK, - BOARD_MEMORY_HIGHMEM, - 128 * 1024 * 1024, - 0, - NULL, NULL, 0, 0, - blizzardboard_settings - }, - { - _T("Blizzard PPC"), - _T("BlizzardPPC"), - ROMTYPE_CB_BLIZPPC, 0, - blizzardppc_add_scsi_unit, EXPANSIONTYPE_SCSI, - BOARD_MEMORY_BLIZZARD_PPC, - 256 * 1024 * 1024 - }, -#endif - { - NULL - } -}; -static const struct cpuboardsubtype cyberstormboard_sub[] = { -#if 0 - { - _T("CyberStorm MK I"), - _T("CyberStormMK1"), - ROMTYPE_CB_CSMK1, 0, - cpuboard_ncr9x_add_scsi_unit, EXPANSIONTYPE_SCSI, - BOARD_MEMORY_HIGHMEM, - 128 * 1024 * 1024 - }, - { - _T("CyberStorm MK II"), - _T("CyberStormMK2"), - ROMTYPE_CB_CSMK2, 0, - cpuboard_ncr9x_add_scsi_unit, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_FALLBACK_DISABLE | EXPANSIONTYPE_HAS_FALLBACK, - BOARD_MEMORY_HIGHMEM, - 128 * 1024 * 1024 - }, - { - _T("CyberStorm MK III"), - _T("CyberStormMK3"), - ROMTYPE_CB_CSMK3, 0, - cyberstorm_add_scsi_unit, EXPANSIONTYPE_SCSI, - BOARD_MEMORY_HIGHMEM, - 128 * 1024 * 1024 - }, - { - _T("CyberStorm PPC"), - _T("CyberStormPPC"), - ROMTYPE_CB_CSPPC, 0, - cyberstorm_add_scsi_unit, EXPANSIONTYPE_SCSI, - BOARD_MEMORY_HIGHMEM, - 128 * 1024 * 1024 - }, -#endif - { - NULL - } -}; -static const struct cpuboardsubtype warpengine_sub[] = { -#if 0 - { - _T("Warp Engine A4000"), - _T("WarpEngineA4000"), - ROMTYPE_CB_WENGINE, 0, - warpengine_add_scsi_unit, EXPANSIONTYPE_SCSI, - BOARD_MEMORY_HIGHMEM, - 128 * 1024 * 1024, - 0x01000000, - ncr710_warpengine_autoconfig_init, NULL, BOARD_AUTOCONFIG_Z3, 1, - warpengine_settings - }, -#endif - { - NULL - } -}; -static const struct expansionboardsettings mtec_settings[] = { - { - _T("SCSI disabled"), - _T("scsioff") - }, - { - NULL - } -}; -static const struct cpuboardsubtype mtec_sub[] = { -#if 0 - { - _T("E-Matrix 530"), - _T("e-matrix530"), - ROMTYPE_CB_EMATRIX, 0, - ematrix_add_scsi_unit, EXPANSIONTYPE_SCSI, - BOARD_MEMORY_CUSTOM_32, - 128 * 1024 * 1024, - 0, - ncr_ematrix_autoconfig_init, NULL, BOARD_AUTOCONFIG_Z2, 1, - mtec_settings - }, -#endif - { - NULL - } -}; - -static const struct expansionboardsettings ivsvector_settings[] = { - { - // 0/1 - _T("Memory (JP12)\0") _T("4M\0") _T("8M\0") _T("16M\0") _T("32M\0"), - _T("memory\0") _T("4m\0") _T("8m\0") _T("16m\0") _T("32m\0"), - true, false, 0 - }, - { - // 3 - _T("Disable FastROM (JP17)"), - _T("disfastrom"), - false, false, 1 - }, - { - // 4 - _T("Autoboot (JP20)"), - _T("autoboot"), - false, false, 0 - }, - { - // 5 - _T("Dis68kRAM (JP14)"), - _T("dis68kram"), - false, false, 1 - }, - { - // 6 - _T("Burst (JP13)"), - _T("burst"), - false, false, 1 - }, - { - NULL - } -}; - - -static const struct expansionboardsettings a26x0board_settings[] = { - { - _T("OSMODE (J304)"), - _T("j304") - }, - { - NULL - } -}; -static const struct cpuboardsubtype commodore_sub[] = { -#if 0 - { - _T("A2620/A2630"), - _T("A2630"), - ROMTYPE_CB_A26x0, 0, - NULL, 0, - BOARD_MEMORY_25BITMEM, - 128 * 1024 * 1024, - 0, - NULL, NULL, 0, 0, - a26x0board_settings, - cpuboard_io_special - }, -#endif - { - NULL - } -}; -static const struct cpuboardsubtype dbk_sub[] = { -#if 0 - { - _T("1230/1240"), - _T("DKB12x0"), - ROMTYPE_CB_DKB12x0, 0, - cpuboard_dkb_add_scsi_unit, EXPANSIONTYPE_SCSI, - 0, - 128 * 1024 * 1024, - 0, - ncr_dkb_autoconfig_init, NULL, BOARD_AUTOCONFIG_Z2, 0 - }, - { - _T("Wildfire"), - _T("wildfire"), - ROMTYPE_CB_DBK_WF, 0, - wildfire_add_scsi_unit, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_HAS_FALLBACK, - BOARD_MEMORY_HIGHMEM, - 128 * 1024 * 1024, - 0, - dkb_wildfire_pci_init, NULL, BOARD_NONAUTOCONFIG_BEFORE, 0 - }, -#endif - { - NULL - } -}; -static const struct cpuboardsubtype fusionforty_sub[] = { -#if 0 - { - _T("Fusion Forty"), - _T("FusionForty"), - ROMTYPE_CB_FUSION, 0, - NULL, 0, - BOARD_MEMORY_HIGHMEM, - 128 * 1024 * 1024 - }, -#endif - { - NULL - } -}; -static const struct cpuboardsubtype ivs_sub[] = { -#if 0 - { - _T("Vector"), - _T("Vector"), - ROMTYPE_CB_VECTOR, 0, - ivsvector_add_scsi_unit, EXPANSIONTYPE_SCSI, - BOARD_MEMORY_HIGHMEM, - 32 * 1024 * 1024, - 0, - ivsvector_init, NULL, BOARD_AUTOCONFIG_Z2, 1, - ivsvector_settings, NULL, - 2112, 240, 0, false - }, -#endif - { - NULL - } -}; - -static const struct expansionboardsettings apollo_settings[] = { - { - _T("SCSI module installed"), - _T("scsi") - }, - { - NULL - } -}; - -static const struct cpuboardsubtype apollo_sub[] = { -#if 0 - { - _T("Apollo 1240/1260"), - _T("Apollo"), - ROMTYPE_CB_APOLLO, 0, - apollo_add_scsi_unit, EXPANSIONTYPE_SCSI, - BOARD_MEMORY_HIGHMEM, - 128 * 1024 * 1024, - 0, - apollo_init_cpu, NULL, 2, 0, - apollo_settings - }, -#endif - { - NULL - } -}; -static const struct cpuboardsubtype kupkeboard_sub[] = { -#if 0 - { - _T("Golem 030"), - _T("golem030"), - ROMTYPE_CB_GOLEM030, 0, - NULL, 0, - BOARD_MEMORY_25BITMEM, - 16 * 1024 * 1024 - }, -#endif - { - NULL - } -}; -static const struct cpuboardsubtype icboard_sub[] = { - { - _T("ACA 500"), - _T("aca500"), - ROMTYPE_CB_ACA500, 0, - NULL, EXPANSIONTYPE_24BIT - }, - { - NULL - } -}; -static const struct cpuboardsubtype dceboard_sub[] = { -#if 0 - { - _T("SX32 Pro"), - _T("sx32pro"), - ROMTYPE_CB_SX32PRO, 0, - NULL, 0, - BOARD_MEMORY_CUSTOM_32, - 64 * 1024 * 1024 - }, -#endif - { - NULL - } -}; - -static const struct cpuboardsubtype dummy_sub[] = { - { NULL } -}; - -const struct cpuboardtype cpuboards[] = { - { - -1, - _T("-"), - dummy_sub, 0 - }, -#if 0 - { - BOARD_ACT, - _T("ACT"), - apollo_sub, 0 - }, - { - BOARD_COMMODORE, - _T("Commodore"), - commodore_sub, 0 - }, - { - BOARD_DCE, - _T("DCE"), - dceboard_sub, 0 - }, - { - BOARD_DKB, - _T("DKB"), - dbk_sub, 0 - }, - { - BOARD_GVP, - _T("Great Valley Products"), - gvpboard_sub, 0 - }, - { - BOARD_KUPKE, - _T("Kupke"), - kupkeboard_sub, 0 - }, - { - BOARD_MACROSYSTEM, - _T("MacroSystem"), - warpengine_sub, 0 - }, - { - BOARD_MTEC, - _T("M-Tec"), - mtec_sub, 0 - }, - { - BOARD_BLIZZARD, - _T("Phase 5 - Blizzard"), - blizzardboard_sub, 0 - }, - { - BOARD_CYBERSTORM, - _T("Phase 5 - CyberStorm"), - cyberstormboard_sub, 0 - }, - { - BOARD_RCS, - _T("RCS Management"), - fusionforty_sub, 0 - }, - { - BOARD_IVS, - _T("Interactive Video Systems"), - ivs_sub, 0 - }, -#endif -#if 0 - { - BOARD_IC, - _T("Individual Computers"), - icboard_sub, 0 - }, -#endif - { - NULL - } -}; - -const struct memoryboardtype memoryboards[] -{ - // z2 - { - _T("UAE"), _T("0xf00000 RAM"), - 2, 0xf00000, 0xffff, 0xff - }, - { - _T("DKB"), _T("Insider I/II"), - 2, 0x800000, 0xffff, 0xff - }, - { - _T("GVP"), _T("Impact A2000-RAM8"), - 2, 0, 2077, 9 - }, - { - _T("Kupke"), _T("Golem RAM-Card"), - 2, 0, 2073, 3 - }, - { - _T("Supra"), _T("SupraRAM 500RX"), - 2, 0, 1056, 10 - }, - { - _T("Supra"), _T("SupraRAM 2000"), - 2, 0, 1056, 9 - }, - // z3 - { - _T("E3B"), _T("ZorRAM"), - 3, 0, 3643, 32 + EXPANSIONTYPE_INTERNAL }, - { NULL } diff --git a/src/filesys.cpp b/src/filesys.cpp index dca8481c..1b5b33fc 100644 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -27,54 +27,34 @@ #include "threaddep/thread.h" #include "options.h" +#include "traps.h" #include "uae.h" #include "memory.h" #include "custom.h" #include "newcpu.h" #include "filesys.h" #include "autoconf.h" -#include "traps.h" #include "fsusage.h" #include "native2amiga.h" -#include "scsidev.h" #include "fsdb.h" #include "zfile.h" +#include "zarchive.h" #include "gui.h" +#include "gayle.h" #include "savestate.h" #include "bsdsocket.h" #include "uaeresource.h" #include "inputdevice.h" -#include "clipboard.h" #include "blkdev.h" -#ifdef RETROPLATFORM -#include "rp.h" -#endif +#include "picasso96.h" +#include "rommgr.h" -#define TRACING_ENABLED 0 -int log_filesys = 0; +#define TRAPMD 1 -#if TRACING_ENABLED -#if 0 -#define TRACE(x) if (log_filesys > 0 && (unit->volflags & MYVOLUMEINFO_CDFS)) { write_log x; } -#else -#define TRACE(x) if (log_filesys > 0) { write_log x; } -#endif -#define TRACEI(x) if (log_filesys > 0) { write_log x; } -#define TRACE2(x) if (log_filesys >= 2) { write_log x; } -#define TRACE3(x) if (log_filesys >= 3) { write_log x; } -#define DUMPLOCK(u,x) dumplock(u,x) -#else -#define TRACE(x) -#define DUMPLOCK(u,x) -#define TRACEI(x) -#define TRACE2(x) -#define TRACE3(x) -#endif +#define KS12_BOOT_HACK 1 #define UNIT_LED(unit) (LED_HD) -#define RTAREA_HEARTBEAT 0xFFFC - static int bootrom_header; static uae_u32 dlg (uae_u32 a) @@ -82,42 +62,20 @@ static uae_u32 dlg (uae_u32 a) return (dbg (a + 0) << 24) | (dbg (a + 1) << 16) | (dbg (a + 2) << 8) | (dbg (a + 3) << 0); } -static void aino_test (a_inode *aino) -{ -#ifdef AINO_DEBUG - a_inode *aino2 = aino, *aino3; - for (;;) { - if (!aino || !aino->next) - return; - if ((aino->checksum1 ^ aino->checksum2) != 0xaaaa5555) { - write_log (_T("PANIC: corrupted or freed but used aino detected!"), aino); - } - aino3 = aino; - aino = aino->next; - if (aino->prev != aino3) { - write_log (_T("PANIC: corrupted aino linking!\n")); - break; - } - if (aino == aino2) break; - } -#endif -} +#define UAEFS_VERSION "UAEfs 0.5" -static void aino_test_init (a_inode *aino) -{ -#ifdef AINO_DEBUG - aino->checksum1 = (uae_u32)aino; - aino->checksum2 = aino->checksum1 ^ 0xaaaa5555; -#endif -} - - -uaecptr filesys_initcode; +uaecptr filesys_initcode, filesys_initcode_ptr; static uaecptr bootrom_start; static uae_u32 fsdevname, fshandlername, filesys_configdev; +static uaecptr afterdos_name, afterdos_id, afterdos_initcode; static int filesys_in_interrupt; static uae_u32 mountertask; static int automountunit = -1; +static int autocreatedunit; +static uaecptr ROM_filesys_doio, ROM_filesys_doio_original; +static uaecptr ROM_filesys_putmsg, ROM_filesys_putmsg_original; +static uaecptr ROM_filesys_putmsg_return; +static uaecptr ROM_filesys_hack_remove; #define FS_STARTUP 0 #define FS_GO_DOWN 1 @@ -125,42 +83,41 @@ static int automountunit = -1; #define DEVNAMES_PER_HDF 32 #define UNIT_FILESYSTEM 0 -#define UNIT_CDFS 1 typedef struct { int unit_type; int open; // >0 start as filesystem, <0 = allocated but do not start - TCHAR *devname; /* device name, e.g. UAE0: */ - uaecptr devname_amiga; - uaecptr startup; + TCHAR *devname; /* device name, e.g. UAE0: */ + uaecptr devname_amiga; + uaecptr startup; uaecptr devicenode; uaecptr parmpacket; - TCHAR *volname; /* volume name, e.g. CDROM, WORK, etc. */ - int volflags; /* volume flags, readonly, stream uaefsdb support */ - TCHAR *rootdir; /* root native directory/hdf. empty drive if invalid path */ - struct zvolume *zarchive; - TCHAR *rootdirdiff; /* "diff" file/directory */ - bool readonly; /* disallow write access? */ - bool locked; /* action write protect */ + TCHAR *volname; /* volume name, e.g. CDROM, WORK, etc. */ + int volflags; /* volume flags, readonly, stream uaefsdb support */ + TCHAR *rootdir; /* root native directory/hdf. empty drive if invalid path */ + struct zvolume *zarchive; + TCHAR *rootdirdiff; /* "diff" file/directory */ + bool readonly; /* disallow write access? */ + bool locked; /* action write protect */ bool unknown_media; /* ID_UNREADABLE_DISK */ - int bootpri; /* boot priority. -128 = no autoboot, -129 = no mount */ - int devno; + int bootpri; /* boot priority. -128 = no autoboot, -129 = no mount */ + int devno; int controller_type; int controller_unit; - bool wasisempty; /* if true, this unit was created empty */ - bool canremove; /* if true, this unit can be safely ejected and remounted */ - bool configureddrive; /* if true, this is drive that was manually configured */ + bool wasisempty; /* if true, this unit was created empty */ + bool canremove; /* if true, this unit can be safely ejected and remounted */ + bool configureddrive; /* if true, this is drive that was manually configured */ bool inject_icons; /* inject icons if directory filesystem */ + + struct hardfiledata hf; - struct hardfiledata hf; - - /* Threading stuff */ - smp_comm_pipe *volatile unit_pipe, *volatile back_pipe; - uae_thread_id tid; - struct _unit *self; - /* Reset handling */ - uae_sem_t reset_sync_sem; - volatile int reset_state; + /* Threading stuff */ + smp_comm_pipe *volatile unit_pipe, *volatile back_pipe; + uae_thread_id tid; + struct _unit *self; + /* Reset handling */ + uae_sem_t reset_sync_sem; + volatile int reset_state; /* RDB stuff */ uaecptr rdb_devname_amiga[DEVNAMES_PER_HDF]; @@ -173,12 +130,6 @@ typedef struct { /* filesystem seglist */ uaecptr filesysseg; uae_u32 rdb_dostype; - - /* CDFS */ - bool cd_open; - int cddevno; - void *cdfs_superblock; - } UnitInfo; struct uaedev_mount_info { @@ -197,22 +148,21 @@ int nr_units (void) return cnt; } -int nr_directory_units(struct uae_prefs *p) +int nr_directory_units (struct uae_prefs *p) { - int i, cnt = 0; - if (p) { - for (i = 0; i < p->mountitems; i++) { + int i, cnt = 0; + if (p) { + for (i = 0; i < p->mountitems; i++) { if (p->mountconfig[i].ci.controller_type == HD_CONTROLLER_TYPE_UAE) - cnt++; - } - } - else { - for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) { + cnt++; + } + } else { + for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) { if (mountinfo.ui[i].open > 0 && mountinfo.ui[i].controller_type == HD_CONTROLLER_TYPE_UAE) - cnt++; - } - } - return cnt; + cnt++; + } + } + return cnt; } static int is_virtual (int unit_no) @@ -274,12 +224,6 @@ static UnitInfo *getuip(struct uae_prefs *p, int index) return NULL; return &mountinfo.ui[index]; } -static int getuindex (struct uae_prefs *p, int index) -{ - if (index < 0) - return -1; - return p->mountconfig[index].unitnum; -} int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo *mi) { @@ -307,12 +251,12 @@ int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo * } else if (uci->ci.type == UAEDEV_HDF) { ui->hf.ci.readonly = true; ui->hf.ci.blocksize = uci->ci.blocksize; - if (!hdf_open (&ui->hf, uci->ci.rootdir)) { + int err = hdf_open (&ui->hf, uci->ci.rootdir); + if (err <= 0) { mi->ismedia = false; mi->ismounted = true; + mi->error = err; if (uci->ci.reserved == 0 && uci->ci.sectors == 0 && uci->ci.surfaces == 0) { - if (ui->hf.flags & 1) - return FILESYS_HARDDRIVE; return FILESYS_HARDFILE_RDB; } return -1; @@ -331,22 +275,15 @@ int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo * mi->ismedia = di.media_inserted != 0; _tcscpy (mi->rootdir, di.label); } -#if 0 - if (ui->hf.ci.cd_emu_unit == 0) - _tcscpy (mi->rootdir, _T("CD")); - else - _stprintf (mi->rootdir, _T("CD %d"), ui->hf.ci.cd_emu_unit); -#endif } - } - else if (uci->ci.type != UAEDEV_TAPE) { + } else { if (ui->controller_type == HD_CONTROLLER_TYPE_UAE) { // what is this? || (ui->controller && p->cs_ide)) { - mi->ismounted = 1; - if (uci->ci.type == UAEDEV_HDF) - mi->ismedia = ui->hf.drive_empty ? false : true; - else - mi->ismedia = true; - } + mi->ismounted = 1; + if (uci->ci.type == UAEDEV_HDF) + mi->ismedia = ui->hf.drive_empty ? false : true; + else + mi->ismedia = true; + } } if (mi->size < 0) @@ -360,8 +297,6 @@ int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo * if (uci->ci.type == UAEDEV_DIR) return FILESYS_VIRTUAL; if (uci->ci.reserved == 0 && uci->ci.sectors == 0 && uci->ci.surfaces == 0) { - if (ui->hf.flags & 1) - return FILESYS_HARDDRIVE; return FILESYS_HARDFILE_RDB; } return FILESYS_HARDFILE; @@ -401,23 +336,23 @@ static void fixcharset (TCHAR *s) au_fs_copy (s, strlen (tmp) + 1, tmp); } -TCHAR *validatevolumename(TCHAR *s, const TCHAR *def) +TCHAR *validatevolumename (TCHAR *s, const TCHAR *def) { - stripsemicolon(s); - fixcharset(s); - striplength(s, 30); + stripsemicolon (s); + fixcharset (s); + striplength (s, 30); if (_tcslen(s) == 0 && def) { xfree(s); s = my_strdup(def); } return s; } -TCHAR *validatedevicename(TCHAR *s, const TCHAR *def) +TCHAR *validatedevicename (TCHAR *s, const TCHAR *def) { - stripsemicolon(s); - stripspace(s); - fixcharset(s); - striplength(s, 30); + stripsemicolon (s); + stripspace (s); + fixcharset (s); + striplength (s, 30); if (_tcslen(s) == 0 && def) { xfree(s); s = my_strdup(def); @@ -425,7 +360,7 @@ TCHAR *validatedevicename(TCHAR *s, const TCHAR *def) return s; } -TCHAR *filesys_createvolname(const TCHAR *volname, const TCHAR *rootdir, struct zvolume *zv, const TCHAR *def) +TCHAR *filesys_createvolname (const TCHAR *volname, const TCHAR *rootdir, struct zvolume *zv, const TCHAR *def) { TCHAR *nvol = NULL; int i, archivehd; @@ -437,6 +372,12 @@ TCHAR *filesys_createvolname(const TCHAR *volname, const TCHAR *rootdir, struct else if (my_existsdir(rootdir)) archivehd = 0; + if (zv && zv->volumename && _tcslen(zv->volumename) > 0) { + nvol = my_strdup(zv->volumename); + nvol = validatevolumename (nvol, def); + return nvol; + } + if ((!volname || _tcslen (volname) == 0) && rootdir && archivehd >= 0) { p = my_strdup (rootdir); for (i = _tcslen (p) - 1; i >= 0; i--) { @@ -460,7 +401,6 @@ TCHAR *filesys_createvolname(const TCHAR *volname, const TCHAR *rootdir, struct nvol = my_strdup (p + i); } if (!nvol && archivehd >= 0) { - TCHAR *s = NULL; if (volname && _tcslen (volname) > 0) nvol = my_strdup (volname); else @@ -472,7 +412,7 @@ TCHAR *filesys_createvolname(const TCHAR *volname, const TCHAR *rootdir, struct else nvol = my_strdup (_T("")); } - validatevolumename (nvol, def); + nvol = validatevolumename (nvol, def); xfree (p); return nvol; } @@ -544,15 +484,15 @@ static int set_filesys_unit_1 (int nr, struct uaedev_config_info *ci) } } - if (ci->controller_type != HD_CONTROLLER_TYPE_UAE || ci->type == UAEDEV_TAPE) { - ui = &mountinfo.ui[nr]; - memset(ui, 0, sizeof(UnitInfo)); - memcpy(&ui->hf.ci, &c, sizeof(struct uaedev_config_info)); - ui->readonly = c.readonly; - ui->unit_type = -1; - ui->open = -1; - return nr; - } + if (ci->controller_type != HD_CONTROLLER_TYPE_UAE) { + ui = &mountinfo.ui[nr]; + memset (ui, 0, sizeof (UnitInfo)); + memcpy (&ui->hf.ci, &c, sizeof (struct uaedev_config_info)); + ui->readonly = c.readonly; + ui->unit_type = -1; + ui->open = -1; + return nr; + } for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) { if (nr == i || !mountinfo.ui[i].open || mountinfo.ui[i].rootdir == NULL) @@ -565,6 +505,7 @@ static int set_filesys_unit_1 (int nr, struct uaedev_config_info *ci) ui = &mountinfo.ui[nr]; memset (ui, 0, sizeof (UnitInfo)); + memcpy (&ui->hf.ci, &c, sizeof (struct uaedev_config_info)); if (c.volname[0]) { int flags = 0; @@ -573,18 +514,17 @@ static int set_filesys_unit_1 (int nr, struct uaedev_config_info *ci) if (set_filesys_volume (c.rootdir, &flags, &c.readonly, &emptydrive, &ui->zarchive) < 0) return -1; } - ui->volname = filesys_createvolname(c.volname, c.rootdir, ui->zarchive, _T("harddrive")); + ui->volname = filesys_createvolname (c.volname, c.rootdir, ui->zarchive, _T("harddrive")); ui->volflags = flags; } else { ui->unit_type = UNIT_FILESYSTEM; - memcpy (&ui->hf.ci, &c, sizeof (struct uaedev_config_info)); ui->hf.unitnum = nr; ui->volname = 0; if (ui->hf.ci.rootdir[0]) { - if (!hdf_open (&ui->hf) && !c.readonly) { + if (hdf_open (&ui->hf) <= 0 && !c.readonly) { write_log (_T("Attempting to open '%s' in read-only mode.\n"), ui->hf.ci.rootdir); ui->hf.ci.readonly = c.readonly = true; - if (hdf_open (&ui->hf)) { + if (hdf_open (&ui->hf) > 0) { error_log (_T("'%s' opened in read-only mode.\n"), ui->hf.ci.rootdir); } } @@ -637,7 +577,9 @@ static int set_filesys_unit_1 (int nr, struct uaedev_config_info *ci) if (c.bootpri > 127) c.bootpri = 127; ui->bootpri = c.bootpri; + ui->inject_icons = c.inject_icons; ui->open = 1; + return nr; err: if (ui->hf.handle_valid) @@ -661,32 +603,26 @@ static int add_filesys_unit (struct uaedev_config_info *ci) return -1; ret = set_filesys_unit_1 (-1, ci); -#ifdef RETROPLATFORM - if (ret >= 0) { - rp_hd_device_enable (ret, true); - rp_harddrive_image_change (ret, ci->readonly, ci->rootdir); - } -#endif return ret; } -int kill_filesys_unitconfig(struct uae_prefs *p, int nr) +int kill_filesys_unitconfig (struct uae_prefs *p, int nr) { struct uaedev_config_data *uci; - if (nr < 0) - return 0; - uci = getuci(p->mountconfig, nr); - hardfile_do_disk_change(uci, 0); + if (nr < 0) + return 0; + uci = getuci (p->mountconfig, nr); + hardfile_do_disk_change (uci, 0); if (uci->configoffset >= 0 && uci->ci.controller_type == HD_CONTROLLER_TYPE_UAE) - filesys_media_change(uci->ci.rootdir, 0, uci); - while (nr < MOUNT_CONFIG_SIZE) { - memmove(&p->mountconfig[nr], &p->mountconfig[nr + 1], sizeof(struct uaedev_config_data)); - nr++; - } - p->mountitems--; - memset(&p->mountconfig[MOUNT_CONFIG_SIZE - 1], 0, sizeof(struct uaedev_config_data)); - return 1; + filesys_media_change (uci->ci.rootdir, 0, uci); + while (nr < MOUNT_CONFIG_SIZE) { + memmove (&p->mountconfig[nr], &p->mountconfig[nr + 1], sizeof (struct uaedev_config_data)); + nr++; + } + p->mountitems--; + memset (&p->mountconfig[MOUNT_CONFIG_SIZE - 1], 0, sizeof (struct uaedev_config_data)); + return 1; } int move_filesys_unitconfig (struct uae_prefs *p, int nr, int to) @@ -722,20 +658,105 @@ static void allocuci (struct uae_prefs *p, int nr, int idx) allocuci (p, nr, idx, -1); } +static const TCHAR *getunittype(struct uaedev_config_info *uci) +{ + return uci->type == UAEDEV_CD ? _T("CD") : _T("HD"); +} + +static int cpuboard_hd; +static romconfig cpuboard_dummy; + +static void add_cpuboard_unit_init(void) +{ + memset(&cpuboard_dummy, 0, sizeof cpuboard_dummy); + cpuboard_dummy.device_id = 7; +} + +static bool add_ide_unit(int type, int unit, struct uaedev_config_info *uci) +{ + bool added = false; + if (type >= HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST && type <= HD_CONTROLLER_TYPE_IDE_LAST) { + for (int i = 0; expansionroms[i].name; i++) { + if (i == type - HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST) { + const struct expansionromtype *ert = &expansionroms[i]; + if ((ert->deviceflags & 2) && is_board_enabled(&currprefs, ert->romtype, uci->controller_type_unit)) { + cpuboard_hd = 1; + if (ert->add) { + struct romconfig *rc = get_device_romconfig(&currprefs, ert->romtype, uci->controller_type_unit); + write_log(_T("Adding IDE %s '%s' unit %d ('%s')\n"), getunittype(uci), + ert->name, unit, uci->rootdir); + ert->add(unit, uci, rc); + } + if (cpuboard_hd) + added = true; + } + } + } + } + return added; +} + static void initialize_mountinfo(void) { int nr; UnitInfo *uip = &mountinfo.ui[0]; + autocreatedunit = 0; + for (nr = 0; nr < currprefs.mountitems; nr++) { - struct uaedev_config_data *uci = &currprefs.mountconfig[nr]; - if (uci->ci.controller_type == HD_CONTROLLER_TYPE_UAE && (uci->ci.type == UAEDEV_DIR || uci->ci.type == UAEDEV_HDF)) { - struct uaedev_config_info ci; - memcpy(&ci, &uci->ci, sizeof(struct uaedev_config_info)); - ci.flags = MYVOLUMEINFO_REUSABLE; - int idx = set_filesys_unit_1(-1, &ci); - allocuci(&currprefs, nr, idx); - } + struct uaedev_config_data *uci = &currprefs.mountconfig[nr]; + if (uci->ci.controller_type == HD_CONTROLLER_TYPE_UAE && (uci->ci.type == UAEDEV_DIR || uci->ci.type == UAEDEV_HDF)) { + struct uaedev_config_info ci; + memcpy (&ci, &uci->ci, sizeof (struct uaedev_config_info)); + ci.flags = MYVOLUMEINFO_REUSABLE; + int idx = set_filesys_unit_1 (-1, &ci); + allocuci (&currprefs, nr, idx); + } + } + nr = nr_units (); + + // init all controllers first + add_cpuboard_unit_init(); + for (int i = 0; expansionroms[i].name; i++) { + const struct expansionromtype *ert = &expansionroms[i]; + for (int j = 0; j < MAX_DUPLICATE_EXPANSION_BOARDS; j++) { + struct romconfig *rc = get_device_romconfig(&currprefs, ert->romtype, j); + if ((ert->deviceflags & 3) && rc) { + if (ert->add) { + struct uaedev_config_info ci = { 0 }; + ci.controller_type_unit = j; + ert->add(-1, &ci, rc); + } + } + } + } + + for (nr = 0; nr < currprefs.mountitems; nr++) { + struct uaedev_config_info *uci = &currprefs.mountconfig[nr].ci; + int type = uci->controller_type; + int unit = uci->controller_unit; + bool added = false; + if (type == HD_CONTROLLER_TYPE_UAE) { + continue; + } else if (type != HD_CONTROLLER_TYPE_IDE_AUTO && type >= HD_CONTROLLER_TYPE_IDE_FIRST && type <= HD_CONTROLLER_TYPE_IDE_LAST) { + added = add_ide_unit(type, unit, uci); + } else if (type == HD_CONTROLLER_TYPE_IDE_AUTO) { + for (int st = HD_CONTROLLER_TYPE_IDE_FIRST; st <= HD_CONTROLLER_TYPE_IDE_LAST; st++) { + added = add_ide_unit(st, unit, uci); + if (added) + break; + } + } else if (type == HD_CONTROLLER_TYPE_PCMCIA) { + if (uci->controller_type_unit == 0) { + gayle_add_pcmcia_sram_unit (uci); + added = true; + } else { + gayle_add_pcmcia_ide_unit (uci); + added = true; + } + } + if (added) + allocuci (&currprefs, nr, -1); } } @@ -745,7 +766,7 @@ int sprintf_filesys_unit (TCHAR *buffer, int num) if (uip[num].volname != 0) _stprintf (buffer, _T("(DH%d:) Filesystem, %s: %s %s"), num, uip[num].volname, - uip[num].rootdir, uip[num].readonly ? "ro" : ""); + uip[num].rootdir, uip[num].readonly ? _T("ro") : _T("")); else _stprintf (buffer, _T("(DH%d:) Hardfile, \"%s\", size %d Mbytes"), num, uip[num].rootdir, (int)(uip[num].hf.virtsize / (1024 * 1024))); @@ -757,6 +778,7 @@ static void free_mountinfo (void) int i; for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) close_filesys_unit (mountinfo.ui + i); + gayle_free_units (); } struct hardfiledata *get_hardfile_data (int nr) @@ -791,6 +813,8 @@ struct hardfiledata *get_hardfile_data (int nr) #define dp64_Arg4 52 #define dp64_Arg5 56 +#define dp_Max 60 + /* result codes */ #define DOS_TRUE ((uae_u32)-1L) #define DOS_FALSE (0L) @@ -804,7 +828,15 @@ struct hardfiledata *get_hardfile_data (int nr) #define ST_SOFTLINK 3 #define ST_LINKDIR 4 +#if 1 +#define MAXFILESIZE32 (0xffffffff) +#else +/* technically correct but most native + * filesystems don't enforce it + */ #define MAXFILESIZE32 (0x7fffffff) +#endif +#define MAXFILESIZE32_2G (0x7fffffff) /* Passed as type to Lock() */ #define SHARED_LOCK -2 /* File is readable by others */ @@ -863,6 +895,7 @@ struct hardfiledata *get_hardfile_data (int nr) #define ACTION_READ_LINK 1024 /* OS4 64-bit filesize packets */ +#define ACTION_FILESYSTEM_ATTR 3005 #define ACTION_CHANGE_FILE_POSITION64 8001 #define ACTION_GET_FILE_POSITION64 8002 #define ACTION_CHANGE_FILE_SIZE64 8003 @@ -885,6 +918,13 @@ struct hardfiledata *get_hardfile_data (int nr) #define DISK_TYPE_DOS_FFS 0x444f5301 /* DOS\1 */ #define CDFS_DOSTYPE 0x43440000 /* CDxx */ +typedef struct _dpacket { + uaecptr packet_addr; + uae_u8 *packet_data; + uae_u8 packet_array[dp_Max]; + bool need_flush; +} dpacket; + typedef struct { uae_u32 uniq; /* The directory we're going through. */ @@ -896,7 +936,7 @@ typedef struct { struct lockrecord { struct lockrecord *next; - uae_u32 packet; + dpacket *packet; uae_u64 pos; uae_u64 len; uae_u32 mode; @@ -946,6 +986,7 @@ typedef struct _unit { /* Amiga stuff */ uaecptr dosbase; + /* volume points to our IO board, always 1:1 mapping */ uaecptr volume; uaecptr port; /* Our port */ uaecptr locklist; @@ -964,7 +1005,7 @@ typedef struct _unit { /* ExKeys */ ExamineKey examine_keys[EXKEYS]; int next_exkey; - unsigned long total_locked_ainos; + unsigned int total_locked_ainos; /* ExAll */ ExAllKey exalls[EXALLKEYS]; @@ -976,10 +1017,10 @@ typedef struct _unit { struct lockrecord *waitingrecords; a_inode rootnode; - unsigned long aino_cache_size; + unsigned int aino_cache_size; a_inode *aino_hash[MAX_AINO_HASH]; - unsigned long nr_cache_hits; - unsigned long nr_cache_lookups; + unsigned int nr_cache_hits; + unsigned int nr_cache_lookups; struct notify *notifyhash[NOTIFY_HASH_SIZE]; @@ -1008,112 +1049,141 @@ typedef struct _unit { static uae_u32 a_uniq, key_uniq; -static void set_quadp(uaecptr p, uae_s64 v) +#define PUT_PCK_RES1(p,v) do { put_long_host((p)->packet_data + dp_Res1, (v)); } while (0) +#define PUT_PCK_RES2(p,v) do { put_long_host((p)->packet_data + dp_Res2, (v)); } while (0) +#define GET_PCK_TYPE(p) ((uae_s32)(get_long_host((p)->packet_data + dp_Type))) +#define GET_PCK_RES1(p) ((uae_s32)(get_long_host((p)->packet_data + dp_Res1))) +#define GET_PCK_RES2(p) ((uae_s32)(get_long_host((p)->packet_data + dp_Res2))) +#define GET_PCK_ARG1(p) ((uae_s32)(get_long_host((p)->packet_data + dp_Arg1))) +#define GET_PCK_ARG2(p) ((uae_s32)(get_long_host((p)->packet_data + dp_Arg2))) +#define GET_PCK_ARG3(p) ((uae_s32)(get_long_host((p)->packet_data + dp_Arg3))) +#define GET_PCK_ARG4(p) ((uae_s32)(get_long_host((p)->packet_data + dp_Arg4))) +#define GET_PCK_ARG5(p) ((uae_s32)(get_long_host((p)->packet_data + dp_Arg5))) + +#define PUT_PCK64_RES0(p,v) do { put_long_host((p)->packet_data + dp64_Res0, (v)); } while (0) +#define PUT_PCK64_RES1(p,v) do { put_long_host((p)->packet_data + dp64_Res1, (((uae_u64)v) >> 32)); put_long_host((p)->packet_data + dp64_Res1 + 4, ((uae_u32)v)); } while (0) +#define PUT_PCK64_RES2(p,v) do { put_long_host((p)->packet_data + dp64_Res2, (v)); } while (0) + +#define GET_PCK64_TYPE(p) ((uae_s32)(get_long_host((p)->packet_data + dp64_Type))) +#define GET_PCK64_RES0(p) ((uae_s32)(get_long_host((p)->packet_data + dp64_Res0))) +#define GET_PCK64_RES1(p) ( (((uae_s64)(get_long_host((p)->packet_data + dp64_Res1))) << 32) | (((uae_s64)(get_long_host((p)->packet_data + dp64_Res1 + 4))) << 0) ) +#define GET_PCK64_ARG1(p) ((uae_s32)(get_long_host((p)->packet_data + dp64_Arg1))) +#define GET_PCK64_ARG2(p) ( (((uae_s64)(get_long_host((p)->packet_data + dp64_Arg2))) << 32) | (((uae_s64)(get_long_host((p)->packet_data + dp64_Arg2 + 4))) << 0) ) +#define GET_PCK64_ARG3(p) ((uae_s32)(get_long_host((p)->packet_data + dp64_Arg3))) +#define GET_PCK64_ARG4(p) ((uae_s32)(get_long_host((p)->packet_data + dp64_Arg4))) +#define GET_PCK64_ARG5(p) ( (((uae_s64)(get_long_host((p)->packet_data + dp64_Arg5))) << 32) | (((uae_s64)(get_long_host((p)->packet_data + dp64_Arg5 + 4))) << 0) ) + +static void readdpacket(TrapContext *ctx, dpacket *packet, uaecptr pck) { - if (!valid_address(p, 8)) + // Read enough to get also all 64-bit fields + packet->packet_addr = pck; + if (!valid_address(pck, dp_Max)) { + trap_get_bytes(ctx, packet->packet_array, pck, dp_Max); + packet->packet_data = packet->packet_array; + packet->need_flush = true; + } else { + packet->packet_data = get_real_address(pck); + packet->need_flush = false; + } +} +static void writedpacket(TrapContext *ctx, dpacket *packet) +{ + if (!packet->need_flush) return; - put_long(p, v >> 32); - put_long(p + 4, (uae_u64)v); + int type = GET_PCK_TYPE(packet); + if (type >= 8000 && type < 9000 && GET_PCK64_RES0(packet) == DP64_INIT) { + // 64-bit RESx fields + trap_put_bytes(ctx, packet->packet_data + 12, packet->packet_addr + 12, 32 - 12); + } else { + // dp_Res1 and dp_Res2 + trap_put_bytes(ctx, packet->packet_data + 12, packet->packet_addr + 12, 20 - 12); + } } -static uae_u64 get_quadp(uaecptr p) + +static void set_quadp(TrapContext *ctx, uaecptr p, uae_s64 v) { - if (!valid_address(p, 8)) - return 0; - return ((uae_u64)get_long(p) << 32) | get_long(p + 4); + if (!trap_valid_address(ctx, p, 8)) + return; + trap_put_quad(ctx, p, v); +} +static uae_u64 get_quadp(TrapContext *ctx, uaecptr p) +{ + if (!trap_valid_address(ctx, p, 8)) + return 0; + return trap_get_quad(ctx, p); } - -typedef uaecptr dpacket; -#define PUT_PCK_RES1(p,v) do { put_long ((p) + dp_Res1, (v)); } while (0) -#define PUT_PCK_RES2(p,v) do { put_long ((p) + dp_Res2, (v)); } while (0) -#define GET_PCK_TYPE(p) ((uae_s32)(get_long ((p) + dp_Type))) -#define GET_PCK_RES1(p) ((uae_s32)(get_long ((p) + dp_Res1))) -#define GET_PCK_RES2(p) ((uae_s32)(get_long ((p) + dp_Res2))) -#define GET_PCK_ARG1(p) ((uae_s32)(get_long ((p) + dp_Arg1))) -#define GET_PCK_ARG2(p) ((uae_s32)(get_long ((p) + dp_Arg2))) -#define GET_PCK_ARG3(p) ((uae_s32)(get_long ((p) + dp_Arg3))) -#define GET_PCK_ARG4(p) ((uae_s32)(get_long ((p) + dp_Arg4))) -#define GET_PCK_ARG5(p) ((uae_s32)(get_long ((p) + dp_Arg5))) - -#define PUT_PCK64_RES0(p,v) do { put_long ((p) + dp64_Res0, (v)); } while (0) -#define PUT_PCK64_RES1(p,v) do { put_long ((p) + dp64_Res1, (((uae_u64)v) >> 32)); put_long ((p) + dp64_Res1 + 4, ((uae_u32)v)); } while (0) -#define PUT_PCK64_RES2(p,v) do { put_long ((p) + dp64_Res2, (v)); } while (0) - -#define GET_PCK64_TYPE(p) ((uae_s32)(get_long ((p) + dp64_Type))) -#define GET_PCK64_RES0(p) ((uae_s32)(get_long ((p) + dp64_Res0))) -#define GET_PCK64_RES1(p) ( (((uae_s64)(get_long ((p) + dp64_Res1))) << 32) | (((uae_s64)(get_long ((p) + dp64_Res1 + 4))) << 0) ) -#define GET_PCK64_ARG1(p) ((uae_s32)(get_long ((p) + dp64_Arg1))) -#define GET_PCK64_ARG2(p) ( (((uae_s64)(get_long ((p) + dp64_Arg2))) << 32) | (((uae_s64)(get_long ((p) + dp64_Arg2 + 4))) << 0) ) -#define GET_PCK64_ARG3(p) ((uae_s32)(get_long ((p) + dp64_Arg3))) -#define GET_PCK64_ARG4(p) ((uae_s32)(get_long ((p) + dp64_Arg4))) -#define GET_PCK64_ARG5(p) ( (((uae_s64)(get_long ((p) + dp64_Arg5))) << 32) | (((uae_s64)(get_long ((p) + dp64_Arg5 + 4))) << 0) ) static int flush_cache(Unit *unit, int num); -static TCHAR *char1 (uaecptr addr) +static TCHAR *char1 (TrapContext *ctx, uaecptr addr) { - static uae_char buf[1024]; - static TCHAR bufx[1024]; + uae_char buf[1024]; + +#if TRAPMD + trap_get_string(ctx, (uae_u8*)buf, addr, sizeof(buf)); +#else unsigned int i = 0; do { - buf[i] = get_byte(addr); + buf[i] = trap_get_byte(ctx, addr); addr++; } while (buf[i++] && i < sizeof(buf)); - return au_fs_copy (bufx, sizeof (bufx) / sizeof (TCHAR), buf); +#endif + return au_fs(buf); } -static TCHAR *bstr1 (uaecptr addr) +static TCHAR *bstr1 (TrapContext *ctx, uaecptr addr) { - static TCHAR bufx[257]; - static uae_char buf[257]; - int i; - int n = get_byte(addr); + uae_char buf[257]; + int n = trap_get_byte(ctx, addr); + addr++; - - for (i = 0; i < n; i++, addr++) - buf[i] = get_byte(addr); - buf[i] = 0; - return au_fs_copy (bufx, sizeof (bufx) / sizeof (TCHAR), buf); +#if TRAPMD + trap_get_bytes(ctx, (uae_u8*)buf, addr, n); +#else + for (int i = 0; i < n; i++, addr++) + buf[i] = trap_get_byte(ctx, addr); +#endif + buf[n] = 0; + return au_fs(buf); } -static TCHAR *bstr (Unit *unit, uaecptr addr) +static TCHAR *bstr (TrapContext *ctx, Unit *unit, uaecptr addr) { - int i; - int n = get_byte(addr); + int n = trap_get_byte(ctx, addr); uae_char buf[257]; addr++; - for (i = 0; i < n; i++, addr++) - buf[i] = get_byte (addr); - buf[i] = 0; +#if TRAPMD + trap_get_bytes(ctx, (uae_u8*)buf, addr, n); +#else + for (int i = 0; i < n; i++, addr++) + buf[i] = trap_get_byte(ctx, addr); +#endif + buf[n] = 0; au_fs_copy (unit->tmpbuf3, sizeof (unit->tmpbuf3) / sizeof (TCHAR), buf); return unit->tmpbuf3; } -static TCHAR *cstr (Unit *unit, uaecptr addr) +static TCHAR *cstr (TrapContext *ctx, Unit *unit, uaecptr addr) { - int i; uae_char buf[257]; - for (i = 0;;i++,addr++) { - buf[i] = get_byte (addr); - if (!buf[i]) - break; - } + trap_get_string(ctx, buf, addr, sizeof buf); au_fs_copy (unit->tmpbuf3, sizeof (unit->tmpbuf3) / sizeof (TCHAR), buf); return unit->tmpbuf3; } -static TCHAR *bstr_cut (Unit *unit, uaecptr addr) +static TCHAR *bstr_cut (TrapContext *ctx, Unit *unit, uaecptr addr) { TCHAR *p = unit->tmpbuf3; int i, colon_seen = 0, off; - int n = get_byte (addr); + int n = trap_get_byte(ctx, addr); uae_char buf[257]; off = 0; addr++; for (i = 0; i < n; i++, addr++) { - uae_u8 c = get_byte(addr); + uae_u8 c = trap_get_byte(ctx, addr); buf[i] = c; if (c == '/' || (c == ':' && colon_seen++ == 0)) off = i + 1; @@ -1127,7 +1197,7 @@ static TCHAR *bstr_cut (Unit *unit, uaecptr addr) static const uae_s64 msecs_per_day = 24 * 60 * 60 * 1000; static const uae_s64 diff = ((8 * 365 + 2) * (24 * 60 * 60)) * (uae_u64)1000; -void timeval_to_amiga (struct mytimeval *tv, int *days, int *mins, int *ticks) +void timeval_to_amiga (struct mytimeval *tv, int *days, int *mins, int *ticks, int tickcount) { /* tv.tv_sec is secs since 1-1-1970 */ /* days since 1-1-1978 */ @@ -1142,10 +1212,10 @@ void timeval_to_amiga (struct mytimeval *tv, int *days, int *mins, int *ticks) t -= *days * msecs_per_day; *mins = t / (60 * 1000); t -= *mins * (60 * 1000); - *ticks = t / (1000 / 50); + *ticks = t / (1000 / tickcount); } -void amiga_to_timeval (struct mytimeval *tv, int days, int mins, int ticks) +void amiga_to_timeval (struct mytimeval *tv, int days, int mins, int ticks, int tickcount) { uae_s64 t; @@ -1155,7 +1225,7 @@ void amiga_to_timeval (struct mytimeval *tv, int days, int mins, int ticks) days = 9900 * 365; // in future far enough? if (mins < 0 || mins >= 24 * 60) mins = 0; - if (ticks < 0 || ticks >= 60 * 50) + if (ticks < 0 || ticks >= 60 * tickcount) ticks = 0; t = ticks * 20; @@ -1169,8 +1239,7 @@ void amiga_to_timeval (struct mytimeval *tv, int days, int mins, int ticks) static Unit *units = 0; -static Unit* - find_unit (uaecptr port) +static Unit *find_unit (uaecptr port) { Unit* u; for (u = units; u; u = u->next) @@ -1277,6 +1346,19 @@ static uae_u32 fs_fsize (struct fs_filehandle *fsf) return (uae_u32)fs_fsize64 (fsf); } +static uae_s64 key_filesize(Key *k) +{ + if (k->aino->vfso) + return k->aino->vfso->size; + return fs_fsize64 (k->fd); +} +static uae_s64 key_seek(Key *k, uae_s64 offset, int whence) +{ + if (k->aino->vfso) + return k->file_pos; + return fs_lseek64 (k->fd, offset, whence); +} + static void set_volume_name (Unit *unit, struct mytimeval *tv) { int namelen; @@ -1285,13 +1367,15 @@ static void set_volume_name (Unit *unit, struct mytimeval *tv) s = ua_fs (unit->ui.volname, -1); namelen = strlen (s); - put_byte (unit->volume + 44, namelen); + if (namelen >= 58) + namelen = 58; + put_byte (unit->volume + 64, namelen); for (i = 0; i < namelen; i++) - put_byte (unit->volume + 45 + i, s[i]); - put_byte (unit->volume + 45 + namelen, 0); + put_byte (unit->volume + 64 + 1 + i, s[i]); + put_byte (unit->volume + 64 + 1 + namelen, 0); if (tv && (tv->tv_sec || tv->tv_usec)) { int days, mins, ticks; - timeval_to_amiga (tv, &days, &mins, &ticks); + timeval_to_amiga (tv, &days, &mins, &ticks, 50); put_long (unit->volume + 16, days); put_long (unit->volume + 20, mins); put_long (unit->volume + 24, ticks); @@ -1306,7 +1390,7 @@ static int filesys_isvolume(Unit *unit) { if (!unit->volume) return 0; - return get_byte (unit->volume + 44) || unit->ui.unknown_media; + return get_byte (unit->volume + 64) || unit->ui.unknown_media; } static void clear_exkeys(Unit *unit) @@ -1378,25 +1462,38 @@ int filesys_eject (int nr) } static uae_u32 heartbeat; -static int heartbeat_count; -static int heartbeat_task; -// This uses filesystem process to reduce resource usage -void setsystime (void) +static uae_u32 REGPARAM2 debugger_helper(TrapContext *ctx) { - if (!currprefs.tod_hack || !rtarea_base) - return; - heartbeat = get_long (rtarea_base + RTAREA_HEARTBEAT); - heartbeat_task = 1; - heartbeat_count = 10; + int mode = trap_get_dreg(ctx, 1); + switch (mode) + { + case 1: + // Execute debugger_boot() to get here. + write_log(_T("debugger #1\n")); + // return RunCommand(() parameters + // does nothing if D1 == 0. + break; + case 2: + // called when RunCommand() returns + // D0 = RunCommand() return code. + write_log(_T("debugger #2\n")); + break; + default: + write_log(_T("Unknown debugger hook %d\n"), mode); + return 0; + } + return 1; } -static void setsystime_vblank (void) +static void debugger_boot(void) { Unit *u; + TrapContext *ctx = NULL; + for (u = units; u; u = u->next) { - if (is_virtual (u->unit) && filesys_isvolume (u)) { - put_byte (u->volume + 173 - 32, 1); + if (is_virtual(u->unit) && filesys_isvolume(u)) { + put_byte(u->volume + 173 - 32, get_byte(u->volume + 173 - 32) | 2); uae_Signal (get_long (u->volume + 176 - 32), 1 << 13); break; } @@ -1407,6 +1504,7 @@ int filesys_insert (int nr, const TCHAR *volume, const TCHAR *rootdir, bool read { UnitInfo *ui; Unit *u; + TrapContext *ctx = NULL; if (!mountertask) return 0; @@ -1462,7 +1560,7 @@ int filesys_insert (int nr, const TCHAR *volume, const TCHAR *rootdir, bool read return 100 + nr; } -static uae_u32 filesys_media_change_reply (TrapContext *ctx, int mode) +static uae_u32 filesys_media_change_reply (int mode) { int nr; UnitInfo *ui = NULL; @@ -1487,12 +1585,6 @@ static uae_u32 filesys_media_change_reply (TrapContext *ctx, int mode) zfile_fclose_archive (u->zarchive); u->zarchive = NULL; u->ui.unknown_media = false; -#ifdef RETROPLATFORM - if (ui->unit_type == UNIT_CDFS) - rp_cd_image_change (ui->cddevno, NULL); - else - rp_harddrive_image_change (nr, false, NULL); -#endif } else { u->mount_changed = 0; } @@ -1503,6 +1595,7 @@ static uae_u32 filesys_media_change_reply (TrapContext *ctx, int mode) struct mytimeval ctime = { 0 }; bool emptydrive = false; struct uaedev_config_data *uci = NULL; + clear_exkeys (u); xfree (u->ui.rootdir); ui->rootdir = u->ui.rootdir = my_strdup (u->mount_rootdir); @@ -1514,11 +1607,9 @@ static uae_u32 filesys_media_change_reply (TrapContext *ctx, int mode) if (emptydrive) return 0; xfree (u->ui.volname); - ui->volname = u->ui.volname = filesys_createvolname(u->mount_volume, u->mount_rootdir, u->zarchive, _T("removable")); -#ifdef RETROPLATFORM - rp_harddrive_image_change (nr, u->mount_readonly, u->mount_rootdir); -#endif + ui->volname = u->ui.volname = filesys_createvolname (u->mount_volume, u->mount_rootdir, u->zarchive, _T("removable")); uci = getuci (currprefs.mountconfig, nr); + if (u->ui.unknown_media) { write_log (_T("FILESYS: inserted unreadable volume NR=%d RO=%d\n"), nr, u->mount_readonly); } else { @@ -1535,7 +1626,7 @@ static uae_u32 filesys_media_change_reply (TrapContext *ctx, int mode) if (uci != NULL) uci->ci.readonly = u->mount_readonly; } - put_byte (u->volume + 44, 0); + put_byte (u->volume + 64, 0); put_byte (u->volume + 172 - 32, 1); } @@ -1560,6 +1651,7 @@ int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_conf int nr = -1; TCHAR volname[MAX_DPATH], *volptr; TCHAR devname[MAX_DPATH]; + TrapContext *ctx = NULL; if (!mountertask) return 0; @@ -1600,9 +1692,10 @@ int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_conf if (uci) { volptr = my_strdup (uci->ci.volname); } else { - struct uaedev_config_info ci2 = { 0 }; - _tcscpy(ci2.rootdir, rootdir); - target_get_volume_name(&mountinfo, &ci2, 1, 0, -1); + struct uaedev_config_info ci2 = { 0 }; + _tcscpy(ci2.rootdir, rootdir); + target_get_volume_name (&mountinfo, &ci2, 1, 0, -1); + _tcscpy(volname, ci2.volname); volptr = volname; if (!volname[0]) volptr = NULL; @@ -1612,7 +1705,7 @@ int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_conf } } if (!volptr) { - volptr = filesys_createvolname(NULL, rootdir, NULL, _T("removable")); + volptr = filesys_createvolname (NULL, rootdir, NULL, _T("removable")); _tcscpy (volname, volptr); xfree (volptr); volptr = volname; @@ -1638,7 +1731,7 @@ int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_conf if (uci) _tcscpy (devname, uci->ci.devname); else - _stprintf (devname, _T("RDH%d"), nr_units()); + _stprintf (devname, _T("RDH%d"), autocreatedunit++); _tcscpy (ci.devname, devname); _tcscpy (ci.volname, volptr); _tcscpy (ci.rootdir, rootdir); @@ -1658,6 +1751,17 @@ int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_conf return 0; } +int hardfile_added (struct uaedev_config_info *ci) +{ + if (ci->controller_type == HD_CONTROLLER_TYPE_PCMCIA) { + if (ci->controller_type_unit == 1) + return gayle_add_pcmcia_ide_unit(ci); + if (ci->controller_type_unit == 0) + return gayle_add_pcmcia_sram_unit(ci); + } + return 0; +} + int hardfile_media_change (struct hardfiledata *hfd, struct uaedev_config_info *ci, bool inserted, bool timer) { if (!hfd) @@ -1679,7 +1783,7 @@ int hardfile_media_change (struct hardfiledata *hfd, struct uaedev_config_info * } } memcpy (&hfd->ci, &hfd->delayedci, sizeof (struct uaedev_config_info)); - if (!hdf_open (hfd)) { + if (hdf_open (hfd) <= 0) { write_log (_T("HARDFILE: '%s' failed to open\n"), hfd->ci.rootdir); return 0; } @@ -1715,23 +1819,9 @@ int hardfile_media_change (struct hardfiledata *hfd, struct uaedev_config_info * return 0; } -int hardfile_remount (int nr) -{ - /* this does work but every media reinsert duplicates the device.. */ -#if 0 - if (!mountertask) - return 0; - automountunit = nr; - uae_Signal (mountertask, 1 << 13); -#endif - return 1; -} - /* flags and comments supported? */ static int fsdb_cando (Unit *unit) { - if (unit->volflags & MYVOLUMEINFO_ARCHIVE) - return 1; return 1; } @@ -1741,7 +1831,6 @@ static void prepare_for_open (TCHAR *name) static void de_recycle_aino (Unit *unit, a_inode *aino) { - aino_test (aino); if (aino->next == 0 || aino == &unit->rootnode) return; aino->next->prev = aino->prev; @@ -1790,11 +1879,9 @@ static int flush_cache(Unit *unit, int num) a_inode **aip; aip = &parent->child; - aino_test (parent); if (parent && !parent->locked_children) { for (;;) { a_inode *aino = *aip; - aino_test (aino); if (aino == 0) break; /* Not recyclable if next == 0 (i.e., not chained into @@ -1836,34 +1923,21 @@ static int flush_cache(Unit *unit, int num) static void recycle_aino (Unit *unit, a_inode *new_aino) { - aino_test (new_aino); if (new_aino->dir || new_aino->shlock > 0 || new_aino->elock || new_aino == &unit->rootnode) /* Still in use */ return; - TRACE3((_T("Recycling; cache size %d, total_locked %d\n"), - unit->aino_cache_size, unit->total_locked_ainos)); if (unit->aino_cache_size > 5000 + unit->total_locked_ainos) { /* Reap a few. */ flush_cache (unit, 50); -#if 0 - { - TCHAR buffer[40]; - _stprintf (buffer, "%d ainos reaped.\n", i); - TRACE ((buffer)); - } -#endif } - aino_test (new_aino); /* Chain it into circular list. */ new_aino->next = unit->rootnode.next; new_aino->prev = &unit->rootnode; new_aino->prev->next = new_aino; new_aino->next->prev = new_aino; - aino_test (new_aino->next); - aino_test (new_aino->prev); unit->aino_cache_size++; } @@ -1881,7 +1955,7 @@ static void update_child_names (Unit *unit, a_inode *a, a_inode *parent) TCHAR *new_name; TCHAR dirsep[2] = { FSDB_DIR_SEPARATOR, '\0' }; - a->parent = parent; + a->parent = parent; name_start = _tcsrchr (a->nname, FSDB_DIR_SEPARATOR); if (name_start == 0) { write_log (_T("malformed file name")); @@ -1901,8 +1975,6 @@ static void update_child_names (Unit *unit, a_inode *a, a_inode *parent) static void move_aino_children (Unit *unit, a_inode *from, a_inode *to) { - aino_test (from); - aino_test (to); to->child = from->child; from->child = 0; update_child_names (unit, to->child, to); @@ -1912,9 +1984,6 @@ static void delete_aino (Unit *unit, a_inode *aino) { a_inode **aip; - TRACE((_T("deleting aino %x\n"), aino->uniq)); - - aino_test (aino); aino->dirty = 1; aino->deleted = 1; de_recycle_aino (unit, aino); @@ -1922,16 +1991,13 @@ static void delete_aino (Unit *unit, a_inode *aino) /* If any ExKeys are currently pointing at us, advance them. */ if (aino->parent->exnext_count > 0) { int i; - TRACE((_T("entering exkey validation\n"))); for (i = 0; i < EXKEYS; i++) { ExamineKey *k = unit->examine_keys + i; if (k->uniq == 0) continue; if (k->aino == aino->parent) { - TRACE((_T("Same parent found for %d\n"), i)); if (k->curr_file == aino) { k->curr_file = aino->sibling; - TRACE((_T("Advancing curr_file\n"))); } } } @@ -1995,12 +2061,11 @@ static a_inode *lookup_aino (Unit *unit, uae_u32 uniq) unit->nr_cache_hits++; unit->nr_cache_lookups++; unit->aino_hash[hash] = a; - aino_test (a); return a; } -static a_inode *aino_from_lock (Unit *unit, uaecptr lock) +static a_inode *aino_from_lock (TrapContext *ctx, Unit *unit, uaecptr lock) { - return lookup_aino (unit, get_long (lock + 4)); + return lookup_aino (unit, trap_get_long(ctx, lock + 4)); } TCHAR *build_nname (const TCHAR *d, const TCHAR *n) @@ -2027,7 +2092,6 @@ TCHAR *build_aname (const TCHAR *d, const TCHAR *n) static TCHAR *get_nname (Unit *unit, a_inode *base, TCHAR *rel, TCHAR **modified_rel, uae_u64 *uniq_ext) { TCHAR *found; - TCHAR *p = 0; *modified_rel = 0; @@ -2037,8 +2101,6 @@ static TCHAR *get_nname (Unit *unit, a_inode *base, TCHAR *rel, TCHAR **modified return NULL; } - aino_test (base); - /* If we have a mapping of some other aname to "rel", we must pretend * it does not exist. * This can happen for example if an Amiga program creates a @@ -2070,27 +2132,15 @@ static TCHAR *create_nname (Unit *unit, a_inode *base, TCHAR *rel) { TCHAR *p; - aino_test (base); /* We are trying to create a file called REL. */ /* If the name is used otherwise in the directory (or globally), we * need a new unique nname. */ if (fsdb_name_invalid (rel) || fsdb_used_as_nname (base, rel)) { -#if 0 -oh_dear: -#endif p = fsdb_create_unique_nname (base, rel); return p; } p = build_nname (base->nname, rel); -#if 0 - /* Delete this code once we know everything works. */ - if (access (p, R_OK) >= 0 || errno != ENOENT) { - write_log (_T("Filesystem in trouble... please report.\n")); - xfree (p); - goto oh_dear; - } -#endif return p; } @@ -2161,9 +2211,6 @@ static void init_child_aino (Unit *unit, a_inode *base, a_inode *aino) base->locked_children++; } init_child_aino_tree(unit, base, aino); - - aino_test_init (aino); - aino_test (aino); } static a_inode *new_child_aino (Unit *unit, a_inode *base, TCHAR *rel) @@ -2173,8 +2220,6 @@ static a_inode *new_child_aino (Unit *unit, a_inode *base, TCHAR *rel) a_inode *aino = NULL; int isvirtual = unit->volflags & MYVOLUMEINFO_ARCHIVE; - TRACE((_T("new_child_aino %s, %s\n"), base->aname, rel)); - if (!isvirtual) aino = fsdb_lookup_aino_aname (base, rel); if (aino == 0) { @@ -2203,7 +2248,6 @@ static a_inode *new_child_aino (Unit *unit, a_inode *base, TCHAR *rel) init_child_aino (unit, base, aino); recycle_aino (unit, aino); - TRACE((_T("created aino %x, lookup, amigaos_mode %d\n"), aino->uniq, aino->amigaos_mode)); return aino; } @@ -2229,7 +2273,6 @@ static a_inode *create_child_aino (Unit *unit, a_inode *base, TCHAR *rel, int is aino->dirty = 1; recycle_aino (unit, aino); - TRACE((_T("created aino %x, create\n"), aino->uniq)); return aino; } @@ -2238,9 +2281,6 @@ static a_inode *lookup_child_aino (Unit *unit, a_inode *base, TCHAR *rel, int *e a_inode *c = base->child; int l0 = _tcslen (rel); - aino_test (base); - aino_test (c); - if (base->dir == 0) { *err = ERROR_OBJECT_WRONG_TYPE; return 0; @@ -2262,15 +2302,12 @@ static a_inode *lookup_child_aino (Unit *unit, a_inode *base, TCHAR *rel, int *e } /* Different version because for this one, REL is an nname. */ -static a_inode *lookup_child_aino_for_exnext (Unit *unit, a_inode *base, TCHAR *rel, uae_u32 *err, uae_u64 uniq_external) +static a_inode *lookup_child_aino_for_exnext (Unit *unit, a_inode *base, TCHAR *rel, uae_u32 *err, uae_u64 uniq_external, struct virtualfilesysobject *vfso) { a_inode *c = base->child; int l0 = _tcslen (rel); int isvirtual = unit->volflags & MYVOLUMEINFO_ARCHIVE; - aino_test (base); - aino_test (c); - *err = 0; while (c != 0) { int l1 = _tcslen (c->nname); @@ -2282,7 +2319,7 @@ static a_inode *lookup_child_aino_for_exnext (Unit *unit, a_inode *base, TCHAR * } if (c != 0) return c; - if (!isvirtual) + if (!isvirtual && !vfso) c = fsdb_lookup_aino_nname (base, rel); if (c == 0) { c = xcalloc (a_inode, 1); @@ -2296,18 +2333,22 @@ static a_inode *lookup_child_aino_for_exnext (Unit *unit, a_inode *base, TCHAR * c->comment = 0; c->uniq_external = uniq_external; c->has_dbentry = 0; - if (!fill_file_attrs(unit, base, c)) { + if (vfso) { + c->dir = vfso->dir; + c->comment = my_strdup(vfso->comment); + c->amigaos_mode = vfso->amigaos_mode; + c->vfso = vfso; + } else if (!fill_file_attrs (unit, base, c)) { xfree (c); *err = ERROR_NO_FREE_STORE; return 0; } - if (c->dir && !isvirtual) + if (c->dir && !isvirtual && !vfso) fsdb_clean_dir (c); } init_child_aino (unit, base, c); recycle_aino (unit, c); - TRACE((_T("created aino %x, exnext\n"), c->uniq)); return c; } @@ -2319,10 +2360,7 @@ static a_inode *get_aino (Unit *unit, a_inode *base, const TCHAR *rel, int *err) a_inode *curr; int i; - aino_test (base); - *err = 0; - TRACE((_T("get_path(%s,%s)\n"), base->aname, rel)); /* root-relative path? */ for (i = 0; rel[i] && rel[i] != '/' && rel[i] != ':'; i++) @@ -2339,28 +2377,27 @@ static a_inode *get_aino (Unit *unit, a_inode *base, const TCHAR *rel, int *err) if (*p == '/') { if (curr->parent != 0) curr = curr->parent; - p++; - } else { - a_inode *next; + p++; + } else { + a_inode *next; - TCHAR *component_end; - component_end = _tcschr (p, '/'); - if (component_end != 0) - *component_end = '\0'; - next = lookup_child_aino (unit, curr, p, err); - if (next == 0) { - /* if only last component not found, return parent dir. */ - if (*err != ERROR_OBJECT_NOT_AROUND || component_end != 0) - curr = NULL; - /* ? what error is appropriate? */ - break; - } - curr = next; - if (component_end) - p = component_end+1; - else - break; - + TCHAR *component_end; + component_end = _tcschr (p, '/'); + if (component_end != 0) + *component_end = '\0'; + next = lookup_child_aino (unit, curr, p, err); + if (next == 0) { + /* if only last component not found, return parent dir. */ + if (*err != ERROR_OBJECT_NOT_AROUND || component_end != 0) + curr = NULL; + /* ? what error is appropriate? */ + break; + } + curr = next; + if (component_end) + p = component_end+1; + else + break; } } xfree (tmp); @@ -2386,15 +2423,6 @@ static Notify *new_notify (Unit *unit, TCHAR *name) return n; } -#if 0 -static void free_notify_item(Notify *n) -{ - xfree(n->fullname); - xfree(n->partname); - xfree(n); -} -#endif - static void free_notify (Unit *unit, int hash, Notify *n) { Notify *n1, *prev = 0; @@ -2420,7 +2448,7 @@ static void startup_update_unit (Unit *unit, UnitInfo *uinfo) unit->ui.volname = my_strdup (uinfo->volname); /* might free later for rename */ } -static Unit *startup_create_unit (UnitInfo *uinfo, int num) +static Unit *startup_create_unit (TrapContext *ctx, UnitInfo *uinfo, int num) { int i; Unit *unit, *u; @@ -2438,7 +2466,7 @@ static Unit *startup_create_unit (UnitInfo *uinfo, int num) uinfo->self = unit; unit->volume = 0; - unit->port = m68k_areg (regs, 5); + unit->port = trap_get_areg(ctx, 5); unit->unit = num; startup_update_unit (unit, uinfo); @@ -2475,7 +2503,6 @@ static Unit *startup_create_unit (UnitInfo *uinfo, int num) unit->rootnode.comment = 0; unit->rootnode.has_dbentry = 0; unit->rootnode.volflags = uinfo->volflags; - aino_test_init (&unit->rootnode); unit->aino_cache_size = 0; for (i = 0; i < MAX_AINO_HASH; i++) unit->aino_hash[i] = 0; @@ -2498,7 +2525,7 @@ static void filesys_start_thread (UnitInfo *ui, int nr) if (is_virtual (nr)) { ui->unit_pipe = xmalloc (smp_comm_pipe, 1); ui->back_pipe = xmalloc (smp_comm_pipe, 1); - init_comm_pipe (ui->unit_pipe, 100, 3); + init_comm_pipe (ui->unit_pipe, 400, 3); init_comm_pipe (ui->back_pipe, 100, 1); uae_start_thread (_T("filesys"), filesys_thread, (void *)ui, &ui->tid); } @@ -2508,18 +2535,24 @@ static void filesys_start_thread (UnitInfo *ui, int nr) } } -static uae_u32 REGPARAM2 startup_handler (TrapContext *context) +static uae_u32 REGPARAM2 startup_handler (TrapContext *ctx) { + uae_u32 mode = trap_get_dreg(ctx, 0); + + if (mode == 1) { + return 0; + } + /* Just got the startup packet. It's in D3. DosBase is in A2, * our allocated volume structure is in A3, A5 is a pointer to * our port. */ - uaecptr rootnode = get_long (m68k_areg (regs, 2) + 34); - uaecptr dos_info = get_long (rootnode + 24) << 2; - uaecptr pkt = m68k_dreg (regs, 3); - uaecptr arg1 = get_long (pkt + dp_Arg1); - uaecptr arg2 = get_long (pkt + dp_Arg2); - uaecptr arg3 = get_long (pkt + dp_Arg3); - uaecptr devnode; + uaecptr rootnode = trap_get_long(ctx, trap_get_areg(ctx, 2) + 34); + uaecptr dos_info = trap_get_long(ctx, rootnode + 24) << 2; + uaecptr pkt = trap_get_dreg(ctx, 3); + uaecptr arg1 = trap_get_long(ctx, pkt + dp_Arg1); + uaecptr arg2 = trap_get_long(ctx, pkt + dp_Arg2); + uaecptr arg3 = trap_get_long(ctx, pkt + dp_Arg3); + uaecptr devnode, volume; int nr; Unit *unit; UnitInfo *uinfo; @@ -2540,28 +2573,28 @@ static uae_u32 REGPARAM2 startup_handler (TrapContext *context) continue; if (!is_virtual (nr)) continue; - if (mountinfo.ui[nr].startup == arg2) break; } if (nr == MAX_FILESYSTEM_UNITS) { write_log (_T("Attempt to mount unknown filesystem device\n")); - put_long (pkt + dp_Res1, DOS_FALSE); - put_long (pkt + dp_Res2, ERROR_DEVICE_NOT_MOUNTED); + trap_put_long(ctx, pkt + dp_Res1, DOS_FALSE); + trap_put_long(ctx, pkt + dp_Res2, ERROR_DEVICE_NOT_MOUNTED); return 0; } uinfo = mountinfo.ui + nr; //devnode = arg3 << 2; devnode = uinfo->devicenode; + volume = trap_get_areg(ctx, 3) + 32; cdays = 3800 + nr; ed = my_existsdir (uinfo->rootdir); ef = my_existsfile (uinfo->rootdir); if (!uinfo->wasisempty && !ef && !ed) { write_log (_T("Failed attempt to mount device '%s' (%s)\n"), uinfo->devname, uinfo->rootdir); - put_long (pkt + dp_Res1, DOS_FALSE); - put_long (pkt + dp_Res2, ERROR_DEVICE_NOT_MOUNTED); + trap_put_long(ctx, pkt + dp_Res1, DOS_FALSE); + trap_put_long(ctx, pkt + dp_Res2, ERROR_DEVICE_NOT_MOUNTED); return 0; } @@ -2569,7 +2602,7 @@ static uae_u32 REGPARAM2 startup_handler (TrapContext *context) late = 1; filesys_start_thread (uinfo, nr); } - unit = startup_create_unit (uinfo, nr); + unit = startup_create_unit(ctx, uinfo, nr); unit->volflags = uinfo->volflags; unit->rootnode.uniq_external = uniq; @@ -2579,20 +2612,20 @@ static uae_u32 REGPARAM2 startup_handler (TrapContext *context) unit->ui.volname, unit->volflags, uinfo->wasisempty, ed, ef, unit->ui.rootdir); /* fill in our process in the device node */ - put_long (devnode + 8, unit->port); - unit->dosbase = m68k_areg (regs, 2); + trap_put_long(ctx, devnode + 8, unit->port); + unit->dosbase = trap_get_areg(ctx, 2); /* make new volume */ - unit->volume = m68k_areg (regs, 3) + 32; + unit->volume = volume; put_long (unit->volume + 180 - 32, devnode); #ifdef UAE_FILESYS_THREADS - unit->locklist = m68k_areg (regs, 3) + 8; + unit->locklist = trap_get_areg(ctx, 3) + 8; #else - unit->locklist = m68k_areg (regs, 3); + unit->locklist = trap_get_areg(ctx, 3); #endif - unit->dummy_message = m68k_areg (regs, 3) + 12; + unit->dummy_message = trap_get_areg(ctx, 3) + 12; - put_long (unit->dummy_message + 10, 0); + trap_put_long(ctx, unit->dummy_message + 10, 0); /* Prepare volume information */ put_long (unit->volume + 4, 2); /* Type = dt_volume */ @@ -2601,9 +2634,9 @@ static uae_u32 REGPARAM2 startup_handler (TrapContext *context) put_long (unit->volume + 20, 0); put_long (unit->volume + 24, 0); put_long (unit->volume + 28, 0); /* lock list */ - put_long (unit->volume + 40, (unit->volume + 44) >> 2); /* Name */ + put_long (unit->volume + 40, (unit->volume + 64) >> 2); /* Name */ - put_byte (unit->volume + 44, 0); + put_byte (unit->volume + 64, 0); if (!uinfo->wasisempty && !uinfo->unknown_media) { int isvirtual = unit->volflags & (MYVOLUMEINFO_ARCHIVE); /* Set volume if non-empty */ @@ -2613,25 +2646,30 @@ static uae_u32 REGPARAM2 startup_handler (TrapContext *context) } put_long (unit->volume + 8, unit->port); - put_long (unit->volume + 32, DISK_TYPE_DOS_FFS); + /* not FFS because it is not understood by WB1.x C:Info */ + put_long(unit->volume + 32, DISK_TYPE_DOS); - put_long (pkt + dp_Res1, DOS_TRUE); + trap_put_long(ctx, pkt + dp_Res1, DOS_TRUE); return 1 | (late ? 2 : 0); } -static void - do_info (Unit *unit, dpacket packet, uaecptr info, bool disk_info) +static bool is_writeprotected(Unit *unit) +{ + return unit->ui.readonly || unit->ui.locked || currprefs.harddrive_read_only; +} + +static void do_info(TrapContext *ctx, Unit *unit, dpacket *packet, uaecptr info, bool disk_info) { struct fs_usage fsu; int ret, err = ERROR_NO_FREE_STORE; int blocksize, nr; uae_u32 dostype; bool fs = false, media = false; + uae_u8 buf[36] = { 0 }; // InfoData blocksize = 512; - /* not FFS because it is not understood by WB1.x C:Info */ - dostype = DISK_TYPE_DOS; + dostype = get_long(unit->volume + 32); nr = unit->unit; if (unit->volflags & MYVOLUMEINFO_ARCHIVE) { ret = zfile_fs_usage_archive (unit->ui.rootdir, 0, &fsu); @@ -2649,61 +2687,72 @@ static void PUT_PCK_RES2 (packet, err); return; } - - put_long (info, 0); /* errors */ - put_long (info + 4, nr); /* unit number */ - put_long (info + 8, unit->ui.readonly || unit->ui.locked ? 80 : 82); /* state */ - put_long (info + 20, blocksize); /* bytesperblock */ - put_long (info + 32, 0); /* inuse */ + put_long_host(buf, 0); /* errors */ + put_long_host(buf + 4, nr); /* unit number */ + put_long_host(buf + 8, is_writeprotected(unit) ? 80 : 82); /* state */ + put_long_host(buf + 20, blocksize); /* bytesperblock */ + put_long_host(buf + 32, 0); /* inuse */ if (unit->ui.unknown_media) { if (!disk_info) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_NOT_A_DOS_DISK); return; } - put_long (info + 12, 0); - put_long (info + 16, 0); - put_long (info + 24, ('B' << 24) | ('A' << 16) | ('D' << 8) | (0 << 0)); /* ID_UNREADABLE_DISK */ - put_long (info + 28, 0); + put_long_host(buf + 12, 0); + put_long_host(buf + 16, 0); + put_long_host(buf + 24, ('B' << 24) | ('A' << 16) | ('D' << 8) | (0 << 0)); /* ID_UNREADABLE_DISK */ + put_long_host(buf + 28, 0); } else if (!media) { if (!disk_info) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_NO_DISK); return; } - put_long (info + 12, 0); - put_long (info + 16, 0); - put_long (info + 24, -1); /* ID_NO_DISK_PRESENT */ - put_long (info + 28, 0); + put_long_host(buf + 12, 0); + put_long_host(buf + 16, 0); + put_long_host(buf + 24, -1); /* ID_NO_DISK_PRESENT */ + put_long_host(buf + 28, 0); } else { if (fs && currprefs.filesys_limit) { - if (fsu.fsu_blocks > (uae_u64)currprefs.filesys_limit * 1024 / blocksize) { - uae_u32 oldblocks = fsu.fsu_blocks; - fsu.fsu_blocks = (uae_u32)((uae_u64)currprefs.filesys_limit * 1024 / blocksize); - fsu.fsu_bavail = (uae_u32)((uae_u64)fsu.fsu_bavail * fsu.fsu_blocks / oldblocks); + if (fsu.total > (uae_s64)currprefs.filesys_limit * 1024) { + uae_s64 oldtotal = fsu.total; + fsu.total = currprefs.filesys_limit * 1024; + fsu.avail = ((fsu.avail / 1024) * (fsu.total / 1024)) / (oldtotal / 1024); + fsu.avail *= 1024; } } - put_long (info + 12, fsu.fsu_blocks ); /* numblocks */ - put_long (info + 16, fsu.fsu_blocks - fsu.fsu_bavail); /* inuse */ - put_long (info + 24, dostype); /* disk type */ - put_long (info + 28, unit->volume >> 2); /* volume node */ - put_long (info + 32, (get_long (unit->volume + 28) || unit->keys) ? -1 : 0); /* inuse */ + uae_s64 numblocks = 0; + while (blocksize < 32768 || numblocks == 0) { + numblocks = fsu.total / blocksize; + if (numblocks <= 10) + numblocks = 10; + if (numblocks <= 0x7fffffff) + break; + blocksize *= 2; + } + uae_s64 inuse = (numblocks * blocksize - fsu.avail) / blocksize; + if (inuse > numblocks) + inuse = numblocks; + + put_long_host(buf + 12, (uae_u32)numblocks); /* numblocks */ + put_long_host(buf + 16, (uae_u32)inuse); /* inuse */ + put_long_host(buf + 20, blocksize); /* bytesperblock */ + put_long_host(buf + 24, dostype); /* disk type */ + put_long_host(buf + 28, unit->volume >> 2); /* volume node */ + put_long_host(buf + 32, (get_long(unit->volume + 28) || unit->keys) ? -1 : 0); /* inuse */ } + trap_put_bytes(ctx, buf, info, sizeof buf); PUT_PCK_RES1 (packet, DOS_TRUE); } -static void - action_disk_info (Unit *unit, dpacket packet) +static void action_disk_info(TrapContext *ctx, Unit *unit, dpacket *packet) { - TRACE((_T("ACTION_DISK_INFO\n"))); - do_info (unit, packet, GET_PCK_ARG1 (packet) << 2, true); + do_info(ctx, unit, packet, GET_PCK_ARG1 (packet) << 2, true); } -static void - action_info (Unit *unit, dpacket packet) +static void action_info(TrapContext *ctx, Unit *unit, dpacket *packet) { - TRACE((_T("ACTION_INFO\n"))); - do_info (unit, packet, GET_PCK_ARG2 (packet) << 2, false); + do_info(ctx, unit, packet, GET_PCK_ARG2 (packet) << 2, false); } static void free_key (Unit *unit, Key *k) @@ -2760,73 +2809,76 @@ static Key *new_key (Unit *unit) return k; } -#if TRACING_ENABLED -static void - dumplock (Unit *unit, uaecptr lock) -{ - a_inode *a; - TRACE((_T("LOCK: 0x%lx"), lock)); - if (!lock) { - TRACE((_T("\n"))); - return; - } - TRACE((_T("{ next=0x%lx, mode=%ld, handler=0x%lx, volume=0x%lx, aino %lx "), - get_long (lock) << 2, get_long (lock+8), - get_long (lock+12), get_long (lock+16), - get_long (lock + 4))); - a = aino_from_lock (unit, lock); - if (a == 0) { - TRACE((_T("not found!"))); - } else { - TRACE((_T("%s"), a->nname)); - } - TRACE((_T(" }\n"))); -} -#endif - -static a_inode *find_aino (Unit *unit, uaecptr lock, const TCHAR *name, int *err) +static a_inode *find_aino (TrapContext *ctx, Unit *unit, uaecptr lock, const TCHAR *name, int *err) { a_inode *a; if (lock) { - a_inode *olda = aino_from_lock (unit, lock); + a_inode *olda = aino_from_lock(ctx, unit, lock); if (olda == 0) { /* That's the best we can hope to do. */ a = get_aino (unit, &unit->rootnode, name, err); } else { - TRACE((_T("aino: 0x%08lx"), (unsigned long int)olda->uniq)); - TRACE((_T(" \"%s\"\n"), olda->nname)); a = get_aino (unit, olda, name, err); } } else { a = get_aino (unit, &unit->rootnode, name, err); } - if (a) { - TRACE((_T("aino=\"%s\"\n"), a->nname)); - } - aino_test (a); return a; } -static uaecptr make_lock (Unit *unit, uae_u32 uniq, long mode) +static uaecptr make_lock (TrapContext *ctx, Unit *unit, uae_u32 uniq, long mode) { /* allocate lock from the list kept by the assembly code */ uaecptr lock; - lock = get_long (unit->locklist); - put_long (unit->locklist, get_long (lock)); +#if TRAPMD + + struct trapmd md1[] = + { + { TRAPCMD_GET_LONG, { unit->locklist }, 1, 0 }, + { TRAPCMD_GET_LONG, { 0 }, 2, 1 }, + { TRAPCMD_PUT_LONG, { unit->locklist, 0 } }, + }; + trap_multi(ctx, md1, sizeof md1 / sizeof(struct trapmd)); + lock = md1[0].params[0] + 4; + +#else + + lock = trap_get_long(ctx, unit->locklist); + trap_put_long(ctx, unit->locklist, trap_get_long(ctx, lock)); lock += 4; - put_long (lock + 4, uniq); - put_long (lock + 8, mode); - put_long (lock + 12, unit->port); - put_long (lock + 16, unit->volume >> 2); +#endif + +#if TRAPMD + struct trapmd md2[] = + { + { TRAPCMD_PUT_LONG, { lock + 4, uniq } }, + { TRAPCMD_PUT_LONG, { lock + 8, mode } }, + { TRAPCMD_PUT_LONG, { lock + 12, unit->port } }, + { TRAPCMD_PUT_LONG, { lock + 16, unit->volume >> 2 } }, + + /* prepend to lock chain */ + { TRAPCMD_GET_LONG, { unit->volume + 28 }, 5, 1 }, + { TRAPCMD_PUT_LONG, { lock, 0 } }, + { TRAPCMD_PUT_LONG, { unit->volume + 28, lock >> 2 } } + }; + trap_multi(ctx, md2, sizeof md2 / sizeof(struct trapmd)); + +#else + + trap_put_long(ctx, lock + 4, uniq); + trap_put_long(ctx, lock + 8, mode); + trap_put_long(ctx, lock + 12, unit->port); + trap_put_long(ctx, lock + 16, unit->volume >> 2); /* prepend to lock chain */ - put_long (lock, get_long (unit->volume + 28)); - put_long (unit->volume + 28, lock >> 2); + trap_put_long(ctx, lock, trap_get_long(ctx, unit->volume + 28)); + trap_put_long(ctx, unit->volume + 28, lock >> 2); + +#endif - DUMPLOCK(unit, lock); return lock; } @@ -2839,23 +2891,23 @@ static uaecptr make_lock (Unit *unit, uae_u32 uniq, long mode) #define NRF_NOTIFY_INITIAL 16 #define NRF_MAGIC (1 << 31) -static void notify_send (Unit *unit, Notify *n) +static void notify_send (TrapContext *ctx, Unit *unit, Notify *n) { uaecptr nr = n->notifyrequest; - int flags = get_long (nr + 12); + int flags = trap_get_long(ctx, nr + 12); if (flags & NRF_SEND_MESSAGE) { if (!(flags & NRF_WAIT_REPLY) || ((flags & NRF_WAIT_REPLY) && !(flags & NRF_MAGIC))) { uae_NotificationHack (unit->port, nr); } else if (flags & NRF_WAIT_REPLY) { - put_long (nr + 12, get_long (nr + 12) | NRF_MAGIC); + trap_put_long(ctx, nr + 12, trap_get_long(ctx, nr + 12) | NRF_MAGIC); } } else if (flags & NRF_SEND_SIGNAL) { - uae_Signal (get_long (nr + 16), 1 << get_byte (nr + 20)); + uae_Signal (trap_get_long(ctx, nr + 16), 1 << trap_get_byte(ctx, nr + 20)); } } -static void notify_check (Unit *unit, a_inode *a) +static void notify_check (TrapContext *ctx, Unit *unit, a_inode *a) { Notify *n; int hash = notifyhash (a->aname); @@ -2863,9 +2915,9 @@ static void notify_check (Unit *unit, a_inode *a) uaecptr nr = n->notifyrequest; if (same_aname(n->partname, a->aname)) { int err; - a_inode *a2 = find_aino (unit, 0, n->fullname, &err); + a_inode *a2 = find_aino(ctx, unit, 0, n->fullname, &err); if (err == 0 && a == a2) - notify_send (unit, n); + notify_send(ctx, unit, n); } } if (a->parent) { @@ -2874,46 +2926,29 @@ static void notify_check (Unit *unit, a_inode *a) uaecptr nr = n->notifyrequest; if (same_aname(n->partname, a->parent->aname)) { int err; - a_inode *a2 = find_aino (unit, 0, n->fullname, &err); + a_inode *a2 = find_aino(ctx, unit, 0, n->fullname, &err); if (err == 0 && a->parent == a2) - notify_send (unit, n); + notify_send(ctx, unit, n); } } } } -static void - action_add_notify (Unit *unit, dpacket packet) +static void action_add_notify(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr nr = GET_PCK_ARG1 (packet); int flags; Notify *n; TCHAR *name, *p, *partname; - TRACE((_T("ACTION_ADD_NOTIFY\n"))); - - name = my_strdup (char1 (get_long (nr + 4))); - flags = get_long (nr + 12); + name = char1 (ctx, trap_get_long(ctx, nr + 4)); + flags = trap_get_long(ctx, nr + 12); if (!(flags & (NRF_SEND_MESSAGE | NRF_SEND_SIGNAL))) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_BAD_NUMBER); return; } -#if 0 - write_log (_T("Notify:\n")); - write_log (_T("nr_Name '%s'\n"), char1 (get_long (nr + 0))); - write_log (_T("nr_FullName '%s'\n"), name); - write_log (_T("nr_UserData %08X\n"), get_long (nr + 8)); - write_log (_T("nr_Flags %08X\n"), flags); - if (flags & NRF_SEND_MESSAGE) { - write_log (_T("Message NotifyRequest, port = %08X\n"), get_long (nr + 16)); - } else if (flags & NRF_SEND_SIGNAL) { - write_log (_T("Signal NotifyRequest, Task = %08X signal = %d\n"), get_long (nr + 16), get_long (nr + 20)); - } else { - write_log (_T("corrupt NotifyRequest\n")); - } -#endif p = name + _tcslen (name) - 1; if (p[0] == ':') @@ -2928,20 +2963,18 @@ static void n->fullname = name; if (flags & NRF_NOTIFY_INITIAL) { int err; - a_inode *a = find_aino (unit, 0, n->fullname, &err); + a_inode *a = find_aino(ctx, unit, 0, n->fullname, &err); if (err == 0) - notify_send (unit, n); + notify_send(ctx, unit, n); } PUT_PCK_RES1 (packet, DOS_TRUE); } -static void - action_remove_notify (Unit *unit, dpacket packet) +static void action_remove_notify(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr nr = GET_PCK_ARG1 (packet); Notify *n; int hash; - TRACE((_T("ACTION_REMOVE_NOTIFY\n"))); for (hash = 0; hash < NOTIFY_HASH_SIZE; hash++) { for (n = unit->notifyhash[hash]; n; n = n->next) { if (n->notifyrequest == nr) { @@ -2958,18 +2991,19 @@ static void PUT_PCK_RES1 (packet, DOS_TRUE); } -static void free_lock (Unit *unit, uaecptr lock) +static void free_lock (TrapContext *ctx, Unit *unit, uaecptr lock) { if (! lock) return; - if (lock == get_long (unit->volume + 28) << 2) { - put_long (unit->volume + 28, get_long (lock)); + uaecptr curlock = get_long(unit->volume + 28); + if (lock == curlock << 2) { + put_long(unit->volume + 28, trap_get_long(ctx, lock)); } else { - uaecptr current = get_long (unit->volume + 28); + uaecptr current = curlock; uaecptr next = 0; while (current) { - next = get_long (current << 2); + next = trap_get_long(ctx, current << 2); if (lock == next << 2) break; current = next; @@ -2978,31 +3012,36 @@ static void free_lock (Unit *unit, uaecptr lock) write_log (_T("tried to unlock non-existing lock %x\n"), lock); return; } - put_long (current << 2, get_long (lock)); + trap_put_long(ctx, current << 2, trap_get_long(ctx, lock)); } lock -= 4; - put_long (lock, get_long (unit->locklist)); - put_long (unit->locklist, lock); +#if TRAPMD + struct trapmd md2[] = + { + { TRAPCMD_GET_LONG, { unit->locklist }, 1, 1 }, + { TRAPCMD_PUT_LONG, { lock } }, + { TRAPCMD_PUT_LONG, { unit->locklist, lock } } + }; + trap_multi(ctx, md2, sizeof md2 / sizeof(struct trapmd)); +#else + trap_put_long(ctx, lock, trap_get_long(ctx, unit->locklist)); + trap_put_long(ctx, unit->locklist, lock); +#endif } -static void - action_lock (Unit *unit, dpacket packet) +static void action_lock(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr lock = GET_PCK_ARG1 (packet) << 2; uaecptr name = GET_PCK_ARG2 (packet) << 2; - long mode = GET_PCK_ARG3 (packet); + int mode = GET_PCK_ARG3 (packet); a_inode *a; int err; if (mode != SHARED_LOCK && mode != EXCLUSIVE_LOCK) { - TRACE((_T("Bad mode %d (should be %d or %d).\n"), mode, SHARED_LOCK, EXCLUSIVE_LOCK)); mode = SHARED_LOCK; } - TRACE((_T("ACTION_LOCK(0x%08x, \"%s\", %d)\n"), lock, bstr (unit, name), mode)); - DUMPLOCK(unit, lock); - - a = find_aino (unit, lock, bstr (unit, name), &err); + a = find_aino(ctx, unit, lock, bstr(ctx, unit, name), &err); if (err == 0 && (a->elock || (mode != SHARED_LOCK && a->shlock > 0))) { err = ERROR_OBJECT_IN_USE; } @@ -3017,17 +3056,15 @@ static void else a->elock = 1; de_recycle_aino (unit, a); - PUT_PCK_RES1 (packet, make_lock (unit, a->uniq, mode) >> 2); + PUT_PCK_RES1 (packet, make_lock (ctx, unit, a->uniq, mode) >> 2); } -static void action_free_lock (Unit *unit, dpacket packet) +static void action_free_lock(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr lock = GET_PCK_ARG1 (packet) << 2; a_inode *a; - TRACE((_T("ACTION_FREE_LOCK(0x%lx)\n"), lock)); - DUMPLOCK(unit, lock); - a = aino_from_lock (unit, lock); + a = aino_from_lock(ctx, unit, lock); if (a == 0) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_OBJECT_NOT_AROUND); @@ -3038,13 +3075,12 @@ static void action_free_lock (Unit *unit, dpacket packet) else a->shlock--; recycle_aino (unit, a); - free_lock(unit, lock); + free_lock(ctx, unit, lock); PUT_PCK_RES1 (packet, DOS_TRUE); } -static uaecptr - action_dup_lock_2 (Unit *unit, dpacket packet, uae_u32 uniq) +static uaecptr action_dup_lock_2(TrapContext *ctx, Unit *unit, dpacket *packet, uae_u32 uniq) { uaecptr out; a_inode *a; @@ -3065,119 +3101,42 @@ static uaecptr } a->shlock++; de_recycle_aino (unit, a); - out = make_lock (unit, a->uniq, -2) >> 2; + out = make_lock(ctx, unit, a->uniq, -2) >> 2; PUT_PCK_RES1 (packet, out); return out; } -static void - action_dup_lock (Unit *unit, dpacket packet) +static void action_dup_lock(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr lock = GET_PCK_ARG1 (packet) << 2; - TRACE((_T("ACTION_DUP_LOCK(0x%lx)\n"), lock)); if (!lock) { PUT_PCK_RES1 (packet, 0); return; } - action_dup_lock_2 (unit, packet, get_long(lock + 4)); + action_dup_lock_2(ctx, unit, packet, trap_get_long(ctx, lock + 4)); } -static void - action_lock_from_fh (Unit *unit, dpacket packet) +static void action_lock_from_fh(TrapContext *ctx, Unit *unit, dpacket *packet) { Key *k = lookup_key (unit, GET_PCK_ARG1 (packet)); - TRACE((_T("ACTION_COPY_DIR_FH(0x%lx,'%s')\n"), GET_PCK_ARG1 (packet), k ? k->aino->aname : _T(""))); if (k == 0) { PUT_PCK_RES1 (packet, DOS_FALSE); return; } - action_dup_lock_2 (unit, packet, k->aino->uniq); + action_dup_lock_2(ctx, unit, packet, k->aino->uniq); } -static void free_exkey (Unit *unit, ExamineKey *ek) +static void free_exkey (Unit *unit, a_inode *aino) { - if (--ek->aino->exnext_count == 0) { - TRACE ((_T("Freeing ExKey and reducing total_locked from %d by %d\n"), - unit->total_locked_ainos, ek->aino->locked_children)); - unit->total_locked_ainos -= ek->aino->locked_children; - ek->aino->locked_children = 0; + if (--aino->exnext_count == 0) { + unit->total_locked_ainos -= aino->locked_children; + aino->locked_children = 0; } - ek->aino = 0; - ek->uniq = 0; -} - -static ExamineKey *lookup_exkey (Unit *unit, uae_u32 uniq) -{ - ExamineKey *ek; - int i; - - ek = unit->examine_keys; - for (i = 0; i < EXKEYS; i++, ek++) { - /* Did we find a free one? */ - if (ek->uniq == uniq) - return ek; - } - write_log (_T("Houston, we have a BIG problem.\n")); - return 0; -} - -/* This is so sick... who invented ACTION_EXAMINE_NEXT? What did he THINK??? */ -static ExamineKey *new_exkey (Unit *unit, a_inode *aino) -{ - uae_u32 uniq; - uae_u32 oldest = 0xFFFFFFFE; - ExamineKey *ek, *oldest_ek = 0; - int i; - - ek = unit->examine_keys; - for (i = 0; i < EXKEYS; i++, ek++) { - /* Did we find a free one? */ - if (ek->aino == 0) - continue; - if (ek->uniq < oldest) - oldest = (oldest_ek = ek)->uniq; - } - ek = unit->examine_keys; - for (i = 0; i < EXKEYS; i++, ek++) { - /* Did we find a free one? */ - if (ek->aino == 0) - goto found; - } - /* This message should usually be harmless. */ - write_log (_T("Houston, we have a problem (%s).\n"), aino->nname); - free_exkey (unit, oldest_ek); - ek = oldest_ek; - found: - - uniq = unit->next_exkey; - if (uniq >= 0xFFFFFFFE) { - /* Things will probably go wrong, but most likely the Amiga will crash - * before this happens because of something else. */ - uniq = 1; - } - unit->next_exkey = uniq+1; - ek->aino = aino; - ek->curr_file = 0; - ek->uniq = uniq; - return ek; } static void move_exkeys (Unit *unit, a_inode *from, a_inode *to) { - int i; - unsigned long tmp = 0; - for (i = 0; i < EXKEYS; i++) { - ExamineKey *k = unit->examine_keys + i; - if (k->uniq == 0) - continue; - if (k->aino == from) { - k->aino = to; - tmp++; - } - } - if (tmp != from->exnext_count) - write_log (_T("filesys.c: Bug in ExNext bookkeeping. BAD.\n")); to->exnext_count = from->exnext_count; to->locked_children = from->locked_children; from->exnext_count = 0; @@ -3187,7 +3146,7 @@ static void move_exkeys (Unit *unit, a_inode *from, a_inode *to) static bool get_statinfo(Unit *unit, a_inode *aino, struct mystat *statbuf) { bool ok = true; - memset (statbuf, 0, sizeof &statbuf); + memset (statbuf, 0, sizeof(struct mystat)); /* No error checks - this had better work. */ if (unit->volflags & MYVOLUMEINFO_ARCHIVE) ok = zfile_stat_archive (aino->nname, statbuf) != 0; @@ -3196,23 +3155,37 @@ static bool get_statinfo(Unit *unit, a_inode *aino, struct mystat *statbuf) return ok; } -static void - get_fileinfo (Unit *unit, dpacket packet, uaecptr info, a_inode *aino, bool longfilesize) +static void get_fileinfo(TrapContext *ctx, Unit *unit, dpacket *packet, uaecptr info, a_inode *aino, bool longfilesize) { struct mystat statbuf; int days, mins, ticks; int i, n, entrytype, blocksize; uae_s64 numblocks; int fsdb_can = fsdb_cando (unit); - const char *xs; + const TCHAR *xs; char *x, *x2; + uae_u8 *buf; + uae_u8 buf_array[260] = { 0 }; - if (!get_statinfo(unit, aino, &statbuf)) { + if (!valid_address(info, (sizeof buf_array) - 36)) { + buf = buf_array; + } else { + buf = get_real_address(info); + } + + if (aino->vfso) { + fsdb_can = 1; + statbuf.mode = aino->vfso->amigaos_mode; + statbuf.mtime.tv_sec = 0; + statbuf.mtime.tv_usec = 0; + statbuf.size = aino->vfso->size; + } else if (!get_statinfo(unit, aino, &statbuf)) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_NOT_A_DOS_DISK); return; } + put_long_host(buf + 0, aino->uniq); if (aino->parent == 0) { /* Guru book says ST_ROOT = 1 (root directory, not currently used) * but some programs really expect 2 from root dir.. @@ -3223,11 +3196,10 @@ static void entrytype = aino->dir ? ST_USERDIR : ST_FILE; xs = aino->aname; } - put_long (info + 4, entrytype); + put_long_host(buf + 4, entrytype); /* AmigaOS docs say these have to contain the same value. */ - put_long (info + 120, entrytype); + put_long_host(buf + 120, entrytype); - TRACE((_T("name=\"%s\"\n"), xs)); x2 = x = ua_fs (xs, -1); n = strlen (x); if (n > 107) @@ -3235,43 +3207,42 @@ static void if (n > abs (currprefs.filesys_max_name)) n = abs (currprefs.filesys_max_name); i = 8; - put_byte (info + i, n); i++; + put_byte_host(buf + i, n); i++; while (n--) - put_byte (info + i, *x), i++, x++; + put_byte_host(buf + i, *x), i++, x++; while (i < 108) - put_byte (info + i, 0), i++; + put_byte_host(buf + i, 0), i++; xfree (x2); - put_long (info + 116, fsdb_can ? aino->amigaos_mode : fsdb_mode_supported(aino)); + put_long_host(buf + 116, fsdb_can ? aino->amigaos_mode : fsdb_mode_supported (aino)); if (kickstart_version >= 36) { - put_word (info + 224, 0); // OwnerUID - put_word (info + 226, 0); // OwnerGID + put_word_host(buf + 224, 0); // OwnerUID + put_word_host(buf + 226, 0); // OwnerGID } - blocksize = (unit->volflags & MYVOLUMEINFO_CDFS) ? 2048 : 512; + blocksize = 512; numblocks = (statbuf.size + blocksize - 1) / blocksize; - put_long (info + 128, numblocks > MAXFILESIZE32 ? MAXFILESIZE32 : numblocks); + put_long_host(buf + 128, numblocks > MAXFILESIZE32 ? MAXFILESIZE32 : numblocks); if (longfilesize) { /* MorphOS 64-bit file length support */ - put_long (info + 124, statbuf.size > MAXFILESIZE32 ? 0 : (uae_u32)statbuf.size); - put_long (info + 228, statbuf.size >> 32); - put_long (info + 232, (uae_u32)statbuf.size); - put_long (info + 236, numblocks >> 32); - put_long (info + 240, (uae_u32)numblocks); + put_long_host(buf + 124, statbuf.size > MAXFILESIZE32_2G ? 0 : (uae_u32)statbuf.size); + put_long_host(buf + 228, statbuf.size >> 32); + put_long_host(buf + 232, (uae_u32)statbuf.size); + put_long_host(buf + 236, numblocks >> 32); + put_long_host(buf + 240, (uae_u32)numblocks); } else { - put_long (info + 124, statbuf.size > MAXFILESIZE32 ? MAXFILESIZE32 : (uae_u32)statbuf.size); + put_long_host(buf + 124, statbuf.size > MAXFILESIZE32 ? MAXFILESIZE32 : (uae_u32)statbuf.size); } - timeval_to_amiga (&statbuf.mtime, &days, &mins, &ticks); - put_long (info + 132, days); - put_long (info + 136, mins); - put_long (info + 140, ticks); + timeval_to_amiga (&statbuf.mtime, &days, &mins, &ticks, 50); + put_long_host(buf + 132, days); + put_long_host(buf + 136, mins); + put_long_host(buf + 140, ticks); if (aino->comment == 0 || !fsdb_can) - put_long (info + 144, 0); + put_long_host(buf + 144, 0); else { - TRACE((_T("comment=\"%s\"\n"), aino->comment)); i = 144; xs = aino->comment; if (!xs) @@ -3280,22 +3251,34 @@ static void n = strlen (x); if (n > 78) n = 78; - put_byte (info + i, n); i++; + put_byte_host(buf + i, n); i++; while (n--) - put_byte (info + i, *x), i++, x++; + put_byte_host(buf + i, *x), i++, x++; while (i < 224) - put_byte (info + i, 0), i++; + put_byte_host(buf + i, 0), i++; xfree (x2); } + + if (buf == buf_array) { + // Must not write Fib_reserved at the end. + if (kickstart_version >= 36) { + // FIB + fib_OwnerUID and fib_OwnerGID + trap_put_bytes(ctx, buf, info, (sizeof buf_array) - 32); + } else { + // FIB only + trap_put_bytes(ctx, buf, info, (sizeof buf_array) - 36); + } + } + PUT_PCK_RES1 (packet, DOS_TRUE); } -int get_native_path (uae_u32 lock, TCHAR *out) +int get_native_path(TrapContext *ctx, uae_u32 lock, TCHAR *out) { int i = 0; for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) { if (mountinfo.ui[i].self) { - a_inode *a = aino_from_lock (mountinfo.ui[i].self, lock << 2); + a_inode *a = aino_from_lock(ctx, mountinfo.ui[i].self, lock << 2); if (a) { _tcscpy (out, a->nname); return 0; @@ -3310,7 +3293,7 @@ int get_native_path (uae_u32 lock, TCHAR *out) #define REC_SHARED 2 #define REC_SHARED_IMMED 3 -static struct lockrecord *new_record (uae_u32 packet, uae_u64 pos, uae_u64 len, uae_u32 mode, uae_u32 timeout, uae_u32 msg) +static struct lockrecord *new_record (dpacket *packet, uae_u64 pos, uae_u64 len, uae_u32 mode, uae_u32 timeout, uae_u32 msg) { struct lockrecord *lr = xcalloc (struct lockrecord, 1); lr->packet = packet; @@ -3348,7 +3331,7 @@ static bool record_hit (Unit *unit, Key *k, uae_u64 pos, uae_u64 len, uae_u32 mo return false; } -static void record_timeout (Unit *unit) +static void record_timeout (TrapContext *ctx, Unit *unit) { bool retry = true; while (retry) { @@ -3361,7 +3344,7 @@ static void record_timeout (Unit *unit) PUT_PCK_RES1 (lr->packet, DOS_FALSE); PUT_PCK_RES2 (lr->packet, ERROR_LOCK_TIMEOUT); // mark packet as complete - put_long (lr->msg + 4, 0xfffffffe); + trap_put_long(ctx, lr->msg + 4, 0xfffffffe); uae_Signal (get_long (unit->volume + 176 - 32), 1 << 13); if (prev) prev->next = lr->next; @@ -3377,7 +3360,7 @@ static void record_timeout (Unit *unit) } } -static void record_check_waiting (Unit *unit) +static void record_check_waiting (TrapContext *ctx, Unit *unit) { bool retry = true; while (retry) { @@ -3390,9 +3373,9 @@ static void record_check_waiting (Unit *unit) prev->next = lr->next; else unit->waitingrecords = lr->next; - write_log (_T("queued record released '%s',%d,%d,%d,%d\n"), k->aino->nname, lr->pos, lr->len, lr->mode, lr->timeout); + write_log (_T("queued record released '%s',%llud,%llu,%d,%d\n"), k->aino->nname, lr->pos, lr->len, lr->mode, lr->timeout); // mark packet as complete - put_long (lr->msg + 4, 0xffffffff); + trap_put_long(ctx, lr->msg + 4, 0xffffffff); xfree (lr); retry = true; break; @@ -3402,7 +3385,7 @@ static void record_check_waiting (Unit *unit) } } -static int action_lock_record (Unit *unit, dpacket packet, uae_u32 msg) +static int action_lock_record(TrapContext *ctx, Unit *unit, dpacket *packet, uae_u32 msg) { Key *k = lookup_key (unit, GET_PCK_ARG1 (packet)); uae_u32 pos = GET_PCK_ARG2 (packet); @@ -3442,7 +3425,7 @@ static int action_lock_record (Unit *unit, dpacket packet, uae_u32 msg) return 1; } - struct lockrecord *lr = new_record (GET_PCK_ARG1 (packet), pos, len, mode, timeout, 0); + struct lockrecord *lr = new_record (packet, pos, len, mode, timeout, 0); if (k->record) { lr->next = k->record; k->record = lr; @@ -3454,7 +3437,7 @@ static int action_lock_record (Unit *unit, dpacket packet, uae_u32 msg) return 1; } -static void action_free_record (Unit *unit, dpacket packet) +static void action_free_record(TrapContext *ctx, Unit *unit, dpacket *packet) { Key *k = lookup_key (unit, GET_PCK_ARG1 (packet)); uae_u32 pos = GET_PCK_ARG2 (packet); @@ -3477,7 +3460,7 @@ static void action_free_record (Unit *unit, dpacket packet) k->record = lr->next; xfree (lr); write_log (_T("->OK\n")); - record_check_waiting (unit); + record_check_waiting(ctx, unit); PUT_PCK_RES1 (packet, DOS_TRUE); return; } @@ -3487,7 +3470,6 @@ static void action_free_record (Unit *unit, dpacket packet) PUT_PCK_RES2 (packet, ERROR_RECORD_NOT_LOCKED); } -#define EXALL_DEBUG 0 #define EXALL_END 0xde1111ad static ExAllKey *getexall (Unit *unit, uaecptr control, int id) @@ -3513,14 +3495,13 @@ static ExAllKey *getexall (Unit *unit, uaecptr control, int id) return NULL; } -static int exalldo (uaecptr exalldata, uae_u32 exalldatasize, uae_u32 type, uaecptr control, Unit *unit, a_inode *aino) +static int exalldo (TrapContext *ctx, uaecptr exalldata, uae_u32 exalldatasize, uae_u32 type, uaecptr control, Unit *unit, a_inode *aino) { uaecptr exp = exalldata; int i; int size, size2; int entrytype; - TCHAR *xs = NULL; - const char *commentx = NULL; + const TCHAR *xs = NULL, *commentx = NULL; uae_u32 flags = 15; int days, mins, ticks; struct mystat statbuf; @@ -3560,7 +3541,7 @@ static int exalldo (uaecptr exalldata, uae_u32 exalldatasize, uae_u32 type, uaec size2 += 4; } if (type >= 5) { - timeval_to_amiga (&statbuf.mtime, &days, &mins, &ticks); + timeval_to_amiga (&statbuf.mtime, &days, &mins, &ticks, 50); size2 += 12; } if (type >= 6) { @@ -3582,57 +3563,52 @@ static int exalldo (uaecptr exalldata, uae_u32 exalldatasize, uae_u32 type, uaec size2 += 8; } - i = get_long (control + 0); + i = trap_get_long(ctx, control + 0); while (i > 0) { - exp = get_long (exp); /* ed_Next */ + exp = trap_get_long(ctx, exp); /* ed_Next */ i--; } if (exalldata + exalldatasize - exp < size + size2) goto end; /* not enough space */ -#if EXALL_DEBUG > 0 - write_log (_T("ID=%d, %d, %08x: '%s'%s\n"), - get_long (control + 4), get_long (control + 0), exp, xs, aino->dir ? _T(" [DIR]") : _T("")); -#endif - - put_long (exp, exp + size + size2); /* ed_Next */ + trap_put_long(ctx, exp, exp + size + size2); /* ed_Next */ if (type >= 1) { - put_long (exp + 4, exp + size2); + trap_put_long(ctx, exp + 4, exp + size2); for (i = 0; i <= strlen (x); i++) { - put_byte (exp + size2, x[i]); + trap_put_byte(ctx, exp + size2, x[i]); size2++; } } if (type >= 2) - put_long (exp + 8, entrytype); + trap_put_long(ctx, exp + 8, entrytype); if (type >= 3) - put_long (exp + 12, statbuf.size > MAXFILESIZE32 ? MAXFILESIZE32 : statbuf.size); + trap_put_long(ctx, exp + 12, statbuf.size > MAXFILESIZE32 ? MAXFILESIZE32 : statbuf.size); if (type >= 4) - put_long (exp + 16, flags); + trap_put_long(ctx, exp + 16, flags); if (type >= 5) { - put_long (exp + 20, days); - put_long (exp + 24, mins); - put_long (exp + 28, ticks); + trap_put_long(ctx, exp + 20, days); + trap_put_long(ctx, exp + 24, mins); + trap_put_long(ctx, exp + 28, ticks); } if (type >= 6) { - put_long (exp + 32, exp + size2); - put_byte (exp + size2, strlen (comment)); + trap_put_long(ctx, exp + 32, exp + size2); + trap_put_byte(ctx, exp + size2, strlen (comment)); for (i = 0; i <= strlen (comment); i++) { - put_byte (exp + size2, comment[i]); + trap_put_byte(ctx, exp + size2, comment[i]); size2++; } } if (type >= 7) { - put_word (exp + 36, uid); - put_word (exp + 38, gid); + trap_put_word(ctx, exp + 36, uid); + trap_put_word(ctx, exp + 38, gid); } if (type >= 8) { - put_long (exp + 40, statbuf.size >> 32); - put_long (exp + 44, (uae_u32)statbuf.size); + trap_put_long(ctx, exp + 40, statbuf.size >> 32); + trap_put_long(ctx, exp + 44, (uae_u32)statbuf.size); } - put_long (control + 0, get_long (control + 0) + 1); + trap_put_long(ctx, control + 0, trap_get_long(ctx, control + 0) + 1); ret = 1; end: xfree (x); @@ -3645,7 +3621,17 @@ static bool filesys_name_invalid (const TCHAR *fn) return _tcslen (fn) > currprefs.filesys_max_name; } -static int action_examine_all_do (Unit *unit, uaecptr lock, ExAllKey *eak, uaecptr exalldata, uae_u32 exalldatasize, uae_u32 type, uaecptr control) +static int filesys_readdir(struct fs_dirhandle *d, TCHAR *fn, uae_u64 *uniq) +{ + int ok = 0; + if (d->fstype == FS_ARCHIVE) + ok = zfile_readdir_archive (d->zd, fn); + else if (d->fstype == FS_DIRECTORY) + ok = my_readdir (d->od, fn); + return ok; +} + +static int action_examine_all_do (TrapContext *ctx, Unit *unit, uaecptr lock, ExAllKey *eak, uaecptr exalldata, uae_u32 exalldatasize, uae_u32 type, uaecptr control) { a_inode *aino, *base = NULL; int ok; @@ -3654,7 +3640,7 @@ static int action_examine_all_do (Unit *unit, uaecptr lock, ExAllKey *eak, uaecp TCHAR fn[MAX_DPATH]; if (lock != 0) - base = aino_from_lock (unit, lock); + base = aino_from_lock(ctx, unit, lock); if (base == 0) base = &unit->rootnode; for (;;) { @@ -3662,12 +3648,7 @@ static int action_examine_all_do (Unit *unit, uaecptr lock, ExAllKey *eak, uaecp d = eak->dirhandle; if (!eak->fn) { do { - if (d->fstype == FS_ARCHIVE) - ok = zfile_readdir_archive (d->zd, fn); - else if (d->fstype == FS_DIRECTORY) - ok = my_readdir (d->od, fn); - else - ok = 0; + ok = filesys_readdir(d, fn, &uniq); } while (ok && d->fstype == FS_DIRECTORY && (filesys_name_invalid (fn) || fsdb_name_invalid_dir (fn))); if (!ok) return 0; @@ -3676,12 +3657,12 @@ static int action_examine_all_do (Unit *unit, uaecptr lock, ExAllKey *eak, uaecp xfree (eak->fn); eak->fn = NULL; } - aino = lookup_child_aino_for_exnext (unit, base, fn, &err, uniq); + aino = lookup_child_aino_for_exnext (unit, base, fn, &err, uniq, NULL); if (!aino) return 0; eak->id = unit->exallid++; - put_long (control + 4, eak->id); - if (!exalldo (exalldata, exalldatasize, type, control, unit, aino)) { + trap_put_long(ctx, control + 4, eak->id); + if (!exalldo (ctx, exalldata, exalldatasize, type, control, unit, aino)) { eak->fn = my_strdup (fn); /* no space in exallstruct, save current entry */ break; } @@ -3689,7 +3670,7 @@ static int action_examine_all_do (Unit *unit, uaecptr lock, ExAllKey *eak, uaecp return 1; } -static int action_examine_all_end (Unit *unit, dpacket packet) +static int action_examine_all_end(TrapContext *ctx, Unit *unit, dpacket *packet) { uae_u32 id; uae_u32 doserr = 0; @@ -3698,11 +3679,8 @@ static int action_examine_all_end (Unit *unit, dpacket packet) if (kickstart_version < 36) return 0; - id = get_long (control + 4); + id = trap_get_long(ctx, control + 4); eak = getexall (unit, control, id); -#if EXALL_DEBUG > 0 - write_log (_T("EXALL_END ID=%d %x\n"), id, eak); -#endif if (!eak) { write_log (_T("FILESYS: EXALL_END non-existing ID %d\n"), id); doserr = ERROR_OBJECT_WRONG_TYPE; @@ -3722,7 +3700,7 @@ static int action_examine_all_end (Unit *unit, dpacket packet) return 1; } -static int action_examine_all (Unit *unit, dpacket packet) +static int action_examine_all(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr lock = GET_PCK_ARG1 (packet) << 2; uaecptr exalldata = GET_PCK_ARG2 (packet); @@ -3739,14 +3717,7 @@ static int action_examine_all (Unit *unit, dpacket packet) ok = 0; -#if EXALL_DEBUG > 0 - write_log (_T("exall: %08x %08x-%08x %d %d %08x\n"), - lock, exalldata, exalldata + exalldatasize, exalldatasize, type, control); - write_log (_T("exall: MatchString %08x, MatchFunc %08x\n"), - get_long (control + 8), get_long (control + 12)); -#endif - - put_long (control + 0, 0); /* eac_Entries */ + trap_put_long(ctx, control + 0, 0); /* eac_Entries */ /* EXAMINE ALL might use dos.library MatchPatternNoCase() which is >=36 */ if (kickstart_version < 36) @@ -3758,7 +3729,7 @@ static int action_examine_all (Unit *unit, dpacket packet) } PUT_PCK_RES1 (packet, DOS_TRUE); - id = get_long (control + 4); + id = trap_get_long(ctx, control + 4); if (id == EXALL_END) { write_log (_T("FILESYS: EXALL called twice with ERROR_NO_MORE_ENTRIES\n")); goto fail; /* already ended exall() */ @@ -3770,9 +3741,9 @@ static int action_examine_all (Unit *unit, dpacket packet) doserr = ERROR_OBJECT_WRONG_TYPE; goto fail; } - if (!action_examine_all_do (unit, lock, eak, exalldata, exalldatasize, type, control)) + if (!action_examine_all_do(ctx, unit, lock, eak, exalldata, exalldatasize, type, control)) goto fail; - if (get_long (control + 0) == 0) { + if (trap_get_long(ctx, control + 0) == 0) { /* uh, no space for first entry.. */ doserr = ERROR_NO_FREE_STORE; goto fail; @@ -3784,20 +3755,17 @@ static int action_examine_all (Unit *unit, dpacket packet) if (!eak) goto fail; if (lock != 0) - base = aino_from_lock (unit, lock); + base = aino_from_lock(ctx, unit, lock); if (base == 0) base = &unit->rootnode; -#if EXALL_DEBUG > 0 - write_log("exall: ID=%d '%s'\n", eak->id, base->nname); -#endif d = fs_opendir (unit, base); if (!d) goto fail; eak->dirhandle = d; - put_long (control + 4, eak->id); - if (!action_examine_all_do (unit, lock, eak, exalldata, exalldatasize, type, control)) + trap_put_long(ctx, control + 4, eak->id); + if (!action_examine_all_do (ctx, unit, lock, eak, exalldata, exalldatasize, type, control)) goto fail; - if (get_long (control + 0) == 0) { + if (trap_get_long(ctx, control + 0) == 0) { /* uh, no space for first entry.. */ doserr = ERROR_NO_FREE_STORE; goto fail; @@ -3809,19 +3777,16 @@ static int action_examine_all (Unit *unit, dpacket packet) fail: /* Clear last ed_Next. This "list" is quite non-Amiga like.. */ exp = exalldata; - i = get_long (control + 0); + i = trap_get_long(ctx, control + 0); for (;;) { if (i <= 1) { if (exp) - put_long (exp, 0); + trap_put_long(ctx, exp, 0); break; } - exp = get_long (exp); /* ed_Next */ + exp = trap_get_long(ctx, exp); /* ed_Next */ i--; } -#if EXALL_DEBUG > 0 - write_log("ok=%d, err=%d, eac_Entries = %d\n", ok, ok ? -1 : doserr, get_long (control + 0)); -#endif if (!ok) { PUT_PCK_RES1 (packet, DOS_FALSE); @@ -3834,46 +3799,47 @@ fail: eak->fn = NULL; } if (doserr == ERROR_NO_MORE_ENTRIES) - put_long (control + 4, EXALL_END); + trap_put_long(ctx, control + 4, EXALL_END); } return 1; } -static uae_u32 exall_helpder(TrapContext *context) +static uae_u32 exall_helper(TrapContext *ctx) { int i; Unit *u; - uaecptr packet = m68k_areg (regs, 4); - uaecptr control = get_long (packet + dp_Arg5); - uae_u32 id = get_long (control + 4); + uaecptr pck = trap_get_areg(ctx, 4); + + dpacket packet; + readdpacket(ctx, &packet, pck); + + uaecptr control = get_long_host(packet.packet_data + dp_Arg5); + uae_u32 id = trap_get_long(ctx, control + 4); -#if EXALL_DEBUG > 0 - write_log (_T("FILESYS: EXALL extra round ID=%d\n"), id); -#endif if (id == EXALL_END) return 1; for (u = units; u; u = u->next) { for (i = 0; i < EXALLKEYS; i++) { if (u->exalls[i].id == id && u->exalls[i].control == control) { - action_examine_all (u, packet); + action_examine_all(ctx, u, &packet); } } } return 1; } -static uae_u32 REGPARAM2 fsmisc_helper (TrapContext *context) +static uae_u32 REGPARAM2 fsmisc_helper (TrapContext *ctx) { - int mode = m68k_dreg (regs, 0); + int mode = trap_get_dreg(ctx, 0); switch (mode) { case 0: - return exall_helpder (context); + return exall_helper (ctx); case 1: - return filesys_media_change_reply (context, 0); + return filesys_media_change_reply (0); case 2: - return filesys_media_change_reply (context, 1); + return filesys_media_change_reply (1); case 3: uae_u32 t = getlocaltime (); uae_u32 secs = (uae_u32)t - (8 * 365 + 2) * 24 * 60 * 60; @@ -3882,25 +3848,82 @@ static uae_u32 REGPARAM2 fsmisc_helper (TrapContext *context) return 0; } -static void action_examine_object (Unit *unit, dpacket packet) +static void action_examine_object(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr lock = GET_PCK_ARG1 (packet) << 2; uaecptr info = GET_PCK_ARG2 (packet) << 2; a_inode *aino = 0; - TRACE((_T("ACTION_EXAMINE_OBJECT(0x%lx,0x%lx)\n"), lock, info)); - DUMPLOCK(unit, lock); - if (lock != 0) - aino = aino_from_lock (unit, lock); + aino = aino_from_lock(ctx, unit, lock); if (aino == 0) aino = &unit->rootnode; - get_fileinfo (unit, packet, info, aino, false); - if (aino->dir) { - put_long (info, 0xFFFFFFFF); - } else - put_long (info, 0); + get_fileinfo(ctx, unit, packet, info, aino, false); +} + +extern unsigned char def_tool[]; +extern unsigned int def_tool_len; +extern unsigned char def_project[]; +extern unsigned int def_project_len; +extern unsigned char def_drawer[]; +extern unsigned int def_drawer_len; +static struct virtualfilesysobject vfso_icon_tool; +static struct virtualfilesysobject vfso_icon_project; +static struct virtualfilesysobject vfso_icon_drawer; + +static void load_injected_icon(struct virtualfilesysobject *vfso, const TCHAR *fn, uae_u8 *default_data, int default_size) +{ + uae_u8 *data = NULL; + int size; + + xfree(vfso->data); + if (fn && fn[0]) + data = zfile_load_file(fn, &size); + if (!data) { + vfso->data = xmalloc(uae_u8, default_size); + memcpy(vfso->data, default_data, default_size); + vfso->size = default_size; + return; + } + vfso->data = data; + vfso->size = size; +} + +static void load_injected_icons(void) +{ + load_injected_icon(&vfso_icon_tool, currprefs.filesys_inject_icons_tool, def_tool, def_tool_len); + load_injected_icon(&vfso_icon_project, currprefs.filesys_inject_icons_project, def_project, def_project_len); + load_injected_icon(&vfso_icon_drawer, currprefs.filesys_inject_icons_drawer, def_drawer, def_drawer_len); +} + +static void inject_icons_to_directory(Unit *unit, a_inode *base) +{ + for (a_inode *aino = base->child; aino; aino = aino->sibling) { + int len = _tcslen(aino->aname); + if (len >= 5 && !_tcsicmp(aino->aname + len - 5, _T(".info"))) + continue; + TCHAR tmp[256]; + _stprintf(tmp, _T("%s.info"), aino->aname); + bool match = false; + for (a_inode *aino2 = base->child; aino2; aino2 = aino2->sibling) { + if (!_tcsicmp(aino2->aname, tmp)) + match = true; + } + if (match) + continue; + uae_u32 err; + struct virtualfilesysobject *vfso; + if (aino->dir) { + vfso = &vfso_icon_drawer; + } else { + if (aino->amigaos_mode & A_FIBF_EXECUTE) + vfso = &vfso_icon_project; + else + vfso = &vfso_icon_tool; + } + lookup_child_aino_for_exnext(unit, base, tmp, &err, 0, vfso); + } } /* Read a directory's contents, create a_inodes for each file, and @@ -3922,8 +3945,6 @@ static void populate_directory (Unit *unit, a_inode *base) base->locked_children++; unit->total_locked_ainos++; } - TRACE3((_T("Populating directory, child %p, locked_children %d\n"), - base->child, base->locked_children)); for (;;) { uae_u64 uniq = 0; TCHAR fn[MAX_DPATH]; @@ -3933,119 +3954,124 @@ static void populate_directory (Unit *unit, a_inode *base) /* Find next file that belongs to the Amiga fs (skipping things like "..", "." etc. */ do { - if (d->fstype == FS_ARCHIVE) - ok = zfile_readdir_archive(d->zd, fn); - else if (d->fstype == FS_DIRECTORY) - ok = my_readdir (d->od, fn); - else - ok = 0; + ok = filesys_readdir(d, fn, &uniq); } while (ok && d->fstype == FS_DIRECTORY && (filesys_name_invalid (fn) || fsdb_name_invalid_dir (fn))); if (!ok) break; /* This calls init_child_aino, which will notice that the parent is being ExNext()ed, and it will increment the locked counts. */ - aino = lookup_child_aino_for_exnext (unit, base, fn, &err, uniq); + aino = lookup_child_aino_for_exnext (unit, base, fn, &err, uniq, NULL); } fs_closedir (d); + if (currprefs.filesys_inject_icons || unit->ui.inject_icons) + inject_icons_to_directory(unit, base); } -static void do_examine (Unit *unit, dpacket packet, ExamineKey *ek, uaecptr info, bool longfilesize) +static bool do_examine(TrapContext *ctx, Unit *unit, dpacket *packet, a_inode *aino, uaecptr info, bool longfilesize) { for (;;) { TCHAR *name; - if (ek->curr_file == 0) + if (!aino) break; - name = ek->curr_file->nname; - get_fileinfo (unit, packet, info, ek->curr_file, longfilesize); - ek->curr_file = ek->curr_file->sibling; - if (!(unit->volflags & MYVOLUMEINFO_ARCHIVE) && !fsdb_exists(name)) { - TRACE ((_T("%s orphaned"), name)); - continue; + name = aino->nname; + get_fileinfo (ctx, unit, packet, info, aino, longfilesize); + if (!aino->vfso && !(unit->volflags & MYVOLUMEINFO_ARCHIVE) && !fsdb_exists(name)) { + return false; } - TRACE ((_T("curr_file set to %p %s\n"), ek->curr_file, - ek->curr_file ? ek->curr_file->aname : _T("NULL"))); - return; + return true; } - TRACE((_T("no more entries\n"))); - free_exkey (unit, ek); + free_exkey (unit, aino->parent); PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_NO_MORE_ENTRIES); + return true; } -static void action_examine_next (Unit *unit, dpacket packet, bool largefilesize) +static void action_examine_next(TrapContext *ctx, Unit *unit, dpacket *packet, bool largefilesize) { uaecptr lock = GET_PCK_ARG1 (packet) << 2; uaecptr info = GET_PCK_ARG2 (packet) << 2; - a_inode *aino = 0; - ExamineKey *ek; + a_inode *aino = 0, *daino = 0; uae_u32 uniq; - TRACE((_T("ACTION_EXAMINE_NEXT(0x%lx,0x%lx,%d)\n"), lock, info, largefilesize)); - gui_flicker_led(UNIT_LED(unit), unit->unit, 1); - DUMPLOCK(unit, lock); + gui_flicker_led (UNIT_LED(unit), unit->unit, 1); if (lock != 0) - aino = aino_from_lock (unit, lock); + aino = aino_from_lock(ctx, unit, lock); if (aino == 0) aino = &unit->rootnode; + uniq = trap_get_long(ctx, info); for(;;) { - uniq = get_long (info); - if (uniq == 0) { - write_log (_T("ExNext called for a file! (Houston?)\n")); - goto no_more_entries; - } else if (uniq == 0xFFFFFFFE) - goto no_more_entries; - else if (uniq == 0xFFFFFFFF) { - TRACE((_T("Creating new ExKey\n"))); - ek = new_exkey (unit, aino); - if (ek) { - if (aino->exnext_count++ == 0) - populate_directory (unit, aino); - ek->curr_file = aino->child; - TRACE((_T("Initial curr_file: %p %s\n"), ek->curr_file, - ek->curr_file ? ek->curr_file->aname : _T("NULL"))); - } - } else { - TRACE((_T("Looking up ExKey\n"))); - ek = lookup_exkey (unit, get_long (info)); + if (uniq == aino->uniq) { + // first exnext + if (!aino->dir) { + write_log (_T("ExNext called for a file! %s:%d (Houston?)\n"), aino->nname, uniq); + goto no_more_entries; + } + if (aino->exnext_count++ == 0) + populate_directory (unit, aino); + if (!aino->child) + goto no_more_entries; + daino = aino->child; + } else { + daino = lookup_aino(unit, uniq); + if (!daino) { + // deleted? Look for next larger uniq in same directory. + daino = aino->child; + while (daino && uniq >= daino->uniq) { + daino = daino->sibling; + } + // didn't find, what about previous? + if (!daino) { + daino = aino->child; + while (daino && uniq >= daino->uniq) { + if (daino->sibling && daino->sibling->uniq >= uniq) { + break; + } + daino = daino->sibling; + } + } + // didn't find any but there are still entries? restart from beginning. + if (!daino && aino->child) { + daino = aino->child; + } + } else { + daino = daino->sibling; + } } - if (ek == 0) { - write_log (_T("Couldn't find a matching ExKey. Prepare for trouble.\n")); + if (!daino) + goto no_more_entries; + if (daino->parent != aino) { + write_log(_T("Houston, we have a BIG problem. %s is not parent of %s\n"), daino->nname, aino->nname); goto no_more_entries; } - put_long (info, ek->uniq); - if (!ek->curr_file || ek->curr_file->mountcount == unit->mountcount) - break; - ek->curr_file = ek->curr_file->sibling; - if (!ek->curr_file) - goto no_more_entries; - } - do_examine (unit, packet, ek, info, largefilesize); - return; + uniq = daino->uniq; + if (daino->mountcount != unit->mountcount) + continue; + if (!do_examine(ctx, unit, packet, daino, info, largefilesize)) + continue; + return; + } no_more_entries: + free_exkey(unit, aino); PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_NO_MORE_ENTRIES); } -static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallback) +static void do_find(TrapContext *ctx, Unit *unit, dpacket *packet, int mode, int create, int fallback) { uaecptr fh = GET_PCK_ARG1 (packet) << 2; uaecptr lock = GET_PCK_ARG2 (packet) << 2; uaecptr name = GET_PCK_ARG3 (packet) << 2; a_inode *aino; Key *k; - struct fs_filehandle *fd; + struct fs_filehandle *fd = NULL; int err; mode_t openmode; int aino_created = 0; int isvirtual = unit->volflags & MYVOLUMEINFO_ARCHIVE; - TRACE((_T("ACTION_FIND_*(0x%08x,0x%08x,\"%s\",%d,%d)\n"), fh, lock, bstr (unit, name), mode, create)); - TRACE((_T("fh=%x lock=%x name=%x\n"), fh, lock, name)); - DUMPLOCK(unit, lock); - - aino = find_aino (unit, lock, bstr (unit, name), &err); + aino = find_aino(ctx, unit, lock, bstr(ctx, unit, name), &err); if (aino == 0 || (err != 0 && err != ERROR_OBJECT_NOT_AROUND)) { /* Whatever it is, we can't handle it. */ @@ -4065,20 +4091,25 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb PUT_PCK_RES2 (packet, ERROR_OBJECT_IN_USE); return; } + if (create && aino->vfso) { + PUT_PCK_RES1 (packet, DOS_FALSE); + PUT_PCK_RES2 (packet, ERROR_DELETE_PROTECTED); + return; + } if (create == 2 && (aino->amigaos_mode & A_FIBF_DELETE) != 0) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DELETE_PROTECTED); return; } if (create != 2) { - if ((((mode & aino->amigaos_mode) & A_FIBF_WRITE) != 0 || unit->ui.readonly || unit->ui.locked) + if ((((mode & aino->amigaos_mode) & A_FIBF_WRITE) != 0 || is_writeprotected(unit)) && fallback) { mode &= ~A_FIBF_WRITE; } /* Kick 1.3 doesn't check read and write access bits - maybe it would be * simpler just not to do that either. */ - if ((mode & A_FIBF_WRITE) != 0 && (unit->ui.readonly || unit->ui.locked)) { + if ((mode & A_FIBF_WRITE) != 0 && is_writeprotected(unit)) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED); return; @@ -4102,7 +4133,7 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb return; } else { /* Object does not exist. aino points to containing directory. */ - aino = create_child_aino (unit, aino, my_strdup (bstr_cut (unit, name)), 0); + aino = create_child_aino(unit, aino, my_strdup (bstr_cut(ctx, unit, name)), 0); if (aino == 0) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DISK_IS_FULL); /* best we can do */ @@ -4113,21 +4144,23 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb prepare_for_open (aino->nname); - openmode = (((mode & A_FIBF_READ) == 0 ? O_WRONLY - : (mode & A_FIBF_WRITE) == 0 ? O_RDONLY - : O_RDWR) - | (create ? O_CREAT : 0) - | (create == 2 ? O_TRUNC : 0)); - - fd = fs_openfile (unit, aino, openmode | O_BINARY); - if (fd == NULL) { - if (aino_created) - delete_aino (unit, aino); - PUT_PCK_RES1 (packet, DOS_FALSE); - /* archive and fd == NULL = corrupt archive or out of memory */ - PUT_PCK_RES2 (packet, isvirtual ? ERROR_OBJECT_NOT_AROUND : dos_errno ()); - return; - } + if (!aino->vfso) { + openmode = (((mode & A_FIBF_READ) == 0 ? O_WRONLY + : (mode & A_FIBF_WRITE) == 0 ? O_RDONLY + : O_RDWR) + | (create ? O_CREAT : 0) + | (create == 2 ? O_TRUNC : 0)); + + fd = fs_openfile (unit, aino, openmode | O_BINARY); + if (fd == NULL) { + if (aino_created) + delete_aino (unit, aino); + PUT_PCK_RES1 (packet, DOS_FALSE); + /* archive and fd == NULL = corrupt archive or out of memory */ + PUT_PCK_RES2 (packet, isvirtual ? ERROR_OBJECT_NOT_AROUND : dos_errno ()); + return; + } + } k = new_key (unit); k->fd = fd; @@ -4139,7 +4172,7 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb if (create && isvirtual) fsdb_set_file_attrs (aino); - put_long (fh+36, k->uniq); + trap_put_long(ctx, fh + 36, k->uniq); if (create == 2) { aino->elock = 1; // clear comment if file already existed @@ -4152,11 +4185,11 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb aino->shlock++; } de_recycle_aino (unit, aino); + PUT_PCK_RES1 (packet, DOS_TRUE); } -static void - action_fh_from_lock (Unit *unit, dpacket packet) +static void action_fh_from_lock(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr fh = GET_PCK_ARG1 (packet) << 2; uaecptr lock = GET_PCK_ARG2 (packet) << 2; @@ -4166,16 +4199,13 @@ static void mode_t openmode; int mode; - TRACE((_T("ACTION_FH_FROM_LOCK(0x%lx,0x%lx)\n"), fh, lock)); - DUMPLOCK(unit,lock); - if (!lock) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, 0); return; } - aino = aino_from_lock (unit, lock); + aino = aino_from_lock(ctx, unit, lock); if (aino == 0) aino = &unit->rootnode; @@ -4183,13 +4213,12 @@ static void prepare_for_open (aino->nname); - TRACE ((_T(" mode is %d\n"), mode)); openmode = (((mode & A_FIBF_READ) ? O_WRONLY : (mode & A_FIBF_WRITE) ? O_RDONLY : O_RDWR)); /* the files on CD really can have the write-bit set. */ - if (unit->ui.readonly || unit->ui.locked) + if (is_writeprotected(unit)) openmode = O_RDONLY; fd = fs_openfile (unit, aino, openmode | O_BINARY); @@ -4203,42 +4232,39 @@ static void k->fd = fd; k->aino = aino; - put_long (fh+36, k->uniq); + trap_put_long(ctx, fh + 36, k->uniq); /* I don't think I need to play with shlock count here, because I'm opening from an existing lock ??? */ de_recycle_aino (unit, aino); - free_lock (unit, lock); /* lock must be unlocked */ + free_lock (ctx, unit, lock); /* lock must be unlocked */ PUT_PCK_RES1 (packet, DOS_TRUE); /* PUT_PCK_RES2 (packet, k->uniq); - this shouldn't be necessary, try without it */ } -static void - action_find_input (Unit *unit, dpacket packet) +static void action_find_input(TrapContext *ctx, Unit *unit, dpacket *packet) { - do_find(unit, packet, A_FIBF_READ|A_FIBF_WRITE, 0, 1); + do_find(ctx, unit, packet, A_FIBF_READ | A_FIBF_WRITE, 0, 1); } -static void - action_find_output (Unit *unit, dpacket packet) +static void action_find_output(TrapContext *ctx, Unit *unit, dpacket *packet) { - if (unit->ui.readonly || unit->ui.locked) { + if (is_writeprotected(unit)) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED); return; } - do_find(unit, packet, A_FIBF_READ|A_FIBF_WRITE, 2, 0); + do_find(ctx, unit, packet, A_FIBF_READ | A_FIBF_WRITE, 2, 0); } -static void - action_find_write (Unit *unit, dpacket packet) +static void action_find_write(TrapContext *ctx, Unit *unit, dpacket *packet) { - if (unit->ui.readonly || unit->ui.locked) { + if (is_writeprotected(unit)) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED); return; } - do_find(unit, packet, A_FIBF_READ|A_FIBF_WRITE, 1, 0); + do_find(ctx, unit, packet, A_FIBF_READ | A_FIBF_WRITE, 1, 0); } /* change file/dir's parent dir modification time */ @@ -4257,16 +4283,14 @@ static void updatedirtime (a_inode *a1, int now) } } -static void - action_end (Unit *unit, dpacket packet) +static void action_end(TrapContext *ctx, Unit *unit, dpacket *packet) { Key *k; - TRACE((_T("ACTION_END(0x%lx)\n"), GET_PCK_ARG1 (packet))); k = lookup_key (unit, GET_PCK_ARG1 (packet)); if (k != 0) { if (k->notifyactive) { - notify_check (unit, k->aino); + notify_check(ctx, unit, k->aino); updatedirtime (k->aino, 1); } if (k->aino->elock) @@ -4280,8 +4304,7 @@ static void PUT_PCK_RES2 (packet, 0); } -static void - action_read (Unit *unit, dpacket packet) +static void action_read(TrapContext *ctx, Unit *unit, dpacket *packet) { Key *k = lookup_key (unit, GET_PCK_ARG1 (packet)); uaecptr addr = GET_PCK_ARG2 (packet); @@ -4293,17 +4316,25 @@ static void /* PUT_PCK_RES2 (packet, EINVAL); */ return; } - TRACE((_T("ACTION_READ(%s,0x%lx,%ld)\n"), k->aino->nname, addr, size)); - gui_flicker_led(UNIT_LED(unit), unit->unit, 1); + gui_flicker_led (UNIT_LED(unit), unit->unit, 1); if (size == 0) { PUT_PCK_RES1 (packet, 0); PUT_PCK_RES2 (packet, 0); - } else if (!valid_address (addr, size)) { + } else if (k->aino->vfso) { + uae_s64 filesize = k->aino->vfso->size; + for (int i = 0; i < size && k->file_pos < filesize; i++) { + trap_put_byte(ctx, addr + i, k->aino->vfso->data[k->file_pos]); + k->file_pos++; + actual++; + } + PUT_PCK_RES1 (packet, actual); + size = 0; + } else { /* check if filesize < size */ uae_s64 filesize, cur; - filesize = fs_fsize64 (k->fd); + filesize = key_filesize(k); cur = k->file_pos; if (size > filesize - cur) size = filesize - cur; @@ -4311,14 +4342,13 @@ static void if (size == 0) { PUT_PCK_RES1 (packet, 0); PUT_PCK_RES2 (packet, 0); - } else if (!valid_address (addr, size)) { + } else if (!trap_valid_address(ctx, addr, size)) { /* it really crosses memory boundary */ uae_u8 *buf; - write_log (_T("unixfs warning: Bad pointer passed for read: %08x, size %d\n"), addr, size); /* ugh this is inefficient but easy */ - if (fs_lseek64 (k->fd, k->file_pos, SEEK_SET) < 0) { + if (key_seek(k, k->file_pos, SEEK_SET) < 0) { PUT_PCK_RES1 (packet, 0); PUT_PCK_RES2 (packet, dos_errno ()); return; @@ -4330,32 +4360,32 @@ static void PUT_PCK_RES2 (packet, ERROR_NO_FREE_STORE); return; } + actual = fs_read (k->fd, buf, size); if ((uae_s32)actual == -1) { PUT_PCK_RES1 (packet, 0); PUT_PCK_RES2 (packet, dos_errno()); } else { - int i; PUT_PCK_RES1 (packet, actual); - for (i = 0; i < actual; i++) - put_byte(addr + i, buf[i]); + trap_put_bytes(ctx, buf, addr, actual); k->file_pos += actual; } xfree (buf); size = 0; } } - if (size) { - /* normal fast read */ - uae_u8 *realpt = get_real_address (addr); - if (fs_lseek64 (k->fd, k->file_pos, SEEK_SET) < 0) { + if (size) { + + if (key_seek(k, k->file_pos, SEEK_SET) < 0) { PUT_PCK_RES1 (packet, 0); PUT_PCK_RES2 (packet, dos_errno ()); return; } + /* normal fast read */ + uae_u8 *realpt = get_real_address (addr); actual = fs_read (k->fd, realpt, size); if (actual == 0) { @@ -4369,18 +4399,15 @@ static void k->file_pos += actual; } } - TRACE((_T("=%d\n"), actual)); } -static void - action_write (Unit *unit, dpacket packet) +static void action_write(TrapContext *ctx, Unit *unit, dpacket *packet) { Key *k = lookup_key (unit, GET_PCK_ARG1 (packet)); uaecptr addr = GET_PCK_ARG2 (packet); uae_u32 size = GET_PCK_ARG3 (packet); uae_u32 actual; uae_u8 *buf; - int i; if (k == 0) { PUT_PCK_RES1 (packet, DOS_FALSE); @@ -4388,34 +4415,35 @@ static void return; } - gui_flicker_led(UNIT_LED(unit), unit->unit, 2); - TRACE((_T("ACTION_WRITE(%s,0x%lx,%ld)\n"), k->aino->nname, addr, size)); + gui_flicker_led (UNIT_LED(unit), unit->unit, 2); - if (unit->ui.readonly || unit->ui.locked) { + if (is_writeprotected(unit) || k->aino->vfso) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED); return; } if (size == 0) { + actual = 0; PUT_PCK_RES1 (packet, 0); PUT_PCK_RES2 (packet, 0); - } else if (valid_address (addr, size)) { - uae_u8 *realpt = get_real_address (addr); - if (fs_lseek64 (k->fd, k->file_pos, SEEK_SET) < 0) { + } else if (trap_valid_address(ctx, addr, size)) { + + if (key_seek(k, k->file_pos, SEEK_SET) < 0) { PUT_PCK_RES1 (packet, 0); PUT_PCK_RES2 (packet, dos_errno ()); return; } + uae_u8 *realpt = get_real_address (addr); actual = fs_write (k->fd, realpt, size); + } else { - write_log (_T("unixfs warning: Bad pointer passed for write: %08x, size %d\n"), addr, size); /* ugh this is inefficient but easy */ - if (fs_lseek64 (k->fd, k->file_pos, SEEK_SET) < 0) { + if (key_seek(k, k->file_pos, SEEK_SET) < 0) { PUT_PCK_RES1 (packet, 0); PUT_PCK_RES2 (packet, dos_errno ()); return; @@ -4428,14 +4456,12 @@ static void return; } - for (i = 0; i < size; i++) - buf[i] = get_byte(addr + i); + trap_get_bytes(ctx, buf, addr, size); actual = fs_write(k->fd, buf, size); xfree (buf); } - TRACE((_T("=%d\n"), actual)); PUT_PCK_RES1 (packet, actual); if (actual != size) PUT_PCK_RES2 (packet, dos_errno ()); @@ -4445,12 +4471,11 @@ static void k->notifyactive = 1; } -static void - action_seek (Unit *unit, dpacket packet) +static void action_seek(TrapContext *ctx, Unit *unit, dpacket *packet) { Key *k = lookup_key (unit, GET_PCK_ARG1 (packet)); - long pos = (uae_s32)GET_PCK_ARG2 (packet); - long mode = (uae_s32)GET_PCK_ARG3 (packet); + int pos = (uae_s32)GET_PCK_ARG2 (packet); + int mode = (uae_s32)GET_PCK_ARG3 (packet); uae_s64 res; uae_s64 cur; int whence = SEEK_CUR; @@ -4468,11 +4493,9 @@ static void whence = SEEK_SET; cur = k->file_pos; - TRACE((_T("ACTION_SEEK(%s,%d,%d)=%d\n"), k->aino->nname, pos, mode, cur)); - gui_flicker_led(UNIT_LED(unit), unit->unit, 1); - - filesize = fs_fsize64 (k->fd); + gui_flicker_led (UNIT_LED(unit), unit->unit, 1); + filesize = key_filesize(k); if (whence == SEEK_CUR) temppos = cur + pos; if (whence == SEEK_SET) @@ -4485,19 +4508,18 @@ static void return; } - res = fs_lseek64 (k->fd, pos, whence); + res = key_seek(k, pos, whence); if (-1 == res || cur > MAXFILESIZE32) { PUT_PCK_RES1 (packet, -1); PUT_PCK_RES2 (packet, ERROR_SEEK_ERROR); - fs_lseek64 (k->fd, cur, SEEK_SET); + key_seek(k, cur, SEEK_SET); } else { PUT_PCK_RES1 (packet, cur); - k->file_pos = fs_lseek64 (k->fd, 0, SEEK_CUR); + k->file_pos = key_seek(k, 0, SEEK_CUR); } } -static void - action_set_protect (Unit *unit, dpacket packet) +static void action_set_protect(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr lock = GET_PCK_ARG2 (packet) << 2; uaecptr name = GET_PCK_ARG3 (packet) << 2; @@ -4505,15 +4527,13 @@ static void a_inode *a; int err; - TRACE((_T("ACTION_SET_PROTECT(0x%lx,\"%s\",0x%lx)\n"), lock, bstr (unit, name), mask)); - - if (unit->ui.readonly || unit->ui.locked) { + if (is_writeprotected(unit)) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED); return; } - a = find_aino (unit, lock, bstr (unit, name), &err); + a = find_aino(ctx, unit, lock, bstr(ctx, unit, name), &err); if (err != 0) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, err); @@ -4530,11 +4550,11 @@ static void } else { PUT_PCK_RES1 (packet, DOS_TRUE); } - notify_check (unit, a); - gui_flicker_led(UNIT_LED(unit), unit->unit, 2); + notify_check(ctx, unit, a); + gui_flicker_led (UNIT_LED(unit), unit->unit, 2); } -static void action_set_comment (Unit * unit, dpacket packet) +static void action_set_comment(TrapContext *ctx, Unit * unit, dpacket *packet) { uaecptr lock = GET_PCK_ARG2 (packet) << 2; uaecptr name = GET_PCK_ARG3 (packet) << 2; @@ -4543,14 +4563,14 @@ static void action_set_comment (Unit * unit, dpacket packet) a_inode *a; int err; - if (unit->ui.readonly || unit->ui.locked) { + if (is_writeprotected(unit)) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED); return; } if (fsdb_cando (unit)) { - commented = bstr (unit, comment); + commented = bstr(ctx, unit, comment); if (_tcslen (commented) > 80) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_COMMENT_TOO_BIG); @@ -4565,9 +4585,8 @@ static void action_set_comment (Unit * unit, dpacket packet) commented = NULL; } } - TRACE ((_T("ACTION_SET_COMMENT(0x%lx,\"%s\")\n"), lock, commented)); - a = find_aino (unit, lock, bstr (unit, name), &err); + a = find_aino(ctx, unit, lock, bstr(ctx, unit, name), &err); if (err != 0) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, err); @@ -4588,43 +4607,37 @@ static void action_set_comment (Unit * unit, dpacket packet) xfree (a->comment); a->comment = commented; fsdb_set_file_attrs (a); - notify_check (unit, a); - gui_flicker_led(UNIT_LED(unit), unit->unit, 2); + notify_check(ctx, unit, a); + gui_flicker_led (UNIT_LED(unit), unit->unit, 2); } -static void - action_same_lock (Unit *unit, dpacket packet) +static void action_same_lock(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr lock1 = GET_PCK_ARG1 (packet) << 2; uaecptr lock2 = GET_PCK_ARG2 (packet) << 2; - TRACE((_T("ACTION_SAME_LOCK(0x%lx,0x%lx)\n"), lock1, lock2)); - DUMPLOCK(unit, lock1); DUMPLOCK(unit, lock2); - if (!lock1 || !lock2) { PUT_PCK_RES1 (packet, lock1 == lock2 ? DOS_TRUE : DOS_FALSE); } else { - PUT_PCK_RES1 (packet, get_long (lock1 + 4) == get_long (lock2 + 4) ? DOS_TRUE : DOS_FALSE); + PUT_PCK_RES1 (packet, trap_get_long(ctx, lock1 + 4) == trap_get_long(ctx, lock2 + 4) ? DOS_TRUE : DOS_FALSE); } } -static void - action_change_mode (Unit *unit, dpacket packet) +static void action_change_mode(TrapContext *ctx, Unit *unit, dpacket *packet) { #define CHANGE_LOCK 0 #define CHANGE_FH 1 /* will be CHANGE_FH or CHANGE_LOCK value */ - long type = GET_PCK_ARG1 (packet); + int type = GET_PCK_ARG1 (packet); /* either a file-handle or lock */ uaecptr object = GET_PCK_ARG2 (packet) << 2; /* will be EXCLUSIVE_LOCK/SHARED_LOCK if CHANGE_LOCK, * or MODE_OLDFILE/MODE_NEWFILE/MODE_READWRITE if CHANGE_FH * * Above is wrong, it is always *_LOCK. TW. */ - long mode = GET_PCK_ARG3 (packet); + int mode = GET_PCK_ARG3 (packet); unsigned long uniq; a_inode *a = NULL, *olda = NULL; int err = 0; - TRACE((_T("ACTION_CHANGE_MODE(0x%lx,%d,%d)\n"), object, type, mode)); if (! object || (type != CHANGE_FH && type != CHANGE_LOCK)) { PUT_PCK_RES1 (packet, DOS_FALSE); @@ -4633,9 +4646,9 @@ static void } if (type == CHANGE_LOCK) { - uniq = get_long (object + 4); + uniq = trap_get_long(ctx, object + 4); } else { - Key *k = lookup_key (unit, get_long (object + 36)); + Key *k = lookup_key (unit, trap_get_long(ctx, object + 36)); if (!k) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_OBJECT_NOT_AROUND); @@ -4671,8 +4684,7 @@ static void } } -static void - action_parent_common (Unit *unit, dpacket packet, unsigned long uniq) +static void action_parent_common(TrapContext *ctx, Unit *unit, dpacket *packet, unsigned long uniq) { a_inode *olda = lookup_aino (unit, uniq); if (olda == 0) { @@ -4693,11 +4705,10 @@ static void } olda->parent->shlock++; de_recycle_aino (unit, olda->parent); - PUT_PCK_RES1 (packet, make_lock (unit, olda->parent->uniq, -2) >> 2); + PUT_PCK_RES1 (packet, make_lock (ctx, unit, olda->parent->uniq, -2) >> 2); } -static void - action_parent_fh (Unit *unit, dpacket packet) +static void action_parent_fh(TrapContext *ctx, Unit *unit, dpacket *packet) { Key *k = lookup_key (unit, GET_PCK_ARG1 (packet)); if (!k) { @@ -4705,42 +4716,35 @@ static void PUT_PCK_RES2 (packet, ERROR_OBJECT_NOT_AROUND); return; } - action_parent_common (unit, packet, k->aino->uniq); + action_parent_common (ctx, unit, packet, k->aino->uniq); } -static void - action_parent (Unit *unit, dpacket packet) +static void action_parent(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr lock = GET_PCK_ARG1 (packet) << 2; - TRACE((_T("ACTION_PARENT(0x%lx)\n"),lock)); - if (!lock) { PUT_PCK_RES1 (packet, 0); PUT_PCK_RES2 (packet, 0); } else { - action_parent_common (unit, packet, get_long (lock + 4)); + action_parent_common(ctx, unit, packet, trap_get_long(ctx, lock + 4)); } - TRACE((_T("=%x %d\n"), GET_PCK_RES1 (packet), GET_PCK_RES2 (packet))); } -static void - action_create_dir (Unit *unit, dpacket packet) +static void action_create_dir(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr lock = GET_PCK_ARG1 (packet) << 2; uaecptr name = GET_PCK_ARG2 (packet) << 2; a_inode *aino; int err; - TRACE((_T("ACTION_CREATE_DIR(0x%lx,\"%s\")\n"), lock, bstr (unit, name))); - - if (unit->ui.readonly || unit->ui.locked) { + if (is_writeprotected(unit)) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED); return; } - aino = find_aino (unit, lock, bstr (unit, name), &err); + aino = find_aino(ctx, unit, lock, bstr(ctx, unit, name), &err); if (aino == 0 || (err != 0 && err != ERROR_OBJECT_NOT_AROUND)) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, err); @@ -4753,7 +4757,7 @@ static void return; } /* Object does not exist. aino points to containing directory. */ - aino = create_child_aino (unit, aino, my_strdup (bstr_cut (unit, name)), 1); + aino = create_child_aino(unit, aino, my_strdup (bstr_cut(ctx, unit, name)), 1); if (aino == 0) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DISK_IS_FULL); /* best we can do */ @@ -4768,45 +4772,36 @@ static void aino->shlock = 1; fsdb_set_file_attrs (aino); de_recycle_aino (unit, aino); - notify_check (unit, aino); + notify_check(ctx, unit, aino); updatedirtime (aino, 0); - PUT_PCK_RES1 (packet, make_lock (unit, aino->uniq, -2) >> 2); - gui_flicker_led(UNIT_LED(unit), unit->unit, 2); + PUT_PCK_RES1(packet, make_lock(ctx, unit, aino->uniq, -2) >> 2); + gui_flicker_led (UNIT_LED(unit), unit->unit, 2); } -static void - action_examine_fh (Unit *unit, dpacket packet, bool largefilesize) +static void action_examine_fh(TrapContext *ctx, Unit *unit, dpacket *packet, bool largefilesize) { Key *k; a_inode *aino = 0; uaecptr info = GET_PCK_ARG2 (packet) << 2; - TRACE((_T("ACTION_EXAMINE_FH(0x%lx,0x%lx,%d)\n"), - GET_PCK_ARG1 (packet), GET_PCK_ARG2 (packet), largefilesize )); - k = lookup_key (unit, GET_PCK_ARG1 (packet)); if (k != 0) aino = k->aino; if (aino == 0) aino = &unit->rootnode; - get_fileinfo (unit, packet, info, aino, largefilesize); - if (aino->dir) - put_long (info, 0xFFFFFFFF); - else - put_long (info, 0); + get_fileinfo(ctx, unit, packet, info, aino, largefilesize); } /* For a nice example of just how contradictory documentation can be, see the * Autodoc for DOS:SetFileSize and the Packets.txt description of this packet... * This implementation tries to mimic the behaviour of the Kick 3.1 ramdisk * (which seems to match the Autodoc description). */ -static void - action_set_file_size (Unit *unit, dpacket packet) +static void action_set_file_size(TrapContext *ctx, Unit *unit, dpacket *packet) { Key *k, *k1; off_t offset = GET_PCK_ARG2 (packet); - long mode = (uae_s32)GET_PCK_ARG3 (packet); + int mode = (uae_s32)GET_PCK_ARG3 (packet); int whence = SEEK_CUR; if (mode > 0) @@ -4814,23 +4809,26 @@ static void if (mode < 0) whence = SEEK_SET; - TRACE((_T("ACTION_SET_FILE_SIZE(0x%lx, %d, 0x%x)\n"), GET_PCK_ARG1 (packet), offset, mode)); - k = lookup_key (unit, GET_PCK_ARG1 (packet)); if (k == 0) { PUT_PCK_RES1 (packet, DOS_TRUE); PUT_PCK_RES2 (packet, ERROR_OBJECT_NOT_AROUND); return; } + if (k->aino->vfso) { + PUT_PCK_RES1 (packet, DOS_FALSE); + PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED); + return; + } /* Fail if file is >=2G, it is not safe operation. */ - if (fs_fsize64 (k->fd) > MAXFILESIZE32) { + if (key_filesize(k) > MAXFILESIZE32_2G) { PUT_PCK_RES1 (packet, DOS_TRUE); PUT_PCK_RES2 (packet, ERROR_BAD_NUMBER); /* ? */ return; } - gui_flicker_led(UNIT_LED(unit), unit->unit, 1); + gui_flicker_led (UNIT_LED(unit), unit->unit, 1); k->notifyactive = 1; /* If any open files have file pointers beyond this size, truncate only * so far that these pointers do not become invalid. */ @@ -4906,29 +4904,26 @@ static void relock_re(Unit *unit, a_inode *a1, a_inode *a2, int failed) write_log (_T("relocking failed '%s' -> '%s'\n"), a1->nname, a2->nname); free_key (unit, k1); } else { - fs_lseek64 (k1->fd, k1->file_pos, SEEK_SET); + key_seek(k1, k1->file_pos, SEEK_SET); } } } } -static void - action_delete_object (Unit *unit, dpacket packet) +static void action_delete_object(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr lock = GET_PCK_ARG1 (packet) << 2; uaecptr name = GET_PCK_ARG2 (packet) << 2; a_inode *a; int err; - TRACE((_T("ACTION_DELETE_OBJECT(0x%lx,\"%s\")\n"), lock, bstr (unit, name))); - - if (unit->ui.readonly || unit->ui.locked) { + if (is_writeprotected(unit)) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED); return; } - a = find_aino (unit, lock, bstr (unit, name), &err); + a = find_aino(ctx, unit, lock, bstr(ctx, unit, name), &err); if (err != 0) { PUT_PCK_RES1 (packet, DOS_FALSE); @@ -4945,23 +4940,24 @@ static void PUT_PCK_RES2 (packet, ERROR_OBJECT_IN_USE); return; } - if (a->dir) { - /* This should take care of removing the fsdb if no files remain. */ - fsdb_dir_writeback (a); - if (my_rmdir (a->nname) == -1) { - PUT_PCK_RES1 (packet, DOS_FALSE); - PUT_PCK_RES2 (packet, dos_errno()); - return; - } - } else { - if (my_unlink (a->nname) == -1) { - PUT_PCK_RES1 (packet, DOS_FALSE); - PUT_PCK_RES2 (packet, dos_errno()); - return; - } - } - - notify_check (unit, a); + if (!a->vfso) { + if (a->dir) { + /* This should take care of removing the fsdb if no files remain. */ + fsdb_dir_writeback (a); + if (my_rmdir (a->nname) == -1) { + PUT_PCK_RES1 (packet, DOS_FALSE); + PUT_PCK_RES2 (packet, dos_errno()); + return; + } + } else { + if (my_unlink (a->nname) == -1) { + PUT_PCK_RES1 (packet, DOS_FALSE); + PUT_PCK_RES2 (packet, dos_errno()); + return; + } + } + } + notify_check(ctx, unit, a); updatedirtime (a, 1); if (a->child != 0) { write_log (_T("Serious error in action_delete_object.\n")); @@ -4970,50 +4966,48 @@ static void delete_aino (unit, a); } PUT_PCK_RES1 (packet, DOS_TRUE); - gui_flicker_led(UNIT_LED(unit), unit->unit, 2); + gui_flicker_led (UNIT_LED(unit), unit->unit, 2); } -static void - action_set_date (Unit *unit, dpacket packet) +static void action_set_date(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr lock = GET_PCK_ARG2 (packet) << 2; uaecptr name = GET_PCK_ARG3 (packet) << 2; uaecptr date = GET_PCK_ARG4 (packet); a_inode *a; struct mytimeval tv; - int err; + int err = 0; - TRACE((_T("ACTION_SET_DATE(0x%lx,\"%s\")\n"), lock, bstr (unit, name))); - - if (unit->ui.readonly || unit->ui.locked) { + if (is_writeprotected(unit)) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED); return; } - a = find_aino (unit, lock, bstr (unit, name), &err); + a = find_aino(ctx, unit, lock, bstr(ctx, unit, name), &err); if (err != 0) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, err); return; } - amiga_to_timeval (&tv, get_long (date), get_long (date + 4), get_long (date + 8)); - //write_log (_T("%llu.%u (%d,%d,%d) %s\n"), tv.tv_sec, tv.tv_usec, get_long (date), get_long (date + 4), get_long (date + 8), a->nname); - if (!my_utime (a->nname, &tv)) - err = dos_errno (); + if (!a->vfso) { + amiga_to_timeval (&tv, trap_get_long(ctx, date), trap_get_long(ctx, date + 4), trap_get_long(ctx, date + 8), 50); + //write_log (_T("%llu.%u (%d,%d,%d) %s\n"), tv.tv_sec, tv.tv_usec, trap_get_long(ctx, date), trap_get_long(ctx, date + 4), trap_get_long(ctx, date + 8), a->nname); + if (!my_utime (a->nname, &tv)) + err = dos_errno (); + } if (err != 0) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, err); return; } else { - notify_check (unit, a); + notify_check(ctx, unit, a); PUT_PCK_RES1 (packet, DOS_TRUE); } - gui_flicker_led(UNIT_LED(unit), unit->unit, 2); + gui_flicker_led (UNIT_LED(unit), unit->unit, 2); } -static void - action_rename_object (Unit *unit, dpacket packet) +static void action_rename_object(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr lock1 = GET_PCK_ARG1 (packet) << 2; uaecptr name1 = GET_PCK_ARG2 (packet) << 2; @@ -5024,22 +5018,18 @@ static void Key *k1, *knext; int wehavekeys = 0; - TRACE((_T("ACTION_RENAME_OBJECT(0x%lx,\"%s\","), lock1, bstr (unit, name1))); - TRACE((_T("0x%lx,\"%s\")\n"), lock2, bstr (unit, name2))); - - if (unit->ui.readonly || unit->ui.locked) { + if (is_writeprotected(unit)) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED); return; } - a1 = find_aino (unit, lock1, bstr (unit, name1), &err1); + a1 = find_aino(ctx, unit, lock1, bstr(ctx, unit, name1), &err1); if (err1 != 0) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, err1); return; } - /* rename always fails if file is open for writing */ for (k1 = unit->keys; k1; k1 = knext) { knext = k1->next; @@ -5051,12 +5041,13 @@ static void } /* See whether the other name already exists in the filesystem. */ - a2 = find_aino (unit, lock2, bstr (unit, name2), &err2); + a2 = find_aino(ctx, unit, lock2, bstr(ctx, unit, name2), &err2); + if (a2 == a1) { /* Renaming to the same name, but possibly different case. */ - if (_tcscmp (a1->aname, bstr_cut (unit, name2)) == 0) { + if (_tcscmp (a1->aname, bstr_cut(ctx, unit, name2)) == 0) { /* Exact match -> do nothing. */ - notify_check (unit, a1); + notify_check(ctx, unit, a1); updatedirtime (a1, 1); PUT_PCK_RES1 (packet, DOS_TRUE); return; @@ -5068,32 +5059,34 @@ static void return; } - a2 = create_child_aino (unit, a2, bstr_cut (unit, name2), a1->dir); + a2 = create_child_aino (unit, a2, bstr_cut(ctx, unit, name2), a1->dir); if (a2 == 0) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DISK_IS_FULL); /* best we can do */ return; } - if (-1 == my_rename (a1->nname, a2->nname)) { - int ret = -1; - /* maybe we have open file handles that caused failure? */ - write_log (_T("rename '%s' -> '%s' failed, trying relocking..\n"), a1->nname, a2->nname); - wehavekeys = relock_do(unit, a1); - /* try again... */ - ret = my_rename (a1->nname, a2->nname); - /* restore locks */ - relock_re(unit, a1, a2, ret == -1 ? 1 : 0); - if (ret == -1) { - delete_aino (unit, a2); - PUT_PCK_RES1 (packet, DOS_FALSE); - PUT_PCK_RES2 (packet, dos_errno ()); - return; + if (!a1->vfso) { + if (-1 == my_rename (a1->nname, a2->nname)) { + int ret = -1; + /* maybe we have open file handles that caused failure? */ + write_log (_T("rename '%s' -> '%s' failed, trying relocking..\n"), a1->nname, a2->nname); + wehavekeys = relock_do(unit, a1); + /* try again... */ + ret = my_rename (a1->nname, a2->nname); + /* restore locks */ + relock_re(unit, a1, a2, ret == -1 ? 1 : 0); + if (ret == -1) { + delete_aino (unit, a2); + PUT_PCK_RES1 (packet, DOS_FALSE); + PUT_PCK_RES2 (packet, dos_errno ()); + return; + } } - } + } - notify_check (unit, a1); - notify_check (unit, a2); + notify_check(ctx, unit, a1); + notify_check(ctx, unit, a2); a2->comment = a1->comment; a1->comment = 0; a2->amigaos_mode = a1->amigaos_mode; @@ -5103,6 +5096,7 @@ static void a2->has_dbentry = a1->has_dbentry; a2->db_offset = a1->db_offset; a2->dirty = 0; + a2->vfso = a1->vfso; move_exkeys (unit, a1, a2); move_aino_children (unit, a1, a2); delete_aino (unit, a1); @@ -5114,11 +5108,10 @@ static void if (a2->elock > 0 || a2->shlock > 0 || wehavekeys > 0) de_recycle_aino (unit, a2); PUT_PCK_RES1 (packet, DOS_TRUE); - gui_flicker_led(UNIT_LED(unit), unit->unit, 2); + gui_flicker_led (UNIT_LED(unit), unit->unit, 2); } -static void - action_current_volume (Unit *unit, dpacket packet) +static void action_current_volume(TrapContext *ctx, Unit *unit, dpacket *packet) { if (filesys_isvolume(unit)) PUT_PCK_RES1 (packet, unit->volume >> 2); @@ -5126,14 +5119,11 @@ static void PUT_PCK_RES1 (packet, 0); } -static void - action_rename_disk (Unit *unit, dpacket packet) +static void action_rename_disk(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr name = GET_PCK_ARG1 (packet) << 2; - TRACE((_T("ACTION_RENAME_DISK(\"%s\")\n"), bstr (unit, name))); - - if (unit->ui.readonly || unit->ui.locked) { + if (is_writeprotected(unit)) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED); return; @@ -5141,49 +5131,39 @@ static void /* get volume name */ xfree (unit->ui.volname); - unit->ui.volname = bstr1 (name); + unit->ui.volname = bstr1(ctx, name); set_volume_name (unit, 0); PUT_PCK_RES1 (packet, DOS_TRUE); } -static void - action_is_filesystem (Unit *unit, dpacket packet) +static void action_is_filesystem(TrapContext *ctx, Unit *unit, dpacket *packet) { - TRACE((_T("ACTION_IS_FILESYSTEM()\n"))); PUT_PCK_RES1 (packet, DOS_TRUE); } -static void - action_flush (Unit *unit, dpacket packet) +static void action_flush(TrapContext *ctx, Unit *unit, dpacket *packet) { - TRACE((_T("ACTION_FLUSH()\n"))); PUT_PCK_RES1 (packet, DOS_TRUE); flush_cache(unit, 0); } -static void - action_more_cache (Unit *unit, dpacket packet) +static void action_more_cache(TrapContext *ctx, Unit *unit, dpacket *packet) { - TRACE((_T("ACTION_MORE_CACHE()\n"))); PUT_PCK_RES1 (packet, 50); /* bug but AmigaOS expects it */ if (GET_PCK_ARG1 (packet) != 0) flush_cache(unit, 0); } -static void - action_inhibit (Unit *unit, dpacket packet) +static void action_inhibit(TrapContext *ctx, Unit *unit, dpacket *packet) { PUT_PCK_RES1 (packet, DOS_TRUE); flush_cache(unit, 0); unit->inhibited = GET_PCK_ARG1 (packet) != 0; - TRACE((_T("ACTION_INHIBIT(%d:%d)\n"), unit->unit, unit->inhibited)); } -static void - action_write_protect (Unit *unit, dpacket packet) +static void action_write_protect(TrapContext *ctx, Unit *unit, dpacket *packet) { - TRACE((_T("ACTION_WRITE_PROTECT()\n"))); PUT_PCK_RES1 (packet, DOS_TRUE); if (GET_PCK_ARG1 (packet)) { if (!unit->ui.locked) { @@ -5204,11 +5184,88 @@ static void /* OS4 */ -static void action_change_file_position64 (Unit *unit, dpacket packet) +#define TAG_DONE 0 +#define TAG_IGNORE 1 +#define TAG_MORE 2 +#define TAG_SKIP 3 + +static void action_filesystem_attr(TrapContext *ctx, Unit *unit, dpacket *packet) +{ + int versize = 0; + uaecptr verbuffer = 0; + uaecptr taglist = GET_PCK_ARG1(packet); + for (;;) { + uae_u32 tag = trap_get_long(ctx, taglist); + uae_u32 tagp = taglist + 4; + if (tag == TAG_DONE) + break; + taglist += 8; + if (tag == TAG_IGNORE) + continue; + if (tag == TAG_MORE) { + uae_u32 val = trap_get_long(ctx, tagp); + taglist = val; + continue; + } + if (tag == TAG_SKIP) { + uae_u32 val = trap_get_long(ctx, tagp); + taglist += val * 8; + continue; + } + uae_u32 retval = 0; + bool doret = false; + switch(tag) + { + case 0x80002332: // FSA_MaxFileNameLengthR + retval = currprefs.filesys_max_name; + doret = true; + break; + case 0x80002334: // FSA_VersionNumberR + retval = (0 << 16) | (5 << 0); + doret = true; + break; + case 0x80002335: // FSA_DOSTypeR + retval = get_long(unit->volume + 32); + doret = true; + break; + case 0x80002336: // FSA_ActivityFlushTimeoutR + case 0x80002338: // FSA_InactivityFlushTimeoutR + retval = 0; + doret = true; + break; + case 0x8000233a: // FSA_MaxRecycledEntriesR + case 0x8000233c: // FSA_HasRecycledEntriesR + retval = 0; + doret = true; + break; + case 0x8000233d: // FSA_VersionStringR + verbuffer = trap_get_long(ctx, tagp); + break; + case 0x8000233e: // FSA_VersionStringR_BufSize + versize = trap_get_long(ctx, tagp); + break; + default: + write_log(_T("action_filesystem_attr unknown tag %08x\n"), tag); + PUT_PCK64_RES1(packet, DOS_FALSE); + PUT_PCK64_RES2(packet, ERROR_NOT_IMPLEMENTED); + return; + } + if (doret) + trap_put_long(ctx, trap_get_long(ctx, tagp), retval); + + } + if (verbuffer && versize) { + trap_put_string(ctx, UAEFS_VERSION, verbuffer, versize); + } + PUT_PCK_RES1(packet, TRUE); + PUT_PCK_RES2(packet, 0); +} + +static void action_change_file_position64(TrapContext *ctx, Unit *unit, dpacket *packet) { Key *k = lookup_key (unit, GET_PCK64_ARG1 (packet)); uae_s64 pos = GET_PCK64_ARG2 (packet); - long mode = GET_PCK64_ARG3 (packet); + int mode = (uae_s32)GET_PCK64_ARG3 (packet); long whence = SEEK_CUR; uae_s64 res, cur; @@ -5225,13 +5282,12 @@ static void action_change_file_position64 (Unit *unit, dpacket packet) if (mode < 0) whence = SEEK_SET; - TRACE((_T("ACTION_CHANGE_FILE_POSITION64(%s,%lld,%d)\n"), k->aino->nname, pos, mode)); - gui_flicker_led(UNIT_LED(unit), unit->unit, 1); + gui_flicker_led (UNIT_LED(unit), unit->unit, 1); cur = k->file_pos; { uae_s64 temppos; - uae_s64 filesize = fs_fsize64 (k->fd); + uae_s64 filesize = key_filesize(k); if (whence == SEEK_CUR) temppos = cur + pos; @@ -5246,7 +5302,7 @@ static void action_change_file_position64 (Unit *unit, dpacket packet) return; } } - res = fs_lseek64 (k->fd, pos, whence); + res = key_seek(k, pos, whence); if (-1 == res) { PUT_PCK64_RES1 (packet, DOS_FALSE); @@ -5254,13 +5310,11 @@ static void action_change_file_position64 (Unit *unit, dpacket packet) } else { PUT_PCK64_RES1 (packet, TRUE); PUT_PCK64_RES2 (packet, 0); - k->file_pos = fs_lseek64 (k->fd, 0, SEEK_CUR); + k->file_pos = key_seek(k, 0, SEEK_CUR); } - TRACE((_T("= oldpos %lld newpos %lld\n"), cur, k->file_pos)); - } -static void action_get_file_position64 (Unit *unit, dpacket packet) +static void action_get_file_position64(TrapContext *ctx, Unit *unit, dpacket *packet) { Key *k = lookup_key (unit, GET_PCK64_ARG1 (packet)); @@ -5271,16 +5325,15 @@ static void action_get_file_position64 (Unit *unit, dpacket packet) PUT_PCK64_RES2 (packet, ERROR_INVALID_LOCK); return; } - TRACE((_T("ACTION_GET_FILE_POSITION64(%s)=%lld\n"), k->aino->nname, k->file_pos)); PUT_PCK64_RES1 (packet, k->file_pos); PUT_PCK64_RES2 (packet, 0); } -static void action_change_file_size64 (Unit *unit, dpacket packet) +static void action_change_file_size64(TrapContext *ctx, Unit *unit, dpacket *packet) { Key *k, *k1; uae_s64 offset = GET_PCK64_ARG2 (packet); - long mode = (uae_s32)GET_PCK64_ARG3 (packet); + int mode = (uae_s32)GET_PCK64_ARG3 (packet); int whence = SEEK_CUR; PUT_PCK64_RES0 (packet, DP64_INIT); @@ -5290,8 +5343,6 @@ static void action_change_file_size64 (Unit *unit, dpacket packet) if (mode < 0) whence = SEEK_SET; - TRACE((_T("ACTION_CHANGE_FILE_SIZE64(0x%lx, %lld, 0x%x)\n"), GET_PCK64_ARG1 (packet), offset, mode)); - k = lookup_key (unit, GET_PCK64_ARG1 (packet)); if (k == 0) { PUT_PCK64_RES1 (packet, DOS_FALSE); @@ -5299,7 +5350,7 @@ static void action_change_file_size64 (Unit *unit, dpacket packet) return; } - gui_flicker_led(UNIT_LED(unit), unit->unit, 1); + gui_flicker_led (UNIT_LED(unit), unit->unit, 1); k->notifyactive = 1; /* If any open files have file pointers beyond this size, truncate only * so far that these pointers do not become invalid. */ @@ -5312,11 +5363,11 @@ static void action_change_file_size64 (Unit *unit, dpacket packet) /* Write one then truncate: that should give the right size in all cases. */ fs_lseek (k->fd, offset, whence); - offset = fs_lseek64 (k->fd, offset, whence); + offset = key_seek(k, offset, whence); fs_write (k->fd, /* whatever */(uae_u8*)&k1, 1); if (k->file_pos > offset) k->file_pos = offset; - fs_lseek64 (k->fd, k->file_pos, SEEK_SET); + key_seek(k, k->file_pos, SEEK_SET); if (my_truncate (k->aino->nname, offset) == -1) { PUT_PCK64_RES1 (packet, DOS_FALSE); @@ -5328,7 +5379,7 @@ static void action_change_file_size64 (Unit *unit, dpacket packet) PUT_PCK64_RES2 (packet, 0); } -static void action_get_file_size64 (Unit *unit, dpacket packet) +static void action_get_file_size64(TrapContext *ctx, Unit *unit, dpacket *packet) { Key *k = lookup_key (unit, GET_PCK64_ARG1 (packet)); uae_s64 filesize; @@ -5340,8 +5391,7 @@ static void action_get_file_size64 (Unit *unit, dpacket packet) PUT_PCK64_RES2 (packet, ERROR_INVALID_LOCK); return; } - filesize = fs_fsize64 (k->fd); - TRACE((_T("ACTION_GET_FILE_SIZE64(%s)=%lld\n"), k->aino->nname, filesize)); + filesize = key_filesize(k); if (filesize >= 0) { PUT_PCK64_RES1 (packet, filesize); PUT_PCK64_RES2 (packet, 0); @@ -5353,32 +5403,25 @@ static void action_get_file_size64 (Unit *unit, dpacket packet) /* MOS */ -static void action_examine_object64(Unit *unit, dpacket packet) +static void action_examine_object64(TrapContext *ctx, Unit *unit, dpacket *packet) { uaecptr lock = GET_PCK_ARG1 (packet) << 2; uaecptr info = GET_PCK_ARG2 (packet) << 2; a_inode *aino = 0; - TRACE((_T("ACTION_EXAMINE_OBJECT(0x%lx,0x%lx)\n"), lock, info)); - DUMPLOCK(unit, lock); - if (lock != 0) - aino = aino_from_lock (unit, lock); + aino = aino_from_lock(ctx, unit, lock); if (aino == 0) aino = &unit->rootnode; - get_fileinfo (unit, packet, info, aino, true); - if (aino->dir) { - put_long (info, 0xFFFFFFFF); - } else - put_long (info, 0); + get_fileinfo(ctx, unit, packet, info, aino, true); } -static void action_set_file_size64(Unit *unit, dpacket packet) +static void action_set_file_size64(TrapContext *ctx, Unit *unit, dpacket *packet) { Key *k, *k1; - uae_s64 offset = get_quadp(GET_PCK_ARG2 (packet)); - long mode = (uae_s32)GET_PCK_ARG3 (packet); + uae_s64 offset = get_quadp(ctx, GET_PCK_ARG2 (packet)); + int mode = (uae_s32)GET_PCK_ARG3 (packet); int whence = SEEK_CUR; if (mode > 0) @@ -5386,8 +5429,6 @@ static void action_set_file_size64(Unit *unit, dpacket packet) if (mode < 0) whence = SEEK_SET; - TRACE((_T("ACTION_SET_FILE_SIZE64(0x%lx, %lld, 0x%x)\n"), GET_PCK_ARG1 (packet), offset, mode)); - k = lookup_key (unit, GET_PCK_ARG1 (packet)); if (k == 0) { PUT_PCK_RES1 (packet, DOS_FALSE); @@ -5395,7 +5436,7 @@ static void action_set_file_size64(Unit *unit, dpacket packet) return; } - gui_flicker_led(UNIT_LED(unit), unit->unit, 1); + gui_flicker_led (UNIT_LED(unit), unit->unit, 1); k->notifyactive = 1; /* If any open files have file pointers beyond this size, truncate only * so far that these pointers do not become invalid. */ @@ -5408,11 +5449,11 @@ static void action_set_file_size64(Unit *unit, dpacket packet) /* Write one then truncate: that should give the right size in all cases. */ fs_lseek (k->fd, offset, whence); - offset = fs_lseek64 (k->fd, offset, whence); + offset = key_seek(k, offset, whence); fs_write (k->fd, /* whatever */(uae_u8*)&k1, 1); if (k->file_pos > offset) k->file_pos = offset; - fs_lseek64 (k->fd, k->file_pos, SEEK_SET); + key_seek(k, k->file_pos, SEEK_SET); if (my_truncate (k->aino->nname, offset) == -1) { PUT_PCK_RES1 (packet, DOS_FALSE); @@ -5421,14 +5462,14 @@ static void action_set_file_size64(Unit *unit, dpacket packet) } PUT_PCK_RES1 (packet, DOS_TRUE); - set_quadp(GET_PCK_ARG4(packet), offset); + set_quadp(ctx, GET_PCK_ARG4(packet), offset); } -static void action_seek64(Unit *unit, dpacket packet) +static void action_seek64(TrapContext *ctx, Unit *unit, dpacket *packet) { Key *k = lookup_key(unit, GET_PCK_ARG1(packet)); - uae_s64 pos = get_quadp(GET_PCK64_ARG2(packet)); - long mode = GET_PCK_ARG3(packet); + uae_s64 pos = get_quadp(ctx, GET_PCK64_ARG2(packet)); + int mode = GET_PCK_ARG3(packet); long whence = SEEK_CUR; uae_s64 res, cur; @@ -5443,13 +5484,12 @@ static void action_seek64(Unit *unit, dpacket packet) if (mode < 0) whence = SEEK_SET; - TRACE((_T("ACTION_SEEK64(%s,%lld,%d)\n"), k->aino->nname, pos, mode)); - gui_flicker_led(UNIT_LED(unit), unit->unit, 1); + gui_flicker_led (UNIT_LED(unit), unit->unit, 1); cur = k->file_pos; { uae_s64 temppos; - uae_s64 filesize = fs_fsize64 (k->fd); + uae_s64 filesize = key_filesize(k); if (whence == SEEK_CUR) temppos = cur + pos; @@ -5464,24 +5504,23 @@ static void action_seek64(Unit *unit, dpacket packet) return; } } - res = fs_lseek64 (k->fd, pos, whence); + res = key_seek(k, pos, whence); if (-1 == res) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_SEEK_ERROR); } else { PUT_PCK_RES1 (packet, TRUE); - set_quadp(GET_PCK_ARG3(packet), cur); - k->file_pos = fs_lseek64 (k->fd, 0, SEEK_CUR); + set_quadp(ctx, GET_PCK_ARG3(packet), cur); + k->file_pos = key_seek(k, 0, SEEK_CUR); } - TRACE((_T("= oldpos %lld newpos %lld\n"), cur, k->file_pos)); } -static int action_lock_record64(Unit *unit, dpacket packet, uae_u32 msg) +static int action_lock_record64(TrapContext *ctx, Unit *unit, dpacket *packet, uae_u32 msg) { Key *k = lookup_key(unit, GET_PCK_ARG1(packet)); - uae_u64 pos = get_quadp(GET_PCK_ARG2(packet)); - uae_u64 len = get_quadp(GET_PCK_ARG3(packet)); + uae_u64 pos = get_quadp(ctx, GET_PCK_ARG2(packet)); + uae_u64 len = get_quadp(ctx, GET_PCK_ARG3(packet)); uae_u32 mode = GET_PCK_ARG4(packet); uae_u32 timeout = GET_PCK_ARG5(packet); @@ -5517,7 +5556,7 @@ static int action_lock_record64(Unit *unit, dpacket packet, uae_u32 msg) return 1; } - struct lockrecord *lr = new_record (GET_PCK_ARG1(packet), pos, len, mode, timeout, 0); + struct lockrecord *lr = new_record(packet, pos, len, mode, timeout, 0); if (k->record) { lr->next = k->record; k->record = lr; @@ -5529,11 +5568,11 @@ static int action_lock_record64(Unit *unit, dpacket packet, uae_u32 msg) return 1; } -static void action_free_record64(Unit *unit, dpacket packet) +static void action_free_record64(TrapContext *ctx, Unit *unit, dpacket *packet) { Key *k = lookup_key(unit, GET_PCK_ARG1(packet)); - uae_u64 pos = get_quadp(GET_PCK_ARG2(packet)); - uae_u64 len = get_quadp(GET_PCK_ARG3 (packet)); + uae_u64 pos = get_quadp(ctx, GET_PCK_ARG2(packet)); + uae_u64 len = get_quadp(ctx, GET_PCK_ARG3 (packet)); write_log (_T("action_free_record('%s',%lld,%lld)\n"), k ? k->aino->nname : _T("null"), pos, len); @@ -5552,7 +5591,7 @@ static void action_free_record64(Unit *unit, dpacket packet) k->record = lr->next; xfree (lr); write_log (_T("->OK\n")); - record_check_waiting (unit); + record_check_waiting(ctx, unit); PUT_PCK_RES1 (packet, DOS_TRUE); return; } @@ -5566,30 +5605,14 @@ static void action_free_record64(Unit *unit, dpacket packet) * know whether AmigaOS takes care of that, but this does. */ static uae_sem_t singlethread_int_sem = 0; -static uae_u32 REGPARAM2 exter_int_helper (TrapContext *context) +static uae_u32 REGPARAM2 exter_int_helper (TrapContext *ctx) { UnitInfo *uip = mountinfo.ui; uaecptr port; - int n = m68k_dreg (regs, 0); + int n = trap_get_dreg(ctx, 0); static int unit_no; - switch (n) { - case 0: - /* Determine whether a given EXTER interrupt is for us. */ - if (uae_int_requested & 1) { - if (uae_sem_trywait (&singlethread_int_sem) != 0) - /* Pretend it isn't for us. We might get it again later. */ - return 0; - /* Clear the interrupt flag _before_ we do any processing. - * That way, we can get too many interrupts, but never not - * enough. */ - filesys_in_interrupt++; - uae_int_requested &= ~1; - unit_no = 0; - return 1; - } - return 0; - case 1: + if (n == 1) { /* Release a message_lock. This is called as soon as the message is * received by the assembly code. We use the opportunity to check * whether we have some locks that we can give back to the assembler @@ -5599,32 +5622,43 @@ static uae_u32 REGPARAM2 exter_int_helper (TrapContext *context) */ #ifdef UAE_FILESYS_THREADS { - Unit *unit = find_unit (m68k_areg (regs, 5)); - uaecptr msg = m68k_areg (regs, 4); + Unit *unit = find_unit(trap_get_areg(ctx, 5)); + uaecptr msg = trap_get_areg(ctx, 4); unit->cmds_complete = unit->cmds_acked; while (comm_pipe_has_data (unit->ui.back_pipe)) { - uaecptr locks, lockend; + uaecptr locks, lockend, lockv; int cnt = 0; locks = read_comm_pipe_int_blocking (unit->ui.back_pipe); lockend = locks; - while (get_long (lockend) != 0) { - if (get_long (lockend) == lockend) { + while ((lockv = trap_get_long(ctx, lockend)) != 0) { + if (lockv == lockend) { write_log (_T("filesystem lock queue corrupted!\n")); break; } - lockend = get_long (lockend); + lockend = lockv; cnt++; } - TRACE3((_T("message_lock: %d %x %x %x\n"), cnt, locks, lockend, m68k_areg (regs, 3))); - put_long (lockend, get_long (m68k_areg (regs, 3))); - put_long (m68k_areg (regs, 3), locks); + trap_put_long(ctx, lockend, trap_get_long(ctx, trap_get_areg(ctx, 3))); + trap_put_long(ctx, trap_get_areg(ctx, 3), locks); } } #else write_log (_T("exter_int_helper should not be called with arg 1!\n")); #endif - break; - case 2: + return 0; + } + + if(n == 10) { + if (uae_sem_trywait (&singlethread_int_sem) != 0) { + /* Pretend it isn't for us. We might get it again later. */ + do_uae_int_requested(); + return 0; + } + filesys_in_interrupt++; + unit_no = 0; + } + if (n >= 10) { + /* Find work that needs to be done: * return d0 = 0: none * d0 = 1: PutMsg(), port in a0, message in a1 @@ -5640,26 +5674,26 @@ static uae_u32 REGPARAM2 exter_int_helper (TrapContext *context) int cmd = read_comm_pipe_int_blocking (&native2amiga_pending); switch (cmd) { case 0: /* Signal() */ - m68k_areg (regs, 1) = read_comm_pipe_u32_blocking (&native2amiga_pending); - m68k_dreg (regs, 1) = read_comm_pipe_u32_blocking (&native2amiga_pending); + trap_set_areg(ctx, 1, read_comm_pipe_u32_blocking(&native2amiga_pending)); + trap_set_dreg(ctx, 1, read_comm_pipe_u32_blocking(&native2amiga_pending)); return 2; case 1: /* PutMsg() */ - m68k_areg (regs, 0) = read_comm_pipe_u32_blocking (&native2amiga_pending); - m68k_areg (regs, 1) = read_comm_pipe_u32_blocking (&native2amiga_pending); + trap_set_areg(ctx, 0, read_comm_pipe_u32_blocking(&native2amiga_pending)); + trap_set_areg(ctx, 1, read_comm_pipe_u32_blocking(&native2amiga_pending)); return 1; case 2: /* ReplyMsg() */ - m68k_areg (regs, 1) = read_comm_pipe_u32_blocking (&native2amiga_pending); + trap_set_areg(ctx, 1, read_comm_pipe_u32_blocking(&native2amiga_pending)); return 3; case 3: /* Cause() */ - m68k_areg (regs, 1) = read_comm_pipe_u32_blocking (&native2amiga_pending); + trap_set_areg(ctx, 1, read_comm_pipe_u32_blocking(&native2amiga_pending)); return 4; case 4: /* NotifyHack() */ - m68k_areg (regs, 0) = read_comm_pipe_u32_blocking (&native2amiga_pending); - m68k_areg (regs, 1) = read_comm_pipe_u32_blocking (&native2amiga_pending); + trap_set_areg(ctx, 0, read_comm_pipe_u32_blocking(&native2amiga_pending)); + trap_set_areg(ctx, 1, read_comm_pipe_u32_blocking(&native2amiga_pending)); return 5; default: @@ -5675,7 +5709,7 @@ static uae_u32 REGPARAM2 exter_int_helper (TrapContext *context) * startup packet sent. */ for (;;) { if (unit_no >= MAX_FILESYSTEM_UNITS) - return 0; + goto end; if (uip[unit_no].open > 0 && uip[unit_no].self != 0 && uip[unit_no].self->cmds_acked == uip[unit_no].self->cmds_complete @@ -5686,35 +5720,26 @@ static uae_u32 REGPARAM2 exter_int_helper (TrapContext *context) uip[unit_no].self->cmds_acked = uip[unit_no].self->cmds_sent; port = uip[unit_no].self->port; if (port) { - m68k_areg (regs, 0) = port; - m68k_areg (regs, 1) = find_unit (port)->dummy_message; + trap_set_areg(ctx, 0, port); + trap_set_areg(ctx, 1, find_unit(port)->dummy_message); unit_no++; return 1; } - break; - case 3: - uae_sem_wait (&singlethread_int_sem); - break; - case 4: + +end: /* Exit the interrupt, and release the single-threading lock. */ filesys_in_interrupt--; uae_sem_post (&singlethread_int_sem); - break; - - default: - write_log (_T("Shouldn't happen in exter_int_helper.\n")); - break; } return 0; } -static int handle_packet (Unit *unit, dpacket pck, uae_u32 msg) +static int handle_packet(TrapContext *ctx, Unit *unit, dpacket *pck, uae_u32 msg, int isvolume) { uae_s32 type = GET_PCK_TYPE (pck); PUT_PCK_RES2 (pck, 0); - TRACE((_T("unit=%x packet=%d\n"), unit, type)); - if (unit->inhibited && filesys_isvolume(unit) + if (unit->inhibited && isvolume && type != ACTION_INHIBIT && type != ACTION_MORE_CACHE && type != ACTION_DISK_INFO) { PUT_PCK_RES1 (pck, DOS_FALSE); @@ -5724,71 +5749,72 @@ static int handle_packet (Unit *unit, dpacket pck, uae_u32 msg) if (type != ACTION_INHIBIT && type != ACTION_CURRENT_VOLUME && type != ACTION_IS_FILESYSTEM && type != ACTION_MORE_CACHE && type != ACTION_WRITE_PROTECT && type != ACTION_DISK_INFO - && !filesys_isvolume(unit)) { + && !isvolume) { PUT_PCK_RES1 (pck, DOS_FALSE); PUT_PCK_RES2 (pck, unit->ui.unknown_media ? ERROR_NOT_A_DOS_DISK : ERROR_NO_DISK); return 1; } switch (type) { - case ACTION_LOCATE_OBJECT: action_lock (unit, pck); break; - case ACTION_FREE_LOCK: action_free_lock (unit, pck); break; - case ACTION_COPY_DIR: action_dup_lock (unit, pck); break; - case ACTION_DISK_INFO: action_disk_info (unit, pck); break; - case ACTION_INFO: action_info (unit, pck); break; - case ACTION_EXAMINE_OBJECT: action_examine_object (unit, pck); break; - case ACTION_EXAMINE_NEXT: action_examine_next (unit, pck, false); break; - case ACTION_FIND_INPUT: action_find_input (unit, pck); break; - case ACTION_FIND_WRITE: action_find_write (unit, pck); break; - case ACTION_FIND_OUTPUT: action_find_output (unit, pck); break; - case ACTION_END: action_end (unit, pck); break; - case ACTION_READ: action_read (unit, pck); break; - case ACTION_WRITE: action_write (unit, pck); break; - case ACTION_SEEK: action_seek (unit, pck); break; - case ACTION_SET_PROTECT: action_set_protect (unit, pck); break; - case ACTION_SET_COMMENT: action_set_comment (unit, pck); break; - case ACTION_SAME_LOCK: action_same_lock (unit, pck); break; - case ACTION_PARENT: action_parent (unit, pck); break; - case ACTION_CREATE_DIR: action_create_dir (unit, pck); break; - case ACTION_DELETE_OBJECT: action_delete_object (unit, pck); break; - case ACTION_RENAME_OBJECT: action_rename_object (unit, pck); break; - case ACTION_SET_DATE: action_set_date (unit, pck); break; - case ACTION_CURRENT_VOLUME: action_current_volume (unit, pck); break; - case ACTION_RENAME_DISK: action_rename_disk (unit, pck); break; - case ACTION_IS_FILESYSTEM: action_is_filesystem (unit, pck); break; - case ACTION_FLUSH: action_flush (unit, pck); break; - case ACTION_MORE_CACHE: action_more_cache (unit, pck); break; - case ACTION_INHIBIT: action_inhibit (unit, pck); break; - case ACTION_WRITE_PROTECT: action_write_protect (unit, pck); break; + case ACTION_LOCATE_OBJECT: action_lock (ctx, unit, pck); break; + case ACTION_FREE_LOCK: action_free_lock (ctx, unit, pck); break; + case ACTION_COPY_DIR: action_dup_lock (ctx, unit, pck); break; + case ACTION_DISK_INFO: action_disk_info (ctx, unit, pck); break; + case ACTION_INFO: action_info (ctx, unit, pck); break; + case ACTION_EXAMINE_OBJECT: action_examine_object (ctx, unit, pck); break; + case ACTION_EXAMINE_NEXT: action_examine_next (ctx, unit, pck, false); break; + case ACTION_FIND_INPUT: action_find_input (ctx, unit, pck); break; + case ACTION_FIND_WRITE: action_find_write (ctx, unit, pck); break; + case ACTION_FIND_OUTPUT: action_find_output (ctx, unit, pck); break; + case ACTION_END: action_end (ctx, unit, pck); break; + case ACTION_READ: action_read (ctx, unit, pck); break; + case ACTION_WRITE: action_write (ctx, unit, pck); break; + case ACTION_SEEK: action_seek (ctx, unit, pck); break; + case ACTION_SET_PROTECT: action_set_protect (ctx, unit, pck); break; + case ACTION_SET_COMMENT: action_set_comment (ctx, unit, pck); break; + case ACTION_SAME_LOCK: action_same_lock (ctx, unit, pck); break; + case ACTION_PARENT: action_parent (ctx, unit, pck); break; + case ACTION_CREATE_DIR: action_create_dir (ctx, unit, pck); break; + case ACTION_DELETE_OBJECT: action_delete_object (ctx, unit, pck); break; + case ACTION_RENAME_OBJECT: action_rename_object (ctx, unit, pck); break; + case ACTION_SET_DATE: action_set_date (ctx, unit, pck); break; + case ACTION_CURRENT_VOLUME: action_current_volume (ctx, unit, pck); break; + case ACTION_RENAME_DISK: action_rename_disk (ctx, unit, pck); break; + case ACTION_IS_FILESYSTEM: action_is_filesystem (ctx, unit, pck); break; + case ACTION_FLUSH: action_flush (ctx, unit, pck); break; + case ACTION_MORE_CACHE: action_more_cache (ctx, unit, pck); break; + case ACTION_INHIBIT: action_inhibit (ctx, unit, pck); break; + case ACTION_WRITE_PROTECT: action_write_protect (ctx, unit, pck); break; /* 2.0+ packet types */ - case ACTION_SET_FILE_SIZE: action_set_file_size (unit, pck); break; - case ACTION_EXAMINE_FH: action_examine_fh (unit, pck, false); break; - case ACTION_FH_FROM_LOCK: action_fh_from_lock (unit, pck); break; - case ACTION_COPY_DIR_FH: action_lock_from_fh (unit, pck); break; - case ACTION_CHANGE_MODE: action_change_mode (unit, pck); break; - case ACTION_PARENT_FH: action_parent_fh (unit, pck); break; - case ACTION_ADD_NOTIFY: action_add_notify (unit, pck); break; - case ACTION_REMOVE_NOTIFY: action_remove_notify (unit, pck); break; - case ACTION_EXAMINE_ALL: return action_examine_all (unit, pck); - case ACTION_EXAMINE_ALL_END: return action_examine_all_end (unit, pck); - case ACTION_LOCK_RECORD: return action_lock_record (unit, pck, msg); break; - case ACTION_FREE_RECORD: action_free_record (unit, pck); break; + case ACTION_SET_FILE_SIZE: action_set_file_size (ctx, unit, pck); break; + case ACTION_EXAMINE_FH: action_examine_fh (ctx, unit, pck, false); break; + case ACTION_FH_FROM_LOCK: action_fh_from_lock (ctx, unit, pck); break; + case ACTION_COPY_DIR_FH: action_lock_from_fh (ctx, unit, pck); break; + case ACTION_CHANGE_MODE: action_change_mode (ctx, unit, pck); break; + case ACTION_PARENT_FH: action_parent_fh (ctx, unit, pck); break; + case ACTION_ADD_NOTIFY: action_add_notify (ctx, unit, pck); break; + case ACTION_REMOVE_NOTIFY: action_remove_notify (ctx, unit, pck); break; + case ACTION_EXAMINE_ALL: return action_examine_all (ctx, unit, pck); + case ACTION_EXAMINE_ALL_END: return action_examine_all_end (ctx, unit, pck); + case ACTION_LOCK_RECORD: return action_lock_record (ctx, unit, pck, msg); break; + case ACTION_FREE_RECORD: action_free_record (ctx, unit, pck); break; /* OS4 packet types */ - case ACTION_CHANGE_FILE_POSITION64: action_change_file_position64 (unit, pck); break; - case ACTION_GET_FILE_POSITION64: action_get_file_position64 (unit, pck); break; - case ACTION_CHANGE_FILE_SIZE64: action_change_file_size64 (unit, pck); break; - case ACTION_GET_FILE_SIZE64: action_get_file_size64 (unit, pck); break; + case ACTION_FILESYSTEM_ATTR: action_filesystem_attr(ctx, unit, pck); break; + case ACTION_CHANGE_FILE_POSITION64: action_change_file_position64 (ctx, unit, pck); break; + case ACTION_GET_FILE_POSITION64: action_get_file_position64 (ctx, unit, pck); break; + case ACTION_CHANGE_FILE_SIZE64: action_change_file_size64 (ctx, unit, pck); break; + case ACTION_GET_FILE_SIZE64: action_get_file_size64 (ctx, unit, pck); break; /* MOS packet types */ - case ACTION_SEEK64: action_seek64(unit, pck); break; - case ACTION_SET_FILE_SIZE64: action_set_file_size64(unit, pck); break; - case ACTION_EXAMINE_OBJECT64: action_examine_object64(unit, pck); break; - case ACTION_EXAMINE_NEXT64: action_examine_next(unit, pck, true); break; - case ACTION_EXAMINE_FH64: action_examine_fh(unit, pck, true); break; - case ACTION_LOCK_RECORD64: return action_lock_record64(unit, pck, msg); break; - case ACTION_FREE_RECORD64: action_free_record64(unit, pck); break; + case ACTION_SEEK64: action_seek64(ctx, unit, pck); break; + case ACTION_SET_FILE_SIZE64: action_set_file_size64(ctx, unit, pck); break; + case ACTION_EXAMINE_OBJECT64: action_examine_object64(ctx, unit, pck); break; + case ACTION_EXAMINE_NEXT64: action_examine_next(ctx, unit, pck, true); break; + case ACTION_EXAMINE_FH64: action_examine_fh(ctx, unit, pck, true); break; + case ACTION_LOCK_RECORD64: return action_lock_record64(ctx, unit, pck, msg); break; + case ACTION_FREE_RECORD64: action_free_record64(ctx, unit, pck); break; /* unsupported packets */ case ACTION_MAKE_LINK: @@ -5807,10 +5833,12 @@ static int handle_packet (Unit *unit, dpacket pck, uae_u32 msg) static int filesys_iteration(UnitInfo *ui) { - dpacket pck; + uaecptr pck; uaecptr msg; uae_u32 morelocks; + TrapContext *ctx = NULL; + ctx = (TrapContext*)read_comm_pipe_pvoid_blocking(ui->unit_pipe); pck = read_comm_pipe_u32_blocking (ui->unit_pipe); msg = read_comm_pipe_u32_blocking (ui->unit_pipe); morelocks = (uae_u32)read_comm_pipe_int_blocking (ui->unit_pipe); @@ -5824,25 +5852,65 @@ static int filesys_iteration(UnitInfo *ui) return 0; } - put_long (get_long (morelocks), get_long (ui->self->locklist)); - put_long (ui->self->locklist, morelocks); - int ret = handle_packet (ui->self, pck, msg); - if (!ret) { - PUT_PCK_RES1 (pck, DOS_FALSE); - PUT_PCK_RES2 (pck, ERROR_ACTION_NOT_KNOWN); + dpacket packet; + readdpacket(ctx, &packet, pck); + + int isvolume = 0; +#if TRAPMD + trapmd md[] = { + { TRAPCMD_GET_LONG, { morelocks }, 2, 0 }, + { TRAPCMD_GET_LONG, { ui->self->locklist }, 2, 1 }, + { TRAPCMD_PUT_LONG }, + { TRAPCMD_PUT_LONG, { ui->self->locklist, morelocks }}, + { ui->self->volume ? TRAPCMD_GET_BYTE : TRAPCMD_NOP, { ui->self->volume + 64 }}, + }; + trap_multi(ctx, md, sizeof md / sizeof(struct trapmd)); + + if (ui->self->volume) { + isvolume = md[4].params[0] || ui->self->ui.unknown_media; } +#else + trap_put_long(ctx, trap_get_long(ctx, morelocks), trap_get_long(ctx, ui->self->locklist)); + trap_put_long(ctx, ui->self->locklist, morelocks); + if (ui->self->volume) { + isvolume = trap_get_byte(ctx, ui->self->volume + 64) || ui->self->ui.unknown_media; + } +#endif + + int ret = handle_packet(ctx, ui->self, &packet, msg, isvolume); + if (!ret) { + PUT_PCK_RES1 (&packet, DOS_FALSE); + PUT_PCK_RES2 (&packet, ERROR_ACTION_NOT_KNOWN); + } + writedpacket(ctx, &packet); + + trapmd md2[] = { + { TRAPCMD_PUT_LONG, { msg + 4, 0xffffffff } }, + { TRAPCMD_GET_LONG, { ui->self->locklist } }, + { TRAPCMD_PUT_LONG, { ui->self->locklist, 0 } } + }; + struct trapmd *mdp; + int mdcnt; if (ret >= 0) { + mdp = &md2[0]; + mdcnt = 3; /* Mark the packet as processed for the list scan in the assembly code. */ - put_long (msg + 4, 0xffffffff); + //trap_put_long(ctx, msg + 4, 0xffffffff); + } else { + mdp = &md2[1]; + mdcnt = 2; } /* Acquire the message lock, so that we know we can safely send the message. */ ui->self->cmds_sent++; + + /* Send back the locks. */ + trap_multi(ctx, mdp, mdcnt); + if (md2[1].params[0] != 0) + write_comm_pipe_int(ui->back_pipe, (int)md2[1].params[0], 0); + /* The message is sent by our interrupt handler, so make sure an interrupt happens. */ do_uae_int_requested(); - /* Send back the locks. */ - if (get_long (ui->self->locklist) != 0) - write_comm_pipe_int (ui->back_pipe, (int)(get_long (ui->self->locklist)), 0); - put_long (ui->self->locklist, 0); + return 1; } @@ -5862,17 +5930,18 @@ static void *filesys_thread (void *unit_v) #endif /* Talk about spaghetti code... */ -static uae_u32 REGPARAM2 filesys_handler (TrapContext *context) +static uae_u32 REGPARAM2 filesys_handler (TrapContext *ctx) { - Unit *unit = find_unit (m68k_areg (regs, 5)); - uaecptr packet_addr = m68k_dreg (regs, 3); - uaecptr message_addr = m68k_areg (regs, 4); - if (! valid_address (packet_addr, 36) || ! valid_address (message_addr, 14)) { + bool packet_valid = false; + Unit *unit = find_unit(trap_get_areg(ctx, 5)); + uaecptr packet_addr = trap_get_dreg(ctx, 3); + uaecptr message_addr = trap_get_areg(ctx, 4); + + if (!trap_valid_address(ctx, packet_addr, 36) || !trap_valid_address(ctx, message_addr, 14)) { write_log (_T("FILESYS: Bad address %x/%x passed for packet.\n"), packet_addr, message_addr); goto error2; } - put_long (message_addr + 4, 0xffffffff); if (!unit || !unit->volume) { write_log (_T("FILESYS: was not initialized.\n")); goto error; @@ -5883,12 +5952,40 @@ static uae_u32 REGPARAM2 filesys_handler (TrapContext *context) if (!unit->ui.unit_pipe) goto error; /* Get two more locks and hand them over to the other thread. */ - morelocks = get_long (m68k_areg (regs, 3)); - put_long (m68k_areg (regs, 3), get_long (get_long (morelocks))); - put_long (get_long (morelocks), 0); + +#if TRAPMD + struct trapmd md[] = { + // morelocks = trap_get_long(ctx, trap_get_areg(ctx, 3)); + /* 0 */ { TRAPCMD_GET_LONG, { trap_get_areg(ctx, 3) }, 1, 0 }, + // morelocksptr = trap_get_long(ctx, morelocks) + /* 1 */ { TRAPCMD_GET_LONG, { 0 } }, + // result 1 to index 4 + /* 2 */ { TRAPCMD_NOP, { 0 }, 4, 0 }, + // result 1 to index 6 + /* 3 */ { TRAPCMD_NOP, { 0 }, 6, 0 }, + // trap_get_long(ctx, morelocksptr) + /* 4 */ { TRAPCMD_GET_LONG, { 0 }, 5, 1 }, + // trap_put_long(ctx, trap_get_areg(ctx, 3), result 4 + /* 5 */ { TRAPCMD_PUT_LONG, { trap_get_areg(ctx, 3) } }, + // trap_put_long(ctx, morelocksptr, 0); + /* 6 */ { TRAPCMD_PUT_LONG, { 0, 0 } }, + // trap_put_long(ctx, message_addr + 4, 0); + /* 7 */ { TRAPCMD_PUT_LONG, { message_addr + 4, 0 } } + }; + trap_multi(ctx, md, sizeof md / sizeof(struct trapmd)); + morelocks = md[0].params[0]; +#else + uae_u32 morelocksptr; + morelocks = trap_get_long(ctx, trap_get_areg(ctx, 3)); + morelocksptr = trap_get_long(ctx, morelocks); + trap_put_long(ctx, trap_get_areg(ctx, 3), trap_get_long(ctx, morelocksptr)); + trap_put_long(ctx, morelocksptr, 0); /* The packet wasn't processed yet. */ - put_long (message_addr + 4, 0); + trap_put_long(ctx, message_addr + 4, 0); +#endif + + write_comm_pipe_pvoid(unit->ui.unit_pipe, ctx, 0); write_comm_pipe_u32 (unit->ui.unit_pipe, packet_addr, 0); write_comm_pipe_u32 (unit->ui.unit_pipe, message_addr, 0); write_comm_pipe_int (unit->ui.unit_pipe, (int)morelocks, 1); @@ -5897,31 +5994,26 @@ static uae_u32 REGPARAM2 filesys_handler (TrapContext *context) } #endif - if (! handle_packet (unit, packet_addr, 0)) { + dpacket packet; + readdpacket(ctx, &packet, packet_addr); + packet_valid = true; + + if (! handle_packet(ctx, unit, &packet, 0, filesys_isvolume(unit))) { error: - PUT_PCK_RES1 (packet_addr, DOS_FALSE); - PUT_PCK_RES2 (packet_addr, ERROR_ACTION_NOT_KNOWN); + if (!packet_valid) + readdpacket(ctx, &packet, packet_addr); + PUT_PCK_RES1 (&packet, DOS_FALSE); + PUT_PCK_RES2 (&packet, ERROR_ACTION_NOT_KNOWN); } - TRACE((_T("reply: %8lx, %ld\n"), GET_PCK_RES1 (packet_addr), GET_PCK_RES2 (packet_addr))); + + writedpacket(ctx, &packet); error2: + trap_put_long(ctx, message_addr + 4, 0xffffffff); return 0; } -static void init_filesys_diagentry (void) -{ - put_long_host(baseaddr + 0x2100, EXPANSION_explibname); - put_long_host(baseaddr + 0x2104, filesys_configdev); - put_long_host(baseaddr + 0x2108, EXPANSION_doslibname); - put_word_host(baseaddr + 0x210c, 0); - put_word_host(baseaddr + 0x210e, nr_units()); - put_word_host(baseaddr + 0x2110, 0); - put_word_host(baseaddr + 0x2112, 1 | (currprefs.uae_hide_autoconfig || currprefs.uaeboard > 1 ? 16 : 0)); - - native2amiga_startup(); -} - void filesys_start_threads (void) { int i; @@ -5935,20 +6027,6 @@ void filesys_start_threads (void) } } -void filesys_cleanup (void) -{ - filesys_prepare_reset(); - free_mountinfo (); - - if(singlethread_int_sem != 0) - uae_sem_destroy(&singlethread_int_sem); - singlethread_int_sem = 0; - - filesys_in_interrupt = 0; - mountertask = 0; - automountunit = -1; -} - void filesys_free_handles(void) { Unit *u, *u1; @@ -5997,6 +6075,7 @@ void filesys_reset (void) { if (isrestore ()) return; + load_injected_icons(); filesys_reset2 (); initialize_mountinfo(); } @@ -6004,7 +6083,6 @@ void filesys_reset (void) static void filesys_prepare_reset2 (void) { UnitInfo *uip; -// Unit *u; int i; uip = mountinfo.ui; @@ -6014,10 +6092,12 @@ static void filesys_prepare_reset2 (void) uae_sem_init (&uip[i].reset_sync_sem, 0, 0); uip[i].reset_state = FS_GO_DOWN; /* send death message */ + write_comm_pipe_pvoid(uip[i].unit_pipe, NULL, 0); write_comm_pipe_int (uip[i].unit_pipe, 0, 0); write_comm_pipe_int (uip[i].unit_pipe, 0, 0); write_comm_pipe_int (uip[i].unit_pipe, 0, 1); uae_sem_wait (&uip[i].reset_sync_sem); + uae_end_thread (&uip[i].tid); uae_sem_destroy(&uip[i].reset_sync_sem); uip[i].reset_sync_sem = 0; destroy_comm_pipe(uip[i].unit_pipe); @@ -6030,15 +6110,6 @@ static void filesys_prepare_reset2 (void) } #endif filesys_free_handles(); -#if 0 - u = units; - while (u != 0) { - free_all_ainos (u, &u->rootnode); - u->rootnode.next = u->rootnode.prev = &u->rootnode; - u->aino_cache_size = 0; - u = u->next; - } -#endif } void filesys_prepare_reset (void) @@ -6048,75 +6119,6 @@ void filesys_prepare_reset (void) filesys_prepare_reset2 (); } -static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *context) -{ - uaecptr resaddr = m68k_areg (regs, 2) + 0x10; - uaecptr expansion = m68k_areg (regs, 5); - uaecptr start = resaddr; - uaecptr residents, tmp; - - write_log (_T("filesystem: diagentry called: %x\n"), resaddr); - - filesys_configdev = m68k_areg (regs, 3); - init_filesys_diagentry (); - - if (ROM_hardfile_resid != 0) { - /* Build a struct Resident. This will set up and initialize - * the uae.device */ - put_word (resaddr + 0x0, 0x4AFC); - put_long (resaddr + 0x2, resaddr); - put_long (resaddr + 0x6, resaddr + 0x1A); /* Continue scan here */ - put_word (resaddr + 0xA, 0x8101); /* RTF_AUTOINIT|RTF_COLDSTART; Version 1 */ - put_word (resaddr + 0xC, 0x0305); /* NT_DEVICE; pri 05 */ - put_long (resaddr + 0xE, ROM_hardfile_resname); - put_long (resaddr + 0x12, ROM_hardfile_resid); - put_long (resaddr + 0x16, ROM_hardfile_init); /* calls filesys_init */ - } - resaddr += 0x1A; - tmp = resaddr; - - /* The good thing about this function is that it always gets called - * when we boot. So we could put all sorts of stuff that wants to be done - * here. - * We can simply add more Resident structures here. Although the Amiga OS - * only knows about the one at address DiagArea + 0x10, we scan for other - * Resident structures and call InitResident() for them at the end of the - * diag entry. */ - - resaddr = uaeres_startup (resaddr); -#ifdef BSDSOCKET - resaddr = bsdlib_startup (resaddr); -#endif - - /* scan for Residents and return pointer to array of them */ - residents = resaddr; - while (tmp < residents && tmp > start) { - if (get_word (tmp) == 0x4AFC && - get_long (tmp + 0x2) == tmp) { - put_word (resaddr, 0x227C); /* move.l #tmp,a1 */ - put_long (resaddr + 2, tmp); - put_word (resaddr + 6, 0x7200); /* moveq #0,d1 */ - put_long (resaddr + 8, 0x4EAEFF9A); /* jsr -$66(a6) ; InitResident */ - resaddr += 12; - tmp = get_long (tmp + 0x6); - } else { - tmp += 2; - } - } - /* call setup_exter */ - put_word (resaddr + 0, 0x2079); - put_long (resaddr + 2, rtarea_base + bootrom_header + 4 + 5 * 4); /* move.l RTAREA_BASE+setup_exter,a0 */ - put_word (resaddr + 6, 0xd1fc); - put_long (resaddr + 8, rtarea_base + bootrom_header); /* add.l #RTAREA_BASE+bootrom_header,a0 */ - put_word (resaddr + 12, 0x4e90); /* jsr (a0) */ - - put_word (resaddr + 14, 0x7001); /* moveq #1,d0 */ - put_word (resaddr + 16, RTS); - - m68k_areg (regs, 0) = residents; - return 1; -} - /* don't forget filesys.asm! */ #define PP_MAXSIZE 4 * 96 #define PP_FSSIZE 400 @@ -6124,17 +6126,357 @@ static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *context) #define PP_ADDTOFSRES 408 #define PP_FSRES 412 #define PP_FSRES_CREATED 416 -#define PP_EXPLIB 420 -#define PP_FSHDSTART 424 +#define PP_DEVICEPROC 420 +#define PP_EXPLIB 424 +#define PP_FSHDSTART 428 -static uae_u32 REGPARAM2 filesys_dev_bootfilesys (TrapContext *context) +static int trackdisk_hack_state; +static int putmsg_hack_state; +static int putmsg_hack_filesystemtask; +static uae_u32 ks12hack_deviceproc; + +static bool bcplonlydos(void) { - uaecptr devicenode = m68k_areg (regs, 3); - uaecptr parmpacket = m68k_areg (regs, 1); - uaecptr fsres = get_long (parmpacket + PP_FSRES); + return kickstart_version && kickstart_version < 33; +} + +static const uae_u8 bootblock_ofs[] = { + 0x44,0x4f,0x53,0x00,0xc0,0x20,0x0f,0x19,0x00,0x00,0x03,0x70,0x43,0xfa,0x00,0x18, + 0x4e,0xae,0xff,0xa0,0x4a,0x80,0x67,0x0a,0x20,0x40,0x20,0x68,0x00,0x16,0x70,0x00, + 0x4e,0x75,0x70,0xff,0x60,0xfa,0x64,0x6f,0x73,0x2e,0x6c,0x69,0x62,0x72,0x61,0x72, + 0x79 +}; +static uae_u32 REGPARAM2 filesys_putmsg_return(TrapContext *ctx) +{ + uaecptr message = trap_get_areg(ctx, 1); + uaecptr dospacket = trap_get_long(ctx, message + 10); + UnitInfo *uip = mountinfo.ui; + if (!ks12hack_deviceproc && uip[0].parmpacket) + ks12hack_deviceproc = trap_get_long(ctx, uip[0].parmpacket + PP_DEVICEPROC); + if (ks12hack_deviceproc) { + uae_u32 port = ks12hack_deviceproc; + if (port) { + uaecptr proc = trap_get_long(ctx, trap_get_long(ctx, 4) + 276); // ThisTask + trap_put_long(ctx, proc + 168, port); // pr_FileSystemTask + trap_set_areg(ctx, 0, port); + write_log(_T("Pre-KS 1.3 automount hack: patch boot handler process. DP=%08x Proc %08x pr_FileSystemTask=%08x.\n"), dospacket, proc, port); + } + } + return trap_get_dreg(ctx, 0); +} + +static uae_u32 REGPARAM2 filesys_putmsg(TrapContext *ctx) +{ + trap_set_areg(ctx, 7, trap_get_areg(ctx, 7) - 4); + trap_put_long(ctx, trap_get_areg(ctx, 7), trap_get_long(ctx, ROM_filesys_putmsg_original)); + if (putmsg_hack_state) { + uaecptr message = trap_get_areg(ctx, 1); + uaecptr dospacket = trap_get_long(ctx, message + 10); + if (dospacket && !(dospacket & 3) && trap_valid_address(ctx, dospacket, 48)) { + int type = trap_get_long(ctx, dospacket + 8); +// write_log(_T("Port=%08x Msg=%08x DP=%08x dp_Link=%08x dp_Port=%08x dp_Type=%d\n"), +// m68k_areg(regs, 0), m68k_areg(regs, 1), dospacket, get_long(dospacket), get_long(dospacket + 4), type); + if (type == ACTION_LOCATE_OBJECT) { + write_log(_T("Pre-KS 1.3 automount hack: init drives.\n")); + putmsg_hack_state = 0; + if (putmsg_hack_filesystemtask) { + trap_set_areg(ctx, 7, trap_get_areg(ctx, 7) - 4); + trap_put_long(ctx, trap_get_areg(ctx, 7), ROM_filesys_putmsg_return); + } + trap_set_areg(ctx, 7, trap_get_areg(ctx, 7) - 4); + trap_put_long(ctx, trap_get_areg(ctx, 7), filesys_initcode); + trap_set_areg(ctx, 7, trap_get_areg(ctx, 7) - 4); + trap_put_long(ctx, trap_get_areg(ctx, 7), ROM_filesys_hack_remove); + return trap_get_dreg(ctx, 0); + } + } + } + return trap_get_dreg(ctx, 0); +} + +static uae_u32 REGPARAM2 filesys_doio(TrapContext *ctx) +{ + uaecptr ioreq = trap_get_areg(ctx, 1); + uaecptr unit = trap_get_long(ctx, ioreq + 24); // io_Unit + if (trackdisk_hack_state && unit && trap_valid_address(ctx, unit, 14)) { + uaecptr name = trap_get_long(ctx, unit + 10); // ln_Name + if (name && trap_valid_address(ctx, name, 20)) { + uae_u8 *addr = get_real_address(name); + if (!memcmp(addr, "trackdisk.device", 17)) { + int cmd = trap_get_word(ctx, ioreq + 28); // io_Command + uaecptr data = trap_get_long(ctx, ioreq + 40); + int len = trap_get_long(ctx, ioreq + 36); + //write_log(_T("%08x %d\n"), ioreq, cmd); + switch (cmd) + { + case 2: // CMD_READ + { + // trackdisk.device reading boot block + uae_u8 *d = get_real_address(data); + memset(d, 0, 1024); + memcpy(d, bootblock_ofs, sizeof bootblock_ofs); + trap_put_long(ctx, ioreq + 32, len); // io_Actual + trackdisk_hack_state = 0; + write_log(_T("Pre-KS 1.3 automount hack: DF0: boot block faked.\n")); + } + break; + case 9: // TD_MOTOR + trap_put_long(ctx, ioreq + 32, trackdisk_hack_state < 0 ? 0 : 1); + trackdisk_hack_state = len ? 1 : -1; + break; + case 13: // TD_CHANGENUM + trap_put_long(ctx, ioreq + 32, 1); // io_Actual + break; + case 14: // TD_CHANGESTATE + trap_put_long(ctx, ioreq + 32, 0); + break; + } + return 0; + } + } + } + trap_set_areg(ctx, 7, trap_get_areg(ctx, 7) - 4); + trap_put_long(ctx, trap_get_areg(ctx, 7), trap_get_long(ctx, ROM_filesys_doio_original)); + return 0; +} + +static uaecptr add_resident(TrapContext *ctx, uaecptr resaddr, uaecptr myres) +{ + uaecptr sysbase, reslist, prevjmp, resptr; + + uae_s8 myrespri = trap_get_byte(ctx, myres + 13); // rt_Pri + + sysbase = trap_get_long(ctx, 4); + prevjmp = 0; + reslist = trap_get_long(ctx, sysbase + 300); // ResModules + for (;;) { + resptr = trap_get_long(ctx, reslist); + if (!resptr) + break; + if (resptr & 0x80000000) { + prevjmp = reslist; + reslist = resptr & 0x7fffffff; + continue; + } + uae_s8 respri = trap_get_byte(ctx, resptr + 13); // rt_Pri + uaecptr resname = trap_get_long(ctx, resptr + 14); // rt_Name + if (resname) { + uae_char resnamebuf[256]; + trap_get_string(ctx, resnamebuf, resname, sizeof resnamebuf); + if (myrespri >= respri) + break; + } + prevjmp = 0; + reslist += 4; + } + if (prevjmp) { + trap_put_long(ctx, prevjmp, 0x80000000 | resaddr); + } else { + trap_put_long(ctx, reslist, 0x80000000 | resaddr); + } + trap_put_long(ctx, resaddr, myres); + trap_put_long(ctx, resaddr + 4, resptr); + trap_put_long(ctx, resaddr + 8, 0x80000000 | (reslist + 4)); + resaddr += 3 * 4; + return resaddr; +} + +static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *ctx) +{ + UnitInfo *uip = mountinfo.ui; + uaecptr resaddr = trap_get_areg(ctx, 2); + uaecptr expansion = trap_get_areg(ctx, 5); + uaecptr first_resident, last_resident, tmp; + uaecptr resaddr_hack = 0; + uae_u8 *baseaddr; + + filesys_configdev = trap_get_areg(ctx, 3); + + baseaddr = filesys_bank.baseaddr; + resaddr += 0x10; + + put_long_host(baseaddr + 0x2100, EXPANSION_explibname); + put_long_host(baseaddr + 0x2104, filesys_configdev); + put_long_host(baseaddr + 0x2108, EXPANSION_doslibname); + put_word_host(baseaddr + 0x210c, 0); + put_word_host(baseaddr + 0x210e, nr_units()); + put_word_host(baseaddr + 0x2110, 0); + put_word_host(baseaddr + 0x2112, 1); + + native2amiga_startup(); + + write_log (_T("filesystem: diagentry %08x configdev %08x\n"), resaddr, filesys_configdev); + + first_resident = resaddr; + if (ROM_hardfile_resid != 0) { + /* Build a struct Resident. This will set up and initialize + * the uae.device */ + trap_put_word(ctx, resaddr + 0x0, 0x4AFC); + trap_put_long(ctx, resaddr + 0x2, resaddr); + trap_put_long(ctx, resaddr + 0x6, resaddr + 0x1A); /* Continue scan here */ + trap_put_word(ctx, resaddr + 0xA, 0x8132); /* RTF_AUTOINIT|RTF_COLDSTART; Version 50 */ + trap_put_word(ctx, resaddr + 0xC, 0x0305); /* NT_DEVICE; pri 05 */ + trap_put_long(ctx, resaddr + 0xE, ROM_hardfile_resname); + trap_put_long(ctx, resaddr + 0x12, ROM_hardfile_resid); + trap_put_long(ctx, resaddr + 0x16, ROM_hardfile_init); /* calls filesys_init */ + } + resaddr += 0x1A; + if (!KS12_BOOT_HACK || expansion) + first_resident = resaddr; + /* The good thing about this function is that it always gets called + * when we boot. So we could put all sorts of stuff that wants to be done + * here. + * We can simply add more Resident structures here. Although the Amiga OS + * only knows about the one at address DiagArea + 0x10, we scan for other + * Resident structures and inject them to ResList in priority order + */ + + if (kickstart_version >= 37) { + trap_put_word(ctx, resaddr + 0x0, 0x4afc); + trap_put_long(ctx, resaddr + 0x2, resaddr); + trap_put_long(ctx, resaddr + 0x6, resaddr + 0x1A); + trap_put_word(ctx, resaddr + 0xA, 0x0432); /* RTF_AFTERDOS; Version 50 */ + trap_put_word(ctx, resaddr + 0xC, 0x0000 | AFTERDOS_INIT_PRI); /* NT_UNKNOWN; pri */ + trap_put_long(ctx, resaddr + 0xE, afterdos_name); + trap_put_long(ctx, resaddr + 0x12, afterdos_id); + trap_put_long(ctx, resaddr + 0x16, afterdos_initcode); + resaddr += 0x1A; + } + + resaddr = uaeres_startup (ctx, resaddr); +#ifdef BSDSOCKET + resaddr = bsdlib_startup(ctx, resaddr); +#endif + + last_resident = resaddr; + + /* call setup_exter */ + trap_put_word(ctx, resaddr + 0, 0x7000 | 1); /* moveq #x,d0 */ + trap_put_word(ctx, resaddr + 2, 0x2079); /* move.l RTAREA_BASE+setup_exter,a0 */ + trap_put_long(ctx, resaddr + 4, rtarea_base + bootrom_header + 4 + 5 * 4); + trap_put_word(ctx, resaddr + 8, 0xd1fc); /* add.l #RTAREA_BASE+bootrom_header,a0 */ + trap_put_long(ctx, resaddr + 10, rtarea_base + bootrom_header); + trap_put_word(ctx, resaddr + 14, 0x4e90); /* jsr (a0) */ + resaddr += 16; + + trackdisk_hack_state = 0; + putmsg_hack_state = 0; + putmsg_hack_filesystemtask = 0; + ks12hack_deviceproc = 0; + + if (KS12_BOOT_HACK && nr_units() && filesys_configdev == 0) { + resaddr_hack = resaddr; + putmsg_hack_state = -1; + if (uip[0].bootpri > -128) { + resaddr += 2 * 22; + trackdisk_hack_state = -1; + putmsg_hack_filesystemtask = 1; + } else { + resaddr += 1 * 22; + } + } + + trap_put_word(ctx, resaddr + 0, 0x7001); /* moveq #1,d0 */ + trap_put_word(ctx, resaddr + 2, RTS); + resaddr += 4; + + ROM_filesys_doio_original = resaddr; + ROM_filesys_putmsg_original = resaddr + 4; + resaddr += 8; + ROM_filesys_hack_remove = resaddr; + + if (putmsg_hack_state) { + + // remove patches + put_long(resaddr + 0, 0x48e7fffe); // movem.l d0-d7/a0-a6,-(sp) + put_word(resaddr + 4, 0x224e); // move.l a6,a1 + resaddr += 6; + if (trackdisk_hack_state) { + put_word(resaddr + 0, 0x307c); // move.w #x,a0 + put_word(resaddr + 2, -0x1c8); + put_word(resaddr + 4, 0x2039); // move.l x,d0 + put_long(resaddr + 6, ROM_filesys_doio_original); + put_word(resaddr + 10, 0x4eae); // jsr x(a6) + put_word(resaddr + 12, -0x1a4); + resaddr += 14; + } + put_word(resaddr + 0, 0x307c); // move.w #x,a0 + put_word(resaddr + 2, -0x16e); + put_word(resaddr + 4, 0x2039); // move.l x,d0 + put_long(resaddr + 6, ROM_filesys_putmsg_original); + put_word(resaddr + 10, 0x4eae); // jsr x(a6) + put_word(resaddr + 12, -0x1a4); + resaddr += 14; + put_long(resaddr + 0, 0x4cdf7fff); // movem.l (sp)+,d0-d7/a0-a6 + resaddr += 4; + + uaecptr temp = here(); + org(filesys_initcode_ptr); + dl(resaddr); + org(temp); + + put_word(resaddr, 0x4e75); // rts + resaddr += 2; + + uaecptr resaddr_tmp = resaddr; + + resaddr = resaddr_hack; + + if (trackdisk_hack_state) { + // Pre-KS 1.3 trackdisk.device boot block injection hack. Patch DoIO() + put_word(resaddr + 0, 0x224e); // move.l a6,a1 + put_word(resaddr + 2, 0x307c); // move.w #x,a0 + put_word(resaddr + 4, -0x1c8); + put_word(resaddr + 6, 0x203c); // move.l #x,d0 + put_long(resaddr + 8, ROM_filesys_doio); + put_word(resaddr + 12, 0x4eae); // jsr x(a6) + put_word(resaddr + 14, -0x1a4); + put_word(resaddr + 16, 0x23c0); // move.l d0,x + put_long(resaddr + 18, ROM_filesys_doio_original); + resaddr += 22; + } + + // Pre-KS 1.3 automount hack. Patch PutMsg() + put_word(resaddr + 0, 0x224e); // move.l a6,a1 + put_word(resaddr + 2, 0x307c); // move.w #x,a0 + put_word(resaddr + 4, -0x16e); + put_word(resaddr + 6, 0x203c); // move.l #x,d0 + put_long(resaddr + 8, ROM_filesys_putmsg); + put_word(resaddr + 12, 0x4eae); // jsr x(a6) + put_word(resaddr + 14, -0x1a4); + put_word(resaddr + 16, 0x23c0); // move.l d0,x + put_long(resaddr + 18, ROM_filesys_putmsg_original); + resaddr += 22; + + // filesys.asm make_dev D7 + put_word_host(baseaddr + 0x2112, 1 | 2 | 8 | 16); + + resaddr = resaddr_tmp; + } + + trap_set_areg(ctx, 0, last_resident); + + tmp = first_resident; + while (tmp < last_resident && tmp >= first_resident) { + if (trap_get_word(ctx, tmp) == 0x4AFC && trap_get_long(ctx, tmp + 0x2) == tmp) { + resaddr = add_resident(ctx, resaddr, tmp); + tmp = trap_get_long(ctx, tmp + 0x6); + } else { + tmp += 2; + } + } + + return 1; +} + +static uae_u32 REGPARAM2 filesys_dev_bootfilesys (TrapContext *ctx) +{ + uaecptr devicenode = trap_get_areg(ctx, 3); + uaecptr parmpacket = trap_get_areg(ctx, 1); + uaecptr fsres = trap_get_long(ctx, parmpacket + PP_FSRES); uaecptr fsnode; uae_u32 dostype, dostype2; - int no = m68k_dreg (regs, 6) & 0x7fffffff; + int no = trap_get_dreg(ctx, 6) & 0x7fffffff; int unit_no = no & 65535; UnitInfo *uip = &mountinfo.ui[unit_no]; int type; @@ -6142,58 +6484,119 @@ static uae_u32 REGPARAM2 filesys_dev_bootfilesys (TrapContext *context) type = is_hardfile (unit_no); if (type == FILESYS_VIRTUAL) { - if (!get_long (devicenode + 16)) - put_long (devicenode + 16, fshandlername); + if (!trap_get_long(ctx, devicenode + 16)) + trap_put_long(ctx, devicenode + 16, fshandlername); return 0; } - if (get_long (parmpacket + PP_FSPTR) && !get_long (parmpacket + PP_ADDTOFSRES)) { - uaecptr fsptr = get_long (parmpacket + PP_FSPTR); + dostype = trap_get_long(ctx, parmpacket + 80); + if (trap_get_long(ctx, parmpacket + PP_FSPTR) && !trap_get_long(ctx, parmpacket + PP_ADDTOFSRES)) { + uaecptr fsptr = trap_get_long(ctx, parmpacket + PP_FSPTR); uip->filesysseg = fsptr; // filesystem but was not added to fs.resource - uae_u32 pf = get_long (parmpacket + PP_FSHDSTART + 8); // fse_PatchFlags + uae_u32 pf = trap_get_long(ctx, parmpacket + PP_FSHDSTART + 8); // fse_PatchFlags for (int i = 0; i < 32; i++) { if (pf & (1 << i)) - put_long (devicenode + 4 + i * 4, get_long (parmpacket + PP_FSHDSTART + 8 + 4 + i * 4)); + trap_put_long(ctx, devicenode + 4 + i * 4, trap_get_long(ctx, parmpacket + PP_FSHDSTART + 8 + 4 + i * 4)); } - put_long (devicenode + 4 + 7 * 4, fsptr >> 2); // seglist + uaecptr seglist = fsptr >> 2; + if (bcplonlydos()) { + trap_put_long(ctx, devicenode + 4 + 3 * 4, seglist); + seglist = (trap_get_long(ctx, rtarea_base + bootrom_header + 4 + 6 * 4) + rtarea_base + bootrom_header) >> 2; + } + trap_put_long(ctx, devicenode + 4 + 7 * 4, seglist); return 1; } - dostype = get_long (parmpacket + 80); - fsnode = get_long (fsres + 18); - while (get_long (fsnode)) { - dostype2 = get_long (fsnode + 14); + fsnode = trap_get_long(ctx, fsres + 18); + while (trap_get_long(ctx, fsnode)) { + dostype2 = trap_get_long(ctx, fsnode + 14); if (dostype2 == dostype) { - uae_u32 pf = get_long (fsnode + 22); // fse_PatchFlags + uae_u32 pf = trap_get_long(ctx, fsnode + 22); // fse_PatchFlags for (int i = 0; i < 32; i++) { - if (pf & (1 << i)) - put_long (devicenode + 4 + i * 4, get_long (fsnode + 22 + 4 + i * 4)); + if (pf & (1 << i)) { + uae_u32 data = trap_get_long(ctx, fsnode + 22 + 4 + i * 4); + if (i == 7 && bcplonlydos()) { // seglist + // point seglist to bcpl wrapper and put original seglist in dn_Handler + trap_put_long(ctx, devicenode + 4 + 3 * 4, trap_get_long(ctx, fsnode + 22 + 4 + 7 * 4)); + data = (trap_get_long(ctx, rtarea_base + bootrom_header + 4 + 6 * 4) + rtarea_base + bootrom_header) >> 2; + } + trap_put_long(ctx, devicenode + 4 + i * 4, data); + } } return 1; } - fsnode = get_long (fsnode); + fsnode = trap_get_long(ctx, fsnode); } if (type == FILESYS_HARDFILE) { - uae_u32 pf = get_long (parmpacket + PP_FSHDSTART + 8); // fse_PatchFlags + uae_u32 pf = trap_get_long(ctx, parmpacket + PP_FSHDSTART + 8); // fse_PatchFlags for (int i = 0; i < 32; i++) { if (pf & (1 << i)) - put_long (devicenode + 4 + i * 4, get_long (parmpacket + PP_FSHDSTART + 8 + 4 + i * 4)); + trap_put_long(ctx, devicenode + 4 + i * 4, trap_get_long(ctx, parmpacket + PP_FSHDSTART + 8 + 4 + i * 4)); } - put_long (devicenode + 4 + 7 * 4, 0); // seglist + trap_put_long(ctx, devicenode + 4 + 7 * 4, 0); // seglist } + + uaecptr file_system_proc = trap_get_dreg(ctx, 1); + if (bcplonlydos() && file_system_proc && trap_get_long(ctx, devicenode + 4 + 7 * 4) == 0) { + // 1.1 or older, seglist == 0: get ROM OFS seglist from "File System" process. + // 1.2 and newer automatically use ROM OFS if seglist is zero. + // d1 = "File System" process pointer. + uaecptr p = trap_get_long(ctx, file_system_proc + 0x80) << 2; // pr_SegList + if (p) { + uae_u32 cnt = trap_get_long(ctx, p); + if (cnt > 0 && cnt < 16) { + uaecptr handlerseg = trap_get_long(ctx, p + cnt * 4); + write_log(_T("Pre-KS 1.2 handler segment %08x.\n"), handlerseg << 2); + trap_put_long(ctx, devicenode + 4 + 7 * 4, handlerseg); + } + } + } + return 0; } -extern void picasso96_alloc (TrapContext*); -static uae_u32 REGPARAM2 filesys_init_storeinfo (TrapContext *context) +// called from bcplwrapper +static uae_u32 REGPARAM2 filesys_bcpl_wrapper(TrapContext *ctx) +{ + const int patches[] = { 0x782, 0x7b8, 0x159c, 0x15b4, 0 }; + uaecptr devicenode = trap_get_long(ctx, trap_get_dreg(ctx, 1) + 0x1c) << 2; + // fetch original seglist from dn_Handler + uaecptr seglist = trap_get_long(ctx, devicenode + 4 + 3 * 4) << 2; + uaecptr patchfunc = trap_get_areg(ctx, 1); + seglist += 4; + trap_set_areg(ctx, 0, seglist); + for (int i = 0; patches[i]; i++) { + int offset = patches[i]; + if (get_long(seglist + offset + 2) != 0x4eaefd90) { + write_log(_T("FFS patch failed, comparison mismatch.\n")); + return 0; + } + } + for (int i = 0; patches[i]; i++) { + int offset = patches[i]; + trap_put_word(ctx, seglist + offset, 0x4eb9); + trap_put_long(ctx, seglist + offset + 2, patchfunc); + patchfunc += 4; + } + uae_u16 ver = trap_get_word(ctx, trap_get_areg(ctx, 6) + 20); + if (ver < 31) { + // OpenLibrary -> OldOpenLibrary + trap_put_word(ctx, seglist + 0x7f4, -0x198); + trap_put_word(ctx, seglist + 0x2a6e, -0x198); + } + write_log(_T("FFS pre-1.2 patched\n")); + return 0; +} + +static uae_u32 REGPARAM2 filesys_init_storeinfo (TrapContext *ctx) { int ret = -1; - switch (m68k_dreg (regs, 1)) + switch (trap_get_dreg(ctx, 1)) { case 1: - mountertask = m68k_areg (regs, 1); + mountertask = trap_get_areg(ctx, 1); #ifdef PICASSO96 - picasso96_alloc (context); + picasso96_alloc (ctx); #endif break; case 2: @@ -6208,15 +6611,14 @@ static uae_u32 REGPARAM2 filesys_init_storeinfo (TrapContext *context) /* Remember a pointer AmigaOS gave us so we can later use it to identify * which unit a given startup message belongs to. */ -static uae_u32 REGPARAM2 filesys_dev_remember (TrapContext *context) +static uae_u32 REGPARAM2 filesys_dev_remember (TrapContext *ctx) { - int no = m68k_dreg (regs, 6) & 0x7fffffff; + int no = trap_get_dreg(ctx, 6) & 0x7fffffff; int unit_no = no & 65535; int sub_no = no >> 16; UnitInfo *uip = &mountinfo.ui[unit_no]; - int i; - uaecptr devicenode = m68k_areg (regs, 3); - uaecptr parmpacket = m68k_areg (regs, 1); + uaecptr devicenode = trap_get_areg(ctx, 3); + uaecptr parmpacket = trap_get_areg(ctx, 1); int fssize; uae_u8 *fs; @@ -6225,16 +6627,16 @@ static uae_u32 REGPARAM2 filesys_dev_remember (TrapContext *context) fs = uip->rdb_filesysstore; /* copy filesystem loaded from RDB */ - if (get_long (parmpacket + PP_FSPTR)) { - for (i = 0; i < fssize; i++) - put_byte (get_long (parmpacket + PP_FSPTR) + i, fs[i]); + if (trap_get_long(ctx, parmpacket + PP_FSPTR)) { + uaecptr addr = trap_get_long(ctx, parmpacket + PP_FSPTR); + trap_put_bytes(ctx, fs, addr, fssize); } xfree (fs); uip->rdb_filesysstore = 0; uip->rdb_filesyssize = 0; - if (m68k_dreg (regs, 3) >= 0) - uip->startup = get_long (devicenode + 28); + if (trap_get_dreg(ctx, 3) >= 0) + uip->startup = trap_get_long(ctx, devicenode + 28); return devicenode; } @@ -6253,7 +6655,7 @@ static uae_u32 rl (uae_u8 *p) return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3]); } -int rdb_checksum (const char *id, uae_u8 *p, int block) +static int rdb_checksum (const uae_char *id, uae_u8 *p, int block) { uae_u32 sum = 0; int i, blocksize; @@ -6275,28 +6677,30 @@ int rdb_checksum (const char *id, uae_u8 *p, int block) return 1; } -static int device_isdup (uaecptr expbase, TCHAR *devname) +static int device_isdup (TrapContext *ctx, uaecptr expbase, TCHAR *devname) { uaecptr bnode, dnode, name; int len, i; TCHAR dname[256]; - bnode = get_long (expbase + 74); /* expansion.library bootnode list */ - while (get_long (bnode)) { - dnode = get_long (bnode + 16); /* device node */ - name = get_long (dnode + 40) << 2; /* device name BSTR */ - len = get_byte (name); + if (!expbase) + return 0; + bnode = trap_get_long(ctx, expbase + 74); /* expansion.library bootnode list */ + while (trap_get_long(ctx, bnode)) { + dnode = trap_get_long(ctx, bnode + 16); /* device node */ + name = trap_get_long(ctx, dnode + 40) << 2; /* device name BSTR */ + len = trap_get_byte(ctx, name); for (i = 0; i < len; i++) - dname[i] = get_byte (name + 1 + i); + dname[i] = trap_get_byte(ctx, name + 1 + i); dname[len] = 0; if (!_tcsicmp (devname, dname)) return 1; - bnode = get_long (bnode); + bnode = trap_get_long(ctx, bnode); } return 0; } -static TCHAR *device_dupfix (uaecptr expbase, TCHAR *devname) +static TCHAR *device_dupfix (TrapContext *ctx, uaecptr expbase, TCHAR *devname) { int modified; TCHAR newname[256]; @@ -6305,7 +6709,7 @@ static TCHAR *device_dupfix (uaecptr expbase, TCHAR *devname) modified = 1; while (modified) { modified = 0; - if (device_isdup (expbase, newname)) { + if (device_isdup (ctx, expbase, newname)) { if (_tcslen (newname) > 2 && newname[_tcslen (newname) - 2] == '_') { newname[_tcslen (newname) - 1]++; } else { @@ -6317,9 +6721,8 @@ static TCHAR *device_dupfix (uaecptr expbase, TCHAR *devname) return my_strdup (newname); } -static const TCHAR *dostypes (uae_u32 dostype) +static const TCHAR *dostypes(TCHAR *dt, uae_u32 dostype) { - static TCHAR dt[32]; int j; j = 0; @@ -6339,9 +6742,10 @@ static const TCHAR *dostypes (uae_u32 dostype) #define rdbmnt write_log (_T("Mounting uaehf.device %d (%d) (size=%llu):\n"), unit_no, partnum, hfd->virtsize); -static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacket) +static int rdb_mount (TrapContext *ctx, UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacket) { int lastblock = 63, blocksize, readblocksize, badblock, driveinitblock; + TCHAR dt[32]; uae_u8 bufrdb[FILESYS_MAX_BLOCKSIZE], *buf = 0; uae_u8 *fsmem = 0; int rdblock, partblock, fileblock, lsegblock, i; @@ -6353,7 +6757,7 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke int oldversion, oldrevision; int newversion, newrevision; TCHAR *s; - bool showdebug = partnum == 0; + int cnt = 0; write_log (_T("%s:\n"), uip->rootdir); if (hfd->drive_empty) { @@ -6397,32 +6801,20 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke } blocksize = rl (bufrdb + 16); readblocksize = blocksize > hfd->ci.blocksize ? blocksize : hfd->ci.blocksize; + badblock = rl (bufrdb + 24); if (badblock != -1) { - rdbmnt - write_log (_T("RDB: badblock list is not yet supported. Contact the author.\n")); - return -2; + write_log (_T("RDB: badblock list %08x\n"), badblock); } + driveinitblock = rl (bufrdb + 36); if (driveinitblock != -1) { - rdbmnt - write_log (_T("RDB: driveinit is not yet supported. Contact the author.\n")); - return -2; + write_log (_T("RDB: driveinit = %08x\n"), driveinitblock); } + hfd->rdbcylinders = rl (bufrdb + 64); hfd->rdbsectors = rl (bufrdb + 68); hfd->rdbheads = rl (bufrdb + 72); -#if 0 - { - int cyls, secs, heads; - getchsgeometry_hdf (hfd, hfd->virtsize, &cyls, &secs, &heads); - if (cyls * secs * heads > hfd->cylinders * hfd->sectors * hfd->heads) { - hfd->cylinders = cyls; - hfd->sectors = secs; - hfd->heads = heads; - } - } -#endif fileblock = rl (bufrdb + 32); buf = xmalloc (uae_u8, readblocksize); @@ -6440,11 +6832,12 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke hdf_read (hfd, buf, partblock * hfd->ci.blocksize, readblocksize); if (!rdb_checksum ("PART", buf, partblock)) { err = -2; + write_log(_T("RDB: checksum error in PART block %d\n"), partblock); goto error; } } - rdbmnt + rdbmnt; flags = rl (buf + 20); if ((flags & 2) || uip->bootpri <= -129) { /* do not mount */ err = -1; @@ -6453,19 +6846,19 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke } if (!(flags & 1) || uip->bootpri <= -128) /* not bootable */ - m68k_dreg (regs, 7) = m68k_dreg (regs, 7) & ~1; + trap_set_dreg(ctx, 7, trap_get_dreg(ctx, 7) & ~1); buf[37 + buf[36]] = 0; /* zero terminate BSTR */ s = au ((char*)buf + 37); - uip->rdb_devname_amiga[partnum] = ds (device_dupfix (get_long (parmpacket + PP_EXPLIB), s)); + uip->rdb_devname_amiga[partnum] = ds(device_dupfix(ctx, trap_get_long(ctx, parmpacket + PP_EXPLIB), s)); xfree (s); - put_long (parmpacket, uip->rdb_devname_amiga[partnum]); /* name */ - put_long (parmpacket + 4, ROM_hardfile_resname); - put_long (parmpacket + 8, uip->devno); - put_long (parmpacket + 12, 0); /* Device flags */ + trap_put_long(ctx, parmpacket, uip->rdb_devname_amiga[partnum]); /* name */ + trap_put_long(ctx, parmpacket + 4, ROM_hardfile_resname); + trap_put_long(ctx, parmpacket + 8, uip->devno); + trap_put_long(ctx, parmpacket + 12, 0); /* Device flags */ for (i = 0; i < PP_MAXSIZE; i++) - put_byte (parmpacket + 16 + i, buf[128 + i]); - dostype = get_long (parmpacket + 80); + trap_put_byte(ctx, parmpacket + 16 + i, buf[128 + i]); + dostype = trap_get_long(ctx, parmpacket + 80); uip->rdb_dostype = dostype; if (dostype == 0) { @@ -6483,21 +6876,21 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke if (fileblock == -1 || !legalrdbblock (uip, fileblock)) goto error; - fsres = get_long (parmpacket + PP_FSRES); + fsres = trap_get_long(ctx, parmpacket + PP_FSRES); if (!fsres) { write_log (_T("RDB: FileSystem.resource not found, this shouldn't happen!\n")); goto error; } - fsnode = get_long (fsres + 18); - while (get_long (fsnode)) { - if (get_long (fsnode + 14) == dostype) + fsnode = trap_get_long(ctx, fsres + 18); + while (trap_get_long(ctx, fsnode)) { + if (trap_get_long(ctx, fsnode + 14) == dostype) break; - fsnode = get_long (fsnode); + fsnode = trap_get_long(ctx, fsnode); } oldversion = oldrevision = -1; - if (get_long (fsnode)) { - oldversion = get_word (fsnode + 18); - oldrevision = get_word (fsnode + 20); + if (trap_get_long(ctx, fsnode)) { + oldversion = trap_get_word(ctx, fsnode + 18); + oldrevision = trap_get_word(ctx, fsnode + 20); } else { fsnode = 0; } @@ -6505,7 +6898,7 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke for (;;) { if (fileblock == -1) { if (!fsnode) - write_log (_T("RDB: FS %08X (%s) not in FileSystem.resource or in RDB\n"), dostype, dostypes (dostype)); + write_log (_T("RDB: FS %08X (%s) not in FileSystem.resource or in RDB\n"), dostype, dostypes (dt, dostype)); goto error; } if (!legalrdbblock (uip, fileblock)) { @@ -6520,15 +6913,15 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke } fileblock = rl (buf + 16); uae_u32 rdbdostype = rl (buf + 32); - if (((dostype >> 8) == (rdbdostype >> 8) && (dostype != 0x444f5300 && (dostype & 0xffffff00) == 0x444f5300)) || (dostype == rdbdostype)) + if (((dostype >> 8) == (rdbdostype >> 8) && (dostype != DISK_TYPE_DOS && (dostype & 0xffffff00) == DISK_TYPE_DOS)) || (dostype == rdbdostype)) break; } newversion = (buf[36] << 8) | buf[37]; newrevision = (buf[38] << 8) | buf[39]; - write_log (_T("RDB: RDB filesystem %08X (%s) version %d.%d\n"), dostype, dostypes (dostype), newversion, newrevision); + write_log (_T("RDB: RDB filesystem %08X (%s) version %d.%d\n"), dostype, dostypes (dt, dostype), newversion, newrevision); if (fsnode) { - write_log (_T("RDB: %08X (%s) in FileSystem.resource version %d.%d\n"), dostype, dostypes (dostype), oldversion, oldrevision); + write_log (_T("RDB: %08X (%s) in FileSystem.resource version %d.%d\n"), dostype, dostypes (dt, dostype), oldversion, oldrevision); } if (newversion * 65536 + newrevision <= oldversion * 65536 + oldrevision && oldversion >= 0) { write_log (_T("RDB: FS in FileSystem.resource is newer or same, ignoring RDB filesystem\n")); @@ -6536,35 +6929,36 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke } for (i = 0; i < 140; i++) - put_byte (parmpacket + PP_FSHDSTART + i, buf[32 + i]); - put_long (parmpacket + PP_FSHDSTART, dostype); + trap_put_byte(ctx, parmpacket + PP_FSHDSTART + i, buf[32 + i]); + trap_put_long(ctx, parmpacket + PP_FSHDSTART, dostype); /* we found required FSHD block */ fsmem = xmalloc (uae_u8, 262144); lsegblock = rl (buf + 72); - i = 0; for (;;) { int pb = lsegblock; if (!legalrdbblock (uip, lsegblock)) goto error; memset (buf, 0, readblocksize); hdf_read (hfd, buf, lsegblock * hfd->ci.blocksize, readblocksize); - if (!rdb_checksum ("LSEG", buf, lsegblock)) + if (!rdb_checksum ("LSEG", buf, lsegblock)) { + write_log(_T("RDB: checksum error in LSEG block %d\n"), lsegblock); goto error; + } lsegblock = rl (buf + 16); if (lsegblock == pb) goto error; - if ((i + 1) * (blocksize - 20) >= 262144) + if ((cnt + 1) * (blocksize - 20) >= 262144) goto error; - memcpy (fsmem + i * (blocksize - 20), buf + 20, blocksize - 20); - i++; + memcpy (fsmem + cnt * (blocksize - 20), buf + 20, blocksize - 20); + cnt++; if (lsegblock == -1) break; } - write_log (_T("RDB: Filesystem loaded, %d bytes\n"), i * (blocksize - 20)); - put_long (parmpacket + PP_FSSIZE, i * (blocksize - 20)); /* RDB filesystem size hack */ - put_long (parmpacket + PP_ADDTOFSRES, -1); + write_log (_T("RDB: Filesystem loaded, %d bytes\n"), cnt * (blocksize - 20)); + trap_put_long(ctx, parmpacket + PP_FSSIZE, cnt * (blocksize - 20)); /* RDB filesystem size hack */ + trap_put_long(ctx, parmpacket + PP_ADDTOFSRES, -1); uip->rdb_filesysstore = fsmem; - uip->rdb_filesyssize = i * (blocksize - 20); + uip->rdb_filesyssize = cnt * (blocksize - 20); xfree (buf); return 2; error: @@ -6573,33 +6967,33 @@ error: return err; } -static void addfakefilesys (uaecptr parmpacket, uae_u32 dostype, int ver, int rev, struct uaedev_config_info *ci) +static void addfakefilesys (TrapContext *ctx, uaecptr parmpacket, uae_u32 dostype, int ver, int rev, struct uaedev_config_info *ci) { int i; uae_u32 flags; flags = 0x180; for (i = 0; i < 140; i++) - put_byte (parmpacket + PP_FSHDSTART + i, 0); + trap_put_byte(ctx, parmpacket + PP_FSHDSTART + i, 0); if (dostype) { - put_long (parmpacket + 80, dostype); - put_long (parmpacket + PP_FSHDSTART, dostype); + trap_put_long(ctx, parmpacket + 80, dostype); + trap_put_long(ctx, parmpacket + PP_FSHDSTART, dostype); } if (ver >= 0 && rev >= 0) - put_long (parmpacket + PP_FSHDSTART + 4, (ver << 16) | rev); + trap_put_long(ctx, parmpacket + PP_FSHDSTART + 4, (ver << 16) | rev); - put_long (parmpacket + PP_FSHDSTART + 12 + 4 * 4, ci->stacksize); + trap_put_long(ctx, parmpacket + PP_FSHDSTART + 12 + 4 * 4, ci->stacksize); flags |= 0x10; if (ci->priority != -129) { - put_long (parmpacket + PP_FSHDSTART + 12 + 5 * 4, ci->priority); + trap_put_long(ctx, parmpacket + PP_FSHDSTART + 12 + 5 * 4, ci->priority); flags |= 0x20; } - put_long (parmpacket + PP_FSHDSTART + 12 + 8 * 4, dostype == 0x444f5300 ? 0 : -1); // globvec + trap_put_long(ctx, parmpacket + PP_FSHDSTART + 12 + 8 * 4, dostype == DISK_TYPE_DOS || bcplonlydos() ? 0 : -1); // globvec // if OFS = seglist -> NULL - if (dostype == 0x444f5300) + if (dostype == DISK_TYPE_DOS) flags &= ~0x080; - put_long (parmpacket + PP_FSHDSTART + 8, flags); // patchflags + trap_put_long(ctx, parmpacket + PP_FSHDSTART + 8, flags); // patchflags } static uaecptr getfakefilesysseg (UnitInfo *uip) @@ -6618,10 +7012,11 @@ static uaecptr getfakefilesysseg (UnitInfo *uip) return 0; } -static int dofakefilesys (UnitInfo *uip, uaecptr parmpacket, struct uaedev_config_info *ci) +static int dofakefilesys (TrapContext *ctx, UnitInfo *uip, uaecptr parmpacket, struct uaedev_config_info *ci) { int i, size; TCHAR tmp[MAX_DPATH]; + TCHAR dt[32]; uae_u8 buf[512]; struct zfile *zf; int ver = -1, rev = -1; @@ -6633,9 +7028,9 @@ static int dofakefilesys (UnitInfo *uip, uaecptr parmpacket, struct uaedev_confi uaecptr seg = getfakefilesysseg (uip); if (seg) { // yes, re-use it. - put_long (parmpacket + PP_FSSIZE, 0); - put_long (parmpacket + PP_FSPTR, seg); - put_long (parmpacket + PP_ADDTOFSRES, 0); + trap_put_long(ctx, parmpacket + PP_FSSIZE, 0); + trap_put_long(ctx, parmpacket + PP_FSPTR, seg); + trap_put_long(ctx, parmpacket + PP_ADDTOFSRES, 0); write_log (_T("RDB: faked RDB filesystem '%s' reused\n"), uip->filesysdir); return FILESYS_HARDFILE; } @@ -6649,10 +7044,10 @@ static int dofakefilesys (UnitInfo *uip, uaecptr parmpacket, struct uaedev_confi dostype = ci->dostype; } if (dostype == 0) { - addfakefilesys (parmpacket, dostype, ver, rev, ci); + addfakefilesys(ctx, parmpacket, dostype, ver, rev, ci); return FILESYS_HARDFILE; } - if (dostype == 0x444f5300 && (!uip->filesysdir || !uip->filesysdir[0])) { + if (dostype == DISK_TYPE_DOS && (!uip->filesysdir || !uip->filesysdir[0])) { write_log (_T("RDB: OFS, using ROM default FS.\n")); return FILESYS_HARDFILE; } @@ -6660,7 +7055,7 @@ static int dofakefilesys (UnitInfo *uip, uaecptr parmpacket, struct uaedev_confi tmp[0] = 0; if (uip->filesysdir && _tcslen (uip->filesysdir) > 0) { _tcscpy (tmp, uip->filesysdir); - } else if ((dostype & 0xffffff00) == 0x444f5300) { + } else if ((dostype & 0xffffff00) == DISK_TYPE_DOS) { _tcscpy (tmp, currprefs.romfile); i = _tcslen (tmp); while (i > 0 && tmp[i - 1] != '/' && tmp[i - 1] != '\\') @@ -6669,17 +7064,17 @@ static int dofakefilesys (UnitInfo *uip, uaecptr parmpacket, struct uaedev_confi autofs = true; } if (tmp[0] == 0) { - write_log (_T("RDB: no filesystem for dostype 0x%08X (%s)\n"), dostype, dostypes (dostype)); - addfakefilesys (parmpacket, dostype, ver, rev, ci); - if ((dostype & 0xffffff00) == 0x444f5300) + write_log (_T("RDB: no filesystem for dostype 0x%08X (%s)\n"), dostype, dostypes (dt, dostype)); + addfakefilesys (ctx, parmpacket, dostype, ver, rev, ci); + if ((dostype & 0xffffff00) == DISK_TYPE_DOS) return FILESYS_HARDFILE; write_log (_T("RDB: mounted without filesys\n")); return FILESYS_HARDFILE; } - write_log (_T("RDB: fakefilesys, trying to load '%s', dostype 0x%08X (%s)\n"), tmp, dostype, dostypes (dostype)); + write_log (_T("RDB: fakefilesys, trying to load '%s', dostype 0x%08X (%s)\n"), tmp, dostype, dostypes (dt, dostype)); zf = zfile_fopen (tmp, _T("rb"), ZFD_NORMAL); if (!zf) { - addfakefilesys (parmpacket, dostype, ver, rev, ci); + addfakefilesys(ctx, parmpacket, dostype, ver, rev, ci); write_log (_T("RDB: filesys not found, mounted without forced filesys\n")); return FILESYS_HARDFILE; } @@ -6687,22 +7082,22 @@ static int dofakefilesys (UnitInfo *uip, uaecptr parmpacket, struct uaedev_confi uae_u32 fsres, fsnode; int oldversion = -1; int oldrevision = -1; - fsres = get_long (parmpacket + PP_FSRES); - fsnode = get_long (fsres + 18); - while (get_long (fsnode)) { - uae_u32 fsdostype = get_long (fsnode + 14); + fsres = trap_get_long(ctx, parmpacket + PP_FSRES); + fsnode = trap_get_long(ctx, fsres + 18); + while (trap_get_long(ctx, fsnode)) { + uae_u32 fsdostype = trap_get_long(ctx, fsnode + 14); if (fsdostype == dostype) { - oldversion = get_word (fsnode + 18); - oldrevision = get_word (fsnode + 20); - write_log (_T("RDB: %08X (%s) in FileSystem.resource version %d.%d\n"), dostype, dostypes (dostype), oldversion, oldrevision); + oldversion = trap_get_word(ctx, fsnode + 18); + oldrevision = trap_get_word(ctx, fsnode + 20); + write_log (_T("RDB: %08X (%s) in FileSystem.resource version %d.%d\n"), dostype, dostypes(dt, dostype), oldversion, oldrevision); break; } - fsnode = get_long (fsnode); + fsnode = trap_get_long(ctx, fsnode); } // if automatically found FastFileSystem, do not replace matching FileSystem.resource FS if (autofs && oldversion >= 0) { zfile_fclose (zf); - addfakefilesys (parmpacket, dostype, ver, rev, ci); + addfakefilesys(ctx, parmpacket, dostype, ver, rev, ci); write_log (_T("RDB: not replacing FileSystem.resource\n")); return FILESYS_HARDFILE; } @@ -6754,31 +7149,31 @@ static int dofakefilesys (UnitInfo *uip, uaecptr parmpacket, struct uaedev_confi uip->rdb_filesyssize = size; // DOS\0 is not in fs.resource and fs.resource already existed? - if (dostype == 0x444f5300 && oldversion < 0) + if (dostype == DISK_TYPE_DOS && oldversion < 0) oldversion = 0; - put_long (parmpacket + PP_FSSIZE, uip->rdb_filesyssize); - put_long (parmpacket + PP_ADDTOFSRES, oldversion < 0 ? -1 : 0); - addfakefilesys (parmpacket, dostype, ver, rev, ci); - write_log (_T("RDB: faked RDB filesystem %08X (%s %d.%d) loaded. ADD2FS=%d\n"), dostype, dostypes (dostype), ver, rev, oldversion < 0 ? 1 : 0); + trap_put_long(ctx, parmpacket + PP_FSSIZE, uip->rdb_filesyssize); + trap_put_long(ctx, parmpacket + PP_ADDTOFSRES, oldversion < 0 ? -1 : 0); + addfakefilesys (ctx, parmpacket, dostype, ver, rev, ci); + write_log (_T("RDB: faked RDB filesystem %08X (%s %d.%d) loaded. ADD2FS=%d\n"), dostype, dostypes (dt, dostype), ver, rev, oldversion < 0 ? 1 : 0); return FILESYS_HARDFILE; } -static void get_new_device (int type, uaecptr parmpacket, TCHAR **devname, uaecptr *devname_amiga, int unit_no) +static void get_new_device (TrapContext *ctx, int type, uaecptr parmpacket, TCHAR **devname, uaecptr *devname_amiga, int unit_no) { TCHAR buffer[80]; - uaecptr expbase = get_long (parmpacket + PP_EXPLIB); + uaecptr expbase = trap_get_long(ctx, parmpacket + PP_EXPLIB); if (*devname == 0 || _tcslen (*devname) == 0) { int un = unit_no; for (;;) { _stprintf (buffer, _T("DH%d"), un++); - if (!device_isdup (expbase, buffer)) + if (!device_isdup(ctx, expbase, buffer)) break; } } else { _tcscpy (buffer, *devname); } - *devname_amiga = ds (device_dupfix (expbase, buffer)); + *devname_amiga = ds (device_dupfix(ctx, expbase, buffer)); if (type == FILESYS_VIRTUAL) write_log (_T("FS: mounted virtual unit %s (%s)\n"), buffer, mountinfo.ui[unit_no].rootdir); else @@ -6789,171 +7184,152 @@ static void get_new_device (int type, uaecptr parmpacket, TCHAR **devname, uaecp } /* Fill in per-unit fields of a parampacket */ -static uae_u32 REGPARAM2 filesys_dev_storeinfo (TrapContext *context) +static uae_u32 REGPARAM2 filesys_dev_storeinfo (TrapContext *ctx) { - UnitInfo *uip = mountinfo.ui; - int no = m68k_dreg(regs, 6) & 0x7fffffff; - int unit_no = no & 65535; - int sub_no = no >> 16; - int iscd = (m68k_dreg(regs, 6) & 0x80000000) != 0 || uip[unit_no].unit_type == UNIT_CDFS; - int type; - uaecptr parmpacket = m68k_areg(regs, 0); + UnitInfo *uip = mountinfo.ui; + int no = trap_get_dreg(ctx, 6) & 0x7fffffff; + int unit_no = no & 65535; + int sub_no = no >> 16; + int type; + uaecptr parmpacket = trap_get_areg(ctx, 0); struct uaedev_config_info *ci = &uip[unit_no].hf.ci; - put_long (parmpacket + PP_ADDTOFSRES, 0); - put_long (parmpacket + PP_FSSIZE, 0); - //TODO - //if (iscd) { - // TCHAR *cdname = NULL; - // uaecptr cdname_amiga; - // int cd_unit_no = unit_no - cd_unit_offset; + uip[unit_no].parmpacket = parmpacket; + if (!ks12hack_deviceproc) + ks12hack_deviceproc = trap_get_long(ctx, parmpacket + PP_DEVICEPROC); + trap_put_long(ctx, parmpacket + PP_DEVICEPROC, 0); + trap_put_long(ctx, parmpacket + PP_ADDTOFSRES, 0); + trap_put_long(ctx, parmpacket + PP_FSSIZE, 0); - // if (sub_no) - // return -2; - - // type = FILESYS_CD; - // get_new_device(type, parmpacket, &uip[unit_no].devname, &uip[unit_no].devname_amiga, cd_unit_no); - // cdname_amiga = uip[unit_no].devname_amiga; - // uip[unit_no].devno = unit_no; - // type = FILESYS_VIRTUAL; - // gui_flicker_led(LED_CD, cd_unit_no, 0); - - // write_log(_T("Mounting uaescsi.device %d: (%d)\n"), cd_unit_no, unit_no); - // put_long(parmpacket + 0, cdname_amiga); - // put_long(parmpacket + 4, cdfs_devname); - // put_long(parmpacket + 8, cd_unit_no); - // put_long(parmpacket + 12, 0); /* Device flags */ - // put_long(parmpacket + 16, 19); /* Env. size */ - // put_long(parmpacket + 20, 2048 >> 2); /* longwords per block */ - // put_long(parmpacket + 24, 0); /* unused */ - // put_long(parmpacket + 28, 1); /* heads */ - // put_long(parmpacket + 32, 1); /* sectors per block */ - // put_long(parmpacket + 36, 1); /* sectors per track */ - // put_long(parmpacket + 40, 0); /* reserved blocks */ - // put_long(parmpacket + 44, 0); /* unused */ - // put_long(parmpacket + 48, 0); /* interleave */ - // put_long(parmpacket + 52, 0); /* lowCyl */ - // put_long(parmpacket + 56, 0); /* hiCyl */ - // put_long(parmpacket + 60, 50); /* Number of buffers */ - // put_long(parmpacket + 64, 1); /* Buffer mem type */ - // put_long(parmpacket + 68, 0x7FFFFFFE); /* largest transfer */ - // put_long(parmpacket + 72, 0xFFFFFFFE); /* dma mask */ - // put_long(parmpacket + 76, scsi_get_cd_drive_media_mask() & (1 << cd_unit_no) ? -127 : -128); /* bootPri */ - // put_long(parmpacket + 80, CDFS_DOSTYPE | (((cd_unit_no / 10) + '0') << 8) | ((cd_unit_no % 10) + '0')); - // put_long(parmpacket + 84, 0); /* baud */ - // put_long(parmpacket + 88, 0); /* control */ - // put_long(parmpacket + 92, 0); /* bootblocks */ - // return type; - - //} - - gui_flicker_led(LED_HD, unit_no, 0); - type = is_hardfile(unit_no); - if (type == FILESYS_HARDFILE_RDB || type == FILESYS_HARDDRIVE) { + gui_flicker_led (LED_HD, unit_no, 0); + type = is_hardfile (unit_no); + if (type == FILESYS_HARDFILE_RDB) { /* RDB hardfile */ uip[unit_no].devno = unit_no; - return rdb_mount(&uip[unit_no], unit_no, sub_no, parmpacket); + return rdb_mount (ctx, &uip[unit_no], unit_no, sub_no, parmpacket); } - if (sub_no) - return -2; - write_log(_T("Mounting uaehf.device %d (%d):\n"), unit_no, sub_no); - get_new_device(type, parmpacket, &uip[unit_no].devname, &uip[unit_no].devname_amiga, unit_no); - uip[unit_no].devno = unit_no; - put_long(parmpacket, uip[unit_no].devname_amiga); - put_long(parmpacket + 8, uip[unit_no].devno); - put_long(parmpacket + 12, 0); /* Device flags */ - put_long(parmpacket + 16, 16); /* Env. size */ - put_long(parmpacket + 24, 0); /* unused */ - put_long(parmpacket + 44, 0); /* unused */ - put_long(parmpacket + 48, 0); /* interleave */ - put_long(parmpacket + 60, 50); /* Number of buffers */ - put_long(parmpacket + 64, 1); /* Buffer mem type */ - put_long(parmpacket + 68, 0x7FFFFFFE); /* largest transfer */ - put_long(parmpacket + 72, 0xFFFFFFFE); /* dma mask */ - put_long(parmpacket + 76, uip[unit_no].bootpri); /* bootPri */ - put_long(parmpacket + 80, DISK_TYPE_DOS); /* DOS\0 */ + if (sub_no) + return -2; + write_log(_T("Mounting uaehf.device %d (%d):\n"), unit_no, sub_no); + get_new_device(ctx, type, parmpacket, &uip[unit_no].devname, &uip[unit_no].devname_amiga, unit_no); + uip[unit_no].devno = unit_no; + trap_put_long(ctx, parmpacket, uip[unit_no].devname_amiga); + trap_put_long(ctx, parmpacket + 8, uip[unit_no].devno); + trap_put_long(ctx, parmpacket + 12, 0); /* Device flags */ + trap_put_long(ctx, parmpacket + 16, 16); /* Env. size */ + trap_put_long(ctx, parmpacket + 24, 0); /* unused */ + trap_put_long(ctx, parmpacket + 44, 0); /* unused */ + trap_put_long(ctx, parmpacket + 48, 0); /* interleave */ + trap_put_long(ctx, parmpacket + 60, 50); /* Number of buffers */ + trap_put_long(ctx, parmpacket + 64, 1); /* Buffer mem type */ + trap_put_long(ctx, parmpacket + 68, 0x7FFFFFFE); /* largest transfer */ + trap_put_long(ctx, parmpacket + 72, 0xFFFFFFFE); /* dma mask */ + trap_put_long(ctx, parmpacket + 76, uip[unit_no].bootpri); /* bootPri */ if (type == FILESYS_VIRTUAL) { - put_long(parmpacket + 4, fsdevname); - put_long(parmpacket + 20, 512 >> 2); /* longwords per block */ - put_long(parmpacket + 28, 15); /* heads */ - put_long(parmpacket + 32, 1); /* sectors per block */ - put_long(parmpacket + 36, 127); /* sectors per track */ - put_long(parmpacket + 40, 2); /* reserved blocks */ - put_long(parmpacket + 52, 0); /* lowCyl */ - put_long(parmpacket + 56, 1); /* hiCyl */ - } - else { - uae_u8 buf[512] = { 0 }; + // generate some sane-looking geometry if some program really cares.. + uae_s64 hicyl = 100; + uae_u32 heads = 16; + if (currprefs.filesys_limit) { + hicyl = ((currprefs.filesys_limit * 1024) / 512) / (heads * 127); + } else { + struct fs_usage fsu; + if (!get_fs_usage(uip[unit_no].rootdir, 0, &fsu)) { + for (;;) { + hicyl = (fsu.total / 512) / (heads * 127); + if (hicyl < 65536 || heads == 64) + break; + heads *= 2; + } + } + } + trap_put_long(ctx, parmpacket + 4, fsdevname); + trap_put_long(ctx, parmpacket + 20, 512 >> 2); /* longwords per block */ + trap_put_long(ctx, parmpacket + 28, heads); /* heads */ + trap_put_long(ctx, parmpacket + 32, 1); /* sectors per block */ + trap_put_long(ctx, parmpacket + 36, 127); /* sectors per track */ + trap_put_long(ctx, parmpacket + 40, 2); /* reserved blocks */ + trap_put_long(ctx, parmpacket + 52, 1); /* lowCyl */ + trap_put_long(ctx, parmpacket + 56, (uae_u32)hicyl); /* hiCyl */ + trap_put_long(ctx, parmpacket + 80, DISK_TYPE_DOS); /* DOS\0 */ + } else { + uae_u8 buf[512]; + trap_put_long(ctx, parmpacket + 4, ROM_hardfile_resname); + trap_put_long(ctx, parmpacket + 20, ci->blocksize >> 2); /* longwords per block */ + trap_put_long(ctx, parmpacket + 28, ci->surfaces); /* heads */ + trap_put_long(ctx, parmpacket + 32, ci->sectorsperblock); /* sectors per block */ + trap_put_long(ctx, parmpacket + 36, ci->sectors); /* sectors per track */ + trap_put_long(ctx, parmpacket + 40, ci->reserved); /* reserved blocks */ + trap_put_long(ctx, parmpacket + 52, ci->lowcyl); /* lowCyl */ + trap_put_long(ctx, parmpacket + 56, ci->highcyl <= 0 ? ci->cyls - 1 : ci->highcyl - 1); /* hiCyl */ + trap_put_long(ctx, parmpacket + 48, ci->interleave); /* interleave */ + trap_put_long(ctx, parmpacket + 60, ci->buffers); /* Number of buffers */ + trap_put_long(ctx, parmpacket + 64, ci->bufmemtype); /* Buffer mem type */ + trap_put_long(ctx, parmpacket + 68, ci->maxtransfer); /* largest transfer */ + trap_put_long(ctx, parmpacket + 72, ci->mask); /* dma mask */ + trap_put_long(ctx, parmpacket + 80, DISK_TYPE_DOS); /* DOS\0 */ + memset(buf, 0, sizeof buf); + if (ci->dostype) { // forced dostype? + trap_put_long(ctx, parmpacket + 80, ci->dostype); /* dostype */ + } else if (hdf_read (&uip[unit_no].hf, buf, 0, sizeof buf)) { + uae_u32 dt = rl (buf); + if (dt != 0x00000000 && dt != 0xffffffff) + trap_put_long(ctx, parmpacket + 80, dt); + } + memset(buf, 0, sizeof buf); char *s = ua_fs(uip[unit_no].devname, -1); buf[36] = strlen(s); for (int i = 0; i < buf[36]; i++) buf[37 + i] = s[i]; xfree(s); - put_long(parmpacket + 4, ROM_hardfile_resname); - put_long(parmpacket + 20, ci->blocksize >> 2); /* longwords per block */ - put_long(parmpacket + 28, ci->surfaces); /* heads */ - put_long(parmpacket + 32, ci->sectorsperblock); /* sectors per block */ - put_long(parmpacket + 36, ci->sectors); /* sectors per track */ - put_long(parmpacket + 40, ci->reserved); /* reserved blocks */ - put_long(parmpacket + 52, ci->lowcyl); /* lowCyl */ - put_long(parmpacket + 56, ci->highcyl <= 0 ? ci->cyls - 1 : ci->highcyl - 1); /* hiCyl */ - put_long(parmpacket + 48, ci->interleave); /* interleave */ - put_long(parmpacket + 60, ci->buffers); /* Number of buffers */ - put_long(parmpacket + 64, ci->bufmemtype); /* Buffer mem type */ - put_long(parmpacket + 68, ci->maxtransfer); /* largest transfer */ - put_long(parmpacket + 72, ci->mask); /* dma mask */ - if (ci->dostype) { // forced dostype? - put_long(parmpacket + 80, ci->dostype); /* dostype */ - } - else if (hdf_read(&uip[unit_no].hf, buf, 0, sizeof buf)) { - uae_u32 dt = rl(buf); - if (dt != 0x00000000 && dt != 0xffffffff) - put_long(parmpacket + 80, dt); - } for (int i = 0; i < 80; i++) - buf[i + 128] = get_byte(parmpacket + 16 + i); + buf[i + 128] = trap_get_byte(ctx, parmpacket + 16 + i); } if (type == FILESYS_HARDFILE) - type = dofakefilesys(&uip[unit_no], parmpacket, ci); - if (uip[unit_no].bootpri < -127 || (type == FILESYS_HARDFILE && ci->rootdir[0] == 0)) - m68k_dreg(regs, 7) = m68k_dreg(regs, 7) & ~1; /* do not boot */ - if (uip[unit_no].bootpri < -128) - return -1; /* do not mount */ - return type; + type = dofakefilesys (ctx, &uip[unit_no], parmpacket, ci); + if (uip[unit_no].bootpri < -127 || (type == FILESYS_HARDFILE && ci->rootdir[0] == 0)) + trap_set_dreg(ctx, 7, trap_get_dreg(ctx, 7) & ~1); /* do not boot */ + if (uip[unit_no].bootpri < -128) + return -1; /* do not mount */ + return type; } -static uae_u32 REGPARAM2 mousehack_done (TrapContext *context) +static uae_u32 REGPARAM2 mousehack_done (TrapContext *ctx) { - int mode = m68k_dreg (regs, 1); + int mode = trap_get_dreg(ctx, 1); if (mode < 10) { - uaecptr diminfo = m68k_areg (regs, 2); - uaecptr dispinfo = m68k_areg (regs, 3); - uaecptr vp = m68k_areg (regs, 4); - return input_mousehack_status (mode, diminfo, dispinfo, vp, m68k_dreg (regs, 2)); + uaecptr diminfo = trap_get_areg(ctx, 2); + uaecptr dispinfo = trap_get_areg(ctx, 3); + uaecptr vp = trap_get_areg(ctx, 4); + return input_mousehack_status(ctx, mode, diminfo, dispinfo, vp, trap_get_dreg(ctx, 2)); } else if (mode == 10) { - amiga_clipboard_die (); } else if (mode == 11) { - amiga_clipboard_got_data (m68k_areg (regs, 2), m68k_dreg (regs, 2), m68k_dreg (regs, 0) + 8); } else if (mode == 12) { - return amiga_clipboard_want_data (); + return 0; } else if (mode == 13) { - return amiga_clipboard_proc_start (); + return 0; } else if (mode == 14) { - amiga_clipboard_task_start (m68k_dreg (regs, 0)); } else if (mode == 15) { - amiga_clipboard_init (); } else if (mode == 16) { - uaecptr a2 = m68k_areg (regs, 2); + uaecptr a2 = trap_get_areg(ctx, 2); input_mousehack_mouseoffset (a2); } else if (mode == 17) { - uae_u32 v = 0; - return v; + return 0; } else if (mode == 18) { + put_long_host(rtarea_bank.baseaddr + RTAREA_EXTERTASK, trap_get_dreg(ctx, 0)); + put_long_host(rtarea_bank.baseaddr + RTAREA_TRAPTASK, trap_get_dreg(ctx, 2)); return rtarea_base + RTAREA_HEARTBEAT; + } else if (mode == 19) { + // boot rom copy + // d2 = ram address + return 0; + } else if (mode == 20) { + // boot rom copy done + return 0; + } else if (mode == 21) { + // keymap hook (nur für Retroplatform relevant) + return 1; } else if (mode == 101) { } else if (mode == 102) { - uaecptr ret = 0; - put_long (m68k_areg (regs, 7) + 4 * 4, ret); } else { write_log (_T("Unknown mousehack hook %d\n"), mode); } @@ -6962,17 +7338,15 @@ static uae_u32 REGPARAM2 mousehack_done (TrapContext *context) void filesys_vsync (void) { + TrapContext *ctx = NULL; Unit *u; - if (uae_boot_rom_type <= 0) - return; - - if (heartbeat == get_long (rtarea_base + RTAREA_HEARTBEAT)) { - if (heartbeat_count > 0) - heartbeat_count--; + if (uae_boot_rom_type <= 0) + return; + if (heartbeat == get_long_host(rtarea_bank.baseaddr + RTAREA_HEARTBEAT)) { return; } - heartbeat = get_long (rtarea_base + RTAREA_HEARTBEAT); + heartbeat = get_long_host(rtarea_bank.baseaddr + RTAREA_HEARTBEAT); for (u = units; u; u = u->next) { if (u->reinsertdelay > 0) { @@ -6985,7 +7359,7 @@ void filesys_vsync (void) u->newrootdir = NULL; } } - record_timeout (u); + record_timeout (ctx, u); } for (int i = 0; i < currprefs.mountitems; i++) { @@ -7000,39 +7374,58 @@ void filesys_vsync (void) } } } +} - if (heartbeat_count <= 0) - return; - - if (heartbeat_task & 1) { - setsystime_vblank (); - heartbeat_task &= ~1; - } +void filesys_cleanup (void) +{ + filesys_free_handles(); + free_mountinfo (); + + if(singlethread_int_sem != 0) + uae_sem_destroy(&singlethread_int_sem); + singlethread_int_sem = 0; + + filesys_in_interrupt = 0; + mountertask = 0; + automountunit = -1; } void filesys_install (void) { uaecptr loop; - TRACEI ((_T("Installing filesystem\n"))); - uae_sem_init (&singlethread_int_sem, 0, 1); - ROM_filesys_resname = ds_ansi ("UAEunixfs.resource"); - ROM_filesys_resid = ds_ansi ("UAE unixfs 0.4"); + ROM_filesys_resname = ds_ansi ("UAEfs.resource"); + ROM_filesys_resid = ds_ansi (UAEFS_VERSION); fsdevname = ds_ansi ("uae.device"); /* does not really exist */ fshandlername = ds_bstr_ansi ("uaefs"); + + afterdos_name = ds_ansi("UAE afterdos"); + afterdos_id = ds_ansi("UAE afterdos 0.1"); + ROM_filesys_diagentry = here(); calltrap (deftrap2 (filesys_diagentry, 0, _T("filesys_diagentry"))); dw(0x4ED0); /* JMP (a0) - jump to code that inits Residents */ - loop = here (); + ROM_filesys_doio = here(); + calltrap(deftrap2(filesys_doio, 0, _T("filesys_doio"))); + dw(RTS); + + ROM_filesys_putmsg = here(); + calltrap(deftrap2(filesys_putmsg, 0, _T("filesys_putmsg"))); + dw(RTS); + + ROM_filesys_putmsg_return = here(); + calltrap(deftrap2(filesys_putmsg_return, 0, _T("filesys_putmsg_return"))); + dw(RTS); + + loop = here (); org (rtarea_base + RTAREA_HEARTBEAT); dl (0); heartbeat = 0; - heartbeat_task = 0; org (rtarea_base + 0xFF18); calltrap (deftrap2 (filesys_dev_bootfilesys, 0, _T("filesys_dev_bootfilesys"))); @@ -7045,7 +7438,7 @@ void filesys_install (void) org (rtarea_base + 0xFF28); calltrap (deftrap2 (filesys_dev_storeinfo, 0, _T("filesys_dev_storeinfo"))); - dw (RTS); + dw (RTS); org (rtarea_base + 0xFF30); calltrap (deftrap2 (filesys_handler, 0, _T("filesys_handler"))); @@ -7071,6 +7464,14 @@ void filesys_install (void) calltrap (deftrap2 (fsmisc_helper, 0, _T("fsmisc_helper"))); dw (RTS); + org(rtarea_base + 0xFF68); + calltrap(deftrap2(filesys_bcpl_wrapper, 0, _T("filesys_bcpl_wrapper"))); + dw(RTS); + + org(rtarea_base + 0xFF78); + calltrap(deftrap2(debugger_helper, 0, _T("debugger_helper"))); + dw(RTS); + org (loop); } @@ -7083,71 +7484,76 @@ void filesys_install_code (void) { uae_u32 b, items; - bootrom_header = 3 * 4; - align(4); - bootrom_start = here(); -#include "filesys_bootrom.cpp" + bootrom_header = 3 * 4; + align(4); + bootrom_start = here (); + #include "filesys_bootrom.cpp" - items = dlg(bootrom_start + 8) & 0xffff; - /* The last offset comes from the code itself, look for it near the top. */ + items = dlg (bootrom_start + 8) & 0xffff; + /* The last offset comes from the code itself, look for it near the top. */ EXPANSION_bootcode = bootrom_start + bootrom_header + items * 4 - 4; b = bootrom_start + bootrom_header + 3 * 4 - 4; - filesys_initcode = bootrom_start + dlg(b) + bootrom_header - 4; + filesys_initcode = bootrom_start + dlg (b) + bootrom_header - 4; + afterdos_initcode = filesys_get_entry(8); } -static uae_u8 *restore_filesys_hardfile(UnitInfo *ui, uae_u8 *src) -{ - struct hardfiledata *hfd = &ui->hf; - TCHAR *s; +#ifdef _WIN32_ +#include "od-win32/win32_filesys.cpp" +#endif - hfd->virtsize = restore_u64(); - hfd->offset = restore_u64(); - hfd->ci.highcyl = restore_u32(); - hfd->ci.sectors = restore_u32(); - hfd->ci.surfaces = restore_u32(); - hfd->ci.reserved = restore_u32(); - hfd->ci.blocksize = restore_u32(); - hfd->ci.readonly = restore_u32() != 0; - hfd->flags = restore_u32(); - hfd->rdbcylinders = restore_u32(); - hfd->rdbsectors = restore_u32(); - hfd->rdbheads = restore_u32(); - s = restore_string(); - _tcscpy(hfd->vendor_id, s); - xfree(s); - s = restore_string(); - _tcscpy(hfd->product_id, s); - xfree(s); - s = restore_string(); - _tcscpy(hfd->product_rev, s); - xfree(s); - s = restore_string(); - _tcscpy(hfd->ci.devname, s); - xfree(s); - return src; +static uae_u8 *restore_filesys_hardfile (UnitInfo *ui, uae_u8 *src) +{ + struct hardfiledata *hfd = &ui->hf; + TCHAR *s; + + hfd->virtsize = restore_u64(); + hfd->offset = restore_u64(); + hfd->ci.highcyl = restore_u32 (); + hfd->ci.sectors = restore_u32 (); + hfd->ci.surfaces = restore_u32 (); + hfd->ci.reserved = restore_u32 (); + hfd->ci.blocksize = restore_u32 (); + hfd->ci.readonly = restore_u32 () != 0; + hfd->flags = restore_u32(); + hfd->rdbcylinders = restore_u32 (); + hfd->rdbsectors = restore_u32 (); + hfd->rdbheads = restore_u32 (); + s = restore_string(); + _tcscpy (hfd->vendor_id, s); + xfree(s); + s = restore_string(); + _tcscpy (hfd->product_id, s); + xfree(s); + s = restore_string(); + _tcscpy (hfd->product_rev, s); + xfree(s); + s = restore_string(); + _tcscpy (hfd->ci.devname, s); + xfree(s); + return src; } -static uae_u8 *save_filesys_hardfile(UnitInfo *ui, uae_u8 *dst) +static uae_u8 *save_filesys_hardfile (UnitInfo *ui, uae_u8 *dst) { - struct hardfiledata *hfd = &ui->hf; + struct hardfiledata *hfd = &ui->hf; - save_u64(hfd->virtsize); - save_u64(hfd->offset); - save_u32(hfd->ci.highcyl); - save_u32(hfd->ci.sectors); - save_u32(hfd->ci.surfaces); - save_u32(hfd->ci.reserved); - save_u32(hfd->ci.blocksize); - save_u32(hfd->ci.readonly); - save_u32(hfd->flags); - save_u32(hfd->rdbcylinders); - save_u32(hfd->rdbsectors); - save_u32(hfd->rdbheads); - save_string(hfd->vendor_id); - save_string(hfd->product_id); - save_string(hfd->product_rev); - save_string(hfd->ci.devname); - return dst; + save_u64 (hfd->virtsize); + save_u64 (hfd->offset); + save_u32 (hfd->ci.highcyl); + save_u32 (hfd->ci.sectors); + save_u32 (hfd->ci.surfaces); + save_u32 (hfd->ci.reserved); + save_u32 (hfd->ci.blocksize); + save_u32 (hfd->ci.readonly); + save_u32 (hfd->flags); + save_u32 (hfd->rdbcylinders); + save_u32 (hfd->rdbsectors); + save_u32 (hfd->rdbheads); + save_string (hfd->vendor_id); + save_string (hfd->product_id); + save_string (hfd->product_rev); + save_string (hfd->ci.devname); + return dst; } static a_inode *restore_filesys_get_base (Unit *u, TCHAR *npath) @@ -7167,7 +7573,6 @@ static a_inode *restore_filesys_get_base (Unit *u, TCHAR *npath) cnt = 1; for (;;) { _tcscpy (path, npath); - _tcscat (path, _T("/")); p = path; for (i = 0; i < cnt ;i++) { if (i > 0) @@ -7283,9 +7688,10 @@ static uae_u8 *restore_aino(UnitInfo *ui, Unit *u, uae_u8 *src) pn = makenativepath(ui, p); a->nname = pn; a->aname = my_strdup(p2); - /* find parent of a->aname (Already restored previously. I hope..) */ + /* create path to parent dir */ if (p2 != p) - p2[-1] = 0; + p2[0] = 0; + /* find parent of a->aname (Already restored previously. I hope..) */ base = restore_filesys_get_base(u, p); xfree(p); if (flags & 2) { @@ -7385,14 +7791,14 @@ static uae_u8 *restore_key(UnitInfo *ui, Unit *u, uae_u8 *src) missing = 1; } else { uae_s64 s; - s = fs_fsize64 (k->fd); + s = key_filesize(k); if (s != savedsize) write_log (_T("FS: restored file '%s' size changed! orig=%llu, now=%lld!!\n"), p, savedsize, s); if (k->file_pos > s) { write_log (_T("FS: restored filepos larger than size of file '%s'!! %llu > %lld\n"), p, k->file_pos, s); k->file_pos = s; } - fs_lseek64 (k->fd, k->file_pos, SEEK_SET); + key_seek(k, k->file_pos, SEEK_SET); } } xfree (p); @@ -7439,7 +7845,7 @@ static uae_u8 *restore_exkey(UnitInfo *ui, Unit *u, uae_u8 *src) static uae_u8 *restore_filesys_virtual (UnitInfo *ui, uae_u8 *src, int num) { - Unit *u = startup_create_unit (ui, num); + Unit *u = startup_create_unit (NULL, ui, num); int cnt; u->dosbase = restore_u32 (); @@ -7482,11 +7888,11 @@ static TCHAR *getfullaname(a_inode *a) TCHAR *p; int first = 1; - p = xcalloc (TCHAR, 2000); + p = xcalloc (TCHAR, MAX_DPATH); while (a) { int len = _tcslen (a->aname); memmove (p + len + 1, p, (_tcslen (p) + 1) * sizeof (TCHAR)); - memcpy (p, a->aname, _tcslen (a->aname) * sizeof (TCHAR)); + memcpy (p, a->aname, len * sizeof (TCHAR)); if (!first) p[len] = '/'; first = 0; @@ -7688,8 +8094,6 @@ uae_u8 *save_filesys (int num, int *len) save_path (ui->rootdir, SAVESTATE_PATH_VDIR); else if (type == FILESYS_HARDFILE || type == FILESYS_HARDFILE_RDB) save_path (ui->rootdir, SAVESTATE_PATH_HDF); - else if (type == FILESYS_HARDDRIVE) - save_path (ui->rootdir, SAVESTATE_PATH_HD); else save_path (ui->rootdir, SAVESTATE_PATH); save_string (ui->devname); @@ -7726,8 +8130,6 @@ uae_u8 *restore_filesys (uae_u8 *src) rootdir = restore_path (SAVESTATE_PATH_VDIR); } else if (type == FILESYS_HARDFILE || type == FILESYS_HARDFILE_RDB) { rootdir = restore_path (SAVESTATE_PATH_HDF); - } else if (type == FILESYS_HARDDRIVE) { - rootdir = restore_path (SAVESTATE_PATH_HD); } else { rootdir = restore_path (SAVESTATE_PATH); } diff --git a/src/fsdb_unix.cpp b/src/fsdb_unix.cpp index be84a75a..0dfa0478 100644 --- a/src/fsdb_unix.cpp +++ b/src/fsdb_unix.cpp @@ -85,7 +85,7 @@ int fsdb_fill_file_attrs (a_inode *base, a_inode *aino) | (S_IWUSR & statbuf.st_mode ? 0 : A_FIBF_WRITE) | (S_IRUSR & statbuf.st_mode ? 0 : A_FIBF_READ)); -#if defined(WIN32) || defined(ANDROIDSDL) || defined(AMIBERRY) +#if defined(WIN32) || defined(AMIBERRY) // Always give execute & read permission // Temporary do this for raspberry... aino->amigaos_mode &= ~A_FIBF_EXECUTE; diff --git a/src/genblitter.cpp b/src/genblitter.cpp index 5ba6dc63..bb2e550f 100644 --- a/src/genblitter.cpp +++ b/src/genblitter.cpp @@ -16,255 +16,174 @@ /* Here is the minterm table used in blitter function generation */ static unsigned char blttbl[]= { - 0x00, 0x0a, 0x2a, 0x30, 0x3a, 0x3c, 0x4a, 0x6a, 0x8a, 0x8c, 0x9a, 0xa8, - 0xaa, 0xb1, 0xca, 0xcc, 0xd8, 0xe2, 0xea, 0xf0, 0xfa, 0xfc + 0x00, 0x0a, 0x2a, 0x30, 0x3a, 0x3c, 0x4a, 0x6a, 0x8a, 0x8c, 0x9a, 0xa8, + 0xaa, 0xb1, 0xca, 0xcc, 0xd8, 0xe2, 0xea, 0xf0, 0xfa, 0xfc }; static void generate_include(void) { - int minterm; - printf("STATIC_INLINE uae_u32 blit_func(uae_u32 srca, uae_u32 srcb, uae_u32 srcc, uae_u8 mt)\n{\nswitch(mt){\n"); - for (minterm = 0; minterm < 256; minterm++) { - printf("case 0x%x:\n", minterm); - printf("\treturn %s;\n", blitops[minterm].s); - } - printf("}\n"); - printf("return 0;\n"); /* No, sir, it doesn't! */ - printf("}\n"); + int minterm; + printf("STATIC_INLINE uae_u32 blit_func(const uae_u32 srca, const uae_u32 srcb, const uae_u32 srcc, const uae_u8 mt)\n{\nswitch(mt){\n"); + for (minterm = 0; minterm < 256; minterm++) { + printf("case 0x%x:\n", minterm); + printf("\treturn %s;\n", blitops[minterm].s); + } + printf("}\n"); + printf("return 0;\n"); /* No, sir, it doesn't! */ + printf("}\n"); } static void generate_func(void) { - unsigned int i; - printf("#include \"sysconfig.h\"\n"); - printf("#include \"sysdeps.h\"\n"); - printf("#include \"options.h\"\n"); - printf("#include \"custom.h\"\n"); - printf("#include \"memory.h\"\n"); - printf("#include \"blitter.h\"\n"); - printf("#include \"blitfunc.h\"\n\n"); + unsigned int i; + printf("#include \"sysconfig.h\"\n"); + printf("#include \"sysdeps.h\"\n"); + printf("#include \"options.h\"\n"); + printf("#include \"memory.h\"\n"); + printf("#include \"newcpu.h\"\n"); + printf("#include \"custom.h\"\n"); + printf("#include \"savestate.h\"\n"); + printf("#include \"blitter.h\"\n"); + printf("#include \"blitfunc.h\"\n\n"); - for (i = 0; i < sizeof(blttbl); i++) { - int active = blitops[blttbl[i]].used; - int a_is_on = active & 1, b_is_on = active & 2, c_is_on = active & 4; - printf("void blitdofast_%x (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b)\n",blttbl[i]); - printf("{\n"); - printf("int i,j;\n"); - printf("uae_u32 totald = 0;\n"); -#if 0 - printf("if (currprefs.blits_32bit_enabled && b->hblitsize > 1"); - if (a_is_on) printf(" && !b->blitashift && b->bltafwm==0xffff && b->bltalwm==0xffff"); - if (b_is_on) printf(" && !b->blitbshift"); - printf(") {\n"); - if (a_is_on) printf("uae_u32 srca=((uae_u32)b->bltadat << 16) | b->bltadat;\n"); - if (b_is_on) printf("uae_u32 srcb=((uae_u32)b->bltbdat << 16) | b->bltbdat;\n"); - if (c_is_on) printf("uae_u32 srcc=((uae_u32)b->bltcdat << 16) | b->bltcdat;\n"); - printf("uae_u32 dest;\n"); - printf("int count=b->hblitsize/2, oddword=b->hblitsize&1;\n"); - printf("for (j=0;jvblitsize;j++) {\n"); - printf("\tfor(i=0;ibltamod;\n"); - if (b_is_on) printf("\tif (ptb) ptb += b->bltbmod;\n"); - if (c_is_on) printf("\tif (ptc) ptc += b->bltcmod;\n"); - printf("\tif (ptd) ptd += b->bltdmod;\n"); - printf("}\n"); - if (a_is_on) printf("if (pta) b->bltadat = (*(pta-b->bltamod-2) << 8) | *(pta - b->bltamod - 1);\n"); /* Maybe not necessary, but I don't want problems */ - if (b_is_on) printf("if (ptb) b->bltbdat = (*(ptb-b->bltbmod-2) << 8) | *(ptb - b->bltbmod - 1);\n"); - if (c_is_on) printf("if (ptc) b->bltcdat = (*(ptc-b->bltcmod-2) << 8) | *(ptc - b->bltcmod - 1);\n"); - printf("if (ptd) b->bltddat = (*(ptd-b->bltdmod-2) << 8) | *(ptd - b->bltdmod - 1);\n"); + for (i = 0; i < sizeof(blttbl); i++) { + int active = blitops[blttbl[i]].used; + int a_is_on = active & 1, b_is_on = active & 2, c_is_on = active & 4; + printf("void blitdofast_%x (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b)\n",blttbl[i]); + printf("{\n"); + printf("int i,j;\n"); + printf("uae_u32 totald = 0;\n"); + if (b_is_on) printf("uae_u32 srcb = b->bltbhold;\n"); + if (c_is_on) printf("uae_u32 srcc = b->bltcdat;\n"); + printf("uae_u32 dstd=0;\n"); + printf("uaecptr dstp = 0;\n"); + printf("for (j = 0; j < b->vblitsize; j++) {\n"); + printf("\tfor (i = 0; i < b->hblitsize; i++) {\n\t\tuae_u32 bltadat, srca;\n\n"); + if (c_is_on) printf("\t\tif (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc += 2; }\n"); + if (b_is_on) printf("\t\tif (ptb) {\n\t\t\tuae_bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb += 2;\n"); + if (b_is_on) printf("\t\t\tsrcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> b->blitbshift;\n"); + if (b_is_on) printf("\t\t\tb->bltbold = bltbdat;\n\t\t}\n"); + if (a_is_on) printf("\t\tif (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta += 2; } else { bltadat = b->bltadat; }\n"); + if (a_is_on) printf("\t\tbltadat &= blit_masktable[i];\n"); + if (a_is_on) printf("\t\tsrca = (((uae_u32)b->bltaold << 16) | bltadat) >> b->blitashift;\n"); + if (a_is_on) printf("\t\tb->bltaold = bltadat;\n"); + printf("\t\tif (dstp)\n\t\t\tchipmem_wput_indirect (dstp, dstd);\n"); + printf("\t\tdstd = (%s);\n", blitops[blttbl[i]].s); + printf("\t\ttotald |= dstd;\n"); + printf("\t\tif (ptd) { dstp = ptd; ptd += 2; }\n"); + printf("\t}\n"); + if (a_is_on) printf("\tif (pta) pta += b->bltamod;\n"); + if (b_is_on) printf("\tif (ptb) ptb += b->bltbmod;\n"); + if (c_is_on) printf("\tif (ptc) ptc += b->bltcmod;\n"); + printf("\tif (ptd) ptd += b->bltdmod;\n"); + printf("}\n"); + if (b_is_on) printf("b->bltbhold = srcb;\n"); + if (c_is_on) printf("b->bltcdat = srcc;\n"); + printf("\t\tif (dstp)\n\t\t\tchipmem_wput_indirect (dstp, dstd);\n"); + printf("if ((totald<<16) != 0) b->blitzero = 0;\n"); + printf("}\n"); - printf("} else {\n"); -#endif - if (a_is_on) printf("uae_u32 preva = 0;\n"); - if (b_is_on) printf("uae_u32 prevb = 0, srcb = b->bltbhold;\n"); - if (c_is_on) printf("uae_u32 srcc = b->bltcdat;\n"); - printf("uae_u32 dstd=0;\n"); - printf("uaecptr dstp = 0;\n"); - printf("for (j = 0; j < b->vblitsize; j++) {\n"); - printf("\tfor (i = 0; i < b->hblitsize; i++) {\n\t\tuae_u32 bltadat, srca;\n\n"); - if (c_is_on) printf("\t\tif (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; }\n"); - if (b_is_on) printf("\t\tif (ptb) {\n\t\t\tuae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb += 2;\n"); - if (b_is_on) printf("\t\t\tsrcb = (((uae_u32)prevb << 16) | bltbdat) >> b->blitbshift;\n"); - if (b_is_on) printf("\t\t\tprevb = bltbdat;\n\t\t}\n"); - if (a_is_on) printf("\t\tif (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = blt_info.bltadat; }\n"); - if (a_is_on) printf("\t\tbltadat &= blit_masktable[i];\n"); - if (a_is_on) printf("\t\tsrca = (((uae_u32)preva << 16) | bltadat) >> b->blitashift;\n"); - if (a_is_on) printf("\t\tpreva = bltadat;\n"); - printf("\t\tif (dstp) chipmem_wput_indirect (dstp, dstd);\n"); - printf("\t\tdstd = (%s) & 0xFFFF;\n", blitops[blttbl[i]].s); - printf("\t\ttotald |= dstd;\n"); - printf("\t\tif (ptd) { dstp = ptd; ptd += 2; }\n"); - printf("\t}\n"); - if (a_is_on) printf("\tif (pta) pta += b->bltamod;\n"); - if (b_is_on) printf("\tif (ptb) ptb += b->bltbmod;\n"); - if (c_is_on) printf("\tif (ptc) ptc += b->bltcmod;\n"); - printf("\tif (ptd) ptd += b->bltdmod;\n"); - printf("}\n"); - if (b_is_on) printf("b->bltbhold = srcb;\n"); - if (c_is_on) printf("b->bltcdat = srcc;\n"); - printf("\t\tif (dstp) chipmem_wput_indirect (dstp, dstd);\n"); -#if 0 - printf("}\n"); -#endif - printf("if (totald != 0) b->blitzero = 0;\n"); - printf("}\n"); + printf("void blitdofast_desc_%x (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b)\n",blttbl[i]); + printf("{\n"); + printf("uae_u32 totald = 0;\n"); + printf("int i,j;\n"); - printf("void blitdofast_desc_%x (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b)\n",blttbl[i]); - printf("{\n"); - printf("uae_u32 totald = 0;\n"); - printf("int i,j;\n"); -#if 0 - printf("if (currprefs.blits_32bit_enabled && b->hblitsize > 1"); - if (a_is_on) printf(" && !b->blitashift && b->bltafwm==0xffff && b->bltalwm==0xffff"); - if (b_is_on) printf(" && !b->blitbshift"); - printf(") {\n"); - if (a_is_on) printf("uae_u32 srca = ((uae_u32)b->bltadat << 16) | b->bltadat;\n"); - if (b_is_on) printf("uae_u32 srcb = ((uae_u32)b->bltbdat << 16) | b->bltbdat;\n"); - if (c_is_on) printf("uae_u32 srcc = ((uae_u32)b->bltcdat << 16) | b->bltcdat;\n"); - printf("uae_u32 dest;\n"); - printf("int count=b->hblitsize/2, oddword=b->hblitsize&1;\n"); - printf("for (j=0;jvblitsize;j++) {\n"); - printf("\tfor(i=0;ibltamod;\n"); - if (b_is_on) printf("\tif (ptb) ptb -= b->bltbmod;\n"); - if (c_is_on) printf("\tif (ptc) ptc -= b->bltcmod;\n"); - printf("\tif (ptd) ptd-=b->bltdmod;\n"); - printf("}\n"); - if (a_is_on) printf("if (pta) b->bltadat = (*(pta + b->bltamod + 2) << 8) | *(pta + b->bltamod + 1);\n"); /* Maybe not necessary, but I don't want problems */ - if (b_is_on) printf("if (ptb) b->bltbdat = (*(ptb + b->bltbmod + 2) << 8) | *(ptb + b->bltbmod + 1);\n"); - if (c_is_on) printf("if (ptc) b->bltcdat = (*(ptc + b->bltcmod + 2) << 8) | *(ptc + b->bltcmod + 1);\n"); - printf("if (ptd) b->bltddat = (*(ptd + b->bltdmod + 2) << 8) | *(ptd + b->bltdmod + 1);\n"); - - printf("} else {\n"); -#endif - if (a_is_on) printf("uae_u32 preva = 0;\n"); - if (b_is_on) printf("uae_u32 prevb = 0, srcb = b->bltbhold;\n"); - if (c_is_on) printf("uae_u32 srcc = b->bltcdat;\n"); - printf("uae_u32 dstd = 0;\n"); - printf("uaecptr dstp = 0;\n"); - printf("for (j = 0; j < b->vblitsize; j++) {\n"); - printf("\tfor (i = 0; i < b->hblitsize; i++) {\n\t\tuae_u32 bltadat, srca;\n"); - if (c_is_on) printf("\t\tif (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; }\n"); - if (b_is_on) printf("\t\tif (ptb) {\n\t\t\tuae_u32 bltbdat = blt_info.bltbdat = chipmem_wget_indirect (ptb); ptb -= 2;\n"); - if (b_is_on) printf("\t\t\tsrcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift;\n"); - if (b_is_on) printf("\t\t\tprevb = bltbdat;\n\t\t}\n"); - if (a_is_on) printf("\t\tif (pta) { bltadat = blt_info.bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = blt_info.bltadat; }\n"); - if (a_is_on) printf("\t\tbltadat &= blit_masktable[i];\n"); - if (a_is_on) printf("\t\tsrca = (((uae_u32)bltadat << 16) | preva) >> b->blitdownashift;\n"); - if (a_is_on) printf("\t\tpreva = bltadat;\n"); - printf("\t\tif (dstp) chipmem_wput_indirect (dstp, dstd);\n"); - printf("\t\tdstd = (%s) & 0xFFFF;\n", blitops[blttbl[i]].s); - printf("\t\ttotald |= dstd;\n"); - printf("\t\tif (ptd) { dstp = ptd; ptd -= 2; }\n"); - printf("\t}\n"); - if (a_is_on) printf("\tif (pta) pta -= b->bltamod;\n"); - if (b_is_on) printf("\tif (ptb) ptb -= b->bltbmod;\n"); - if (c_is_on) printf("\tif (ptc) ptc -= b->bltcmod;\n"); - printf("\tif (ptd) ptd -= b->bltdmod;\n"); - printf("}\n"); - if (b_is_on) printf("b->bltbhold = srcb;\n"); - if (c_is_on) printf("b->bltcdat = srcc;\n"); - printf("\t\tif (dstp) chipmem_wput_indirect (dstp, dstd);\n"); -#if 0 - printf("}\n"); -#endif - printf("if (totald != 0) b->blitzero = 0;\n"); - printf("}\n"); - } + if (b_is_on) printf("uae_u32 srcb = b->bltbhold;\n"); + if (c_is_on) printf("uae_u32 srcc = b->bltcdat;\n"); + printf("uae_u32 dstd = 0;\n"); + printf("uaecptr dstp = 0;\n"); + printf("for (j = 0; j < b->vblitsize; j++) {\n"); + printf("\tfor (i = 0; i < b->hblitsize; i++) {\n\t\tuae_u32 bltadat, srca;\n"); + if (c_is_on) printf("\t\tif (ptc) { srcc = do_get_mem_word ((uae_u16 *)ptc); ptc -= 2; }\n"); + if (b_is_on) printf("\t\tif (ptb) {\n\t\t\tuae_u32 bltbdat = b->bltbdat = do_get_mem_word ((uae_u16 *)ptb); ptb -= 2;\n"); + if (b_is_on) printf("\t\t\tsrcb = ((bltbdat << 16) | b->bltbold) >> b->blitdownbshift;\n"); + if (b_is_on) printf("\t\t\tb->bltbold = bltbdat;\n\t\t}\n"); + if (a_is_on) printf("\t\tif (pta) { bltadat = b->bltadat = do_get_mem_word ((uae_u16 *)pta); pta -= 2; } else { bltadat = b->bltadat; }\n"); + if (a_is_on) printf("\t\tbltadat &= blit_masktable[i];\n"); + if (a_is_on) printf("\t\tsrca = (((uae_u32)bltadat << 16) | b->bltaold) >> b->blitdownashift;\n"); + if (a_is_on) printf("\t\tb->bltaold = bltadat;\n"); + printf("\t\tif (dstp)\n\t\t\tchipmem_wput_indirect (dstp, dstd);\n"); + printf("\t\tdstd = (%s);\n", blitops[blttbl[i]].s); + printf("\t\ttotald |= dstd;\n"); + printf("\t\tif (ptd) { dstp = ptd; ptd -= 2; }\n"); + printf("\t}\n"); + if (a_is_on) printf("\tif (pta) pta -= b->bltamod;\n"); + if (b_is_on) printf("\tif (ptb) ptb -= b->bltbmod;\n"); + if (c_is_on) printf("\tif (ptc) ptc -= b->bltcmod;\n"); + printf("\tif (ptd) ptd -= b->bltdmod;\n"); + printf("}\n"); + if (b_is_on) printf("b->bltbhold = srcb;\n"); + if (c_is_on) printf("b->bltcdat = srcc;\n"); + printf("\t\tif (dstp)\n\t\t\tchipmem_wput_indirect (dstp, dstd);\n"); + printf("if ((totald<<16) != 0) b->blitzero = 0;\n"); + printf("}\n"); + } } static void generate_table(void) { - unsigned int index = 0; - unsigned int i; - printf("#include \"sysconfig.h\"\n"); - printf("#include \"sysdeps.h\"\n"); - printf("#include \"options.h\"\n"); - printf("#include \"custom.h\"\n"); - printf("#include \"memory.h\"\n"); - printf("#include \"blitter.h\"\n"); - printf("#include \"blitfunc.h\"\n\n"); - printf("blitter_func * const blitfunc_dofast[256] = {\n"); - for (i = 0; i < 256; i++) { - if (index < sizeof(blttbl) && i == blttbl[index]) { + unsigned int index = 0; + unsigned int i; + printf("#include \"sysconfig.h\"\n"); + printf("#include \"sysdeps.h\"\n"); + printf("#include \"options.h\"\n"); + printf("#include \"memory.h\"\n"); + printf("#include \"newcpu.h\"\n"); + printf("#include \"custom.h\"\n"); + printf("#include \"savestate.h\"\n"); + printf("#include \"blitter.h\"\n"); + printf("#include \"blitfunc.h\"\n\n"); + printf("blitter_func * const blitfunc_dofast[256] = {\n"); + for (i = 0; i < 256; i++) { + if (index < sizeof(blttbl) && i == blttbl[index]) { printf("blitdofast_%x",i); index++; - } - else printf("0"); - if (i < 255) printf(", "); - if ((i & 7) == 7) printf("\n"); - } - printf("};\n\n"); + } + else printf("0"); + if (i < 255) printf(", "); + if ((i & 7) == 7) printf("\n"); + } + printf("};\n\n"); - index = 0; - printf("blitter_func * const blitfunc_dofast_desc[256] = {\n"); - for (i = 0; i < 256; i++) { - if (index < sizeof(blttbl) && i == blttbl[index]) { + index = 0; + printf("blitter_func * const blitfunc_dofast_desc[256] = {\n"); + for (i = 0; i < 256; i++) { + if (index < sizeof(blttbl) && i == blttbl[index]) { printf("blitdofast_desc_%x",i); index++; - } - else printf("0"); - if (i < 255) printf(", "); - if ((i & 7) == 7) printf("\n"); - } - printf("};\n"); + } + else printf("0"); + if (i < 255) printf(", "); + if ((i & 7) == 7) printf("\n"); + } + printf("};\n"); } static void generate_header(void) { - unsigned int i; - for (i = 0; i < sizeof(blttbl); i++) { - printf("extern blitter_func blitdofast_%x;\n",blttbl[i]); - printf("extern blitter_func blitdofast_desc_%x;\n",blttbl[i]); - } + unsigned int i; + for (i = 0; i < sizeof(blttbl); i++) { + printf("extern blitter_func blitdofast_%x;\n",blttbl[i]); + printf("extern blitter_func blitdofast_desc_%x;\n",blttbl[i]); + } } int main(int argc, char **argv) { - char mode = 'i'; + char mode = 'i'; - if (argc == 2) mode = *argv[1]; - switch (mode) { - case 'i': generate_include(); - break; - case 'f': generate_func(); - break; - case 't': generate_table(); - break; - case 'h': generate_header(); - break; - default: abort(); - } - return 0; + if (argc == 2) mode = *argv[1]; + switch (mode) { + case 'i': generate_include(); + break; + case 'f': generate_func(); + break; + case 't': generate_table(); + break; + case 'h': generate_header(); + break; + default: abort(); + } + return 0; } diff --git a/src/gfxboard.cpp b/src/gfxboard.cpp index 0ef8fda8..1da4877b 100644 --- a/src/gfxboard.cpp +++ b/src/gfxboard.cpp @@ -11,24 +11,15 @@ #include "sysdeps.h" #include "options.h" -#include "uae.h" -#include "include/memory.h" -#include "debug.h" -#include "custom.h" -#include "newcpu.h" -#include "picasso96.h" -#include "statusline.h" -#include "rommgr.h" -#include "zfile.h" #include "gfxboard.h" -bool gfxboard_is_z3 (int type) +const TCHAR *gfxboard_get_name(int type) { if (type == GFXBOARD_UAE_Z2) - return false; + return _T("UAE Zorro II"); if (type == GFXBOARD_UAE_Z3) - return true; - return false; + return _T("UAE Zorro III (*)"); + return NULL; } const TCHAR *gfxboard_get_configname(int type) @@ -37,5 +28,15 @@ const TCHAR *gfxboard_get_configname(int type) return _T("ZorroII"); if (type == GFXBOARD_UAE_Z3) return _T("ZorroIII"); - //return boards[type - GFXBOARD_HARDWARE].configname; -} \ No newline at end of file + return NULL; +} + +int gfxboard_get_configtype(struct rtgboardconfig *rbc) +{ + int type = rbc->rtgmem_type; + if (type == GFXBOARD_UAE_Z2) + return 2; + if (type == GFXBOARD_UAE_Z3) + return 3; + return 0; +} diff --git a/src/gfxutil.cpp b/src/gfxutil.cpp index d743d022..cc1b171d 100644 --- a/src/gfxutil.cpp +++ b/src/gfxutil.cpp @@ -13,68 +13,24 @@ #include "rtgmodes.h" #include "xwin.h" -double getvsyncrate(double hz, int *mult) -{ - struct apmode *ap = picasso_on ? &currprefs.gfx_apmode[1] : &currprefs.gfx_apmode[0]; - - if (hz < 0) - return 0; - if (hz > 85) { - *mult = -1; - return hz / 2; - } - if (hz < 35 && hz > 0) { - if (ap->gfx_interlaced) - *mult = 0; - else - *mult = 1; - return hz * 2; - } - *mult = 0; - return hz; -} - -#define RED 0 +#define RED 0 #define GRN 1 #define BLU 2 unsigned int doMask (int p, int bits, int shift) { - /* p is a value from 0 to 15 (Amiga color value) - * scale to 0..255, shift to align msb with mask, and apply mask */ - uae_u32 val; + /* scale to 0..255, shift to align msb with mask, and apply mask */ + uae_u32 val; - //uae_u32 val = p * 0x11111111UL; val = p << 24; - if (!bits) - return 0; - val >>= (32 - bits); - val <<= shift; + if (!bits) + return 0; + val >>= (32 - bits); + val <<= shift; - return val; + return val; } -int bits_in_mask(unsigned long mask) -{ - int n = 0; - while (mask) { - n += mask & 1; - mask >>= 1; - } - return n; -} - -int mask_shift(unsigned long mask) -{ - int n = 0; - if (!mask) - return 0; - while (!(mask & 1)) { - n++; - mask >>= 1; - } - return n; -} unsigned int doMask256 (int p, int bits, int shift) { @@ -92,135 +48,15 @@ unsigned int doMask256 (int p, int bits, int shift) static unsigned int doColor(int i, int bits, int shift) { - int shift2; + int shift2; - if (bits >= 8) - shift2 = 0; - else - shift2 = 8 - bits; - return (i >> shift2) << shift; + if(bits >= 8) + shift2 = 0; + else + shift2 = 8 - bits; + return (i >> shift2) << shift; } -static unsigned int doAlpha(int alpha, int bits, int shift) -{ - return (alpha & ((1 << bits) - 1)) << shift; -} - -static float video_gamma(float value, float gamma, float bri, float con) -{ - double factor; - float ret; - - value += bri; - value *= con; - - if (value <= 0.0f) - return 0.0f; - - factor = pow(255.0f, 1.0f - gamma); - ret = float(factor * pow(value, gamma)); - - if (ret < 0.0f) - ret = 0.0f; - - return ret; -} - -static uae_u32 Gamma[256 * 3][3]; -static int lf, hf; - -//static void video_calc_gammatable(void) -//{ -// float bri, con, gam, gams[3]; -// -// bri = ((float)(currprefs.gfx_luminance)) * (128.0f / 1000.0f); -// con = ((float)(currprefs.gfx_contrast + 1000)) / 1000.0f; -// gam = ((float)(1000 - currprefs.gfx_gamma)) / 1000.0f - 1.0; -// gams[0] = gam + ((float)(1000 - currprefs.gfx_gamma_ch[0])) / 1000.0f; -// gams[1] = gam + ((float)(1000 - currprefs.gfx_gamma_ch[1])) / 1000.0f; -// gams[2] = gam + ((float)(1000 - currprefs.gfx_gamma_ch[2])) / 1000.0f; -// -// lf = 64 * currprefs.gf[picasso_on].gfx_filter_blur / 1000; -// hf = 256 - lf * 2; -// -// for (int i = 0; i < (256 * 3); i++) { -// for (int j = 0; j < 3; j++) { -// float val = i - 256; -// float v; -// -// if (currprefs.gfx_threebitcolors == 2) { -// val *= 2; -// } -// else if (currprefs.gfx_threebitcolors == 3) { -// val = (val * 252.0) / 119.0; -// } -// else if (currprefs.gfx_threebitcolors == 1) { -// val = (val * 252.0) / 238.0; -// } -// -// if (currprefs.gfx_luminance == 0 && currprefs.gfx_contrast == 0 && currprefs.gfx_gamma == 0 && -// currprefs.gfx_gamma_ch[0] == 0 && currprefs.gfx_gamma_ch[1] == 0 && currprefs.gfx_gamma_ch[2] == 0) { -// v = val; -// } -// else { -// v = video_gamma(val, gams[j], bri, con); -// } -// -// if (v < 0.0) -// v = 0.0; -// if (v > 255.0) -// v = 255.0; -// -// gamma[i][j] = (uae_u32)(v + 0.5); -// } -// } -//} - -static uae_u32 limit256(double v) -{ - v = v * double(currprefs.gf[picasso_on].gfx_filter_contrast + 1000) / 1000.0 + currprefs.gf[picasso_on].gfx_filter_luminance / 10.0; - if (v < 0) - v = 0; - if (v > 255) - v = 255; - return uae_u32(v) & 0xff; -} -static uae_u32 limit256rb(double v) -{ - v *= double(currprefs.gf[picasso_on].gfx_filter_saturation + 1000) / 1000.0; - if (v < -128) - v = -128; - if (v > 127) - v = 127; - return uae_u32(v) & 0xff; -} -static double get_y(int r, int g, int b) -{ - return 0.2989f * r + 0.5866f * g + 0.1145f * b; -} -static uae_u32 get_yh(int r, int g, int b) -{ - return limit256(get_y(r, g, b) * hf / 256); -} -static uae_u32 get_yl(int r, int g, int b) -{ - return limit256(get_y(r, g, b) * lf / 256); -} -static uae_u32 get_cb(int r, int g, int b) -{ - return limit256rb(-0.168736f * r - 0.331264f * g + 0.5f * b); -} -static uae_u32 get_cr(int r, int g, int b) -{ - return limit256rb(0.5f * r - 0.418688f * g - 0.081312f * b); -} - -extern uae_s32 tyhrgb[65536]; -extern uae_s32 tylrgb[65536]; -extern uae_s32 tcbrgb[65536]; -extern uae_s32 tcrrgb[65536]; -extern uae_u32 redc[3 * 256], grec[3 * 256], bluc[3 * 256]; - static uae_u32 lowbits (int v, int shift, int lsize) { v >>= shift; @@ -228,128 +64,25 @@ static uae_u32 lowbits (int v, int shift, int lsize) return v; } -void alloc_colors_picasso(int rw, int gw, int bw, int rs, int gs, int bs, int rgbfmt) -{ -#ifdef PICASSO96 - int byte_swap = 0; - int i; - int red_bits = 0, green_bits, blue_bits; - int red_shift, green_shift, blue_shift; - int bpp = rw + gw + bw; - - switch (rgbfmt) - { - case RGBFB_R5G6B5PC: - red_bits = 5; - green_bits = 6; - blue_bits = 5; - red_shift = 11; - green_shift = 5; - blue_shift = 0; - break; - case RGBFB_R5G5B5PC: - red_bits = green_bits = blue_bits = 5; - red_shift = 10; - green_shift = 5; - blue_shift = 0; - break; - case RGBFB_R5G6B5: - red_bits = 5; - green_bits = 6; - blue_bits = 5; - red_shift = 11; - green_shift = 5; - blue_shift = 0; - byte_swap = 1; - break; - case RGBFB_R5G5B5: - red_bits = green_bits = blue_bits = 5; - red_shift = 10; - green_shift = 5; - blue_shift = 0; - byte_swap = 1; - break; - case RGBFB_B5G6R5PC: - red_bits = 5; - green_bits = 6; - blue_bits = 5; - red_shift = 0; - green_shift = 5; - blue_shift = 11; - break; - case RGBFB_B5G5R5PC: - red_bits = green_bits = blue_bits = 5; - red_shift = 0; - green_shift = 5; - blue_shift = 10; - break; - default: - red_bits = rw; - green_bits = gw; - blue_bits = bw; - red_shift = rs; - green_shift = gs; - blue_shift = bs; - break; - } - -#ifdef WORDS_BIGENDIAN - byte_swap = !byte_swap; -#endif - - memset(p96_rgbx16, 0, sizeof p96_rgbx16); - - if (red_bits) { - int lrbits = 8 - red_bits; - int lgbits = 8 - green_bits; - int lbbits = 8 - blue_bits; - int lrmask = (1 << red_bits) - 1; - int lgmask = (1 << green_bits) - 1; - int lbmask = (1 << blue_bits) - 1; - for (i = 65535; i >= 0; i--) { - uae_u32 r, g, b, c; - uae_u32 j = byte_swap ? bswap_16(i) : i; - r = (((j >> red_shift) & lrmask) << lrbits) | lowbits(j, red_shift, lrbits); - g = (((j >> green_shift) & lgmask) << lgbits) | lowbits(j, green_shift, lgbits); - b = (((j >> blue_shift) & lbmask) << lbbits) | lowbits(j, blue_shift, lbbits); - c = doMask(r, rw, rs) | doMask(g, gw, gs) | doMask(b, bw, bs); - if (bpp <= 16) - c *= 0x00010001; - p96_rgbx16[i] = c; - } - } -#endif -} - -void alloc_colors_rgb(int rw, int gw, int bw, int rs, int gs, int bs, int aw, int as, int alpha, int byte_swap, +#ifndef ARMV6_ASSEMBLY +void alloc_colors_rgb (int rw, int gw, int bw, int rs, int gs, int bs, int byte_swap, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc) { - int bpp = rw + gw + bw + aw; + int bpp = rw + gw + bw; int i; - for (i = 0; i < 256; i++) { - int j; - - if (currprefs.gfx_blackerthanblack) { - j = i * 15 / 16 + 15; - } - else { - j = i; - } - j += 256; - - rc[i] = doColor(Gamma[j][0], rw, rs) | doAlpha(alpha, aw, as); - gc[i] = doColor(Gamma[j][1], gw, gs) | doAlpha(alpha, aw, as); - bc[i] = doColor(Gamma[j][2], bw, bs) | doAlpha(alpha, aw, as); + for(i = 0; i < 256; i++) { + rc[i] = doColor (i, rw, rs); + gc[i] = doColor (i, gw, gs); + bc[i] = doColor (i, bw, bs); if (byte_swap) { if (bpp <= 16) { - rc[i] = bswap_16(rc[i]); - gc[i] = bswap_16(gc[i]); - bc[i] = bswap_16(bc[i]); - } - else { - rc[i] = bswap_32(rc[i]); - gc[i] = bswap_32(gc[i]); - bc[i] = bswap_32(bc[i]); + rc[i] = bswap_16 (rc[i]); + gc[i] = bswap_16 (gc[i]); + bc[i] = bswap_16 (bc[i]); + } else { + rc[i] = bswap_32 (rc[i]); + gc[i] = bswap_32 (gc[i]); + bc[i] = bswap_32 (bc[i]); } } if (bpp <= 16) { @@ -361,119 +94,21 @@ void alloc_colors_rgb(int rw, int gw, int bw, int rs, int gs, int bs, int aw, in } } } +#endif -void alloc_colors64k (int rw, int gw, int bw, int rs, int gs, int bs, int aw, int as, int alpha, int byte_swap) +void alloc_colors64k (int rw, int gw, int bw, int rs, int gs, int bs, int byte_swap) { - int bpp = rw + gw + bw + aw; - int i, j; - - //video_calc_gammatable(); - j = 256; + int i; for (i = 0; i < 4096; i++) { int r = ((i >> 8) << 4) | (i >> 8); int g = (((i >> 4) & 0xf) << 4) | ((i >> 4) & 0x0f); int b = ((i & 0xf) << 4) | (i & 0x0f); - r = Gamma[r + j][0]; - g = Gamma[g + j][1]; - b = Gamma[b + j][2]; - xcolors[i] = doMask(r, rw, rs) | doMask(g, gw, gs) | doMask(b, bw, bs) | doAlpha(alpha, aw, as); - if (byte_swap) { - if (bpp <= 16) { - xcolors[i] = bswap_16(xcolors[i]); - } - else { - xcolors[i] = bswap_32(xcolors[i]); - } - } - if (bpp <= 16) { - /* Fill upper 16 bits of each colour value - * with a copy of the colour. */ - xcolors[i] |= xcolors[i] * 0x00010001; - } - } -#if defined(AGA) || defined(GFXFILTER) - alloc_colors_rgb(rw, gw, bw, rs, gs, bs, aw, as, alpha, byte_swap, xredcolors, xgreencolors, xbluecolors); - /* copy original color table */ - //for (i = 0; i < 256; i++) { - // redc[0 * 256 + i] = xredcolors[0]; - // grec[0 * 256 + i] = xgreencolors[0]; - // bluc[0 * 256 + i] = xbluecolors[0]; - // redc[1 * 256 + i] = xredcolors[i]; - // grec[1 * 256 + i] = xgreencolors[i]; - // bluc[1 * 256 + i] = xbluecolors[i]; - // redc[2 * 256 + i] = xredcolors[255]; - // grec[2 * 256 + i] = xgreencolors[255]; - // bluc[2 * 256 + i] = xbluecolors[255]; - //} -#ifdef GFXFILTER - if (usedfilter && usedfilter->yuv) { - /* create internal 5:6:5 color tables */ - for (i = 0; i < 256; i++) { - j = i + 256; - xredcolors[i] = doColor(gamma[j][0], 5, 11); - xgreencolors[i] = doColor(gamma[j][1], 6, 5); - xbluecolors[i] = doColor(gamma[j][2], 5, 0); - if (bpp <= 16) { - /* Fill upper 16 bits of each colour value with - * a copy of the colour. */ - xredcolors[i] = xredcolors[i] * 0x00010001; - xgreencolors[i] = xgreencolors[i] * 0x00010001; - xbluecolors[i] = xbluecolors[i] * 0x00010001; - } - } - for (i = 0; i < 4096; i++) { - int r = ((i >> 8) << 4) | (i >> 8); - int g = (((i >> 4) & 0xf) << 4) | ((i >> 4) & 0x0f); - int b = ((i & 0xf) << 4) | (i & 0x0f); - r = gamma[r + 256][0]; - g = gamma[g + 256][1]; - b = gamma[b + 256][2]; - xcolors[i] = doMask(r, 5, 11) | doMask(g, 6, 5) | doMask(b, 5, 0); - if (byte_swap) { - if (bpp <= 16) - xcolors[i] = bswap_16(xcolors[i]); - else - xcolors[i] = bswap_32(xcolors[i]); - } - if (bpp <= 16) { - /* Fill upper 16 bits of each colour value - * with a copy of the colour. */ - xcolors[i] |= xcolors[i] * 0x00010001; - } - } - - /* create RGB 5:6:5 -> YUV tables */ - for (i = 0; i < 65536; i++) { - uae_u32 r, g, b; - r = (((i >> 11) & 31) << 3) | lowbits(i, 11, 3); - r = gamma[r + 256][0]; - g = (((i >> 5) & 63) << 2) | lowbits(i, 5, 2); - g = gamma[g + 256][1]; - b = (((i >> 0) & 31) << 3) | lowbits(i, 0, 3); - b = gamma[b + 256][2]; - tyhrgb[i] = get_yh(r, g, b) * 256 * 256; - tylrgb[i] = get_yl(r, g, b) * 256 * 256; - tcbrgb[i] = ((uae_s8)get_cb(r, g, b)) * 256; - tcrrgb[i] = ((uae_s8)get_cr(r, g, b)) * 256; - } + xcolors[i] = doMask(r, rw, rs) | doMask(g, gw, gs) | doMask(b, bw, bs); + /* Fill upper 16 bits of each colour value + * with a copy of the colour. */ + xcolors[i] = xcolors[i] * 0x00010001; } +#ifndef ARMV6_ASSEMBLY + alloc_colors_rgb (rw, gw, bw, rs, gs, bs, byte_swap, xredcolors, xgreencolors, xbluecolors); #endif - -#endif - xredcolor_b = rw; - xgreencolor_b = gw; - xbluecolor_b = bw; - xredcolor_s = rs; - xgreencolor_s = gs; - xbluecolor_s = bs; - xredcolor_m = ((1 << rw) - 1) << xredcolor_s; - xgreencolor_m = ((1 << gw) - 1) << xgreencolor_s; - xbluecolor_m = ((1 << bw) - 1) << xbluecolor_s; - - /* create AGA color tables */ - for(i=0; i<256; i++) { - xredcolors[i] = doColor(i, rw, rs); - xgreencolors[i] = doColor(i, gw, gs); - xbluecolors[i] = doColor(i, bw, bs); - } } diff --git a/src/guisan/Makefile b/src/guisan/Makefile index 847d4424..ca953757 100644 --- a/src/guisan/Makefile +++ b/src/guisan/Makefile @@ -6,8 +6,8 @@ DIRS =$(shell find ./src -maxdepth 3 -type d) SOURCE = $(foreach dir,$(DIRS),$(wildcard $(dir)/*.cpp)) OBJS = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCE))) -INCLUDE =-I./include `sdl2-config --cflags --libs` -CFLAGS =-g -w -O3 $(INCLUDE) +INCLUDE =-I./include `sdl2-config --cflags` +CFLAGS = -g -w -O3 $(INCLUDE) CXXFLAGS= $(CFLAGS) diff --git a/src/hardfile.cpp b/src/hardfile.cpp index 414354b4..abaf6268 100644 --- a/src/hardfile.cpp +++ b/src/hardfile.cpp @@ -1,11 +1,11 @@ -/* -* UAE - The Un*x Amiga Emulator -* -* Hardfile emulation -* -* Copyright 1995 Bernd Schmidt -* 2002 Toni Wilen (scsi emulation, 64-bit support) -*/ + /* + * UAE - The Un*x Amiga Emulator + * + * Hardfile emulation + * + * Copyright 1995 Bernd Schmidt + * 2002 Toni Wilen (scsi emulation, 64-bit support) + */ #include "sysconfig.h" #include "sysdeps.h" @@ -24,16 +24,12 @@ #include "gui.h" #include "uae.h" #include "scsi.h" -//#include "gayle.h" +#include "gayle.h" #include "execio.h" #include "zfile.h" +#include "ide.h" -#ifdef WITH_CHD -#include "archivers/chd/chdtypes.h" -#include "archivers/chd/chd.h" -#endif - -//#undef DEBUGME +#undef DEBUGME #define hf_log(fmt, ...) #define hf_log2(fmt, ...) #define scsi_log(fmt, ...) @@ -57,51 +53,53 @@ #define ASYNC_REQUEST_CHANGEINT 10 struct hardfileprivdata { - volatile uaecptr d_request[MAX_ASYNC_REQUESTS]; - volatile int d_request_type[MAX_ASYNC_REQUESTS]; - volatile uae_u32 d_request_data[MAX_ASYNC_REQUESTS]; - smp_comm_pipe requests; - int thread_running; - uae_sem_t sync_sem; - uaecptr base; - int changenum; - uaecptr changeint; + uaecptr d_request[MAX_ASYNC_REQUESTS]; + uae_u8 *d_request_iobuf[MAX_ASYNC_REQUESTS]; + int d_request_type[MAX_ASYNC_REQUESTS]; + uae_u32 d_request_data[MAX_ASYNC_REQUESTS]; + smp_comm_pipe requests; + int thread_running; + uae_thread_id thread_id; + uae_sem_t sync_sem; + uaecptr base; + int changenum; + uaecptr changeint; + struct scsi_data *sd; }; #define HFD_VHD_DYNAMIC 3 #define HFD_VHD_FIXED 2 -#define HFD_CHD 1 -STATIC_INLINE uae_u32 gl(uae_u8 *p) +STATIC_INLINE uae_u32 gl (uae_u8 *p) { return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3] << 0); } -static uae_sem_t change_sem; +static uae_sem_t change_sem = 0; static struct hardfileprivdata hardfpd[MAX_FILESYSTEM_UNITS]; static uae_u32 nscmd_cmd; -static void wl(uae_u8 *p, int v) +static void wl (uae_u8 *p, int v) { p[0] = v >> 24; p[1] = v >> 16; p[2] = v >> 8; p[3] = v; } -static void ww(uae_u8 *p, int v) +static void ww (uae_u8 *p, int v) { p[0] = v >> 8; p[1] = v; } -static int rl(uae_u8 *p) +static int rl (uae_u8 *p) { return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3]); } -static void getchs2(struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, int *tracksec) +static void getchs2 (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, int *tracksec) { unsigned int total = (unsigned int)(hfd->virtsize / 1024); int heads; @@ -140,15 +138,15 @@ static void getchs2(struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, *head = heads; } -static void getchsx(struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, int *tracksec) +static void getchsx (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, int *tracksec) { - getchs2(hfd, cyl, cylsec, head, tracksec); - hf_log(_T("CHS: %08X-%08X %d %d %d %d %d\n"), - (uae_u32)(hfd->virtsize >> 32), (uae_u32)hfd->virtsize, + getchs2 (hfd, cyl, cylsec, head, tracksec); + hf_log (_T("CHS: %08X-%08X %d %d %d %d %d\n"), + (uae_u32)(hfd->virtsize >> 32),(uae_u32)hfd->virtsize, *cyl, *cylsec, *head, *tracksec); } -static void getchsgeometry2(uae_u64 size, int *pcyl, int *phead, int *psectorspertrack, int mode) +static void getchsgeometry2 (uae_u64 size, int *pcyl, int *phead, int *psectorspertrack, int mode) { int sptt[4]; int i, spt, head, cyl; @@ -160,8 +158,7 @@ static void getchsgeometry2(uae_u64 size, int *pcyl, int *phead, int *psectorspe spt = 32; cyl = total / (head * spt); - } - else { + } else { sptt[0] = 63; sptt[1] = 127; @@ -169,14 +166,14 @@ static void getchsgeometry2(uae_u64 size, int *pcyl, int *phead, int *psectorspe sptt[3] = -1; for (i = 0; sptt[i] >= 0; i++) { + int maxhead = sptt[i] < 255 ? 16 : 255; spt = sptt[i]; - for (head = 4; head <= 16; head++) { + for (head = 4; head <= maxhead; head++) { cyl = total / (head * spt); if (size <= 512 * 1024 * 1024) { if (cyl <= 1023) break; - } - else { + } else { if (cyl < 16383) break; if (cyl < 32767 && head >= 5) @@ -184,24 +181,30 @@ static void getchsgeometry2(uae_u64 size, int *pcyl, int *phead, int *psectorspe if (cyl <= 65535) break; } + if (maxhead > 16) { + head *= 2; + head--; + } } if (head <= 16) break; } } + if (head > 16) + head--; *pcyl = cyl; *phead = head; *psectorspertrack = spt; } -void getchsgeometry(uae_u64 size, int *pcyl, int *phead, int *psectorspertrack) +void getchsgeometry (uae_u64 size, int *pcyl, int *phead, int *psectorspertrack) { - getchsgeometry2(size, pcyl, phead, psectorspertrack, 0); + getchsgeometry2 (size, pcyl, phead, psectorspertrack, 0); } -void getchsgeometry_hdf(struct hardfiledata *hfd, uae_u64 size, int *pcyl, int *phead, int *psectorspertrack) +void getchsgeometry_hdf (struct hardfiledata *hfd, uae_u64 size, int *pcyl, int *phead, int *psectorspertrack) { uae_u8 block[512]; int i; @@ -211,33 +214,33 @@ void getchsgeometry_hdf(struct hardfiledata *hfd, uae_u64 size, int *pcyl, int * *phead = 1; *psectorspertrack = 32; } - memset(block, 0, sizeof block); + memset (block, 0, sizeof block); if (hfd) { - hdf_read(hfd, block, 0, 512); + hdf_read (hfd, block, 0, 512); if (block[0] == 'D' && block[1] == 'O' && block[2] == 'S') { int mode; for (mode = 0; mode < 2; mode++) { uae_u32 rootblock; uae_u32 chk = 0; - getchsgeometry2(size, pcyl, phead, psectorspertrack, mode); + getchsgeometry2 (size, pcyl, phead, psectorspertrack, mode); rootblock = (2 + ((*pcyl) * (*phead) * (*psectorspertrack) - 1)) / 2; - memset(block, 0, sizeof block); - hdf_read(hfd, block, (uae_u64)rootblock * 512, 512); + memset (block, 0, sizeof block); + hdf_read (hfd, block, (uae_u64)rootblock * 512, 512); for (i = 0; i < 512; i += 4) chk += (block[i] << 24) | (block[i + 1] << 16) | (block[i + 2] << 8) | (block[i + 3] << 0); if (!chk && block[0] == 0 && block[1] == 0 && block[2] == 0 && block[3] == 2 && - block[4] == 0 && block[5] == 0 && block[6] == 0 && block[7] == 0 && - block[8] == 0 && block[9] == 0 && block[10] == 0 && block[11] == 0 && + block[4] == 0 && block[5] == 0 && block[6] == 0 && block[7] == 0 && + block[8] == 0 && block[9] == 0 && block[10] == 0 && block[11] == 0 && block[508] == 0 && block[509] == 0 && block[510] == 0 && block[511] == 1) { - return; + return; } } } } - getchsgeometry2(size, pcyl, phead, psectorspertrack, size <= minsize ? 1 : 2); + getchsgeometry2 (size, pcyl, phead, psectorspertrack, size <= minsize ? 1 : 2); } -void getchspgeometry(uae_u64 total, int *pcyl, int *phead, int *psectorspertrack, bool idegeometry) +void getchspgeometry (uae_u64 total, int *pcyl, int *phead, int *psectorspertrack, bool idegeometry) { uae_u64 blocks = total / 512; @@ -254,16 +257,16 @@ void getchspgeometry(uae_u64 total, int *pcyl, int *phead, int *psectorspertrack *pcyl = blocks / ((*psectorspertrack) * (*phead)); return; } - getchsgeometry(total, pcyl, phead, psectorspertrack); + getchsgeometry (total, pcyl, phead, psectorspertrack); } -static void getchshd(struct hardfiledata *hfd, int *pcyl, int *phead, int *psectorspertrack) +static void getchshd (struct hardfiledata *hfd, int *pcyl, int *phead, int *psectorspertrack) { - getchspgeometry(hfd->virtsize, pcyl, phead, psectorspertrack, false); + getchspgeometry (hfd->virtsize, pcyl, phead, psectorspertrack, false); } -static void pl(uae_u8 *p, int off, uae_u32 v) +static void pl (uae_u8 *p, int off, uae_u32 v) { p += off * 4; p[0] = v >> 24; @@ -272,34 +275,34 @@ static void pl(uae_u8 *p, int off, uae_u32 v) p[3] = v >> 0; } -static void rdb_crc(uae_u8 *p) +static void rdb_crc (uae_u8 *p) { uae_u32 sum; int i, blocksize; - sum = 0; - blocksize = rl(p + 1 * 4); + sum =0; + blocksize = rl (p + 1 * 4); for (i = 0; i < blocksize; i++) - sum += rl(p + i * 4); + sum += rl (p + i * 4); sum = -sum; - pl(p, 2, sum); + pl (p, 2, sum); } -static void create_virtual_rdb(struct hardfiledata *hfd) +static void create_virtual_rdb (struct hardfiledata *hfd) { uae_u8 *rdb, *part, *denv; int cyl = hfd->ci.surfaces * hfd->ci.sectors; int cyls = 262144 / (cyl * 512); int size = cyl * cyls * 512; - rdb = xcalloc(uae_u8, size); + rdb = xcalloc (uae_u8, size); hfd->virtual_rdb = rdb; hfd->virtual_size = size; part = rdb + 512; pl(rdb, 0, 0x5244534b); pl(rdb, 1, 64); pl(rdb, 2, 0); // chksum - pl(rdb, 3, 0); // hostid + pl(rdb, 3, 7); // hostid pl(rdb, 4, 512); // blockbytes pl(rdb, 5, 0); // flags pl(rdb, 6, -1); // badblock @@ -336,10 +339,10 @@ static void create_virtual_rdb(struct hardfiledata *hfd) pl(rdb, 37, 0); // autopark pl(rdb, 38, 2); // highrdskblock pl(rdb, 39, -1); // res - ua_copy((char*)rdb + 40 * 4, -1, hfd->vendor_id); - ua_copy((char*)rdb + 42 * 4, -1, hfd->product_id); - ua_copy((char*)rdb + 46 * 4, -1, _T("UAE")); - rdb_crc(rdb); + ua_copy ((char*)rdb + 40 * 4, 8, hfd->vendor_id); + ua_copy ((char*)rdb + 42 * 4, 16, hfd->product_id); + ua_copy ((char*)rdb + 46 * 4, 4, _T("UAE")); + rdb_crc (rdb); pl(part, 0, 0x50415254); pl(part, 1, 64); @@ -350,8 +353,8 @@ static void create_virtual_rdb(struct hardfiledata *hfd) pl(part, 6, -1); pl(part, 7, -1); pl(part, 8, 0); // devflags - part[9 * 4] = _tcslen(hfd->ci.devname); - ua_copy((char*)part + 9 * 4 + 1, 30, hfd->ci.devname); + part[9 * 4] = _tcslen (hfd->ci.devname); + ua_copy ((char*)part + 9 * 4 + 1, 30, hfd->ci.devname); denv = part + 128; pl(denv, 0, 80); @@ -371,47 +374,45 @@ static void create_virtual_rdb(struct hardfiledata *hfd) pl(denv, 14, hfd->ci.mask); pl(denv, 15, hfd->ci.bootpri); pl(denv, 16, hfd->ci.dostype); - rdb_crc(part); + rdb_crc (part); hfd->virtsize += size; } -void hdf_hd_close(struct hd_hardfiledata *hfd) +void hdf_hd_close (struct hd_hardfiledata *hfd) { if (!hfd) return; - hdf_close(&hfd->hfd); + hdf_close (&hfd->hfd); } -int hdf_hd_open(struct hd_hardfiledata *hfd) +int hdf_hd_open (struct hd_hardfiledata *hfd) { struct uaedev_config_info *ci = &hfd->hfd.ci; - if (!hdf_open(&hfd->hfd)) + if (hdf_open (&hfd->hfd) <= 0) return 0; - if (ci->pcyls && ci->pheads && ci->psecs) { + if (ci->physical_geometry) { hfd->cyls = ci->pcyls; hfd->heads = ci->pheads; hfd->secspertrack = ci->psecs; - } - else if (ci->highcyl && ci->surfaces && ci->sectors) { + } else if (ci->highcyl && ci->surfaces && ci->sectors) { hfd->cyls = ci->highcyl; hfd->heads = ci->surfaces; hfd->secspertrack = ci->sectors; - } - else { - getchshd(&hfd->hfd, &hfd->cyls, &hfd->heads, &hfd->secspertrack); + } else { + getchshd (&hfd->hfd, &hfd->cyls, &hfd->heads, &hfd->secspertrack); } hfd->cyls_def = hfd->cyls; hfd->secspertrack_def = hfd->secspertrack; hfd->heads_def = hfd->heads; if (ci->surfaces && ci->sectors) { uae_u8 buf[512] = { 0 }; - hdf_read(&hfd->hfd, buf, 0, 512); - if (buf[0] != 0 && memcmp(buf, _T("RDSK"), 4)) { + hdf_read (&hfd->hfd, buf, 0, 512); + if (buf[0] != 0 && memcmp (buf, _T("RDSK"), 4)) { ci->highcyl = (hfd->hfd.virtsize / ci->blocksize) / (ci->sectors * ci->surfaces); - ci->dostype = rl(buf); - create_virtual_rdb(&hfd->hfd); + ci->dostype = rl (buf); + create_virtual_rdb (&hfd->hfd); while (ci->highcyl * ci->surfaces * ci->sectors > hfd->cyls_def * hfd->secspertrack_def * hfd->heads_def) { hfd->cyls_def++; } @@ -421,44 +422,22 @@ int hdf_hd_open(struct hd_hardfiledata *hfd) return 1; } -static uae_u32 vhd_checksum(uae_u8 *p, int offset) -{ - int i; - uae_u32 sum; +static int hdf_write2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len); +static int hdf_read2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len); - sum = 0; - for (i = 0; i < 512; i++) { - if (offset >= 0 && i >= offset && i < offset + 4) - continue; - sum += p[i]; - } - return ~sum; +static int hdf_cache_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) +{ + return hdf_read2 (hfd, buffer, offset, len); } -static int hdf_write2(struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len); -static int hdf_read2(struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len); - -static void hdf_init_cache(struct hardfiledata *hfd) -{ -} -static void hdf_flush_cache(struct hardfiledata *hdf) +static int hdf_cache_write (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) { + return hdf_write2 (hfd, buffer, offset, len); } -static int hdf_cache_read(struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) +int hdf_open (struct hardfiledata *hfd, const TCHAR *pname) { - return hdf_read2(hfd, buffer, offset, len); -} - -static int hdf_cache_write(struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) -{ - return hdf_write2(hfd, buffer, offset, len); -} - -int hdf_open(struct hardfiledata *hfd, const TCHAR *pname) -{ - uae_u8 tmp[512], tmp2[512]; - uae_u32 v; + int ret; if ((!pname || pname[0] == 0) && hfd->ci.rootdir[0] == 0) return 0; @@ -467,546 +446,59 @@ int hdf_open(struct hardfiledata *hfd, const TCHAR *pname) hfd->hfd_type = 0; if (!pname) pname = hfd->ci.rootdir; -#ifdef WITH_CHD - TCHAR nametmp[MAX_DPATH]; - _tcscpy(nametmp, pname); - TCHAR *ext = _tcsrchr(nametmp, '.'); - if (ext && !_tcsicmp(ext, _T(".chd"))) { - struct zfile *zf = zfile_fopen(nametmp, _T("rb")); - if (zf) { - int err; - chd_file *cf = new chd_file(); - err = cf->open(zf, false, NULL); - if (err != CHDERR_NONE) { - zfile_fclose(zf); - goto nonvhd; - } - hfd->chd_handle = cf; - hfd->ci.readonly = true; - hfd->hfd_type = HFD_CHD; - hfd->handle_valid = -1; - hfd->virtsize = cf->logical_bytes(); - goto nonvhd; - } - } -#endif - if (!hdf_open_target(hfd, pname)) - return 0; - if (hdf_read_target(hfd, tmp, 0, 512) != 512) - goto nonvhd; - v = gl(tmp + 8); // features - if ((v & 3) != 2) - goto nonvhd; - v = gl(tmp + 8 + 4); // version - if ((v >> 16) != 1) - goto nonvhd; - hfd->hfd_type = gl(tmp + 8 + 4 + 4 + 8 + 4 + 4 + 4 + 4 + 8 + 8 + 4); - if (hfd->hfd_type != HFD_VHD_FIXED && hfd->hfd_type != HFD_VHD_DYNAMIC) - goto nonvhd; - v = gl(tmp + 8 + 4 + 4 + 8 + 4 + 4 + 4 + 4 + 8 + 8 + 4 + 4); - if (v == 0) - goto nonvhd; - if (vhd_checksum(tmp, 8 + 4 + 4 + 8 + 4 + 4 + 4 + 4 + 8 + 8 + 4 + 4) != v) - goto nonvhd; - if (hdf_read_target(hfd, tmp2, hfd->physsize - sizeof tmp2, 512) != 512) - goto end; - if (memcmp(tmp, tmp2, sizeof tmp)) - goto nonvhd; - hfd->vhd_footerblock = hfd->physsize - 512; - hfd->virtsize = (uae_u64)(gl(tmp + 8 + 4 + 4 + 8 + 4 + 4 + 4 + 4 + 8)) << 32; - hfd->virtsize |= gl(tmp + 8 + 4 + 4 + 8 + 4 + 4 + 4 + 4 + 8 + 4); - if (hfd->hfd_type == HFD_VHD_DYNAMIC) { - uae_u32 size; - hfd->vhd_bamoffset = gl(tmp + 8 + 4 + 4 + 4); - if (hfd->vhd_bamoffset == 0 || hfd->vhd_bamoffset >= hfd->physsize) - goto end; - if (hdf_read_target(hfd, tmp, hfd->vhd_bamoffset, 512) != 512) - goto end; - v = gl(tmp + 8 + 8 + 8 + 4 + 4 + 4); - if (vhd_checksum(tmp, 8 + 8 + 8 + 4 + 4 + 4) != v) - goto end; - v = gl(tmp + 8 + 8 + 8); - if ((v >> 16) != 1) - goto end; - hfd->vhd_blocksize = gl(tmp + 8 + 8 + 8 + 4 + 4); - hfd->vhd_bamoffset = gl(tmp + 8 + 8 + 4); - hfd->vhd_bamsize = (((hfd->virtsize + hfd->vhd_blocksize - 1) / hfd->vhd_blocksize) * 4 + 511) & ~511; - size = hfd->vhd_bamoffset + hfd->vhd_bamsize; - hfd->vhd_header = xmalloc(uae_u8, size); - if (hdf_read_target(hfd, hfd->vhd_header, 0, size) != size) - goto end; - hfd->vhd_sectormap = xmalloc(uae_u8, 512); - hfd->vhd_sectormapblock = -1; - hfd->vhd_bitmapsize = ((hfd->vhd_blocksize / (8 * 512)) + 511) & ~511; - } - write_log(_T("HDF is VHD %s image, virtual size=%lldK\n"), - hfd->hfd_type == HFD_VHD_FIXED ? _T("fixed") : _T("dynamic"), - hfd->virtsize / 1024); - hdf_init_cache(hfd); - return 1; -nonvhd: - return 1; -end: - hdf_close_target(hfd); - return 0; -} -int hdf_open(struct hardfiledata *hfd) -{ - return hdf_open(hfd, NULL); -} - -void hdf_close(struct hardfiledata *hfd) -{ - hdf_flush_cache(hfd); - hdf_close_target(hfd); -#ifdef WITH_CHD - if (hfd->chd_handle) { - chd_file *cf = (chd_file*)hfd->chd_handle; - cf->close(); - hfd->chd_handle = NULL; - } -#endif + ret = hdf_open_target (hfd, pname); + if (ret <= 0) + return ret; hfd->hfd_type = 0; - xfree(hfd->vhd_header); - hfd->vhd_header = NULL; - xfree(hfd->vhd_sectormap); - hfd->vhd_sectormap = NULL; -} - -//int hdf_dup(struct hardfiledata *dhfd, const struct hardfiledata *shfd) -//{ -// return hdf_dup_target(dhfd, shfd); -//} - -//extern int get_guid_target(uae_u8 *out); - -static uae_u64 vhd_read(struct hardfiledata *hfd, void *v, uae_u64 offset, uae_u64 len) -{ - uae_u64 read; - uae_u8 *dataptr = (uae_u8*)v; - - //write_log (_T("%08x %08x\n"), (uae_u32)offset, (uae_u32)len); - read = 0; - if (offset & 511) - return read; - if (len & 511) - return read; - while (len > 0) { - uae_u32 bamoffset = (offset / hfd->vhd_blocksize) * 4 + hfd->vhd_bamoffset; - uae_u32 sectoroffset = gl(hfd->vhd_header + bamoffset); - if (sectoroffset == 0xffffffff) { - memset(dataptr, 0, 512); - read += 512; - } - else { - int bitmapoffsetbits; - int bitmapoffsetbytes; - uae_u64 sectormapblock; - - bitmapoffsetbits = (offset / 512) % (hfd->vhd_blocksize / 512); - bitmapoffsetbytes = bitmapoffsetbits / 8; - sectormapblock = sectoroffset * (uae_u64)512 + (bitmapoffsetbytes & ~511); - if (hfd->vhd_sectormapblock != sectormapblock) { - // read sector bitmap - //write_log (_T("BM %08x\n"), sectormapblock); - if (hdf_read_target(hfd, hfd->vhd_sectormap, sectormapblock, 512) != 512) { - write_log(_T("vhd_read: bitmap read error\n")); - return read; - } - hfd->vhd_sectormapblock = sectormapblock; - } - // block allocated in bitmap? - if (hfd->vhd_sectormap[bitmapoffsetbytes & 511] & (1 << (7 - (bitmapoffsetbits & 7)))) { - // read data block - uae_u64 block = sectoroffset * (uae_u64)512 + hfd->vhd_bitmapsize + bitmapoffsetbits * 512; - //write_log (_T("DB %08x\n"), block); - if (hdf_read_target(hfd, dataptr, block, 512) != 512) { - write_log(_T("vhd_read: data read error\n")); - return read; - } - } - else { - memset(dataptr, 0, 512); - } - read += 512; - } - len -= 512; - dataptr += 512; - offset += 512; - } - return read; -} - -static int vhd_write_enlarge(struct hardfiledata *hfd, uae_u32 bamoffset) -{ - uae_u8 *buf, *p; - int len; - uae_u32 block; - int v; - - len = hfd->vhd_blocksize + hfd->vhd_bitmapsize + 512; - buf = xcalloc(uae_u8, len); - if (!hdf_resize_target(hfd, hfd->physsize + len - 512)) { - write_log(_T("vhd_enlarge: failure\n")); - return 0; - } - // add footer (same as 512 byte header) - memcpy(buf + len - 512, hfd->vhd_header, 512); - v = hdf_write_target(hfd, buf, hfd->vhd_footerblock, len); - xfree(buf); - if (v != len) { - write_log(_T("vhd_enlarge: footer write error\n")); - return 0; - } - // write new offset to BAM - p = hfd->vhd_header + bamoffset; - block = hfd->vhd_footerblock / 512; - p[0] = block >> 24; - p[1] = block >> 16; - p[2] = block >> 8; - p[3] = block >> 0; - // write to disk - if (hdf_write_target(hfd, hfd->vhd_header + hfd->vhd_bamoffset, hfd->vhd_bamoffset, hfd->vhd_bamsize) != hfd->vhd_bamsize) { - write_log(_T("vhd_enlarge: bam write error\n")); - return 0; - } - hfd->vhd_footerblock += len - 512; return 1; } - -static uae_u64 vhd_write(struct hardfiledata *hfd, void *v, uae_u64 offset, uae_u64 len) +int hdf_open (struct hardfiledata *hfd) { - uae_u64 written; - uae_u8 *dataptr = (uae_u8*)v; - - //write_log (_T("%08x %08x\n"), (uae_u32)offset, (uae_u32)len); - written = 0; - if (offset & 511) - return written; - if (len & 511) - return written; - while (len > 0) { - uae_u32 bamoffset = (offset / hfd->vhd_blocksize) * 4 + hfd->vhd_bamoffset; - uae_u32 sectoroffset = gl(hfd->vhd_header + bamoffset); - if (sectoroffset == 0xffffffff) { - if (!vhd_write_enlarge(hfd, bamoffset)) - return written; - continue; - } - else { - int bitmapoffsetbits; - int bitmapoffsetbytes; - - bitmapoffsetbits = (offset / 512) % (hfd->vhd_blocksize / 512); - bitmapoffsetbytes = bitmapoffsetbits / 8; - uae_u64 sectormapblock = sectoroffset * (uae_u64)512 + (bitmapoffsetbytes & ~511); - if (hfd->vhd_sectormapblock != sectormapblock) { - // read sector bitmap - if (hdf_read_target(hfd, hfd->vhd_sectormap, sectormapblock, 512) != 512) { - write_log(_T("vhd_write: bitmap read error\n")); - return written; - } - hfd->vhd_sectormapblock = sectormapblock; - } - // write data - if (hdf_write_target(hfd, dataptr, sectoroffset * (uae_u64)512 + hfd->vhd_bitmapsize + bitmapoffsetbits * 512, 512) != 512) { - write_log(_T("vhd_write: data write error\n")); - return written; - } - // block already allocated in bitmap? - if (!(hfd->vhd_sectormap[bitmapoffsetbytes & 511] & (1 << (7 - (bitmapoffsetbits & 7))))) { - // no, we need to mark it allocated and write the modified bitmap back to the disk - hfd->vhd_sectormap[bitmapoffsetbytes & 511] |= (1 << (7 - (bitmapoffsetbits & 7))); - if (hdf_write_target(hfd, hfd->vhd_sectormap, sectormapblock, 512) != 512) { - write_log(_T("vhd_write: bam write error\n")); - return written; - } - } - written += 512; - } - len -= 512; - dataptr += 512; - offset += 512; - } - return written; + return hdf_open (hfd, NULL); } - -int vhd_create(const TCHAR *name, uae_u64 size, uae_u32 dostype) +void hdf_close (struct hardfiledata *hfd) { - struct hardfiledata hfd; - struct zfile *zf; - uae_u8 *b; - int cyl, cylsec, head, tracksec; - uae_u32 crc, blocksize, batsize, batentrysize; - int ret, i; - time_t tm; - - if (size >= (uae_u64)10 * 1024 * 1024 * 1024) - blocksize = 2 * 1024 * 1024; - else - blocksize = 512 * 1024; - batsize = (size + blocksize - 1) / blocksize; - batentrysize = batsize; - batsize *= 4; - batsize += 511; - batsize &= ~511; - ret = 0; - b = NULL; - zf = zfile_fopen(name, _T("wb"), 0); - if (!zf) - goto end; - b = xcalloc(uae_u8, 512 + 1024 + batsize + 512); - if (zfile_fwrite(b, 512 + 1024 + batsize + 512, 1, zf) != 1) - goto end; - - memset(&hfd, 0, sizeof hfd); - hfd.virtsize = hfd.physsize = size; - hfd.ci.blocksize = 512; - strcpy((char*)b, "conectix"); // cookie - b[0x0b] = 2; // features - b[0x0d] = 1; // version - b[0x10 + 6] = 2; // data offset - // time stamp - tm = time(NULL) - 946684800; - b[0x18] = tm >> 24; - b[0x19] = tm >> 16; - b[0x1a] = tm >> 8; - b[0x1b] = tm >> 0; - strcpy((char*)b + 0x1c, "vpc "); // creator application - b[0x21] = 5; // creator version - strcpy((char*)b + 0x24, "Wi2k"); // creator host os - // original and current size - b[0x28] = b[0x30] = size >> 56; - b[0x29] = b[0x31] = size >> 48; - b[0x2a] = b[0x32] = size >> 40; - b[0x2b] = b[0x33] = size >> 32; - b[0x2c] = b[0x34] = size >> 24; - b[0x2d] = b[0x35] = size >> 16; - b[0x2e] = b[0x36] = size >> 8; - b[0x2f] = b[0x37] = size >> 0; - getchs2(&hfd, &cyl, &cylsec, &head, &tracksec); - // cylinders - b[0x38] = cyl >> 8; - b[0x39] = cyl; - // heads - b[0x3a] = head; - // sectors per track - b[0x3b] = tracksec; - // disk type - b[0x3c + 3] = HFD_VHD_DYNAMIC; - //get_guid_target(b + 0x44); - crc = vhd_checksum(b, -1); - b[0x40] = crc >> 24; - b[0x41] = crc >> 16; - b[0x42] = crc >> 8; - b[0x43] = crc >> 0; - - // write header - zfile_fseek(zf, 0, SEEK_SET); - zfile_fwrite(b, 512, 1, zf); - // write footer - zfile_fseek(zf, 512 + 1024 + batsize, SEEK_SET); - zfile_fwrite(b, 512, 1, zf); - - // dynamic disk header - memset(b, 0, 1024); - // cookie - strcpy((char*)b, "cxsparse"); - // data offset - for (i = 0; i < 8; i++) - b[0x08 + i] = 0xff; - // table offset (bat) - b[0x10 + 6] = 0x06; - // version - b[0x19] = 1; - // max table entries - b[0x1c] = batentrysize >> 24; - b[0x1d] = batentrysize >> 16; - b[0x1e] = batentrysize >> 8; - b[0x1f] = batentrysize >> 0; - b[0x20] = blocksize >> 24; - b[0x21] = blocksize >> 16; - b[0x22] = blocksize >> 8; - b[0x23] = blocksize >> 0; - crc = vhd_checksum(b, -1); - b[0x24] = crc >> 24; - b[0x25] = crc >> 16; - b[0x26] = crc >> 8; - b[0x27] = crc >> 0; - - // write dynamic header - zfile_fseek(zf, 512, SEEK_SET); - zfile_fwrite(b, 1024, 1, zf); - - // bat - memset(b, 0, batsize); - memset(b, 0xff, batentrysize * 4); - zfile_fwrite(b, batsize, 1, zf); - - zfile_fclose(zf); - zf = NULL; - - if (dostype) { - uae_u8 bootblock[512] = { 0 }; - bootblock[0] = dostype >> 24; - bootblock[1] = dostype >> 16; - bootblock[2] = dostype >> 8; - bootblock[3] = dostype >> 0; - if (hdf_open(&hfd, name)) { - vhd_write(&hfd, bootblock, 0, 512); - hdf_close(&hfd); - } - } - - ret = 1; - -end: - xfree(b); - zfile_fclose(zf); - return ret; + hdf_close_target (hfd); + hfd->hfd_type = 0; } -static int hdf_read2(struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) +static int hdf_read2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) { - if (hfd->hfd_type == HFD_VHD_DYNAMIC) - return vhd_read(hfd, buffer, offset, len); - else if (hfd->hfd_type == HFD_VHD_FIXED) - return hdf_read_target(hfd, buffer, offset + 512, len); -#ifdef WITH_CHD - else if (hfd->hfd_type == HFD_CHD) { - chd_file *cf = (chd_file*)hfd->chd_handle; - if (cf->read_bytes(offset, buffer, len) == CHDERR_NONE) - return len; - return 0; - } -#endif - else - return hdf_read_target(hfd, buffer, offset, len); + return hdf_read_target (hfd, buffer, offset, len); } -static int hdf_write2(struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) +static int hdf_write2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) { - if (hfd->hfd_type == HFD_VHD_DYNAMIC) - return vhd_write(hfd, buffer, offset, len); - else if (hfd->hfd_type == HFD_VHD_FIXED) - return hdf_write_target(hfd, buffer, offset + 512, len); -#ifdef WITH_CHD - else if (hfd->hfd_type == HFD_CHD) - return 0; -#endif - else - return hdf_write_target(hfd, buffer, offset, len); + return hdf_write_target (hfd, buffer, offset, len); } -static void adide_decode(void *v, int len) +static void adide_decode (void *v, int len) { int i; uae_u8 *buffer = (uae_u8*)v; for (i = 0; i < len; i += 2) { - uae_u8 *b = buffer + i; + uae_u8 *b = buffer + i; uae_u16 w = (b[0] << 8) | (b[1] << 0); - uae_u16 o = 0; - - if (w & 0x8000) - o |= 0x0001; - if (w & 0x0001) - o |= 0x0002; - - if (w & 0x4000) - o |= 0x0004; - if (w & 0x0002) - o |= 0x0008; - - if (w & 0x2000) - o |= 0x0010; - if (w & 0x0004) - o |= 0x0020; - - if (w & 0x1000) - o |= 0x0040; - if (w & 0x0008) - o |= 0x0080; - - if (w & 0x0800) - o |= 0x0100; - if (w & 0x0010) - o |= 0x0200; - - if (w & 0x0400) - o |= 0x0400; - if (w & 0x0020) - o |= 0x0800; - - if (w & 0x0200) - o |= 0x1000; - if (w & 0x0040) - o |= 0x2000; - - if (w & 0x0100) - o |= 0x4000; - if (w & 0x0080) - o |= 0x8000; - + uae_u16 o = adide_decode_word(w); b[0] = o >> 8; b[1] = o >> 0; } } -static void adide_encode(void *v, int len) +static void adide_encode (void *v, int len) { int i; uae_u8 *buffer = (uae_u8*)v; for (i = 0; i < len; i += 2) { - uae_u8 *b = buffer + i; + uae_u8 *b = buffer + i; uae_u16 w = (b[0] << 8) | (b[1] << 0); - uae_u16 o = 0; - - if (w & 0x0001) - o |= 0x8000; - if (w & 0x0002) - o |= 0x0001; - - if (w & 0x0004) - o |= 0x4000; - if (w & 0x0008) - o |= 0x0002; - - if (w & 0x0010) - o |= 0x2000; - if (w & 0x0020) - o |= 0x0004; - - if (w & 0x0040) - o |= 0x1000; - if (w & 0x0080) - o |= 0x0008; - - if (w & 0x0100) - o |= 0x0800; - if (w & 0x0200) - o |= 0x0010; - - if (w & 0x0400) - o |= 0x0400; - if (w & 0x0800) - o |= 0x0020; - - if (w & 0x1000) - o |= 0x0200; - if (w & 0x2000) - o |= 0x0040; - - if (w & 0x4000) - o |= 0x0100; - if (w & 0x8000) - o |= 0x0080; - + uae_u16 o = adide_encode_word(w); b[0] = o >> 8; b[1] = o >> 0; } } -static void hdf_byteswap(void *v, int len) +static void hdf_byteswap (void *v, int len) { int i; uae_u8 *b = (uae_u8*)v; @@ -1018,1238 +510,1646 @@ static void hdf_byteswap(void *v, int len) } } -int hdf_read_rdb(struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) +int hdf_read_rdb (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) { int v; - v = hdf_read(hfd, buffer, offset, len); - if (v > 0 && offset < 16 * 512 && !hfd->byteswap && !hfd->adide) { + v = hdf_read (hfd, buffer, offset, len); + if (v > 0 && offset < 16 * 512 && !hfd->byteswap && !hfd->adide) { uae_u8 *buf = (uae_u8*)buffer; bool changed = false; if (buf[0] == 0x39 && buf[1] == 0x10 && buf[2] == 0xd3 && buf[3] == 0x12) { // AdIDE encoded "CPRM" hfd->adide = 1; changed = true; - write_log(_T("HDF: adide scrambling detected\n")); - } - else if (!memcmp(buf, "DRKS", 4)) { + write_log (_T("HDF: adide scrambling detected\n")); + } else if (!memcmp (buf, "DRKS", 4)) { hfd->byteswap = 1; changed = true; - write_log(_T("HDF: byteswapped RDB detected\n")); + write_log (_T("HDF: byteswapped RDB detected\n")); } if (changed) - v = hdf_read(hfd, buffer, offset, len); + v = hdf_read (hfd, buffer, offset, len); } return v; } -int hdf_read(struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) +int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) { int v; - hf_log3(_T("cmd_read: %p %04x-%08x (%d) %08x (%d)\n"), + hf_log3 (_T("cmd_read: %p %04x-%08x (%d) %08x (%d)\n"), buffer, (uae_u32)(offset >> 32), (uae_u32)offset, (uae_u32)(offset / hfd->ci.blocksize), (uae_u32)len, (uae_u32)(len / hfd->ci.blocksize)); if (!hfd->adide) { - v = hdf_cache_read(hfd, buffer, offset, len); - } - else { + v = hdf_cache_read (hfd, buffer, offset, len); + } else { offset += 512; - v = hdf_cache_read(hfd, buffer, offset, len); - adide_decode(buffer, len); + v = hdf_cache_read (hfd, buffer, offset, len); + adide_decode (buffer, len); } if (hfd->byteswap) - hdf_byteswap(buffer, len); + hdf_byteswap (buffer, len); return v; } -int hdf_write(struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) +int hdf_write (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) { int v; - hf_log3(_T("cmd_write: %p %04x-%08x (%d) %08x (%d)\n"), + hf_log3 (_T("cmd_write: %p %04x-%08x (%d) %08x (%d)\n"), buffer, (uae_u32)(offset >> 32), (uae_u32)offset, (uae_u32)(offset / hfd->ci.blocksize), (uae_u32)len, (uae_u32)(len / hfd->ci.blocksize)); if (hfd->byteswap) - hdf_byteswap(buffer, len); + hdf_byteswap (buffer, len); if (!hfd->adide) { - v = hdf_cache_write(hfd, buffer, offset, len); - } - else { + v = hdf_cache_write (hfd, buffer, offset, len); + } else { offset += 512; - adide_encode(buffer, len); - v = hdf_cache_write(hfd, buffer, offset, len); - adide_decode(buffer, len); + adide_encode (buffer, len); + v = hdf_cache_write (hfd, buffer, offset, len); + adide_decode (buffer, len); } if (hfd->byteswap) - hdf_byteswap(buffer, len); + hdf_byteswap (buffer, len); return v; } -static uae_u64 cmd_readx(struct hardfiledata *hfd, uae_u8 *dataptr, uae_u64 offset, uae_u64 len) +static uae_u64 cmd_readx (struct hardfiledata *hfd, uae_u8 *dataptr, uae_u64 offset, uae_u64 len) { - gui_flicker_led(LED_HD, hfd->unitnum, 1); - return hdf_read(hfd, dataptr, offset, len); + gui_flicker_led (LED_HD, hfd->unitnum, 1); + return hdf_read (hfd, dataptr, offset, len); } -static uae_u64 cmd_read(struct hardfiledata *hfd, uaecptr dataptr, uae_u64 offset, uae_u64 len) +static uae_u64 cmd_read(TrapContext *ctx, struct hardfiledata *hfd, uaecptr dataptr, uae_u64 offset, uae_u64 len) { - addrbank *bank_data = &get_mem_bank(dataptr); - if (!len || !bank_data || !bank_data->check(dataptr, len)) + if (!len) return 0; - return cmd_readx(hfd, bank_data->xlateaddr(dataptr), offset, len); + if (!ctx) { + addrbank *bank_data = &get_mem_bank (dataptr); + if (!bank_data || !bank_data->check (dataptr, len)) + return 0; + uae_u8 *buffer = bank_data->xlateaddr (dataptr); + return cmd_readx (hfd, buffer, offset, len); + } + int total = 0; + while (len > 0) { + uae_u8 buf[RTAREA_TRAP_DATA_EXTRA_SIZE]; + int max = RTAREA_TRAP_DATA_EXTRA_SIZE & ~511; + int size = len > max ? max : len; + if (cmd_readx(hfd, buf, offset, size) != size) + break; + trap_put_bytes(ctx, buf, dataptr, size); + offset += size; + dataptr += size; + len -= size; + total += size; + } + return total; } -static uae_u64 cmd_writex(struct hardfiledata *hfd, uae_u8 *dataptr, uae_u64 offset, uae_u64 len) +static uae_u64 cmd_writex (struct hardfiledata *hfd, uae_u8 *dataptr, uae_u64 offset, uae_u64 len) { - gui_flicker_led(LED_HD, hfd->unitnum, 2); - return hdf_write(hfd, dataptr, offset, len); + gui_flicker_led (LED_HD, hfd->unitnum, 2); + return hdf_write (hfd, dataptr, offset, len); } -static uae_u64 cmd_write(struct hardfiledata *hfd, uaecptr dataptr, uae_u64 offset, uae_u64 len) +static uae_u64 cmd_write(TrapContext *ctx, struct hardfiledata *hfd, uaecptr dataptr, uae_u64 offset, uae_u64 len) { - addrbank *bank_data = &get_mem_bank(dataptr); - if (!len || !bank_data || !bank_data->check(dataptr, len)) + if (!len) return 0; - return cmd_writex(hfd, bank_data->xlateaddr(dataptr), offset, len); + if (!ctx) { + addrbank *bank_data = &get_mem_bank (dataptr); + if (!bank_data || !bank_data->check (dataptr, len)) + return 0; + uae_u8 *buffer = bank_data->xlateaddr (dataptr); + return cmd_writex (hfd, buffer, offset, len); + } + int total = 0; + while (len > 0) { + uae_u8 buf[RTAREA_TRAP_DATA_EXTRA_SIZE]; + int max = RTAREA_TRAP_DATA_EXTRA_SIZE & ~511; + int size = len > max ? max : len; + trap_get_bytes(ctx, buf, dataptr, size); + if (cmd_writex(hfd, buf, offset, size) != size) + break; + offset += size; + dataptr += size; + len -= size; + total += size; + } + return total; } -static int checkbounds(struct hardfiledata *hfd, uae_u64 offset, uae_u64 len) +static int checkbounds (struct hardfiledata *hfd, uae_u64 offset, uae_u64 len, int mode) { - if (offset >= hfd->virtsize) - return 0; - if (offset + len > hfd->virtsize) - return 0; - return 1; -} - -static int nodisk(struct hardfiledata *hfd) -{ - if (hfd->drive_empty) - return 1; + uae_u64 max = hfd->virtsize; + if (offset >= max || offset + len > max || (offset > 0xffffffff && (uae_s64)offset < 0)) { + return -1; + } return 0; } -int scsi_hd_emulate(struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u8 *cmdbuf, int scsi_cmd_len, +static bool is_writeprotected(struct hardfiledata *hfd) +{ + return hfd->ci.readonly || hfd->dangerous || currprefs.harddrive_read_only; +} + +static int nodisk (struct hardfiledata *hfd) +{ + if (hfd->drive_empty) + return 1; + return 0; +} + +static void setdrivestring(const TCHAR *s, uae_u8 *d, int start, int length) +{ + int i = 0; + uae_char *ss = ua(s); + while (i < length && ss[i]) { + d[start + i] = ss[i]; + i++; + } + while (i > 0) { + uae_char c = d[start + i - 1]; + if (c != '_') + break; + i--; + } + while (i < length) { + d[start + i] = 32; + i++; + } + xfree (ss); +} + +static const uae_u8 sasi_commands[] = +{ + 0x00, 0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x12, + 0xe0, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xff +}; +static const uae_u8 sasi_commands2[] = +{ + 0x12, + 0xff +}; + +static uae_u64 get_scsi_6_offset(struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u8 *cmdbuf, uae_u64 *lba) +{ + bool chs = hfd->ci.unit_feature_level == HD_LEVEL_SASI_CHS; + uae_u64 offset; + if (chs) { + int cyl, cylsec, head, tracksec; + if (hdhfd) { + cyl = hdhfd->cyls; + head = hdhfd->heads; + tracksec = hdhfd->secspertrack; + cylsec = 0; + } else { + getchsx(hfd, &cyl, &cylsec, &head, &tracksec); + } + int d_head = cmdbuf[1] & 31; + int d_cyl = cmdbuf[3] | ((cmdbuf[2] >> 6) << 8) | ((cmdbuf[1] >> 7) << 10); + int d_sec = cmdbuf[2] & 63; + + *lba = ((cmdbuf[1] & (0x1f | 0x80 | 0x40)) << 16) | (cmdbuf[2] << 8) || cmdbuf[3]; + if (d_cyl >= cyl || d_head >= head || d_sec >= tracksec) + return ~0; + offset = d_cyl * head * tracksec + d_head * tracksec + d_sec; + } else { + offset = ((cmdbuf[1] & 31) << 16) | (cmdbuf[2] << 8) | cmdbuf[3]; + } + return offset; +} + +int scsi_hd_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u8 *cmdbuf, int scsi_cmd_len, uae_u8 *scsi_data, int *data_len, uae_u8 *r, int *reply_len, uae_u8 *s, int *sense_len) { + TrapContext *ctx = NULL; + if (cmdbuf == NULL) + return 0; + uae_u64 len, offset; int lr = 0, ls = 0; + int chkerr; int scsi_len = -1; int status = 0; - int i, lun; - char *ss; + int lun; + uae_u8 cmd; + bool sasi = hfd->ci.unit_feature_level >= HD_LEVEL_SASI && hfd->ci.unit_feature_level <= HD_LEVEL_SASI_ENHANCED; + bool sasie = hfd->ci.unit_feature_level == HD_LEVEL_SASI_ENHANCED; + bool omti = hfd->ci.unit_feature_level == HD_LEVEL_SASI_CHS; + uae_u8 sasi_sense = 0; + uae_u64 current_lba = ~0; + + cmd = cmdbuf[0]; + + /* REQUEST SENSE */ + if (cmd == 0x03) { + return 0; + } *reply_len = *sense_len = 0; lun = cmdbuf[1] >> 5; - if (cmdbuf[0] != 0x03 && cmdbuf[0] != 0x12 && lun) { + if (sasi || omti) { + lun = lun & 1; + if (lun) + goto nodisk; + } + if (cmd != 0x03 && cmd != 0x12 && lun) { status = 2; /* CHECK CONDITION */ s[0] = 0x70; s[2] = 5; /* ILLEGAL REQUEST */ s[12] = 0x25; /* INVALID LUN */ ls = 0x12; - goto err; + write_log (_T("UAEHF: CMD=%02X LUN=%d ignored\n"), cmdbuf[0], lun); + goto scsi_done; } + + if (sasi || omti) { + int i; + for (i = 0; sasi_commands[i] != 0xff; i++) { + if (sasi_commands[i] == cmdbuf[0]) + break; + } + if (sasi_commands[i] == 0xff) { + if (sasie) { + for (i = 0; sasi_commands2[i] != 0xff; i++) { + if (sasi_commands2[i] == cmdbuf[0]) + break; + } + if (sasi_commands2[i] == 0xff) + goto errreq; + } else { + goto errreq; + } + } + switch (cmdbuf[0]) + { + case 0x05: /* READ VERIFY */ + if (nodisk(hfd)) + goto nodisk; + offset = get_scsi_6_offset(hfd, hdhfd, cmdbuf, ¤t_lba); + if (offset == ~0) { + chkerr = 1; + goto checkfail; + } + current_lba = offset; + offset *= hfd->ci.blocksize; + chkerr = checkbounds(hfd, offset, hfd->ci.blocksize, 1); + if (chkerr) { + current_lba = offset; + goto checkfail; + } + scsi_len = 0; + goto scsi_done; + case 0x0c: /* INITIALIZE DRIVE CHARACTERISTICS */ + scsi_len = 8; + write_log(_T("INITIALIZE DRIVE CHARACTERISTICS: ")); + write_log(_T("Heads: %d Cyls: %d Secs: %d\n"), + (scsi_data[1] >> 4) | ((scsi_data[0] & 0xc0) << 4), + ((scsi_data[1] & 15) << 8) | (scsi_data[2]), + scsi_data[5]); + for (int i = 0; i < 8; i++) { + write_log(_T("%02X "), scsi_data[i]); + } + write_log(_T("\n")); + goto scsi_done; + case 0x12: /* INQUIRY */ + { + int cyl, cylsec, head, tracksec; + int alen = cmdbuf[4]; + if (nodisk(hfd)) + goto nodisk; + if (hdhfd) { + cyl = hdhfd->cyls; + head = hdhfd->heads; + tracksec = hdhfd->secspertrack; + cylsec = 0; + } else { + getchsx(hfd, &cyl, &cylsec, &head, &tracksec); + } + r[0] = 0; + r[1] = 11; + r[9] = cyl >> 8; + r[10] = cyl; + r[11] = head; + scsi_len = lr = alen > 12 ? 12 : alen; + goto scsi_done; + } + break; + } + } + + switch (cmdbuf[0]) + { + case 0x12: /* INQUIRY */ + { + if ((cmdbuf[1] & 1) || cmdbuf[2] != 0) + goto err; + int alen = (cmdbuf[3] << 8) | cmdbuf[4]; + if (lun != 0) { + r[0] = 0x7f; + } else { + r[0] = 0; + } + r[2] = 2; /* supports SCSI-2 */ + r[3] = 2; /* response data format */ + r[4] = 32; /* additional length */ + r[7] = 0; + lr = alen < 36 ? alen : 36; + if (hdhfd) { + r[2] = hdhfd->ansi_version; + r[3] = hdhfd->ansi_version >= 2 ? 2 : 0; + } + setdrivestring(hfd->vendor_id, r, 8, 8); + setdrivestring(hfd->product_id, r, 16, 16); + setdrivestring(hfd->product_rev, r, 32, 4); + if (lun == 0 && hfd->drive_empty) { + r[0] |= 0x20; // not present + r[1] |= 0x80; // removable.. + } + scsi_len = lr; + } + goto scsi_done; + case 0x1b: /* START/STOP UNIT */ + scsi_len = 0; + hfd->unit_stopped = (cmdbuf[4] & 1) == 0; + goto scsi_done; + } + + if (hfd->unit_stopped) { + status = 2; /* CHECK CONDITION */ + s[0] = 0x70; + s[2] = 2; /* NOT READY */ + s[12] = 4; /* not ready */ + s[13] = 2; /* need initialise command */ + ls = 0x12; + goto scsi_done; + } + switch (cmdbuf[0]) { case 0x00: /* TEST UNIT READY */ - if (nodisk(hfd)) + if (nodisk (hfd)) goto nodisk; scsi_len = 0; break; - case 0x03: /* REQUEST SENSE */ - scsi_len = cmdbuf[4] > MAX_SCSI_SENSE ? MAX_SCSI_SENSE : cmdbuf[4]; - memcpy(r, hfd->scsi_sense, scsi_len); - memset(hfd->scsi_sense, 0, MAX_SCSI_SENSE); + case 0x01: /* REZERO UNIT */ + if (nodisk (hfd)) + goto nodisk; + scsi_len = 0; + break; + case 0x04: /* FORMAT UNIT */ + // do nothing + if (nodisk (hfd)) + goto nodisk; + if (is_writeprotected(hfd)) + goto readprot; + scsi_len = 0; + break; + case 0x05: /* VERIFY TRACK */ + // do nothing + if (nodisk (hfd)) + goto nodisk; + scsi_len = 0; + break; + case 0x06: /* FORMAT TRACK */ + // do nothing + if (nodisk (hfd)) + goto nodisk; + if (is_writeprotected(hfd)) + goto readprot; + scsi_len = 0; + break; + case 0x09: /* READ VERIFY */ + if (nodisk(hfd)) + goto nodisk; + offset = get_scsi_6_offset(hfd, hdhfd, cmdbuf, ¤t_lba); + if (offset == ~0) { + chkerr = 1; + goto checkfail; + } + current_lba = offset; + offset *= hfd->ci.blocksize; + chkerr = checkbounds(hfd, offset, hfd->ci.blocksize, 1); + if (chkerr) { + current_lba = offset; + goto checkfail; + } + scsi_len = 0; + break; + case 0x0b: /* SEEK (6) */ + if (nodisk (hfd)) + goto nodisk; + offset = get_scsi_6_offset(hfd, hdhfd, cmdbuf, ¤t_lba); + if (offset == ~0) { + chkerr = 1; + goto checkfail; + } + current_lba = offset; + offset *= hfd->ci.blocksize; + chkerr = checkbounds(hfd, offset, hfd->ci.blocksize, 3); + if (chkerr) + goto checkfail; + scsi_len = 0; break; case 0x08: /* READ (6) */ - if (nodisk(hfd)) + if (nodisk (hfd)) goto nodisk; - offset = ((cmdbuf[1] & 31) << 16) | (cmdbuf[2] << 8) | cmdbuf[3]; + offset = get_scsi_6_offset(hfd, hdhfd, cmdbuf, ¤t_lba); + if (offset == ~0) { + chkerr = 1; + goto checkfail; + } + current_lba = offset; offset *= hfd->ci.blocksize; len = cmdbuf[4]; if (!len) len = 256; len *= hfd->ci.blocksize; - if (!checkbounds(hfd, offset, len)) - goto outofbounds; + chkerr = checkbounds(hfd, offset, len, 1); + if (chkerr) + goto checkfail; scsi_len = (uae_u32)cmd_readx(hfd, scsi_data, offset, len); break; + case 0x0f: /* WRITE SECTOR BUFFER */ + scsi_len = hfd->ci.blocksize; + break; case 0x0a: /* WRITE (6) */ - if (nodisk(hfd)) + if (nodisk (hfd)) goto nodisk; - if (hfd->ci.readonly || hfd->dangerous) + if (is_writeprotected(hfd)) goto readprot; - offset = ((cmdbuf[1] & 31) << 16) | (cmdbuf[2] << 8) | cmdbuf[3]; + offset = get_scsi_6_offset(hfd, hdhfd, cmdbuf, ¤t_lba); + if (offset == ~0) { + chkerr = 1; + goto checkfail; + } + current_lba = offset; offset *= hfd->ci.blocksize; len = cmdbuf[4]; if (!len) len = 256; len *= hfd->ci.blocksize; - if (!checkbounds(hfd, offset, len)) - goto outofbounds; + chkerr = checkbounds(hfd, offset, len, 2); + if (chkerr) + goto checkfail; scsi_len = (uae_u32)cmd_writex(hfd, scsi_data, offset, len); break; - case 0x12: /* INQUIRY */ - { - if ((cmdbuf[1] & 1) || cmdbuf[2] != 0) - goto err; - int alen = (cmdbuf[3] << 8) | cmdbuf[4]; - if (lun != 0) { - r[0] = 0x7f; - } - else { - r[0] = 0; - if (hfd->drive_empty) { - r[1] |= 0x80; // removable.. - r[0] |= 0x20; // not present - } - } - r[2] = 2; /* supports SCSI-2 */ - r[3] = 2; /* response data format */ - r[4] = 32; /* additional length */ - r[7] = 0x20; /* 16 bit bus */ - scsi_len = lr = alen < 36 ? alen : 36; - if (hdhfd) { - r[2] = hdhfd->ansi_version; - r[3] = hdhfd->ansi_version >= 2 ? 2 : 0; - } - ss = ua(hfd->vendor_id); - i = 0; /* vendor id */ - while (i < 8 && ss[i]) { - r[8 + i] = ss[i]; - i++; - } - while (i < 8) { - r[8 + i] = 32; - i++; - } - xfree(ss); - ss = ua(hfd->product_id); - i = 0; /* product id */ - while (i < 16 && ss[i]) { - r[16 + i] = ss[i]; - i++; - } - while (i < 16) { - r[16 + i] = 32; - i++; - } - xfree(ss); - ss = ua(hfd->product_rev); - i = 0; /* product revision */ - while (i < 4 && ss[i]) { - r[32 + i] = ss[i]; - i++; - } - while (i < 4) { - r[32 + i] = 32; - i++; - } - xfree(ss); - } - break; + case 0x5a: // MODE SENSE(10) case 0x1a: /* MODE SENSE(6) */ - { - uae_u8 *p; - int pc = cmdbuf[2] >> 6; - int pcode = cmdbuf[2] & 0x3f; - int dbd = cmdbuf[1] & 8; - int alen = cmdbuf[4]; - int cyl, cylsec, head, tracksec; - if (nodisk(hfd)) - goto nodisk; - if (hdhfd) { - cyl = hdhfd->cyls; - head = hdhfd->heads; - tracksec = hdhfd->secspertrack; - cylsec = 0; - } - else { - getchsx(hfd, &cyl, &cylsec, &head, &tracksec); - } - //write_log (_T("MODE SENSE PC=%d CODE=%d DBD=%d\n"), pc, pcode, dbd); - p = r; - p[0] = 4 - 1; - p[1] = 0; - p[2] = (hfd->ci.readonly || hfd->dangerous) ? 0x80 : 0x00; - p[3] = 0; - p += 4; - if (!dbd) { - if (alen >= r[0] + 1 + 8) { - uae_u32 blocks = (uae_u32)(hfd->virtsize / hfd->ci.blocksize); - p[-1] = 8; - wl(p + 0, blocks); - wl(p + 4, hfd->ci.blocksize); + { + uae_u8 *p; + bool pcodeloop = false; + bool sense10 = cmdbuf[0] == 0x5a; + int pc = cmdbuf[2] >> 6; + int pcode = cmdbuf[2] & 0x3f; + int dbd = cmdbuf[1] & 8; + int cyl, head, tracksec; + int totalsize, bdsize, alen; + + if (nodisk (hfd)) + goto nodisk; + if (hdhfd) { + cyl = hdhfd->cyls; + head = hdhfd->heads; + tracksec = hdhfd->secspertrack; + } else { + int cylsec; + getchsx (hfd, &cyl, &cylsec, &head, &tracksec); + } + //write_log (_T("MODE SENSE PC=%d CODE=%d DBD=%d\n"), pc, pcode, dbd); + p = r; + + if (sense10) { + totalsize = 8 - 2; + alen = (cmdbuf[7] << 8) | cmdbuf[8]; + p[2] = 0; + p[3] = is_writeprotected(hfd) ? 0x80 : 0x00; + p[4] = 0; + p[5] = 0; + p[6] = 0; + p[7] = 0; p += 8; - } - } - if (pcode == 0) { - if (alen >= r[0] + 1 + r[3] + 4) { - p[0] = 0; - p[1] = 3; - p[2] = 0x20; + } else { + totalsize = 4 - 1; + alen = cmdbuf[4]; + p[1] = 0; + p[2] = is_writeprotected(hfd) ? 0x80 : 0x00; p[3] = 0; - r[0] += p[1]; + p += 4; } - } - else if (pcode == 3) { - // format parameters - if (alen >= r[0] + 1 + r[3] + 24) { - p[0] = 3; - p[1] = 24; - p[3] = 1; - p[10] = tracksec >> 8; - p[11] = tracksec; - p[12] = hfd->ci.blocksize >> 8; - p[13] = hfd->ci.blocksize; - p[15] = 1; // interleave - p[20] = 0x80; - r[0] += p[1]; + + bdsize = 0; + if (!dbd) { + uae_u32 blocks = (uae_u32)(hfd->virtsize / hfd->ci.blocksize); + wl(p + 0, blocks < 0x01000000 ? blocks : 0); + wl(p + 4, hfd->ci.blocksize); + bdsize = 8; + p += bdsize; } - } - else if (pcode == 4) { - // rigid drive geometry - if (alen >= r[0] + 1 + r[3] + 16) { - p[0] = 4; - wl(p + 1, cyl); - p[1] = 24; - p[5] = head; - wl(p + 13, cyl); - ww(p + 20, 5400); - r[0] += p[1]; + + if (pcode == 0x3f) { + pcode = 1; // page = 0 must be last + pcodeloop = true; } + for (;;) { + int psize = 0; + if (pcode == 0) { + p[0] = 0; + p[1] = 0; + p[2] = 0x20; + p[3] = 0; + psize = 4; + } else if (pcode == 1) { + // error recovery page + p[0] = 1; + p[1] = 0x0a; + psize = p[1] + 2; + // return defaults (0) + } else if (pcode == 3) { + // format parameters + p[0] = 3; + p[1] = 22; + p[3] = 1; + p[10] = tracksec >> 8; + p[11] = tracksec; + p[12] = hfd->ci.blocksize >> 8; + p[13] = hfd->ci.blocksize; + p[15] = 1; // interleave + p[20] = 0x80; + psize = p[1] + 2; + } else if (pcode == 4) { + // rigid drive geometry + p[0] = 4; + wl(p + 1, cyl); + p[1] = 22; + p[5] = head; + wl(p + 13, cyl); + ww(p + 20, 5400); + psize = p[1] + 2; + } else { + if (!pcodeloop) + goto err; + } + totalsize += psize; + p += psize; + if (!pcodeloop) + break; + if (pcode == 0) + break; + pcode++; + if (pcode == 0x3f) + pcode = 0; + } + + if (sense10) { + totalsize += bdsize; + r[6] = bdsize >> 8; + r[7] = bdsize & 0xff; + r[0] = totalsize >> 8; + r[1] = totalsize & 0xff; + } else { + totalsize += bdsize; + r[3] = (uae_u8)bdsize; + r[0] = (uae_u8)totalsize; + } + + scsi_len = lr = totalsize + 1; + if (scsi_len > alen) + scsi_len = alen; + if (lr > alen) + lr = alen; + break; } - else { - goto err; - } - r[0] += r[3]; - scsi_len = lr = r[0] + 1; - if (scsi_len > alen) - scsi_len = alen; break; - } - break; case 0x1d: /* SEND DIAGNOSTICS */ break; - case 0x25: /* READ_CAPACITY */ - { - int pmi = cmdbuf[8] & 1; - uae_u32 lba = (cmdbuf[2] << 24) | (cmdbuf[3] << 16) | (cmdbuf[4] << 8) | cmdbuf[5]; - uae_u32 blocks; - int cyl, cylsec, head, tracksec; - if (nodisk(hfd)) + case 0x25: /* READ CAPACITY */ + { + int pmi = cmdbuf[8] & 1; + uae_u32 lba = (cmdbuf[2] << 24) | (cmdbuf[3] << 16) | (cmdbuf[4] << 8) | cmdbuf[5]; + uae_u32 blocks; + int cyl, head, tracksec; + if (nodisk (hfd)) + goto nodisk; + blocks = (uae_u32)(hfd->virtsize / hfd->ci.blocksize); + if (hdhfd) { + cyl = hdhfd->cyls; + head = hdhfd->heads; + tracksec = hdhfd->secspertrack; + } else { + int cylsec; + getchsx (hfd, &cyl, &cylsec, &head, &tracksec); + } + if (pmi == 0 && lba != 0) + goto errreq; + if (pmi) { + lba += tracksec * head; + lba /= tracksec * head; + lba *= tracksec * head; + if (lba > blocks) + lba = blocks; + blocks = lba; + } + wl (r, blocks - 1); + wl (r + 4, hfd->ci.blocksize); + scsi_len = lr = 8; + } + break; + case 0x2b: /* SEEK (10) */ + if (nodisk (hfd)) goto nodisk; - blocks = (uae_u32)(hfd->virtsize / hfd->ci.blocksize - 1); - if (hdhfd) { - cyl = hdhfd->cyls; - head = hdhfd->heads; - tracksec = hdhfd->secspertrack; - cylsec = 0; - } - else { - getchsx(hfd, &cyl, &cylsec, &head, &tracksec); - } - if (pmi == 0 && lba != 0) - goto errreq; - if (pmi) { - lba += tracksec * head; - lba /= tracksec * head; - lba *= tracksec * head; - if (lba > blocks) - lba = blocks; - blocks = lba; - } - wl(r, blocks); - wl(r + 4, hfd->ci.blocksize); - scsi_len = lr = 8; - } - break; - case 0x28: /* READ (10) */ - if (nodisk(hfd)) - goto nodisk; - offset = rl(cmdbuf + 2); + offset = rl (cmdbuf + 2); + current_lba = offset; offset *= hfd->ci.blocksize; - len = rl(cmdbuf + 7 - 2) & 0xffff; + chkerr = checkbounds(hfd, offset, hfd->ci.blocksize, 3); + if (chkerr) + goto checkfail; + scsi_len = 0; + break; + case 0x28: /* READ (10) */ + if (nodisk (hfd)) + goto nodisk; + offset = rl (cmdbuf + 2); + current_lba = offset; + offset *= hfd->ci.blocksize; + len = rl (cmdbuf + 7 - 2) & 0xffff; len *= hfd->ci.blocksize; - if (!checkbounds(hfd, offset, len)) - goto outofbounds; - scsi_len = (uae_u32)cmd_readx(hfd, scsi_data, offset, len); + chkerr = checkbounds(hfd, offset, len, 1); + if (chkerr) + goto checkfail; + scsi_len = (uae_u32)cmd_readx (hfd, scsi_data, offset, len); break; case 0x2a: /* WRITE (10) */ - if (nodisk(hfd)) + if (nodisk (hfd)) goto nodisk; - if (hfd->ci.readonly || hfd->dangerous) + if (is_writeprotected(hfd)) goto readprot; - offset = rl(cmdbuf + 2); + offset = rl (cmdbuf + 2); + current_lba = offset; offset *= hfd->ci.blocksize; - len = rl(cmdbuf + 7 - 2) & 0xffff; + len = rl (cmdbuf + 7 - 2) & 0xffff; len *= hfd->ci.blocksize; - if (!checkbounds(hfd, offset, len)) - goto outofbounds; - scsi_len = (uae_u32)cmd_writex(hfd, scsi_data, offset, len); + chkerr = checkbounds(hfd, offset, len, 2); + if (chkerr) + goto checkfail; + scsi_len = (uae_u32)cmd_writex (hfd, scsi_data, offset, len); break; case 0x2f: /* VERIFY (10) */ - { - int bytchk = cmdbuf[1] & 2; - if (nodisk(hfd)) - goto nodisk; - if (bytchk) { - offset = rl(cmdbuf + 2); - offset *= hfd->ci.blocksize; - len = rl(cmdbuf + 7 - 2) & 0xffff; - len *= hfd->ci.blocksize; - uae_u8 *vb = xmalloc(uae_u8, hfd->ci.blocksize); - if (checkbounds(hfd, offset, len)) { + { + int bytchk = cmdbuf[1] & 2; + if (nodisk (hfd)) + goto nodisk; + if (bytchk) { + offset = rl (cmdbuf + 2); + current_lba = offset; + offset *= hfd->ci.blocksize; + len = rl (cmdbuf + 7 - 2) & 0xffff; + len *= hfd->ci.blocksize; + chkerr = checkbounds (hfd, offset, len, 1); + if (chkerr) + goto checkfail; + uae_u8 *vb = xmalloc(uae_u8, hfd->ci.blocksize); while (len > 0) { - int readlen = cmd_readx(hfd, vb, offset, hfd->ci.blocksize); - if (readlen != hfd->ci.blocksize || memcmp(vb, scsi_data, hfd->ci.blocksize)) { - xfree(vb); + int readlen = cmd_readx (hfd, vb, offset, hfd->ci.blocksize); + if (readlen != hfd->ci.blocksize || memcmp (vb, scsi_data, hfd->ci.blocksize)) { + xfree (vb); goto miscompare; } scsi_data += hfd->ci.blocksize; offset += hfd->ci.blocksize; len -= hfd->ci.blocksize; } + xfree (vb); } - xfree(vb); + scsi_len = 0; } - scsi_len = 0; - } - break; + break; case 0x35: /* SYNCRONIZE CACHE (10) */ - if (nodisk(hfd)) + if (nodisk (hfd)) goto nodisk; scsi_len = 0; break; case 0xa8: /* READ (12) */ - if (nodisk(hfd)) + if (nodisk (hfd)) goto nodisk; - offset = rl(cmdbuf + 2); + offset = rl (cmdbuf + 2); + current_lba = offset; offset *= hfd->ci.blocksize; - len = rl(cmdbuf + 6); + len = rl (cmdbuf + 6); len *= hfd->ci.blocksize; - if (!checkbounds(hfd, offset, len)) - goto outofbounds; - scsi_len = (uae_u32)cmd_readx(hfd, scsi_data, offset, len); + chkerr = checkbounds(hfd, offset, len, 1); + if (chkerr) + goto checkfail; + scsi_len = (uae_u32)cmd_readx (hfd, scsi_data, offset, len); break; case 0xaa: /* WRITE (12) */ - if (nodisk(hfd)) + if (nodisk (hfd)) goto nodisk; - if (hfd->ci.readonly || hfd->dangerous) + if (is_writeprotected(hfd)) goto readprot; - offset = rl(cmdbuf + 2); + offset = rl (cmdbuf + 2); + current_lba = offset; offset *= hfd->ci.blocksize; - len = rl(cmdbuf + 6); + len = rl (cmdbuf + 6); len *= hfd->ci.blocksize; - if (!checkbounds(hfd, offset, len)) - goto outofbounds; - scsi_len = (uae_u32)cmd_writex(hfd, scsi_data, offset, len); + chkerr = checkbounds(hfd, offset, len, 2); + if (chkerr) + goto checkfail; + scsi_len = (uae_u32)cmd_writex (hfd, scsi_data, offset, len); break; case 0x37: /* READ DEFECT DATA */ - if (nodisk(hfd)) + if (nodisk (hfd)) goto nodisk; - status = 2; /* CHECK CONDITION */ - s[0] = 0x70; - s[2] = 0; /* NO SENSE */ - s[12] = 0x1c; /* DEFECT LIST NOT FOUND */ - ls = 0x12; + scsi_len = lr = 4; + r[0] = 0; + r[1] = cmdbuf[1] & 0x1f; + r[2] = 0; + r[3] = 0; break; - case 0x1b: /* START/STOP UNIT */ + case 0xe0: /* RAM DIAGNOSTICS */ + case 0xe3: /* DRIVE DIAGNOSTIC */ + case 0xe4: /* CONTROLLER INTERNAL DIAGNOSTICS */ scsi_len = 0; break; - readprot: +readprot: status = 2; /* CHECK CONDITION */ s[0] = 0x70; s[2] = 7; /* DATA PROTECT */ s[12] = 0x27; /* WRITE PROTECTED */ ls = 0x12; + sasi_sense = 0x03; // write fault break; - nodisk: +nodisk: status = 2; /* CHECK CONDITION */ s[0] = 0x70; s[2] = 2; /* NOT READY */ s[12] = 0x3A; /* MEDIUM NOT PRESENT */ ls = 0x12; + sasi_sense = 0x04; // drive not ready break; default: - err: - write_log(_T("UAEHF: unsupported scsi command 0x%02X LUN=%d\n"), cmdbuf[0], lun); - errreq: - lr = -1; +err: + write_log (_T("UAEHF: unsupported scsi command 0x%02X LUN=%d\n"), cmdbuf[0], lun); +errreq: status = 2; /* CHECK CONDITION */ s[0] = 0x70; s[2] = 5; /* ILLEGAL REQUEST */ s[12] = 0x24; /* ILLEGAL FIELD IN CDB */ ls = 0x12; + sasi_sense = 0x22; // invalid parameter break; - outofbounds: - lr = -1; +checkfail: status = 2; /* CHECK CONDITION */ - s[0] = 0x70; - s[2] = 5; /* ILLEGAL REQUEST */ - s[12] = 0x21; /* LOGICAL BLOCK OUT OF RANGE */ + s[0] = 0x70 | ((current_lba != ~0) ? 0x80 : 0x00); + if (chkerr < 0) { + s[2] = 5; /* ILLEGAL REQUEST */ + s[12] = 0x21; /* LOGICAL BLOCK OUT OF RANGE */ + sasi_sense = 0x21; // illegal disk address + } else { + s[2] = 3; /* MEDIUM ERROR */ + if (chkerr == 1) { + s[12] = 0x11; /* Unrecovered Read Error */ + sasi_sense = 0x11; // uncorrectable data error + } + if (chkerr == 2) { + s[12] = 0x0c; /* Write Error */ + sasi_sense = 0x03; // write fault + } + } ls = 0x12; break; - miscompare: - lr = -1; +miscompare: status = 2; /* CHECK CONDITION */ - s[0] = 0x70; + s[0] = 0x70 | ((current_lba != ~0) ? 0x80 : 0x00); s[2] = 5; /* ILLEGAL REQUEST */ s[12] = 0x1d; /* MISCOMPARE DURING VERIFY OPERATION */ ls = 0x12; + sasi_sense = 0x11; // uncorrectable data error break; } +scsi_done: + + if (ls > 7) + s[7] = ls - 8; + *data_len = scsi_len; *reply_len = lr; - *sense_len = ls; if (ls > 0) { - memset(hfd->scsi_sense, 0, MAX_SCSI_SENSE); - memcpy(hfd->scsi_sense, s, ls); + if (omti || sasi) { + if (sasi_sense != 0) { + bool islba = (s[0] & 0x80) != 0; + ls = 4; + s[0] = sasi_sense | (islba ? 0x80 : 0x00); + s[1] = (lun & 1) << 5; + s[2] = 0; + s[3] = 0; + if (islba) { + s[1] |= (current_lba >> 16) & 31; + s[2] = (current_lba >> 8) & 255; + s[3] = (current_lba >> 0) & 255; + } + } + } else { + if (s[0] & 0x80) { + s[3] = (current_lba >> 24) & 255; + s[4] = (current_lba >> 16) & 255; + s[5] = (current_lba >> 8) & 255; + s[6] = (current_lba >> 0) & 255; + } + } + memset (hfd->scsi_sense, 0, MAX_SCSI_SENSE); + memcpy (hfd->scsi_sense, s, ls); } + *sense_len = ls; return status; } -static int handle_scsi(uaecptr request, struct hardfiledata *hfd) +static int handle_scsi (TrapContext *ctx, uae_u8 *iobuf, uaecptr request, struct hardfiledata *hfd, struct scsi_data *sd) { - uae_u32 acmd = get_long(request + 40); - uaecptr scsi_data = get_long(acmd + 0); - int scsi_len = get_long(acmd + 4); - uaecptr scsi_cmd = get_long(acmd + 12); - uae_u16 scsi_cmd_len = get_word(acmd + 16); - uae_u8 scsi_flags = get_byte(acmd + 20); - uaecptr scsi_sense = get_long(acmd + 22); - uae_u16 scsi_sense_len = get_word(acmd + 26); - uae_u8 cmd = get_byte(scsi_cmd); - uae_u8 cmdbuf[256]; - int status, ret = 0, reply_len, sense_len; - uae_u32 i; - uae_u8 reply[256], sense[256]; - uae_u8 *scsi_data_ptr = NULL; - addrbank *bank_data = &get_mem_bank(scsi_data); + int ret = 0; - if (bank_data && bank_data->check(scsi_data, scsi_len)) - scsi_data_ptr = bank_data->xlateaddr(scsi_data); - scsi_sense_len = (scsi_flags & 4) ? 4 : /* SCSIF_OLDAUTOSENSE */ + uae_u32 scsicmdaddr = get_long_host(iobuf + 40); + + uae_u8 scsicmd[30]; + trap_get_bytes(ctx, scsicmd, scsicmdaddr, sizeof scsicmd); + + uaecptr scsi_data = get_long_host(scsicmd + 0); + int scsi_len = get_long_host(scsicmd + 4); + uaecptr scsi_cmd = get_long_host(scsicmd + 12); + uae_u16 scsi_cmd_len = get_word_host(scsicmd + 16); + uae_u8 scsi_flags = get_byte_host(scsicmd + 20); + uaecptr scsi_sense = get_long_host(scsicmd + 22); + uae_u16 scsi_sense_len = get_word_host(scsicmd + 26); + uae_u8 cmd = trap_get_byte(ctx, scsi_cmd); + + scsi_sense_len = (scsi_flags & 4) ? 4 : /* SCSIF_OLDAUTOSENSE */ (scsi_flags & 2) ? scsi_sense_len : /* SCSIF_AUTOSENSE */ 32; - status = 0; - memset(reply, 0, sizeof reply); - reply_len = 0; sense_len = 0; - scsi_log(_T("hdf scsiemu: cmd=%02X,%d flags=%02X sense=%p,%d data=%p,%d\n"), + scsi_log (_T("hdf scsiemu: cmd=%02X,%d flags=%02X sense=%p,%d data=%p,%d\n"), cmd, scsi_cmd_len, scsi_flags, scsi_sense, scsi_sense_len, scsi_data, scsi_len); - for (i = 0; i < scsi_cmd_len; i++) { - cmdbuf[i] = get_byte(scsi_cmd + i); - scsi_log(_T("%02X%c"), get_byte(scsi_cmd + i), i < scsi_cmd_len - 1 ? '.' : ' '); + + sd->cmd_len = scsi_cmd_len; + sd->data_len = scsi_len; + + trap_get_bytes(ctx, sd->cmd, scsi_cmd, sd->cmd_len); + for (int i = 0; i < sd->cmd_len; i++) { + scsi_log (_T("%02X%c"), cmdbuf[i], i < sd->cmd_len - 1 ? '.' : ' '); } - scsi_log(_T("\n")); + scsi_log (_T("\n")); - status = scsi_hd_emulate(hfd, NULL, cmdbuf, scsi_cmd_len, scsi_data_ptr, &scsi_len, reply, &reply_len, sense, &sense_len); + scsi_emulate_analyze(sd); + scsi_start_transfer(sd); + if (sd->direction > 0) { + trap_get_bytes(ctx, sd->buffer, scsi_data, sd->data_len); + scsi_emulate_cmd(sd); + } else { + scsi_emulate_cmd(sd); + if (sd->direction < 0) + trap_put_bytes(ctx, sd->buffer, scsi_data, sd->data_len); + } - put_word(acmd + 18, status != 0 ? 0 : scsi_cmd_len); /* fake scsi_CmdActual */ - put_byte(acmd + 21, status); /* scsi_Status */ - if (reply_len > 0) { - scsi_log(_T("RD:")); - i = 0; - while (i < reply_len) { - if (i < 24) { - scsi_log(_T("%02X%c"), reply[i], i < reply_len - 1 ? '.' : ' '); - } - put_byte(scsi_data + i, reply[i]); + put_word_host(scsicmd + 18, sd->status != 0 ? 0 : sd->cmd_len); /* fake scsi_CmdActual */ + put_byte_host(scsicmd + 21, sd->status); /* scsi_Status */ + if (sd->reply_len > 0) { + trap_put_bytes(ctx, sd->reply, scsi_data, sd->reply_len); + scsi_log (_T("RD:")); + int i = 0; + while (i < sd->reply_len && i < 24) { + scsi_log (_T("%02X%c"), reply[i], i < reply_len - 1 ? '.' : ' '); i++; } - scsi_log(_T("\n")); + scsi_log (_T("\n")); } - i = 0; if (scsi_sense) { - while (i < sense_len && i < scsi_sense_len) { - put_byte(scsi_sense + i, sense[i]); - i++; + trap_put_bytes(ctx, sd->sense, scsi_sense, sd->sense_len < scsi_sense_len ? sd->sense_len : scsi_sense_len); + if (scsi_sense_len > sd->sense_len) { + trap_set_bytes(ctx, scsi_sense + sd->sense_len, 0, scsi_sense_len - sd->sense_len); } } - while (i < scsi_sense_len && scsi_sense) { - put_byte(scsi_sense + i, 0); - i++; - } - if (scsi_len < 0) { - put_long(acmd + 8, 0); /* scsi_Actual */ + if (sd->data_len < 0) { + put_long_host(scsicmd + 8, 0); /* scsi_Actual */ ret = 20; + } else { + put_long_host(scsicmd + 8, sd->data_len); /* scsi_Actual */ } - else { - put_long(acmd + 8, scsi_len); /* scsi_Actual */ - } + + trap_put_bytes(ctx, scsicmd, scsicmdaddr, sizeof scsicmd); return ret; } -void hardfile_send_disk_change(struct hardfiledata *hfd, bool insert) +void hardfile_send_disk_change (struct hardfiledata *hfd, bool insert) { int newstate = insert ? 0 : 1; - uae_sem_wait(&change_sem); + uae_sem_wait (&change_sem); hardfpd[hfd->unitnum].changenum++; - write_log(_T("uaehf.device:%d media status=%d changenum=%d\n"), hfd->unitnum, insert, hardfpd[hfd->unitnum].changenum); + write_log (_T("uaehf.device:%d media status=%d changenum=%d\n"), hfd->unitnum, insert, hardfpd[hfd->unitnum].changenum); hfd->drive_empty = newstate; int j = 0; while (j < MAX_ASYNC_REQUESTS) { if (hardfpd[hfd->unitnum].d_request_type[j] == ASYNC_REQUEST_CHANGEINT) { - uae_Cause(hardfpd[hfd->unitnum].d_request_data[j]); + uae_Cause (hardfpd[hfd->unitnum].d_request_data[j]); } j++; } if (hardfpd[hfd->unitnum].changeint) - uae_Cause(hardfpd[hfd->unitnum].changeint); - uae_sem_post(&change_sem); + uae_Cause (hardfpd[hfd->unitnum].changeint); + uae_sem_post (&change_sem); } -void hardfile_do_disk_change(struct uaedev_config_data *uci, bool insert) +void hardfile_do_disk_change (struct uaedev_config_data *uci, bool insert) { - int fsid = uci->configoffset; - struct hardfiledata *hfd; + int fsid = uci->configoffset; + struct hardfiledata *hfd; if (uci->ci.controller_type == HD_CONTROLLER_TYPE_PCMCIA) { if (uci->ci.controller_type_unit == 0) { - //gayle_modify_pcmcia_sram_unit(&uci->ci, insert); - } - else { - //gayle_modify_pcmcia_ide_unit(&uci->ci, insert); + gayle_modify_pcmcia_sram_unit (&uci->ci, insert); + } else { + gayle_modify_pcmcia_ide_unit (&uci->ci, insert); } return; } - hfd = get_hardfile_data(fsid); - if (!hfd) - return; - hardfile_send_disk_change(hfd, insert); + hfd = get_hardfile_data (fsid); + if (!hfd) + return; + hardfile_send_disk_change (hfd, insert); } -static int add_async_request(struct hardfileprivdata *hfpd, uaecptr request, int type, uae_u32 data) +static int add_async_request (struct hardfileprivdata *hfpd, uae_u8 *iobuf, uaecptr request, int type, uae_u32 data) { - int i; + int i; - i = 0; - while (i < MAX_ASYNC_REQUESTS) { - if (hfpd->d_request[i] == request) { - hfpd->d_request_type[i] = type; - hfpd->d_request_data[i] = data; - hf_log(_T("old async request %p (%d) added\n"), request, type); - return 0; - } - i++; - } - i = 0; - while (i < MAX_ASYNC_REQUESTS) { - if (hfpd->d_request[i] == 0) { - hfpd->d_request[i] = request; - hfpd->d_request_type[i] = type; - hfpd->d_request_data[i] = data; - hf_log(_T("async request %p (%d) added (total=%d)\n"), request, type, i); - return 0; - } - i++; - } - hf_log(_T("async request overflow %p!\n"), request); - return -1; + i = 0; + while (i < MAX_ASYNC_REQUESTS) { + if (hfpd->d_request[i] == request) { + hfpd->d_request_type[i] = type; + hfpd->d_request_data[i] = data; + hf_log (_T("old async request %p (%d) added\n"), request, type); + return 0; + } + i++; + } + i = 0; + while (i < MAX_ASYNC_REQUESTS) { + if (hfpd->d_request[i] == 0) { + hfpd->d_request[i] = request; + hfpd->d_request_iobuf[i] = iobuf; + hfpd->d_request_type[i] = type; + hfpd->d_request_data[i] = data; + hf_log (_T("async request %p (%d) added (total=%d)\n"), request, type, i); + return 0; + } + i++; + } + hf_log (_T("async request overflow %p!\n"), request); + return -1; } -static int release_async_request(struct hardfileprivdata *hfpd, uaecptr request) +static int release_async_request (struct hardfileprivdata *hfpd, uaecptr request) { - int i = 0; + int i = 0; - while (i < MAX_ASYNC_REQUESTS) { - if (hfpd->d_request[i] == request) { - int type = hfpd->d_request_type[i]; - hfpd->d_request[i] = 0; - hfpd->d_request_data[i] = 0; - hfpd->d_request_type[i] = 0; - hf_log(_T("async request %p removed\n"), request); - return type; - } - i++; - } - hf_log(_T("tried to remove non-existing request %p\n"), request); - return -1; + while (i < MAX_ASYNC_REQUESTS) { + if (hfpd->d_request[i] == request) { + int type = hfpd->d_request_type[i]; + hfpd->d_request[i] = 0; + xfree(hfpd->d_request_iobuf[i]); + hfpd->d_request_iobuf[i] = 0; + hfpd->d_request_data[i] = 0; + hfpd->d_request_type[i] = 0; + hf_log (_T("async request %p removed\n"), request); + return type; + } + i++; + } + hf_log (_T("tried to remove non-existing request %p\n"), request); + return -1; } -static void abort_async(struct hardfileprivdata *hfpd, uaecptr request, int errcode, int type) +static void abort_async (struct hardfileprivdata *hfpd, uaecptr request, int errcode, int type) { - int i; - hf_log(_T("aborting async request %p\n"), request); - i = 0; - while (i < MAX_ASYNC_REQUESTS) { - if (hfpd->d_request[i] == request && hfpd->d_request_type[i] == ASYNC_REQUEST_TEMP) { - /* ASYNC_REQUEST_TEMP = request is processing */ - sleep_millis(1); - i = 0; - continue; - } - i++; - } - i = release_async_request(hfpd, request); + int i; + hf_log (_T("aborting async request %p\n"), request); + i = 0; + while (i < MAX_ASYNC_REQUESTS) { + if (hfpd->d_request[i] == request && hfpd->d_request_type[i] == ASYNC_REQUEST_TEMP) { + /* ASYNC_REQUEST_TEMP = request is processing */ + sleep_millis (1); + i = 0; + continue; + } + i++; + } + i = release_async_request (hfpd, request); if (i >= 0) { - hf_log(_T("asyncronous request=%08X aborted, error=%d\n"), request, errcode); + hf_log (_T("asyncronous request=%08X aborted, error=%d\n"), request, errcode); } } -static void *hardfile_thread(void *devs); -static int start_thread(TrapContext *context, int unit) +static void *hardfile_thread (void *devs); +static int start_thread (TrapContext *ctx, int unit) { - struct hardfileprivdata *hfpd = &hardfpd[unit]; + struct hardfileprivdata *hfpd = &hardfpd[unit]; - if (hfpd->thread_running) - return 1; - memset(hfpd, 0, sizeof(struct hardfileprivdata)); - hfpd->base = m68k_areg(regs, 6); - init_comm_pipe(&hfpd->requests, 100, 1); - uae_sem_init(&hfpd->sync_sem, 0, 0); - uae_start_thread(_T("hardfile"), hardfile_thread, hfpd, NULL); - uae_sem_wait(&hfpd->sync_sem); - return hfpd->thread_running; + if (hfpd->thread_running) + return 1; + memset (hfpd, 0, sizeof (struct hardfileprivdata)); + hfpd->base = trap_get_areg(ctx, 6); + init_comm_pipe (&hfpd->requests, 300, 3); + uae_sem_init (&hfpd->sync_sem, 0, 0); + uae_start_thread (_T("hardfile"), hardfile_thread, hfpd, &(hfpd->thread_id)); + uae_sem_wait (&hfpd->sync_sem); + return hfpd->thread_running; } -static int mangleunit(int unit) +static int mangleunit (int unit) { - if (unit <= 99) - return unit; - if (unit == 100) - return 8; - if (unit == 110) - return 9; - return -1; + if (unit <= 99) + return unit; + if (unit == 100) + return 8; + if (unit == 110) + return 9; + return -1; } -static uae_u32 REGPARAM2 hardfile_open(TrapContext *context) +static uae_u32 REGPARAM2 hardfile_open (TrapContext *ctx) { - uaecptr ioreq = m68k_areg(regs, 1); /* IOReq */ - int unit = mangleunit(m68k_dreg(regs, 0)); - struct hardfileprivdata *hfpd = &hardfpd[unit]; - int err = IOERR_OPENFAIL; + uaecptr ioreq = trap_get_areg (ctx, 1); /* IOReq */ + int unit = mangleunit (trap_get_dreg(ctx, 0)); + int err = IOERR_OPENFAIL; /* boot device port size == 0!? KS 1.x size = 12??? - * Ignore message size, too many programs do not set it correct - * int size = get_word (ioreq + 0x12); - */ - /* Check unit number */ - if (unit >= 0) { - struct hardfiledata *hfd = get_hardfile_data(unit); - if (hfd && (hfd->handle_valid || hfd->drive_empty) && start_thread(context, unit)) { - put_word(hfpd->base + 32, get_word(hfpd->base + 32) + 1); - put_long(ioreq + 24, unit); /* io_Unit */ - put_byte(ioreq + 31, 0); /* io_Error */ - put_byte(ioreq + 8, 7); /* ln_type = NT_REPLYMSG */ - hf_log(_T("hardfile_open, unit %d (%d), OK\n"), unit, m68k_dreg(regs, 0)); - return 0; - } - } - if (unit < 1000 || is_hardfile(unit) == FILESYS_VIRTUAL || is_hardfile(unit) == FILESYS_CD) - err = 50; /* HFERR_NoBoard */ - hf_log(_T("hardfile_open, unit %d (%d), ERR=%d\n"), unit, m68k_dreg(regs, 0), err); - put_long(ioreq + 20, (uae_u32)err); - put_byte(ioreq + 31, (uae_u8)err); - return (uae_u32)err; + * Ignore message size, too many programs do not set it correct + * int size = get_word (ioreq + 0x12); + */ + /* Check unit number */ + if (unit >= 0 && unit < MAX_FILESYSTEM_UNITS) { + struct hardfileprivdata *hfpd = &hardfpd[unit]; + struct hardfiledata *hfd = get_hardfile_data (unit); + if (hfd && (hfd->handle_valid || hfd->drive_empty) && start_thread (ctx, unit)) { + trap_put_word(ctx, hfpd->base + 32, trap_get_word(ctx, hfpd->base + 32) + 1); + trap_put_long(ctx, ioreq + 24, unit); /* io_Unit */ + trap_put_byte(ctx, ioreq + 31, 0); /* io_Error */ + trap_put_byte(ctx, ioreq + 8, 7); /* ln_type = NT_REPLYMSG */ + if (!hfpd->sd) + hfpd->sd = scsi_alloc_generic(hfd, UAEDEV_HDF); + hf_log (_T("hardfile_open, unit %d (%d), OK\n"), unit, trap_get_dreg (ctx, 0)); + return 0; + } + } + if (unit < 1000 || is_hardfile(unit) == FILESYS_VIRTUAL) + err = 50; /* HFERR_NoBoard */ + hf_log (_T("hardfile_open, unit %d (%d), ERR=%d\n"), unit, trap_get_dreg(ctx, 0), err); + trap_put_long(ctx, ioreq + 20, (uae_u32)err); + trap_put_byte(ctx, ioreq + 31, (uae_u8)err); + return (uae_u32)err; } -static uae_u32 REGPARAM2 hardfile_close(TrapContext *context) +static uae_u32 REGPARAM2 hardfile_close (TrapContext *ctx) { - uaecptr request = m68k_areg(regs, 1); /* IOReq */ - int unit = mangleunit(get_long(request + 24)); - struct hardfileprivdata *hfpd = &hardfpd[unit]; - - if (!hfpd) + uaecptr request = trap_get_areg (ctx, 1); /* IOReq */ + int unit = mangleunit (trap_get_long(ctx, request + 24)); + if (unit < 0 || unit >= MAX_FILESYSTEM_UNITS) { return 0; - put_word(hfpd->base + 32, get_word(hfpd->base + 32) - 1); - if (get_word(hfpd->base + 32) == 0) - write_comm_pipe_u32(&hfpd->requests, 0, 1); - return 0; + } + struct hardfileprivdata *hfpd = &hardfpd[unit]; + + if (!hfpd) + return 0; + trap_put_word(ctx, hfpd->base + 32, trap_get_word(ctx, hfpd->base + 32) - 1); + if (trap_get_word(ctx, hfpd->base + 32) == 0) { + scsi_free(hfpd->sd); + hfpd->sd = NULL; + write_comm_pipe_pvoid(&hfpd->requests, NULL, 0); + write_comm_pipe_pvoid(&hfpd->requests, NULL, 0); + write_comm_pipe_u32 (&hfpd->requests, 0, 1); + } + return 0; } -static uae_u32 REGPARAM2 hardfile_expunge(TrapContext *context) +static uae_u32 REGPARAM2 hardfile_expunge (TrapContext *context) { - return 0; /* Simply ignore this one... */ + return 0; /* Simply ignore this one... */ } -static void outofbounds(int cmd, uae_u64 offset, uae_u64 len, uae_u64 max) +static void outofbounds (int cmd, uae_u64 offset, uae_u64 len, uae_u64 max) { - write_log(_T("UAEHF: cmd %d: out of bounds, %08X-%08X + %08X-%08X > %08X-%08X\n"), cmd, - (uae_u32)(offset >> 32), (uae_u32)offset, (uae_u32)(len >> 32), (uae_u32)len, - (uae_u32)(max >> 32), (uae_u32)max); + write_log (_T("UAEHF: cmd %d: out of bounds, %08X-%08X + %08X-%08X > %08X-%08X\n"), cmd, + (uae_u32)(offset >> 32),(uae_u32)offset,(uae_u32)(len >> 32),(uae_u32)len, + (uae_u32)(max >> 32),(uae_u32)max); } -static void unaligned(int cmd, uae_u64 offset, uae_u64 len, int blocksize) +static void unaligned (int cmd, uae_u64 offset, uae_u64 len, int blocksize) { - write_log(_T("UAEHF: cmd %d: unaligned access, %08X-%08X, %08X-%08X, %08X\n"), cmd, - (uae_u32)(offset >> 32), (uae_u32)offset, (uae_u32)(len >> 32), (uae_u32)len, - blocksize); + write_log (_T("UAEHF: cmd %d: unaligned access, %08X-%08X, %08X-%08X, %08X\n"), cmd, + (uae_u32)(offset >> 32),(uae_u32)offset,(uae_u32)(len >> 32),(uae_u32)len, + blocksize); } -static uae_u32 hardfile_do_io(struct hardfiledata *hfd, struct hardfileprivdata *hfpd, uaecptr request) +static uae_u32 hardfile_do_io (TrapContext *ctx, struct hardfiledata *hfd, struct hardfileprivdata *hfpd, uae_u8 *iobuf, uaecptr request) { - uae_u32 dataptr, offset, actual = 0, cmd; - uae_u64 offset64; - int unit = get_long(request + 24); - uae_u32 error = 0, len; - int async = 0; + uae_u32 dataptr, offset, actual = 0, cmd; + uae_u64 offset64; + int unit; + uae_u32 error = 0, len; + int async = 0; int bmask = hfd->ci.blocksize - 1; - cmd = get_word(request + 28); /* io_Command */ - dataptr = get_long(request + 40); - switch (cmd) - { + unit = get_long_host(iobuf + 24); + cmd = get_word_host(iobuf + 28); /* io_Command */ + dataptr = get_long_host(iobuf + 40); + switch (cmd) + { case CMD_READ: - if (nodisk(hfd)) - goto no_disk; - offset = get_long(request + 44); - len = get_long(request + 36); /* io_Length */ + if (nodisk (hfd)) + goto no_disk; + offset = get_long_host(iobuf + 44); + len = get_long_host(iobuf + 36); /* io_Length */ if (offset & bmask) { - unaligned(cmd, offset, len, hfd->ci.blocksize); - goto bad_command; - } - if (len & bmask) { - unaligned(cmd, offset, len, hfd->ci.blocksize); - goto bad_len; - } - if (len + offset > hfd->virtsize) { - outofbounds(cmd, offset, len, hfd->virtsize); - goto bad_len; - } - actual = (uae_u32)cmd_read(hfd, dataptr, offset, len); - break; + unaligned (cmd, offset, len, hfd->ci.blocksize); + goto bad_command; + } + if (len & bmask) { + unaligned (cmd, offset, len, hfd->ci.blocksize); + goto bad_len; + } + if (len + offset > hfd->virtsize) { + outofbounds (cmd, offset, len, hfd->virtsize); + goto bad_len; + } + actual = (uae_u32)cmd_read(ctx, hfd, dataptr, offset, len); + break; case TD_READ64: case NSCMD_TD_READ64: - if (nodisk(hfd)) - goto no_disk; - offset64 = get_long(request + 44) | ((uae_u64)get_long(request + 32) << 32); - len = get_long(request + 36); /* io_Length */ + if (nodisk (hfd)) + goto no_disk; + offset64 = get_long_host(iobuf + 44) | ((uae_u64)get_long_host(iobuf + 32) << 32); + len = get_long_host(iobuf + 36); /* io_Length */ if (offset64 & bmask) { - unaligned(cmd, offset64, len, hfd->ci.blocksize); - goto bad_command; - } - if (len & bmask) { - unaligned(cmd, offset64, len, hfd->ci.blocksize); - goto bad_len; - } - if (len + offset64 > hfd->virtsize) { - outofbounds(cmd, offset64, len, hfd->virtsize); - goto bad_len; - } - actual = (uae_u32)cmd_read(hfd, dataptr, offset64, len); - break; + unaligned (cmd, offset64, len, hfd->ci.blocksize); + goto bad_command; + } + if (len & bmask) { + unaligned (cmd, offset64, len, hfd->ci.blocksize); + goto bad_len; + } + if (len + offset64 > hfd->virtsize || (uae_s64)offset64 < 0) { + outofbounds (cmd, offset64, len, hfd->virtsize); + goto bad_len; + } + actual = (uae_u32)cmd_read(ctx, hfd, dataptr, offset64, len); + break; case CMD_WRITE: case CMD_FORMAT: /* Format */ - if (nodisk(hfd)) - goto no_disk; - if (hfd->ci.readonly || hfd->dangerous) { - error = 28; /* write protect */ - } - else { - offset = get_long(request + 44); - len = get_long(request + 36); /* io_Length */ + if (nodisk (hfd)) + goto no_disk; + if (is_writeprotected(hfd)) { + error = 28; /* write protect */ + } else { + offset = get_long_host(iobuf + 44); + len = get_long_host(iobuf + 36); /* io_Length */ if (offset & bmask) { - unaligned(cmd, offset, len, hfd->ci.blocksize); - goto bad_command; - } - if (len & bmask) { - unaligned(cmd, offset, len, hfd->ci.blocksize); - goto bad_len; - } - if (len + offset > hfd->virtsize) { - outofbounds(cmd, offset, len, hfd->virtsize); - goto bad_len; - } - actual = (uae_u32)cmd_write(hfd, dataptr, offset, len); - } - break; + unaligned (cmd, offset, len, hfd->ci.blocksize); + goto bad_command; + } + if (len & bmask) { + unaligned (cmd, offset, len, hfd->ci.blocksize); + goto bad_len; + } + if (len + offset > hfd->virtsize) { + outofbounds (cmd, offset, len, hfd->virtsize); + goto bad_len; + } + actual = (uae_u32)cmd_write(ctx, hfd, dataptr, offset, len); + } + break; case TD_WRITE64: case TD_FORMAT64: case NSCMD_TD_WRITE64: case NSCMD_TD_FORMAT64: - if (nodisk(hfd)) - goto no_disk; - if (hfd->ci.readonly || hfd->dangerous) { - error = 28; /* write protect */ - } - else { - offset64 = get_long(request + 44) | ((uae_u64)get_long(request + 32) << 32); - len = get_long(request + 36); /* io_Length */ + if (nodisk (hfd)) + goto no_disk; + if (is_writeprotected(hfd)) { + error = 28; /* write protect */ + } else { + offset64 = get_long_host(iobuf + 44) | ((uae_u64)get_long_host(iobuf + 32) << 32); + len = get_long_host(iobuf + 36); /* io_Length */ if (offset64 & bmask) { - unaligned(cmd, offset64, len, hfd->ci.blocksize); - goto bad_command; - } - if (len & bmask) { - unaligned(cmd, offset64, len, hfd->ci.blocksize); - goto bad_len; - } - if (len + offset64 > hfd->virtsize) { - outofbounds(cmd, offset64, len, hfd->virtsize); - goto bad_len; - } - actual = (uae_u32)cmd_write(hfd, dataptr, offset64, len); - } - break; + unaligned (cmd, offset64, len, hfd->ci.blocksize); + goto bad_command; + } + if (len & bmask) { + unaligned (cmd, offset64, len, hfd->ci.blocksize); + goto bad_len; + } + if (len + offset64 > hfd->virtsize || (uae_s64)offset64 < 0) { + outofbounds (cmd, offset64, len, hfd->virtsize); + goto bad_len; + } + actual = (uae_u32)cmd_write(ctx, hfd, dataptr, offset64, len); + } + break; case NSCMD_DEVICEQUERY: - put_long(dataptr + 0, 0); - put_long(dataptr + 4, 16); /* size */ - put_word(dataptr + 8, NSDEVTYPE_TRACKDISK); - put_word(dataptr + 10, 0); - put_long(dataptr + 12, nscmd_cmd); - actual = 16; - break; + trap_put_long(ctx, dataptr + 0, 0); + trap_put_long(ctx, dataptr + 4, 16); /* size */ + trap_put_word(ctx, dataptr + 8, NSDEVTYPE_TRACKDISK); + trap_put_word(ctx, dataptr + 10, 0); + trap_put_long(ctx, dataptr + 12, nscmd_cmd); + actual = 16; + break; case CMD_GETDRIVETYPE: - actual = DRIVE_NEWSTYLE; - break; + actual = DRIVE_NEWSTYLE; + break; case CMD_GETNUMTRACKS: - { - int cyl, cylsec, head, tracksec; - getchsx(hfd, &cyl, &cylsec, &head, &tracksec); - actual = cyl * head; - break; - } + { + int cyl, cylsec, head, tracksec; + getchsx (hfd, &cyl, &cylsec, &head, &tracksec); + actual = cyl * head; + break; + } case CMD_GETGEOMETRY: - { - int cyl, cylsec, head, tracksec; - uae_u64 size; - getchsx(hfd, &cyl, &cylsec, &head, &tracksec); - put_long(dataptr + 0, hfd->ci.blocksize); - size = hfd->virtsize / hfd->ci.blocksize; - if (size > 0x00ffffffff) - size = 0xffffffff; - put_long(dataptr + 4, (uae_u32)size); - put_long(dataptr + 8, cyl); - put_long(dataptr + 12, cylsec); - put_long(dataptr + 16, head); - put_long(dataptr + 20, tracksec); - put_long(dataptr + 24, 0); /* bufmemtype */ - put_byte(dataptr + 28, 0); /* type = DG_DIRECT_ACCESS */ - put_byte(dataptr + 29, 0); /* flags */ - } - break; + { + int cyl, cylsec, head, tracksec; + uae_u64 size; + getchsx (hfd, &cyl, &cylsec, &head, &tracksec); + trap_put_long(ctx, dataptr + 0, hfd->ci.blocksize); + size = hfd->virtsize / hfd->ci.blocksize; + if (size > 0x00ffffffff) + size = 0xffffffff; + trap_put_long(ctx, dataptr + 4, (uae_u32)size); + trap_put_long(ctx, dataptr + 8, cyl); + trap_put_long(ctx, dataptr + 12, cylsec); + trap_put_long(ctx, dataptr + 16, head); + trap_put_long(ctx, dataptr + 20, tracksec); + trap_put_long(ctx, dataptr + 24, 0); /* bufmemtype */ + trap_put_byte(ctx, dataptr + 28, 0); /* type = DG_DIRECT_ACCESS */ + trap_put_byte(ctx, dataptr + 29, 0); /* flags */ + } + break; case CMD_PROTSTATUS: - if (hfd->ci.readonly || hfd->dangerous) - actual = -1; - else - actual = 0; - break; + if (is_writeprotected(hfd)) + actual = -1; + else + actual = 0; + break; case CMD_CHANGESTATE: - actual = hfd->drive_empty ? 1 : 0; - break; + actual = hfd->drive_empty ? 1 :0; + break; - /* Some commands that just do nothing and return zero */ + /* Some commands that just do nothing and return zero */ case CMD_UPDATE: case CMD_CLEAR: case CMD_MOTOR: case CMD_SEEK: case TD_SEEK64: case NSCMD_TD_SEEK64: - break; + break; case CMD_REMOVE: - hfpd->changeint = get_long(request + 40); - break; + hfpd->changeint = get_long (request + 40); + break; case CMD_CHANGENUM: - actual = hfpd->changenum; - break; + actual = hfpd->changenum; + break; case CMD_ADDCHANGEINT: - error = add_async_request(hfpd, request, ASYNC_REQUEST_CHANGEINT, get_long(request + 40)); - if (!error) - async = 1; - break; + error = add_async_request (hfpd, iobuf, request, ASYNC_REQUEST_CHANGEINT, get_long_host(iobuf + 40)); + if (!error) + async = 1; + break; case CMD_REMCHANGEINT: - release_async_request(hfpd, request); - break; - + release_async_request (hfpd, request); + break; + case HD_SCSICMD: /* SCSI */ if (!hfd->ci.sectors && !hfd->ci.surfaces && !hfd->ci.reserved) { - error = handle_scsi(request, hfd); + error = handle_scsi(ctx, iobuf, request, hfd, hfpd->sd); + } else { /* we don't want users trashing their "partition" hardfiles with hdtoolbox */ + error = IOERR_NOCMD; + write_log (_T("UAEHF: HD_SCSICMD tried on regular HDF, unit %d\n"), unit); } - else { /* we don't want users trashing their "partition" hardfiles with hdtoolbox */ - error = IOERR_NOCMD; - write_log(_T("UAEHF: HD_SCSICMD tried on regular HDF, unit %d\n"), unit); - } - break; + break; case CD_EJECT: if (hfd->ci.sectors && hfd->ci.surfaces) { - int len = get_long(request + 36); + int len = get_long_host(iobuf + 36); if (len) { if (hfd->drive_empty) { - hardfile_media_change(hfd, NULL, true, false); + hardfile_media_change (hfd, NULL, true, false); + } else { + hardfile_media_change (hfd, NULL, false, false); } - else { - hardfile_media_change(hfd, NULL, false, false); - } - } - else { + } else { if (hfd->drive_empty) { - hardfile_media_change(hfd, NULL, true, false); + hardfile_media_change (hfd, NULL, true, false); } } - } - else { - error = IOERR_NOCMD; + } else { + error = IOERR_NOCMD; } break; - bad_command: +bad_command: error = IOERR_BADADDRESS; break; - bad_len: +bad_len: error = IOERR_BADLENGTH; break; - no_disk: +no_disk: error = 29; /* no disk */ break; default: - /* Command not understood. */ - error = IOERR_NOCMD; - break; - } - put_long(request + 32, actual); - put_byte(request + 31, error); + /* Command not understood. */ + error = IOERR_NOCMD; + break; + } + put_long_host(iobuf + 32, actual); + put_byte_host(iobuf + 31, error); - hf_log2(_T("hf: unit=%d, request=%p, cmd=%d offset=%u len=%d, actual=%d error%=%d\n"), unit, request, - get_word(request + 28), get_long(request + 44), get_long(request + 36), actual, error); - - return async; + hf_log2 (_T("hf: unit=%d, request=%p, cmd=%d offset=%u len=%d, actual=%d error%=%d\n"), unit, request, + get_word_host(iobuf + 28), get_long_host(iobuf + 44), get_long_host(iobuf + 36), actual, error); + + return async; } -static uae_u32 REGPARAM2 hardfile_abortio(TrapContext *context) +static uae_u32 REGPARAM2 hardfile_abortio (TrapContext *ctx) { - uae_u32 request = m68k_areg(regs, 1); - int unit = mangleunit(get_long(request + 24)); - struct hardfiledata *hfd = get_hardfile_data(unit); - struct hardfileprivdata *hfpd = &hardfpd[unit]; + uae_u32 request = trap_get_areg (ctx, 1); + int unit = mangleunit (trap_get_long(ctx, request + 24)); +struct hardfiledata *hfd = get_hardfile_data (unit); + struct hardfileprivdata *hfpd = &hardfpd[unit]; - hf_log2(_T("uaehf.device abortio ")); - start_thread(context, unit); - if (!hfd || !hfpd || !hfpd->thread_running) { - put_byte(request + 31, 32); - hf_log2(_T("error\n")); - return get_byte(request + 31); - } - put_byte(request + 31, -2); - hf_log2(_T("unit=%d, request=%08X\n"), unit, request); - abort_async(hfpd, request, -2, 0); - return 0; + hf_log2 (_T("uaehf.device abortio ")); + start_thread(ctx, unit); + if (!hfd || !hfpd || !hfpd->thread_running) { + trap_put_byte(ctx, request + 31, 32); + hf_log2 (_T("error\n")); + return trap_get_byte(ctx, request + 31); + } + trap_put_byte(ctx, request + 31, -2); + hf_log2 (_T("unit=%d, request=%08X\n"), unit, request); + abort_async (hfpd, request, -2, 0); + return 0; } -static int hardfile_can_quick(uae_u32 command) +static int hardfile_can_quick (uae_u32 command) { - switch (command) - { - case CMD_REMCHANGEINT: - return -1; - case CMD_RESET: - case CMD_STOP: - case CMD_START: - case CMD_CHANGESTATE: - case CMD_PROTSTATUS: - case CMD_MOTOR: - case CMD_GETDRIVETYPE: - case CMD_GETGEOMETRY: - case CMD_GETNUMTRACKS: - case NSCMD_DEVICEQUERY: - return 1; - } - return 0; + switch (command) + { + case CMD_REMCHANGEINT: + return -1; + case CMD_RESET: + case CMD_STOP: + case CMD_START: + case CMD_CHANGESTATE: + case CMD_PROTSTATUS: + case CMD_MOTOR: + case CMD_GETDRIVETYPE: + case CMD_GETGEOMETRY: + case CMD_GETNUMTRACKS: + case NSCMD_DEVICEQUERY: + return 1; + } + return 0; } -static int hardfile_canquick(struct hardfiledata *hfd, uaecptr request) +static int hardfile_canquick (TrapContext *ctx, struct hardfiledata *hfd, uae_u8 *iobuf) { - uae_u32 command = get_word(request + 28); - return hardfile_can_quick(command); + uae_u32 command = get_word_host(iobuf + 28); + return hardfile_can_quick (command); } -static uae_u32 REGPARAM2 hardfile_beginio(TrapContext *context) +static uae_u32 REGPARAM2 hardfile_beginio (TrapContext *ctx) { - uae_u32 request = m68k_areg(regs, 1); - uae_u8 flags = get_byte(request + 30); - int cmd = get_word(request + 28); - int unit = mangleunit(get_long(request + 24)); - struct hardfiledata *hfd = get_hardfile_data(unit); - struct hardfileprivdata *hfpd = &hardfpd[unit]; int canquick; + uae_u32 request = trap_get_areg(ctx, 1); - put_byte(request + 8, NT_MESSAGE); - start_thread(context, unit); - if (!hfd || !hfpd || !hfpd->thread_running) { - put_byte(request + 31, 32); - return get_byte(request + 31); - } - put_byte(request + 31, 0); - canquick = hardfile_canquick(hfd, request); + uae_u8 *iobuf = xmalloc(uae_u8, 48); + + trap_get_bytes(ctx, iobuf, request, 48); + + uae_u8 flags = get_byte_host(iobuf + 30); + int cmd = get_word_host(iobuf + 28); + int unit = mangleunit(get_long_host(iobuf + 24)); + + struct hardfiledata *hfd = get_hardfile_data (unit); + struct hardfileprivdata *hfpd = &hardfpd[unit]; + + put_byte_host(iobuf + 8, NT_MESSAGE); + start_thread(ctx, unit); + if (!hfd || !hfpd || !hfpd->thread_running) { + put_byte_host(iobuf + 31, 32); + uae_u8 v = get_byte_host(iobuf + 31); + trap_put_bytes(ctx, iobuf + 8, request + 8, 48 - 8); + xfree(iobuf); + return v; + } + put_byte_host(iobuf + 31, 0); + canquick = hardfile_canquick(ctx, hfd, iobuf); if (((flags & 1) && canquick) || (canquick < 0)) { - hf_log(_T("hf quickio unit=%d request=%p cmd=%d\n"), unit, request, cmd); - if (hardfile_do_io(hfd, hfpd, request)) { - hf_log2(_T("uaehf.device cmd %d bug with IO_QUICK\n"), cmd); + hf_log (_T("hf quickio unit=%d request=%p cmd=%d\n"), unit, request, cmd); + if (hardfile_do_io(ctx, hfd, hfpd, iobuf, request)) { + hf_log2 (_T("uaehf.device cmd %d bug with IO_QUICK\n"), cmd); } + uae_u8 v = get_byte_host(iobuf + 31); + trap_put_bytes(ctx, iobuf + 8, request + 8, 48 - 8); + xfree(iobuf); if (!(flags & 1)) - uae_ReplyMsg(request); - return get_byte(request + 31); - } - else { - hf_log2(_T("hf asyncio unit=%d request=%p cmd=%d\n"), unit, request, cmd); - add_async_request(hfpd, request, ASYNC_REQUEST_TEMP, 0); - put_byte(request + 30, get_byte(request + 30) & ~1); - write_comm_pipe_u32(&hfpd->requests, request, 1); - return 0; - } + uae_ReplyMsg (request); + return v; + } else { + hf_log2 (_T("hf asyncio unit=%d request=%p cmd=%d\n"), unit, request, cmd); + add_async_request(hfpd, iobuf, request, ASYNC_REQUEST_TEMP, 0); + put_byte_host(iobuf + 30, get_byte_host(iobuf + 30) & ~1); + trap_put_bytes(ctx, iobuf + 8, request + 8, 48 - 8); + write_comm_pipe_pvoid(&hfpd->requests, ctx, 0); + write_comm_pipe_pvoid(&hfpd->requests, iobuf, 0); + write_comm_pipe_u32 (&hfpd->requests, request, 1); + return 0; + } } -static void *hardfile_thread(void *devs) +static void *hardfile_thread (void *devs) { - struct hardfileprivdata *hfpd = (struct hardfileprivdata*)devs; + struct hardfileprivdata *hfpd = (struct hardfileprivdata *)devs; - uae_set_thread_priority(NULL, 1); - hfpd->thread_running = 1; - uae_sem_post(&hfpd->sync_sem); - for (;;) { - uaecptr request = (uaecptr)read_comm_pipe_u32_blocking(&hfpd->requests); - uae_sem_wait(&change_sem); - if (!request) { - hfpd->thread_running = 0; - uae_sem_post(&hfpd->sync_sem); - uae_sem_post(&change_sem); - return 0; - } - else if (hardfile_do_io(get_hardfile_data(hfpd - &hardfpd[0]), hfpd, request) == 0) { - put_byte(request + 30, get_byte(request + 30) & ~1); - release_async_request(hfpd, request); - uae_ReplyMsg(request); - } - else { - hf_log2(_T("async request %08X\n"), request); - } - uae_sem_post(&change_sem); - } + uae_set_thread_priority (NULL, 1); + hfpd->thread_running = 1; + uae_sem_post (&hfpd->sync_sem); + for (;;) { + TrapContext *ctx = (TrapContext*)read_comm_pipe_pvoid_blocking(&hfpd->requests); + uae_u8 *iobuf = (uae_u8*)read_comm_pipe_pvoid_blocking(&hfpd->requests); + uaecptr request = (uaecptr)read_comm_pipe_u32_blocking (&hfpd->requests); + uae_sem_wait (&change_sem); + if (!request) { + hfpd->thread_running = 0; + uae_sem_post (&hfpd->sync_sem); + uae_sem_post (&change_sem); + return 0; + } else if (hardfile_do_io(ctx, get_hardfile_data (hfpd - &hardfpd[0]), hfpd, iobuf, request) == 0) { + put_byte_host(iobuf + 30, get_byte_host(iobuf + 30) & ~1); + trap_put_bytes(ctx, iobuf + 8, request + 8, 48 - 8); + release_async_request (hfpd, request); + uae_ReplyMsg (request); + } else { + hf_log2 (_T("async request %08X\n"), request); + trap_put_bytes(ctx, iobuf + 8, request + 8, 48 - 8); + } + uae_sem_post (&change_sem); + } } -void hardfile_reset(void) +void hardfile_reset (void) { - int i, j; - struct hardfileprivdata *hfpd; + int i, j; + struct hardfileprivdata *hfpd; - for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) { - hfpd = &hardfpd[i]; - if (hfpd->base && valid_address(hfpd->base, 36) && get_word(hfpd->base + 32) > 0) { - for (j = 0; j < MAX_ASYNC_REQUESTS; j++) { - uaecptr request; - if ((request = hfpd->d_request[i])) - abort_async(hfpd, request, 0, 0); - } - } - memset(hfpd, 0, sizeof(struct hardfileprivdata)); - } + for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) { + hfpd = &hardfpd[i]; + if (hfpd->base && valid_address(hfpd->base, 36) && get_word(hfpd->base + 32) > 0) { + for (j = 0; j < MAX_ASYNC_REQUESTS; j++) { + uaecptr request; + if ((request = hfpd->d_request[j])) + abort_async (hfpd, request, 0, 0); + } + } + + if(hfpd->thread_running) { + write_comm_pipe_pvoid(&hfpd->requests, NULL, 0); + write_comm_pipe_pvoid(&hfpd->requests, NULL, 0); + write_comm_pipe_u32 (&hfpd->requests, 0, 1); + while(hfpd->thread_running) + sleep_millis(10); + if(hfpd->sync_sem != 0) + uae_sem_destroy(&hfpd->sync_sem); + hfpd->sync_sem = 0; + } + if(hfpd->requests.size == 300) { + destroy_comm_pipe(&hfpd->requests); + hfpd->requests.size = 0; + } + + memset (hfpd, 0, sizeof (struct hardfileprivdata)); + } } -void hardfile_install(void) +void hardfile_install (void) { - uae_u32 functable, datatable; - uae_u32 initcode, openfunc, closefunc, expungefunc; - uae_u32 beginiofunc, abortiofunc; + uae_u32 functable, datatable; + uae_u32 initcode, openfunc, closefunc, expungefunc; + uae_u32 beginiofunc, abortiofunc; - uae_sem_init(&change_sem, 0, 1); + if(change_sem != 0) { + uae_sem_destroy(&change_sem); + change_sem = 0; + } + uae_sem_init (&change_sem, 0, 1); - ROM_hardfile_resname = ds(_T("uaehf.device")); - ROM_hardfile_resid = ds(_T("UAE hardfile.device 0.3")); + ROM_hardfile_resname = ds (_T("uaehf.device")); + ROM_hardfile_resid = ds (_T("UAE hardfile.device 0.4")); - nscmd_cmd = here(); - dw(NSCMD_DEVICEQUERY); - dw(CMD_RESET); - dw(CMD_READ); - dw(CMD_WRITE); - dw(CMD_UPDATE); - dw(CMD_CLEAR); - dw(CMD_START); - dw(CMD_STOP); - dw(CMD_FLUSH); - dw(CMD_MOTOR); - dw(CMD_SEEK); - dw(CMD_FORMAT); - dw(CMD_REMOVE); - dw(CMD_CHANGENUM); - dw(CMD_CHANGESTATE); - dw(CMD_PROTSTATUS); - dw(CMD_GETDRIVETYPE); - dw(CMD_GETGEOMETRY); - dw(CMD_ADDCHANGEINT); - dw(CMD_REMCHANGEINT); - dw(HD_SCSICMD); - dw(NSCMD_TD_READ64); - dw(NSCMD_TD_WRITE64); - dw(NSCMD_TD_SEEK64); - dw(NSCMD_TD_FORMAT64); - dw(0); + nscmd_cmd = here (); + dw (NSCMD_DEVICEQUERY); + dw (CMD_RESET); + dw (CMD_READ); + dw (CMD_WRITE); + dw (CMD_UPDATE); + dw (CMD_CLEAR); + dw (CMD_START); + dw (CMD_STOP); + dw (CMD_FLUSH); + dw (CMD_MOTOR); + dw (CMD_SEEK); + dw (CMD_FORMAT); + dw (CMD_REMOVE); + dw (CMD_CHANGENUM); + dw (CMD_CHANGESTATE); + dw (CMD_PROTSTATUS); + dw (CMD_GETDRIVETYPE); + dw (CMD_GETGEOMETRY); + dw (CMD_ADDCHANGEINT); + dw (CMD_REMCHANGEINT); + dw (HD_SCSICMD); + dw (NSCMD_TD_READ64); + dw (NSCMD_TD_WRITE64); + dw (NSCMD_TD_SEEK64); + dw (NSCMD_TD_FORMAT64); + dw (0); - /* initcode */ -#if 0 - initcode = here(); - calltrap(deftrap(hardfile_init)); dw(RTS); -#else - initcode = filesys_initcode; -#endif - /* Open */ - openfunc = here(); - calltrap(deftrap(hardfile_open)); dw(RTS); + /* initcode */ + initcode = filesys_initcode; - /* Close */ - closefunc = here(); - calltrap(deftrap(hardfile_close)); dw(RTS); + /* Open */ + openfunc = here (); + calltrap (deftrap (hardfile_open)); dw (RTS); - /* Expunge */ - expungefunc = here(); - calltrap(deftrap(hardfile_expunge)); dw(RTS); + /* Close */ + closefunc = here (); + calltrap (deftrap (hardfile_close)); dw (RTS); - /* BeginIO */ - beginiofunc = here(); - calltrap(deftrap(hardfile_beginio)); - dw(RTS); + /* Expunge */ + expungefunc = here (); + calltrap (deftrap (hardfile_expunge)); dw (RTS); - /* AbortIO */ - abortiofunc = here(); - calltrap(deftrap(hardfile_abortio)); dw(RTS); + /* BeginIO */ + beginiofunc = here (); + calltrap (deftrap (hardfile_beginio)); + dw (RTS); - /* FuncTable */ - functable = here(); - dl(openfunc); /* Open */ - dl(closefunc); /* Close */ - dl(expungefunc); /* Expunge */ - dl(EXPANSION_nullfunc); /* Null */ - dl(beginiofunc); /* BeginIO */ - dl(abortiofunc); /* AbortIO */ - dl(0xFFFFFFFFul); /* end of table */ + /* AbortIO */ + abortiofunc = here (); + calltrap (deftrap (hardfile_abortio)); dw (RTS); - /* DataTable */ - datatable = here(); - dw(0xE000); /* INITBYTE */ - dw(0x0008); /* LN_TYPE */ - dw(0x0300); /* NT_DEVICE */ - dw(0xC000); /* INITLONG */ - dw(0x000A); /* LN_NAME */ - dl(ROM_hardfile_resname); - dw(0xE000); /* INITBYTE */ - dw(0x000E); /* LIB_FLAGS */ - dw(0x0600); /* LIBF_SUMUSED | LIBF_CHANGED */ - dw(0xD000); /* INITWORD */ - dw(0x0014); /* LIB_VERSION */ - dw(0x0004); /* 0.4 */ - dw(0xD000); - dw(0x0016); /* LIB_REVISION */ - dw(0x0000); - dw(0xC000); - dw(0x0018); /* LIB_IDSTRING */ - dl(ROM_hardfile_resid); - dw(0x0000); /* end of table */ + /* FuncTable */ + functable = here (); + dl (openfunc); /* Open */ + dl (closefunc); /* Close */ + dl (expungefunc); /* Expunge */ + dl (EXPANSION_nullfunc); /* Null */ + dl (beginiofunc); /* BeginIO */ + dl (abortiofunc); /* AbortIO */ + dl (0xFFFFFFFFul); /* end of table */ - ROM_hardfile_init = here(); - dl(0x00000100); /* ??? */ - dl(functable); - dl(datatable); - dl(initcode); + /* DataTable */ + datatable = here (); + dw (0xE000); /* INITBYTE */ + dw (0x0008); /* LN_TYPE */ + dw (0x0300); /* NT_DEVICE */ + dw (0xC000); /* INITLONG */ + dw (0x000A); /* LN_NAME */ + dl (ROM_hardfile_resname); + dw (0xE000); /* INITBYTE */ + dw (0x000E); /* LIB_FLAGS */ + dw (0x0600); /* LIBF_SUMUSED | LIBF_CHANGED */ + dw (0xD000); /* INITWORD */ + dw (0x0014); /* LIB_VERSION */ + dw (0x0032); /* 50 */ + dw (0xD000); + dw (0x0016); /* LIB_REVISION */ + dw (0x0001); + dw (0xC000); + dw (0x0018); /* LIB_IDSTRING */ + dl (ROM_hardfile_resid); + dw (0x0000); /* end of table */ + + ROM_hardfile_init = here (); + dl (0x00000100); /* ??? */ + dl (functable); + dl (datatable); + filesys_initcode_ptr = here(); + dl (initcode); } diff --git a/src/include/akiko.h b/src/include/akiko.h index 899c451d..5b102597 100644 --- a/src/include/akiko.h +++ b/src/include/akiko.h @@ -1,14 +1,17 @@ -#pragma once +#ifndef UAE_AKIKO_H +#define UAE_AKIKO_H #define AKIKO_BASE 0xb80000 #define AKIKO_BASE_END 0xb80100 /* ?? */ -extern void akiko_reset (void); -extern int akiko_init (void); -extern void akiko_free (void); +extern void akiko_reset(void); +extern int akiko_init(void); +extern void akiko_free(void); -extern void AKIKO_hsync_handler (void); -extern void akiko_mute (int); +extern void AKIKO_hsync_handler(void); +extern void akiko_mute(int); extern bool akiko_ntscmode(void); -extern void rethink_akiko (void); +extern void rethink_akiko(void); + +#endif /* UAE_AKIKO_H */ diff --git a/src/include/audio.h b/src/include/audio.h index f3cc323c..7eb9e4d6 100644 --- a/src/include/audio.h +++ b/src/include/audio.h @@ -6,12 +6,15 @@ * Copyright 1995, 1996, 1997 Bernd Schmidt */ -#pragma once +#ifndef UAE_AUDIO_H +#define UAE_AUDIO_H + +#include "uae/types.h" + #define PERIOD_MAX ULONG_MAX #define MAX_EV ~0u void AUDxDAT(int nr, uae_u16 value); -void AUDxDAT(int nr, uae_u16 value, uaecptr addr); void AUDxVOL(int nr, uae_u16 value); void AUDxPER(int nr, uae_u16 value); void AUDxLCH(int nr, uae_u16 value); @@ -20,86 +23,30 @@ void AUDxLEN(int nr, uae_u16 value); uae_u16 audio_dmal(void); void audio_state_machine(void); -uaecptr audio_getpt(int nr, bool reset); +void audio_dmal_do(int nr, bool reset); + int init_audio(void); void audio_reset(void); void update_audio(void); void audio_evhandler(void); void audio_hsync(void); void audio_update_adkmasks(void); -void update_sound(double clk); -void update_cda_sound(double clk); +void update_sound(float clk); void led_filter_audio(void); void set_audio(void); int audio_activate(void); void audio_deactivate(void); -void audio_vsync(void); -void audio_sampleripper(int); -void write_wavheader(struct zfile *wavfile, uae_u32 size, uae_u32 freq); - -int audio_is_pull(void); -int audio_pull_buffer(void); -bool audio_finish_pull(void); -bool audio_is_pull_event(void); -bool audio_is_event_frame_possible(int); - -extern int sampleripper_enabled; - -typedef void(*CDA_CALLBACK)(int); -typedef bool(*SOUND_STREAM_CALLBACK)(int); - -extern int audio_enable_stream(bool, int, int, SOUND_STREAM_CALLBACK); -extern void audio_state_stream_state(int, int*, int, unsigned int); - -extern void audio_cda_new_buffer(uae_s16 *buffer, int length, int userdata, CDA_CALLBACK next_cd_audio_buffer_callback); -extern void audio_cda_volume(int left, int right); extern int sound_cd_volume[2]; -extern int sound_paula_volume[2]; - -#define AUDIO_CHANNEL_MAX_STREAM_CH 8 -#define AUDIO_CHANNEL_STREAMS 9 #define AUDIO_CHANNELS_PAULA 4 enum { SND_MONO, SND_STEREO, - SND_4CH_CLONEDSTEREO, - SND_4CH, - SND_6CH_CLONEDSTEREO, - SND_6CH, SND_NONE }; -static inline int get_audio_stereomode(int channels) -{ - switch (channels) - { - case 1: - return SND_MONO; - case 2: - return SND_STEREO; - case 4: - return SND_4CH; - case 6: - return SND_6CH; - } - return SND_STEREO; -} - -STATIC_INLINE int get_audio_nativechannels(int stereomode) -{ - int ch[] = { 1, 2, 4, 4, 6, 6, 0 }; - return ch[stereomode]; -} - -STATIC_INLINE int get_audio_amigachannels(int stereomode) -{ - int ch[] = { 1, 2, 2, 4, 2, 4, 0 }; - return ch[stereomode]; -} - STATIC_INLINE int get_audio_ismono(int stereomode) { return stereomode == 0; @@ -109,3 +56,5 @@ STATIC_INLINE int get_audio_ismono(int stereomode) #define SOUND_MAX_LOG_DELAY 10 #define MIXED_STEREO_MAX 16 #define MIXED_STEREO_SCALE 32 + +#endif /* UAE_AUDIO_H */ \ No newline at end of file diff --git a/src/include/autoconf.h b/src/include/autoconf.h index de0b85e5..3591c84a 100644 --- a/src/include/autoconf.h +++ b/src/include/autoconf.h @@ -1,18 +1,15 @@ -/* -* UAE - The Un*x Amiga Emulator -* -* Autoconfig device support -* -* (c) 1996 Ed Hanway -*/ + /* + * UAE - The Un*x Amiga Emulator + * + * Autoconfig device support + * + * (c) 1996 Ed Hanway + */ #ifndef UAE_AUTOCONF_H #define UAE_AUTOCONF_H -//#include "uae/types.h" -#include "sysconfig.h" -#include "traps.h" -#include "include/memory.h" +#include "uae/types.h" #define AFTERDOS_INIT_PRI ((-121) & 0xff) #define AFTERDOS_PRI ((-122) & 0xff) @@ -61,27 +58,23 @@ #define UAEBOARD_DATAREGION_START 0x4000 #define UAEBOARD_DATAREGION_SIZE 0xc000 -extern uae_u32 addr(int); -extern void db(uae_u8); -extern void dw(uae_u16); -extern void dl(uae_u32); -extern uae_u32 ds_ansi(const uae_char*); -extern uae_u32 ds(const TCHAR*); -extern uae_u32 ds_bstr_ansi(const uae_char*); -extern uae_u8 dbg(uaecptr); -extern void calltrap(uae_u32); -extern void org(uae_u32); -extern uae_u32 here(void); -extern uaecptr makedatatable(uaecptr resid, uaecptr resname, uae_u8 type, uae_s8 priority, uae_u16 ver, uae_u16 rev); -extern uae_u32 boot_rom_copy(TrapContext*, uaecptr, int); -extern void add_rom_absolute(uaecptr addr); -extern void save_rom_absolute(uaecptr addr); +extern uae_u32 addr (int); +extern void db (uae_u8); +extern void dw (uae_u16); +extern void dl (uae_u32); +extern uae_u32 ds_ansi (const uae_char*); +extern uae_u32 ds (const TCHAR*); +extern uae_u32 ds_bstr_ansi (const uae_char*); +extern uae_u8 dbg (uaecptr); +extern void calltrap (uae_u32); +extern void org (uae_u32); +extern uae_u32 here (void); +extern uaecptr makedatatable (uaecptr resid, uaecptr resname, uae_u8 type, uae_s8 priority, uae_u16 ver, uae_u16 rev); -extern void align(int); +extern void align (int); -extern volatile int uae_int_requested; +extern volatile uae_atomic uae_int_requested; extern void rtarea_reset(void); -extern bool rethink_traps(void); #define RTS 0x4e75 #define RTE 0x4e73 @@ -96,77 +89,66 @@ extern uaecptr ROM_hardfile_resname, ROM_hardfile_resid; extern uaecptr ROM_hardfile_init; extern uaecptr filesys_initcode, filesys_initcode_ptr; -extern int is_hardfile(int unit_no); -extern int nr_units(void); -extern int nr_directory_units(struct uae_prefs*); +extern int is_hardfile (int unit_no); +extern int nr_units (void); +extern int nr_directory_units (struct uae_prefs*); extern uaecptr need_uae_boot_rom(struct uae_prefs*); struct mountedinfo { - uae_s64 size; - bool ismounted; - bool ismedia; + uae_s64 size; + bool ismounted; + bool ismedia; int error; - int nrcyls; + int nrcyls; TCHAR rootdir[MAX_DPATH]; }; -extern int get_filesys_unitconfig(struct uae_prefs *p, int index, struct mountedinfo*); -extern int kill_filesys_unitconfig(struct uae_prefs *p, int nr); -extern int move_filesys_unitconfig(struct uae_prefs *p, int nr, int to); -extern TCHAR *validatedevicename(TCHAR *s, const TCHAR *def); -extern TCHAR *validatevolumename(TCHAR *s, const TCHAR *def); +extern int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo*); +extern int kill_filesys_unitconfig (struct uae_prefs *p, int nr); +extern int move_filesys_unitconfig (struct uae_prefs *p, int nr, int to); +extern TCHAR *validatedevicename (TCHAR *s, const TCHAR *def); +extern TCHAR *validatevolumename (TCHAR *s, const TCHAR *def); -int filesys_insert(int nr, const TCHAR *volume, const TCHAR *rootdir, bool readonly, int flags); -int filesys_eject(int nr); -int filesys_media_change(const TCHAR *rootdir, int inserted, struct uaedev_config_data *uci); +int filesys_insert (int nr, const TCHAR *volume, const TCHAR *rootdir, bool readonly, int flags); +int filesys_eject (int nr); +int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_config_data *uci); -extern TCHAR *filesys_createvolname(const TCHAR *volname, const TCHAR *rootdir, struct zvolume *zv, const TCHAR *def); -extern int target_get_volume_name(struct uaedev_mount_info *mtinf, struct uaedev_config_info *ci, bool inserted, bool fullcheck, int cnt); +extern TCHAR *filesys_createvolname (const TCHAR *volname, const TCHAR *rootdir, struct zvolume *zv, const TCHAR *def); +extern int target_get_volume_name (struct uaedev_mount_info *mtinf, struct uaedev_config_info *ci, bool inserted, bool fullcheck, int cnt); -extern int sprintf_filesys_unit(TCHAR *buffer, int num); +extern int sprintf_filesys_unit (TCHAR *buffer, int num); -extern void filesys_reset(void); -extern void filesys_cleanup(void); -extern void filesys_prepare_reset(void); -extern void filesys_start_threads(void); -extern void filesys_flush_cache(void); -extern void filesys_free_handles(void); -extern void filesys_vsync(void); +extern void filesys_reset (void); +extern void filesys_cleanup (void); +extern void filesys_prepare_reset (void); +extern void filesys_start_threads (void); +extern void filesys_flush_cache (void); +extern void filesys_free_handles (void); +extern void filesys_vsync (void); -extern void filesys_install(void); -extern void filesys_install_code(void); +extern void filesys_install (void); +extern void filesys_install_code (void); extern uaecptr filesys_get_entry(int); -extern void filesys_store_devinfo(uae_u8 *); -extern void hardfile_install(void); -extern void hardfile_reset(void); -extern void emulib_install(void); -extern uae_u32 uaeboard_demux(uae_u32*); -extern void expansion_init(void); -extern void expansion_cleanup(void); -extern void expansion_clear(void); +extern void filesys_store_devinfo (uae_u8 *); +extern void hardfile_install (void); +extern void hardfile_reset (void); +extern void emulib_install (void); +extern void expansion_init (void); +extern void expansion_cleanup (void); +extern void expansion_clear (void); extern uaecptr expansion_startaddress(struct uae_prefs*, uaecptr addr, uae_u32 size); -extern bool expansion_is_next_board_fastram(void); -extern uaecptr uaeboard_alloc_ram(uae_u32); extern uae_u8 *uaeboard_map_ram(uaecptr); extern void expansion_scan_autoconfig(struct uae_prefs*, bool); extern void expansion_generate_autoconfig_info(struct uae_prefs *p); -extern struct autoconfig_info *expansion_get_autoconfig_info(struct uae_prefs*, int romtype, int devnum); -extern struct autoconfig_info *expansion_get_autoconfig_data(struct uae_prefs *p, int index); extern struct autoconfig_info *expansion_get_autoconfig_by_address(struct uae_prefs *p, uaecptr addr); -extern void expansion_set_autoconfig_sort(struct uae_prefs *p); -extern int expansion_autoconfig_move(struct uae_prefs *p, int index, int direction, bool test); -extern bool expansion_can_move(struct uae_prefs *p, int index); -extern bool alloc_expansion_bank(addrbank *bank, struct autoconfig_info *aci); -extern void free_expansion_bank(addrbank *bank); extern void expansion_map(void); -extern uae_u32 expansion_board_size(addrbank *ab); -extern void uaegfx_install_code(uaecptr); +extern void uaegfx_install_code (uaecptr); -extern uae_u32 emulib_target_getcpurate(uae_u32, uae_u32*); +extern uae_u32 emulib_target_getcpurate (uae_u32, uae_u32*); -typedef bool(*DEVICE_INIT)(struct autoconfig_info*); +typedef bool (*DEVICE_INIT)(struct autoconfig_info*); typedef void(*DEVICE_ADD)(int, struct uaedev_config_info*, struct romconfig*); typedef bool(*E8ACCESS)(int, uae_u32*, int, bool); typedef void(*DEVICE_MEMORY_CALLBACK)(struct romconfig*, uae_u8*, int); @@ -197,17 +179,6 @@ struct expansionboardsettings const TCHAR *configname; int type; bool invert; - int bitshift; -}; -struct expansionsubromtype -{ - const TCHAR *name; - const TCHAR *configname; - uae_u32 romtype; - int memory_mid, memory_pid; - uae_u32 memory_serial; - bool memory_after; - uae_u8 autoconfig[16]; }; struct expansionromtype { @@ -221,60 +192,11 @@ struct expansionromtype uae_u32 parentromtype; int zorro; bool singleonly; - const struct expansionsubromtype *subtypes; - int defaultsubtype; - bool autoboot_jumper; int deviceflags; - int memory_mid, memory_pid; - uae_u32 memory_serial; - bool memory_after; - DEVICE_MEMORY_CALLBACK memory_callback; - bool id_jumper; - int extrahdports; const struct expansionboardsettings *settings; uae_u8 autoconfig[16]; }; extern const struct expansionromtype expansionroms[]; -struct cpuboardsubtype -{ - const TCHAR *name; - const TCHAR *configname; - int romtype, romtype_extra; - DEVICE_ADD add; - int deviceflags; - int memorytype; - int maxmemory; - int z3extra; - DEVICE_INIT init, init2; - int initzorro; - int initflag; - const struct expansionboardsettings *settings; - E8ACCESS e8; - // if includes Z2 or Z3 RAM - int memory_mid, memory_pid; - uae_u32 memory_serial; - bool memory_after; - uae_u8 autoconfig[16]; -}; -struct cpuboardtype -{ - int id; - const TCHAR *name; - const struct cpuboardsubtype *subtypes; - int defaultsubtype; -}; -extern const struct cpuboardtype cpuboards[]; -struct memoryboardtype -{ - const TCHAR *man; - const TCHAR *name; - uae_u8 z; - uae_u32 address; - uae_u16 manufacturer; - uae_u8 product; - uae_u8 autoconfig[16]; -}; -extern const struct memoryboardtype memoryboards[]; #endif /* UAE_AUTOCONF_H */ diff --git a/src/include/blitter.h b/src/include/blitter.h index 7bc2ed15..2d95e7bc 100644 --- a/src/include/blitter.h +++ b/src/include/blitter.h @@ -6,48 +6,51 @@ * (c) 1995 Bernd Schmidt */ -#pragma once +#ifndef UAE_BLITTER_H +#define UAE_BLITTER_H + +#include "uae/types.h" + struct bltinfo { - int blitzero; - int blitashift, blitbshift, blitdownashift, blitdownbshift; - uae_u16 bltadat, bltbdat, bltcdat, bltddat; - uae_u16 bltahold, bltbhold, bltafwm, bltalwm; - int vblitsize, hblitsize; - int bltamod, bltbmod, bltcmod, bltdmod; - int got_cycle; + int blitzero; + int blitashift,blitbshift,blitdownashift,blitdownbshift; + uae_u16 bltadat, bltbdat, bltcdat,bltddat; + uae_u16 bltaold, bltahold, bltbold, bltbhold, bltafwm, bltalwm; + int vblitsize,hblitsize; + int bltamod,bltbmod,bltcmod,bltdmod; }; extern enum blitter_states { - BLT_done, BLT_init, BLT_read, BLT_work, BLT_write, BLT_next + BLT_done, BLT_init, BLT_read, BLT_work, BLT_write, BLT_next } bltstate; extern struct bltinfo blt_info; -extern int blitter_nasty, blit_interrupt, blitter_dangerous_bpl; - -extern void check_is_blit_dangerous(uaecptr *bplpt, int planes, int words); +extern int blit_interrupt; extern uae_u16 bltsize; -extern uae_u16 bltcon0, bltcon1; -extern uae_u32 bltapt, bltbpt, bltcpt, bltdpt; -extern uae_u32 bltptx; -extern int bltptxpos, bltptxc; -extern int blit_singlechannel; +extern uae_u16 bltcon0,bltcon1; +extern uae_u32 bltapt,bltbpt,bltcpt,bltdpt; -extern void maybe_blit(int, int); -extern void reset_blit(int); -extern int blitnasty(void); -extern int blitnnasty(int); -extern void blitter_handler(uae_u32); -extern void build_blitfilltable(void); -extern void do_blitter(int, int); -extern void decide_blitter(int hpos); -extern int blitter_need(int hpos); -extern void blitter_done_notify(int hpos); -extern void blitter_slowdown(int, int, int, int); -extern int blitter_channel_state(void); -extern void blitter_check_start(void); -extern void blitter_reset(void); +extern void maybe_blit2 (int); +STATIC_INLINE void maybe_blit (int hack) +{ + if (bltstate == BLT_done) + return; + + if (savestate_state) + return; + + maybe_blit2(hack); +} +extern void reset_blit (int); +extern int blitnasty (void); +extern void blitter_handler (void); +extern void build_blitfilltable (void); +extern void do_blitter (void); +extern void blitter_done_notify (void); +extern void blitter_slowdown (int, int, int, int); +extern void blitter_check_start (void); typedef void blitter_func(uaecptr, uaecptr, uaecptr, uaecptr, struct bltinfo *); @@ -61,3 +64,5 @@ extern uae_u32 blit_masktable[BLITTER_MAX_WORDS]; #define BLIT_MODE_APPROXIMATE 0 #define BLIT_MODE_COMPATIBLE 1 #define BLIT_MODE_EXACT 2 + +#endif /* UAE_BLITTER_H */ diff --git a/src/include/cia.h b/src/include/cia.h index 4d838469..3f1d0035 100644 --- a/src/include/cia.h +++ b/src/include/cia.h @@ -1,35 +1,30 @@ -/* - * UAE - The Un*x Amiga Emulator - * - * CIA chip support - * - * (c) 1995 Bernd Schmidt - */ + /* + * UAE - The Un*x Amiga Emulator + * + * CIA chip support + * + * (c) 1995 Bernd Schmidt + */ -#pragma once -extern void CIA_reset(void); -extern void CIA_vsync_prehandler(void); -extern void CIA_hsync_prehandler(void); -extern void CIA_hsync_posthandler(bool, bool); -extern void CIA_handler(void); -extern void CIAA_tod_inc(int); -extern void CIAB_tod_handler(int); +#ifndef UAE_CIA_H +#define UAE_CIA_H -extern void diskindex_handler(void); -extern void cia_parallelack(void); -extern void cia_diskindex(void); +#include "uae/types.h" -extern void dumpcia(void); -extern void rethink_cias(void); -extern int resetwarning_do(int); -extern void cia_set_overlay(bool); -void cia_heartbeat(void); +extern void CIA_reset (void); +extern void CIA_vsync_prehandler (void); +extern void CIA_hsync_posthandler (bool); +extern void CIA_handler (void); +extern void CIAA_tod_handler (uae_u32); +extern void CIAB_tod_inc_event (uae_u32); +extern void CIAA_tod_inc (int); +extern void CIAB_tod_handler (int); -extern int parallel_direct_write_data(uae_u8, uae_u8); -extern int parallel_direct_read_data(uae_u8*); -extern int parallel_direct_write_status(uae_u8, uae_u8); -extern int parallel_direct_read_status(uae_u8*); +extern void cia_diskindex (void); + +extern void rethink_cias (void); +extern void cia_set_overlay (bool); extern void rtc_hardreset(void); -extern void keyboard_connected(bool); +#endif /* UAE_CIA_H */ diff --git a/src/include/custom.h b/src/include/custom.h index 3048717d..579fe26d 100644 --- a/src/include/custom.h +++ b/src/include/custom.h @@ -1,18 +1,19 @@ -/* -* UAE - The Un*x Amiga Emulator -* -* custom chip support -* -* (c) 1995 Bernd Schmidt -*/ + /* + * UAE - The Un*x Amiga Emulator + * + * custom chip support + * + * (c) 1995 Bernd Schmidt + */ #ifndef UAE_CUSTOM_H #define UAE_CUSTOM_H +#include "uae/types.h" #include "machdep/rpt.h" /* These are the masks that are ORed together in the chipset_mask option. -* If CSMASK_AGA is set, the ECS bits are guaranteed to be set as well. */ + * If CSMASK_AGA is set, the ECS bits are guaranteed to be set as well. */ #define CSMASK_ECS_AGNUS 1 #define CSMASK_ECS_DENISE 2 #define CSMASK_AGA 4 @@ -26,41 +27,29 @@ #define MAXVPOS_LINES_OCS 512 #define HPOS_SHIFT 3 -uae_u32 get_copper_address(int copno); +extern void set_speedup_values(void); +extern int custom_init (void); +extern void custom_prepare (void); +extern void custom_reset (bool hardreset, bool keyboardreset); +extern int intlev (void); -extern int custom_init(void); -extern void custom_prepare(void); -extern void custom_reset(bool hardreset, bool keyboardreset); -extern int intlev(void); -extern void dumpcustom(void); +extern void do_copper (void); -extern void do_disk(void); -extern void do_copper(void); - -extern void notice_new_xcolors(void); -extern void notice_screen_contents_lost(void); -extern void init_row_map(void); -extern void init_hz_normal(void); -extern void init_custom(void); +extern void notice_new_xcolors (void); +extern void init_row_map (void); +extern void init_hz_normal (void); +extern void init_custom (void); extern bool picasso_requested_on, picasso_requested_forced_on, picasso_on; -extern void set_picasso_hack_rate(int hz); -/* Set to 1 to leave out the current frame in average frame time calculation. -* Useful if the debugger was active. */ -extern int bogusframe; -extern unsigned long int hsync_counter, vsync_counter; +extern unsigned long int hsync_counter; extern uae_u16 dmacon; -extern uae_u16 intena, intreq, intreqr; +extern uae_u16 intreq; -extern int vpos, lof_store; +extern int vpos; -extern int find_copper_record(uaecptr, int *, int *); - -extern int n_frames; - -STATIC_INLINE int dmaen(unsigned int dmamask) +STATIC_INLINE int dmaen (unsigned int dmamask) { return (dmamask & dmacon) && (dmacon & 0x200); } @@ -85,25 +74,22 @@ STATIC_INLINE int dmaen(unsigned int dmamask) extern uae_u16 adkcon; -extern unsigned int joy0dir, joy1dir; -extern int joy0button, joy1button; - -extern void INTREQ(uae_u16); -extern bool INTREQ_0(uae_u16); -extern void INTREQ_f(uae_u16); -extern void send_interrupt(int num, int delay); +extern void INTREQ (uae_u16); +extern bool INTREQ_0 (uae_u16); +extern void INTREQ_f (uae_u16); +STATIC_INLINE void send_interrupt (int num) +{ + INTREQ_0 (0x8000 | (1 << num)); +} extern void rethink_uae_int(void); -extern uae_u16 INTREQR(void); +STATIC_INLINE uae_u16 INTREQR (void) +{ + return intreq; +} /* maximums for statically allocated tables */ -#ifdef UAE_MINI -/* absolute minimums for basic A500/A1200-emulation */ #define MAXHPOS 227 -#define MAXVPOS 312 -#else -#define MAXHPOS 256 -#define MAXVPOS 592 -#endif +#define MAXVPOS 314 /* PAL/NTSC values */ @@ -125,14 +111,11 @@ extern uae_u16 INTREQR(void); #define EQU_ENDLINE_PAL 8 #define EQU_ENDLINE_NTSC 10 -extern int maxhpos, maxhpos_short; +extern int maxhpos; extern int maxvpos, maxvpos_nom, maxvpos_display; -extern int hsyncstartpos, hsyncendpos; -extern int minfirstline, vblank_endline, numscrlines; -extern double vblank_hz, fake_vblank_hz; -extern double hblank_hz; -extern int vblank_skip, doublescan; -extern bool programmedmode; +extern int minfirstline; +extern float vblank_hz, fake_vblank_hz; +extern float hblank_hz; #define DMA_AUD0 0x0001 #define DMA_AUD1 0x0002 @@ -146,43 +129,17 @@ extern bool programmedmode; #define DMA_MASTER 0x0200 #define DMA_BLITPRI 0x0400 -#define CYCLE_REFRESH 1 -#define CYCLE_STROBE 2 -#define CYCLE_MISC 3 -#define CYCLE_SPRITE 4 -#define CYCLE_COPPER 5 -#define CYCLE_BLITTER 6 -#define CYCLE_CPU 7 -#define CYCLE_CPUNASTY 8 -#define CYCLE_COPPER_SPECIAL 0x10 - -#define CYCLE_MASK 0x0f - -extern unsigned long frametime, timeframes; -extern uae_u16 htotal, vtotal, beamcon0; +extern unsigned long timeframes; /* 100 words give you 1600 horizontal pixels. Should be more than enough for -* superhires. Don't forget to update the definition in genp2c.c as well. -* needs to be larger for superhires support */ -#ifdef CUSTOM_SIMPLE -#define MAX_WORDS_PER_LINE 50 -#else + * superhires. Don't forget to update the definition in genp2c.c as well. + * needs to be larger for superhires support */ #define MAX_WORDS_PER_LINE 100 -#endif -extern uae_u32 hirestab_h[256][2]; -extern uae_u32 lorestab_h[256][4]; - -extern uae_u32 hirestab_l[256][1]; -extern uae_u32 lorestab_l[256][2]; - -#ifdef AGA +#ifndef ARMV6_ASSEMBLY /* AGA mode color lookup tables */ extern unsigned int xredcolors[256], xgreencolors[256], xbluecolors[256]; #endif -extern int xredcolor_s, xredcolor_b, xredcolor_m; -extern int xgreencolor_s, xgreencolor_b, xgreencolor_m; -extern int xbluecolor_s, xbluecolor_b, xbluecolor_m; #define RES_LORES 0 #define RES_HIRES 1 @@ -190,55 +147,37 @@ extern int xbluecolor_s, xbluecolor_b, xbluecolor_m; #define RES_MAX 2 #define VRES_NONDOUBLE 0 #define VRES_DOUBLE 1 -#define VRES_QUAD 2 #define VRES_MAX 1 -/* calculate shift depending on resolution (replaced "decided_hires ? 4 : 8") */ -#define RES_SHIFT(res) ((res) == RES_LORES ? 8 : (res) == RES_HIRES ? 4 : 2) - /* get resolution from bplcon0 */ -STATIC_INLINE int GET_RES_DENISE(uae_u16 con0) +STATIC_INLINE int GET_RES_DENISE (uae_u16 con0) { - if (!(currprefs.chipset_mask & CSMASK_ECS_DENISE)) - con0 &= ~0x40; // SUPERHIRES - return ((con0) & 0x40) ? RES_SUPERHIRES : ((con0) & 0x8000) ? RES_HIRES : RES_LORES; + if ((currprefs.chipset_mask & CSMASK_ECS_DENISE) && ((con0) & 0x40)) + return RES_SUPERHIRES; // SUPERHIRES + return ((con0) & 0x8000) ? RES_HIRES : RES_LORES; } -STATIC_INLINE int GET_RES_AGNUS(uae_u16 con0) +STATIC_INLINE int GET_RES_AGNUS (uae_u16 con0) { - if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) - con0 &= ~0x40; // SUPERHIRES - return ((con0) & 0x40) ? RES_SUPERHIRES : ((con0) & 0x8000) ? RES_HIRES : RES_LORES; + if ((currprefs.chipset_mask & CSMASK_ECS_AGNUS) && ((con0) & 0x40)) + return RES_SUPERHIRES; // SUPERHIRES + return ((con0) & 0x8000) ? RES_HIRES : RES_LORES; } /* get sprite width from FMODE */ #define GET_SPRITEWIDTH(FMODE) ((((FMODE) >> 2) & 3) == 3 ? 64 : (((FMODE) >> 2) & 3) == 0 ? 16 : 32) /* Compute the number of bitplanes from a value written to BPLCON0 */ STATIC_INLINE int GET_PLANES(uae_u16 bplcon0) { - if ((bplcon0 & 0x0010) && (bplcon0 & 0x7000)) - return 0; // >8 planes = 0 planes - if (bplcon0 & 0x0010) - return 8; // AGA 8-planes bit - return (bplcon0 >> 12) & 7; // normal planes bits + if ((bplcon0 & 0x0010) && (bplcon0 & 0x7000)) + return 0; // >8 planes = 0 planes + if (bplcon0 & 0x0010) + return 8; // AGA 8-planes bit + return (bplcon0 >> 12) & 7; // normal planes bits } -extern void fpscounter_reset(void); +extern void fpscounter_reset (void); extern unsigned long idletime; -extern int lightpen_x, lightpen_y, lightpen_cx, lightpen_cy, lightpen_active, lightpen_enabled; -struct customhack { - uae_u16 v; - int vpos, hpos; -}; -void customhack_put(struct customhack *ch, uae_u16 v, int hpos); -uae_u16 customhack_get(struct customhack *ch, int hpos); -extern void alloc_cycle_ext(int, int); -extern void alloc_cycle_blitter(int hpos, uaecptr *ptr, int); -extern bool ispal(void); -extern bool isvga(void); -extern int current_maxvpos(void); -extern struct chipset_refresh *get_chipset_refresh(void); -extern void compute_framesync(void); -extern void getsyncregisters(uae_u16 *phsstrt, uae_u16 *phsstop, uae_u16 *pvsstrt, uae_u16 *pvsstop); -int is_bitplane_dma(int hpos); +extern int current_maxvpos (void); +extern struct chipset_refresh *get_chipset_refresh (void); #endif /* UAE_CUSTOM_H */ diff --git a/src/include/drawing.h b/src/include/drawing.h index 52311933..7ab643bf 100644 --- a/src/include/drawing.h +++ b/src/include/drawing.h @@ -4,81 +4,62 @@ * Copyright 1996-1998 Bernd Schmidt */ -#pragma once -#define SMART_UPDATE 1 +#ifndef UAE_DRAWING_H +#define UAE_DRAWING_H -#ifdef SUPPORT_PENGUINS -#undef SMART_UPDATE -#define SMART_UPDATE 1 -#endif +#include "uae/types.h" -#ifdef AGA #define MAX_PLANES 8 -#else -#define MAX_PLANES 6 -#endif -#ifdef AMIBERRY -#define AMIGA_WIDTH_MAX (640 / 2) -#define AMIGA_HEIGHT_MAX (512 / 2) -#else -#define AMIGA_WIDTH_MAX (752 / 2) -#define AMIGA_HEIGHT_MAX (576 / 2) -#endif - - //#define NEWHSYNC - -#ifdef NEWHSYNC -#define DIW_DDF_OFFSET 9 - /* this many cycles starting from hpos=0 are visible on right border */ -#define HBLANK_OFFSET 13 -#define DISPLAY_LEFT_SHIFT 0x40 -#else - /* According to the HRM, pixel data spends a couple of cycles somewhere in the chips - before it appears on-screen. (TW: display emulation now does this automatically) */ +/* According to the HRM, pixel data spends a couple of cycles somewhere in the chips +before it appears on-screen. (TW: display emulation now does this automatically) */ #define DIW_DDF_OFFSET 1 - /* this many cycles starting from hpos=0 are visible on right border */ +/* this many cycles starting from hpos=0 are visible on right border */ #define HBLANK_OFFSET 9 - /* We ignore that many lores pixels at the start of the display. These are +/* We ignore that many lores pixels at the start of the display. These are * invisible anyway due to hardware DDF limits. */ #define DISPLAY_LEFT_SHIFT 0x38 -#endif #define PIXEL_XPOS(HPOS) (((HPOS)*2 - DISPLAY_LEFT_SHIFT + DIW_DDF_OFFSET - 1) << lores_shift) #define min_diwlastword (0) -#define max_diwlastword (PIXEL_XPOS(0x1d4 >> 1)) +#define max_diwlastword (PIXEL_XPOS(0x1d4>> 1)) extern int lores_shift, interlace_seen; -extern bool aga_mode, direct_rgb; -extern int visible_left_border, visible_right_border; -extern int detected_screen_resolution; +extern bool aga_mode; -STATIC_INLINE int coord_hw_to_window_x(int x) +STATIC_INLINE int shres_coord_hw_to_window_x (int x) { - x -= DISPLAY_LEFT_SHIFT; + x -= DISPLAY_LEFT_SHIFT << 2; + x <<= lores_shift; + x >>= 2; + return x; +} + +STATIC_INLINE int coord_hw_to_window_x (int x) +{ + x -= DISPLAY_LEFT_SHIFT; return x << lores_shift; } -STATIC_INLINE int coord_window_to_hw_x(int x) +STATIC_INLINE int coord_window_to_hw_x (int x) { x >>= lores_shift; - return x + DISPLAY_LEFT_SHIFT; + return x + DISPLAY_LEFT_SHIFT; } -STATIC_INLINE int coord_diw_to_window_x(int x) +STATIC_INLINE int coord_diw_to_window_x (int x) { return (x - DISPLAY_LEFT_SHIFT + DIW_DDF_OFFSET - 1) << lores_shift; } -STATIC_INLINE int coord_window_to_diw_x(int x) +STATIC_INLINE int coord_window_to_diw_x (int x) { - x = coord_window_to_hw_x(x); - return x - DIW_DDF_OFFSET; + x = coord_window_to_hw_x (x); + return x - DIW_DDF_OFFSET; } extern int framecnt; -extern int custom_frame_redraw_necessary; /* color values in two formats: 12 (OCS/ECS) or 24 (AGA) bit Amiga RGB (color_regs), * and the native color value; both for each Amiga hardware color register. @@ -86,7 +67,6 @@ extern int custom_frame_redraw_necessary; * !!! See color_reg_xxx functions below before touching !!! */ #define CE_BORDERBLANK 0 -#define CE_BORDERNTRANS 1 #define CE_BORDERSPRITE 2 #define CE_SHRES_DELAY 4 @@ -98,83 +78,83 @@ STATIC_INLINE bool ce_is_bordersprite(uae_u8 data) { return (data & (1 << CE_BORDERSPRITE)) != 0; } -STATIC_INLINE bool ce_is_borderntrans(uae_u8 data) -{ - return (data & (1 << CE_BORDERNTRANS)) != 0; -} struct color_entry { - uae_u16 color_regs_ecs[32]; -#ifndef AGA - xcolnr acolors[32]; -#else - xcolnr acolors[256]; - uae_u32 color_regs_aga[256]; -#endif + uae_u16 color_regs_ecs[32]; + xcolnr acolors[256]; + uae_u32 color_regs_aga[256]; uae_u8 extra; }; -#ifdef AGA /* convert 24 bit AGA Amiga RGB to native color */ -/* warning: this is still ugly, but now works with either byte order */ -# define CONVERT_RGB(c) \ - ( xbluecolors[((uae_u8*)(&c))[0]] | xgreencolors[((uae_u8*)(&c))[1]] | xredcolors[((uae_u8*)(&c))[2]] ) +#ifdef ARMV6_ASSEMBLY +STATIC_INLINE uae_u32 CONVERT_RGB(uae_u32 c) +{ + uae_u32 ret; + __asm__ ( + "ubfx r1, %[c], #19, #5 \n\t" + "ubfx r2, %[c], #10, #6 \n\t" + "ubfx %[v], %[c], #3, #5 \n\t" + "orr %[v], %[v], r1, lsl #11 \n\t" + "orr %[v], %[v], r2, lsl #5 \n\t" + "pkhbt %[v], %[v], %[v], lsl #16 \n\t" + : [v] "=r" (ret) : [c] "r" (c) : "r1", "r2" ); + return ret; +} +STATIC_INLINE uae_u16 CONVERT_RGB_16(uae_u32 c) +{ + uae_u16 ret; + __asm__ ( + "ubfx r1, %[c], #19, #5 \n\t" + "ubfx r2, %[c], #10, #6 \n\t" + "ubfx %[v], %[c], #3, #5 \n\t" + "orr %[v], %[v], r1, lsl #11 \n\t" + "orr %[v], %[v], r2, lsl #5 \n\t" + : [v] "=r" (ret) : [c] "r" (c) : "r1", "r2" ); + return ret; +} +#else +#define CONVERT_RGB(c) \ + ( xbluecolors[((uae_u8*)(&c))[0]] | xgreencolors[((uae_u8*)(&c))[1]] | xredcolors[((uae_u8*)(&c))[2]] ) +#define CONVERT_RGB_16(c) \ + ( xbluecolors[((uae_u8*)(&c))[0]] | xgreencolors[((uae_u8*)(&c))[1]] | xredcolors[((uae_u8*)(&c))[2]] ) #endif -STATIC_INLINE xcolnr getxcolor(int c) +STATIC_INLINE xcolnr getxcolor (int c) { -#ifdef AGA - if (direct_rgb) + if (aga_mode) return CONVERT_RGB(c); else -#endif return xcolors[c]; } /* functions for reading, writing, copying and comparing struct color_entry */ -STATIC_INLINE int color_reg_get(struct color_entry *ce, int c) +STATIC_INLINE int color_reg_get (struct color_entry *ce, int c) { -#ifdef AGA if (aga_mode) return ce->color_regs_aga[c]; else -#endif return ce->color_regs_ecs[c]; } -STATIC_INLINE void color_reg_set(struct color_entry *ce, int c, int v) + +STATIC_INLINE void color_reg_set (struct color_entry *ce, int c, int v) { -#ifdef AGA if (aga_mode) ce->color_regs_aga[c] = v; else -#endif ce->color_regs_ecs[c] = v; } -STATIC_INLINE int color_reg_cmp(struct color_entry *ce1, struct color_entry *ce2) -{ - int v; -#ifdef AGA - if (aga_mode) - v = memcmp(ce1->color_regs_aga, ce2->color_regs_aga, sizeof(uae_u32) * 256); - else -#endif - v = memcmp(ce1->color_regs_ecs, ce2->color_regs_ecs, sizeof(uae_u16) * 32); - if (!v && ce1->extra == ce2->extra) - return 0; - return 1; -} + /* ugly copy hack, is there better solution? */ -STATIC_INLINE void color_reg_cpy(struct color_entry *dst, struct color_entry *src) +STATIC_INLINE void color_reg_cpy (struct color_entry *dst, struct color_entry *src) { dst->extra = src->extra; -#ifdef AGA - if (aga_mode) - /* copy acolors and color_regs_aga */ - memcpy(dst->acolors, src->acolors, sizeof(struct color_entry) - sizeof(uae_u16) * 32); - else -#endif - /* copy first 32 acolors and color_regs_ecs */ - memcpy(dst->color_regs_ecs, src->color_regs_ecs, sizeof(struct color_entry)); + if (aga_mode) + /* copy acolors and color_regs_aga */ + memcpy (dst->acolors, src->acolors, sizeof(struct color_entry) - sizeof(uae_u16) * 32); + else + /* copy first 32 acolors and color_regs_ecs */ + memcpy(dst->color_regs_ecs, src->color_regs_ecs, sizeof(uae_u16) * 32 + sizeof(xcolnr) * 32); } /* @@ -188,30 +168,25 @@ STATIC_INLINE void color_reg_cpy(struct color_entry *dst, struct color_entry *sr #define COLOR_CHANGE_BRDBLANK 0x80000000 #define COLOR_CHANGE_SHRES_DELAY 0x40000000 -#define COLOR_CHANGE_HSYNC_HACK 0x20000000 #define COLOR_CHANGE_MASK 0xf0000000 struct color_change { - int linepos; - int regno; - unsigned int value; + int linepos; + int regno; + unsigned int value; }; /* 440 rather than 880, since sprites are always lores. */ -#ifdef UAE_MINI -#define MAX_PIXELS_PER_LINE 880 -#else #define MAX_PIXELS_PER_LINE 1760 -#endif -/* No divisors for MAX_PIXELS_PER_LINE; we support AGA and SHRES sprites */ -#define MAX_SPR_PIXELS (((MAXVPOS + 1) * 2 + 1) * MAX_PIXELS_PER_LINE) +/* No divisors for MAX_PIXELS_PER_LINE; we support AGA and SHRES sprites */ +#define MAX_SPR_PIXELS (((MAXVPOS + 1)*2 + 1) * MAX_PIXELS_PER_LINE) struct sprite_entry { - unsigned short pos; - unsigned short max; - unsigned int first_pixel; - bool has_attached; + unsigned short pos; + unsigned short max; + unsigned int first_pixel; + bool has_attached; }; union sps_union { @@ -219,44 +194,43 @@ union sps_union { uae_u32 words[2 * MAX_SPR_PIXELS / 4]; }; extern union sps_union spixstate; + extern uae_u16 spixels[MAX_SPR_PIXELS * 2]; /* Way too much... */ -#define MAX_REG_CHANGE ((MAXVPOS + 1) * 2 * MAXHPOS) +#define MAX_REG_CHANGE ((MAXVPOS + 1) * MAXHPOS) -extern struct color_entry *curr_color_tables, *prev_color_tables; +extern struct color_entry curr_color_tables[(MAXVPOS + 2) * 2]; -extern struct sprite_entry *curr_sprite_entries, *prev_sprite_entries; -extern struct color_change *curr_color_changes, *prev_color_changes; -extern struct draw_info *curr_drawinfo, *prev_drawinfo; +extern struct sprite_entry *curr_sprite_entries; +extern struct color_change *curr_color_changes; +extern struct draw_info curr_drawinfo[2 * (MAXVPOS + 2) + 1]; /* struct decision contains things we save across drawing frames for * comparison (smart update stuff). */ struct decision { - /* Records the leftmost access of BPL1DAT. */ - int plfleft, plfright, plflinelen; - /* Display window: native coordinates, depend on lores state. */ - int diwfirstword, diwlastword; - int ctable; + /* Records the leftmost access of BPL1DAT. */ + int plfleft, plfright, plflinelen; + /* Display window: native coordinates, depend on lores state. */ + int diwfirstword, diwlastword; + int ctable; - uae_u16 bplcon0, bplcon2; -#ifdef AGA - uae_u16 bplcon3, bplcon4; -#endif - uae_u8 nr_planes; - uae_u8 bplres; - bool ehb_seen; - bool ham_seen; - bool ham_at_start; + uae_u16 bplcon0, bplcon2; + uae_u16 bplcon3, bplcon4; + uae_u8 nr_planes; + uae_u8 bplres; + bool ham_seen; + bool ham_at_start; bool bordersprite_seen; + bool xor_seen; }; /* Anything related to changes in hw registers during the DDF for one * line. */ struct draw_info { - int first_sprite_entry, last_sprite_entry; - int first_color_change, last_color_change; - int nr_color_changes, nr_sprites; + int first_sprite_entry, last_sprite_entry; + int first_color_change, last_color_change; + int nr_color_changes, nr_sprites; }; extern struct decision line_decisions[2 * (MAXVPOS + 2) + 1]; @@ -264,70 +238,34 @@ extern struct decision line_decisions[2 * (MAXVPOS + 2) + 1]; extern uae_u8 line_data[(MAXVPOS + 2) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2]; /* Functions in drawing.c. */ -extern int coord_native_to_amiga_y(int); -extern int coord_native_to_amiga_x(int); +extern int coord_native_to_amiga_y (int); +extern int coord_native_to_amiga_x (int); -extern void record_diw_line(int plfstrt, int first, int last); -extern void hardware_line_completed(int lineno); - -/* Determine how to draw a scan line. */ -enum nln_how { - /* All lines on a non-doubled display. */ - nln_normal, - /* Non-interlace, doubled display. */ - nln_doubled, - /* Interlace, doubled display, upper line. */ - nln_upper, - /* Interlace, doubled display, lower line. */ - nln_lower, - /* This line normal, next one black. */ - nln_nblack, - nln_upper_black, - nln_lower_black, - nln_upper_black_always, - nln_lower_black_always -}; - -extern void hsync_record_line_state(int lineno, enum nln_how, int changed); -extern void vsync_handle_redraw(int long_field, int lof_changed, uae_u16, uae_u16); -extern bool vsync_handle_check(); -extern void init_hardware_for_drawing_frame(); -extern void reset_drawing(); -extern void drawing_init(); -extern bool notice_interlace_seen(bool); -extern void notice_resolution_seen(int, bool); -extern void frame_drawn(void); -extern void redraw_frame(void); -extern bool draw_frame(); -extern int get_custom_limits(int *pw, int *ph, int *pdx, int *pdy, int *prealh); -extern void store_custom_limits(int w, int h, int dx, int dy); -extern void set_custom_limits(int w, int h, int dx, int dy); -extern void get_custom_topedge(int *x, int *y, bool max); -extern void get_custom_raw_limits(int *pw, int *ph, int *pdx, int *pdy); - -extern long time_per_frame; +extern void hsync_record_line_state (int lineno); +extern void halt_draw_frame(void); +extern void vsync_handle_redraw (void); +extern bool vsync_handle_check (void); +extern void init_hardware_for_drawing_frame (void); +extern void reset_drawing (void); +extern void drawing_init (void); +extern bool notice_interlace_seen (bool); +extern void check_prefs_picasso(void); /* Finally, stuff that shouldn't really be shared. */ -extern int thisframe_first_drawn_line, thisframe_last_drawn_line; - #define IHF_SCROLLLOCK 0 #define IHF_QUIT_PROGRAM 1 #define IHF_PICASSO 2 extern int inhibit_frame; -STATIC_INLINE void set_inhibit_frame(int bit) +STATIC_INLINE void set_inhibit_frame (int bit) { - inhibit_frame |= 1 << bit; + inhibit_frame |= 1 << bit; +} +STATIC_INLINE void clear_inhibit_frame (int bit) +{ + inhibit_frame &= ~(1 << bit); } -STATIC_INLINE void clear_inhibit_frame(int bit) -{ - inhibit_frame &= ~(1 << bit); -} - -STATIC_INLINE void toggle_inhibit_frame(int bit) -{ - inhibit_frame ^= 1 << bit; -} +#endif /* UAE_DRAWING_H */ diff --git a/src/include/events.h b/src/include/events.h index 8e5f105b..5a69b800 100644 --- a/src/include/events.h +++ b/src/include/events.h @@ -1,6 +1,3 @@ -#ifndef EVENTS_H -#define EVENTS_H - /* * UAE - The Un*x Amiga Emulator * @@ -12,27 +9,25 @@ * Copyright 1995-1998 Bernd Schmidt */ -#undef EVENT_DEBUG +#ifndef UAE_EVENTS_H +#define UAE_EVENTS_H + +#include "uae/types.h" #include "machdep/rpt.h" extern frame_time_t vsyncmintime, vsyncmaxtime, vsyncwaittime; extern int vsynctimebase, syncbase; -extern void reset_frame_rate_hack (); -extern unsigned long int vsync_cycles; -extern unsigned long start_cycles; -extern int event2_count; -extern bool event_wait; +extern void reset_frame_rate_hack (void); extern int speedup_timelimit; -extern void compute_vsynctime (); -extern void init_eventtab (); -extern void events_schedule (); +extern void compute_vsynctime (void); +extern void init_eventtab (void); +extern void events_schedule (void); extern unsigned long currcycle, nextevent; -extern int is_syncline, is_syncline_end; -extern long last_synctime; -typedef void (*evfunc)(); +extern int is_syncline; +typedef void (*evfunc)(void); typedef void (*evfunc2)(uae_u32); typedef void (*do_cycles_func)(unsigned long); @@ -58,98 +53,89 @@ struct ev2 }; enum { - ev_cia, ev_audio, ev_misc, ev_hsync, - ev_max + ev_copper, + ev_cia, ev_audio, ev_blitter, ev_dmal, ev_misc, ev_hsync, + ev_max }; enum { - ev2_blitter, ev2_disk, ev2_misc, - ev2_max = 12 + ev2_disk, ev2_ciaa_tod, ev2_ciab_tod, ev2_disk_motor0, ev2_disk_motor1, ev2_disk_motor2, ev2_disk_motor3, + ev2_max }; extern int pissoff_value; -extern uae_s32 pissoff; - -#define countdown (pissoff) -//TODO: check and implement this -//#define do_cycles do_cycles_slow +#define countdown (regs.pissoff) extern struct ev eventtab[ev_max]; extern struct ev2 eventtab2[ev2_max]; -extern volatile bool vblank_found_chipset; -extern volatile bool vblank_found_rtg; -extern int hpos_offset; -extern int maxhpos; - -STATIC_INLINE void cycles_do_special () +STATIC_INLINE void cycles_do_special (void) { #ifdef JIT if (currprefs.cachesize) { - if (pissoff >= 0) - pissoff = -1; + if (regs.pissoff >= 0) + regs.pissoff = -1; } else #endif { - pissoff = 0; + regs.pissoff = 0; } } -STATIC_INLINE void do_extra_cycles(unsigned long cycles_to_add) +STATIC_INLINE void do_extra_cycles (unsigned long cycles_to_add) { - pissoff -= cycles_to_add; + regs.pissoff -= cycles_to_add; } -STATIC_INLINE unsigned long int get_cycles () +STATIC_INLINE unsigned long int get_cycles (void) { return currcycle; } -STATIC_INLINE void set_cycles(unsigned long int x) +STATIC_INLINE void set_cycles (unsigned long int x) { - currcycle = x; + currcycle = x; eventtab[ev_hsync].oldcycles = x; } -STATIC_INLINE int current_hpos_safe(void) +STATIC_INLINE int current_hpos (void) { - int hp = (get_cycles() - eventtab[ev_hsync].oldcycles) / CYCLE_UNIT; + int hp = (get_cycles () - eventtab[ev_hsync].oldcycles) / CYCLE_UNIT; return hp; } -extern int current_hpos(void); - -STATIC_INLINE bool cycles_in_range(unsigned long endcycles) +STATIC_INLINE bool cycles_in_range (unsigned long endcycles) { - signed long c = get_cycles(); - return static_cast(endcycles) - c > 0; + signed long c = get_cycles (); + return (signed long)endcycles - c > 0; } -extern void MISC_handler(); -extern void event2_newevent_xx(int no, evt t, uae_u32 data, evfunc2 func); -extern void event2_newevent_x_replace(evt t, uae_u32 data, evfunc2 func); +extern void MISC_handler(void); -STATIC_INLINE void event2_newevent_x(int no, evt t, uae_u32 data, evfunc2 func) +STATIC_INLINE void event2_newevent (int no, evt t, uae_u32 data) { - if (int(t) <= 0) { - func(data); - return; - } - event2_newevent_xx(no, t * CYCLE_UNIT, data, func); + eventtab2[no].active = true; + eventtab2[no].evtime = (t * CYCLE_UNIT) + get_cycles(); + eventtab2[no].data = data; + MISC_handler(); } -STATIC_INLINE void event2_newevent(int no, evt t, uae_u32 data) -{ - event2_newevent_x(no, t, data, eventtab2[no].handler); -} -STATIC_INLINE void event2_newevent2(evt t, uae_u32 data, evfunc2 func) -{ - event2_newevent_x(-1, t, data, func); -} - -STATIC_INLINE void event2_remevent(int no) +STATIC_INLINE void event2_remevent (int no) { eventtab2[no].active = 0; } -#endif +STATIC_INLINE void event_newevent (int no, evt t) +{ + evt ct = get_cycles(); + eventtab[no].active = true; + eventtab[no].evtime = ct + t * CYCLE_UNIT; + events_schedule(); +} + +STATIC_INLINE void event_remevent (int no) +{ + eventtab[no].active = 0; +} + +#endif /* UAE_EVENTS_H */ diff --git a/src/include/filesys.h b/src/include/filesys.h index b7a5d825..f580e578 100644 --- a/src/include/filesys.h +++ b/src/include/filesys.h @@ -1,4 +1,4 @@ -/* + /* * UAE - The Un*x Amiga Emulator * * Unix file system handler for AmigaDOS @@ -6,65 +6,43 @@ * Copyright 1997 Bernd Schmidt */ -#ifndef FILESYS_H -#define FILESYS_H +#ifndef UAE_FILESYS_H +#define UAE_FILESYS_H -struct hardfilehandle; +#include "uae/types.h" +#include "traps.h" -#define MAX_HDF_CACHE_BLOCKS 128 #define MAX_SCSI_SENSE 36 -struct hdf_cache -{ - bool valid; - uae_u8 *data; - uae_u64 block; - bool dirty; - int readcount; - int writecount; - time_t lastaccess; -}; struct hardfiledata { - uae_u64 virtsize; // virtual size - uae_u64 physsize; // physical size (dynamic disk) - uae_u64 offset; + uae_u64 virtsize; // virtual size + uae_u64 physsize; // physical size (dynamic disk) + uae_u64 offset; struct uaedev_config_info ci; - struct hardfilehandle *handle; - int handle_valid; - int dangerous; - int flags; - uae_u8 *cache; - int cache_valid; - uae_u64 cache_offset; - TCHAR vendor_id[8 + 1]; - TCHAR product_id[16 + 1]; - TCHAR product_rev[4 + 1]; - /* geometry from possible RDSK block */ - int rdbcylinders; - int rdbsectors; - int rdbheads; - uae_u8 *virtual_rdb; - uae_u64 virtual_size; - int unitnum; - int byteswap; - int adide; - int hfd_type; + struct hardfilehandle *handle; + int handle_valid; + int dangerous; + int flags; + uae_u8 *cache; + int cache_valid; + uae_u64 cache_offset; + TCHAR vendor_id[8 + 1]; + TCHAR product_id[16 + 1]; + TCHAR product_rev[4 + 1]; + /* geometry from possible RDSK block */ + int rdbcylinders; + int rdbsectors; + int rdbheads; + uae_u8 *virtual_rdb; + uae_u64 virtual_size; + int unitnum; + int byteswap; + int adide; + int hfd_type; - uae_u8 *vhd_header; - uae_u32 vhd_bamoffset; - uae_u32 vhd_bamsize; - uae_u32 vhd_blocksize; - uae_u8 *vhd_sectormap; - uae_u64 vhd_sectormapblock; - uae_u32 vhd_bitmapsize; - uae_u64 vhd_footerblock; + int drive_empty; + TCHAR *emptyname; - void *chd_handle; - - int drive_empty; - TCHAR *emptyname; - - struct hdf_cache bcache[MAX_HDF_CACHE_BLOCKS]; uae_u8 scsi_sense[MAX_SCSI_SENSE]; struct uaedev_config_info delayedci; @@ -73,23 +51,20 @@ struct hardfiledata { bool unit_stopped; }; -#define HFD_FLAGS_REALDRIVE 1 -#define HFD_FLAGS_REALDRIVEPARTITION 2 - struct hd_hardfiledata { - struct hardfiledata hfd; - uae_u64 size; - int cyls; - int heads; - int secspertrack; - int cyls_def; - int secspertrack_def; - int heads_def; - int ansi_version; + struct hardfiledata hfd; + uae_u64 size; + int cyls; + int heads; + int secspertrack; + int cyls_def; + int secspertrack_def; + int heads_def; + int ansi_version; }; -#define HD_CONTROLLER_EXPANSION_MAX 120 -#define HD_CONTROLLER_NEXT_UNIT 300 +#define HD_CONTROLLER_EXPANSION_MAX 50 +#define HD_CONTROLLER_NEXT_UNIT 200 #define HD_CONTROLLER_TYPE_UAE 0 #define HD_CONTROLLER_TYPE_IDE_AUTO (HD_CONTROLLER_TYPE_UAE + 1) @@ -108,41 +83,35 @@ struct hd_hardfiledata { #define FILESYS_HARDFILE 1 #define FILESYS_HARDFILE_RDB 2 #define FILESYS_HARDDRIVE 3 -#define FILESYS_CD 4 -#define FILESYS_TAPE 5 #define MAX_FILESYSTEM_UNITS 30 struct uaedev_mount_info; extern struct uaedev_mount_info options_mountinfo; -extern struct hardfiledata* get_hardfile_data(int nr); +extern struct hardfiledata *get_hardfile_data (int nr); #define FILESYS_MAX_BLOCKSIZE 2048 -extern int hdf_open(struct hardfiledata* hfd); -extern int hdf_open(struct hardfiledata* hfd, const TCHAR* altname); -extern void hdf_close(struct hardfiledata* hfd); -extern int hdf_read_rdb(struct hardfiledata* hfd, void* buffer, uae_u64 offset, int len); -extern int hdf_read(struct hardfiledata* hfd, void* buffer, uae_u64 offset, int len); -extern int hdf_write(struct hardfiledata* hfd, void* buffer, uae_u64 offset, int len); -extern int get_native_path(uae_u32 lock, TCHAR* out); -extern void hardfile_do_disk_change(struct uaedev_config_data* uci, bool insert); -extern void hardfile_send_disk_change(struct hardfiledata* hfd, bool insert); -extern int hardfile_media_change(struct hardfiledata* hfd, struct uaedev_config_info* ci, bool inserted, bool timer); +extern int hdf_open (struct hardfiledata *hfd); +extern int hdf_open (struct hardfiledata *hfd, const TCHAR *altname); +extern void hdf_close (struct hardfiledata *hfd); +extern int hdf_read_rdb (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len); +extern int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len); +extern int hdf_write (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len); +extern int get_native_path(TrapContext *ctx, uae_u32 lock, TCHAR *out); +extern void hardfile_do_disk_change (struct uaedev_config_data *uci, bool insert); +extern void hardfile_send_disk_change (struct hardfiledata *hfd, bool insert); +extern int hardfile_media_change (struct hardfiledata *hfd, struct uaedev_config_info *ci, bool inserted, bool timer); +extern int hardfile_added (struct uaedev_config_info *ci); -void hdf_hd_close(struct hd_hardfiledata* hfd); -int hdf_hd_open(struct hd_hardfiledata* hfd); +void hdf_hd_close(struct hd_hardfiledata *hfd); +int hdf_hd_open(struct hd_hardfiledata *hfd); -extern int vhd_create(const TCHAR *name, uae_u64 size, uae_u32); +extern int hdf_open_target (struct hardfiledata *hfd, const TCHAR *name); +extern void hdf_close_target (struct hardfiledata *hfd); +extern int hdf_read_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len); +extern int hdf_write_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len); +extern void getchsgeometry (uae_u64 size, int *pcyl, int *phead, int *psectorspertrack); +extern void getchsgeometry_hdf (struct hardfiledata *hfd, uae_u64 size, int *pcyl, int *phead, int *psectorspertrack); +extern void getchspgeometry (uae_u64 total, int *pcyl, int *phead, int *psectorspertrack, bool idegeometry); -extern int hdf_init_target(); -extern int hdf_open_target(struct hardfiledata *hfd, const TCHAR *name); -extern int hdf_dup_target(struct hardfiledata *dhfd, const struct hardfiledata *shfd); -extern void hdf_close_target(struct hardfiledata *hfd); -extern int hdf_read_target(struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len); -extern int hdf_write_target(struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len); -extern int hdf_resize_target(struct hardfiledata *hfd, uae_u64 newsize); -extern void getchsgeometry(uae_u64 size, int *pcyl, int *phead, int *psectorspertrack); -extern void getchsgeometry_hdf(struct hardfiledata *hfd, uae_u64 size, int *pcyl, int *phead, int *psectorspertrack); -extern void getchspgeometry(uae_u64 total, int *pcyl, int *phead, int *psectorspertrack, bool idegeometry); - -#endif /* MEMORY_H */ +#endif /* UAE_FILESYS_H */ diff --git a/src/include/gfxboard.h b/src/include/gfxboard.h index f9e850b2..6d0ef890 100644 --- a/src/include/gfxboard.h +++ b/src/include/gfxboard.h @@ -1,89 +1,12 @@ +#ifndef UAE_GFXBOARD_H +#define UAE_GFXBOARD_H -#pragma once -#include "picasso96.h" - -extern bool gfxboard_init_memory(struct autoconfig_info*); -extern bool gfxboard_init_memory_p4_z2(struct autoconfig_info*); -extern bool gfxboard_init_registers(struct autoconfig_info*); -extern void gfxboard_free(void); -extern void gfxboard_reset(void); -extern bool gfxboard_vsync_handler(bool); -extern void gfxboard_hsync_handler(void); -extern int gfxboard_get_configtype(struct rtgboardconfig*); -extern bool gfxboard_is_registers(struct rtgboardconfig*); -extern int gfxboard_get_vram_min(struct rtgboardconfig*); -extern int gfxboard_get_vram_max(struct rtgboardconfig*); -extern bool gfxboard_need_byteswap(struct rtgboardconfig*); -extern int gfxboard_get_autoconfig_size(struct rtgboardconfig*); -extern double gfxboard_get_vsync(void); -extern void gfxboard_refresh(void); -extern int gfxboard_toggle(int mode, int msg); -extern int gfxboard_num_boards(struct rtgboardconfig*); -extern uae_u32 gfxboard_get_romtype(struct rtgboardconfig*); +extern int gfxboard_get_configtype (struct rtgboardconfig*); extern const TCHAR *gfxboard_get_name(int); -extern const TCHAR *gfxboard_get_manufacturername(int); extern const TCHAR *gfxboard_get_configname(int); -extern struct gfxboard_func *gfxboard_get_func(struct rtgboardconfig *rbc); - -extern bool gfxboard_allocate_slot(int, int); -extern void gfxboard_free_slot(int); -extern bool gfxboard_rtg_enable_initial(int); -extern void gfxboard_rtg_disable(int); -extern bool gfxboard_init_board(struct autoconfig_info*); - -extern struct gfxboard_func a2410_func; -extern struct gfxboard_func harlequin_func; - -extern void vga_io_put(int board, int portnum, uae_u8 v); -extern uae_u8 vga_io_get(int board, int portnum); -extern void vga_ram_put(int board, int offset, uae_u8 v); -extern uae_u8 vga_ram_get(int board, int offset); - -void gfxboard_get_a8_vram(int index); -void gfxboard_free_vram(int index); - -int gfxboard_get_devnum(struct uae_prefs *p, int index); #define GFXBOARD_UAE_Z2 0 #define GFXBOARD_UAE_Z3 1 #define GFXBOARD_HARDWARE 2 -#define GFXBOARD_PICASSO2 2 -#define GFXBOARD_PICASSO2PLUS 3 -#define GFXBOARD_PICCOLO_Z2 4 -#define GFXBOARD_PICCOLO_Z3 5 -#define GFXBOARD_SD64_Z2 6 -#define GFXBOARD_SD64_Z3 7 -#define GFXBOARD_SPECTRUM_Z2 8 -#define GFXBOARD_SPECTRUM_Z3 9 -#define GFXBOARD_PICASSO4_Z2 10 -#define GFXBOARD_PICASSO4_Z3 11 -#define GFXBOARD_A2410 12 -#define GFXBOARD_VGA 13 - -struct gfxboard_mode -{ - int width; - int height; - RGBFTYPE mode; - bool redraw_required; -}; - -typedef bool(*GFXBOARD_INIT)(struct autoconfig_info*); -typedef void(*GFXBOARD_FREE)(void*); -typedef void(*GFXBOARD_RESET)(void*); -typedef void(*GFXBOARD_HSYNC)(void*); -typedef bool(*GFXBOARD_VSYNC)(void*, struct gfxboard_mode*); -typedef bool(*GFXBOARD_TOGGLE)(void*, int); -typedef void(*GFXBOARD_CONFIGURED)(void*, uae_u32); - -struct gfxboard_func -{ - GFXBOARD_INIT init; - GFXBOARD_FREE free; - GFXBOARD_RESET reset; - GFXBOARD_HSYNC hsync; - GFXBOARD_VSYNC vsync; - GFXBOARD_TOGGLE toggle; - GFXBOARD_CONFIGURED configured; -}; \ No newline at end of file +#endif /* UAE_GFXBOARD_H */ diff --git a/src/include/gui.h b/src/include/gui.h index c4ccd377..bcaa1ef6 100644 --- a/src/include/gui.h +++ b/src/include/gui.h @@ -91,7 +91,7 @@ typedef enum { NUMSG_KICKREPNO, NUMSG_KS68030PLUS, NUMSG_NOMEMORY, - NUMSG_LAST + NUMSG_LAST // 20 } notify_user_msg; #endif /* UAE_GUI_H */ diff --git a/src/include/inputdevice.h b/src/include/inputdevice.h index b3f03e0b..3ee7dc95 100644 --- a/src/include/inputdevice.h +++ b/src/include/inputdevice.h @@ -7,7 +7,11 @@ * Copyright 2001-2002 Toni Wilen */ -#pragma once +#ifndef UAE_INPUTDEVICE_H +#define UAE_INPUTDEVICE_H + +#include "uae/types.h" + #define DIR_LEFT_BIT 0 #define DIR_RIGHT_BIT 1 #define DIR_UP_BIT 2 @@ -31,8 +35,7 @@ #define IDTYPE_JOYSTICK 0 #define IDTYPE_MOUSE 1 #define IDTYPE_KEYBOARD 2 -#define IDTYPE_INTERNALEVENT 3 -#define IDTYPE_MAX 4 +#define IDTYPE_MAX 3 struct inputdevice_functions { int (*init)(void); @@ -41,8 +44,8 @@ struct inputdevice_functions { void (*unacquire)(int); void (*read)(void); int (*get_num)(void); - const char* (*get_friendlyname)(int); - const char* (*get_uniquename)(int); + const TCHAR* (*get_friendlyname)(int); + const TCHAR* (*get_uniquename)(int); int (*get_widget_num)(int); int (*get_widget_type)(int,int,TCHAR*,uae_u32*); int (*get_widget_first)(int,int); @@ -51,7 +54,6 @@ struct inputdevice_functions { extern struct inputdevice_functions inputdevicefunc_joystick; extern struct inputdevice_functions inputdevicefunc_mouse; extern struct inputdevice_functions inputdevicefunc_keyboard; -extern int pause_emulation; struct uae_input_device_default_node { @@ -67,10 +69,12 @@ struct uae_input_device_kbr_default { struct inputevent { const TCHAR *confname; const TCHAR *name; + const TCHAR *shortname; int allow_mask; int type; int unit; int data; + int portid; }; #define MAX_INPUT_QUALIFIERS (8 + 5) @@ -89,23 +93,23 @@ struct inputevent { #define ID_FLAG_GAMEPORTSCUSTOM_MASK (ID_FLAG_GAMEPORTSCUSTOM1 | ID_FLAG_GAMEPORTSCUSTOM2) #define ID_FLAG_AUTOFIRE_MASK (ID_FLAG_TOGGLE | ID_FLAG_INVERTTOGGLE | ID_FLAG_AUTOFIRE) -#define ID_FLAG_QUALIFIER1 0x000000100000000 -#define ID_FLAG_QUALIFIER1_R 0x000000200000000 -#define ID_FLAG_QUALIFIER2 0x000000400000000 -#define ID_FLAG_QUALIFIER3 0x000001000000000 -#define ID_FLAG_QUALIFIER4 0x000004000000000 -#define ID_FLAG_QUALIFIER5 0x000010000000000 -#define ID_FLAG_QUALIFIER6 0x000040000000000 -#define ID_FLAG_QUALIFIER7 0x000100000000000 -#define ID_FLAG_QUALIFIER8 0x000400000000000 -#define ID_FLAG_QUALIFIER_SPECIAL 0x001000000000000 -#define ID_FLAG_QUALIFIER_SPECIAL_R 0x002000000000000 -#define ID_FLAG_QUALIFIER_SHIFT 0x004000000000000 -#define ID_FLAG_QUALIFIER_CONTROL 0x010000000000000 -#define ID_FLAG_QUALIFIER_ALT 0x040000000000000 -#define ID_FLAG_QUALIFIER_WIN 0x100000000000000 -#define ID_FLAG_QUALIFIER_MASK 0xfffffff00000000 -#define ID_FLAG_QUALIFIER_MASK_R 0xaaaaaaa00000000 +#define ID_FLAG_QUALIFIER1 0x000000100000000ULL +#define ID_FLAG_QUALIFIER1_R 0x000000200000000ULL +#define ID_FLAG_QUALIFIER2 0x000000400000000ULL +#define ID_FLAG_QUALIFIER3 0x000001000000000ULL +#define ID_FLAG_QUALIFIER4 0x000004000000000ULL +#define ID_FLAG_QUALIFIER5 0x000010000000000ULL +#define ID_FLAG_QUALIFIER6 0x000040000000000ULL +#define ID_FLAG_QUALIFIER7 0x000100000000000ULL +#define ID_FLAG_QUALIFIER8 0x000400000000000ULL +#define ID_FLAG_QUALIFIER_SPECIAL 0x001000000000000ULL +#define ID_FLAG_QUALIFIER_SPECIAL_R 0x002000000000000ULL +#define ID_FLAG_QUALIFIER_SHIFT 0x004000000000000ULL +#define ID_FLAG_QUALIFIER_CONTROL 0x010000000000000ULL +#define ID_FLAG_QUALIFIER_ALT 0x040000000000000ULL +#define ID_FLAG_QUALIFIER_WIN 0x100000000000000ULL +#define ID_FLAG_QUALIFIER_MASK 0xfffffff00000000ULL +#define ID_FLAG_QUALIFIER_MASK_R 0xaaaaaaa00000000ULL #define ID_FLAG_SAVE_MASK_CONFIG 0x000001ff #define ID_FLAG_SAVE_MASK_QUALIFIERS ID_FLAG_QUALIFIER_MASK @@ -127,28 +131,33 @@ struct inputevent { #define IDEV_MAPPED_SET_ONOFF 128 #define IDEV_MAPPED_SET_ONOFF_VAL 256 -#define IDEV_MAPPED_QUALIFIER1 0x000000100000000 -#define IDEV_MAPPED_QUALIFIER2 0x000000400000000 -#define IDEV_MAPPED_QUALIFIER3 0x000001000000000 -#define IDEV_MAPPED_QUALIFIER4 0x000004000000000 -#define IDEV_MAPPED_QUALIFIER5 0x000010000000000 -#define IDEV_MAPPED_QUALIFIER6 0x000040000000000 -#define IDEV_MAPPED_QUALIFIER7 0x000100000000000 -#define IDEV_MAPPED_QUALIFIER8 0x000400000000000 -#define IDEV_MAPPED_QUALIFIER_SPECIAL 0x001000000000000 -#define IDEV_MAPPED_QUALIFIER_SHIFT 0x004000000000000 -#define IDEV_MAPPED_QUALIFIER_CONTROL 0x010000000000000 -#define IDEV_MAPPED_QUALIFIER_ALT 0x040000000000000 -#define IDEV_MAPPED_QUALIFIER_WIN 0x100000000000000 -#define IDEV_MAPPED_QUALIFIER_MASK 0xfffffff00000000 +#define IDEV_MAPPED_QUALIFIER1 0x000000100000000ULL +#define IDEV_MAPPED_QUALIFIER2 0x000000400000000ULL +#define IDEV_MAPPED_QUALIFIER3 0x000001000000000ULL +#define IDEV_MAPPED_QUALIFIER4 0x000004000000000ULL +#define IDEV_MAPPED_QUALIFIER5 0x000010000000000ULL +#define IDEV_MAPPED_QUALIFIER6 0x000040000000000ULL +#define IDEV_MAPPED_QUALIFIER7 0x000100000000000ULL +#define IDEV_MAPPED_QUALIFIER8 0x000400000000000ULL +#define IDEV_MAPPED_QUALIFIER_SPECIAL 0x001000000000000ULL +#define IDEV_MAPPED_QUALIFIER_SHIFT 0x004000000000000ULL +#define IDEV_MAPPED_QUALIFIER_CONTROL 0x010000000000000ULL +#define IDEV_MAPPED_QUALIFIER_ALT 0x040000000000000ULL +#define IDEV_MAPPED_QUALIFIER_WIN 0x100000000000000ULL +#define IDEV_MAPPED_QUALIFIER_MASK 0xfffffff00000000ULL #define SET_ONOFF_ON_VALUE 0x7fffff01 #define SET_ONOFF_OFF_VALUE 0x7fffff00 #define ID_BUTTON_OFFSET 0 -#define ID_BUTTON_TOTAL 32 -#define ID_AXIS_OFFSET 32 -#define ID_AXIS_TOTAL 32 +#define ID_BUTTON_TOTAL 128 +#define ID_AXIS_OFFSET 128 +#define ID_AXIS_TOTAL 64 + +//#define ID_BUTTON_OFFSET 0 +//#define ID_BUTTON_TOTAL 32 +//#define ID_AXIS_OFFSET 32 +//#define ID_AXIS_TOTAL 32 #define MAX_COMPA_INPUTLIST 30 @@ -167,88 +176,74 @@ struct inputevent { #define AM_KK (AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT) #define AM_KT (AM_K|AM_SETTOGGLE) -extern int inputdevice_iterate(int devnum, int num, TCHAR *name, int *af); -extern bool inputdevice_set_gameports_mapping(struct uae_prefs *prefs, int devnum, int num, int evtnum, uae_u64 flags, int port, int input_selected_setting); -extern int inputdevice_set_mapping(int devnum, int num, const TCHAR *name, TCHAR *custom, uae_u64 flags, int port, int sub); -extern int inputdevice_get_mapping(int devnum, int num, uae_u64 *pflags, int *port, TCHAR *name, TCHAR *custom, int sub); -extern void inputdevice_copyconfig(const struct uae_prefs *src, struct uae_prefs *dst); -extern void inputdevice_copy_single_config(struct uae_prefs *p, int src, int dst, int devnum, int selectedwidget); -extern void inputdevice_swap_ports(struct uae_prefs *p, int devnum); -extern void inputdevice_swap_compa_ports(struct uae_prefs *p, int portswap); -extern void inputdevice_config_change(void); -extern int inputdevice_config_change_test(void); -extern int inputdevice_get_device_index(int devnum); -extern const char* inputdevice_get_device_name(int type, int devnum); -extern const char* inputdevice_get_device_name2(int devnum); -extern const char* inputdevice_get_device_unique_name(int type, int devnum); -extern int inputdevice_get_device_status(int devnum); -extern void inputdevice_set_device_status(int devnum, int enabled); -extern int inputdevice_get_device_total(int type); -extern int inputdevice_get_widget_num(int devnum); -extern int inputdevice_get_widget_type(int devnum, int num, TCHAR *name); +extern int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af); +extern bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int num, int evtnum, uae_u64 flags, int port, int input_selected_setting); +extern int inputdevice_set_mapping (int devnum, int num, const TCHAR *name, TCHAR *custom, uae_u64 flags, int port, int sub); +extern int inputdevice_get_mapping (int devnum, int num, uae_u64 *pflags, int *port, TCHAR *name, TCHAR *custom, int sub); +extern void inputdevice_copyconfig (struct uae_prefs *src, struct uae_prefs *dst); +extern void inputdevice_copy_single_config (struct uae_prefs *p, int src, int dst, int devnum, int selectedwidget); +extern void inputdevice_copyjports(struct uae_prefs *srcprefs, struct uae_prefs *dstprefs); +extern void inputdevice_swap_ports (struct uae_prefs *p, int devnum); +extern void inputdevice_swap_compa_ports (struct uae_prefs *p, int portswap); +extern void inputdevice_config_change (void); +extern int inputdevice_config_change_test (void); +extern int inputdevice_get_device_index (int devnum); +extern const TCHAR *inputdevice_get_device_name (int type, int devnum); +extern const TCHAR *inputdevice_get_device_name2 (int devnum); +extern const TCHAR *inputdevice_get_device_unique_name (int type, int devnum); +extern int inputdevice_get_device_status (int devnum); +extern void inputdevice_set_device_status (int devnum, int enabled); +extern int inputdevice_get_device_total (int type); +extern int inputdevice_get_widget_num (int devnum); +extern int inputdevice_get_widget_type (int devnum, int num, TCHAR *name, bool inccode); -extern int input_get_default_mouse(struct uae_input_device *uid, int num, int port, int af, bool gp, bool wheel, bool joymouseswap); -extern int input_get_default_lightpen(struct uae_input_device *uid, int num, int port, int af, bool gp, bool joymouseswap); -extern int input_get_default_joystick(struct uae_input_device *uid, int num, int port, int af, int mode, bool gp, bool joymouseswap); -extern int input_get_default_joystick_analog(struct uae_input_device *uid, int num, int port, int af, bool gp, bool joymouseswap); -extern int input_get_default_keyboard(int num); +extern int input_get_default_mouse (struct uae_input_device *uid, int num, int port, int af, bool gp, bool wheel, bool joymouseswap); +extern int input_get_default_joystick (struct uae_input_device *uid, int num, int port, int af, int mode, bool gp, bool joymouseswap); +extern int input_get_default_joystick_analog (struct uae_input_device *uid, int num, int port, int af, bool gp, bool joymouseswap); +extern int input_get_default_keyboard (int num); #define DEFEVENT(A, B, C, D, E, F) INPUTEVENT_ ## A, +#define DEFEVENT2(A, B, B2, C, D, E, F, G) INPUTEVENT_ ## A, enum inputevents { INPUTEVENT_ZERO, -#include "inputevents.def" +#include "../inputevents.def" INPUTEVENT_END }; #undef DEFEVENT +#undef DEFEVENT2 extern void handle_cd32_joystick_cia (uae_u8, uae_u8); extern uae_u8 handle_parport_joystick (int port, uae_u8 pra, uae_u8 dra); extern uae_u8 handle_joystick_buttons (uae_u8, uae_u8); -#define MAGICMOUSE_BOTH 0 -#define MAGICMOUSE_NATIVE_ONLY 1 -#define MAGICMOUSE_HOST_ONLY 2 - -extern int magicmouse_alive(void); -extern int is_tablet(void); -extern int inputdevice_is_tablet(void); extern int inputdevice_is_tablet (void); -extern int input_mousehack_status (int mode, uaecptr diminfo, uaecptr dispinfo, uaecptr vp, uae_u32 moffset); +extern int input_mousehack_status(TrapContext *ctx, int mode, uaecptr diminfo, uaecptr dispinfo, uaecptr vp, uae_u32 moffset); extern void input_mousehack_mouseoffset (uaecptr pointerprefs); -extern int mousehack_alive(void); -extern void setmouseactive(int); -extern bool ismouseactive(void); +extern void mousehack_wakeup(void); -extern void setmousebuttonstateall(int mouse, uae_u32 buttonbits, uae_u32 buttonmask); -extern void setjoybuttonstateall(int joy, uae_u32 buttonbits, uae_u32 buttonmask); -extern void setjoybuttonstate(int joy, int button, int state); -extern void setmousebuttonstate(int mouse, int button, int state); -extern void setjoystickstate(int joy, int axle, int state, int max); -extern int getjoystickstate(int mouse); -void setmousestate(int mouse, int axis, int data, int isabs); -extern int getmousestate(int mouse); -extern void inputdevice_updateconfig(const struct uae_prefs *srcprefs, struct uae_prefs *dstprefs); -extern void inputdevice_updateconfig_internal(const struct uae_prefs *srcprefs, struct uae_prefs *dstprefs); +extern void setjoybuttonstate (int joy, int button, int state); +extern void setmousebuttonstate (int mouse, int button, int state); +extern void setjoystickstate (int joy, int axle, int state, int max); +extern int getjoystickstate (int mouse); +void setmousestate (int mouse, int axis, int data, int isabs); +extern int getmousestate (int mouse); +extern void inputdevice_updateconfig (struct uae_prefs *srcprefs, struct uae_prefs *dstprefs); +extern void inputdevice_updateconfig_internal (struct uae_prefs *srcprefs, struct uae_prefs *dstprefs); extern void inputdevice_devicechange (struct uae_prefs *prefs); -#define INTERNALEVENT_CPURESET 0 -#define INTERNALEVENT_KBRESET 1 - -extern void send_internalevent (int eventid); - extern int inputdevice_translatekeycode (int keyboard, int scancode, int state); extern void inputdevice_checkqualifierkeycode (int keyboard, int scancode, int state); extern void inputdevice_setkeytranslation (struct uae_input_device_kbr_default **trans, int **kbmaps); extern void inputdevice_do_keyboard (int code, int state); extern int inputdevice_iskeymapped (int keyboard, int scancode); -extern int inputdevice_synccapslock(int, int*); extern int inputdevice_get_compatibility_input (struct uae_prefs*, int index, int *typelist, int *inputlist, const int **at); -extern struct inputevent *inputdevice_get_eventinfo (int evt); +extern const struct inputevent *inputdevice_get_eventinfo (int evt); extern bool inputdevice_get_eventname (const struct inputevent *ie, TCHAR *out); extern void inputdevice_compa_prepare_custom (struct uae_prefs *prefs, int index, int mode, bool removeold); extern void inputdevice_compa_clear (struct uae_prefs *prefs, int index); extern int intputdevice_compa_get_eventtype (int evt, const int **axistable); extern void inputdevice_sparecopy (struct uae_input_device *uid, int num, int sub); +extern void inputdevice_forget_unplugged_device(int portnum); extern uae_u16 potgo_value; extern uae_u16 POTGOR (void); @@ -267,12 +262,12 @@ extern void inputdevice_reset (void); extern void write_inputdevice_config (struct uae_prefs *p, struct zfile *f); extern void read_inputdevice_config (struct uae_prefs *p, const TCHAR *option, TCHAR *value); -extern void reset_inputdevice_config (struct uae_prefs *pr); -extern void store_inputdevice_config (struct uae_prefs *pr); -extern void restore_inputdevice_config (struct uae_prefs *p, int portnum); -extern int inputdevice_joyport_config (struct uae_prefs *p, const TCHAR *value, int portnum, int mode, int type, bool validate); +extern void reset_inputdevice_config (struct uae_prefs *pr, bool reset); +extern int inputdevice_joyport_config(struct uae_prefs *p, const TCHAR *value1, const TCHAR *value2, int portnum, int mode, int type, bool candefault); +extern void inputdevice_joyport_config_store(struct uae_prefs *p, const TCHAR *value, int portnum, int mode, int type); extern int inputdevice_getjoyportdevice (int port, int val); -extern void inputdevice_validate_jports (struct uae_prefs *p, int changedport); +extern void inputdevice_validate_jports (struct uae_prefs *p, int changedport, bool *fixedports); +extern void inputdevice_fix_prefs(struct uae_prefs *p, bool userconfig); extern void inputdevice_init (void); extern void inputdevice_close (void); @@ -280,25 +275,15 @@ extern void inputdevice_default_prefs (struct uae_prefs *p); extern void inputdevice_acquire (int allmode); extern void inputdevice_unacquire (void); - -extern void indicator_leds(int num, int state); - -extern void warpmode(int mode); -extern void pausemode(int mode); +extern void inputdevice_unacquire(bool emulationactive, int inputmask); extern void inputdevice_add_inputcode (int code, int state); extern void inputdevice_handle_inputcode (void); -extern void inputdevice_tablet(int x, int y, int z, - int pressure, uae_u32 buttonbits, int inproximity, - int ax, int ay, int az); -extern void inputdevice_tablet_info(int maxx, int maxy, int maxz, int maxax, int maxay, int maxaz, int xres, int yres); -extern void inputdevice_tablet_strobe(void); +extern void inputdevice_tablet_strobe (void); extern uae_u64 input_getqualifiers (void); -extern void setsystime (void); - #define JSEM_MODE_DEFAULT 0 #define JSEM_MODE_WHEELMOUSE 1 #define JSEM_MODE_MOUSE 2 @@ -318,7 +303,6 @@ extern void setsystime (void); #define JSEM_ISNUMPAD(port,p) (jsem_iskbdjoy(port,p) == JSEM_KBDLAYOUT) #define JSEM_ISCURSOR(port,p) (jsem_iskbdjoy(port,p) == JSEM_KBDLAYOUT + 1) #define JSEM_ISSOMEWHEREELSE(port,p) (jsem_iskbdjoy(port,p) == JSEM_KBDLAYOUT + 2) -#define JSEM_ISCUSTOM(port,p) ((p)->jports[port].id >= JSEM_CUSTOM && (p)->jports[port].id < JSEM_CUSTOM + MAX_JPORTS_CUSTOM) #define JSEM_GETCUSTOMIDX(port,p) ((p)->jports[port].id - JSEM_CUSTOM) #define JSEM_LASTKBD 3 #define JSEM_ISANYKBD(port,p) (jsem_iskbdjoy(port,p) >= JSEM_KBDLAYOUT && jsem_iskbdjoy(port,p) < JSEM_KBDLAYOUT + JSEM_LASTKBD) @@ -328,3 +312,85 @@ extern int jsem_ismouse (int port, const struct uae_prefs *p); extern int jsem_iskbdjoy (int port, const struct uae_prefs *p); extern int inputdevice_uaelib (const TCHAR *, const TCHAR *); +extern int inputdevice_uaelib(const TCHAR *s, int parm, int max, bool autofire); + +extern bool target_can_autoswitchdevice(void); + + +struct host_input_button { + int north_button; + int east_button; + int south_button; + int west_button; + int dpad_left; + int dpad_right; + int dpad_up; + int dpad_down; + int select_button; + int start_button; + + int left_shoulder; + int right_shoulder; + int left_trigger; + int right_trigger; + + int lstick_button; + int lstick_axis_y; + int lstick_axis_x; + int lstick_left; + int lstick_right; + int lstick_up; + int lstick_down; + + int rstick_button; + int rstick_axis_y; + int rstick_axis_x; + int rstick_left; + int rstick_right; + int rstick_up; + int rstick_down; + + int hotkey_button; + int quit_button; + int menu_button; + int reset_button; + int load_state_button; + int save_state_button; + + int number_of_hats; + int number_of_axis; + + bool is_retroarch; +}; + +struct host_keyboard_button { + + int north_button; + int east_button; + int south_button; + int west_button; + int dpad_left; + int dpad_right; + int dpad_up; + int dpad_down; + int left_shoulder; + int right_shoulder; + int select_button; + int start_button; + int lstick_button; + int rstick_button; + + bool is_retroarch; + +}; + + +extern struct host_input_button host_input_buttons[MAX_INPUT_DEVICES]; + +extern int multipler_maps[MAX_JPORTS]; + + +extern int find_in_array(const int arr[], int n, int key); + + +#endif /* UAE_INPUTDEVICE_H */ diff --git a/src/include/keyboard.h b/src/include/keyboard.h index a4f0a7b4..f180ddcf 100644 --- a/src/include/keyboard.h +++ b/src/include/keyboard.h @@ -7,6 +7,16 @@ */ #pragma once + +#ifdef USE_SDL1 +#define KEYCODE_UNK 0 +#define KEYCODE_X11 1 +#define KEYCODE_FBCON 2 + +extern char keyboard_type; +extern void init_keyboard(void); +#endif + /* First, two dummies */ #define AK_mousestuff 0x100 #define AK_inhibit 0x101 diff --git a/src/include/keybuf.h b/src/include/keybuf.h index 28041c8e..1924b3ce 100644 --- a/src/include/keybuf.h +++ b/src/include/keybuf.h @@ -7,12 +7,12 @@ * (c) 1996 Bernd Schmidt */ -#pragma once -extern int get_next_key(void); -extern int keys_available(void); -extern int record_key(int); -extern int record_key_direct(int); -extern void keybuf_init(void); -extern int getcapslockstate(void); -extern void setcapslockstate(int); -extern void keybuf_inject(const uae_char*); +#ifndef UAE_KEYBUF_H +#define UAE_KEYBUF_H + +extern int get_next_key (void); +extern int keys_available (void); +extern int record_key (int); +extern void keybuf_init (void); + +#endif /* UAE_KEYBUF_H */ diff --git a/src/include/memory.h b/src/include/memory.h index 1f37c79e..dc65071b 100644 --- a/src/include/memory.h +++ b/src/include/memory.h @@ -6,34 +6,19 @@ * Copyright 1995 Bernd Schmidt */ -#ifndef MEMORY_H -#define MEMORY_H +#ifndef UAE_MEMORY_H +#define UAE_MEMORY_H -#include "options.h" - -extern void memory_reset(void); -extern void memory_restore(void); -extern void a1000_reset(void); +extern void memory_reset (void); #ifdef JIT extern int special_mem; - -extern uae_u8 *cache_alloc (int); -extern void cache_free (uae_u8*, int); #endif #define S_READ 1 #define S_WRITE 2 -#ifdef AMIBERRY -extern uae_u8* natmem_offset; -#endif - -bool init_shm(void); -void free_shm(void); -bool preinit_shm(void); -extern bool canbang; -extern bool jit_direct_compatible_memory; +bool init_shm (void); #define Z3BASE_UAE 0x10000000 #define Z3BASE_REAL 0x40000000 @@ -46,34 +31,26 @@ extern bool jit_direct_compatible_memory; #define MEMORY_BANKS 256 #else #define MEMORY_BANKS 65536 -#define MEMORY_RANGE_MASK (~0) #endif -typedef uae_u32(REGPARAM3 *mem_get_func)(uaecptr) REGPARAM; +typedef uae_u32 (REGPARAM3 *mem_get_func)(uaecptr) REGPARAM; typedef void (REGPARAM3 *mem_put_func)(uaecptr, uae_u32) REGPARAM; typedef uae_u8 *(REGPARAM3 *xlate_func)(uaecptr) REGPARAM; typedef int (REGPARAM3 *check_func)(uaecptr, uae_u32) REGPARAM; extern uae_u32 max_z3fastmem; -extern uae_u32 wait_cpu_cycle_read(uaecptr addr, int mode); -extern void wait_cpu_cycle_write(uaecptr addr, int mode, uae_u32 v); -extern uae_u32 wait_cpu_cycle_read_ce020(uaecptr addr, int mode); -extern void wait_cpu_cycle_write_ce020(uaecptr addr, int mode, uae_u32 v); - #undef DIRECT_MEMFUNCS_SUCCESSFUL #include "machdep/maccess.h" #define chipmem_start_addr 0x00000000 #define bogomem_start_addr 0x00C00000 -#define cardmem_start_addr 0x00E00000 #define kickmem_start_addr 0x00F80000 #define ROM_SIZE_512 524288 #define ROM_SIZE_256 262144 #define ROM_SIZE_128 131072 -extern bool ersatzkickfile; extern bool cloanto_rom, kickstart_rom; extern uae_u16 kickstart_version; extern int uae_boot_rom_type; @@ -81,8 +58,6 @@ extern int uae_boot_rom_size; extern uaecptr rtarea_base; extern uaecptr uaeboard_base; -extern uae_u8* baseaddr[]; - enum { ABFLAG_UNK = 0, ABFLAG_RAM = 1, ABFLAG_ROM = 2, ABFLAG_ROMIN = 4, ABFLAG_IO = 8, @@ -91,33 +66,32 @@ enum ABFLAG_CHIPRAM = 4096, ABFLAG_CIA = 8192, ABFLAG_PPCIOSPACE = 16384, }; typedef struct { - /* These ones should be self-explanatory... */ - mem_get_func lget, wget, bget; - mem_put_func lput, wput, bput; - /* Use xlateaddr to translate an Amiga address to a uae_u8 * that can - * be used to address memory without calling the wget/wput functions. - * This doesn't work for all memory banks, so this function may call - * abort(). */ - xlate_func xlateaddr; - /* To prevent calls to abort(), use check before calling xlateaddr. - * It checks not only that the memory bank can do xlateaddr, but also - * that the pointer points to an area of at least the specified size. - * This is used for example to translate bitplane pointers in custom.c */ - check_func check; - /* For those banks that refer to real memory, we can save the whole trouble - of going through function calls, and instead simply grab the memory - ourselves. This holds the memory address where the start of memory is - for this particular bank. */ - uae_u8 *baseaddr; + /* These ones should be self-explanatory... */ + mem_get_func lget, wget, bget; + mem_put_func lput, wput, bput; + /* Use xlateaddr to translate an Amiga address to a uae_u8 * that can + * be used to address memory without calling the wget/wput functions. + * This doesn't work for all memory banks, so this function may call + * abort(). */ + xlate_func xlateaddr; + /* To prevent calls to abort(), use check before calling xlateaddr. + * It checks not only that the memory bank can do xlateaddr, but also + * that the pointer points to an area of at least the specified size. + * This is used for example to translate bitplane pointers in custom.c */ + check_func check; + /* For those banks that refer to real memory, we can save the whole trouble + of going through function calls, and instead simply grab the memory + ourselves. This holds the memory address where the start of memory is + for this particular bank. */ + uae_u8 *baseaddr; const TCHAR *label; - const TCHAR *name; - /* for instruction opcode/operand fetches */ - mem_get_func lgeti, wgeti; - int flags; + const TCHAR *name; + /* for instruction opcode/operand fetches */ + mem_get_func lgeti, wgeti; + int flags; int jit_read_flag, jit_write_flag; struct addrbank_sub *sub_banks; uae_u32 mask; - uae_u32 startmask; uae_u32 start; // if RAM: size of allocated RAM. Zero if failed. uae_u32 allocated_size; @@ -139,7 +113,6 @@ struct autoconfig_info { struct uae_prefs *prefs; bool doinit; - bool postinit; int devnum; uae_u8 autoconfig_raw[128]; uae_u8 autoconfig_bytes[16]; @@ -150,38 +123,22 @@ struct autoconfig_info uae_u32 size; int zorro; const TCHAR *label; - addrbank *Addrbank; - uaecptr write_bank_address; + addrbank *addrbankp; struct romconfig *rc; uae_u32 last_high_ram; - const struct cpuboardsubtype *cst; const struct expansionromtype *ert; - struct autoconfig_info *parent; - const int *parent_romtype; - bool parent_of_previous; - bool parent_address_space; bool direct_vram; - const TCHAR *parent_name; bool can_sort; - bool hardwired; - bool(*get_params)(struct uae_prefs*, struct expansion_params*); - bool(*set_params)(struct uae_prefs*, struct expansion_params*); - void *userdata; + bool (*get_params)(struct uae_prefs*, struct expansion_params*); + bool (*set_params)(struct uae_prefs*, struct expansion_params*); }; -#define CE_MEMBANK_FAST32 0 -#define CE_MEMBANK_CHIP16 1 -#define CE_MEMBANK_CHIP32 2 -#define CE_MEMBANK_CIA 3 -#define CE_MEMBANK_FAST16 4 -extern uae_u8 ce_banktype[65536], ce_cachable[65536]; - #define MEMORY_LGET(name) \ static uae_u32 REGPARAM3 name ## _lget (uaecptr) REGPARAM; \ static uae_u32 REGPARAM2 name ## _lget (uaecptr addr) \ { \ uae_u8 *m; \ - addr -= name ## _bank.start & name ## _bank.mask; \ + addr -= name ## _bank.start; \ addr &= name ## _bank.mask; \ m = name ## _bank.baseaddr + addr; \ return do_get_mem_long ((uae_u32 *)m); \ @@ -191,7 +148,7 @@ static uae_u32 REGPARAM3 name ## _wget (uaecptr) REGPARAM; \ static uae_u32 REGPARAM2 name ## _wget (uaecptr addr) \ { \ uae_u8 *m; \ - addr -= name ## _bank.start & name ## _bank.mask; \ + addr -= name ## _bank.start; \ addr &= name ## _bank.mask; \ m = name ## _bank.baseaddr + addr; \ return do_get_mem_word ((uae_u16 *)m); \ @@ -200,7 +157,7 @@ static uae_u32 REGPARAM2 name ## _wget (uaecptr addr) \ static uae_u32 REGPARAM3 name ## _bget (uaecptr) REGPARAM; \ static uae_u32 REGPARAM2 name ## _bget (uaecptr addr) \ { \ - addr -= name ## _bank.start & name ## _bank.mask; \ + addr -= name ## _bank.start; \ addr &= name ## _bank.mask; \ return name ## _bank.baseaddr[addr]; \ } @@ -209,7 +166,7 @@ static void REGPARAM3 name ## _lput (uaecptr, uae_u32) REGPARAM; \ static void REGPARAM2 name ## _lput (uaecptr addr, uae_u32 l) \ { \ uae_u8 *m; \ - addr -= name ## _bank.start & name ## _bank.mask; \ + addr -= name ## _bank.start; \ addr &= name ## _bank.mask; \ m = name ## _bank.baseaddr + addr; \ do_put_mem_long ((uae_u32 *)m, l); \ @@ -219,7 +176,7 @@ static void REGPARAM3 name ## _wput (uaecptr, uae_u32) REGPARAM; \ static void REGPARAM2 name ## _wput (uaecptr addr, uae_u32 w) \ { \ uae_u8 *m; \ - addr -= name ## _bank.start & name ## _bank.mask; \ + addr -= name ## _bank.start; \ addr &= name ## _bank.mask; \ m = name ## _bank.baseaddr + addr; \ do_put_mem_word ((uae_u16 *)m, w); \ @@ -228,7 +185,7 @@ static void REGPARAM2 name ## _wput (uaecptr addr, uae_u32 w) \ static void REGPARAM3 name ## _bput (uaecptr, uae_u32) REGPARAM; \ static void REGPARAM2 name ## _bput (uaecptr addr, uae_u32 b) \ { \ - addr -= name ## _bank.start & name ## _bank.mask; \ + addr -= name ## _bank.start; \ addr &= name ## _bank.mask; \ name ## _bank.baseaddr[addr] = b; \ } @@ -236,7 +193,7 @@ static void REGPARAM2 name ## _bput (uaecptr addr, uae_u32 b) \ static int REGPARAM3 name ## _check (uaecptr addr, uae_u32 size) REGPARAM; \ static int REGPARAM2 name ## _check (uaecptr addr, uae_u32 size) \ { \ - addr -= name ## _bank.start & name ## _bank.mask; \ + addr -= name ## _bank.start; \ addr &= name ## _bank.mask; \ return (addr + size) <= name ## _bank.allocated_size; \ } @@ -244,7 +201,7 @@ static int REGPARAM2 name ## _check (uaecptr addr, uae_u32 size) \ static uae_u8 *REGPARAM3 name ## _xlate (uaecptr addr) REGPARAM; \ static uae_u8 *REGPARAM2 name ## _xlate (uaecptr addr) \ { \ - addr -= name ## _bank.start & name ## _bank.mask; \ + addr -= name ## _bank.start; \ addr &= name ## _bank.mask; \ return name ## _bank.baseaddr + addr; \ } @@ -261,18 +218,6 @@ static void REGPARAM3 NOWARN_UNUSED(name ## _bput) (uaecptr, uae_u32) REGPARAM; static int REGPARAM3 NOWARN_UNUSED(name ## _check) (uaecptr addr, uae_u32 size) REGPARAM; \ static uae_u8 *REGPARAM3 NOWARN_UNUSED(name ## _xlate) (uaecptr addr) REGPARAM; -#define DECLARE_MEMORY_FUNCTIONS_WITH_SUFFIX(name, suffix) \ -static uae_u32 REGPARAM3 NOWARN_UNUSED(name ## _lget_ ## suffix) (uaecptr) REGPARAM; \ -static uae_u32 REGPARAM3 NOWARN_UNUSED(name ## _lgeti_ ## suffix) (uaecptr) REGPARAM; \ -static uae_u32 REGPARAM3 NOWARN_UNUSED(name ## _wget_ ## suffix) (uaecptr) REGPARAM; \ -static uae_u32 REGPARAM3 NOWARN_UNUSED(name ## _wgeti_ ## suffix) (uaecptr) REGPARAM; \ -static uae_u32 REGPARAM3 NOWARN_UNUSED(name ## _bget_ ## suffix) (uaecptr) REGPARAM; \ -static void REGPARAM3 NOWARN_UNUSED(name ## _lput_ ## suffix) (uaecptr, uae_u32) REGPARAM; \ -static void REGPARAM3 NOWARN_UNUSED(name ## _wput_ ## suffix) (uaecptr, uae_u32) REGPARAM; \ -static void REGPARAM3 NOWARN_UNUSED(name ## _bput_ ## suffix) (uaecptr, uae_u32) REGPARAM; \ -static int REGPARAM3 NOWARN_UNUSED(name ## _check_ ## suffix) (uaecptr addr, uae_u32 size) REGPARAM; \ -static uae_u8 *REGPARAM3 NOWARN_UNUSED(name ## _xlate_ ## suffix) (uaecptr addr) REGPARAM; - #define MEMORY_FUNCTIONS(name) \ MEMORY_LGET(name); \ MEMORY_WGET(name); \ @@ -283,13 +228,12 @@ MEMORY_BPUT(name); \ MEMORY_CHECK(name); \ MEMORY_XLATE(name); - #define MEMORY_ARRAY_LGET(name, index) \ static uae_u32 REGPARAM3 name ## index ## _lget (uaecptr) REGPARAM; \ static uae_u32 REGPARAM2 name ## index ## _lget (uaecptr addr) \ { \ uae_u8 *m; \ - addr -= name ## _bank[index].start & name ## _bank[index].mask; \ + addr -= name ## _bank[index].start; \ addr &= name ## _bank[index].mask; \ m = name ## _bank[index].baseaddr + addr; \ return do_get_mem_long ((uae_u32 *)m); \ @@ -299,7 +243,7 @@ static uae_u32 REGPARAM3 name ## index ## _wget (uaecptr) REGPARAM; \ static uae_u32 REGPARAM2 name ## index ## _wget (uaecptr addr) \ { \ uae_u8 *m; \ - addr -= name ## _bank[index].start & name ## _bank[index].mask; \ + addr -= name ## _bank[index].start; \ addr &= name ## _bank[index].mask; \ m = name ## _bank[index].baseaddr + addr; \ return do_get_mem_word ((uae_u16 *)m); \ @@ -308,7 +252,7 @@ static uae_u32 REGPARAM2 name ## index ## _wget (uaecptr addr) \ static uae_u32 REGPARAM3 name ## index ## _bget (uaecptr) REGPARAM; \ static uae_u32 REGPARAM2 name ## index ## _bget (uaecptr addr) \ { \ - addr -= name ## _bank[index].start & name ## _bank[index].mask; \ + addr -= name ## _bank[index].start; \ addr &= name ## _bank[index].mask; \ return name ## _bank[index].baseaddr[addr]; \ } @@ -317,7 +261,7 @@ static void REGPARAM3 name ## index ## _lput (uaecptr, uae_u32) REGPARAM; \ static void REGPARAM2 name ## index ## _lput (uaecptr addr, uae_u32 l) \ { \ uae_u8 *m; \ - addr -= name ## _bank[index].start & name ## _bank[index].mask; \ + addr -= name ## _bank[index].start; \ addr &= name ## _bank[index].mask; \ m = name ## _bank[index].baseaddr + addr; \ do_put_mem_long ((uae_u32 *)m, l); \ @@ -327,7 +271,7 @@ static void REGPARAM3 name ## index ## _wput (uaecptr, uae_u32) REGPARAM; \ static void REGPARAM2 name ## index ## _wput (uaecptr addr, uae_u32 w) \ { \ uae_u8 *m; \ - addr -= name ## _bank[index].start & name ## _bank[index].mask; \ + addr -= name ## _bank[index].start; \ addr &= name ## _bank[index].mask; \ m = name ## _bank[index].baseaddr + addr; \ do_put_mem_word ((uae_u16 *)m, w); \ @@ -336,7 +280,7 @@ static void REGPARAM2 name ## index ## _wput (uaecptr addr, uae_u32 w) \ static void REGPARAM3 name ## index ## _bput (uaecptr, uae_u32) REGPARAM; \ static void REGPARAM2 name ## index ## _bput (uaecptr addr, uae_u32 b) \ { \ - addr -= name ## _bank[index].start & name ## _bank[index].mask; \ + addr -= name ## _bank[index].start; \ addr &= name ## _bank[index].mask; \ name ## _bank[index].baseaddr[addr] = b; \ } @@ -344,7 +288,7 @@ static void REGPARAM2 name ## index ## _bput (uaecptr addr, uae_u32 b) \ static int REGPARAM3 name ## index ## _check (uaecptr addr, uae_u32 size) REGPARAM; \ static int REGPARAM2 name ## index ## _check (uaecptr addr, uae_u32 size) \ { \ - addr -= name ## _bank[index].start & name ## _bank[index].mask; \ + addr -= name ## _bank[index].start; \ addr &= name ## _bank[index].mask; \ return (addr + size) <= name ## _bank[index].allocated_size; \ } @@ -352,7 +296,7 @@ static int REGPARAM2 name ## index ## _check (uaecptr addr, uae_u32 size) \ static uae_u8 *REGPARAM3 name ## index ## _xlate (uaecptr addr) REGPARAM; \ static uae_u8 *REGPARAM2 name ## index ## _xlate (uaecptr addr) \ { \ - addr -= name ## _bank[index].start & name ## _bank[index].mask; \ + addr -= name ## _bank[index].start; \ addr &= name ## _bank[index].mask; \ return name ## _bank[index].baseaddr + addr; \ } @@ -368,8 +312,6 @@ MEMORY_ARRAY_CHECK(name, index); \ MEMORY_ARRAY_XLATE(name, index); extern addrbank chipmem_bank; -extern addrbank chipmem_agnus_bank; -extern addrbank chipmem_bank_ce2; extern addrbank kickmem_bank; extern addrbank custom_bank; extern addrbank clock_bank; @@ -378,19 +320,15 @@ extern addrbank rtarea_bank; extern addrbank filesys_bank; extern addrbank uaeboard_bank; extern addrbank expamem_bank; -extern addrbank expamem_null, expamem_none; +extern addrbank expamem_null; extern addrbank fastmem_bank[MAX_RAM_BOARDS]; -extern addrbank fastmem_nojit_bank[MAX_RAM_BOARDS]; extern addrbank *gfxmem_banks[MAX_RTG_BOARDS]; extern addrbank gayle_bank; extern addrbank gayle2_bank; extern addrbank mbres_bank; extern addrbank akiko_bank; -extern addrbank cardmem_bank; extern addrbank bogomem_bank; extern addrbank z3fastmem_bank[MAX_RAM_BOARDS]; -extern addrbank z3chipmem_bank; -extern addrbank mem25bit_bank; extern addrbank a3000lmem_bank; extern addrbank a3000hmem_bank; extern addrbank extendedkickmem_bank; @@ -398,15 +336,14 @@ extern addrbank extendedkickmem2_bank; extern addrbank custmem1_bank; extern addrbank custmem2_bank; -extern void rtarea_init(void); +extern void rtarea_init (void); extern void rtarea_free(void); -extern void rtarea_init_mem(void); -extern void rtarea_setup(void); -extern void expamem_reset(void); -extern void expamem_next(addrbank *mapped, addrbank *next); -extern void expamem_shutup(addrbank *mapped); +extern void rtarea_init_mem (void); +extern void rtarea_setup (void); +extern void expamem_reset (void); +extern void expamem_next (addrbank *mapped, addrbank *next); +extern void expamem_shutup (addrbank *mapped); extern bool expamem_z3hack(struct uae_prefs*); -extern void expansion_cpu_fallback(void); extern void set_expamem_z3_hack_mode(int); extern uaecptr expamem_board_pointer, expamem_highmem_pointer; extern uaecptr expamem_z3_pointer_real, expamem_z3_pointer_uae; @@ -417,18 +354,17 @@ extern uae_u32 last_custom_value1; /* Default memory access functions */ -extern void dummy_put(uaecptr addr, int size, uae_u32 val); -extern uae_u32 dummy_get(uaecptr addr, int size, bool inst, uae_u32 defvalue); +extern uae_u32 dummy_get (uaecptr addr, int size, bool inst, uae_u32 defvalue); extern uae_u32 dummy_get_safe(uaecptr addr, int size, bool inst, uae_u32 defvalue); extern int REGPARAM3 default_check(uaecptr addr, uae_u32 size) REGPARAM; extern uae_u8 *REGPARAM3 default_xlate(uaecptr addr) REGPARAM; /* 680x0 opcode fetches */ -extern uae_u32 REGPARAM3 dummy_lgeti(uaecptr addr) REGPARAM; -extern uae_u32 REGPARAM3 dummy_wgeti(uaecptr addr) REGPARAM; +extern uae_u32 REGPARAM3 dummy_lgeti (uaecptr addr) REGPARAM; +extern uae_u32 REGPARAM3 dummy_wgeti (uaecptr addr) REGPARAM; /* sub bank support */ -extern uae_u32 REGPARAM3 sub_bank_lget(uaecptr) REGPARAM; +extern uae_u32 REGPARAM3 sub_bank_lget (uaecptr) REGPARAM; extern uae_u32 REGPARAM3 sub_bank_wget(uaecptr) REGPARAM; extern uae_u32 REGPARAM3 sub_bank_bget(uaecptr) REGPARAM; extern void REGPARAM3 sub_bank_lput(uaecptr, uae_u32) REGPARAM; @@ -444,50 +380,26 @@ extern addrbank *get_sub_bank(uaecptr *addr); extern addrbank *mem_banks[MEMORY_BANKS]; -#ifdef JIT -extern uae_u8 *baseaddr[MEMORY_BANKS]; -#endif - #define get_mem_bank(addr) (*mem_banks[bankindex(addr)]) -extern addrbank *get_mem_bank_real(uaecptr); -#ifdef JIT -#define put_mem_bank(addr, b, realstart) do { \ - (mem_banks[bankindex(addr)] = (b)); \ - if ((b)->baseaddr) \ - baseaddr[bankindex(addr)] = (b)->baseaddr - (realstart); \ - else \ - baseaddr[bankindex(addr)] = (uae_u8*)(((uae_u8*)b)+1); \ -} while (0) -#else -#define put_mem_bank(addr, b, realstart) \ - (mem_banks[bankindex(addr)] = (b)); -#endif - -extern void memory_init(void); -extern void memory_cleanup(void); -extern void restore_banks(void); -extern void map_banks(addrbank *bank, int first, int count, int realsize); -extern void map_banks_z2(addrbank *bank, int first, int count); -extern uae_u32 map_banks_z2_autosize(addrbank *bank, int first); +extern void memory_init (void); +extern void memory_cleanup (void); +extern void map_banks (addrbank *bank, int first, int count, int realsize); +extern void map_banks_z2 (addrbank *bank, int first, int count); extern void map_banks_z3(addrbank *bank, int first, int count); extern bool validate_banks_z2(addrbank *bank, int start, int size); extern bool validate_banks_z3(addrbank *bank, int start, int size); -extern void map_banks_quick(addrbank *bank, int first, int count, int realsize); -extern void map_banks_nojitdirect(addrbank *bank, int first, int count, int realsize); -extern void map_banks_cond(addrbank *bank, int first, int count, int realsize); -extern void map_overlay(int chip); -extern void memory_hardreset(int); -extern void memory_clear(void); -extern void free_fastmemory(int); -extern void set_roms_modified(void); -extern void reload_roms(void); +extern void map_banks_quick (addrbank *bank, int first, int count, int realsize); +extern void map_banks_cond (addrbank *bank, int first, int count, int realsize); +extern void map_overlay (int chip); +extern void memory_hardreset (int); +extern void memory_clear (void); +extern void free_fastmemory (int); extern bool read_kickstart_version(struct uae_prefs *p); #define longget(addr) (call_mem_get_func(get_mem_bank(addr).lget, addr)) #define wordget(addr) (call_mem_get_func(get_mem_bank(addr).wget, addr)) #define byteget(addr) (call_mem_get_func(get_mem_bank(addr).bget, addr)) -#define longgeti(addr) (call_mem_get_func(get_mem_bank(addr).lgeti, addr)) #define wordgeti(addr) (call_mem_get_func(get_mem_bank(addr).wgeti, addr)) #define longput(addr,l) (call_mem_put_func(get_mem_bank(addr).lput, addr, l)) #define wordput(addr,w) (call_mem_put_func(get_mem_bank(addr).wput, addr, w)) @@ -495,23 +407,19 @@ extern bool read_kickstart_version(struct uae_prefs *p); STATIC_INLINE uae_u32 get_long(uaecptr addr) { - return longget(addr); + return longget(addr); } STATIC_INLINE uae_u32 get_word(uaecptr addr) { - return wordget(addr); + return wordget(addr); } STATIC_INLINE uae_u32 get_byte(uaecptr addr) { - return byteget(addr); -} -STATIC_INLINE uae_u32 get_longi(uaecptr addr) -{ - return longgeti(addr); + return byteget(addr); } STATIC_INLINE uae_u32 get_wordi(uaecptr addr) { - return wordgeti(addr); + return wordgeti(addr); } STATIC_INLINE uae_u32 get_long_jit(uaecptr addr) @@ -538,47 +446,31 @@ STATIC_INLINE uae_u32 get_byte_jit(uaecptr addr) #endif return bank->bget(addr); } -STATIC_INLINE uae_u32 get_longi_jit(uaecptr addr) -{ - addrbank *bank = &get_mem_bank(addr); -#ifdef JIT - special_mem |= bank->jit_read_flag; -#endif - return bank->lgeti(addr); -} -STATIC_INLINE uae_u32 get_wordi_jit(uaecptr addr) -{ - addrbank *bank = &get_mem_bank(addr); -#ifdef JIT - special_mem |= bank->jit_read_flag; -#endif - return bank->wgeti(addr); -} /* -* Read a host pointer from addr -*/ + * Read a host pointer from addr + */ #if SIZEOF_VOID_P == 4 -# define get_pointer(addr) ((void *)get_long (addr)) +# define get_pointer(addr) ((void *)get_long(addr)) #else # if SIZEOF_VOID_P == 8 -STATIC_INLINE void *get_pointer(uaecptr addr) +STATIC_INLINE void *get_pointer (uaecptr addr) { - const unsigned int n = SIZEOF_VOID_P / 4; - union { - void *ptr; - uae_u32 longs[SIZEOF_VOID_P / 4]; - } p; - unsigned int i; + const unsigned int n = SIZEOF_VOID_P / 4; + union { + void *ptr; + uae_u32 longs[SIZEOF_VOID_P / 4]; + } p; + unsigned int i; - for (i = 0; i < n; i++) { + for (i = 0; i < n; i++) { #ifdef WORDS_BIGENDIAN - p.longs[i] = get_long(addr + i * 4); + p.longs[i] = get_long (addr + i * 4); #else - p.longs[n - 1 - i] = get_long(addr + i * 4); + p.longs[n - 1 - i] = get_long (addr + i * 4); #endif - } - return p.ptr; + } + return p.ptr; } # else # error "Unknown or unsupported pointer size." @@ -587,15 +479,15 @@ STATIC_INLINE void *get_pointer(uaecptr addr) STATIC_INLINE void put_long(uaecptr addr, uae_u32 l) { - longput(addr, l); + longput(addr, l); } STATIC_INLINE void put_word(uaecptr addr, uae_u32 w) { - wordput(addr, w); + wordput(addr, w); } STATIC_INLINE void put_byte(uaecptr addr, uae_u32 b) { - byteput(addr, b); + byteput(addr, b); } STATIC_INLINE void put_long_jit(uaecptr addr, uae_u32 l) @@ -624,42 +516,42 @@ STATIC_INLINE void put_byte_jit(uaecptr addr, uae_u32 l) } /* -* Store host pointer v at addr -*/ + * Store host pointer v at addr + */ #if SIZEOF_VOID_P == 4 -# define put_pointer(addr, p) (put_long ((addr), (uae_u32)(p))) +# define put_pointer(addr, p) (put_long((addr), (uae_u32)(p))) #else # if SIZEOF_VOID_P == 8 -STATIC_INLINE void put_pointer(uaecptr addr, void *v) +STATIC_INLINE void put_pointer (uaecptr addr, void *v) { - const unsigned int n = SIZEOF_VOID_P / 4; - union { - void *ptr; - uae_u32 longs[SIZEOF_VOID_P / 4]; - } p; - unsigned int i; + const unsigned int n = SIZEOF_VOID_P / 4; + union { + void *ptr; + uae_u32 longs[SIZEOF_VOID_P / 4]; + } p; + unsigned int i; - p.ptr = v; + p.ptr = v; - for (i = 0; i < n; i++) { + for (i = 0; i < n; i++) { #ifdef WORDS_BIGENDIAN - put_long(addr + i * 4, p.longs[i]); + put_long (addr + i * 4, p.longs[i]); #else - put_long(addr + i * 4, p.longs[n - 1 - i]); + put_long (addr + i * 4, p.longs[n - 1 - i]); #endif - } + } } # endif #endif STATIC_INLINE uae_u8 *get_real_address(uaecptr addr) { - return get_mem_bank(addr).xlateaddr(addr); + return get_mem_bank(addr).xlateaddr(addr); } STATIC_INLINE int valid_address(uaecptr addr, uae_u32 size) { - return get_mem_bank(addr).check(addr, size); + return get_mem_bank(addr).check(addr, size); } STATIC_INLINE void put_quad_host(void *addr, uae_u64 v) @@ -698,84 +590,35 @@ STATIC_INLINE uae_u32 get_byte_host(void *addr) return *((uae_u8*)addr); } -extern int addr_valid(const TCHAR*, uaecptr, uae_u32); +extern int addr_valid (const TCHAR*,uaecptr,uae_u32); /* For faster access in custom chip emulation. */ -extern void REGPARAM3 chipmem_lput(uaecptr, uae_u32) REGPARAM; -extern void REGPARAM3 chipmem_wput(uaecptr, uae_u32) REGPARAM; -extern void REGPARAM3 chipmem_bput(uaecptr, uae_u32) REGPARAM; +extern void REGPARAM3 chipmem_lput (uaecptr, uae_u32) REGPARAM; +extern void REGPARAM3 chipmem_wput (uaecptr, uae_u32) REGPARAM; +extern void REGPARAM3 chipmem_bput (uaecptr, uae_u32) REGPARAM; -extern uae_u32 REGPARAM3 chipmem_agnus_wget(uaecptr) REGPARAM; -extern void REGPARAM3 chipmem_agnus_wput(uaecptr, uae_u32) REGPARAM; +extern void REGPARAM3 chipmem_agnus_wput (uaecptr, uae_u32) REGPARAM; +extern uae_u32 chipmem_full_mask; extern addrbank dummy_bank; -/* 68020+ Chip RAM DMA contention emulation */ -extern void REGPARAM3 chipmem_bput_c2(uaecptr, uae_u32) REGPARAM; +STATIC_INLINE uae_u32 chipmem_lget_indirect(uae_u32 PT) { + return do_get_mem_long((uae_u32 *)&chipmem_bank.baseaddr[PT & chipmem_full_mask]); +} +STATIC_INLINE uae_u32 chipmem_wget_indirect (uae_u32 PT) { + return do_get_mem_word((uae_u16 *)&chipmem_bank.baseaddr[PT & chipmem_full_mask]); +} -extern uae_u32(REGPARAM3 *chipmem_lget_indirect)(uaecptr) REGPARAM; -extern uae_u32(REGPARAM3 *chipmem_wget_indirect)(uaecptr) REGPARAM; -extern uae_u32(REGPARAM3 *chipmem_bget_indirect)(uaecptr) REGPARAM; -extern void (REGPARAM3 *chipmem_lput_indirect)(uaecptr, uae_u32) REGPARAM; -extern void (REGPARAM3 *chipmem_wput_indirect)(uaecptr, uae_u32) REGPARAM; -extern void (REGPARAM3 *chipmem_bput_indirect)(uaecptr, uae_u32) REGPARAM; -extern int (REGPARAM3 *chipmem_check_indirect)(uaecptr, uae_u32) REGPARAM; -extern uae_u8 *(REGPARAM3 *chipmem_xlate_indirect)(uaecptr) REGPARAM; +#define chipmem_wput_indirect chipmem_agnus_wput -#ifdef NATMEM_OFFSET +extern bool mapped_malloc (addrbank*); +extern void mapped_free (addrbank*); -typedef struct shmpiece_reg { - uae_u8 *native_address; - int id; - uae_u32 size; - const TCHAR *name; - struct shmpiece_reg *next; - struct shmpiece_reg *prev; -} shmpiece; +extern uaecptr strcpyha_safe (uaecptr dst, const uae_char *src); +extern uae_char *strcpyah_safe (uae_char *dst, uaecptr src, int maxsize); +extern void memcpyha_safe (uaecptr dst, const uae_u8 *src, int size); +extern void memcpyha (uaecptr dst, const uae_u8 *src, int size); +extern void memcpyah_safe (uae_u8 *dst, uaecptr src, int size); +extern void memcpyah (uae_u8 *dst, uaecptr src, int size); -extern shmpiece *shm_start; - -extern uae_u8* natmem_offset; -extern uae_u8 *natmem_reserved; -extern uae_u32 natmem_reserved_size; - -#endif - -extern bool mapped_malloc(addrbank*); -extern void mapped_free(addrbank*); -extern void a3000_fakekick(int); - -extern uaecptr strcpyha_safe(uaecptr dst, const uae_char *src); -extern uae_char *strcpyah_safe(uae_char *dst, uaecptr src, int maxsize); -extern void memcpyha_safe(uaecptr dst, const uae_u8 *src, int size); -extern void memcpyha(uaecptr dst, const uae_u8 *src, int size); -extern void memcpyah_safe(uae_u8 *dst, uaecptr src, int size); -extern void memcpyah(uae_u8 *dst, uaecptr src, int size); - -#define UAE_MEMORY_REGIONS_MAX 64 -#define UAE_MEMORY_REGION_NAME_LENGTH 64 - -#define UAE_MEMORY_REGION_RAM (1 << 0) -#define UAE_MEMORY_REGION_ALIAS (1 << 1) -#define UAE_MEMORY_REGION_MIRROR (1 << 2) - -/* Get a list of memory regions in the Amiga address space */ - -typedef struct UaeMemoryRegion { - uaecptr start; - uae_u32 size; - TCHAR name[UAE_MEMORY_REGION_NAME_LENGTH]; - TCHAR rom_name[UAE_MEMORY_REGION_NAME_LENGTH]; - uaecptr alias; - int flags; - uae_u8 *memory; -} UaeMemoryRegion; - -typedef struct UaeMemoryMap { - UaeMemoryRegion regions[UAE_MEMORY_REGIONS_MAX]; - int num_regions; -} UaeMemoryMap; - -void uae_memory_map(UaeMemoryMap *map); - -#endif /* MEMORY_H */ +#endif /* UAE_MEMORY_H */ diff --git a/src/include/native2amiga.h b/src/include/native2amiga.h index 7a2493d4..a29f3f42 100644 --- a/src/include/native2amiga.h +++ b/src/include/native2amiga.h @@ -1,17 +1,19 @@ -/* - * UAE - The Un*x Amiga Emulator - * - * Call (some) Amiga Exec functions outside the main UAE thread - * and without stack magic. - * - * Copyright 1999 Patrick Ohly - * - * Uses the EXTER interrupt that is setup in filesys.c - * and some of it needs thread support. - */ + /* + * UAE - The Un*x Amiga Emulator + * + * Call (some) Amiga Exec functions outside the main UAE thread + * and without stack magic. + * + * Copyright 1999 Patrick Ohly + * + * Uses the EXTER interrupt that is setup in filesys.c + * and some of it needs thread support. + */ -#pragma once -#include "sysconfig.h" +#ifndef UAE_NATIVE2AMIGA_H +#define UAE_NATIVE2AMIGA_H + +#include "uae/types.h" #include "native2amiga_api.h" #include "traps.h" @@ -50,5 +52,7 @@ extern smp_comm_pipe native2amiga_pending; STATIC_INLINE void do_uae_int_requested (void) { - uae_int_requested |= 1; + atomic_or(&uae_int_requested, 1); } + +#endif /* UAE_NATIVE2AMIGA_H */ diff --git a/src/include/newcpu.h b/src/include/newcpu.h index fd933f84..fbc1f551 100644 --- a/src/include/newcpu.h +++ b/src/include/newcpu.h @@ -1,27 +1,3 @@ -/* - * newcpu.h - CPU emulation - * - * Copyright (c) 2009 ARAnyM dev team (see AUTHORS) - * - * Inspired by Christian Bauer's Basilisk II - * - * This file is part of the ARAnyM project which builds a new and powerful - * TOS/FreeMiNT compatible virtual machine running on almost any hardware. - * - * ARAnyM 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. - * - * ARAnyM 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 ARAnyM; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ /* * UAE - The Un*x Amiga Emulator * @@ -30,13 +6,13 @@ * Copyright 1995 Bernd Schmidt */ -#ifndef _NEWCPU_H -#define _NEWCPU_H +#ifndef UAE_NEWCPU_H +#define UAE_NEWCPU_H +#include "uae/types.h" #include "readcpu.h" #include "machdep/m68k.h" -#include "include/memory.h" -#include "events.h" +#include extern const int areg_byteinc[]; extern const int imm8_table[]; @@ -55,8 +31,11 @@ typedef uae_u32 REGPARAM3 cpuop_func (uae_u32) REGPARAM; typedef void REGPARAM3 cpuop_func_ce (uae_u32) REGPARAM; struct cputbl { - cpuop_func *handler; - uae_u16 opcode; + cpuop_func *handler; + uae_u16 opcode; + uae_s8 length; + uae_s8 disp020[2]; + uae_u8 branch; }; #ifdef JIT @@ -71,20 +50,19 @@ typedef uae_u32 REGPARAM3 compop_func (uae_u32) REGPARAM; #define COMP_OPCODE_USES_FPU 0x0020 struct comptbl { - compop_func *handler; + compop_func *handler; uae_u32 specific; - uae_u32 opcode; + uae_u32 opcode; }; #endif extern uae_u32 REGPARAM3 op_illg (uae_u32) REGPARAM; -extern void REGPARAM3 op_unimpl (uae_u16) REGPARAM; typedef uae_u8 flagtype; #ifdef FPUEMU -#if USE_LONG_DOUBLE +#ifdef USE_LONG_DOUBLE typedef long double fptype; #define LDPTR tbyte ptr #else @@ -95,12 +73,8 @@ typedef double fptype; typedef struct { + floatx80 fpx; fptype fp; -#ifdef USE_SOFT_LONG_DOUBLE - bool fpx; - uae_u32 fpm; - uae_u64 fpe; -#endif } fpdata; struct regstruct @@ -111,15 +85,12 @@ struct regstruct uae_u32 pc; uae_u8 *pc_p; uae_u8 *pc_oldp; + uae_u16 opcode; uae_u32 instruction_pc; - uae_u16 irc, ir, db; + uae_u16 irc, ir, db; volatile uae_atomic spcflags; - uae_u32 last_prefetch; - uae_u32 chipset_latch_rw; - uae_u32 chipset_latch_read; - uae_u32 chipset_latch_write; - + uaecptr usp, isp, msp; uae_u16 sr; flagtype t1; @@ -128,40 +99,38 @@ struct regstruct flagtype m; flagtype x; flagtype stopped; - int halted; - int exception; + int halted; int intmask; - int ipl, ipl_pin; uae_u32 vbr,sfc,dfc; #ifdef FPUEMU fpdata fp[8]; - fpdata fp_result; - uae_u32 fp_result_status; uae_u32 fpcr,fpsr, fpiar; uae_u32 fpu_state; uae_u32 fpu_exp_state; - fpdata exp_src1, exp_src2; - uae_u32 exp_pack[3]; - uae_u16 exp_opcode, exp_extra, exp_type; + uae_u16 fp_opword; + uaecptr fp_ea; + uae_u32 fp_exp_pend, fp_unimp_pend; + bool fpu_exp_pre; + bool fp_unimp_ins; bool fp_exception; + bool fp_branch; #endif -#ifndef CPUEMU_68000_ONLY uae_u32 cacr, caar; uae_u32 itt0, itt1, dtt0, dtt1; uae_u32 tcr, mmusr, urp, srp, buscr; -#endif uae_u32 pcr; uae_u32 address_space_mask; - uae_u8 panic; - uae_u32 panic_pc, panic_addr; + uae_s32 pissoff; }; extern struct regstruct regs; +#define REGS_DEFINED +#include "machdep/m68k.h" #include "events.h" STATIC_INLINE uae_u32 munge24(uae_u32 x) @@ -170,26 +139,40 @@ STATIC_INLINE uae_u32 munge24(uae_u32 x) } extern int cpu_cycles; -extern bool m68k_pc_indirect; +extern int m68k_pc_indirect; -STATIC_INLINE void set_special_exter(uae_u32 x) +STATIC_INLINE void set_special (uae_u32 x) { - regs.spcflags |= x; -} -STATIC_INLINE void set_special(uae_u32 x) -{ - regs.spcflags |= x; - cycles_do_special(); + atomic_or(®s.spcflags, x); + cycles_do_special(); } STATIC_INLINE void unset_special (uae_u32 x) { - regs.spcflags &= ~x; + atomic_and(®s.spcflags, ~x); } #define m68k_dreg(r,num) ((r).regs[(num)]) #define m68k_areg(r,num) (((r).regs + 8)[(num)]) +extern uae_u32(*x_get_byte)(uaecptr addr); +extern uae_u32(*x_get_word)(uaecptr addr); +extern uae_u32(*x_get_long)(uaecptr addr); +extern void(*x_put_byte)(uaecptr addr, uae_u32 v); +extern void(*x_put_word)(uaecptr addr, uae_u32 v); +extern void(*x_put_long)(uaecptr addr, uae_u32 v); +extern uae_u32(*x_get_iword)(int); + +#define x_cp_get_byte x_get_byte +#define x_cp_get_word x_get_word +#define x_cp_get_long x_get_long +#define x_cp_put_byte x_put_byte +#define x_cp_put_word x_put_word +#define x_cp_put_long x_put_long +#define x_cp_next_iword() next_diword() +#define x_cp_next_ilong() next_dilong() + +#define x_cp_get_disp_ea_020(base,idx) _get_disp_ea_020(base) /* direct (regs.pc_p) access */ @@ -198,7 +181,6 @@ STATIC_INLINE void m68k_setpc (uaecptr newpc) regs.pc_p = regs.pc_oldp = get_real_address (newpc); regs.instruction_pc = regs.pc = newpc; } - STATIC_INLINE uaecptr m68k_getpc (void) { return (uaecptr)(regs.pc + ((uae_u8*)regs.pc_p - (uae_u8*)regs.pc_oldp)); @@ -208,7 +190,10 @@ STATIC_INLINE uaecptr m68k_getpc (void) #define m68k_incpc(o) ((regs).pc_p += (o)) #define get_dibyte(o) do_get_mem_byte((uae_u8 *)((regs).pc_p + (o) + 1)) -#define get_diword(o) do_get_mem_word((uae_u16 *)((regs).pc_p + (o))) +STATIC_INLINE uae_u32 get_diword(int o) +{ + return do_get_mem_word((uae_u16 *)((regs).pc_p + (o))); +} #define get_dilong(o) do_get_mem_long((uae_u32 *)((regs).pc_p + (o))) STATIC_INLINE uae_u32 next_diword (void) @@ -230,8 +215,6 @@ STATIC_INLINE void m68k_do_bsr (uaecptr oldpc, uae_s32 offset) put_long(m68k_areg(regs, 7), oldpc); m68k_incpc (offset); } - - STATIC_INLINE void m68k_do_rts (void) { uae_u32 newpc = get_long (m68k_areg (regs, 7)); @@ -248,6 +231,11 @@ STATIC_INLINE uaecptr m68k_getpci(void) } #define m68k_incpci(o) (regs.pc += (o)) +STATIC_INLINE uae_u32 get_iiword(int o) +{ + return get_wordi(m68k_getpci() + (o)); +} + STATIC_INLINE void m68k_do_bsri(uaecptr oldpc, uae_s32 offset) { m68k_areg(regs, 7) -= 4; @@ -265,7 +253,7 @@ STATIC_INLINE void m68k_do_rtsi(void) STATIC_INLINE void m68k_incpc_normal(int o) { - if (m68k_pc_indirect) + if (m68k_pc_indirect > 0) m68k_incpci(o); else m68k_incpc(o); @@ -273,29 +261,15 @@ STATIC_INLINE void m68k_incpc_normal(int o) STATIC_INLINE void m68k_setpc_normal(uaecptr pc) { - if (m68k_pc_indirect) { + if (m68k_pc_indirect > 0) { regs.pc_p = regs.pc_oldp = 0; m68k_setpci(pc); - } - else { + } else { m68k_setpc(pc); } } -#define x_get_word get_word -#define x_get_long get_long -#define x_put_word put_word -#define x_put_long put_long - -#define x_cp_put_long put_long -#define x_cp_put_word put_word -#define x_cp_put_byte put_byte -#define x_cp_get_long get_long -#define x_cp_get_word get_word -#define x_cp_get_byte get_byte -#define x_cp_next_iword() next_diword() -#define x_cp_next_ilong() next_dilong() -#define x_cp_get_disp_ea_020(base,idx) _get_disp_ea_020(base) +extern void check_t0_trace(void); #define x_do_cycles(c) do_cycles(c) @@ -313,7 +287,10 @@ extern int get_cpu_model(void); extern void set_cpu_caches (bool flush); extern void REGPARAM3 MakeSR (void) REGPARAM; extern void REGPARAM3 MakeFromSR (void) REGPARAM; +extern void REGPARAM3 MakeFromSR_T0(void) REGPARAM; extern void REGPARAM3 Exception (int) REGPARAM; +extern void REGPARAM3 Exception_cpu(int) REGPARAM; +extern void NMI (void); extern void doint (void); extern void dump_counts (void); extern int m68k_move2c (int, uae_u32 *); @@ -324,7 +301,9 @@ extern void init_m68k (void); extern void m68k_go (int); extern int getDivu68kCycles(uae_u32 dividend, uae_u16 divisor); extern int getDivs68kCycles(uae_s32 dividend, uae_s16 divisor); +extern void divbyzero_special (bool issigned, uae_s32 dst); extern void protect_roms (bool); +extern bool is_hardreset(void); STATIC_INLINE int bitset_count16(uae_u16 data) { @@ -342,7 +321,7 @@ STATIC_INLINE int bitset_count16(uae_u16 data) } extern void mmu_op (uae_u32, uae_u32); -extern void mmu_op30 (uaecptr, uae_u32, uae_u16, uaecptr); +extern bool mmu_op30 (uaecptr, uae_u32, uae_u16, uaecptr); extern void fpuop_arithmetic(uae_u32, uae_u16); extern void fpuop_dbcc(uae_u32, uae_u16); @@ -351,15 +330,17 @@ extern void fpuop_trapcc(uae_u32, uaecptr, uae_u16); extern void fpuop_bcc(uae_u32, uaecptr, uae_u32); extern void fpuop_save(uae_u32); extern void fpuop_restore(uae_u32); +extern uae_u32 fpp_get_fpsr (void); extern void fpu_reset (void); extern bool fpu_get_constant(fpdata *fp, int cr); extern int fpp_cond(int condition); -extern void exception3 (uae_u32 opcode, uaecptr addr); +extern void exception3_read(uae_u32 opcode, uaecptr addr); +extern void exception3_write(uae_u32 opcode, uaecptr addr); +extern void exception3_notinstruction(uae_u32 opcode, uaecptr addr); extern void exception3i (uae_u32 opcode, uaecptr addr); extern void exception3b (uae_u32 opcode, uaecptr addr, bool w, bool i, uaecptr pc); -extern void exception2 (uaecptr addr); -extern void exception2_fake (uaecptr addr); +extern void exception2 (uaecptr addr, bool read, int size, uae_u32 fc); extern void cpureset (void); extern void cpu_halt (int id); @@ -369,27 +350,45 @@ extern void fill_prefetch (void); /* 68040 */ extern const struct cputbl op_smalltbl_1_ff[]; +extern const struct cputbl op_smalltbl_41_ff[]; /* 68030 */ extern const struct cputbl op_smalltbl_2_ff[]; +extern const struct cputbl op_smalltbl_42_ff[]; /* 68020 */ extern const struct cputbl op_smalltbl_3_ff[]; +extern const struct cputbl op_smalltbl_43_ff[]; /* 68010 */ extern const struct cputbl op_smalltbl_4_ff[]; +extern const struct cputbl op_smalltbl_44_ff[]; extern const struct cputbl op_smalltbl_11_ff[]; // prefetch /* 68000 */ extern const struct cputbl op_smalltbl_5_ff[]; +extern const struct cputbl op_smalltbl_45_ff[]; extern const struct cputbl op_smalltbl_12_ff[]; // prefetch extern cpuop_func *cpufunctbl[65536] ASM_SYM_FOR_FUNC ("cpufunctbl"); #ifdef JIT -extern void (*flush_icache)(uaecptr, int); +extern void flush_icache(int); +extern void flush_icache_hard(int); extern void compemu_reset(void); -extern bool check_prefs_changed_comp (void); #else -#define flush_icache(uaecptr, int) do {} while (0) +#define flush_icache(int) do {} while (0) +#define flush_icache_hard(int) do {} while (0) #endif +bool check_prefs_changed_comp (bool); extern int movec_illg (int regno); -#endif /* _NEWCPU_H */ +#define CPU_HALT_BUS_ERROR_DOUBLE_FAULT 1 +#define CPU_HALT_DOUBLE_FAULT 2 +#define CPU_HALT_OPCODE_FETCH_FROM_NON_EXISTING_ADDRESS 3 +#define CPU_HALT_ALL_CPUS_STOPPED 5 +#define CPU_HALT_FAKE_DMA 6 +#define CPU_HALT_AUTOCONFIG_CONFLICT 7 +#define CPU_HALT_PCI_CONFLICT 8 +#define CPU_HALT_CPU_STUCK 9 +#define CPU_HALT_SSP_IN_NON_EXISTING_ADDRESS 10 +#define CPU_HALT_INVALID_START_ADDRESS 11 + +#endif /* UAE_NEWCPU_H */ diff --git a/src/include/options.h b/src/include/options.h index 1af20c1d..7e9e1474 100644 --- a/src/include/options.h +++ b/src/include/options.h @@ -1,4 +1,4 @@ -/* + /* * UAE - The Un*x Amiga Emulator * * Stuff @@ -7,32 +7,28 @@ * Copyright 1995-2001 Bernd Schmidt */ -#ifndef OPTIONS_H -#define OPTIONS_H +#ifndef UAE_OPTIONS_H +#define UAE_OPTIONS_H + +#include "uae/types.h" + +#include "traps.h" #define UAEMAJOR 3 -#define UAEMINOR 4 -#define UAESUBREV 1 -#include "traps.h" +#define UAEMINOR 5 +#define UAESUBREV 0 + +typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES } KbdLang; extern long int version; -#define MAX_PATHS 8 - -struct multipath { - TCHAR path[MAX_PATHS][PATH_MAX]; +struct strlist { + struct strlist *next; + TCHAR *option, *value; + int unknown; }; -struct strlist -{ - struct strlist* next; - TCHAR *option, *value; - int unknown; -}; - -#define DEFAULT_JIT_CACHE_SIZE 8192 - -#define MAX_TOTAL_SCSI_DEVICES 8 +#define MAX_TOTAL_SCSI_DEVICES 1 /* maximum number native input devices supported (single type) */ #define MAX_INPUT_DEVICES 8 @@ -46,27 +42,37 @@ struct strlist #define MAX_INPUT_SUB_EVENT_ALL 9 #define SPARE_SUB_EVENT 8 -#define INTERNALEVENT_COUNT 1 - -struct uae_input_device -{ - TCHAR* name; - TCHAR* configname; +struct uae_input_device { + TCHAR *name; + TCHAR *configname; uae_s16 eventid[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT_ALL]; - TCHAR* custom[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT_ALL]; + TCHAR *custom[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT_ALL]; uae_u64 flags[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT_ALL]; uae_s8 port[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT_ALL]; uae_s16 extra[MAX_INPUT_DEVICE_EVENTS]; uae_s8 enabled; }; -#define MAX_JPORTS_CUSTOM 6 +struct joypad_map_layout { + int south_action = 0; + int east_action = 0; + int west_action = 0; + int north_action = 0; + int left_shoulder_action = 0; + int right_shoulder_action = 0; + int start_action = 0; + int select_action = 0; + int dpad_left_action = 0; + int dpad_right_action = 0; + int dpad_up_action = 0; + int dpad_down_action = 0; + int lstick_select_action = 0; + int rstick_select_action = 0; +}; + #define MAX_JPORTS 4 #define NORMAL_JPORTS 2 #define MAX_JPORTNAME 128 -struct jport_custom { - TCHAR custom[MAX_DPATH]; -}; struct inputdevconfig { TCHAR name[MAX_JPORTNAME]; TCHAR configname[MAX_JPORTNAME]; @@ -76,8 +82,13 @@ struct jport { int id; int mode; // 0=def,1=mouse,2=joy,3=anajoy,4=lightpen int autofire; + int mousemap; struct inputdevconfig idc; bool nokeyboardoverride; + struct joypad_map_layout amiberry_custom_none; + struct joypad_map_layout amiberry_custom_hotkey; + struct joypad_map_layout amiberry_custom_left_trigger; + struct joypad_map_layout amiberry_custom_right_trigger; }; #define JPORT_UNPLUGGED -2 @@ -87,11 +98,6 @@ struct jport { #define JPORT_AF_TOGGLE 2 #define JPORT_AF_ALWAYS 3 -#define KBTYPE_AMIGA 0 -#define KBTYPE_PC1 1 -#define KBTYPE_PC2 2 - -#define MAX_SPARE_DRIVES 20 #define MAX_CUSTOM_MEMORY_ADDRS 2 #define CONFIG_TYPE_ALL -1 @@ -101,26 +107,10 @@ struct jport { #define CONFIG_TYPE_NORESET 4 #define CONFIG_BLEN 2560 -#define MOUSEUNTRAP_NONE 0 -#define MOUSEUNTRAP_MIDDLEBUTTON 1 -#define MOUSEUNTRAP_MAGIC 2 -#define MOUSEUNTRAP_BOTH 3 - #define TABLET_OFF 0 #define TABLET_MOUSEHACK 1 #define TABLET_REAL 2 -#ifdef WITH_SLIRP -#define MAX_SLIRP_REDIRS 32 -struct slirp_redir -{ - int proto; - int srcport; - int dstport; - unsigned long addr; -}; -#endif - struct cdslot { TCHAR name[MAX_DPATH]; @@ -133,24 +123,17 @@ struct floppyslot { TCHAR df[MAX_DPATH]; int dfxtype; - int dfxclick; - TCHAR dfxclickexternal[256]; bool forcedwriteprotect; }; -#define ASPECTMULT 1024 -#define WH_NATIVE 1 struct wh { - int x, y; - int width, height; - int special; + int width, height; }; #define MOUNT_CONFIG_SIZE 30 #define UAEDEV_DIR 0 #define UAEDEV_HDF 1 #define UAEDEV_CD 2 -#define UAEDEV_TAPE 3 #define HD_LEVEL_SCSI_1 0 #define HD_LEVEL_SCSI_2 1 @@ -166,12 +149,6 @@ struct wh { #define BOOTPRI_NOAUTOMOUNT -129 #define ISAUTOBOOT(ci) ((ci)->bootpri > BOOTPRI_NOAUTOBOOT) #define ISAUTOMOUNT(ci) ((ci)->bootpri > BOOTPRI_NOAUTOMOUNT) -#define MAX_UAEDEV_BADBLOCKS 8 -struct uaedev_badblock -{ - uae_u32 first; - uae_u32 last; -}; struct uaedev_config_info { int type; TCHAR devname[MAX_DPATH]; @@ -210,8 +187,6 @@ struct uaedev_config_info { int forceload; int device_emu_unit; bool inject_icons; - int badblock_num; - struct uaedev_badblock badblocks[MAX_UAEDEV_BADBLOCKS]; }; struct uaedev_config_data @@ -221,72 +196,31 @@ struct uaedev_config_data int unitnum; // scsi unit number (if tape currently) }; -enum { - CP_GENERIC = 1, CP_CDTV, CP_CDTVCR, CP_CD32, CP_A500, CP_A500P, CP_A600, CP_A1000, - CP_A1200, CP_A2000, CP_A3000, CP_A3000T, CP_A4000, CP_A4000T, CP_VELVET -}; +enum { CP_GENERIC = 1, CP_CD32, CP_A500, CP_A500P, CP_A600, + CP_A1200, CP_A2000, CP_A4000 }; #define IDE_A600A1200 1 #define IDE_A4000 2 -#define GFX_WINDOW 0 -#define GFX_FULLSCREEN 1 -#define GFX_FULLWINDOW 2 - -#define AUTOSCALE_NONE 0 -#define AUTOSCALE_STATIC_AUTO 1 -#define AUTOSCALE_STATIC_NOMINAL 2 -#define AUTOSCALE_STATIC_MAX 3 -#define AUTOSCALE_NORMAL 4 -#define AUTOSCALE_RESIZE 5 -#define AUTOSCALE_CENTER 6 -#define AUTOSCALE_MANUAL 7 // use gfx_xcenter_pos and gfx_ycenter_pos -#define AUTOSCALE_INTEGER 8 -#define AUTOSCALE_INTEGER_AUTOSCALE 9 -#define AUTOSCALE_SEPARATOR 10 -#define AUTOSCALE_OVERSCAN_BLANK 11 - -#define MONITOREMU_NONE 0 -#define MONITOREMU_AUTO 1 -#define MONITOREMU_A2024 2 -#define MONITOREMU_GRAFFITI 3 -#define MONITOREMU_HAM_E 4 -#define MONITOREMU_HAM_E_PLUS 5 -#define MONITOREMU_VIDEODAC18 6 -#define MONITOREMU_AVIDEO12 7 -#define MONITOREMU_AVIDEO24 8 -#define MONITOREMU_FIRECRACKER24 9 -#define MONITOREMU_DCTV 10 -#define MONITOREMU_OPALVISION 11 -#define MONITOREMU_COLORBURST 12 - -#define MAX_FILTERSHADERS 4 - -#define MAX_CHIPSET_REFRESH 10 +#define MAX_CHIPSET_REFRESH 1 #define MAX_CHIPSET_REFRESH_TOTAL (MAX_CHIPSET_REFRESH + 2) #define CHIPSET_REFRESH_PAL (MAX_CHIPSET_REFRESH + 0) #define CHIPSET_REFRESH_NTSC (MAX_CHIPSET_REFRESH + 1) - struct chipset_refresh { bool inuse; int index; bool locked; bool rtg; - bool exit; bool defaultdata; int horiz; int vert; int lace; int resolution; - int resolution_pct; int ntsc; int vsync; - int framelength; - double rate; + float rate; TCHAR label[16]; - TCHAR commands[256]; - TCHAR filterprofile[64]; }; #define APMODE_NATIVE 0 @@ -294,48 +228,15 @@ struct chipset_refresh struct apmode { - int gfx_fullscreen; - int gfx_display; int gfx_vsync; // 0 = immediate flip // -1 = wait for flip, before frame ends // 1 = wait for flip, after new frame has started int gfx_vflip; - // doubleframemode strobo - bool gfx_strobo; - int gfx_vsyncmode; - int gfx_backbuffers; - bool gfx_interlaced; int gfx_refreshrate; }; -#define MAX_LUA_STATES 16 - - -struct gfx_filterdata -{ - int gfx_filter; - TCHAR gfx_filtershader[2 * MAX_FILTERSHADERS + 1][MAX_DPATH]; - TCHAR gfx_filtermask[2 * MAX_FILTERSHADERS + 1][MAX_DPATH]; - TCHAR gfx_filteroverlay[MAX_DPATH]; - struct wh gfx_filteroverlay_pos; - int gfx_filteroverlay_overscan; - int gfx_filter_scanlines; - int gfx_filter_scanlineratio; - int gfx_filter_scanlinelevel; - float gfx_filter_horiz_zoom, gfx_filter_vert_zoom; - float gfx_filter_horiz_zoom_mult, gfx_filter_vert_zoom_mult; - float gfx_filter_horiz_offset, gfx_filter_vert_offset; - int gfx_filter_filtermode; - int gfx_filter_bilinear; - int gfx_filter_noise, gfx_filter_blur; - int gfx_filter_saturation, gfx_filter_luminance, gfx_filter_contrast, gfx_filter_gamma; - int gfx_filter_keep_aspect, gfx_filter_aspect; - int gfx_filter_autoscale; - int gfx_filter_keep_autoscale_aspect; -}; - -#define MAX_DUPLICATE_EXPANSION_BOARDS 4 +#define MAX_DUPLICATE_EXPANSION_BOARDS 1 #define MAX_EXPANSION_BOARDS 20 struct boardromconfig; struct romconfig @@ -359,28 +260,21 @@ struct boardromconfig int device_order; struct romconfig roms[MAX_BOARD_ROMS]; }; -#define MAX_RTG_BOARDS 4 +#define MAX_RTG_BOARDS 1 struct rtgboardconfig { - int rtg_index; int rtgmem_type; uae_u32 rtgmem_size; int device_order; }; -#define MAX_RAM_BOARDS 4 +#define MAX_RAM_BOARDS 1 struct ramboard { uae_u32 size; uae_u16 manufacturer; uae_u8 product; uae_u8 autoconfig[16]; - bool autoconfig_inuse; - bool manual_config; - bool no_reset_unmap; int device_order; - uae_u32 start_address; - uae_u32 end_address; - uae_u32 write_address; }; struct expansion_params { @@ -391,171 +285,62 @@ struct expansion_params #define Z3MAPPING_UAE 1 #define Z3MAPPING_REAL 2 -struct uae_prefs -{ - struct strlist* all_lines; +struct uae_prefs { + struct strlist *all_lines; TCHAR description[256]; TCHAR info[256]; int config_version; - TCHAR config_hardware_path[MAX_DPATH]; - TCHAR config_host_path[MAX_DPATH]; - TCHAR config_all_path[MAX_DPATH]; - TCHAR config_window_title[256]; - - bool illegal_mem; - bool use_serial; - bool serial_demand; - bool serial_hwctsrts; - bool serial_direct; - int serial_stopbits; - int serial_crlf; - bool parallel_demand; - int parallel_matrix_emulation; - bool parallel_postscript_emulation; - bool parallel_postscript_detection; - int parallel_autoflush_time; - TCHAR ghostscript_parameters[256]; - bool use_gfxlib; bool socket_emu; - - bool start_debugger; bool start_gui; + KbdLang keyboard_lang; + int produce_sound; int sound_stereo; int sound_stereo_separation; int sound_mixed_stereo_delay; int sound_freq; - int sound_maxbsiz; int sound_interpol; int sound_filter; int sound_filter_type; - int sound_volume_master; - int sound_volume_paula; int sound_volume_cd; - int sound_volume_board; - int sound_volume_midi; - int sound_volume_genlock; - bool sound_stereo_swap_paula; - bool sound_stereo_swap_ahi; - bool sound_auto; - bool sound_cdaudio; - int sampler_freq; - int sampler_buffer; - bool sampler_stereo; - - int comptrustbyte; - int comptrustword; - int comptrustlong; - int comptrustnaddr; - bool compnf; - bool compfpu; - bool comp_hardflush; - bool comp_constjump; int cachesize; bool fpu_strict; - bool fpu_softfloat; - int gfx_framerate, gfx_autoframerate; - struct wh gfx_size_win; - struct wh gfx_size_fs; + int gfx_framerate; struct wh gfx_size; - struct wh gfx_size_win_xtra[6]; - struct wh gfx_size_fs_xtra[6]; - bool gfx_autoresolution_vga; - int gfx_autoresolution; - int gfx_autoresolution_delay; - int gfx_autoresolution_minv, gfx_autoresolution_minh; - bool gfx_scandoubler; struct apmode gfx_apmode[2]; int gfx_resolution; int gfx_vresolution; - int gfx_lores_mode; - int gfx_pscanlines, gfx_iscanlines; - int gfx_xcenter, gfx_ycenter; - int gfx_xcenter_pos, gfx_ycenter_pos; - int gfx_xcenter_size, gfx_ycenter_size; - int gfx_max_horizontal, gfx_max_vertical; - int gfx_saturation, gfx_luminance, gfx_contrast, gfx_gamma, gfx_gamma_ch[3]; - bool gfx_blackerthanblack; - int gfx_threebitcolors; - int gfx_api; - int color_mode; - int gfx_extrawidth; - bool lightboost_strobo; - int lightboost_strobo_ratio; - bool gfx_grayscale; - - struct gfx_filterdata gf[2]; - - float rtg_horiz_zoom_mult; - float rtg_vert_zoom_mult; bool immediate_blits; int waiting_blits; unsigned int chipset_mask; - bool keyboard_connected; bool ntscmode; - bool genlock; - int genlock_image; - int genlock_mix; - int genlock_scale; - int genlock_aspect; - bool genlock_alpha; - TCHAR genlock_image_file[MAX_DPATH]; - TCHAR genlock_video_file[MAX_DPATH]; - int monitoremu; - double chipset_refreshrate; + float chipset_refreshrate; struct chipset_refresh cr[MAX_CHIPSET_REFRESH + 2]; int cr_selected; int collision_level; int leds_on_screen; - int leds_on_screen_mask[2]; - struct wh osd_pos; - int keyboard_leds[3]; - bool keyboard_leds_in_use; - int scsi; - bool sana2; - bool uaeserial; - int catweasel; - int cpu_idle; - int ppc_cpu_idle; - bool cpu_cycle_exact; - int cpu_clock_multiplier; - int cpu_frequency; - bool blitter_cycle_exact; - bool cpu_memory_cycle_exact; + int fast_copper; int floppy_speed; int floppy_write_length; - int floppy_random_bits_min; - int floppy_random_bits_max; int floppy_auto_ext2; int cd_speed; - bool tod_hack; - uae_u32 maprom; int boot_rom; - bool rom_readwrite; - int turbo_emulation; - int turbo_emulation_limit; - bool headless; int filesys_limit; int filesys_max_name; - int filesys_max_file_size; bool filesys_inject_icons; TCHAR filesys_inject_icons_tool[MAX_DPATH]; TCHAR filesys_inject_icons_project[MAX_DPATH]; TCHAR filesys_inject_icons_drawer[MAX_DPATH]; - int uaescsidevmode; - bool reset_delay; int cs_compatible; int cs_ciaatod; int cs_rtc; - int cs_rtc_adjust; - int cs_rtc_adjust_mode; bool cs_ksmirror_e0; bool cs_ksmirror_a8; bool cs_ciaoverlay; @@ -564,103 +349,44 @@ struct uae_prefs bool cs_cd32nvram; bool cs_cd32fmv; int cs_cd32nvram_size; - bool cs_cdtvcd; - bool cs_cdtvram; - int cs_cdtvcard; int cs_ide; bool cs_pcmcia; - bool cs_a1000ram; int cs_fatgaryrev; int cs_ramseyrev; - int cs_agnusrev; - int cs_deniserev; - int cs_mbdmac; - bool cs_cdtvscsi; - bool cs_cdtvcr; bool cs_df0idhw; - bool cs_slowmemisfast; - bool cs_resetwarning; - bool cs_denisenoehb; - bool cs_dipagnus; - bool cs_agnusbltbusybug; bool cs_ciatodbug; bool cs_z3autoconfig; - bool cs_1mchipjumper; - bool cs_cia6526; bool cs_bytecustomwritebug; - bool cs_color_burst; - int cs_hacks; struct boardromconfig expansionboard[MAX_EXPANSION_BOARDS]; TCHAR romfile[MAX_DPATH]; - TCHAR romident[256]; TCHAR romextfile[MAX_DPATH]; - uae_u32 romextfile2addr; - TCHAR romextfile2[MAX_DPATH]; - TCHAR romextident[256]; TCHAR flashfile[MAX_DPATH]; - TCHAR rtcfile[MAX_DPATH]; TCHAR cartfile[MAX_DPATH]; - TCHAR cartident[256]; int cart_internal; - TCHAR pci_devices[256]; - TCHAR prtname[256]; - TCHAR sername[256]; - TCHAR a2065name[MAX_DPATH]; - TCHAR ne2000pciname[MAX_DPATH]; - TCHAR ne2000pcmcianame[MAX_DPATH]; - TCHAR picassoivromfile[MAX_DPATH]; struct cdslot cdslots[MAX_TOTAL_SCSI_DEVICES]; - TCHAR quitstatefile[MAX_DPATH]; - TCHAR statefile[MAX_DPATH]; - TCHAR inprecfile[MAX_DPATH]; - bool inprec_autoplay; - bool refresh_indicator; - struct multipath path_floppy; - struct multipath path_hardfile; - struct multipath path_rom; - struct multipath path_cd; + TCHAR path_floppy[MAX_DPATH]; + TCHAR path_hardfile[MAX_DPATH]; + TCHAR path_rom[MAX_DPATH]; + TCHAR path_cd[MAX_DPATH]; int m68k_speed; - double m68k_speed_throttle; - double x86_speed_throttle; int cpu_model; - int mmu_model; - int cpu060_revision; int fpu_model; - int fpu_revision; - int ppc_mode; - TCHAR ppc_model[32]; bool cpu_compatible; - bool cpu_thread; - bool int_no_unimplemented; bool fpu_no_unimplemented; bool address_space_24; - bool picasso96_nocustom; int picasso96_modeflags; - int cpu_model_fallback; uae_u32 z3autoconfig_start; struct ramboard z3fastmem[MAX_RAM_BOARDS]; struct ramboard fastmem[MAX_RAM_BOARDS]; - uae_u32 z3chipmem_size; - uae_u32 z3chipmem_start; uae_u32 chipmem_size; uae_u32 bogomem_size; uae_u32 mbresmem_low_size; uae_u32 mbresmem_high_size; - uae_u32 mem25bit_size; - int cpuboard_type; - int cpuboard_subtype; - int cpuboard_settings; - uae_u32 cpuboardmem1_size; - uae_u32 cpuboardmem2_size; - int ppc_implementation; - bool rtg_hardwareinterrupt; - bool rtg_hardwaresprite; - bool rtg_more_compatible; struct rtgboardconfig rtgboards[MAX_RTG_BOARDS]; uae_u32 custom_memory_addrs[MAX_CUSTOM_MEMORY_ADDRS]; uae_u32 custom_memory_sizes[MAX_CUSTOM_MEMORY_ADDRS]; @@ -668,20 +394,7 @@ struct uae_prefs int uaeboard; int uaeboard_order; - bool kickshifter; - bool filesys_no_uaefsdb; - bool filesys_custom_uaefsdb; - bool mmkeyboard; - int uae_hide; - bool clipboard_sharing; - bool native_code; - bool uae_hide_autoconfig; int z3_mapping_mode; - bool autoconfig_custom_sort; - bool obs_sound_toccata; - bool obs_sound_toccata_mixer; - bool obs_sound_es1370; - bool obs_sound_fm801; int mountitems; struct uaedev_config_data mountconfig[MOUNT_CONFIG_SIZE]; @@ -690,40 +403,52 @@ struct uae_prefs struct floppyslot floppyslots[4]; bool floppy_read_only; bool harddrive_read_only; - TCHAR dfxlist[MAX_SPARE_DRIVES][MAX_DPATH]; - int dfxclickvolume_disk[4]; - int dfxclickvolume_empty[4]; - int dfxclickchannelmask; - - TCHAR luafiles[MAX_LUA_STATES][MAX_DPATH]; /* Target specific options */ #ifdef AMIBERRY - int gfx_correct_aspect; - int gfx_fullscreen_ratio; int kbd_led_num; int kbd_led_scr; int kbd_led_cap; - int scaling_method; - int amiberry_customControls; - int key_for_menu; - int key_for_quit; - int button_for_menu; - int button_for_quit; + +#ifdef USE_SDL1 + int gfx_correct_aspect; + int gfx_fullscreen_ratio; +#endif + +#ifdef USE_SDL2 + int scaling_method; +#endif + + bool customControls; + TCHAR custom_up[256]; + TCHAR custom_down[256]; + TCHAR custom_left[256]; + TCHAR custom_right[256]; + TCHAR custom_a[256]; + TCHAR custom_b[256]; + TCHAR custom_x[256]; + TCHAR custom_y[256]; + TCHAR custom_l[256]; + TCHAR custom_r[256]; + TCHAR custom_play[256]; + + TCHAR open_gui[256]; + TCHAR quit_amiberry[256]; +#endif + +#ifdef PANDORA +int pandora_vertical_offset; + int pandora_cpu_speed; + int pandora_hide_idle_led; + + int pandora_tapDelay; + int pandora_customControls; #endif - int statecapturerate, statecapturebuffersize; - int aviout_width, aviout_height, aviout_xoffset, aviout_yoffset; - int screenshot_width, screenshot_height, screenshot_xoffset, screenshot_yoffset; - int screenshot_min_width, screenshot_min_height; - int screenshot_max_width, screenshot_max_height; - int screenshot_output_width, screenshot_output_height; - int screenshot_xmult, screenshot_ymult; /* input */ struct jport jports[MAX_JPORTS]; - struct jport_custom jports_custom[MAX_JPORTS_CUSTOM]; int input_selected_setting; int input_joymouse_multiplier; int input_joymouse_deadzone; @@ -734,105 +459,153 @@ struct uae_prefs int input_autofire_linecnt; int input_mouse_speed; int input_tablet; - bool tablet_library; - int input_mouse_untrap; - int input_magic_mouse_cursor; int input_keyboard_type; - int input_autoswitch; + + bool amiberry_use_retroarch_quit; + bool amiberry_use_retroarch_menu; + bool amiberry_use_retroarch_reset; + bool amiberry_use_retroarch_statebuttons; + + /* ANDROID */ +#ifdef ANDROIDSDL +int onScreen; +int onScreen_textinput; +int onScreen_dpad; +int onScreen_button1; +int onScreen_button2; +int onScreen_button3; +int onScreen_button4; +int onScreen_button5; +int onScreen_button6; +int custom_position; +int pos_x_textinput; +int pos_y_textinput; +int pos_x_dpad; +int pos_y_dpad; +int pos_x_button1; +int pos_y_button1; +int pos_x_button2; +int pos_y_button2; +int pos_x_button3; +int pos_y_button3; +int pos_x_button4; +int pos_y_button4; +int pos_x_button5; +int pos_y_button5; +int pos_x_button6; +int pos_y_button6; +int extfilter; +int quickSwitch; +int floatingJoystick; +int disableMenuVKeyb; +#endif + struct uae_input_device joystick_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES]; struct uae_input_device mouse_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES]; struct uae_input_device keyboard_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES]; - struct uae_input_device internalevent_settings[MAX_INPUT_SETTINGS][INTERNALEVENT_COUNT]; TCHAR input_config_name[GAMEPORT_INPUT_SETTINGS][256]; - int dongle; - int input_contact_bounce; - int input_device_match_mask; }; extern int config_changed; -extern void config_check_vsync(void); -extern void set_config_changed(void); +extern void config_check_vsync (void); +extern void set_config_changed (void); /* Contains the filename of .uaerc */ -extern TCHAR optionsfile[]; -extern void save_options(struct zfile *, struct uae_prefs *, int); +extern void cfgfile_write (struct zfile *, const TCHAR *option, const TCHAR *format,...); +extern void cfgfile_dwrite (struct zfile *, const TCHAR *option, const TCHAR *format,...); +extern void cfgfile_target_write (struct zfile *, const TCHAR *option, const TCHAR *format,...); +extern void cfgfile_target_dwrite (struct zfile *, const TCHAR *option, const TCHAR *format,...); -extern void cfgfile_write(struct zfile *, const TCHAR *option, const TCHAR *format, ...); -extern void cfgfile_dwrite(struct zfile *, const TCHAR *option, const TCHAR *format, ...); -extern void cfgfile_target_write(struct zfile *, const TCHAR *option, const TCHAR *format, ...); -extern void cfgfile_target_dwrite(struct zfile *, const TCHAR *option, const TCHAR *format, ...); +extern void cfgfile_write_bool (struct zfile *f, const TCHAR *option, bool b); +extern void cfgfile_dwrite_bool (struct zfile *f,const TCHAR *option, bool b); +extern void cfgfile_target_write_bool (struct zfile *f, const TCHAR *option, bool b); +extern void cfgfile_target_dwrite_bool (struct zfile *f, const TCHAR *option, bool b); -extern void cfgfile_write_bool(struct zfile *f, const TCHAR *option, bool b); -extern void cfgfile_dwrite_bool(struct zfile *f, const TCHAR *option, bool b); -extern void cfgfile_target_write_bool(struct zfile *f, const TCHAR *option, bool b); -extern void cfgfile_target_dwrite_bool(struct zfile *f, const TCHAR *option, bool b); +extern void cfgfile_write_str (struct zfile *f, const TCHAR *option, const TCHAR *value); +extern void cfgfile_dwrite_str (struct zfile *f, const TCHAR *option, const TCHAR *value); +extern void cfgfile_target_write_str (struct zfile *f, const TCHAR *option, const TCHAR *value); +extern void cfgfile_target_dwrite_str (struct zfile *f, const TCHAR *option, const TCHAR *value); -extern void cfgfile_write_str(struct zfile *f, const TCHAR *option, const TCHAR *value); -extern void cfgfile_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *value); -extern void cfgfile_target_write_str(struct zfile *f, const TCHAR *option, const TCHAR *value); -extern void cfgfile_target_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *value); +extern struct uaedev_config_data *add_filesys_config (struct uae_prefs *p, int index, struct uaedev_config_info*); +extern bool get_hd_geometry (struct uaedev_config_info *); +extern void uci_set_defaults (struct uaedev_config_info *uci, bool rdb); -extern void cfgfile_backup(const TCHAR *path); -extern struct uaedev_config_data *add_filesys_config(struct uae_prefs *p, int index, struct uaedev_config_info*); -extern bool get_hd_geometry(struct uaedev_config_info *); -extern void uci_set_defaults(struct uaedev_config_info *uci, bool rdb); +extern void error_log (const TCHAR*, ...); +extern TCHAR *get_error_log (void); +extern bool is_error_log (void); -extern void error_log(const TCHAR*, ...); -extern TCHAR *get_error_log(void); -extern bool is_error_log(void); +extern void default_prefs (struct uae_prefs *, bool, int); +extern void discard_prefs (struct uae_prefs *, int); +extern int bip_a500 (struct uae_prefs *p, int rom); +extern int bip_a500plus (struct uae_prefs *p, int rom); +extern int bip_a1200 (struct uae_prefs *p, int rom); +extern int bip_a2000 (struct uae_prefs *p, int rom); +extern int bip_a4000 (struct uae_prefs *p, int rom); +extern int bip_cd32 (struct uae_prefs *p, int rom); -extern void default_prefs(struct uae_prefs *, bool, int); -extern void discard_prefs(struct uae_prefs *, int); +int parse_cmdline_option (struct uae_prefs *, TCHAR, const TCHAR *); -int parse_cmdline_option(struct uae_prefs *, TCHAR, const TCHAR*); +extern int cfgfile_separate_linea (const TCHAR *filename, char *line, TCHAR *line1b, TCHAR *line2b); +extern int cfgfile_yesno (const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location); +extern int cfgfile_intval (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, int scale); +extern int cfgfile_strval (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, const TCHAR *table[], int more); +extern int cfgfile_string (const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz); +extern TCHAR *cfgfile_subst_path (const TCHAR *path, const TCHAR *subst, const TCHAR *file); -extern int cfgfile_yesno(const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location); -extern int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, int scale); -extern int cfgfile_strval(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, const TCHAR *table[], int more); -extern int cfgfile_string(const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz); -extern TCHAR *cfgfile_subst_path(const TCHAR *path, const TCHAR *subst, const TCHAR *file); +extern TCHAR *target_expand_environment (const TCHAR *path, TCHAR *out, int maxlen); +extern int target_parse_option (struct uae_prefs *, const TCHAR *option, const TCHAR *value); +extern void target_save_options (struct zfile*, struct uae_prefs *); +extern void target_default_options (struct uae_prefs *, int type); +extern void target_fixup_options (struct uae_prefs *); +extern int target_cfgfile_load (struct uae_prefs *, const TCHAR *filename, int type, int isdefault); +extern void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type); -extern TCHAR *target_expand_environment(const TCHAR *path); -extern int target_parse_option(struct uae_prefs *, const TCHAR *option, const TCHAR *value); -extern void target_save_options(struct zfile*, struct uae_prefs *); -extern void target_default_options(struct uae_prefs *, int type); -extern void target_fixup_options(struct uae_prefs *); -extern int target_cfgfile_load(struct uae_prefs *, const TCHAR *filename, int type, int isdefault); -extern void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type); -extern int target_get_display(const TCHAR*); -extern const TCHAR *target_get_display_name(int, bool); - -extern int cfgfile_load(struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig); -extern int cfgfile_save(struct uae_prefs *p, const TCHAR *filename, int); -extern void cfgfile_parse_line(struct uae_prefs *p, TCHAR *, int); -extern void cfgfile_parse_lines(struct uae_prefs *p, const TCHAR *, int); -extern int cfgfile_parse_option(struct uae_prefs *p, const TCHAR *option, TCHAR *value, int); -extern int cfgfile_get_description(const TCHAR *filename, TCHAR *description, TCHAR *hostlink, TCHAR *hardwarelink, int *type); -extern void cfgfile_show_usage(void); -extern int cfgfile_searchconfig(const TCHAR *in, int index, TCHAR *out, int outsize); -extern uae_u32 cfgfile_uaelib(TrapContext *ctx, int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen); -extern uae_u32 cfgfile_uaelib_modify(TrapContext *ctx, uae_u32 mode, uae_u32 parms, uae_u32 size, uae_u32 out, uae_u32 outsize); -extern uae_u32 cfgfile_modify(uae_u32 index, const TCHAR *parms, uae_u32 size, TCHAR *out, uae_u32 outsize); -extern void cfgfile_addcfgparam(TCHAR *); -extern int built_in_prefs(struct uae_prefs *p, int model, int config, int compa, int romcheck); -extern int built_in_chipset_prefs(struct uae_prefs *p); -extern int cmdlineparser(const TCHAR *s, TCHAR *outp[], int max); +extern int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig); +extern int cfgfile_save (struct uae_prefs *p, const TCHAR *filename, int); +extern void cfgfile_parse_line (struct uae_prefs *p, TCHAR *, int); +extern int cfgfile_parse_option (struct uae_prefs *p, const TCHAR *option, TCHAR *value, int); +extern int cfgfile_get_description (const TCHAR *filename, TCHAR *description); +extern uae_u32 cfgfile_uaelib (TrapContext *ctx, int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen); +extern uae_u32 cfgfile_uaelib_modify (TrapContext *ctx, uae_u32 mode, uae_u32 parms, uae_u32 size, uae_u32 out, uae_u32 outsize); +extern uae_u32 cfgfile_modify (uae_u32 index, const TCHAR *parms, uae_u32 size, TCHAR *out, uae_u32 outsize); +extern void cfgfile_addcfgparam (TCHAR *); +extern int built_in_prefs (struct uae_prefs *p, int model, int config, int compa, int romcheck); +extern int built_in_chipset_prefs (struct uae_prefs *p); extern int cfgfile_configuration_change(int); -extern void fixup_prefs_dimensions(struct uae_prefs *prefs); -extern void fixup_prefs(struct uae_prefs *prefs, bool userconfig); -extern void fixup_cpu(struct uae_prefs *prefs); +extern void fixup_prefs_dimensions (struct uae_prefs *prefs); +extern void fixup_prefs (struct uae_prefs *prefs, bool userconfig); +extern void fixup_cpu (struct uae_prefs *prefs); extern void cfgfile_compatibility_romtype(struct uae_prefs *p); extern void cfgfile_compatibility_rtg(struct uae_prefs *p); -extern void check_prefs_changed_custom(void); -extern void check_prefs_changed_cpu(void); -extern void check_prefs_changed_audio(void); -extern void check_prefs_changed_cd(void); -extern int check_prefs_changed_gfx(void); +extern void check_prefs_changed_custom (void); +extern void check_prefs_changed_cpu (void); +extern void check_prefs_changed_audio (void); +extern void check_prefs_changed_cd (void); +extern int check_prefs_changed_gfx (void); extern struct uae_prefs currprefs, changed_prefs; -extern int machdep_init(void); -extern void machdep_free(void); +extern int machdep_init (void); +extern void machdep_free (void); -#endif /* OPTIONS_H */ + + + +struct amiberry_customised_layout { + + // create structures for each 'function' button + struct joypad_map_layout none; + struct joypad_map_layout select; + struct joypad_map_layout left_trigger; + struct joypad_map_layout right_trigger; + + }; + +extern const int RemapEventList[]; +extern const int RemapEventListSize; + +extern void saveAdfDir(void); +extern void import_joysticks(void); + +#endif /* UAE_OPTIONS_H */ diff --git a/src/include/rommgr.h b/src/include/rommgr.h index cf3dfa4c..c0f5e8e6 100644 --- a/src/include/rommgr.h +++ b/src/include/rommgr.h @@ -1,5 +1,7 @@ -#pragma once -extern int decode_cloanto_rom_do(uae_u8 *mem, int size, int real_size); +#ifndef UAE_ROMMGR_H +#define UAE_ROMMGR_H + +extern int decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size); #define ROMTYPE_SUB_MASK 0x000000ff #define ROMTYPE_GROUP_MASK 0x003fff00 @@ -146,6 +148,9 @@ extern int decode_cloanto_rom_do(uae_u8 *mem, int size, int real_size); #define ROMTYPE_HARDFRAME 0x0010005e #define ROMTYPE_ATEAM 0x0010005f #define ROMTYPE_PMX 0x00100060 +#define ROMTYPE_COMSPEC 0x00100061 +#define ROMTYPE_MALIBU 0x00100062 +#define ROMTYPE_RAPIDFIRE 0x00100063 #define ROMTYPE_NOT 0x00800000 #define ROMTYPE_QUAD 0x01000000 @@ -158,91 +163,84 @@ extern int decode_cloanto_rom_do(uae_u8 *mem, int size, int real_size); #define ROMTYPE_NONE 0x80000000 #define ROMTYPE_ALL_KICK (ROMTYPE_KICK | ROMTYPE_KICKCD32 | ROMTYPE_CD32) -#define ROMTYPE_ALL_EXT (ROMTYPE_EXTCD32 | ROMTYPE_EXTCDTV) +#define ROMTYPE_ALL_EXT (ROMTYPE_EXTCD32) #define ROMTYPE_ALL_CART (ROMTYPE_AR | ROMTYPE_HRTMON | ROMTYPE_NORDIC | ROMTYPE_XPOWER | ROMTYPE_CD32CART) struct romheader { const TCHAR *name; - int id; + int id; }; struct romdata { const TCHAR *name; - int ver, rev; - int subver, subrev; + int ver, rev; + int subver, subrev; const TCHAR *model; - uae_u32 size; - int id; - int cpu; - int cloanto; + uae_u32 size; + int id; + int cpu; + int cloanto; uae_u32 type; - int group; - int title; + int group; + int title; const TCHAR *partnumber; - uae_u32 crc32; - uae_u32 sha1[5]; + uae_u32 crc32; + uae_u32 sha1[5]; const TCHAR *configname; const TCHAR *defaultfilename; }; struct romlist { - TCHAR *path; - struct romdata *rd; + TCHAR *path; + struct romdata *rd; }; -extern struct romdata *getromdatabypath(const TCHAR *path); -extern struct romdata *getromdatabycrc(uae_u32 crc32); -extern struct romdata *getromdatabycrc(uae_u32 crc32, bool); -extern struct romdata *getromdatabydata(uae_u8 *rom, int size); -extern struct romdata *getromdatabyid(int id); -extern struct romdata *getromdatabyidgroup(int id, int group, int subitem); -extern struct romdata *getromdatabyzfile(struct zfile *f); +extern struct romdata *getromdatabypath (const TCHAR *path); +extern struct romdata *getromdatabycrc (uae_u32 crc32); +extern struct romdata *getromdatabycrc (uae_u32 crc32, bool); +extern struct romdata *getromdatabydata (uae_u8 *rom, int size); +extern struct romdata *getromdatabyid (int id); +extern struct romdata *getromdatabyidgroup (int id, int group, int subitem); +extern struct romdata *getromdatabyzfile (struct zfile *f); extern struct romdata *getfrombydefaultname(const TCHAR *name, int size); -extern struct romlist **getarcadiaroms(void); -extern struct romdata *getarcadiarombyname(const TCHAR *name); -extern struct romlist **getromlistbyident(int ver, int rev, int subver, int subrev, const TCHAR *model, int romflags, bool all); -extern void getromname(const struct romdata*, TCHAR*); -extern struct romdata *getromdatabyname(const TCHAR*); -extern struct romlist *getromlistbyids(const int *ids, const TCHAR *romname); -extern struct romdata *getromdatabyids(const int *ids); +extern void getromname (const struct romdata*, TCHAR*); +extern struct romdata *getromdatabyname (const TCHAR*); +extern struct romlist *getromlistbyids (const int *ids, const TCHAR *romname); +extern struct romdata *getromdatabyids (const int *ids); extern struct romlist *getromlistbyromtype(uae_u32 romtype); extern void romwarning(const int *ids); extern struct romlist *getromlistbyromdata(const struct romdata *rd); -extern void romlist_add(const TCHAR *path, struct romdata *rd); -extern TCHAR *romlist_get(const struct romdata *rd); -extern void romlist_clear(void); -extern struct zfile *read_rom(struct romdata *rd); -extern struct zfile *read_rom_name(const TCHAR *filename); +extern void romlist_add (const TCHAR *path, struct romdata *rd); +extern TCHAR *romlist_get (const struct romdata *rd); +extern void romlist_clear (void); +extern struct zfile *read_rom (struct romdata *rd); +extern struct zfile *read_rom_name (const TCHAR *filename); extern struct zfile *read_device_from_romconfig(struct romconfig *rc, uae_u32 romtype); -extern int load_keyring(struct uae_prefs *p, const TCHAR *path); -extern uae_u8 *target_load_keyfile(struct uae_prefs *p, const TCHAR *path, int *size, TCHAR *name); -extern void free_keyring(void); -extern int get_keyring(void); -extern void kickstart_fix_checksum(uae_u8 *mem, int size); -extern void descramble_nordicpro(uae_u8*, int, int); -extern int kickstart_checksum(uae_u8 *mem, int size); -extern int decode_rom(uae_u8 *mem, int size, int mode, int real_size); -extern struct zfile *rom_fopen(const TCHAR *name, const TCHAR *mode, int mask); -extern struct zfile *read_rom_name_guess(const TCHAR *filename); -extern void addkeydir(const TCHAR *path); -extern void addkeyfile(const TCHAR *path); -extern int romlist_count(void); -extern struct romlist *romlist_getit(void); -extern int configure_rom(struct uae_prefs *p, const int *rom, int msg); +extern int load_keyring (struct uae_prefs *p, const TCHAR *path); +extern uae_u8 *target_load_keyfile (struct uae_prefs *p, const TCHAR *path, int *size, TCHAR *name); +extern void free_keyring (void); +extern int get_keyring (void); +extern void kickstart_fix_checksum (uae_u8 *mem, int size); +extern void descramble_nordicpro (uae_u8*, int, int); +extern int kickstart_checksum (uae_u8 *mem, int size); +extern int decode_rom (uae_u8 *mem, int size, int mode, int real_size); +extern struct zfile *rom_fopen (const TCHAR *name, const TCHAR *mode, int mask); +extern struct zfile *read_rom_name_guess (const TCHAR *filename); +extern void addkeydir (const TCHAR *path); +extern void addkeyfile (const TCHAR *path); +extern int romlist_count (void); +extern struct romlist *romlist_getit (void); +extern int configure_rom (struct uae_prefs *p, const int *rom, int msg); int is_device_rom(struct uae_prefs *p, int romtype, int devnum); -struct zfile *read_device_rom(struct uae_prefs *p, int romtype, int devnum, int *roms); struct romconfig *get_device_romconfig(struct uae_prefs *p, int romtype, int devnum); struct boardromconfig *get_device_rom(struct uae_prefs *p, int romtype, int devnum, int *index); -void set_device_rom(struct uae_prefs *p, const TCHAR *path, int romtype, int devnum); const struct expansionromtype *get_device_expansion_rom(int romtype); -const struct expansionromtype *get_unit_expansion_rom(int hdunit); struct boardromconfig *get_device_rom_new(struct uae_prefs *p, int romtype, int devnum, int *index); void clear_device_rom(struct uae_prefs *p, int romtype, int devnum, bool deleteDevice); struct boardromconfig *get_boardromconfig(struct uae_prefs *p, int romtype, int *index); bool is_board_enabled(struct uae_prefs *p, int romtype, int devnum); -void board_prefs_changed(int romtype, int devnum); #define LOADROM_FILL 1 #define LOADROM_EVENONLY 2 @@ -253,3 +251,5 @@ void board_prefs_changed(int romtype, int devnum); bool load_rom_rc(struct romconfig *rc, uae_u32 romtype, int maxfilesize, int fileoffset, uae_u8 *rom, int maxromsize, int flags); #define EXPANSION_ORDER_MAX 10000 + +#endif /* UAE_ROMMGR_H */ diff --git a/src/include/savestate.h b/src/include/savestate.h index 8f24fc75..2432a51a 100644 --- a/src/include/savestate.h +++ b/src/include/savestate.h @@ -1,14 +1,15 @@ -/* - * UAE - The Un*x Amiga Emulator - * - * Save/restore emulator state - * - * (c) 1999-2001 Toni Wilen - */ + /* + * UAE - The Un*x Amiga Emulator + * + * Save/restore emulator state + * + * (c) 1999-2001 Toni Wilen + */ +#ifndef UAE_SAVESTATE_H +#define UAE_SAVESTATE_H -/* functions to save byte,word or long word - * independent of CPU's endianess */ +#include "uae/types.h" extern void save_u64_func (uae_u8 **, uae_u64); extern void save_u32_func (uae_u8 **, uae_u32); @@ -116,45 +117,53 @@ extern uae_u8 *restore_filesys_common (uae_u8 *src); extern uae_u8 *save_filesys_common (int *len); extern int save_filesys_cando(void); +extern uae_u8 *restore_gayle(uae_u8 *src); +extern uae_u8 *save_gayle (int *len, uae_u8*); +extern uae_u8 *restore_gayle_ide (uae_u8 *src); +extern uae_u8 *save_gayle_ide (int num, int *len, uae_u8*); + extern uae_u8 *save_cd (int num, int *len); extern uae_u8 *restore_cd (int, uae_u8 *src); -extern void restore_cd_finish (void); extern uae_u8 *restore_input (uae_u8 *src); extern uae_u8 *save_input (int *len, uae_u8 *dstptr); extern void restore_cram (int, size_t); extern void restore_bram (int, size_t); -extern void restore_fram(int, size_t, int); +extern void restore_fram (int, size_t, int); extern void restore_zram (int, size_t, int); extern void restore_bootrom (int, size_t); extern void restore_pram (int, size_t); +extern void restore_a3000lram (int, size_t); +extern void restore_a3000hram (int, size_t); + extern void restore_ram (size_t, uae_u8*); -extern uae_u8 *save_cram(int *); -extern uae_u8 *save_bram(int *); -extern uae_u8 *save_fram(int *, int); -extern uae_u8 *save_zram(int *, int); -extern uae_u8 *save_bootrom(int *); -extern uae_u8 *save_pram(int *); -extern uae_u8 *save_a3000lram(int *); -extern uae_u8 *save_a3000hram(int *); - -extern uae_u8 *restore_rom(uae_u8 *); -extern uae_u8 *save_rom(int, int *, uae_u8 *); - -extern uae_u8 *restore_action_replay(uae_u8 *); -extern uae_u8 *save_action_replay(int *, uae_u8 *); -extern uae_u8 *restore_hrtmon(uae_u8 *); -extern uae_u8 *save_hrtmon(int *, uae_u8 *); +extern uae_u8 *save_cram (int *); +extern uae_u8 *save_bram (int *); +extern uae_u8 *save_fram (int *, int); +extern uae_u8 *save_zram (int *, int); +extern uae_u8 *save_bootrom (int *); +extern uae_u8 *save_pram (int *); +extern uae_u8 *save_a3000lram (int *); +extern uae_u8 *save_a3000hram (int *); -extern void savestate_initsave(const TCHAR *filename, int docompress, int nodialogs, bool save); -extern int save_state(const TCHAR *filename, const TCHAR *description); -extern void restore_state(const TCHAR *filename); -extern void savestate_restore_finish(void); -extern void savestate_memorysave(void); +extern uae_u8 *restore_rom (uae_u8 *); +extern uae_u8 *save_rom (int, int *, uae_u8 *); + +extern uae_u8 *save_expansion_info(int*, uae_u8*); +extern uae_u8 *restore_expansion_info(uae_u8*); + +extern uae_u8 *restore_action_replay (uae_u8 *); +extern uae_u8 *save_action_replay (int *, uae_u8 *); +extern uae_u8 *restore_hrtmon (uae_u8 *); +extern uae_u8 *save_hrtmon (int *, uae_u8 *); + +extern void savestate_initsave (const TCHAR *filename, int docompress, int nodialogs, bool save); +extern int save_state (const TCHAR *filename, const TCHAR *description); +extern void restore_state (const TCHAR *filename); +extern void savestate_restore_finish (void); -extern void custom_save_state (void); extern void custom_prepare_savestate (void); extern bool savestate_check (void); @@ -170,18 +179,9 @@ extern int savestate_state; extern TCHAR savestate_fname[MAX_DPATH]; extern struct zfile *savestate_file; -STATIC_INLINE bool isrestore(void) -{ - return savestate_state == STATE_RESTORE || savestate_state == STATE_REWIND; +STATIC_INLINE bool isrestore (void) +{ + return savestate_state == STATE_RESTORE; } -extern void savestate_quick(int slot, int save); - -extern void savestate_capture(int); -extern void savestate_free(void); -extern void savestate_init(void); -extern void savestate_rewind(void); -extern int savestate_dorewind(int); -extern void savestate_listrewind(void); -extern void statefile_save_recording(const TCHAR*); -extern void savestate_capture_request(void); \ No newline at end of file +#endif /* UAE_SAVESTATE_H */ diff --git a/src/include/sysdeps.h b/src/include/sysdeps.h index 54aced6a..aedac029 100644 --- a/src/include/sysdeps.h +++ b/src/include/sysdeps.h @@ -1,6 +1,3 @@ -#ifndef UAE_SYSDEPS_H -#define UAE_SYSDEPS_H - /* * UAE - The Un*x Amiga Emulator * @@ -14,8 +11,25 @@ * * Copyright 1996, 1997 Bernd Schmidt */ +#ifndef UAE_SYSDEPS_H +#define UAE_SYSDEPS_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include "sysconfig.h" + +#ifndef UAE +#define UAE +#endif + +#ifdef __cplusplus #include using namespace std; +#else +#include +#include +#endif #include #include #include @@ -39,29 +53,11 @@ using namespace std; #error unrecognized CPU type #endif -//#ifdef _WIN32 -/* Parameters are passed in ECX, EDX for both x86 and x86-64 (RCX, RDX). -* For x86-64, __fastcall is the default, so it isn't really required. */ -//#define JITCALL __fastcall -//#elif defined(CPU_x86_64) -///* Parameters are passed in RDI, RSI by default (System V AMD64 ABI). */ -//#define JITCALL -//#elif defined(HAVE_FUNC_ATTRIBUTE_REGPARM) -///* Parameters are passed in EAX, EDX on x86 with regparm(2). */ -//#define JITCALL __attribute__((regparm(2))) -///* This was originally regparm(3), but as far as I can see only two register -//* params are supported by the JIT code. It probably just worked anyway -//* if all functions used max two arguments. */ -//#elif !defined(JIT) -//#define JITCALL -//#endif -#define REGPARAM -#define REGPARAM2 -#define REGPARAM3 - #ifndef __STDC__ +#ifndef _MSC_VER_ #error "Your compiler is not ANSI. Get a real one." #endif +#endif #include @@ -128,10 +124,6 @@ using namespace std; #include #include -#if EEXIST == ENOTEMPTY -#define BROKEN_OS_PROBABLY_AIX -#endif - #ifdef __NeXT__ #define S_IRUSR S_IREAD #define S_IWUSR S_IWRITE @@ -139,51 +131,11 @@ using namespace std; #define S_ISDIR(val) (S_IFDIR & val) struct utimbuf { - time_t actime; - time_t modtime; + time_t actime; + time_t modtime; }; #endif -/* sam: some definitions so that SAS/C can compile UAE */ -#if defined(__SASC) && defined(AMIGA) -#define REGPARAM2 -#define REGPARAM -#define S_IRUSR S_IREAD -#define S_IWUSR S_IWRITE -#define S_IXUSR S_IEXECUTE -#define S_ISDIR(val) (S_IFDIR & val) -#define mkdir(x,y) mkdir(x) -#define truncate(x,y) 0 -#define creat(x,y) open("T:creat",O_CREAT|O_TEMP|O_RDWR) /* sam: for zfile.c */ -#define strcasecmp stricmp -#define utime(file,time) 0 -struct utimbuf -{ - time_t actime; - time_t modtime; -}; -#endif - -#ifdef __DOS__ -#include -#include -#endif - -/* Acorn specific stuff */ -#ifdef ACORN - -#define S_IRUSR S_IREAD -#define S_IWUSR S_IWRITE -#define S_IXUSR S_IEXEC - -#define strcasecmp stricmp - -#endif - -#ifndef L_tmpnam -#define L_tmpnam 128 /* ought to be safe */ -#endif - /* If char has more then 8 bits, good night. */ typedef unsigned char uae_u8; typedef signed char uae_s8; @@ -233,36 +185,27 @@ typedef uae_u32 uaecptr; #define UVAL64(a) (a ## ul) #endif -void atomic_and(volatile uae_atomic *p, uae_u32 v); -void atomic_or(volatile uae_atomic *p, uae_u32 v); -uae_atomic atomic_inc(volatile uae_atomic *p); -uae_atomic atomic_dec(volatile uae_atomic *p); -uae_u32 atomic_bit_test_and_reset(volatile uae_atomic *p, uae_u32 v); - #ifdef HAVE_STRDUP -#define my_strdup strdup +#define my_strdup _tcsdup #else -extern TCHAR *my_strdup(const TCHAR*s); +extern TCHAR *my_strdup (const TCHAR*s); #endif -extern TCHAR *my_strdup_ansi(const char*); -extern void my_trim(TCHAR*); -extern TCHAR *my_strdup_trim(const TCHAR*); -extern TCHAR *au(const char*); -extern char *ua(const TCHAR*); -extern TCHAR *aucp(const char *s, unsigned int cp); -extern char *uacp(const TCHAR *s, unsigned int cp); -extern TCHAR *au_fs(const char*); -extern char *ua_fs(const TCHAR*, int); -extern char *ua_copy(char *dst, int maxlen, const TCHAR *src); -extern TCHAR *au_copy(TCHAR *dst, int maxlen, const char *src); -extern char *ua_fs_copy(char *dst, int maxlen, const TCHAR *src, int defchar); -extern TCHAR *au_fs_copy(TCHAR *dst, int maxlen, const char *src); -extern char *uutf8(const TCHAR *s); -extern TCHAR *utf8u(const char *s); -extern void unicode_init(void); -extern void to_lower(TCHAR *s, int len); -extern void to_upper(TCHAR *s, int len); +extern TCHAR *my_strdup_ansi (const char*); +extern void my_trim (TCHAR*); +extern TCHAR *my_strdup_trim (const TCHAR*); +extern TCHAR *au (const char*); +extern char *ua (const TCHAR*); +extern TCHAR *au_fs (const char*); +extern char *ua_fs (const TCHAR*, int); +extern char *ua_copy (char *dst, int maxlen, const TCHAR *src); +extern TCHAR *au_copy (TCHAR *dst, int maxlen, const char *src); +extern char *ua_fs_copy (char *dst, int maxlen, const TCHAR *src, int defchar); +extern TCHAR *au_fs_copy (TCHAR *dst, int maxlen, const char *src); +extern char *uutf8 (const TCHAR *s); +extern TCHAR *utf8u (const char *s); +extern void to_lower (TCHAR *s, int len); +extern void to_upper (TCHAR *s, int len); /* We can only rely on GNU C getting enums right. Mickeysoft VSC++ is known * to have problems, and it's likely that other compilers choke too. */ @@ -295,8 +238,8 @@ extern void to_upper(TCHAR *s, int len); #undef DONT_HAVE_STDIO #undef DONT_HAVE_MALLOC -#ifdef AMIBERRY -#include +#if defined AMIBERRY + #include #define FILEFLAG_DIR 0x1 @@ -307,6 +250,17 @@ extern void to_upper(TCHAR *s, int len); #define FILEFLAG_SCRIPT 0x20 #define FILEFLAG_PURE 0x40 +#define REGPARAM2 +#define REGPARAM3 +#define REGPARAM + +#define abort() \ + do { \ + printf ("Internal error; file %s, line %d\n", __FILE__, __LINE__); \ + SDL_Quit(); \ + (abort) (); \ +} while (0) + #endif #ifdef DONT_HAVE_POSIX @@ -388,8 +342,6 @@ extern void mallocemu_free(void *ptr); #define ASM_SYM_FOR_FUNC(a) #endif -#include "target.h" - #ifdef UAE_CONSOLE #undef write_log #define write_log write_log_standard @@ -410,11 +362,19 @@ extern void gui_message(const TCHAR *, ...); #endif #ifndef STATIC_INLINE -#if __GNUC__ - 1 > 1 && __GNUC_MINOR__ - 1 >= 0 +#ifdef DEBUG +#define STATIC_INLINE static __attribute__ ((noinline)) +#define NOINLINE __attribute__ ((noinline)) +#define NORETURN +#elif __GNUC__ - 1 > 1 && __GNUC_MINOR__ - 1 >= 0 +#ifdef AMIBERRY +#define STATIC_INLINE static __inline__ +#else #define STATIC_INLINE static __inline__ __attribute__ ((always_inline)) +#endif #define NOINLINE __attribute__ ((noinline)) #define NORETURN __attribute__ ((noreturn)) -#elif _MSC_VER +#elif _MSC_VER_ #define STATIC_INLINE static __forceinline #define NOINLINE __declspec(noinline) #define NORETURN __declspec(noreturn) @@ -425,6 +385,8 @@ extern void gui_message(const TCHAR *, ...); #endif #endif +#include "target.h" + /* Every Amiga hardware clock cycle takes this many "virtual" cycles. This used to be hardcoded as 1, but using higher values allows us to time some stuff more precisely. @@ -451,31 +413,32 @@ extern void gui_message(const TCHAR *, ...); * Byte-swapping functions */ +#ifdef ARMV6_ASSEMBLY +STATIC_INLINE uae_u32 do_byteswap_32(uae_u32 v) { + __asm__( + "rev %0, %0" + : "=r" (v) : "0" (v)); return v; +} + +STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v) { + __asm__( + "revsh %0, %0\n\t" + "uxth %0, %0" + : "=r" (v) : "0" (v)); return v; +} +#define bswap_16(x) do_byteswap_16(x) +#define bswap_32(x) do_byteswap_32(x) +#else + /* Try to use system bswap_16/bswap_32 functions. */ #if defined HAVE_BSWAP_16 && defined HAVE_BSWAP_32 # include # ifdef HAVE_BYTESWAP_H # include # endif -#else -# ifdef ARMV6_ASSEMBLY -STATIC_INLINE uae_u32 do_byteswap_32(uae_u32 v) { - __asm__( - "rev %0, %0" - : "=r" (v) : "0" (v)); return v; -} - -STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v) { - __asm__( - "revsh %0, %0\n\t" - "uxth %0, %0" - : "=r" (v) : "0" (v)); return v; -} -#define bswap_16(x) do_byteswap_16(x) -#define bswap_32(x) do_byteswap_32(x) # else /* Else, if using SDL, try SDL's endian functions. */ -# ifdef USE_SDL +# if defined (USE_SDL1) || defined (USE_SDL2) # include # define bswap_16(x) SDL_Swap16(x) # define bswap_32(x) SDL_Swap32(x) @@ -485,9 +448,8 @@ STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v) { #define bswap_32(x) (((x) << 24) | (((x) << 8) & 0x00FF0000) | (((x) >> 8) & 0x0000FF00) | ((x) >> 24)) # endif #endif -#endif -#endif +#endif /* ARMV6_ASSEMBLY*/ #ifndef __cplusplus @@ -496,12 +458,6 @@ STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v) { #define xfree(T) free(T) #define xrealloc(T, TP, N) realloc(TP, sizeof (T) * (N)) -#if 0 -extern void *xmalloc(size_t); -extern void *xcalloc(size_t, size_t); -extern void xfree(const void*); -#endif - #else #define xmalloc(T, N) static_cast(malloc (sizeof (T) * (N))) @@ -517,4 +473,6 @@ extern void xfree(const void*); #define NOWARN_UNUSED(x) __attribute__((unused)) x #else #define NOWARN_UNUSED(x) x -#endif \ No newline at end of file +#endif + +#endif /* UAE_SYSDEPS_H */ diff --git a/src/include/traps.h b/src/include/traps.h index 70cd93d1..102dd741 100644 --- a/src/include/traps.h +++ b/src/include/traps.h @@ -1,19 +1,19 @@ -/* - * E-UAE - The portable Amiga Emulator - * - * Support for traps - * - * Copyright Richard Drummond 2005 - * - * Based on code: - * Copyright 1995, 1996 Bernd Schmidt - * Copyright 1996 Ed Hanway - */ + /* + * E-UAE - The portable Amiga Emulator + * + * Support for traps + * + * Copyright Richard Drummond 2005 + * + * Based on code: + * Copyright 1995, 1996 Bernd Schmidt + * Copyright 1996 Ed Hanway + */ -#ifndef TRAPS_H -#define TRAPS_H +#ifndef UAE_TRAPS_H +#define UAE_TRAPS_H -#include "sysconfig.h" +#include "uae/types.h" #define TRAPCMD_MULTI 0 #define TRAPCMD_PUT_LONG 1 @@ -58,31 +58,30 @@ typedef struct TrapContext TrapContext; #define TRAPFLAG_UAERES 16 /* -* A function which handles a 68k trap -*/ -typedef uae_u32(REGPARAM3 *TrapHandler) (TrapContext *) REGPARAM; + * A function which handles a 68k trap + */ +typedef uae_u32 (REGPARAM3 *TrapHandler) (TrapContext *) REGPARAM; /* -* Interface with 68k interpreter -*/ -extern void REGPARAM3 m68k_handle_trap(unsigned int trap_num) REGPARAM; + * Interface with 68k interpreter + */ +extern void REGPARAM3 m68k_handle_trap (unsigned int trap_num) REGPARAM; -unsigned int define_trap(TrapHandler handler_func, int flags, const TCHAR *name); -uaecptr find_trap(const TCHAR *name); +unsigned int define_trap (TrapHandler handler_func, int flags, const TCHAR *name); +uaecptr find_trap (const TCHAR *name); /* -* Call a 68k Library function from an extended trap -*/ -extern uae_u32 CallLib(TrapContext *context, uaecptr library_base, uae_s16 func_offset); -extern uae_u32 CallFunc(TrapContext *context, uaecptr func); + * Call a 68k Library function from an extended trap + */ +extern uae_u32 CallLib (TrapContext *context, uaecptr library_base, uae_s16 func_offset); +extern uae_u32 CallFunc (TrapContext *context, uaecptr func); /* -* Initialization -*/ -void init_traps(void); -void free_traps(void); -void init_extended_traps(void); + * Initialization + */ +void init_traps (void); +void init_extended_traps (void); #define deftrap(f) define_trap((f), 0, _T(#f)) #define deftrap2(f, mode, str) define_trap((f), (mode), (str)) @@ -90,23 +89,11 @@ void init_extended_traps(void); /* New trap system */ -void call_hardware_trap(uae_u8*, uaecptr, int); -void trap_set_background(TrapContext *ctx); -void trap_background_set_complete(TrapContext *ctx); bool trap_valid_address(TrapContext *ctx, uaecptr addr, uae_u32 size); -bool trap_is_indirect(void); -void trap_dos_active(void); -void trap_reset(void); -typedef uae_u32(*TRAP_CALLBACK)(TrapContext*, void*); -void trap_callback(TRAP_CALLBACK, void*); void trap_memcpyha_safe(TrapContext *ctx, uaecptr dst, const uae_u8 *src, int size); void trap_memcpyah_safe(TrapContext *ctx, uae_u8 *dst, uaecptr src, int size); -TrapContext *alloc_host_main_trap_context(void); -TrapContext *alloc_host_thread_trap_context(void); -void free_host_trap_context(TrapContext*); - uae_u32 trap_get_dreg(TrapContext *ctx, int reg); uae_u32 trap_get_areg(TrapContext *ctx, int reg); void trap_set_dreg(TrapContext *ctx, int reg, uae_u32 v); @@ -144,4 +131,4 @@ void trap_call_add_areg(TrapContext *ctx, int reg, uae_u32 v); uae_u32 trap_call_lib(TrapContext *ctx, uaecptr base, uae_s16 offset); uae_u32 trap_call_func(TrapContext *ctx, uaecptr func); -#endif +#endif /* UAE_TRAPS_H */ diff --git a/src/include/xwin.h b/src/include/xwin.h index 969cd7d4..45ffcec4 100644 --- a/src/include/xwin.h +++ b/src/include/xwin.h @@ -63,9 +63,7 @@ extern int bits_in_mask (unsigned long mask); extern int mask_shift (unsigned long mask); extern unsigned int doMask (int p, int bits, int shift); extern unsigned int doMask256 (int p, int bits, int shift); -extern void alloc_colors64k(int, int, int, int, int, int, int, int, int, int); -extern void alloc_colors_rgb(int rw, int gw, int bw, int rs, int gs, int bs, int aw, int as, int alpha, int byte_swap, - uae_u32 *rc, uae_u32 *gc, uae_u32 *bc); +extern void alloc_colors64k (int, int, int, int, int, int, int); extern void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs, int rgbfmt); struct vidbuffer diff --git a/src/inputdevice.cpp b/src/inputdevice.cpp index 4d9f0117..984b45ab 100644 --- a/src/inputdevice.cpp +++ b/src/inputdevice.cpp @@ -1,9 +1,9 @@ -/* + /* * UAE - The Un*x Amiga Emulator * * joystick/mouse emulation * -* Copyright 2001-2012 Toni Wilen +* Copyright 2001-2016 Toni Wilen * * new fetures: * - very configurable (and very complex to configure :) @@ -30,10 +30,14 @@ #include "newcpu.h" #include "uae.h" #include "picasso96.h" +#include "ar.h" #include "gui.h" #include "savestate.h" -#include "disk.h" -#include "sounddep/sound.h" +#include "zfile.h" +#include "cia.h" +#include "autoconf.h" +#include "statusline.h" +#include "native2amiga_api.h" // 01 = host events // 02 = joystick @@ -49,30 +53,28 @@ #define ID_FLAG_CUSTOMEVENT_TOGGLED2 0x8000 #define IE_INVERT 0x80 -#define IE_CDTV 0x100 #define INPUTEVENT_JOY1_CD32_FIRST INPUTEVENT_JOY1_CD32_PLAY #define INPUTEVENT_JOY2_CD32_FIRST INPUTEVENT_JOY2_CD32_PLAY #define INPUTEVENT_JOY1_CD32_LAST INPUTEVENT_JOY1_CD32_BLUE #define INPUTEVENT_JOY2_CD32_LAST INPUTEVENT_JOY2_CD32_BLUE -#define JOYMOUSE_CDTV 8 - -#define DEFEVENT(A, B, C, D, E, F) {_T(#A), B, C, D, E, F }, -static struct inputevent events[] = { - {0, 0, AM_K,0,0,0}, +#define DEFEVENT(A, B, C, D, E, F) {_T(#A), B, NULL, C, D, E, F, 0 }, +#define DEFEVENT2(A, B, B2, C, D, E, F, G) {_T(#A), B, B2, C, D, E, F, G }, +static const struct inputevent events[] = { + {0, 0, 0, AM_K, 0, 0, 0, 0}, #include "inputevents.def" - {0, 0, 0, 0, 0, 0} + {0, 0, 0, 0, 0, 0, 0, 0} }; #undef DEFEVENT +#undef DEFEVENT2 static int sublevdir[2][MAX_INPUT_SUB_EVENT]; -static const int slotorder1[] = {0, 1, 2, 3, 4, 5, 6, 7}; -static const int slotorder2[] = {8, 1, 2, 3, 4, 5, 6, 7}; +static const int slotorder1[] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static const int slotorder2[] = { 8, 1, 2, 3, 4, 5, 6, 7 }; -struct uae_input_device2 -{ +struct uae_input_device2 { uae_u32 buttonmask; int states[MAX_INPUT_DEVICE_EVENTS / 2][MAX_INPUT_SUB_EVENT + 1]; }; @@ -81,31 +83,41 @@ static struct uae_input_device2 joysticks2[MAX_INPUT_DEVICES]; static struct uae_input_device2 mice2[MAX_INPUT_DEVICES]; static uae_u8 scancodeused[MAX_INPUT_DEVICES][256]; static uae_u64 qualifiers, qualifiers_r; -static uae_s16* qualifiers_evt[MAX_INPUT_QUALIFIERS]; - -// fire/left mouse button pullup resistors enabled? -static bool mouse_pullup = true; +static uae_s16 *qualifiers_evt[MAX_INPUT_QUALIFIERS]; static int joymodes[MAX_JPORTS]; -static int* joyinputs[MAX_JPORTS]; +static const int *joyinputs[MAX_JPORTS]; static int input_acquired; -#ifdef INPUTDEVICE_SIMPLE -static int handle_input_event(int nr, int state, int max, int autofire); -#else -static int handle_input_event (int nr, int state, int max, int autofire, bool canstoprecord, bool playbackevent); -#endif +static int handle_input_event (int nr, int state, int max, int autofire); static struct inputdevice_functions idev[IDTYPE_MAX]; -static int isdevice(struct uae_input_device* id) +struct temp_uids { + TCHAR *name; + TCHAR *configname; + uae_s8 disabled; + uae_s8 empty; + uae_s8 custom; + int joystick; + int devtype; + int idnum; + bool initialized; + int kbreventcnt[MAX_INPUT_DEVICES]; + int lastdevtype; + int matcheddevices[MAX_INPUT_DEVICES]; + int nonmatcheddevices[MAX_INPUT_DEVICES]; +}; +static struct temp_uids temp_uid; +static int temp_uid_index[MAX_INPUT_DEVICES][IDTYPE_MAX]; +static int temp_uid_cnt[IDTYPE_MAX]; + +static int isdevice (struct uae_input_device *id) { int i, j; - for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) - { - for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) - { + for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { + for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) { if (id->eventid[i][j] > 0) return 1; } @@ -113,31 +125,105 @@ static int isdevice(struct uae_input_device* id) return 0; } -int inputdevice_uaelib(const TCHAR* s, const TCHAR* parm) +static void check_enable(int ei); + +int inputdevice_uaelib (const TCHAR *s, const TCHAR *parm) { int i; - for (i = 1; events[i].name; i++) - { - if (!_tcscmp (s, events[i].confname)) - { -#ifdef INPUTDEVICE_SIMPLE - handle_input_event(i, parm ? _tstol (parm) : 0, 1, 0); -#else - handle_input_event (i, parm ? _tstol (parm) : 0, 1, 0, false, false); -#endif + if (!_tcsncmp(s, _T("KEY_RAW_"), 8)) { + // KEY_RAW_UP + // KEY_RAW_DOWN + int v; + const TCHAR *value = parm; + TCHAR *endptr; + int base = 10; + int state = _tcscmp(s, _T("KEY_RAW_UP")) ? 1 : 0; + if (value[0] == '0' && _totupper(value[1]) == 'X') + value += 2, base = 16; + v = _tcstol(value, &endptr, base); + for (i = 1; events[i].name; i++) { + const struct inputevent *ie = &events[i]; + if (_tcsncmp(ie->confname, _T("KEY_"), 4)) + continue; + if (ie->data == v) { + handle_input_event(i, state, 1, 0); + return 1; + } + } + return 0; + } + + for (i = 1; events[i].name; i++) { + if (!_tcscmp (s, events[i].confname)) { + check_enable(i); + handle_input_event (i, parm ? _tstol (parm) : 0, 1, 0); return 1; } } return 0; } -static struct uae_input_device* joysticks; -static struct uae_input_device* mice; -static struct uae_input_device* keyboards; -#ifndef INPUTDEVICE_SIMPLE -static struct uae_input_device *internalevents; -#endif +int inputdevice_uaelib(const TCHAR *s, int parm, int max, bool autofire) +{ + for (int i = 1; events[i].name; i++) { + if (!_tcscmp(s, events[i].confname)) { + check_enable(i); + handle_input_event(i, parm, max, autofire); + return 1; + } + } + return 0; +} + +static int getdevnum(int type, int devnum) +{ + int jcnt = idev[IDTYPE_JOYSTICK].get_num(); + int mcnt = idev[IDTYPE_MOUSE].get_num(); + int kcnt = idev[IDTYPE_KEYBOARD].get_num(); + + if (type == IDTYPE_JOYSTICK) + return devnum; + else if (type == IDTYPE_MOUSE) + return jcnt + devnum; + else if (type == IDTYPE_KEYBOARD) + return jcnt + mcnt + devnum; + return -1; +} + +static int gettype (int devnum) +{ + int jcnt = idev[IDTYPE_JOYSTICK].get_num (); + int mcnt = idev[IDTYPE_MOUSE].get_num (); + int kcnt = idev[IDTYPE_KEYBOARD].get_num (); + + if (devnum < jcnt) + return IDTYPE_JOYSTICK; + else if (devnum < jcnt + mcnt) + return IDTYPE_MOUSE; + else if (devnum < jcnt + mcnt + kcnt) + return IDTYPE_KEYBOARD; + return -1; +} + +static struct inputdevice_functions *getidf (int devnum) +{ + int type = gettype (devnum); + if (type < 0) + return NULL; + return &idev[type]; +} + +const struct inputevent *inputdevice_get_eventinfo(int evt) +{ + if (evt > 0 && !events[evt].name) + return NULL; + return &events[evt]; +} + +static struct uae_input_device *joysticks; +static struct uae_input_device *mice; +static struct uae_input_device *keyboards; static struct uae_input_device_kbr_default *keyboard_default, **keyboard_default_table; static int default_keyboard_layout[MAX_JPORTS]; @@ -155,12 +241,7 @@ static int default_keyboard_layout[MAX_JPORTS]; #define KBR_DEFAULT_MAP_CD32_NP 6 #define KBR_DEFAULT_MAP_CD32_CK 7 #define KBR_DEFAULT_MAP_CD32_SE 8 -#define KBR_DEFAULT_MAP_XA1 9 -#define KBR_DEFAULT_MAP_XA2 10 -#define KBR_DEFAULT_MAP_ARCADIA 11 -#define KBR_DEFAULT_MAP_ARCADIA_XA 12 -#define KBR_DEFAULT_MAP_CDTV 13 -static int** keyboard_default_kbmaps; +static int **keyboard_default_kbmaps; static int mouse_axis[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS]; static int oldm_axis[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS]; @@ -170,26 +251,33 @@ static int oldm_axis[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS]; static uae_s16 mouse_x[MAX_JPORTS], mouse_y[MAX_JPORTS]; static uae_s16 mouse_delta[MAX_JPORTS][MOUSE_AXIS_TOTAL]; static uae_s16 mouse_deltanoreset[MAX_JPORTS][MOUSE_AXIS_TOTAL]; -static uae_s16 lightpen_delta[2]; -static uae_s16 lightpen_deltanoreset[2]; static int joybutton[MAX_JPORTS]; static int joydir[MAX_JPORTS]; +#ifndef INPUTDEVICE_SIMPLE static int joydirpot[MAX_JPORTS][2]; +#endif static uae_s16 mouse_frame_x[MAX_JPORTS], mouse_frame_y[MAX_JPORTS]; static int mouse_port[NORMAL_JPORTS]; static int cd32_shifter[NORMAL_JPORTS]; static int cd32_pad_enabled[NORMAL_JPORTS]; + +#if !defined(INPUTDEVICE_SIMPLE) || defined(AMIBERRY) static int parport_joystick_enabled; +#endif + static int oleft[MAX_JPORTS], oright[MAX_JPORTS], otop[MAX_JPORTS], obot[MAX_JPORTS]; -static int horizclear[MAX_JPORTS], vertclear[MAX_JPORTS]; static int relativecount[MAX_JPORTS][2]; uae_u16 potgo_value; +#ifndef INPUTDEVICE_SIMPLE static int pot_cap[NORMAL_JPORTS][2]; +#endif static uae_u8 pot_dat[NORMAL_JPORTS][2]; static int pot_dat_act[NORMAL_JPORTS][2]; +#ifndef INPUTDEVICE_SIMPLE static int analog_port[NORMAL_JPORTS][2]; +#endif static int digital_port[NORMAL_JPORTS][2]; #define POTDAT_DELAY_PAL 8 #define POTDAT_DELAY_NTSC 7 @@ -198,31 +286,31 @@ static int use_joysticks[MAX_INPUT_DEVICES]; static int use_mice[MAX_INPUT_DEVICES]; static int use_keyboards[MAX_INPUT_DEVICES]; +#ifdef INPUTDEVICE_SIMPLE +#define INPUT_QUEUE_SIZE 6 +#else #define INPUT_QUEUE_SIZE 16 +#endif struct input_queue_struct { int evt, storedstate, state, max, linecnt, nextlinecnt; - TCHAR *custom; }; static struct input_queue_struct input_queue[INPUT_QUEUE_SIZE]; -uae_u8* restore_input(uae_u8* src) +uae_u8 *restore_input (uae_u8 *src) { restore_u32 (); - for (int i = 0; i < 2; i++) - { - for (int j = 0; j < 2; j++) - { + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 2; j++) { #ifndef INPUTDEVICE_SIMPLE pot_cap[i][j] = restore_u16 (); #else - restore_u16(); + restore_u16(); #endif } } return src; } - -uae_u8* save_input(int* len, uae_u8* dstptr) +uae_u8 *save_input (int *len, uae_u8 *dstptr) { uae_u8 *dstbak, *dst; @@ -231,14 +319,12 @@ uae_u8* save_input(int* len, uae_u8* dstptr) else dstbak = dst = xmalloc (uae_u8, 1000); save_u32 (0); - for (int i = 0; i < 2; i++) - { - for (int j = 0; j < 2; j++) - { + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 2; j++) { #ifndef INPUTDEVICE_SIMPLE save_u16 (pot_cap[i][j]); #else - save_u16(0); + save_u16(0); #endif } } @@ -246,41 +332,225 @@ uae_u8* save_input(int* len, uae_u8* dstptr) return dstbak; } -static void freejport(struct uae_prefs* dst, int num) +static void freejport (struct uae_prefs *dst, int num) { bool override = dst->jports[num].nokeyboardoverride; - memset(&dst->jports[num], 0, sizeof (struct jport)); + memset (&dst->jports[num], 0, sizeof (struct jport)); dst->jports[num].id = -1; dst->jports[num].nokeyboardoverride = override; } - -static void copyjport(const struct uae_prefs *src, struct uae_prefs *dst, int num) +static void copyjport (const struct uae_prefs *src, struct uae_prefs *dst, int num) { if (!src) return; - freejport(dst, num); + freejport (dst, num); memcpy(&dst->jports[num].idc, &src->jports[num].idc, sizeof(struct inputdevconfig)); dst->jports[num].id = src->jports[num].id; dst->jports[num].mode = src->jports[num].mode; dst->jports[num].autofire = src->jports[num].autofire; + dst->jports[num].mousemap = src->jports[num].mousemap; + dst->jports[num].amiberry_custom_none = src->jports[num].amiberry_custom_none; + dst->jports[num].amiberry_custom_hotkey = src->jports[num].amiberry_custom_hotkey; + dst->jports[num].amiberry_custom_left_trigger = src->jports[num].amiberry_custom_left_trigger; + dst->jports[num].amiberry_custom_right_trigger = src->jports[num].amiberry_custom_right_trigger; dst->jports[num].nokeyboardoverride = src->jports[num].nokeyboardoverride; } -static void out_config(struct zfile* f, int id, int num, const TCHAR* s1, const TCHAR* s2) +#define MAX_STORED_JPORTS 8 +struct stored_jport { - TCHAR tmp[MAX_DPATH]; - _stprintf(tmp, _T("input.%d.%s%d"), id, s1, num); - cfgfile_write_str(f, tmp, s2); + struct jport jp; + bool inuse; + bool defaultports; + uae_u32 age; +}; +static struct stored_jport stored_jports[MAX_JPORTS][8]; +static uae_u32 stored_jport_cnt; + +// return port where idc was previously plugged if any and forgot it. +static int inputdevice_get_unplugged_device(struct inputdevconfig *idc) +{ + for (int portnum = 0; portnum < MAX_JPORTS; portnum++) { + for (int i = 0; i < MAX_STORED_JPORTS; i++) { + struct stored_jport *jp = &stored_jports[portnum][i]; + if (jp->inuse && jp->jp.id == JPORT_UNPLUGGED) { + if (!_tcscmp(idc->name, jp->jp.idc.name) && !_tcscmp(idc->configname, jp->jp.idc.configname)) { + jp->inuse = false; + return portnum; + } + } + } + } + return -1; } -static bool write_config_head(struct zfile* f, int idnum, int devnum, const TCHAR* name, struct uae_input_device* id, struct inputdevice_functions* idf) +// forget port's unplugged device +void inputdevice_forget_unplugged_device(int portnum) { - const char* s = NULL; + for (int i = 0; i < MAX_STORED_JPORTS; i++) { + struct stored_jport *jp = &stored_jports[portnum][i]; + if (jp->inuse && jp->jp.id == JPORT_UNPLUGGED) { + jp->inuse = false; + } + } +} + +static struct jport *inputdevice_get_used_device(int portnum, int ageindex) +{ + int idx = -1; + int used[MAX_STORED_JPORTS] = { 0 }; + if (ageindex < 0) + return NULL; + while (ageindex >= 0) { + uae_u32 age = 0; + idx = -1; + for (int i = 0; i < MAX_STORED_JPORTS; i++) { + struct stored_jport *jp = &stored_jports[portnum][i]; + if (jp->inuse && !used[i] && jp->age > age) { + age = jp->age; + idx = i; + } + } + if (idx < 0) + return NULL; + used[idx] = 1; + ageindex--; + } + return &stored_jports[portnum][idx].jp; +} + +static void inputdevice_store_clear(void) +{ + for (int j = 0; j < MAX_JPORTS; j++) { + for (int i = 0; i < MAX_STORED_JPORTS; i++) { + struct stored_jport *jp = &stored_jports[j][i]; + if (!jp->defaultports) + memset(jp, 0, sizeof(struct stored_jport)); + } + } +} + +static void inputdevice_set_newest_used_device(int portnum, struct jport *jps) +{ + for (int i = 0; i < MAX_STORED_JPORTS; i++) { + struct stored_jport *jp = &stored_jports[portnum][i]; + if (jp->inuse && &jp->jp == jps && !jp->defaultports) { + stored_jport_cnt++; + jp->age = stored_jport_cnt; + } + } +} + +static void inputdevice_store_used_device(struct jport *jps, int portnum, bool defaultports) +{ + if (jps->id == JPORT_NONE) + return; + + // already added? if custom or kbr layout: delete all old + for (int i = 0; i < MAX_STORED_JPORTS; i++) { + struct stored_jport *jp = &stored_jports[portnum][i]; + if (jp->inuse && ((jps->id == jp->jp.id) || (jps->idc.configname[0] != 0 && jp->jp.idc.configname[0] != 0 && !_tcscmp(jps->idc.configname, jp->jp.idc.configname)))) { + if (!jp->defaultports) { + jp->inuse = false; + } + } + } + + // delete from other ports + for (int j = 0; j < MAX_JPORTS; j++) { + for (int i = 0; i < MAX_STORED_JPORTS; i++) { + struct stored_jport *jp = &stored_jports[j][i]; + if (jp->inuse && ((jps->id == jp->jp.id) || (jps->idc.configname[0] != 0 && jp->jp.idc.configname[0] != 0 && !_tcscmp(jps->idc.configname, jp->jp.idc.configname)))) { + if (!jp->defaultports) { + jp->inuse = false; + } + } + } + } + // delete oldest if full + for (int i = 0; i < MAX_STORED_JPORTS; i++) { + struct stored_jport *jp = &stored_jports[portnum][i]; + if (!jp->inuse) + break; + if (i == MAX_STORED_JPORTS - 1) { + uae_u32 age = 0xffffffff; + int idx = -1; + for (int j = 0; j < MAX_STORED_JPORTS; j++) { + struct stored_jport *jp = &stored_jports[portnum][j]; + if (jp->age < age && !jp->defaultports) { + age = jp->age; + idx = j; + } + } + if (idx >= 0) { + struct stored_jport *jp = &stored_jports[portnum][idx]; + jp->inuse = false; + } + } + } + // add new + for (int i = 0; i < MAX_STORED_JPORTS; i++) { + struct stored_jport *jp = &stored_jports[portnum][i]; + if (!jp->inuse) { + memcpy(&jp->jp, jps, sizeof(struct jport)); + write_log(_T("Stored port %d/%d d=%d: added %d %d %s %s\n"), portnum, i, defaultports, jp->jp.id, jp->jp.mode, jp->jp.idc.name, jp->jp.idc.configname); + jp->inuse = true; + jp->defaultports = defaultports; + stored_jport_cnt++; + jp->age = stored_jport_cnt; + return; + } + } +} + +static void inputdevice_store_unplugged_port(struct uae_prefs *p, struct inputdevconfig *idc) +{ + struct jport jpt = { 0 }; + _tcscpy(jpt.idc.configname, idc->configname); + _tcscpy(jpt.idc.name, idc->name); + jpt.id = JPORT_UNPLUGGED; + for (int i = 0; i < MAX_JPORTS; i++) { + struct jport *jp = &p->jports[i]; + if (!_tcscmp(jp->idc.name, idc->name) && !_tcscmp(jp->idc.configname, idc->configname)) { + write_log(_T("On the fly unplugged stored, port %d '%s' (%s)\n"), i, jpt.idc.name, jpt.idc.configname); + inputdevice_store_used_device(&jpt, i, false); + } + } +} + +static bool isemptykey(int keyboard, int scancode) +{ + int j = 0; + struct uae_input_device *na = &keyboards[keyboard]; + while (j < MAX_INPUT_DEVICE_EVENTS && na->extra[j] >= 0) { + if (na->extra[j] == scancode) { + for (int k = 0; k < MAX_INPUT_SUB_EVENT; k++) { + if (na->eventid[j][k] > 0) + return false; + if (na->custom[j][k] != NULL) + return false; + } + break; + } + j++; + } + return true; +} + +static void out_config (struct zfile *f, int id, int num, const TCHAR *s1, const TCHAR *s2) +{ + TCHAR tmp[MAX_DPATH]; + _stprintf (tmp, _T("input.%d.%s%d"), id, s1, num); + cfgfile_write_str (f, tmp, s2); +} + +static bool write_config_head (struct zfile *f, int idnum, int devnum, const TCHAR *name, struct uae_input_device *id, struct inputdevice_functions *idf) +{ + const TCHAR* s = NULL; TCHAR tmp2[CONFIG_BLEN]; - if (idnum == GAMEPORT_INPUT_SETTINGS) - { - if (!isdevice(id)) + if (idnum == GAMEPORT_INPUT_SETTINGS) { + if (!isdevice (id)) return false; if (!id->enabled) return false; @@ -288,87 +558,71 @@ static bool write_config_head(struct zfile* f, int idnum, int devnum, const TCHA if (id->name) s = id->name; - else if (devnum < idf->get_num()) - s = idf->get_friendlyname(devnum); - if (s) - { - _stprintf(tmp2, _T("input.%d.%s.%d.friendlyname"), idnum + 1, name, devnum); - cfgfile_write_str(f, tmp2, s); + else if (devnum < idf->get_num ()) + s = idf->get_friendlyname (devnum); + if (s) { + _stprintf (tmp2, _T("input.%d.%s.%d.friendlyname"), idnum + 1, name, devnum); + cfgfile_write_str (f, tmp2, s); } s = NULL; if (id->configname) s = id->configname; - else if (devnum < idf->get_num()) - s = idf->get_uniquename(devnum); - if (s) - { - _stprintf(tmp2, _T("input.%d.%s.%d.name"), idnum + 1, name, devnum); - cfgfile_write_str(f, tmp2, s); + else if (devnum < idf->get_num ()) + s = idf->get_uniquename (devnum); + if (s) { + _stprintf (tmp2, _T("input.%d.%s.%d.name"), idnum + 1, name, devnum); + cfgfile_write_str (f, tmp2, s); } - if (!isdevice(id)) - { - _stprintf(tmp2, _T("input.%d.%s.%d.empty"), idnum + 1, name, devnum); - cfgfile_write_bool(f, tmp2, true); - if (id->enabled) - { - _stprintf(tmp2, _T("input.%d.%s.%d.disabled"), idnum + 1, name, devnum); - cfgfile_write_bool(f, tmp2, id->enabled ? false : true); + if (!isdevice (id)) { + _stprintf (tmp2, _T("input.%d.%s.%d.empty"), idnum + 1, name, devnum); + cfgfile_write_bool (f, tmp2, true); + if (id->enabled) { + _stprintf (tmp2, _T("input.%d.%s.%d.disabled"), idnum + 1, name, devnum); + cfgfile_write_bool (f, tmp2, id->enabled ? false : true); } return false; } - if (idnum == GAMEPORT_INPUT_SETTINGS) - { - _stprintf(tmp2, _T("input.%d.%s.%d.custom"), idnum + 1, name, devnum); - cfgfile_write_bool(f, tmp2, true); - } - else - { - _stprintf(tmp2, _T("input.%d.%s.%d.empty"), idnum + 1, name, devnum); - cfgfile_write_bool(f, tmp2, false); - _stprintf(tmp2, _T("input.%d.%s.%d.disabled"), idnum + 1, name, devnum); - cfgfile_write_bool(f, tmp2, id->enabled ? false : true); + if (idnum == GAMEPORT_INPUT_SETTINGS) { + _stprintf (tmp2, _T("input.%d.%s.%d.custom"), idnum + 1, name, devnum); + cfgfile_write_bool (f, tmp2, true); + } else { + _stprintf (tmp2, _T("input.%d.%s.%d.empty"), idnum + 1, name, devnum); + cfgfile_write_bool (f, tmp2, false); + _stprintf (tmp2, _T("input.%d.%s.%d.disabled"), idnum + 1, name, devnum); + cfgfile_write_bool (f, tmp2, id->enabled ? false : true); } return true; } -static bool write_slot(TCHAR* p, struct uae_input_device* uid, int i, int j) +static bool write_slot (TCHAR *p, struct uae_input_device *uid, int i, int j) { bool ok = false; - if (i < 0 || j < 0) - { + if (i < 0 || j < 0) { _tcscpy (p, _T("NULL")); return false; } uae_u64 flags = uid->flags[i][j]; - if (uid->custom[i][j] && _tcslen (uid->custom[i][j]) > 0) - { - _stprintf(p, _T("'%s'.%llu"), uid->custom[i][j], flags & ID_FLAG_SAVE_MASK_CONFIG); + if (uid->custom[i][j] && _tcslen (uid->custom[i][j]) > 0) { + _stprintf (p, _T("'%s'.%d"), uid->custom[i][j], (int)(flags & ID_FLAG_SAVE_MASK_CONFIG)); ok = true; - } - else if (uid->eventid[i][j] > 0) - { - _stprintf(p, _T("%s.%llu"), events[uid->eventid[i][j]].confname, flags & ID_FLAG_SAVE_MASK_CONFIG); + } else if (uid->eventid[i][j] > 0) { + _stprintf (p, _T("%s.%d"), events[uid->eventid[i][j]].confname, (int)(flags & ID_FLAG_SAVE_MASK_CONFIG)); ok = true; - } - else - { + } else { _tcscpy (p, _T("NULL")); } - if (ok && (flags & ID_FLAG_SAVE_MASK_QUALIFIERS)) - { - TCHAR* p2 = p + _tcslen (p); + if (ok && (flags & ID_FLAG_SAVE_MASK_QUALIFIERS)) { + TCHAR *p2 = p + _tcslen (p); *p2++ = '.'; - for (int i = 0; i < MAX_INPUT_QUALIFIERS * 2; i++) - { - if ((ID_FLAG_QUALIFIER1 << i) & flags) - { + for (int i = 0; i < MAX_INPUT_QUALIFIERS * 2; i++) { + if ((ID_FLAG_QUALIFIER1 << i) & flags) { if (i & 1) - _stprintf(p2, _T("%c"), 'a' + i / 2); + _stprintf (p2, _T("%c"), 'a' + i / 2); else - _stprintf(p2, _T("%c"), 'A' + i / 2); + _stprintf (p2, _T("%c"), 'A' + i / 2); p2++; } } @@ -376,12 +630,11 @@ static bool write_slot(TCHAR* p, struct uae_input_device* uid, int i, int j) return ok; } -static struct inputdevice_functions* getidf(int devnum); +static struct inputdevice_functions *getidf (int devnum); -static void kbrlabel(TCHAR* s) +static void kbrlabel (TCHAR *s) { - while (*s) - { + while (*s) { *s = _totupper (*s); if (*s == ' ') *s = '_'; @@ -389,12 +642,12 @@ static void kbrlabel(TCHAR* s) } } -static void write_config2(struct zfile* f, int idnum, int i, int offset, const TCHAR* extra, struct uae_input_device* id) +static void write_config2 (struct zfile *f, int idnum, int i, int offset, const TCHAR *extra, struct uae_input_device *id) { TCHAR tmp2[CONFIG_BLEN], tmp3[CONFIG_BLEN], *p; int evt, got, j, k; - TCHAR* custom; - const int* slotorder; + TCHAR *custom; + const int *slotorder; int io = i + offset; tmp2[0] = 0; @@ -406,14 +659,12 @@ static void write_config2(struct zfile* f, int idnum, int i, int offset, const T if (id->port[io][0] && !(id->flags[io][0] & ID_FLAG_GAMEPORTSCUSTOM_MASK)) slotorder = slotorder2; - for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) - { + for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) { + evt = id->eventid[io][slotorder[j]]; custom = id->custom[io][slotorder[j]]; - if (custom == NULL && evt <= 0) - { - for (k = j + 1; k < MAX_INPUT_SUB_EVENT; k++) - { + if (custom == NULL && evt <= 0) { + for (k = j + 1; k < MAX_INPUT_SUB_EVENT; k++) { if ((id->port[io][k] == 0 || id->port[io][k] == MAX_JPORTS + 1) && (id->eventid[io][slotorder[k]] > 0 || id->custom[io][slotorder[k]] != NULL)) break; } @@ -421,72 +672,61 @@ static void write_config2(struct zfile* f, int idnum, int i, int offset, const T break; } - if (p > tmp2) - { + if (p > tmp2) { *p++ = ','; *p = 0; } - bool ok = write_slot(p, id, io, slotorder[j]); + bool ok = write_slot (p, id, io, slotorder[j]); p += _tcslen (p); - if (ok) - { - if (id->port[io][slotorder[j]] > 0 && id->port[io][slotorder[j]] < MAX_JPORTS + 1) - { + if (ok) { + if (id->port[io][slotorder[j]] > 0 && id->port[io][slotorder[j]] < MAX_JPORTS + 1) { int pnum = id->port[io][slotorder[j]] - 1; - _stprintf(p, _T(".%d"), pnum); + _stprintf (p, _T(".%d"), pnum); p += _tcslen (p); - if (idnum != GAMEPORT_INPUT_SETTINGS && j == 0 && id->port[io][SPARE_SUB_EVENT] && slotorder == slotorder1) - { + if (idnum != GAMEPORT_INPUT_SETTINGS && j == 0 && id->port[io][SPARE_SUB_EVENT] && slotorder == slotorder1) { *p++ = '.'; - write_slot(p, id, io, SPARE_SUB_EVENT); + write_slot (p, id, io, SPARE_SUB_EVENT); p += _tcslen (p); } } } } - if (p > tmp2) - { - _stprintf(tmp3, _T("input.%d.%s%d"), idnum + 1, extra, i); - cfgfile_write_str(f, tmp3, tmp2); + if (p > tmp2) { + _stprintf (tmp3, _T("input.%d.%s%d"), idnum + 1, extra, i); + cfgfile_write_str (f, tmp3, tmp2); } } -static void write_kbr_config(struct zfile* f, int idnum, int devnum, struct uae_input_device* kbr, struct inputdevice_functions* idf) +static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae_input_device *kbr, struct inputdevice_functions *idf) { TCHAR tmp1[CONFIG_BLEN], tmp2[CONFIG_BLEN], tmp3[CONFIG_BLEN], tmp4[CONFIG_BLEN], tmp5[CONFIG_BLEN], *p; int i, j, k, evt, skip; - const int* slotorder; + const int *slotorder; if (!keyboard_default) return; - if (!write_config_head(f, idnum, devnum, _T("keyboard"), kbr, idf)) + if (!write_config_head (f, idnum, devnum, _T("keyboard"), kbr, idf)) return; i = 0; - while (i < MAX_INPUT_DEVICE_EVENTS && kbr->extra[i] >= 0) - { + while (i < MAX_INPUT_DEVICE_EVENTS && kbr->extra[i] >= 0) { + slotorder = slotorder1; - // if gameports non-custom mapping in slot0 -> save slot4 as slot0 + // if gameports non-custom mapping in slot0 -> save slot8 as slot0 if (kbr->port[i][0] && !(kbr->flags[i][0] & ID_FLAG_GAMEPORTSCUSTOM_MASK)) slotorder = slotorder2; skip = 0; k = 0; - while (keyboard_default[k].scancode >= 0) - { - if (keyboard_default[k].scancode == kbr->extra[i]) - { + while (keyboard_default[k].scancode >= 0) { + if (keyboard_default[k].scancode == kbr->extra[i]) { skip = 1; - for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) - { - if (keyboard_default[k].node[j].evt != 0) - { + for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) { + if (keyboard_default[k].node[j].evt != 0) { if (keyboard_default[k].node[j].evt != kbr->eventid[i][slotorder[j]] || keyboard_default[k].node[j].flags != (kbr->flags[i][slotorder[j]] & ID_FLAG_SAVE_MASK_FULL)) skip = 0; - } - else if ((kbr->flags[i][slotorder[j]] & ID_FLAG_SAVE_MASK_FULL) != 0 || kbr->eventid[i][slotorder[j]] > 0) - { + } else if ((kbr->flags[i][slotorder[j]] & ID_FLAG_SAVE_MASK_FULL) != 0 || kbr->eventid[i][slotorder[j]] > 0) { skip = 0; } } @@ -498,143 +738,147 @@ static void write_kbr_config(struct zfile* f, int idnum, int devnum, struct uae_ kbr->port[i][SPARE_SUB_EVENT] && keyboard_default[k].node[0].evt == kbr->eventid[i][SPARE_SUB_EVENT] && keyboard_default[k].node[0].flags == (kbr->flags[i][SPARE_SUB_EVENT] & ID_FLAG_SAVE_MASK_FULL); - if (kbr->port[i][0] > 0 && !(kbr->flags[i][0] & ID_FLAG_GAMEPORTSCUSTOM_MASK) && + if (kbr->port[i][0] > 0 && !(kbr->flags[i][0] & ID_FLAG_GAMEPORTSCUSTOM_MASK) && (kbr->eventid[i][1] <= 0 && kbr->eventid[i][2] <= 0 && kbr->eventid[i][3] <= 0) && (kbr->port[i][SPARE_SUB_EVENT] == 0 || isdefaultspare)) skip = 1; if (kbr->eventid[i][0] == 0 && (kbr->flags[i][0] & ID_FLAG_SAVE_MASK_FULL) == 0 && keyboard_default[k].scancode < 0) skip = 1; - if (skip) - { + if (skip) { i++; continue; } + + if (!input_get_default_keyboard(devnum)) { + bool isempty = true; + for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) { + if (kbr->eventid[i][j] > 0) { + isempty = false; + break; + } + if (kbr->custom[i][j] != NULL) { + isempty = false; + break; + } + } + if (isempty) { + i++; + continue; + } + } + tmp2[0] = 0; p = tmp2; - for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) - { - TCHAR* custom = kbr->custom[i][slotorder[j]]; + for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) { + TCHAR *custom = kbr->custom[i][slotorder[j]]; evt = kbr->eventid[i][slotorder[j]]; - if (custom == NULL && evt <= 0) - { - for (k = j + 1; k < MAX_INPUT_SUB_EVENT; k++) - { + if (custom == NULL && evt <= 0) { + for (k = j + 1; k < MAX_INPUT_SUB_EVENT; k++) { if (kbr->eventid[i][slotorder[k]] > 0 || kbr->custom[i][slotorder[k]] != NULL) break; } if (k == MAX_INPUT_SUB_EVENT) break; } - if (p > tmp2) - { + if (p > tmp2) { *p++ = ','; *p = 0; } - bool ok = write_slot(p, kbr, i, slotorder[j]); + bool ok = write_slot (p, kbr, i, slotorder[j]); p += _tcslen (p); - if (ok) - { + if (ok) { // save port number + SPARE SLOT if needed - if (kbr->port[i][slotorder[j]] > 0 && (kbr->flags[i][slotorder[j]] & ID_FLAG_GAMEPORTSCUSTOM_MASK)) - { - _stprintf(p, _T(".%d"), kbr->port[i][slotorder[j]] - 1); + if (kbr->port[i][slotorder[j]] > 0 && (kbr->flags[i][slotorder[j]] & ID_FLAG_GAMEPORTSCUSTOM_MASK)) { + _stprintf (p, _T(".%d"), kbr->port[i][slotorder[j]] - 1); p += _tcslen (p); - if (idnum != GAMEPORT_INPUT_SETTINGS && j == 0 && kbr->port[i][SPARE_SUB_EVENT] && !isdefaultspare && slotorder == slotorder1) - { + if (idnum != GAMEPORT_INPUT_SETTINGS && j == 0 && kbr->port[i][SPARE_SUB_EVENT] && !isdefaultspare && slotorder == slotorder1) { *p++ = '.'; - write_slot(p, kbr, i, SPARE_SUB_EVENT); + write_slot (p, kbr, i, SPARE_SUB_EVENT); p += _tcslen (p); } } } } - idf->get_widget_type(devnum, i, tmp5, NULL); - _stprintf(tmp3, _T("%d%s%s"), kbr->extra[i], tmp5[0] ? _T(".") : _T(""), tmp5[0] ? tmp5 : _T("")); - kbrlabel(tmp3); - _stprintf(tmp1, _T("keyboard.%d.button.%s"), devnum, tmp3); - _stprintf(tmp4, _T("input.%d.%s"), idnum + 1, tmp1); - cfgfile_write_str(f, tmp4, tmp2[0] ? tmp2 : _T("NULL")); + idf->get_widget_type (devnum, i, tmp5, NULL); + _stprintf (tmp3, _T("%d%s%s"), kbr->extra[i], tmp5[0] ? _T(".") : _T(""), tmp5[0] ? tmp5 : _T("")); + kbrlabel (tmp3); + _stprintf (tmp1, _T("keyboard.%d.button.%s"), devnum, tmp3); + _stprintf (tmp4, _T("input.%d.%s"), idnum + 1, tmp1); + cfgfile_write_str (f, tmp4, tmp2[0] ? tmp2 : _T("NULL")); i++; } } -static void write_config(struct zfile* f, int idnum, int devnum, const TCHAR* name, struct uae_input_device* id, struct inputdevice_functions* idf) +static void write_config (struct zfile *f, int idnum, int devnum, const TCHAR *name, struct uae_input_device *id, struct inputdevice_functions *idf) { TCHAR tmp1[MAX_DPATH]; int i; - if (!write_config_head(f, idnum, devnum, name, id, idf)) + if (!write_config_head (f, idnum, devnum, name, id, idf)) return; - _stprintf(tmp1, _T("%s.%d.axis."), name, devnum); + _stprintf (tmp1, _T("%s.%d.axis."), name, devnum); for (i = 0; i < ID_AXIS_TOTAL; i++) - write_config2(f, idnum, i, ID_AXIS_OFFSET, tmp1, id); - _stprintf(tmp1, _T("%s.%d.button."), name, devnum); + write_config2 (f, idnum, i, ID_AXIS_OFFSET, tmp1, id); + _stprintf (tmp1, _T("%s.%d.button.") ,name, devnum); for (i = 0; i < ID_BUTTON_TOTAL; i++) - write_config2(f, idnum, i, ID_BUTTON_OFFSET, tmp1, id); + write_config2 (f, idnum, i, ID_BUTTON_OFFSET, tmp1, id); } -static const TCHAR* kbtypes[] = {_T("amiga"), _T("pc"), NULL}; +static const TCHAR *kbtypes[] = { _T("amiga"), _T("pc"), NULL }; -void write_inputdevice_config(struct uae_prefs* p, struct zfile* f) +void write_inputdevice_config (struct uae_prefs *p, struct zfile *f) { int i, id; - cfgfile_write(f, _T("input.config"), _T("%d"), p->input_selected_setting == GAMEPORT_INPUT_SETTINGS ? 0 : p->input_selected_setting + 1); - cfgfile_write(f, _T("input.joymouse_speed_analog"), _T("%d"), p->input_joymouse_multiplier); - cfgfile_write(f, _T("input.joymouse_speed_digital"), _T("%d"), p->input_joymouse_speed); - cfgfile_write(f, _T("input.joymouse_deadzone"), _T("%d"), p->input_joymouse_deadzone); - cfgfile_write(f, _T("input.joystick_deadzone"), _T("%d"), p->input_joystick_deadzone); - cfgfile_write(f, _T("input.analog_joystick_multiplier"), _T("%d"), p->input_analog_joystick_mult); - cfgfile_write(f, _T("input.analog_joystick_offset"), _T("%d"), p->input_analog_joystick_offset); - cfgfile_write(f, _T("input.mouse_speed"), _T("%d"), p->input_mouse_speed); - cfgfile_write(f, _T("input.autofire_speed"), _T("%d"), p->input_autofire_linecnt); - cfgfile_dwrite_str(f, _T("input.keyboard_type"), kbtypes[p->input_keyboard_type]); - cfgfile_dwrite(f, _T("input.contact_bounce"), _T("%d"), p->input_contact_bounce); - for (id = 0; id < MAX_INPUT_SETTINGS; id++) - { - TCHAR tmp[MAX_DPATH]; - if (id < GAMEPORT_INPUT_SETTINGS) - { - _stprintf(tmp, _T("input.%d.name"), id + 1); - cfgfile_dwrite_str(f, tmp, p->input_config_name[id]); - } - for (i = 0; i < MAX_INPUT_DEVICES; i++) - write_config(f, id, i, _T("joystick"), &p->joystick_settings[id][i], &idev[IDTYPE_JOYSTICK]); - for (i = 0; i < MAX_INPUT_DEVICES; i++) - write_config(f, id, i, _T("mouse"), &p->mouse_settings[id][i], &idev[IDTYPE_MOUSE]); - for (i = 0; i < MAX_INPUT_DEVICES; i++) - write_kbr_config(f, id, i, &p->keyboard_settings[id][i], &idev[IDTYPE_KEYBOARD]); -#ifndef INPUTDEVICE_SIMPLE - write_config (f, id, 0, _T("internal"), &p->internalevent_settings[id][0], &idev[IDTYPE_INTERNALEVENT]); -#endif - } +// cfgfile_write (f, _T("input.config"), _T("%d"), p->input_selected_setting == GAMEPORT_INPUT_SETTINGS ? 0 : p->input_selected_setting + 1); + cfgfile_write (f, _T("input.joymouse_speed_analog"), _T("%d"), p->input_joymouse_multiplier); + cfgfile_write (f, _T("input.joymouse_speed_digital"), _T("%d"), p->input_joymouse_speed); + cfgfile_write (f, _T("input.joymouse_deadzone"), _T("%d"), p->input_joymouse_deadzone); + cfgfile_write (f, _T("input.joystick_deadzone"), _T("%d"), p->input_joystick_deadzone); + cfgfile_write (f, _T("input.analog_joystick_multiplier"), _T("%d"), p->input_analog_joystick_mult); + cfgfile_write (f, _T("input.analog_joystick_offset"), _T("%d"), p->input_analog_joystick_offset); + cfgfile_write (f, _T("input.mouse_speed"), _T("%d"), p->input_mouse_speed); + cfgfile_write (f, _T("input.autofire_speed"), _T("%d"), p->input_autofire_linecnt); + cfgfile_dwrite_str (f, _T("input.keyboard_type"), kbtypes[p->input_keyboard_type]); + + // not required config saving + // +// for (id = 0; id < MAX_INPUT_SETTINGS; id++) { +// TCHAR tmp[MAX_DPATH]; +// if (id < GAMEPORT_INPUT_SETTINGS) { +// _stprintf (tmp, _T("input.%d.name"), id + 1); +// cfgfile_dwrite_str (f, tmp, p->input_config_name[id]); +// } +// for (i = 0; i < MAX_INPUT_DEVICES; i++) +// write_config (f, id, i, _T("joystick"), &p->joystick_settings[id][i], &idev[IDTYPE_JOYSTICK]); +// for (i = 0; i < MAX_INPUT_DEVICES; i++) +// write_config (f, id, i, _T("mouse"), &p->mouse_settings[id][i], &idev[IDTYPE_MOUSE]); +// for (i = 0; i < MAX_INPUT_DEVICES; i++) +// write_kbr_config (f, id, i, &p->keyboard_settings[id][i], &idev[IDTYPE_KEYBOARD]); +// } } -static uae_u64 getqual(const TCHAR** pp) +static uae_u64 getqual (const TCHAR **pp) { - const TCHAR* p = *pp; + const TCHAR *p = *pp; uae_u64 mask = 0; - while ((*p >= 'A' && *p <= 'Z') || (*p >= 'a' && *p <= 'z')) - { + while ((*p >= 'A' && *p <= 'Z') || (*p >= 'a' && *p <= 'z')) { bool press = (*p >= 'A' && *p <= 'Z'); int shift, inc; - if (press) - { + if (press) { shift = *p - 'A'; inc = 0; - } - else - { + } else { shift = *p - 'a'; inc = 1; } mask |= ID_FLAG_QUALIFIER1 << (shift * 2 + inc); p++; } - while (*p != 0 && *p != '.' && *p != ',') + while (*p != 0 && *p !='.' && *p != ',') p++; if (*p == '.' || *p == ',') p++; @@ -642,9 +886,9 @@ static uae_u64 getqual(const TCHAR** pp) return mask; } -static int getnum(const TCHAR** pp) +static int getnum (const TCHAR **pp) { - const TCHAR* p = *pp; + const TCHAR *p = *pp; int v; if (!_tcsnicmp (p, _T("false"), 5)) @@ -654,102 +898,114 @@ static int getnum(const TCHAR** pp) else v = _tstol (p); - while (*p != 0 && *p != '.' && *p != ',') + while (*p != 0 && *p !='.' && *p != ',' && *p != '=') p++; if (*p == '.' || *p == ',') p++; *pp = p; return v; } - -static TCHAR* getstring(const TCHAR** pp) +static TCHAR *getstring (const TCHAR **pp) { - int i; + int i; static TCHAR str[CONFIG_BLEN]; - const TCHAR* p = *pp; + const TCHAR *p = *pp; bool quoteds = false; bool quotedd = false; - if (*p == 0) - return 0; - i = 0; - while (*p != 0 && i < 1000 - 1) - { + if (*p == 0) + return 0; + i = 0; + while (*p != 0 && i < 1000 - 1) { if (*p == '\"') quotedd = quotedd ? false : true; if (*p == '\'') quoteds = quoteds ? false : true; - if (!quotedd && !quoteds) - { + if (!quotedd && !quoteds) { if (*p == '.' || *p == ',') break; } - str[i++] = *p++; + str[i++] = *p++; } - if (*p == '.' || *p == ',') - p++; - str[i] = 0; - *pp = p; - return str; + if (*p == '.' || *p == ',') + p++; + str[i] = 0; + *pp = p; + return str; } -static void reset_inputdevice_settings(struct uae_input_device* uid) +static void reset_inputdevice_settings (struct uae_input_device *uid) { - for (int l = 0; l < MAX_INPUT_DEVICE_EVENTS; l++) - { - for (int i = 0; i < MAX_INPUT_SUB_EVENT_ALL; i++) - { + for (int l = 0; l < MAX_INPUT_DEVICE_EVENTS; l++) { + for (int i = 0; i < MAX_INPUT_SUB_EVENT_ALL; i++) { uid->eventid[l][i] = 0; uid->flags[l][i] = 0; - if (uid->custom[l][i]) - { - xfree (uid->custom[l][i]); - uid->custom[l][i] = NULL; - } + if (uid->custom[l][i]) { + xfree (uid->custom[l][i]); + uid->custom[l][i] = NULL; + } + } + } +} +static void reset_inputdevice_slot (struct uae_prefs *prefs, int slot) +{ + for (int m = 0; m < MAX_INPUT_DEVICES; m++) { + reset_inputdevice_settings (&prefs->joystick_settings[slot][m]); + reset_inputdevice_settings (&prefs->mouse_settings[slot][m]); + reset_inputdevice_settings (&prefs->keyboard_settings[slot][m]); + } +} + +static void reset_inputdevice_config_temp(void) +{ + for (int i = 0; i < MAX_INPUT_DEVICES; i++) { + for (int j = 0; j < IDTYPE_MAX; j++) { + temp_uid_index[i][j] = -1; } } + for (int i = 0; i < IDTYPE_MAX; i++) { + temp_uid_cnt[i] = 0; + } + memset(&temp_uid, 0, sizeof temp_uid); + for (int i = 0; i < MAX_INPUT_DEVICES; i++) { + temp_uid.matcheddevices[i] = -1; + temp_uid.nonmatcheddevices[i] = -1; + } + temp_uid.idnum = -1; + temp_uid.lastdevtype = -1; } -static void reset_inputdevice_slot(struct uae_prefs* prefs, int slot) +void reset_inputdevice_config (struct uae_prefs *prefs, bool reset) { - for (int m = 0; m < MAX_INPUT_DEVICES; m++) - { - reset_inputdevice_settings(&prefs->joystick_settings[slot][m]); - reset_inputdevice_settings(&prefs->mouse_settings[slot][m]); - reset_inputdevice_settings(&prefs->keyboard_settings[slot][m]); + for (int i = 0; i< MAX_INPUT_SETTINGS; i++) + reset_inputdevice_slot (prefs, i); + reset_inputdevice_config_temp(); + + if (reset) { + inputdevice_store_clear(); } } -void reset_inputdevice_config(struct uae_prefs* prefs) +static void set_kbr_default_event (struct uae_input_device *kbr, struct uae_input_device_kbr_default *trans, int num) { - for (int i = 0; i < MAX_INPUT_SETTINGS; i++) - reset_inputdevice_slot(prefs, i); -} - -static void set_kbr_default_event(struct uae_input_device* kbr, struct uae_input_device_kbr_default* trans, int num) -{ - for (int i = 0; trans[i].scancode >= 0; i++) - { - if (kbr->extra[num] == trans[i].scancode) - { + if (!kbr->enabled || !trans) + return; + for (int i = 0; trans[i].scancode >= 0; i++) { + if (kbr->extra[num] == trans[i].scancode) { int k; - for (k = 0; k < MAX_INPUT_SUB_EVENT; k++) - { + for (k = 0; k < MAX_INPUT_SUB_EVENT; k++) { if (kbr->eventid[num][k] == 0) break; } - if (k == MAX_INPUT_SUB_EVENT) - { + if (k == MAX_INPUT_SUB_EVENT) { write_log (_T("corrupt default keyboard mappings\n")); return; } int l = 0; - while (k < MAX_INPUT_SUB_EVENT && trans[i].node[l].evt) - { + while (k < MAX_INPUT_SUB_EVENT && trans[i].node[l].evt) { int evt = trans[i].node[l].evt; if (evt < 0 || evt >= INPUTEVENT_SPC_LAST) gui_message(_T("invalid event in default keyboard table!")); - kbr->eventid[num][k] = evt; kbr->flags[num][k] = trans[i].node[l].flags; l++; @@ -760,88 +1016,233 @@ static void set_kbr_default_event(struct uae_input_device* kbr, struct uae_input } } -static void clear_id(struct uae_input_device* id) +static void clear_id (struct uae_input_device *id) { int i, j; - for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) - { + for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { for (j = 0; j < MAX_INPUT_SUB_EVENT_ALL; j++) - xfree (id->custom[i][j]); + xfree (id->custom[i][j]); } - TCHAR* cn = id->configname; - TCHAR* n = id->name; - memset(id, 0, sizeof (struct uae_input_device)); + TCHAR *cn = id->configname; + TCHAR *n = id->name; + memset (id, 0, sizeof (struct uae_input_device)); id->configname = cn; id->name = n; } -static void set_kbr_default(struct uae_prefs* p, int index, int devnum, struct uae_input_device_kbr_default* trans) +static void set_kbr_default (struct uae_prefs *p, int index, int devnum, struct uae_input_device_kbr_default *trans) { int i, j; - struct uae_input_device* kbr; - struct inputdevice_functions* id = &idev[IDTYPE_KEYBOARD]; + struct uae_input_device *kbr; + struct inputdevice_functions *id = &idev[IDTYPE_KEYBOARD]; uae_u32 scancode; - if (!trans) - return; - - for (j = 0; j < MAX_INPUT_DEVICES; j++) - { + for (j = 0; j < MAX_INPUT_DEVICES; j++) { if (devnum >= 0 && devnum != j) continue; kbr = &p->keyboard_settings[index][j]; - clear_id(kbr); + uae_s8 ena = kbr->enabled; + clear_id (kbr); + if (ena > 0) + kbr->enabled = ena; for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) kbr->extra[i] = -1; - if (j < id->get_num()) - { - if (input_get_default_keyboard(j)) + if (j < id->get_num ()) { + if (input_get_default_keyboard (j)) kbr->enabled = 1; - for (i = 0; i < id->get_widget_num(j); i++) - { - id->get_widget_type(j, i, 0, &scancode); + for (i = 0; i < id->get_widget_num (j); i++) { + id->get_widget_type (j, i, 0, &scancode); kbr->extra[i] = scancode; - set_kbr_default_event(kbr, trans, i); + if (j == 0 || kbr->enabled) + set_kbr_default_event (kbr, trans, i); } } } } -static void inputdevice_default_kb(struct uae_prefs *p, int num) +static void inputdevice_default_kb (struct uae_prefs *p, int num) { if (num == GAMEPORT_INPUT_SETTINGS) { - reset_inputdevice_slot(p, num); + reset_inputdevice_slot (p, num); } - set_kbr_default(p, num, -1, keyboard_default); + set_kbr_default (p, num, -1, keyboard_default); } -static void inputdevice_default_kb_all(struct uae_prefs* p) +static void inputdevice_default_kb_all (struct uae_prefs *p) { for (int i = 0; i < MAX_INPUT_SETTINGS; i++) - inputdevice_default_kb(p, i); + inputdevice_default_kb (p, i); } -static bool read_slot(const TCHAR* parm, int num, int joystick, int button, struct uae_input_device* id, int keynum, int subnum, struct inputevent* ie, uae_u64 flags, int port, TCHAR* custom) +static const int af_port1[] = { + INPUTEVENT_JOY1_FIRE_BUTTON, INPUTEVENT_JOY1_CD32_RED, + -1 +}; +static const int af_port2[] = { + INPUTEVENT_JOY2_FIRE_BUTTON, INPUTEVENT_JOY2_CD32_RED, + -1 +}; +static const int af_port3[] = { + INPUTEVENT_PAR_JOY1_FIRE_BUTTON, INPUTEVENT_PAR_JOY1_2ND_BUTTON, + -1 +}; +static const int af_port4[] = { + INPUTEVENT_PAR_JOY2_FIRE_BUTTON, INPUTEVENT_PAR_JOY2_2ND_BUTTON, + -1 +}; +static const int *af_ports[] = { af_port1, af_port2, af_port3, af_port4 }; + +static void setautofireevent (struct uae_input_device *uid, int num, int sub, int af, int index) +{ + if (!af) + return; + const int *afp = af_ports[index]; + for (int k = 0; afp[k] >= 0; k++) { + if (afp[k] == uid->eventid[num][sub]) { + uid->flags[num][sub] &= ~ID_FLAG_AUTOFIRE_MASK; + if (af >= JPORT_AF_NORMAL) + uid->flags[num][sub] |= ID_FLAG_AUTOFIRE; +#ifndef INPUTDEVICE_SIMPLE + if (af == JPORT_AF_TOGGLE) + uid->flags[num][sub] |= ID_FLAG_TOGGLE; + if (af == JPORT_AF_ALWAYS) + uid->flags[num][sub] |= ID_FLAG_INVERTTOGGLE; +#endif + return; + } + } +} + +static void setcompakbevent(struct uae_prefs *p, struct uae_input_device *uid, int l, int evt, int port, int af) +{ + inputdevice_sparecopy(uid, l, 0); + if (p->jports[port].nokeyboardoverride && uid->port[l][0] == 0) { + uid->eventid[l][MAX_INPUT_SUB_EVENT - 1] = uid->eventid[l][0]; + uid->flags[l][MAX_INPUT_SUB_EVENT - 1] = uid->flags[l][0] | ID_FLAG_RESERVEDGAMEPORTSCUSTOM; + uid->custom[l][MAX_INPUT_SUB_EVENT - 1] = my_strdup(uid->custom[l][0]); + uid->eventid[l][MAX_INPUT_SUB_EVENT - 1] = uid->eventid[l][0]; + } + uid->eventid[l][0] = evt; + uid->flags[l][0] &= COMPA_RESERVED_FLAGS; + uid->port[l][0] = port + 1; + xfree(uid->custom[l][0]); + uid->custom[l][0] = NULL; + setautofireevent(uid, l, 0, af, port); +} + +static int matchdevice(struct inputdevice_functions *inf, const TCHAR *configname, const TCHAR *name) +{ + int match = -1; + for (int j = 0; j < 2; j++) { + bool fullmatch = j == 0; + for (int i = 0; i < inf->get_num(); i++) { + const TCHAR* aname1 = inf->get_friendlyname(i); + const TCHAR* aname2 = inf->get_uniquename(i); + if (fullmatch && (!aname1 || !name)) + continue; + if (aname2 && configname) { + bool matched = false; + TCHAR bname[MAX_DPATH]; + TCHAR bname2[MAX_DPATH]; + TCHAR *p1, *p2; + _tcscpy(bname, configname); + _tcscpy(bname2, aname2); + // strip possible local guid part + p1 = _tcschr(bname, '{'); + p2 = _tcschr(bname2, '{'); + if (!p1 && !p2) { + // check possible directinput names too + p1 = _tcschr(bname, ' '); + p2 = _tcschr(bname2, ' '); + } + if (!_tcscmp(bname, bname2)) { + matched = true; + } else if (p1 && p2 && p1 - bname == p2 - bname2) { + *p1 = 0; + *p2 = 0; + if (bname[0] && !_tcscmp(bname2, bname)) + matched = true; + } + if (matched && fullmatch && _tcscmp(aname1, name) != 0) + matched = false; + if (matched) { + if (match >= 0) + match = -2; + else + match = i; + } + if (match == -2) + break; + } + } + if (match != -1) + break; + } + // multiple matches -> use complete local-only id string for comparisons + if (match == -2) { + for (int j = 0; j < 2; j++) { + bool fullmatch = j == 0; + match = -1; + for (int i = 0; i < inf->get_num(); i++) { + const TCHAR* aname1 = inf->get_friendlyname(i); + const TCHAR* aname2 = inf->get_uniquename(i); + if (aname2 && configname) { + const TCHAR *bname2 = configname; + bool matched = false; + if (fullmatch && (!aname1 || !name)) + continue; + if (aname2 && bname2 && !_tcscmp(aname2, bname2)) + matched = true; + if (matched && fullmatch && _tcscmp(aname1, name) != 0) + matched = false; + if (matched) { + if (match >= 0) { + match = -2; + break; + } else { + match = i; + } + } + } + } + if (match != -1) + break; + } + } + if (match < 0) { + // no match, try friendly names + for (int i = 0; i < inf->get_num(); i++) { + const TCHAR* aname1 = inf->get_friendlyname(i); + if (aname1 && name) { + const TCHAR *bname1 = name; + if (aname1 && bname1 && !_tcscmp(aname1, bname1)) { + if (match >= 0) { + match = -2; + break; + } else { + match = i; + } + } + } + } + } + return match; +} + +static bool read_slot (const TCHAR *parm, int num, int joystick, int button, struct uae_input_device *id, int keynum, int subnum, const struct inputevent *ie, uae_u64 flags, int port, TCHAR *custom) { int mask; - if (custom == NULL && ie->name == NULL) - { - if (!_tcscmp (parm, _T("NULL"))) - { - if (joystick < 0) - { + if (custom == NULL && ie->name == NULL) { + if (!_tcscmp (parm, _T("NULL"))) { + if (joystick < 0) { id->eventid[keynum][subnum] = 0; id->flags[keynum][subnum] = 0; - } - else if (button) - { + } else if (button) { id->eventid[num + ID_BUTTON_OFFSET][subnum] = 0; id->flags[num + ID_BUTTON_OFFSET][subnum] = 0; - } - else - { + } else { id->eventid[num + ID_AXIS_OFFSET][subnum] = 0; id->flags[num + ID_AXIS_OFFSET][subnum] = 0; } @@ -851,8 +1252,7 @@ static bool read_slot(const TCHAR* parm, int num, int joystick, int button, stru if (custom) ie = &events[INPUTEVENT_SPC_CUSTOM_EVENT]; - if (joystick < 0) - { + if (joystick < 0) { if (!(ie->allow_mask & AM_K)) return false; id->eventid[keynum][subnum] = ie - events; @@ -860,9 +1260,7 @@ static bool read_slot(const TCHAR* parm, int num, int joystick, int button, stru id->port[keynum][subnum] = port; xfree (id->custom[keynum][subnum]); id->custom[keynum][subnum] = custom; - } - else if (button) - { + } else if (button) { if (joystick) mask = AM_JOY_BUT; else @@ -874,9 +1272,7 @@ static bool read_slot(const TCHAR* parm, int num, int joystick, int button, stru id->port[num + ID_BUTTON_OFFSET][subnum] = port; xfree (id->custom[num + ID_BUTTON_OFFSET][subnum]); id->custom[num + ID_BUTTON_OFFSET][subnum] = custom; - } - else - { + } else { if (joystick) mask = AM_JOY_AXIS; else @@ -892,191 +1288,255 @@ static bool read_slot(const TCHAR* parm, int num, int joystick, int button, stru return true; } -static struct inputevent* readevent(const TCHAR* name, TCHAR** customp) +static const struct inputevent *readevent (const TCHAR *name, TCHAR **customp) { int i = 1; - while (events[i].name) - { + while (events[i].name) { if (!_tcscmp (events[i].confname, name)) return &events[i]; i++; } - if (_tcslen (name) > 2 && name[0] == '\'' && name[_tcslen (name) - 1] == '\'') - { - TCHAR* custom = my_strdup(name + 1); - custom[_tcslen (custom) - 1] = 0; + if (_tcslen (name) > 2 && name[0] == '\'') { + name++; + const TCHAR *end = name; + while (*end && *end != '\'') + end++; + if (!customp || *end == 0) + return NULL; + TCHAR *custom = my_strdup (name); + custom[end - name] = 0; *customp = custom; } return &events[0]; } -void read_inputdevice_config(struct uae_prefs* pr, const TCHAR* option, TCHAR* value) +void read_inputdevice_config (struct uae_prefs *pr, const TCHAR *option, TCHAR *value) { - struct uae_input_device* id = 0; - struct inputevent* ie; - int devnum, num, button, joystick, subnum, idnum, keynum; - const TCHAR* p; + struct uae_input_device *id = NULL; + const struct inputevent *ie; + int devnum, num, button, joystick, subnum, idnum, keynum, devtype; + const TCHAR *p; TCHAR *p2, *custom; + struct temp_uids *tid = &temp_uid; + struct inputdevice_functions *idf = NULL; - option += 6; /* "input." */ - p = getstring(&option); - if (!strcasecmp(p, _T("config"))) - { + option += 6; /* "input." */ + p = getstring (&option); + if (!_tcsicmp (p, _T("config"))) { pr->input_selected_setting = _tstol (value) - 1; if (pr->input_selected_setting == -1) pr->input_selected_setting = GAMEPORT_INPUT_SETTINGS; if (pr->input_selected_setting < 0 || pr->input_selected_setting > MAX_INPUT_SETTINGS) pr->input_selected_setting = 0; } - if (!strcasecmp(p, _T("joymouse_speed_analog"))) - pr->input_joymouse_multiplier = _tstol (value); - if (!strcasecmp(p, _T("joymouse_speed_digital"))) + if (!_tcsicmp (p, _T("joymouse_speed_analog"))) + pr->input_joymouse_multiplier = _tstol (value); + if (!_tcsicmp (p, _T("joymouse_speed_digital"))) pr->input_joymouse_speed = _tstol (value); - if (!strcasecmp(p, _T("joystick_deadzone"))) + if (!_tcsicmp (p, _T("joystick_deadzone"))) pr->input_joystick_deadzone = _tstol (value); - if (!strcasecmp(p, _T("joymouse_deadzone"))) + if (!_tcsicmp (p, _T("joymouse_deadzone"))) pr->input_joymouse_deadzone = _tstol (value); - if (!strcasecmp(p, _T("mouse_speed"))) + if (!_tcsicmp (p, _T("mouse_speed"))) pr->input_mouse_speed = _tstol (value); - if (!strcasecmp(p, _T("autofire"))) - pr->input_autofire_linecnt = _tstol (value) * 312; - if (!strcasecmp(p, _T("autofire_speed"))) + if (!_tcsicmp (p, _T("autofire"))) + pr->input_autofire_linecnt = _tstol (value) * 312; + if (!_tcsicmp (p, _T("autofire_speed"))) pr->input_autofire_linecnt = _tstol (value); - if (!strcasecmp(p, _T("analog_joystick_multiplier"))) + if (!_tcsicmp (p, _T("analog_joystick_multiplier"))) pr->input_analog_joystick_mult = _tstol (value); - if (!strcasecmp(p, _T("analog_joystick_offset"))) + if (!_tcsicmp (p, _T("analog_joystick_offset"))) pr->input_analog_joystick_offset = _tstol (value); - if (!strcasecmp(p, _T("keyboard_type"))) - { - cfgfile_strval(option, value, NULL, &pr->input_keyboard_type, kbtypes, 0); + if (!_tcsicmp (p, _T("keyboard_type"))) { + cfgfile_strval (option, value, nullptr, &pr->input_keyboard_type, kbtypes, 0); keyboard_default = keyboard_default_table[pr->input_keyboard_type]; - inputdevice_default_kb_all(pr); + inputdevice_default_kb_all (pr); } - if (!strcasecmp(p, _T("contact_bounce"))) - pr->input_contact_bounce = _tstol(value); - idnum = _tstol (p); if (idnum <= 0 || idnum > MAX_INPUT_SETTINGS) return; idnum--; - if (!_tcscmp (option, _T("name"))) - { + if (idnum != tid->idnum) { + reset_inputdevice_config_temp(); + tid->idnum = idnum; + } + + if (!_tcscmp (option, _T("name"))) { if (idnum < GAMEPORT_INPUT_SETTINGS) - _tcscpy (pr->input_config_name[idnum], value); + _tcscpy (pr->input_config_name[idnum], value); return; - } + } - if (_tcsncmp (option, _T("mouse."), 6) == 0) - { + if (_tcsncmp (option, _T("mouse."), 6) == 0) { p = option + 6; - } - else if (_tcsncmp (option, _T("joystick."), 9) == 0) - { + } else if (_tcsncmp (option, _T("joystick."), 9) == 0) { p = option + 9; - } - else if (_tcsncmp (option, _T("keyboard."), 9) == 0) - { + } else if (_tcsncmp (option, _T("keyboard."), 9) == 0) { p = option + 9; -#ifndef INPUTDEVICE_SIMPLE - } else if (_tcsncmp (option, _T("internal."), 9) == 0) { - p = option + 9; -#endif - } - else + } else return; - devnum = getnum(&p); + devnum = getnum (&p); if (devnum < 0 || devnum >= MAX_INPUT_DEVICES) return; - p2 = getstring(&p); + p2 = getstring (&p); if (!p2) return; - if (_tcsncmp (option, _T("mouse."), 6) == 0) - { + if (_tcsncmp (option, _T("mouse."), 6) == 0) { id = &pr->mouse_settings[idnum][devnum]; joystick = 0; - } - else if (_tcsncmp (option, _T("joystick."), 9) == 0) - { + devtype = IDTYPE_MOUSE; + } else if (_tcsncmp (option, _T("joystick."), 9) == 0) { id = &pr->joystick_settings[idnum][devnum]; joystick = 1; - } - else if (_tcsncmp (option, _T("keyboard."), 9) == 0) - { + devtype = IDTYPE_JOYSTICK; + } else if (_tcsncmp (option, _T("keyboard."), 9) == 0) { id = &pr->keyboard_settings[idnum][devnum]; joystick = -1; -#ifndef INPUTDEVICE_SIMPLE - } else if (_tcsncmp (option, _T("internal."), 9) == 0) { - if (devnum > 0) - return; - id = &pr->internalevent_settings[idnum][devnum]; - joystick = 1; -#endif + devtype = IDTYPE_KEYBOARD; } if (!id) return; - if (!_tcscmp (p2, _T("name"))) - { - xfree (id->configname); - id->configname = my_strdup(value); + idf = &idev[devtype]; + + if (devtype != tid->lastdevtype) { + tid->lastdevtype = devtype; + } + + if (!_tcscmp (p2, _T("name"))) { + xfree(tid->configname); + tid->configname = my_strdup (value); + tid->joystick = joystick; + tid->devtype = devtype; + tid->custom = false; + tid->empty = false; + tid->disabled = false; return; } - if (!_tcscmp (p2, _T("friendlyname"))) - { - xfree (id->name); - id->name = my_strdup(value); + if (!_tcscmp (p2, _T("friendlyname"))) { + xfree (tid->name); + tid->name = my_strdup (value); + tid->joystick = joystick; + tid->devtype = devtype; + tid->custom = false; + tid->empty = false; + tid->disabled = false; + return; + } + if (!_tcscmp (p2, _T("custom"))) { + p = value; + tid->custom = getnum(&p); + tid->joystick = joystick; + tid->devtype = devtype; + tid->empty = false; + return; + } + if (!_tcscmp(p2, _T("empty"))) { + p = value; + tid->empty = getnum(&p); + tid->joystick = joystick; + tid->devtype = devtype; + return; + } + if (!_tcscmp(p2, _T("disabled"))) { + p = value; + tid->disabled = getnum(&p); + tid->joystick = joystick; + tid->devtype = devtype; return; } - if (!_tcscmp (p2, _T("custom"))) - { - int iscustom; - p = value; - iscustom = getnum(&p); - if (idnum == GAMEPORT_INPUT_SETTINGS) - { + bool newdev = false; + if (temp_uid_index[devnum][tid->devtype] == -1) { + int newdevnum = -1; + if (tid->devtype == IDTYPE_KEYBOARD) { + // keyboard devnum == 0: always select keyboard zero. + if (devnum == 0) { + newdevnum = 0; + tid->disabled = false; + tid->empty = false; + } else if (tid->kbreventcnt[0] == 0) { + write_log(_T("Previous keyboard skipped\n")); + // if previously found keyboard had no events, next will be tried again + newdevnum = 0; + tid->disabled = false; + tid->empty = false; + } else { + newdevnum = matchdevice(idf, tid->configname, tid->name); + } + } else { + // match devices with empty names to first free slot + if (tid->configname && tid->configname[0] == 0 && tid->name && tid->name[0] == 0) { + for (int i = 0; i < MAX_INPUT_DEVICES; i++) { + if (tid->matcheddevices[i] < 0) { + newdevnum = i; + break; + } + } + } else { + newdevnum = matchdevice(idf, tid->configname, tid->name); + } + } + newdev = true; + if (newdevnum >= 0) { + temp_uid_index[devnum][tid->devtype] = newdevnum; + write_log(_T("%d %d: %d -> %d (%s)\n"), idnum, tid->devtype, devnum, temp_uid_index[devnum][tid->devtype], tid->name); + tid->matcheddevices[devnum] = newdevnum; + } else { + newdevnum = idf->get_num() + temp_uid_cnt[tid->devtype]; + if (newdevnum < MAX_INPUT_DEVICES) { + temp_uid_index[devnum][tid->devtype] = newdevnum; + temp_uid_cnt[tid->devtype]++; + if (tid->name) + write_log(_T("%d %d: %d -> %d (NO MATCH) (%s)\n"), idnum, tid->devtype, devnum, temp_uid_index[devnum][tid->devtype], tid->name); + if (!tid->disabled && !tid->empty) + tid->nonmatcheddevices[devnum] = newdevnum; + } else { + temp_uid_index[devnum][tid->devtype] = -1; + } + } + } + + devnum = temp_uid_index[devnum][tid->devtype]; + if (devnum < 0) { + if (devnum == -1) + write_log(_T("%s (%s) not found and no free slots\n"), tid->name, tid->configname); + temp_uid_index[devnum][tid->devtype] = -2; + return; + } + + if (tid->devtype == IDTYPE_MOUSE) { + id = &pr->mouse_settings[idnum][devnum]; + } else if (tid->devtype == IDTYPE_JOYSTICK) { + id = &pr->joystick_settings[idnum][devnum]; + } else if (tid->devtype == IDTYPE_KEYBOARD) { + id = &pr->keyboard_settings[idnum][devnum]; + } else { + return; + } + + if (newdev) { + if (!tid->initialized) clear_id(id); - if (joystick < 0) - set_kbr_default(pr, idnum, devnum, keyboard_default); - id->enabled = iscustom; + if (!tid->empty && tid->devtype == IDTYPE_KEYBOARD && !tid->initialized) { + set_kbr_default(pr, idnum, devnum, keyboard_default); } - else - { - id->enabled = false; - } - return; - } - - if (!_tcscmp (p2, _T("empty"))) - { - int empty; - p = value; - empty = getnum(&p); - clear_id(id); - if (!empty) - { - if (joystick < 0) - set_kbr_default(pr, idnum, devnum, keyboard_default); - } - id->enabled = 1; - if (idnum == GAMEPORT_INPUT_SETTINGS) + tid->initialized = true; + id->enabled = tid->disabled == 0 ? 1 : 0; + if (idnum == GAMEPORT_INPUT_SETTINGS) { id->enabled = 0; - return; - } - - if (!_tcscmp (p2, _T("disabled"))) - { - int disabled; - p = value; - disabled = getnum(&p); - id->enabled = disabled == 0 ? 1 : 0; - if (idnum == GAMEPORT_INPUT_SETTINGS) - id->enabled = 0; - return; + } + if (tid->custom) { + id->enabled = 1; + } + xfree(tid->configname); + xfree(tid->name); + tid->configname = NULL; + tid->name = NULL; } if (idnum == GAMEPORT_INPUT_SETTINGS && id->enabled == 0) @@ -1084,153 +1544,88 @@ void read_inputdevice_config(struct uae_prefs* pr, const TCHAR* option, TCHAR* v button = 0; keynum = 0; - if (joystick < 0) - { - num = getnum(&p); - for (keynum = 0; keynum < MAX_INPUT_DEVICE_EVENTS; keynum++) - { + joystick = tid->joystick; + if (joystick < 0) { + num = getnum (&p); + for (keynum = 0; keynum < MAX_INPUT_DEVICE_EVENTS; keynum++) { if (id->extra[keynum] == num) break; } if (keynum >= MAX_INPUT_DEVICE_EVENTS) return; - } - else - { + } else { button = -1; if (!_tcscmp (p2, _T("axis"))) button = 0; - else if (!_tcscmp (p2, _T("button"))) + else if(!_tcscmp (p2, _T("button"))) button = 1; if (button < 0) return; - num = getnum(&p); + num = getnum (&p); } p = value; + bool oldcustommapping = false; custom = NULL; - for (subnum = 0; subnum < MAX_INPUT_SUB_EVENT; subnum++) - { + for (subnum = 0; subnum < MAX_INPUT_SUB_EVENT; subnum++) { uae_u64 flags; int port; xfree (custom); custom = NULL; - p2 = getstring(&p); + p2 = getstring (&p); if (!p2) break; - ie = readevent(p2, &custom); + ie = readevent (p2, &custom); flags = 0; port = 0; if (p[-1] == '.') - flags = getnum(&p) & ID_FLAG_SAVE_MASK_CONFIG; - if (p[-1] == '.') - { + flags = getnum (&p) & ID_FLAG_SAVE_MASK_CONFIG; + if (p[-1] == '.') { if ((p[0] >= 'A' && p[0] <= 'Z') || (p[0] >= 'a' && p[0] <= 'z')) - flags |= getqual(&p); + flags |= getqual (&p); if (p[-1] == '.') - port = getnum(&p) + 1; + port = getnum (&p) + 1; } + if (flags & ID_FLAG_RESERVEDGAMEPORTSCUSTOM) + oldcustommapping = true; if (idnum == GAMEPORT_INPUT_SETTINGS && port == 0) continue; - if (p[-1] == '.' && idnum != GAMEPORT_INPUT_SETTINGS) - { - p2 = getstring(&p); - if (p2) - { + if (p[-1] == '.' && idnum != GAMEPORT_INPUT_SETTINGS) { + p2 = getstring (&p); + if (p2) { int flags2 = 0; if (p[-1] == '.') - flags2 = getnum(&p) & ID_FLAG_SAVE_MASK_CONFIG; - if (p[-1] == '.' && (p[0] >= 'A' && p[0] <= 'Z') || (p[0] >= 'a' && p[0] <= 'z')) - flags |= getqual(&p); - TCHAR* custom2 = NULL; - struct inputevent* ie2 = readevent(p2, &custom2); - read_slot(p2, num, joystick, button, id, keynum, SPARE_SUB_EVENT, ie2, flags2, MAX_JPORTS + 1, custom2); + flags2 = getnum (&p) & ID_FLAG_SAVE_MASK_CONFIG; + if (p[-1] == '.' && ((p[0] >= 'A' && p[0] <= 'Z') || (p[0] >= 'a' && p[0] <= 'z'))) + flags |= getqual (&p); + TCHAR *custom2 = NULL; + const struct inputevent *ie2 = readevent (p2, &custom2); + read_slot (p2, num, joystick, button, id, keynum, SPARE_SUB_EVENT, ie2, flags2, MAX_JPORTS + 1, custom2); } } - while (*p != 0) - { + while (*p != 0) { if (p[-1] == ',') break; p++; } - if (!read_slot(p2, num, joystick, button, id, keynum, subnum, ie, flags, port, custom)) + if (!read_slot (p2, num, joystick, button, id, keynum, subnum, ie, flags, port, custom)) continue; custom = NULL; } + if (joystick < 0 && !oldcustommapping) + tid->kbreventcnt[devnum]++; xfree (custom); } -static int mouseedge_alive, mousehack_alive_cnt; +static int mousehack_alive_cnt; static int lastmx, lastmy; -static uaecptr magicmouse_ibase, magicmouse_gfxbase; -static int dimensioninfo_width, dimensioninfo_height, dimensioninfo_dbl; -static int vp_xoffset, vp_yoffset, mouseoffset_x, mouseoffset_y; -static int tablet_maxx, tablet_maxy, tablet_maxz; -static int tablet_resx, tablet_resy; -static int tablet_maxax, tablet_maxay, tablet_maxaz; +static int mouseoffset_x, mouseoffset_y; static int tablet_data; -int mousehack_alive(void) +STATIC_INLINE int mousehack_alive (void) { - return mousehack_alive_cnt > 0 ? mousehack_alive_cnt : 0; -} - -static uaecptr get_base(const uae_char *name) -{ - uaecptr v = get_long(4); - addrbank *b = &get_mem_bank(v); - - if (!b || !b->check(v, 400) || b->flags != ABFLAG_RAM) - return 0; - v += 378; // liblist - while ((v = get_long(v))) { - uae_u32 v2; - uae_u8 *p; - b = &get_mem_bank(v); - if (!b || !b->check(v, 32) || b->flags != ABFLAG_RAM) - goto fail; - v2 = get_long(v + 10); // name - b = &get_mem_bank(v2); - if (!b || !b->check(v2, 20)) - goto fail; - if (b->flags != ABFLAG_ROM && b->flags != ABFLAG_RAM) - return 0; - p = b->xlateaddr(v2); - if (!memcmp(p, name, strlen(name) + 1)) { - TCHAR *s = au(name); - write_log(_T("get_base('%s')=%08x\n"), s, v); - xfree(s); - return v; - } - } - return 0; -fail: - { - TCHAR *s = au(name); - write_log(_T("get_base('%s') failed, invalid library list\n"), s); - xfree(s); - } - return 0xffffffff; -} - -static uaecptr get_intuitionbase(void) -{ - if (magicmouse_ibase == 0xffffffff) - return 0; - if (magicmouse_ibase) - return magicmouse_ibase; - magicmouse_ibase = get_base("intuition.library"); - return magicmouse_ibase; -} -static uaecptr get_gfxbase(void) -{ - if (magicmouse_gfxbase == 0xffffffff) - return 0; - if (magicmouse_gfxbase) - return magicmouse_gfxbase; - magicmouse_gfxbase = get_base("graphics.library"); - return magicmouse_gfxbase; + return mousehack_alive_cnt > 0 ? mousehack_alive_cnt : 0; } #define MH_E 0 @@ -1258,423 +1653,160 @@ static uaecptr get_gfxbase(void) #define MH_END 44 #define MH_START 4 -int inputdevice_is_tablet(void) +int inputdevice_is_tablet (void) { - int v; - if (uae_boot_rom_type <= 0) - return 0; - if (currprefs.input_tablet == TABLET_OFF) - return 0; - if (currprefs.input_tablet == TABLET_MOUSEHACK) - return -1; - v = is_tablet(); - if (!v) - return 0; - if (kickstart_version < 37) - return v ? -1 : 0; - return v ? 1 : 0; + if (uae_boot_rom_type <= 0) + return 0; + if (currprefs.input_tablet == TABLET_OFF) + return 0; + if (currprefs.input_tablet == TABLET_MOUSEHACK) + return -1; + return 0; } -static uaecptr mousehack_address; +static uae_u8 *mousehack_address; static bool mousehack_enabled; -static void mousehack_reset(void) +static void mousehack_reset (void) { - dimensioninfo_width = dimensioninfo_height = 0; - mouseoffset_x = mouseoffset_y = 0; - dimensioninfo_dbl = 0; - mousehack_alive_cnt = 0; - vp_xoffset = vp_yoffset = 0; - tablet_data = 0; - if (mousehack_address) - put_byte(mousehack_address + MH_E, 0); + mouseoffset_x = mouseoffset_y = 0; + mousehack_alive_cnt = 0; + tablet_data = 0; + if (rtarea_bank.baseaddr) { + put_long_host(rtarea_bank.baseaddr + RTAREA_INTXY, 0xffffffff); + if (mousehack_address) + put_byte_host(mousehack_address + MH_E, 0); + } mousehack_address = 0; mousehack_enabled = false; } -static bool mousehack_enable(void) +static bool mousehack_enable (void) { - int mode; + int mode; if (uae_boot_rom_type <= 0 || currprefs.input_tablet == TABLET_OFF) - return false; + return false; if (mousehack_address && mousehack_enabled) - return true; - mode = 0x80; - if (currprefs.input_tablet == TABLET_MOUSEHACK) - mode |= 1; - if (inputdevice_is_tablet() > 0) - mode |= 2; - if (mousehack_address) - { - write_log (_T("Mouse driver enabled (%s)\n"), ((mode & 3) == 3 ? _T("tablet+mousehack") : ((mode & 3) == 2) ? _T("tablet") : _T("mousehack"))); - put_byte(mousehack_address + MH_E, mode); + return true; + mode = 0x80; + if (currprefs.input_tablet == TABLET_MOUSEHACK) + mode |= 1; + if (mousehack_address && rtarea_bank.baseaddr) { + write_log (_T("Mouse driver enabled (%s)\n"), _T("mousehack")); + put_byte_host(mousehack_address + MH_E, mode); mousehack_enabled = true; } return true; } -static void inputdevice_update_tablet_params(void) +void input_mousehack_mouseoffset (uaecptr pointerprefs) { - uae_u8 *p; - if (inputdevice_is_tablet() <= 0 || !mousehack_address) - return; - p = get_real_address(mousehack_address); - - p[MH_MAXX] = tablet_maxx >> 8; - p[MH_MAXX + 1] = tablet_maxx; - p[MH_MAXY] = tablet_maxy >> 8; - p[MH_MAXY + 1] = tablet_maxy; - p[MH_MAXZ] = tablet_maxz >> 8; - p[MH_MAXZ + 1] = tablet_maxz; - - p[MH_RESX] = tablet_resx >> 8; - p[MH_RESX + 1] = tablet_resx; - p[MH_RESY] = tablet_resy >> 8; - p[MH_RESY + 1] = tablet_resy; - - p[MH_MAXAX] = tablet_maxax >> 8; - p[MH_MAXAX + 1] = tablet_maxax; - p[MH_MAXAY] = tablet_maxay >> 8; - p[MH_MAXAY + 1] = tablet_maxay; - p[MH_MAXAZ] = tablet_maxaz >> 8; - p[MH_MAXAZ + 1] = tablet_maxaz; + mouseoffset_x = (uae_s16)get_word (pointerprefs + 28); + mouseoffset_y = (uae_s16)get_word (pointerprefs + 30); } -void input_mousehack_mouseoffset(uaecptr pointerprefs) +void mousehack_wakeup(void) { - mouseoffset_x = uae_s16(get_word(pointerprefs + 28)); - mouseoffset_y = uae_s16(get_word(pointerprefs + 30)); + if (mousehack_alive_cnt == 0) + mousehack_alive_cnt = -100; + else if (mousehack_alive_cnt > 0) + mousehack_alive_cnt = 100; + if (uaeboard_bank.baseaddr) { + uaeboard_bank.baseaddr[0x201] &= ~3; + } } -int input_mousehack_status(int mode, uaecptr diminfo, uaecptr dispinfo, uaecptr vp, uae_u32 moffset) +int input_mousehack_status(TrapContext *ctx, int mode, uaecptr diminfo, uaecptr dispinfo, uaecptr vp, uae_u32 moffset) { if (mode == 4) { - return mousehack_enable() ? 1 : 0; - } - else if (mode == 5) { - mousehack_address = m68k_dreg(regs, 0); - mousehack_enable(); - inputdevice_update_tablet_params(); - } - else if (mode == 0) { + return mousehack_enable () ? 1 : 0; + } else if (mode == 5) { + mousehack_address = (trap_get_dreg(ctx, 0) & 0xffff) + rtarea_bank.baseaddr; + mousehack_enable (); + } else if (mode == 0) { if (mousehack_address) { - uae_u8 v = get_byte(mousehack_address + MH_E); + uae_u8 v = get_byte_host(mousehack_address + MH_E); v |= 0x40; - put_byte(mousehack_address + MH_E, v); - write_log(_T("Tablet driver running (%08x,%02x)\n"), mousehack_address, v); + put_byte_host(mousehack_address + MH_E, v); + write_log (_T("Tablet driver running (%08x,%02x)\n"), mousehack_address, v); } - } - else if (mode == 1) { - int x1 = -1, y1 = -1, x2 = -1, y2 = -1; - uae_u32 props = 0; - dimensioninfo_width = -1; - dimensioninfo_height = -1; - vp_xoffset = 0; - vp_yoffset = 0; - if (diminfo) { - x1 = get_word(diminfo + 50); - y1 = get_word(diminfo + 52); - x2 = get_word(diminfo + 54); - y2 = get_word(diminfo + 56); - dimensioninfo_width = x2 - x1 + 1; - dimensioninfo_height = y2 - y1 + 1; - } - if (vp) { - vp_xoffset = get_word(vp + 28); - vp_yoffset = get_word(vp + 30); - } - if (dispinfo) - props = get_long(dispinfo + 18); - dimensioninfo_dbl = (props & 0x00020000) ? 1 : 0; - write_log(_T("%08x %08x %08x (%dx%d)-(%dx%d) d=%dx%d %s\n"), - diminfo, props, vp, x1, y1, x2, y2, vp_xoffset, vp_yoffset, - (props & 0x00020000) ? _T("dbl") : _T("")); - } - else if (mode == 2) { - if (mousehack_alive_cnt == 0) - mousehack_alive_cnt = -100; - else if (mousehack_alive_cnt > 0) - mousehack_alive_cnt = 100; - } + } return 1; } -void get_custom_mouse_limits(int *w, int *h, int *dx, int *dy, int dbl); - -void inputdevice_tablet_strobe() +void inputdevice_tablet_strobe (void) { - mousehack_enable(); + mousehack_enable (); if (uae_boot_rom_type <= 0) - return; - if (!tablet_data) - return; + return; + if (!tablet_data) + return; if (mousehack_address) - put_byte(mousehack_address + MH_CNT, get_byte(mousehack_address + MH_CNT) + 1); + put_byte_host(mousehack_address + MH_CNT, get_byte_host(mousehack_address + MH_CNT) + 1); } -void inputdevice_tablet(int x, int y, int z, int pressure, uae_u32 buttonbits, int inproximity, int ax, int ay, int az) +static void inputdevice_mh_abs (int x, int y, uae_u32 buttonbits) { - uae_u8 *p; - uae_u8 tmp[MH_END]; + x -= mouseoffset_x + 1; + y -= mouseoffset_y + 2; - mousehack_enable(); - if (inputdevice_is_tablet() <= 0 || !mousehack_address) - return; + mousehack_enable (); + if (mousehack_address) { + uae_u8 tmp1[4], tmp2[4]; + uae_u8 *p = mousehack_address; - p = get_real_address(mousehack_address); + memcpy (tmp1, p + MH_ABSX, sizeof tmp1); + memcpy (tmp2, p + MH_BUTTONBITS, sizeof tmp2); - memcpy(tmp, p + MH_START, MH_END - MH_START); + //write_log (_T("%04dx%04d %08x\n"), x, y, buttonbits); - p[MH_X] = x >> 8; - p[MH_X + 1] = x; - p[MH_Y] = y >> 8; - p[MH_Y + 1] = y; - p[MH_Z] = z >> 8; - p[MH_Z + 1] = z; + p[MH_ABSX] = x >> 8; + p[MH_ABSX + 1] = x; + p[MH_ABSY] = y >> 8; + p[MH_ABSY + 1] = y; - p[MH_AX] = ax >> 8; - p[MH_AX + 1] = ax; - p[MH_AY] = ay >> 8; - p[MH_AY + 1] = ay; - p[MH_AZ] = az >> 8; - p[MH_AZ + 1] = az; + p[MH_BUTTONBITS + 0] = buttonbits >> 24; + p[MH_BUTTONBITS + 1] = buttonbits >> 16; + p[MH_BUTTONBITS + 2] = buttonbits >> 8; + p[MH_BUTTONBITS + 3] = buttonbits >> 0; - p[MH_PRESSURE] = pressure >> 8; - p[MH_PRESSURE + 1] = pressure; - - p[MH_BUTTONBITS + 0] = buttonbits >> 24; - p[MH_BUTTONBITS + 1] = buttonbits >> 16; - p[MH_BUTTONBITS + 2] = buttonbits >> 8; - p[MH_BUTTONBITS + 3] = buttonbits >> 0; - - if (inproximity < 0) { - p[MH_INPROXIMITY] = p[MH_INPROXIMITY + 1] = 0xff; - } - else { - p[MH_INPROXIMITY] = 0; - p[MH_INPROXIMITY + 1] = inproximity ? 1 : 0; - } - - if (!memcmp(tmp, p + MH_START, MH_END - MH_START)) - return; - - /*if (tablet_log & 1) { - static int obuttonbits, oinproximity; - if (inproximity != oinproximity || buttonbits != obuttonbits) { - obuttonbits = buttonbits; - oinproximity = inproximity; - write_log(_T("TABLET: B=%08x P=%d\n"), buttonbits, inproximity); - } - } - if (tablet_log & 2) { - write_log(_T("TABLET: X=%d Y=%d Z=%d AX=%d AY=%d AZ=%d\n"), x, y, z, ax, ay, az); - }*/ - - p[MH_E] = 0xc0 | 2; - p[MH_CNT]++; + if (!memcmp (tmp1, p + MH_ABSX, sizeof tmp1) && !memcmp (tmp2, p + MH_BUTTONBITS, sizeof tmp2)) + return; + p[MH_E] = 0xc0 | 1; + p[MH_CNT]++; + tablet_data = 1; + } } -void inputdevice_tablet_info(int maxx, int maxy, int maxz, int maxax, int maxay, int maxaz, int xres, int yres) +static void mousehack_helper (uae_u32 buttonmask) { - tablet_maxx = maxx; - tablet_maxy = maxy; - tablet_maxz = maxz; + int x, y; - tablet_resx = xres; - tablet_resy = yres; - tablet_maxax = maxax; - tablet_maxay = maxay; - tablet_maxaz = maxaz; - inputdevice_update_tablet_params(); -} - - -void getgfxoffset(float *dx, float *dy, float*, float*); - -static void inputdevice_mh_abs(int x, int y, uae_u32 buttonbits) -{ - uae_u8* p; - uae_u8 tmp1[4], tmp2[4]; - - mousehack_enable(); - if (!mousehack_address) - return; - p = get_real_address(mousehack_address); - - memcpy(tmp1, p + MH_ABSX, sizeof tmp1); - memcpy(tmp2, p + MH_BUTTONBITS, sizeof tmp2); - - x -= mouseoffset_x + 1; - y -= mouseoffset_y + 2; - - p[MH_ABSX] = x >> 8; - p[MH_ABSX + 1] = x; - p[MH_ABSY] = y >> 8; - p[MH_ABSY + 1] = y; - - p[MH_BUTTONBITS + 0] = buttonbits >> 24; - p[MH_BUTTONBITS + 1] = buttonbits >> 16; - p[MH_BUTTONBITS + 2] = buttonbits >> 8; - p[MH_BUTTONBITS + 3] = buttonbits >> 0; - - if (!memcmp(tmp1, p + MH_ABSX, sizeof tmp1) && !memcmp(tmp2, p + MH_BUTTONBITS, sizeof tmp2)) - return; - p[MH_E] = 0xc0 | 1; - p[MH_CNT]++; - tablet_data = 1; -} - -static void mousehack_helper(uae_u32 buttonmask) -{ - int x, y; - //float fdy, fdx, fmx, fmy; - - if (!(currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC) && currprefs.input_tablet < TABLET_MOUSEHACK) - return; - x = lastmx; - y = lastmy; - //getgfxoffset(&fdx, &fdy, &fmx, &fmy); + if (currprefs.input_tablet < TABLET_MOUSEHACK) + return; + x = lastmx; + y = lastmy; #ifdef PICASSO96 - if (picasso_on) - { - x -= picasso96_state.XOffset; - y -= picasso96_state.YOffset; - //x = int(x * fmx); - //y = int(y * fmy); - //x -= int(fdx * fmx); - //y -= int(fdy * fmy); - } - else + if (picasso_on) { + x -= picasso96_state.XOffset; + y -= picasso96_state.YOffset; + } else #endif - { - //x = int(x * fmx); - //y = int(y * fmy); - //x -= int(fdx * fmx) - 1; - //y -= int(fdy * fmy) - 2; - //if (x < 0) - // x = 0; - //if (x >= gfxvidinfo.outbuffer->outwidth) - // x = gfxvidinfo.outbuffer->outwidth - 1; - //if (y < 0) - // y = 0; - //if (y >= gfxvidinfo.outbuffer->outheight) - // y = gfxvidinfo.outbuffer->outheight - 1; - x = coord_native_to_amiga_x(x); - y = coord_native_to_amiga_y(y) << 1; - } - //inputdevice_mh_abs(x, y, buttonmask); + { + x = coord_native_to_amiga_x (x); + y = coord_native_to_amiga_y (y) << 1; + } + inputdevice_mh_abs (x, y, buttonmask); } -static int mouseedge_x, mouseedge_y, mouseedge_time; -#define MOUSEEDGE_RANGE 100 -#define MOUSEEDGE_TIME 2 - -extern void setmouseactivexy(int, int, int); - -//static int mouseedge() -//{ -// int x, y, dir; -// uaecptr ib; -// static int melast_x, melast_y; -// static int isnonzero; -// -// if (currprefs.input_magic_mouse == 0 || currprefs.input_tablet > 0) -// return 0; -// if (magicmouse_ibase == 0xffffffff) -// return 0; -// dir = 0; -// if (!mouseedge_time) { -// isnonzero = 0; -// goto end; -// } -// ib = get_intuitionbase(); -// if (!ib) -// return 0; -// if (get_word(ib + 20) < 31) // version < 31 -// return 0; -// if (get_long(ib + 34 + 0) == 0) // ViewPort == NULL -// return 0; -// if (get_long(ib + 60) == 0) // FirstScreen == NULL -// return 0; -// x = get_word(ib + 70); -// y = get_word(ib + 68); -// if (x || y) -// isnonzero = 1; -// if (!isnonzero) -// return 0; -// if (melast_x == x) { -// if (mouseedge_x < -MOUSEEDGE_RANGE) { -// mouseedge_x = 0; -// dir |= 1; -// goto end; -// } -// if (mouseedge_x > MOUSEEDGE_RANGE) { -// mouseedge_x = 0; -// dir |= 2; -// goto end; -// } -// } -// else { -// mouseedge_x = 0; -// melast_x = x; -// } -// if (melast_y == y) { -// if (mouseedge_y < -MOUSEEDGE_RANGE) { -// mouseedge_y = 0; -// dir |= 4; -// goto end; -// } -// if (mouseedge_y > MOUSEEDGE_RANGE) { -// mouseedge_y = 0; -// dir |= 8; -// goto end; -// } -// } -// else { -// mouseedge_y = 0; -// melast_y = y; -// } -// return 1; -// -//end: -// mouseedge_time = 0; -// if (dir) { -// if (!picasso_on) { -// int aw = 0, ah = 0, dx, dy; -// get_custom_mouse_limits(&aw, &ah, &dx, &dy, dimensioninfo_dbl); -// x += dx; -// y += dy; -// } -// if (!dmaen(DMA_SPRITE)) -// setmouseactivexy(x, y, 0); -// else -// setmouseactivexy(x, y, dir); -// } -// return 1; -//} - -int magicmouse_alive(void) -{ - return mouseedge_alive > 0; -} - -STATIC_INLINE int adjust(int val) -{ - if (val > 127) - return 127; - else if (val < -127) - return -127; - return val; -} - -static int getbuttonstate(int joy, int button) +static int getbuttonstate (int joy, int button) { return (joybutton[joy] & (1 << button)) ? 1 : 0; } -static int getvelocity(int num, int subnum, int pct) +static int getvelocity (int num, int subnum, int pct) { int val; int v; @@ -1683,8 +1815,7 @@ static int getvelocity(int num, int subnum, int pct) pct = 1000; val = mouse_delta[num][subnum]; v = val * pct / 1000; - if (!v) - { + if (!v) { if (val < -maxvpos / 2) v = -2; else if (val < 0) @@ -1694,97 +1825,49 @@ static int getvelocity(int num, int subnum, int pct) else if (val > 0) v = 1; } - if (!mouse_deltanoreset[num][subnum]) - { + if (!mouse_deltanoreset[num][subnum]) { mouse_delta[num][subnum] -= v; - /*gui_gameport_axis_change(num, subnum * 2 + 0, 0, -1); - gui_gameport_axis_change(num, subnum * 2 + 1, 0, -1);*/ } return v; } #define MOUSEXY_MAX 16384 -static void mouseupdate(int pct, bool vsync) +static void mouseupdate (int pct, bool vsync) { int v, i; int max = 120; - static int mxd, myd; - if (vsync) { - if (mxd < 0) { - if (mouseedge_x > 0) - mouseedge_x = 0; - else - mouseedge_x += mxd; - mouseedge_time = MOUSEEDGE_TIME; - } - if (mxd > 0) { - if (mouseedge_x < 0) - mouseedge_x = 0; - else - mouseedge_x += mxd; - mouseedge_time = MOUSEEDGE_TIME; - } - if (myd < 0) { - if (mouseedge_y > 0) - mouseedge_y = 0; - else - mouseedge_y += myd; - mouseedge_time = MOUSEEDGE_TIME; - } - if (myd > 0) { - if (mouseedge_y < 0) - mouseedge_y = 0; - else - mouseedge_y += myd; - mouseedge_time = MOUSEEDGE_TIME; - } - if (mouseedge_time > 0) { - mouseedge_time--; - if (mouseedge_time == 0) { - mouseedge_x = 0; - mouseedge_y = 0; - } - } - mxd = 0; - myd = 0; - } + for (i = 0; i < 2; i++) { - for (i = 0; i < 2; i++) - { - if (mouse_port[i]) - { - v = getvelocity(i, 0, pct); - mxd += v; + if (mouse_port[i]) { + + v = getvelocity (i, 0, pct); mouse_x[i] += v; - if (mouse_x[i] < 0) - { + if (mouse_x[i] < 0) { mouse_x[i] += MOUSEXY_MAX; mouse_frame_x[i] = mouse_x[i] - v; } - if (mouse_x[i] >= MOUSEXY_MAX) - { + if (mouse_x[i] >= MOUSEXY_MAX) { mouse_x[i] -= MOUSEXY_MAX; mouse_frame_x[i] = mouse_x[i] - v; } - v = getvelocity(i, 1, pct); - myd += v; + v = getvelocity (i, 1, pct); mouse_y[i] += v; - if (mouse_y[i] < 0) - { + if (mouse_y[i] < 0) { mouse_y[i] += MOUSEXY_MAX; mouse_frame_y[i] = mouse_y[i] - v; } - if (mouse_y[i] >= MOUSEXY_MAX) - { + if (mouse_y[i] >= MOUSEXY_MAX) { mouse_y[i] -= MOUSEXY_MAX; mouse_frame_y[i] = mouse_y[i] - v; } #ifndef INPUTDEVICE_SIMPLE v = getvelocity (i, 2, pct); + /* if v != 0, record mouse wheel key presses + * according to the NewMouse standard */ if (v > 0) record_key (0x7a << 1); else if (v < 0) @@ -1793,13 +1876,11 @@ static void mouseupdate(int pct, bool vsync) if (!mouse_deltanoreset[i][2]) mouse_delta[i][2] = 0; - if (mouse_frame_x[i] - mouse_x[i] > max) - { + if (mouse_frame_x[i] - mouse_x[i] > max) { mouse_x[i] = mouse_frame_x[i] - max; mouse_x[i] &= MOUSEXY_MAX - 1; } - if (mouse_frame_x[i] - mouse_x[i] < -max) - { + if (mouse_frame_x[i] - mouse_x[i] < -max) { mouse_x[i] = mouse_frame_x[i] + max; mouse_x[i] &= MOUSEXY_MAX - 1; } @@ -1810,38 +1891,35 @@ static void mouseupdate(int pct, bool vsync) mouse_y[i] = mouse_frame_y[i] + max; } - if (!vsync) - { + if (!vsync) { mouse_frame_x[i] = mouse_x[i]; mouse_frame_y[i] = mouse_y[i]; } + } } static int input_vpos, input_frame; -extern int vpos; -static void readinput() + +static void readinput (void) { uae_u32 totalvpos; int diff; - totalvpos = input_frame * current_maxvpos() + vpos; + totalvpos = input_frame * current_maxvpos () + vpos; diff = totalvpos - input_vpos; - if (diff > 0) - { - if (diff < 10) - { - mouseupdate(0, false); - } - else - { - mouseupdate(diff * 1000 / current_maxvpos(), false); + if (diff > 0) { + if (diff < 10) { + mouseupdate (0, false); + } else { + mouseupdate (diff * 1000 / current_maxvpos (), false); } } input_vpos = totalvpos; + } -static void joymousecounter(int joy) +static void joymousecounter (int joy) { int left = 1, right = 1, top = 1, bot = 1; int b9, b8, b1, b0; @@ -1878,45 +1956,56 @@ static void joymousecounter(int joy) mouse_y[joy] += 4; mouse_y[joy] = (mouse_y[joy] & 0xfc) | cnty; - if (!left || !right || !top || !bot) - { + if (!left || !right || !top || !bot) { mouse_frame_x[joy] = mouse_x[joy]; mouse_frame_y[joy] = mouse_y[joy]; } } -static uae_u16 getjoystate(int joy) +static int inputdelay; + +static void inputdevice_read (void) +{ + do { + handle_msgpump (); + idev[IDTYPE_MOUSE].read (); + idev[IDTYPE_JOYSTICK].read (); + idev[IDTYPE_KEYBOARD].read (); + } while (handle_msgpump ()); +} + +static uae_u16 getjoystate (int joy) { uae_u16 v; - v = uae_u8(mouse_x[joy]) | (mouse_y[joy] << 8); + v = (uae_u8)mouse_x[joy] | (mouse_y[joy] << 8); return v; } -uae_u16 JOY0DAT() +uae_u16 JOY0DAT (void) { uae_u16 v; - readinput(); - v = getjoystate(0); - return v; + readinput (); + v = getjoystate (0); + return v; } -uae_u16 JOY1DAT() +uae_u16 JOY1DAT (void) { uae_u16 v; - readinput(); - v = getjoystate(1); - return v; + readinput (); + v = getjoystate (1); + return v; } -uae_u16 JOYGET(int num) +uae_u16 JOYGET (int num) { uae_u16 v; - v = getjoystate(num); + v = getjoystate (num); return v; } -void JOYSET(int num, uae_u16 dat) +void JOYSET (int num, uae_u16 dat) { mouse_x[num] = dat & 0xff; mouse_y[num] = (dat >> 8) & 0xff; @@ -1924,7 +2013,7 @@ void JOYSET(int num, uae_u16 dat) mouse_frame_y[num] = mouse_y[num]; } -void JOYTEST(uae_u16 v) +void JOYTEST (uae_u16 v) { mouse_x[0] &= 3; mouse_y[0] &= 3; @@ -1940,7 +2029,7 @@ void JOYTEST(uae_u16 v) mouse_frame_y[1] = mouse_y[1]; } -#ifndef INPUTDEVICE_SIMPLE +#if !defined(INPUTDEVICE_SIMPLE) || defined(AMIBERRY) static uae_u8 parconvert (uae_u8 v, int jd, int shift) { if (jd & DIR_UP) @@ -1985,7 +2074,7 @@ uae_u8 handle_parport_joystick (int port, uae_u8 pra, uae_u8 dra) #endif /* p5 is 1 or floating = cd32 2-button mode */ -static bool cd32padmode(uae_u16 p5dir, uae_u16 p5dat) +static bool cd32padmode (uae_u16 p5dir, uae_u16 p5dat) { if (!(potgo_value & p5dir) || ((potgo_value & p5dat) && (potgo_value & p5dir))) return false; @@ -1997,10 +2086,6 @@ static bool is_joystick_pullup (int joy) { return joymodes[joy] == JSEM_MODE_GAMEPAD; } -static bool is_mouse_pullup(int joy) -{ - return mouse_pullup; -} static void charge_cap (int joy, int idx, int charge) { @@ -2014,31 +2099,28 @@ static void charge_cap (int joy, int idx, int charge) } #endif -static void cap_check() +static void cap_check (void) { int joy, i; - for (joy = 0; joy < 2; joy++) - { - for (i = 0; i < 2; i++) - { + for (joy = 0; joy < 2; joy++) { + for (i = 0; i < 2; i++) { #ifndef INPUTDEVICE_SIMPLE - int charge = 0, dong, joypot; + int charge = 0, joypot; #endif uae_u16 pdir = 0x0200 << (joy * 4 + i * 2); /* output enable */ uae_u16 pdat = 0x0100 << (joy * 4 + i * 2); /* data */ uae_u16 p5dir = 0x0200 << (joy * 4); uae_u16 p5dat = 0x0100 << (joy * 4); - int isbutton = getbuttonstate(joy, i == 0 ? JOYBUTTON_3 : JOYBUTTON_2); + int isbutton = getbuttonstate (joy, i == 0 ? JOYBUTTON_3 : JOYBUTTON_2); - if (cd32_pad_enabled[joy]) - { + if (cd32_pad_enabled[joy]) { // only red and blue can be read if CD32 pad and only if it is in normal pad mode - isbutton |= getbuttonstate(joy, JOYBUTTON_CD32_BLUE); + isbutton |= getbuttonstate (joy, JOYBUTTON_CD32_BLUE); // CD32 pad 3rd button line (P5) is always floating if (i == 0) isbutton = 0; - if (cd32padmode(p5dir, p5dat)) + if (cd32padmode (p5dir, p5dat)) continue; } @@ -2049,21 +2131,16 @@ static void cap_check() if ((is_joystick_pullup (joy) && digital_port[joy][i]) || (mouse_port[joy])) charge = 1; // slow charge via pull-up resistor #endif - if (!(potgo_value & pdir)) - { // input? + if (!(potgo_value & pdir)) { // input? if (pot_dat_act[joy][i]) pot_dat[joy][i]++; /* first 7 or 8 lines after potgo has been started = discharge cap */ - if (pot_dat_act[joy][i] == 1) - { - if (pot_dat[joy][i] < (currprefs.ntscmode ? POTDAT_DELAY_NTSC : POTDAT_DELAY_PAL)) - { + if (pot_dat_act[joy][i] == 1) { + if (pot_dat[joy][i] < (currprefs.ntscmode ? POTDAT_DELAY_NTSC : POTDAT_DELAY_PAL)) { #ifndef INPUTDEVICE_SIMPLE charge = -2; /* fast discharge delay */ #endif - } - else - { + } else { pot_dat_act[joy][i] = 2; pot_dat[joy][i] = 0; } @@ -2072,8 +2149,7 @@ static void cap_check() if (analog_port[joy][i] && pot_dat_act[joy][i] == 2 && pot_cap[joy][i] >= joypot) pot_dat_act[joy][i] = 0; #endif - if ((digital_port[joy][i] || mouse_port[joy]) && pot_dat_act[joy][i] == 2) - { + if ((digital_port[joy][i] || mouse_port[joy]) && pot_dat_act[joy][i] == 2) { #ifdef INPUTDEVICE_SIMPLE if (!isbutton) #else @@ -2081,9 +2157,7 @@ static void cap_check() #endif pot_dat_act[joy][i] = 0; } - } - else - { // output? + } else { // output? #ifndef INPUTDEVICE_SIMPLE charge = (potgo_value & pdat) ? 2 : -2; /* fast (dis)charge if output */ #endif @@ -2118,57 +2192,47 @@ static void cap_check() } } -uae_u8 handle_joystick_buttons(uae_u8 pra, uae_u8 dra) +uae_u8 handle_joystick_buttons (uae_u8 pra, uae_u8 dra) { - uae_u8 but = 0; + uae_u8 but = 0; int i; - cap_check(); + cap_check (); for (i = 0; i < 2; i++) { int mask = 0x40 << i; if (cd32_pad_enabled[i]) { uae_u16 p5dir = 0x0200 << (i * 4); uae_u16 p5dat = 0x0100 << (i * 4); but |= mask; - if (!cd32padmode(p5dir, p5dat)) { - if (getbuttonstate(i, JOYBUTTON_CD32_RED) || getbuttonstate(i, JOYBUTTON_1)) + if (!cd32padmode (p5dir, p5dat)) { + if (getbuttonstate (i, JOYBUTTON_CD32_RED) || getbuttonstate (i, JOYBUTTON_1)) but &= ~mask; } - } - else { - if (!getbuttonstate(i, JOYBUTTON_1)) + } else { + if (!getbuttonstate (i, JOYBUTTON_1)) but |= mask; - //if (bouncy && cycles_in_range(bouncy_cycles)) { - // but &= ~mask; - // if (uaerand() & 1) - // but |= mask; - //} if (dra & mask) but = (but & ~mask) | (pra & mask); } } - return but; + return but; } /* joystick 1 button 1 is used as a output for incrementing shift register */ -void handle_cd32_joystick_cia(uae_u8 pra, uae_u8 dra) +void handle_cd32_joystick_cia (uae_u8 pra, uae_u8 dra) { static int oldstate[2]; int i; - cap_check(); - for (i = 0; i < 2; i++) - { + cap_check (); + for (i = 0; i < 2; i++) { uae_u8 but = 0x40 << i; uae_u16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ uae_u16 p5dat = 0x0100 << (i * 4); /* data P5 */ - if (cd32padmode(p5dir, p5dat)) - { - if ((dra & but) && (pra & but) != oldstate[i]) - { - if (!(pra & but)) - { + if (cd32padmode (p5dir, p5dat)) { + if ((dra & but) && (pra & but) != oldstate[i]) { + if (!(pra & but)) { cd32_shifter[i]--; if (cd32_shifter[i] < 0) cd32_shifter[i] = 0; @@ -2180,20 +2244,19 @@ void handle_cd32_joystick_cia(uae_u8 pra, uae_u8 dra) } /* joystick port 1 button 2 is input for button state */ -static uae_u16 handle_joystick_potgor(uae_u16 potgor) +static uae_u16 handle_joystick_potgor (uae_u16 potgor) { int i; - cap_check(); - for (i = 0; i < 2; i++) - { + cap_check (); + for (i = 0; i < 2; i++) { uae_u16 p9dir = 0x0800 << (i * 4); /* output enable P9 */ uae_u16 p9dat = 0x0400 << (i * 4); /* data P9 */ uae_u16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ uae_u16 p5dat = 0x0100 << (i * 4); /* data P5 */ - if (cd32_pad_enabled[i] && cd32padmode(p5dir, p5dat)) - { + if (cd32_pad_enabled[i] && cd32padmode (p5dir, p5dat)) { + /* p5 is floating in input-mode */ potgor &= ~p5dat; potgor |= potgo_value & p5dat; @@ -2207,9 +2270,9 @@ static uae_u16 handle_joystick_potgor(uae_u16 potgor) potgor &= ~p9dat; /* shift at zero == return zero */ if (cd32_shifter[i] >= 2 && (joybutton[i] & ((1 << JOYBUTTON_CD32_PLAY) << (cd32_shifter[i] - 2)))) potgor &= ~p9dat; - } - else - { + + } else { + potgor &= ~p5dat; #ifdef INPUTDEVICE_SIMPLE if (getbuttonstate(i, JOYBUTTON_3) == 0) @@ -2218,133 +2281,98 @@ static uae_u16 handle_joystick_potgor(uae_u16 potgor) #endif potgor |= p5dat; - if (!cd32_pad_enabled[i] || !cd32padmode(p5dir, p5dat)) - { + if (!cd32_pad_enabled[i] || !cd32padmode (p5dir, p5dat)) { potgor &= ~p9dat; #ifdef INPUTDEVICE_SIMPLE - if (getbuttonstate(i, JOYBUTTON_2) == 0) + if(getbuttonstate(i, JOYBUTTON_2) == 0) #else if (pot_cap[i][1] > 100) #endif - potgor |= p9dat; + potgor |= p9dat; } + } } return potgor; } -static int inputdelay; - -void inputdevice_read() -{ - do - { - handle_msgpump(); - idev[IDTYPE_MOUSE].read(); - idev[IDTYPE_JOYSTICK].read(); - idev[IDTYPE_KEYBOARD].read(); - } - while (handle_msgpump()); -} - -static void inject_events(const TCHAR* str) +static void inject_events (const TCHAR *str) { bool quot = false; bool first = true; uae_u8 keys[300]; int keycnt = 0; - for (;;) - { + for (;;) { TCHAR ch = *str++; if (!ch) break; - if (ch == '\'') - { + if (ch == '\'') { first = false; quot = !quot; continue; } - if (!quot && (ch == ' ' || first)) - { - const TCHAR* s = str; + if (!quot && (ch == ' ' || first)) { + const TCHAR *s = str; if (first) s--; while (*s == ' ') s++; - const TCHAR* s2 = s; + const TCHAR *s2 = s; while (*s && *s != ' ') s++; int s2len = s - s2; if (!s2len) break; - for (int i = 1; events[i].name; i++) - { - const TCHAR* cf = events[i].confname; + for (int i = 1; events[i].name; i++) { + const TCHAR *cf = events[i].confname; if (!_tcsnicmp (cf, _T("KEY_"), 4)) cf += 4; - if (events[i].allow_mask == AM_K && !_tcsnicmp (cf, s2, _tcslen (cf)) && s2len == _tcslen (cf)) - { + if (events[i].allow_mask == AM_K && !_tcsnicmp (cf, s2, _tcslen (cf)) && s2len == _tcslen (cf)) { int j; uae_u8 kc = events[i].data << 1; TCHAR tch = _totupper (s2[0]); - if (tch != s2[0]) - { + if (tch != s2[0]) { // release - for (j = 0; j < keycnt; j++) - { + for (j = 0; j < keycnt; j++) { if (keys[j] == kc) keys[j] = 0xff; } kc |= 0x01; - } - else - { - for (j = 0; j < keycnt; j++) - { - if (keys[j] == kc) - { + } else { + for (j = 0; j < keycnt; j++) { + if (keys[j] == kc) { kc = 0xff; } } - if (kc != 0xff) - { - for (j = 0; j < keycnt; j++) - { - if (keys[j] == 0xff) - { + if (kc != 0xff) { + for (j = 0; j < keycnt; j++) { + if (keys[j] == 0xff) { keys[j] = kc; break; } } - if (j == keycnt) - { + if (j == keycnt) { if (keycnt < sizeof keys) keys[keycnt++] = kc; } } } - if (kc != 0xff) - { + if (kc != 0xff) { //write_log (_T("%s\n"), cf); - record_key(kc); + record_key (kc); } } } - } - else if (quot) - { + } else if (quot) { ch = _totupper (ch); - if ((ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9')) - { - for (int i = 1; events[i].name; i++) - { - if (events[i].allow_mask == AM_K && events[i].name[1] == 0 && events[i].name[0] == ch) - { - record_key(events[i].data << 1); - record_key((events[i].data << 1) | 0x01); + if ((ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9')) { + for (int i = 1; events[i].name; i++) { + if (events[i].allow_mask == AM_K && events[i].name[1] == 0 && events[i].name[0] == ch) { + record_key (events[i].data << 1); + record_key ((events[i].data << 1) | 0x01); //write_log (_T("%c\n"), ch); } } @@ -2352,156 +2380,56 @@ static void inject_events(const TCHAR* str) } first = false; } - while (--keycnt >= 0) - { + while (--keycnt >= 0) { uae_u8 kc = keys[keycnt]; if (kc != 0xff) - record_key(kc | 0x01); + record_key (kc | 0x01); } } -#ifndef INPUTDEVICE_SIMPLE -struct delayed_event -{ - TCHAR *event_string; - int delay; - struct delayed_event *next; -}; -static struct delayed_event *delayed_events; - -static int handle_custom_event (const TCHAR *custom) -{ - TCHAR *p, *buf, *nextp; - bool noquot = false; - - if (custom == NULL) - return 0; - write_log (_T("%s\n"), custom); - p = buf = my_strdup_trim (custom); - if (p[0] != '\"') - noquot = true; - while (p && *p) { - TCHAR *p2; - if (!noquot) { - if (*p != '\"') - break; - p++; - p2 = p; - while (*p2 != '\"' && *p2 != 0) - p2++; - if (*p2 == '\"') { - *p2++ = 0; - nextp = p2 + 1; - while (*nextp == ' ') - nextp++; - } - } -//write_log (L"-> '%s'\n", p); - if (!_tcsnicmp (p, _T("delay "), 6)) { - int delay = _tstol (p + 6); - if (delay >= 0) { - struct delayed_event *de = delayed_events; - while (de) { - if (de->delay < 0) { - de->delay = delay; - de->event_string = my_strdup (p2); - break; - } - de = de->next; - } - if (!de) { - de = xcalloc (delayed_event, 1); - de->next = delayed_events; - delayed_events = de; - de->delay = delay; - de->event_string = my_strdup (p2); - } - } - break; - } else if (!_tcsnicmp (p, _T("dbg "), 4)) { - debug_parser (p + 4, NULL, -1); - } else if (!_tcsnicmp (p, _T("kbr "), 4)) { - inject_events (p + 4); - } else if (!_tcsnicmp (p, _T("evt "), 4)) { - TCHAR *pp = _tcschr (p + 4, ' '); - p += 4; - if (pp) - *pp++ = 0; - inputdevice_uaelib (p, pp); - } else { - cfgfile_parse_line (&changed_prefs, p, 0); - } - if (noquot) - break; - p = nextp; - } - xfree (buf); - return 0; -} -#endif - -void inputdevice_hsync() +void inputdevice_hsync (void) { static int cnt; - cap_check(); + cap_check (); -#ifdef CATWEASEL - catweasel_hsync(); -#endif - - for (int i = 0; i < INPUT_QUEUE_SIZE; i++) - { - struct input_queue_struct* iq = &input_queue[i]; - if (iq->linecnt > 0) - { + for (int i = 0; i < INPUT_QUEUE_SIZE; i++) { + struct input_queue_struct *iq = &input_queue[i]; + if (iq->linecnt > 0) { iq->linecnt--; - if (iq->linecnt == 0) - { + if (iq->linecnt == 0) { if (iq->state) iq->state = 0; else iq->state = iq->storedstate; -#ifndef INPUTDEVICE_SIMPLE - if (iq->custom) - handle_custom_event (iq->custom); -#endif if (iq->evt) -#ifdef INPUTDEVICE_SIMPLE - handle_input_event(iq->evt, iq->state, iq->max, 0); -#else - handle_input_event (iq->evt, iq->state, iq->max, 0, false, true); -#endif + handle_input_event (iq->evt, iq->state, iq->max, 0); iq->linecnt = iq->nextlinecnt; } } } - if ((++cnt & 63) == 63) - { - inputdevice_read(); - } - else if (inputdelay > 0) - { + if ((++cnt & 63) == 63 ) { + inputdevice_read (); + } else if (inputdelay > 0) { inputdelay--; if (inputdelay == 0) - inputdevice_read(); + inputdevice_read (); } } -static uae_u16 POTDAT(int joy) +static uae_u16 POTDAT (int joy) { uae_u16 v = (pot_dat[joy][1] << 8) | pot_dat[joy][0]; return v; } -uae_u16 POT0DAT() +uae_u16 POT0DAT (void) { - return POTDAT(0); + return POTDAT (0); } - -uae_u16 POT1DAT() +uae_u16 POT1DAT (void) { - return POTDAT(1); + return POTDAT (1); } /* direction=input, data pin floating, last connected logic level or previous status @@ -2511,38 +2439,31 @@ uae_u16 POT1DAT() * it takes some tens of microseconds before data pin changes state */ -void POTGO(uae_u16 v) +void POTGO (uae_u16 v) { - int i, j; + int i, j; potgo_value = potgo_value & 0x5500; /* keep state of data bits */ potgo_value |= v & 0xaa00; /* get new direction bits */ - for (i = 0; i < 8; i += 2) - { + for (i = 0; i < 8; i += 2) { uae_u16 dir = 0x0200 << i; - if (v & dir) - { + if (v & dir) { uae_u16 data = 0x0100 << i; potgo_value &= ~data; potgo_value |= v & data; } } - for (i = 0; i < 2; i++) - { - if (cd32_pad_enabled[i]) - { + for (i = 0; i < 2; i++) { + if (cd32_pad_enabled[i]) { uae_u16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ uae_u16 p5dat = 0x0100 << (i * 4); /* data P5 */ if (!(potgo_value & p5dir) || ((potgo_value & p5dat) && (potgo_value & p5dir))) cd32_shifter[i] = 8; } } - if (v & 1) - { - for (i = 0; i < 2; i++) - { - for (j = 0; j < 2; j++) - { + if (v & 1) { + for (i = 0; i < 2; i++) { + for (j = 0; j < 2; j++) { pot_dat_act[i][j] = 1; pot_dat[i][j] = 0; } @@ -2550,20 +2471,19 @@ void POTGO(uae_u16 v) } } -uae_u16 POTGOR() +uae_u16 POTGOR (void) { uae_u16 v; - v = handle_joystick_potgor(potgo_value) & 0x5500; - return v; + v = handle_joystick_potgor (potgo_value) & 0x5500; + return v; } -static int check_input_queue(int evt) +static int check_input_queue (int evt) { - struct input_queue_struct* iq; + struct input_queue_struct *iq; int i; - for (i = 0; i < INPUT_QUEUE_SIZE; i++) - { + for (i = 0; i < INPUT_QUEUE_SIZE; i++) { iq = &input_queue[i]; if (iq->evt == evt && iq->linecnt >= 0) return i; @@ -2571,65 +2491,38 @@ static int check_input_queue(int evt) return -1; } -#ifdef INPUTDEVICE_SIMPLE -static void queue_input_event(int evt, int state, int max, int linecnt) -#else -static void queue_input_event (int evt, const TCHAR *custom, int state, int max, int linecnt, int autofire) -#endif +static void queue_input_event (int evt, int state, int max, int linecnt) { - struct input_queue_struct* iq; + struct input_queue_struct *iq; int idx; if (!evt) return; - idx = check_input_queue(evt); - if (state < 0 && idx >= 0) - { + idx = check_input_queue (evt); + if (state < 0 && idx >= 0) { iq = &input_queue[idx]; iq->nextlinecnt = -1; iq->linecnt = -1; iq->evt = 0; if (iq->state == 0 && evt > 0) -#ifdef INPUTDEVICE_SIMPLE - handle_input_event(evt, 0, 1, 0); -#else - handle_input_event (evt, 0, 1, 0, false, false); -#endif - } - else if (state >= 0 && idx < 0) - { -#ifdef INPUTDEVICE_SIMPLE + handle_input_event (evt, 0, 1, 0); + } else if (state >= 0 && idx < 0) { if (evt == 0) -#else - if (evt == 0 && custom == NULL) -#endif return; - for (idx = 0; idx < INPUT_QUEUE_SIZE; idx++) - { + for (idx = 0; idx < INPUT_QUEUE_SIZE; idx++) { iq = &input_queue[idx]; if (iq->linecnt < 0) break; } - if (idx == INPUT_QUEUE_SIZE) - { + if (idx == INPUT_QUEUE_SIZE) { write_log (_T("input queue overflow\n")); return; } -#ifndef INPUTDEVICE_SIMPLE - xfree (iq->custom); - iq->custom = NULL; - if (custom) - iq->custom = my_strdup (custom); -#endif iq->evt = evt; iq->state = iq->storedstate = state; iq->max = max; iq->linecnt = linecnt < 0 ? maxvpos + maxvpos / 2 : linecnt; -#ifdef INPUTDEVICE_SIMPLE iq->nextlinecnt = linecnt; -#else - iq->nextlinecnt = autofire > 0 ? linecnt : -1; -#endif } } @@ -2637,396 +2530,189 @@ static uae_u8 keybuf[256]; #define MAX_PENDING_EVENTS 20 static int inputcode_pending[MAX_PENDING_EVENTS], inputcode_pending_state[MAX_PENDING_EVENTS]; -void inputdevice_release_all_keys(void) +void inputdevice_add_inputcode (int code, int state) { - int i; - - for (i = 0; i < 0x80; i++) { - if (keybuf[i] != 0) { - keybuf[i] = 0; - record_key(i << 1 | 1); - } - } -} - -void inputdevice_add_inputcode(int code, int state) -{ - for (int i = 0; i < MAX_PENDING_EVENTS; i++) - { + for (int i = 0; i < MAX_PENDING_EVENTS; i++) { if (inputcode_pending[i] == code && inputcode_pending_state[i] == state) return; } - for (int i = 0; i < MAX_PENDING_EVENTS; i++) - { - if (inputcode_pending[i] == 0) - { - inputcode_pending[i] = code; - inputcode_pending_state[i] = state; + for (int i = 0; i < MAX_PENDING_EVENTS; i++) { + if (inputcode_pending[i] == 0) { + inputcode_pending[i] = code; + inputcode_pending_state[i] = state; return; } } } -void inputdevice_do_keyboard(int code, int state) +void inputdevice_do_keyboard (int code, int state) { -#ifdef CDTV - if (code >= 0x72 && code <= 0x77) { // CDTV keys - if (cdtv_front_panel(-1)) { - // front panel active - if (!state) - return; - cdtv_front_panel(code - 0x72); - return; - } - } -#endif - if (code < 0x80) - { + if (code < 0x80) { uae_u8 key = code | (state ? 0x00 : 0x80); keybuf[key & 0x7f] = (key & 0x80) ? 0 : 1; - - if (record_key(uae_u8((key << 1) | (key >> 7)))) - { + if (record_key ((uae_u8)((key << 1) | (key >> 7)))) { } return; } - inputdevice_add_inputcode(code, state); + inputdevice_add_inputcode (code, state); } -// these need cpu trace data -static bool needcputrace(int code) -{ - switch (code) - { - case AKS_ENTERGUI: - case AKS_STATECAPTURE: - case AKS_STATESAVEQUICK: - case AKS_STATESAVEQUICK1: - case AKS_STATESAVEQUICK2: - case AKS_STATESAVEQUICK3: - case AKS_STATESAVEQUICK4: - case AKS_STATESAVEQUICK5: - case AKS_STATESAVEQUICK6: - case AKS_STATESAVEQUICK7: - case AKS_STATESAVEQUICK8: - case AKS_STATESAVEQUICK9: - case AKS_STATESAVEDIALOG: - return true; - } - return false; -} -static bool inputdevice_handle_inputcode2(int code, int state) +int find_in_array(const int arr[], int n, int key) { - static int swapperslot; - static int tracer_enable; - int newstate; + int index = -1; + for(int i=0; i 4) - changed_prefs.sound_interpol = 0; - set_config_changed(); - break; - case AKS_STATESAVEDIALOG: - gui_display(5); - break; - case AKS_STATERESTOREDIALOG: - gui_display(4); - break; - case AKS_DISKSWAPPER_NEXT: - swapperslot++; - if (swapperslot >= MAX_SPARE_DRIVES || currprefs.dfxlist[swapperslot][0] == 0) - swapperslot = 0; - break; - case AKS_DISKSWAPPER_PREV: - swapperslot--; - if (swapperslot < 0) - swapperslot = MAX_SPARE_DRIVES - 1; - while (swapperslot > 0) { - if (currprefs.dfxlist[swapperslot][0]) - break; - swapperslot--; - } - break; - case AKS_DISKSWAPPER_INSERT0: - case AKS_DISKSWAPPER_INSERT1: - case AKS_DISKSWAPPER_INSERT2: - case AKS_DISKSWAPPER_INSERT3: - _tcscpy(changed_prefs.floppyslots[code - AKS_DISKSWAPPER_INSERT0].df, currprefs.dfxlist[swapperslot]); - set_config_changed(); - break; - case AKS_INPUT_CONFIG_1: - case AKS_INPUT_CONFIG_2: - case AKS_INPUT_CONFIG_3: - case AKS_INPUT_CONFIG_4: - changed_prefs.input_selected_setting = currprefs.input_selected_setting = code - AKS_INPUT_CONFIG_1; - inputdevice_updateconfig(&changed_prefs, &currprefs); - break; - case AKS_DISK_PREV0: - case AKS_DISK_PREV1: - case AKS_DISK_PREV2: - case AKS_DISK_PREV3: - disk_prevnext(code - AKS_DISK_PREV0, -1); - break; - case AKS_DISK_NEXT0: - case AKS_DISK_NEXT1: - case AKS_DISK_NEXT2: - case AKS_DISK_NEXT3: - disk_prevnext(code - AKS_DISK_NEXT0, 1); - break; -#ifdef CDTV - case AKS_CDTV_FRONT_PANEL_STOP: - case AKS_CDTV_FRONT_PANEL_PLAYPAUSE: - case AKS_CDTV_FRONT_PANEL_PREV: - case AKS_CDTV_FRONT_PANEL_NEXT: - case AKS_CDTV_FRONT_PANEL_REW: - case AKS_CDTV_FRONT_PANEL_FF: - cdtv_front_panel(code - AKS_CDTV_FRONT_PANEL_STOP); - break; -#endif - } +#ifndef PANDORA + case AKS_MOUSEMAP_PORT0_LEFT: + ((changed_prefs.jports[0].mousemap) ^= 1 << 0); + inputdevice_updateconfig (&changed_prefs, &currprefs); + break; + case AKS_MOUSEMAP_PORT0_RIGHT: + ((changed_prefs.jports[0].mousemap) ^= 1 << 1); + inputdevice_updateconfig (&changed_prefs, &currprefs); + break; + case AKS_MOUSEMAP_PORT1_LEFT: + ((changed_prefs.jports[1].mousemap) ^= 1 << 0); + inputdevice_updateconfig (&changed_prefs, &currprefs); + break; + case AKS_MOUSEMAP_PORT1_RIGHT: + ((changed_prefs.jports[1].mousemap) ^= 1 << 1); + inputdevice_updateconfig (&changed_prefs, &currprefs); + break; +#endif + case AKS_MOUSE_SPEED_DOWN: + + num_elements = sizeof(mousespeed_values) / sizeof( mousespeed_values[0] ); + mousespeed = currprefs.input_joymouse_multiplier; + + i = find_in_array(mousespeed_values, num_elements, mousespeed); + i = i - 1; + if (i < 0 ) { i = num_elements - 1 ;} + changed_prefs.input_joymouse_multiplier = mousespeed_values[i]; + inputdevice_updateconfig (&changed_prefs, &currprefs); + + break; + + case AKS_MOUSE_SPEED_UP: + + num_elements = sizeof(mousespeed_values) / sizeof( mousespeed_values[0] ); + mousespeed = currprefs.input_joymouse_multiplier; + + i = find_in_array(mousespeed_values, num_elements, mousespeed); + i = i + 1; + if (i >= num_elements ) { i =0 ;} + changed_prefs.input_joymouse_multiplier = mousespeed_values[i]; + inputdevice_updateconfig (&changed_prefs, &currprefs); + + break; + } +end: return false; } -void inputdevice_handle_inputcode() + + +void inputdevice_handle_inputcode (void) { bool got = false; - for (int i = 0; i < MAX_PENDING_EVENTS; i++) - { + for (int i = 0; i < MAX_PENDING_EVENTS; i++) { int code = inputcode_pending[i]; int state = inputcode_pending_state[i]; - if (code) - { - if (!inputdevice_handle_inputcode2(code, state)) + if (code) { + if (!inputdevice_handle_inputcode2 (code, state)) inputcode_pending[i] = 0; got = true; } } if (!got) - inputdevice_handle_inputcode2(0, 0); + inputdevice_handle_inputcode2 (0, 0); } -static int getqualid(int evt) +static int getqualid (int evt) { if (evt > INPUTEVENT_SPC_QUALIFIER_START && evt < INPUTEVENT_SPC_QUALIFIER_END) return evt - INPUTEVENT_SPC_QUALIFIER1; return -1; } -static uae_u64 isqual(int evt) +static uae_u64 isqual (int evt) { - int num = getqualid(evt); + int num = getqualid (evt); if (num < 0) return 0; return ID_FLAG_QUALIFIER1 << (num * 2); } -#ifdef INPUTDEVICE_SIMPLE -static int handle_input_event(int nr, int state, int max, int autofire) -#else -static int handle_input_event (int nr, int state, int max, int autofire, bool canstopplayback, bool playbackevent) -#endif +static int handle_input_event (int nr, int state, int max, int autofire) { - struct inputevent* ie; + const struct inputevent *ie; int joy; bool isaks = false; if (nr <= 0 || nr == INPUTEVENT_SPC_CUSTOM_EVENT) return 0; +#ifdef _WIN32_ // ignore normal GUI event if forced gui key is in use - if (currprefs.key_for_menu >= 0 && nr == INPUTEVENT_SPC_ENTERGUI) + if (currprefs.win32_guikey >= 0 && nr == INPUTEVENT_SPC_ENTERGUI) return 0; +#endif ie = &events[nr]; - if (isqual(nr)) + if (isqual (nr)) return 0; // qualifiers do nothing - if (ie->unit == 0 && ie->data >= AKS_FIRST) - { + if (ie->unit == 0 && ie->data >= AKS_FIRST) { isaks = true; - if (!state) // release AKS_ does nothing - return 0; } - if (autofire) - { -#ifdef INPUTDEVICE_SIMPLE + if (autofire) { if (state) - queue_input_event(nr, state, max, currprefs.input_autofire_linecnt); + queue_input_event (nr, state, max, currprefs.input_autofire_linecnt); else - queue_input_event(nr, -1, 0, 0); -#else - if (state) - queue_input_event (nr, NULL, state, max, currprefs.input_autofire_linecnt, 1); - else - queue_input_event (nr, NULL, -1, 0, 0, 1); -#endif + queue_input_event (nr, -1, 0, 0); } switch (ie->unit) { @@ -3035,48 +2721,40 @@ static int handle_input_event (int nr, int state, int max, int autofire, bool ca case 3: /* ->Parallel port joystick adapter port #1 */ case 4: /* ->Parallel port joystick adapter port #2 */ joy = ie->unit - 1; - if (ie->type & 4) - { + if (ie->type & 4) { int old = joybutton[joy] & (1 << ie->data); - if (state) - { + if (state) { joybutton[joy] |= 1 << ie->data; - } - else - { + } else { joybutton[joy] &= ~(1 << ie->data); } - } - else if (ie->type & 8) - { + + } else if (ie->type & 8) { + /* real mouse / analog stick mouse emulation */ int delta; - int deadzone = currprefs.input_joymouse_deadzone * max / 100; + int deadzone = max < 0 ? 0 : currprefs.input_joymouse_deadzone * max / 100; int unit = ie->data & 0x7f; - if (max) - { - if (state <= deadzone && state >= -deadzone) - { + if (max) { + if (state <= deadzone && state >= -deadzone) { state = 0; mouse_deltanoreset[joy][unit] = 0; - } - else if (state < 0) - { + } else if (state < 0) { state += deadzone; mouse_deltanoreset[joy][unit] = 1; - } - else - { + } else { state -= deadzone; mouse_deltanoreset[joy][unit] = 1; } - max -= deadzone; - delta = state * currprefs.input_joymouse_multiplier / max; - } - else - { + if (max > 0) { + max -= deadzone; + delta = state * currprefs.input_joymouse_multiplier / max; + } else { + delta = state; + } + } else { delta = state; mouse_deltanoreset[joy][unit] = 0; } @@ -3090,45 +2768,34 @@ static int handle_input_event (int nr, int state, int max, int autofire, bool ca mouse_delta[joy][unit] += delta; max = 32; - } - else if (ie->type & 32) - { /* button mouse emulation vertical */ + } else if (ie->type & 32) { /* button mouse emulation vertical */ - int speed = (ie->data & IE_CDTV) ? JOYMOUSE_CDTV : currprefs.input_joymouse_speed; + int speed = currprefs.input_joymouse_speed; - if (state && (ie->data & DIR_UP)) - { + if (state && (ie->data & DIR_UP)) { mouse_delta[joy][1] = -speed; mouse_deltanoreset[joy][1] = 1; - } - else if (state && (ie->data & DIR_DOWN)) - { + } else if (state && (ie->data & DIR_DOWN)) { mouse_delta[joy][1] = speed; mouse_deltanoreset[joy][1] = 1; - } - else + } else mouse_deltanoreset[joy][1] = 0; - } - else if (ie->type & 64) - { /* button mouse emulation horizontal */ - int speed = (ie->data & IE_CDTV) ? JOYMOUSE_CDTV : currprefs.input_joymouse_speed; + } else if (ie->type & 64) { /* button mouse emulation horizontal */ - if (state && (ie->data & DIR_LEFT)) - { + int speed = currprefs.input_joymouse_speed; + + if (state && (ie->data & DIR_LEFT)) { mouse_delta[joy][0] = -speed; mouse_deltanoreset[joy][0] = 1; - } - else if (state && (ie->data & DIR_RIGHT)) - { + } else if (state && (ie->data & DIR_RIGHT)) { mouse_delta[joy][0] = speed; mouse_deltanoreset[joy][0] = 1; - } - else + } else mouse_deltanoreset[joy][0] = 0; - } - else if (ie->type & 128) - { /* analog joystick / paddle */ + + } else if (ie->type & 128) { /* analog joystick / paddle */ + #ifndef INPUTDEVICE_SIMPLE int deadzone = currprefs.input_joymouse_deadzone * max / 100; int unit = ie->data & 0x7f; @@ -3165,105 +2832,59 @@ static int handle_input_event (int nr, int state, int max, int autofire, bool ca mouse_deltanoreset[joy][0] = 1; mouse_deltanoreset[joy][1] = 1; #endif - } - else - { + + } else { + int left = oleft[joy], right = oright[joy], top = otop[joy], bot = obot[joy]; - if (ie->type & 16) - { + if (ie->type & 16) { /* button to axis mapping */ - if (ie->data & DIR_LEFT) - { + if (ie->data & DIR_LEFT) { left = oleft[joy] = state ? 1 : 0; - if (horizclear[joy] && left) { - horizclear[joy] = 0; - right = oright[joy] = 0; - } } - if (ie->data & DIR_RIGHT) - { + if (ie->data & DIR_RIGHT) { right = oright[joy] = state ? 1 : 0; - if (horizclear[joy] && right) { - horizclear[joy] = 0; - left = oleft[joy] = 0; - } } - if (ie->data & DIR_UP) - { + if (ie->data & DIR_UP) { top = otop[joy] = state ? 1 : 0; - if (vertclear[joy] && top) { - vertclear[joy] = 0; - bot = obot[joy] = 0; - } } - if (ie->data & DIR_DOWN) - { + if (ie->data & DIR_DOWN) { bot = obot[joy] = state ? 1 : 0; - if (vertclear[joy] && bot) { - vertclear[joy] = 0; - top = otop[joy] = 0; - } } - } - else - { + } else { /* "normal" joystick axis */ int deadzone = currprefs.input_joystick_deadzone * max / 100; int neg, pos; - if (max == 0) - { + if (max == 0) { int cnt; int mmax = 50, mextra = 10; int unit = (ie->data & (4 | 8)) ? 1 : 0; // relative events relativecount[joy][unit] += state; cnt = relativecount[joy][unit]; - neg = cnt < -mmax; + neg = cnt < -mmax; pos = cnt > mmax; if (cnt < -(mmax + mextra)) cnt = -(mmax + mextra); if (cnt > (mmax + mextra)) cnt = (mmax + mextra); relativecount[joy][unit] = cnt; + } else { + if (state < deadzone && state > -deadzone) + state = 0; + neg = state < 0 ? 1 : 0; + pos = state > 0 ? 1 : 0; } - else - { - if (state < deadzone && state > -deadzone) - state = 0; - neg = state < 0 ? 1 : 0; - pos = state > 0 ? 1 : 0; - } - if (ie->data & DIR_LEFT) - { + if (ie->data & DIR_LEFT) { left = oleft[joy] = neg; - if (horizclear[joy] && left) { - horizclear[joy] = 0; - right = oright[joy] = 0; - } } - if (ie->data & DIR_RIGHT) - { + if (ie->data & DIR_RIGHT) { right = oright[joy] = pos; - if (horizclear[joy] && right) { - horizclear[joy] = 0; - left = oleft[joy] = 0; - } } - if (ie->data & DIR_UP) - { + if (ie->data & DIR_UP) { top = otop[joy] = neg; - if (vertclear[joy] && top) { - vertclear[joy] = 0; - bot = obot[joy] = 0; - } } - if (ie->data & DIR_DOWN) - { + if (ie->data & DIR_DOWN) { bot = obot[joy] = pos; - if (vertclear[joy] && bot) { - vertclear[joy] = 0; - top = otop[joy] = 0; - } } } mouse_deltanoreset[joy][0] = 1; @@ -3278,129 +2899,81 @@ static int handle_input_event (int nr, int state, int max, int autofire, bool ca if (bot) joydir[joy] |= DIR_DOWN; if (joy == 0 || joy == 1) - joymousecounter(joy); + joymousecounter (joy); } break; case 0: /* ->KEY */ - inputdevice_do_keyboard(ie->data, state); + inputdevice_do_keyboard (ie->data, state); break; - } + } return 1; } -static void inputdevice_checkconfig(void) +static void inputdevice_checkconfig (void) { - if ( - currprefs.jports[0].id != changed_prefs.jports[0].id || - currprefs.jports[1].id != changed_prefs.jports[1].id || - currprefs.jports[2].id != changed_prefs.jports[2].id || - currprefs.jports[3].id != changed_prefs.jports[3].id || - - currprefs.jports[0].mode != changed_prefs.jports[0].mode || - currprefs.jports[1].mode != changed_prefs.jports[1].mode || - currprefs.jports[2].mode != changed_prefs.jports[2].mode || - currprefs.jports[3].mode != changed_prefs.jports[3].mode || + bool changed = false; + for (int i = 0; i < MAX_JPORTS; i++) { + if (currprefs.jports[i].id != changed_prefs.jports[i].id || + currprefs.jports[i].mode != changed_prefs.jports[i].mode) + changed = true; + } + if (changed || currprefs.input_selected_setting != changed_prefs.input_selected_setting || currprefs.input_joymouse_multiplier != changed_prefs.input_joymouse_multiplier || currprefs.input_joymouse_deadzone != changed_prefs.input_joymouse_deadzone || currprefs.input_joystick_deadzone != changed_prefs.input_joystick_deadzone || currprefs.input_joymouse_speed != changed_prefs.input_joymouse_speed || currprefs.input_autofire_linecnt != changed_prefs.input_autofire_linecnt || - currprefs.input_mouse_speed != changed_prefs.input_mouse_speed) - { - currprefs.input_selected_setting = changed_prefs.input_selected_setting; - currprefs.input_joymouse_multiplier = changed_prefs.input_joymouse_multiplier; - currprefs.input_joymouse_deadzone = changed_prefs.input_joymouse_deadzone; - currprefs.input_joystick_deadzone = changed_prefs.input_joystick_deadzone; - currprefs.input_joymouse_speed = changed_prefs.input_joymouse_speed; - currprefs.input_autofire_linecnt = changed_prefs.input_autofire_linecnt; - currprefs.input_mouse_speed = changed_prefs.input_mouse_speed; + currprefs.input_mouse_speed != changed_prefs.input_mouse_speed) { - inputdevice_updateconfig(&changed_prefs, &currprefs); + currprefs.input_selected_setting = changed_prefs.input_selected_setting; + currprefs.input_joymouse_multiplier = changed_prefs.input_joymouse_multiplier; + currprefs.input_joymouse_deadzone = changed_prefs.input_joymouse_deadzone; + currprefs.input_joystick_deadzone = changed_prefs.input_joystick_deadzone; + currprefs.input_joymouse_speed = changed_prefs.input_joymouse_speed; + currprefs.input_autofire_linecnt = changed_prefs.input_autofire_linecnt; + currprefs.input_mouse_speed = changed_prefs.input_mouse_speed; + + inputdevice_updateconfig (&changed_prefs, &currprefs); } } -void inputdevice_vsync() +void inputdevice_vsync (void) { input_frame++; - mouseupdate(0, true); + mouseupdate (0, true); -#ifndef INPUTDEVICE_SIMPLE - struct delayed_event *de = delayed_events; - while (de) { - if (de->delay > 0) - de->delay--; - if (de->delay == 0) { - de->delay = -1; - if (de->event_string) { - TCHAR *s = de->event_string; - de->event_string = NULL; - handle_custom_event (s); - xfree (s); - } - } - de = de->next; - } -#endif - - inputdevice_read(); + inputdevice_read (); inputdelay = uaerand () % (maxvpos <= 1 ? 1 : maxvpos - 1); - inputdevice_handle_inputcode(); - if (mouseedge_alive > 0) - mouseedge_alive--; -#ifdef ARCADIA - if (arcadia_bios) - arcadia_vsync(); -#endif - //if (mouseedge()) - // mouseedge_alive = 10; + inputdevice_handle_inputcode (); if (mousehack_alive_cnt > 0) { mousehack_alive_cnt--; - //if (mousehack_alive_cnt == 0) - // setmouseactive(-1); - } - else if (mousehack_alive_cnt < 0) { + } else if (mousehack_alive_cnt < 0) { mousehack_alive_cnt++; if (mousehack_alive_cnt == 0) { mousehack_alive_cnt = 100; - //setmouseactive(0); - //setmouseactive(1); } } - inputdevice_checkconfig(); + inputdevice_checkconfig (); } - -void inputdevice_reset() +void inputdevice_reset (void) { - magicmouse_ibase = 0; - magicmouse_gfxbase = 0; - mousehack_reset(); - if (inputdevice_is_tablet()) - mousehack_enable(); -#ifndef INPUTDEVICE_SIMPLE - while (delayed_events) { - struct delayed_event *de = delayed_events; - delayed_events = de->next; - xfree (de->event_string); - xfree (de); - } -#endif + mousehack_reset (); + if (inputdevice_is_tablet ()) + mousehack_enable (); } -static int getoldport(struct uae_input_device* id) +static int getoldport (struct uae_input_device *id) { int i, j; - for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) - { - for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) - { + for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { + for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) { int evt = id->eventid[i][j]; - if (evt > 0) - { + if (evt > 0) { int unit = events[evt].unit; if (unit >= 1 && unit <= 4) return unit; @@ -3410,211 +2983,181 @@ static int getoldport(struct uae_input_device* id) return -1; } -static int switchdevice(struct uae_input_device* id, int num, bool buttonmode) +static int switchdevice (struct uae_input_device *id, int num, bool buttonmode) { - int i, j; int ismouse = 0; int newport = 0; + int newslot = -1; int flags = 0; - const char* name = NULL; + const TCHAR *name = NULL, *fname = NULL; int otherbuttonpressed = 0; int acc = input_acquired; if (num >= 4) return 0; - for (i = 0; i < MAX_INPUT_DEVICES; i++) - { - if (id == &joysticks[i]) - { - name = idev[IDTYPE_JOYSTICK].get_uniquename(i); + if (!target_can_autoswitchdevice()) + return 0; + + for (int i = 0; i < MAX_INPUT_DEVICES; i++) { + if (id == &joysticks[i]) { + name = idev[IDTYPE_JOYSTICK].get_uniquename (i); + fname = idev[IDTYPE_JOYSTICK].get_friendlyname (i); newport = num == 0 ? 1 : 0; - flags = idev[IDTYPE_JOYSTICK].get_flags(i); - for (j = 0; j < MAX_INPUT_DEVICES; j++) - { - if (j != i) - { - struct uae_input_device2* id2 = &joysticks2[j]; + flags = idev[IDTYPE_JOYSTICK].get_flags (i); + for (int j = 0; j < MAX_INPUT_DEVICES; j++) { + if (j != i) { + struct uae_input_device2 *id2 = &joysticks2[j]; if (id2->buttonmask) otherbuttonpressed = 1; } } } - if (id == &mice[i]) - { + if (id == &mice[i]) { ismouse = 1; - name = idev[IDTYPE_MOUSE].get_uniquename(i); + name = idev[IDTYPE_MOUSE].get_uniquename (i); + fname = idev[IDTYPE_MOUSE].get_friendlyname (i); newport = num == 0 ? 0 : 1; - flags = idev[IDTYPE_MOUSE].get_flags(i); + flags = idev[IDTYPE_MOUSE].get_flags (i); } } - if (!name) - { + if (!name) { return 0; } - if (buttonmode) - { + if (buttonmode) { if (num == 0 && otherbuttonpressed) newport = newport ? 0 : 1; - } - else - { + } else { newport = num ? 1 : 0; } /* "GamePorts" switch if in GamePorts mode or Input mode and GamePorts port was not NONE */ - if (currprefs.input_selected_setting == GAMEPORT_INPUT_SETTINGS || currprefs.jports[newport].id != JPORT_NONE) - { - if ((num == 0 || num == 1) && !JSEM_ISCUSTOM(newport, &currprefs)) - { + if (currprefs.input_selected_setting == GAMEPORT_INPUT_SETTINGS || currprefs.jports[newport].id != JPORT_NONE) { + if ((num == 0 || num == 1)) { bool issupermouse = false; - int om = jsem_ismouse(num, &currprefs); - int om1 = jsem_ismouse(0, &currprefs); - int om2 = jsem_ismouse(1, &currprefs); - if ((om1 >= 0 || om2 >= 0) && ismouse) - { + int om = jsem_ismouse (num, &currprefs); + int om1 = jsem_ismouse (0, &currprefs); + int om2 = jsem_ismouse (1, &currprefs); + if ((om1 >= 0 || om2 >= 0) && ismouse) { return 0; } - if (flags) - { + if (flags) { return 0; } + #if 1 - if (ismouse) - { + if (ismouse) { int nummouse = 0; // count number of non-supermouse mice int supermouse = -1; - for (i = 0; i < idev[IDTYPE_MOUSE].get_num(); i++) - { - if (!idev[IDTYPE_MOUSE].get_flags(i)) + for (int i = 0; i < idev[IDTYPE_MOUSE].get_num (); i++) { + if (!idev[IDTYPE_MOUSE].get_flags (i)) nummouse++; else supermouse = i; } - if (supermouse >= 0 && nummouse == 1) - { - const char* oldname = name; - name = idev[IDTYPE_MOUSE].get_uniquename(supermouse); + if (supermouse >= 0 && nummouse == 1) { + const TCHAR* oldname = name; + name = idev[IDTYPE_MOUSE].get_uniquename (supermouse); + fname = idev[IDTYPE_MOUSE].get_friendlyname(supermouse); issupermouse = true; } } #endif - inputdevice_unacquire(); + inputdevice_unacquire (); - if (currprefs.input_selected_setting != GAMEPORT_INPUT_SETTINGS && currprefs.jports[newport].id > JPORT_NONE) - { + if (currprefs.input_selected_setting != GAMEPORT_INPUT_SETTINGS && currprefs.jports[newport].id > JPORT_NONE) { // disable old device int devnum; devnum = jsem_ismouse(newport, &currprefs); - if (devnum >= 0) - { - if (changed_prefs.mouse_settings[currprefs.input_selected_setting][devnum].enabled) - { + if (devnum >= 0) { + if (changed_prefs.mouse_settings[currprefs.input_selected_setting][devnum].enabled) { changed_prefs.mouse_settings[currprefs.input_selected_setting][devnum].enabled = false; } } - for (int l = 0; l < idev[IDTYPE_MOUSE].get_num(); l++) - { - if (changed_prefs.mouse_settings[currprefs.input_selected_setting][l].enabled) - { - if (idev[IDTYPE_MOUSE].get_flags(l)) - { + for (int l = 0; l < idev[IDTYPE_MOUSE].get_num(); l++) { + if (changed_prefs.mouse_settings[currprefs.input_selected_setting][l].enabled) { + if (idev[IDTYPE_MOUSE].get_flags(l)) { issupermouse = true; } } } - if (issupermouse) - { + if (issupermouse) { // new mouse is supermouse, disable all other mouse devices - for (int l = 0; l < MAX_INPUT_DEVICES; l++) - { + for (int l = 0; l < MAX_INPUT_DEVICES; l++) { changed_prefs.mouse_settings[currprefs.input_selected_setting][l].enabled = false; } } devnum = jsem_isjoy(newport, &currprefs); - if (devnum >= 0) - { - if (changed_prefs.joystick_settings[currprefs.input_selected_setting][devnum].enabled) - { + if (devnum >= 0) { + if (changed_prefs.joystick_settings[currprefs.input_selected_setting][devnum].enabled) { changed_prefs.joystick_settings[currprefs.input_selected_setting][devnum].enabled = false; } } } - inputdevice_joyport_config(&changed_prefs, name, newport, -1, 2, false); - inputdevice_validate_jports(&changed_prefs, -1); - inputdevice_copyconfig(&changed_prefs, &currprefs); + if (newslot >= 0) { + TCHAR cust[100]; + _stprintf(cust, _T("custom%d"), newslot); + inputdevice_joyport_config(&changed_prefs, cust, cust, newport, -1, 0, true); + } else { + inputdevice_joyport_config (&changed_prefs, name, name, newport, -1, 1, true); + } + inputdevice_validate_jports (&changed_prefs, -1, NULL); + inputdevice_copyconfig (&changed_prefs, &currprefs); if (acc) - inputdevice_acquire(TRUE); + inputdevice_acquire (TRUE); return 1; } return 0; - } - else - { - int oldport = getoldport(id); + + } else { + int oldport = getoldport (id); int k, evt; - struct inputevent *ie, *ie2; + const struct inputevent *ie, *ie2; if (flags) return 0; - if (oldport <= 0) - { + if (oldport <= 0) { return 0; } newport++; /* do not switch if switching mouse and any "supermouse" mouse enabled */ - if (ismouse) - { - for (i = 0; i < MAX_INPUT_SETTINGS; i++) - { - if (mice[i].enabled && idev[IDTYPE_MOUSE].get_flags(i)) - { + if (ismouse) { + for (int i = 0; i < MAX_INPUT_SETTINGS; i++) { + if (mice[i].enabled && idev[IDTYPE_MOUSE].get_flags (i)) { return 0; - } - } + } + } } - for (i = 0; i < MAX_INPUT_SETTINGS; i++) - { - if (getoldport(&joysticks[i]) == newport) - { + for (int i = 0; i < MAX_INPUT_SETTINGS; i++) { + if (getoldport (&joysticks[i]) == newport) { joysticks[i].enabled = 0; - } - if (getoldport(&mice[i]) == newport) - { + } + if (getoldport (&mice[i]) == newport) { mice[i].enabled = 0; - } - } + } + } id->enabled = 1; - for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) - { - for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) - { + for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { + for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) { evt = id->eventid[i][j]; if (evt <= 0) continue; ie = &events[evt]; - if (ie->unit == oldport) - { + if (ie->unit == oldport) { k = 1; - while (events[k].confname) - { + while (events[k].confname) { ie2 = &events[k]; - if (ie2->type == ie->type && ie2->data == ie->data && ie2->allow_mask == ie->allow_mask && ie2->unit == newport) - { + if (ie2->type == ie->type && ie2->data == ie->data && ie2->allow_mask == ie->allow_mask && ie2->unit == newport) { id->eventid[i][j] = k; break; } k++; } - } - else if (ie->unit == newport) - { + } else if (ie->unit == newport) { k = 1; - while (events[k].confname) - { + while (events[k].confname) { ie2 = &events[k]; - if (ie2->type == ie->type && ie2->data == ie->data && ie2->allow_mask == ie->allow_mask && ie2->unit == oldport) - { + if (ie2->type == ie->type && ie2->data == ie->data && ie2->allow_mask == ie->allow_mask && ie2->unit == oldport) { id->eventid[i][j] = k; break; } @@ -3624,26 +3167,26 @@ static int switchdevice(struct uae_input_device* id, int num, bool buttonmode) } } write_log (_T("inputdevice input change '%s':%d->%d\n"), name, num, newport); - inputdevice_unacquire(); - inputdevice_copyconfig(&currprefs, &changed_prefs); - inputdevice_validate_jports(&changed_prefs, -1); - inputdevice_copyconfig(&changed_prefs, &currprefs); + inputdevice_unacquire (); + inputdevice_copyconfig (&currprefs, &changed_prefs); + inputdevice_validate_jports (&changed_prefs, -1, NULL); + inputdevice_copyconfig (&changed_prefs, &currprefs); if (acc) - inputdevice_acquire(TRUE); + inputdevice_acquire (TRUE); return 1; } return 0; } -uae_u64 input_getqualifiers(void) +uae_u64 input_getqualifiers (void) { return qualifiers; } -static bool checkqualifiers(int evt, uae_u64 flags, uae_u64* qualmask, uae_s16 events[MAX_INPUT_SUB_EVENT_ALL]) +static bool checkqualifiers (int evt, uae_u64 flags, uae_u64 *qualmask, uae_s16 events[MAX_INPUT_SUB_EVENT_ALL]) { int i, j; - int qualid = getqualid(evt); + int qualid = getqualid (evt); int nomatch = 0; bool isspecial = (qualifiers & (ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SPECIAL_R)) != 0; @@ -3654,43 +3197,37 @@ static bool checkqualifiers(int evt, uae_u64 flags, uae_u64* qualmask, uae_s16 e if ((qualifiers & (ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SPECIAL_R)) && qualid >= 0) return false; - for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) - { + for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) { if (qualmask[i]) break; } - if (i == MAX_INPUT_SUB_EVENT) - { - // no qualifiers in any slot and no special = always match + if (i == MAX_INPUT_SUB_EVENT) { + // no qualifiers in any slot and no special = always match return isspecial == false; } - for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) - { - for (j = 0; j < MAX_INPUT_QUALIFIERS; j++) - { + // do we have any subevents with qualifier set? + for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) { + for (j = 0; j < MAX_INPUT_QUALIFIERS; j++) { uae_u64 mask = (ID_FLAG_QUALIFIER1 | ID_FLAG_QUALIFIER1_R) << (j * 2); bool isqualmask = (qualmask[i] & mask) != 0; bool isqual = (qualifiers & mask) != 0; - if (isqualmask != isqual) - { + if (isqualmask != isqual) { nomatch++; break; } } } - if (nomatch == MAX_INPUT_SUB_EVENT) - { + if (nomatch == MAX_INPUT_SUB_EVENT) { // no matched qualifiers in any slot // allow all slots without qualifiers // special = never accept if (isspecial) - return false; + return false; return flags ? false : true; - } + } - for (i = 0; i < MAX_INPUT_QUALIFIERS; i++) - { + for (i = 0; i < MAX_INPUT_QUALIFIERS; i++) { uae_u64 mask = (ID_FLAG_QUALIFIER1 | ID_FLAG_QUALIFIER1_R) << (i * 2); bool isflags = (flags & mask) != 0; bool isqual = (qualifiers & mask) != 0; @@ -3700,134 +3237,36 @@ static bool checkqualifiers(int evt, uae_u64 flags, uae_u64* qualmask, uae_s16 e return true; } -static void setqualifiers(int evt, int state) +static void setqualifiers (int evt, int state) { - uae_u64 mask = isqual(evt); + uae_u64 mask = isqual (evt); if (!mask) return; if (state) qualifiers |= mask; else qualifiers &= ~mask; - //write_log (_T("%llx\n"), qualifiers); } -static uae_u64 getqualmask(uae_u64* qualmask, struct uae_input_device* id, int num, bool* qualonly) +static uae_u64 getqualmask (uae_u64 *qualmask, struct uae_input_device *id, int num, bool *qualonly) { uae_u64 mask = 0, mask2 = 0; - for (int i = 0; i < MAX_INPUT_SUB_EVENT; i++) - { + for (int i = 0; i < MAX_INPUT_SUB_EVENT; i++) { int evt = id->eventid[num][i]; mask |= id->flags[num][i]; qualmask[i] = id->flags[num][i] & ID_FLAG_QUALIFIER_MASK; - mask2 |= isqual(evt); + mask2 |= isqual (evt); } mask &= ID_FLAG_QUALIFIER_MASK; *qualonly = false; - if (qualifiers & ID_FLAG_QUALIFIER_SPECIAL) - { + if (qualifiers & ID_FLAG_QUALIFIER_SPECIAL) { // ID_FLAG_QUALIFIER_SPECIAL already active and this event has one or more qualifiers configured *qualonly = mask2 != 0; } return mask; } -#ifndef INPUTDEVICE_SIMPLE -static bool process_custom_event (struct uae_input_device *id, int offset, int state, uae_u64 *qualmask, int autofire, int sub) -{ - int idx, slotoffset, custompos; - TCHAR *custom; - uae_u64 flags, qual; - - if (!id) - return false; - - slotoffset = sub & ~3; - sub &= 3; - flags = id->flags[offset][slotoffset]; - qual = flags & ID_FLAG_QUALIFIER_MASK; - custom = id->custom[offset][slotoffset]; - int af = flags & ID_FLAG_AUTOFIRE_MASK; - - for (idx = 1; idx < 4; idx++) { - uae_u64 flags2 = id->flags[offset][slotoffset + idx]; - TCHAR *custom2 = id->custom[offset][slotoffset + idx]; - -// all slots must have same qualifier - if ((flags2 & ID_FLAG_QUALIFIER_MASK) != qual) - break; -// no slot must have autofire - if ((flags2 & ID_FLAG_AUTOFIRE_MASK) || (flags & ID_FLAG_AUTOFIRE_MASK)) - break; - } -// at least slot 0 and 2 must have custom - if (custom == NULL || id->custom[offset][slotoffset + 2] == NULL) - idx = -1; - - if (idx < 4) { - id->flags[offset][slotoffset] &= ~(ID_FLAG_CUSTOMEVENT_TOGGLED1 | ID_FLAG_CUSTOMEVENT_TOGGLED2); - int evt2 = id->eventid[offset][slotoffset + sub]; - uae_u64 flags2 = id->flags[offset][slotoffset + sub]; - if (checkqualifiers (evt2, flags2, qualmask, NULL)) { - custom = id->custom[offset][slotoffset + sub]; - if (state && custom) { - if (autofire) - queue_input_event (-1, custom, 1, 1, currprefs.input_autofire_linecnt, 1); - handle_custom_event (custom); - return true; - } - } - return false; - } - - if (sub != 0) - return false; - - slotoffset = 0; - if (!checkqualifiers (id->eventid[offset][slotoffset], id->flags[offset][slotoffset], qualmask, NULL)) { - slotoffset = 4; - if (!checkqualifiers (id->eventid[offset][slotoffset], id->flags[offset][slotoffset], qualmask, NULL)) - return false; - } - - flags = id->flags[offset][slotoffset]; - custompos = (flags & ID_FLAG_CUSTOMEVENT_TOGGLED1) ? 1 : 0; - custompos |= (flags & ID_FLAG_CUSTOMEVENT_TOGGLED2) ? 2 : 0; - - if (state < 0) { - idx = 0; - custompos = 0; - } else { - if (state > 0) { - if (custompos & 1) - return false; // waiting for release - } else { - if (!(custompos & 1)) - return false; // waiting for press - } - idx = custompos; - custompos++; - } - - queue_input_event (-1, NULL, -1, 0, 0, 1); - - if ((id->flags[offset][slotoffset + idx] & ID_FLAG_QUALIFIER_MASK) == qual) { - custom = id->custom[offset][slotoffset + idx]; - if (autofire) - queue_input_event (-1, custom, 1, 1, currprefs.input_autofire_linecnt, 1); - if (custom) - handle_custom_event (custom); - } - - id->flags[offset][slotoffset] &= ~(ID_FLAG_CUSTOMEVENT_TOGGLED1 | ID_FLAG_CUSTOMEVENT_TOGGLED2); - id->flags[offset][slotoffset] |= (custompos & 1) ? ID_FLAG_CUSTOMEVENT_TOGGLED1 : 0; - id->flags[offset][slotoffset] |= (custompos & 2) ? ID_FLAG_CUSTOMEVENT_TOGGLED2 : 0; - - return true; -} -#endif - -static void setbuttonstateall(struct uae_input_device* id, struct uae_input_device2* id2, int button, int buttonstate) +static void setbuttonstateall (struct uae_input_device *id, struct uae_input_device2 *id2, int button, int buttonstate) { static frame_time_t switchdevice_timeout; int i; @@ -3836,131 +3275,109 @@ static void setbuttonstateall(struct uae_input_device* id, struct uae_input_devi uae_u32 nmask = (buttonstate ? 1 : 0) << button; uae_u64 qualmask[MAX_INPUT_SUB_EVENT]; bool qualonly; + bool doit = true; if (!id->enabled) { - frame_time_t t = read_processor_time(); + frame_time_t t = read_processor_time (); + if (!t) + t++; if (buttonstate) { switchdevice_timeout = t; - } - else { - int port = button; - if (t - switchdevice_timeout >= syncbase) // 1s - port ^= 1; - switchdevice(id, port, true); - } + } else { + if (switchdevice_timeout) { + int port = button; + if (t - switchdevice_timeout >= syncbase) // 1s + port ^= 1; + switchdevice (id, port, true); + } + switchdevice_timeout = 0; + } return; } if (button >= ID_BUTTON_TOTAL) return; - getqualmask(qualmask, id, ID_BUTTON_OFFSET + button, &qualonly); + if (doit) { + getqualmask (qualmask, id, ID_BUTTON_OFFSET + button, &qualonly); - bool didcustom = false; + for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) { + int sub = sublevdir[buttonstate == 0 ? 1 : 0][i]; + uae_u64 *flagsp = &id->flags[ID_BUTTON_OFFSET + button][sub]; + int evt = id->eventid[ID_BUTTON_OFFSET + button][sub]; + uae_u64 flags = flagsp[0]; + int autofire = (flags & ID_FLAG_AUTOFIRE) ? 1 : 0; + int toggle = (flags & ID_FLAG_TOGGLE) ? 1 : 0; + int inverttoggle = (flags & ID_FLAG_INVERTTOGGLE) ? 1 : 0; + int invert = (flags & ID_FLAG_INVERT) ? 1 : 0; + int setmode = (flags & ID_FLAG_SET_ONOFF) ? 1: 0; + int setval = (flags & ID_FLAG_SET_ONOFF_VAL) ? SET_ONOFF_ON_VALUE : SET_ONOFF_OFF_VALUE; + int state; - for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) { - int sub = sublevdir[buttonstate == 0 ? 1 : 0][i]; - uae_u64 *flagsp = &id->flags[ID_BUTTON_OFFSET + button][sub]; - int evt = id->eventid[ID_BUTTON_OFFSET + button][sub]; - TCHAR *custom = id->custom[ID_BUTTON_OFFSET + button][sub]; - uae_u64 flags = flagsp[0]; - int autofire = (flags & ID_FLAG_AUTOFIRE) ? 1 : 0; - int toggle = (flags & ID_FLAG_TOGGLE) ? 1 : 0; - int inverttoggle = (flags & ID_FLAG_INVERTTOGGLE) ? 1 : 0; - int invert = (flags & ID_FLAG_INVERT) ? 1 : 0; - int setmode = (flags & ID_FLAG_SET_ONOFF) ? 1 : 0; - int setval = (flags & ID_FLAG_SET_ONOFF_VAL) ? SET_ONOFF_ON_VALUE : SET_ONOFF_OFF_VALUE; - int state; - - if (buttonstate < 0) { - state = buttonstate; - } - else if (invert) { - state = buttonstate ? 0 : 1; - } - else { - state = buttonstate; - } - if (setmode) { - if (state) - state = setval; - } - -#ifndef INPUTDEVICE_SIMPLE - if (!state) { - didcustom |= process_custom_event (id, ID_BUTTON_OFFSET + button, state, qualmask, autofire, i); - } -#endif - setqualifiers(evt, state > 0); - - if (qualonly) - continue; - -#ifndef INPUTDEVICE_SIMPLE - if (state < 0) { - if (!checkqualifiers(evt, flags, qualmask, NULL)) - continue; - handle_input_event(evt, 1, 1, 0, true, false); - didcustom |= process_custom_event(id, ID_BUTTON_OFFSET + button, state, qualmask, 0, i); - } - else if (inverttoggle) { - /* pressed = firebutton, not pressed = autofire */ - if (state) { - queue_input_event(evt, NULL, -1, 0, 0, 1); - handle_input_event(evt, 1, 1, 0, true, false); - } - else { - handle_input_event(evt, 1, 1, autofire, true, false); - } - didcustom |= process_custom_event(id, ID_BUTTON_OFFSET + button, state, qualmask, autofire, i); - } - else if (toggle) { - if (!state) - continue; - if (omask & mask) - continue; - if (!checkqualifiers(evt, flags, qualmask, NULL)) - continue; - *flagsp ^= ID_FLAG_TOGGLED; - int toggled = (*flagsp & ID_FLAG_TOGGLED) ? 1 : 0; - handle_input_event(evt, toggled, 1, autofire, true, false); - didcustom |= process_custom_event(id, ID_BUTTON_OFFSET + button, toggled, qualmask, autofire, i); - } - else { -#endif - if (!checkqualifiers(evt, flags, qualmask, NULL)) { - if (!state && !(flags & ID_FLAG_CANRELEASE)) { - if (!invert) - continue; - } - else if (state) { - continue; - } - } - if (!state) - *flagsp &= ~ID_FLAG_CANRELEASE; - else - *flagsp |= ID_FLAG_CANRELEASE; - if ((omask ^ nmask) & mask) { -#ifdef INPUTDEVICE_SIMPLE - handle_input_event(evt, state, 1, autofire); -#else - handle_input_event (evt, state, 1, autofire, true, false); + if (buttonstate < 0) { + state = buttonstate; + } else if (invert) { + state = buttonstate ? 0 : 1; + } else { + state = buttonstate; + } + if (setmode) { if (state) - didcustom |= process_custom_event (id, ID_BUTTON_OFFSET + button, state, qualmask, autofire, i); -#endif - } -#ifndef INPUTDEVICE_SIMPLE - } -#endif - } + state = setval; + } - if (!didcustom) -#ifdef INPUTDEVICE_SIMPLE - queue_input_event(-1, -1, 0, 0); -#else - queue_input_event (-1, NULL, -1, 0, 0, 1); + setqualifiers (evt, state > 0); + + if (qualonly) + continue; + +#ifndef INPUTDEVICE_SIMPLE + if (state < 0) { + if (!checkqualifiers (evt, flags, qualmask, NULL)) + continue; + handle_input_event (evt, 1, 1, 0); + } else if (inverttoggle) { + /* pressed = firebutton, not pressed = autofire */ + if (state) { + queue_input_event (evt, -1, 0, 0); + handle_input_event (evt, 2, 1, 0); + } else { + handle_input_event (evt, 2, 1, autofire); + } + } else if (toggle) { + if (!state) + continue; + if (omask & mask) + continue; + if (!checkqualifiers (evt, flags, qualmask, NULL)) + continue; + *flagsp ^= ID_FLAG_TOGGLED; + int toggled = (*flagsp & ID_FLAG_TOGGLED) ? 2 : 0; + handle_input_event (evt, toggled, 1, autofire); + } else { #endif + if (!checkqualifiers (evt, flags, qualmask, NULL)) { + if (!state && !(flags & ID_FLAG_CANRELEASE)) { + if (!invert) + continue; + } else if (state) { + continue; + } + } + if (!state) + *flagsp &= ~ID_FLAG_CANRELEASE; + else + *flagsp |= ID_FLAG_CANRELEASE; + if ((omask ^ nmask) & mask) { + handle_input_event (evt, state, 1, autofire); + } +#ifndef INPUTDEVICE_SIMPLE + } +#endif + } + + queue_input_event (-1, -1, 0, 0); + } if (id2 && ((omask ^ nmask) & mask)) { if (buttonstate) @@ -3976,50 +3393,46 @@ static void setbuttonstateall(struct uae_input_device* id, struct uae_input_devi * - detect device type in ports (mouse or joystick) */ -static int iscd32(int ei) +static int iscd32 (int ei) { - if (ei >= INPUTEVENT_JOY1_CD32_FIRST && ei <= INPUTEVENT_JOY1_CD32_LAST) - { + if (ei >= INPUTEVENT_JOY1_CD32_FIRST && ei <= INPUTEVENT_JOY1_CD32_LAST) { cd32_pad_enabled[0] = 1; return 1; } - if (ei >= INPUTEVENT_JOY2_CD32_FIRST && ei <= INPUTEVENT_JOY2_CD32_LAST) - { + if (ei >= INPUTEVENT_JOY2_CD32_FIRST && ei <= INPUTEVENT_JOY2_CD32_LAST) { cd32_pad_enabled[1] = 1; return 2; } return 0; } -#ifndef INPUTDEVICE_SIMPLE static int isparport (int ei) { +#if !defined(INPUTDEVICE_SIMPLE) || defined(AMIBERRY) if (ei > INPUTEVENT_PAR_JOY1_START && ei < INPUTEVENT_PAR_JOY_END) { parport_joystick_enabled = 1; return 1; } +#endif return 0; } -#endif -static int ismouse(int ei) +static int ismouse (int ei) { - if (ei >= INPUTEVENT_MOUSE1_FIRST && ei <= INPUTEVENT_MOUSE1_LAST) - { + if (ei >= INPUTEVENT_MOUSE1_FIRST && ei <= INPUTEVENT_MOUSE1_LAST) { mouse_port[0] = 1; return 1; } - if (ei >= INPUTEVENT_MOUSE2_FIRST && ei <= INPUTEVENT_MOUSE2_LAST) - { + if (ei >= INPUTEVENT_MOUSE2_FIRST && ei <= INPUTEVENT_MOUSE2_LAST) { mouse_port[1] = 1; return 2; } return 0; } -#ifndef INPUTDEVICE_SIMPLE static int isanalog (int ei) { +#ifndef INPUTDEVICE_SIMPLE if (ei == INPUTEVENT_JOY1_HORIZ_POT || ei == INPUTEVENT_JOY1_HORIZ_POT_INV) { analog_port[0][0] = 1; return 1; @@ -4036,66 +3449,60 @@ static int isanalog (int ei) analog_port[1][1] = 1; return 1; } +#endif return 0; } -#endif -static int isdigitalbutton(int ei) +static int isdigitalbutton (int ei) { - if (ei == INPUTEVENT_JOY1_2ND_BUTTON) - { + if (ei == INPUTEVENT_JOY1_2ND_BUTTON) { digital_port[0][1] = 1; return 1; } - if (ei == INPUTEVENT_JOY1_3RD_BUTTON) - { + if (ei == INPUTEVENT_JOY1_3RD_BUTTON) { digital_port[0][0] = 1; return 1; } - if (ei == INPUTEVENT_JOY2_2ND_BUTTON) - { + if (ei == INPUTEVENT_JOY2_2ND_BUTTON) { digital_port[1][1] = 1; return 1; } - if (ei == INPUTEVENT_JOY2_3RD_BUTTON) - { + if (ei == INPUTEVENT_JOY2_3RD_BUTTON) { digital_port[1][0] = 1; return 1; } return 0; } -//static int islightpen(int ei) -//{ -// if (ei >= INPUTEVENT_LIGHTPEN_FIRST && ei < INPUTEVENT_LIGHTPEN_LAST) { -// lightpen_enabled = true; -// return 1; -// } -// return 0; -//} - -static void isqualifier(int ei) +static void isqualifier (int ei) { } -static void scanevents(struct uae_prefs* p) +static void check_enable(int ei) +{ + iscd32(ei); + isparport(ei); + ismouse(ei); + isdigitalbutton(ei); + isqualifier(ei); +} + +static void scanevents (struct uae_prefs *p) { int i, j, k, ei; - const struct inputevent* e; - int n_joy = idev[IDTYPE_JOYSTICK].get_num(); - int n_mouse = idev[IDTYPE_MOUSE].get_num(); + const struct inputevent *e; + int n_joy = idev[IDTYPE_JOYSTICK].get_num (); + int n_mouse = idev[IDTYPE_MOUSE].get_num (); cd32_pad_enabled[0] = cd32_pad_enabled[1] = 0; -#ifndef INPUTDEVICE_SIMPLE +#if !defined(INPUTDEVICE_SIMPLE) || defined(AMIBERRY) parport_joystick_enabled = 0; #endif mouse_port[0] = mouse_port[1] = 0; qualifiers = 0; - for (i = 0; i < NORMAL_JPORTS; i++) - { - for (j = 0; j < 2; j++) - { + for (i = 0; i < NORMAL_JPORTS; i++) { + for (j = 0; j < 2; j++) { digital_port[i][j] = 0; #ifndef INPUTDEVICE_SIMPLE analog_port[i][j] = 0; @@ -4104,111 +3511,78 @@ static void scanevents(struct uae_prefs* p) } } - for (i = 0; i < MAX_INPUT_DEVICES; i++) - { + for (i = 0; i < MAX_INPUT_DEVICES; i++) { use_joysticks[i] = 0; use_mice[i] = 0; - for (k = 0; k < MAX_INPUT_SUB_EVENT; k++) - { - for (j = 0; j < ID_BUTTON_TOTAL; j++) - { - if ((joysticks[i].enabled && i < n_joy) || joysticks[i].enabled < 0) - { + for (k = 0; k < MAX_INPUT_SUB_EVENT; k++) { + for (j = 0; j < ID_BUTTON_TOTAL; j++) { + + if ((joysticks[i].enabled && i < n_joy) || joysticks[i].enabled < 0) { ei = joysticks[i].eventid[ID_BUTTON_OFFSET + j][k]; e = &events[ei]; - iscd32(ei); -#ifndef INPUTDEVICE_SIMPLE + iscd32 (ei); isparport (ei); -#endif - ismouse(ei); - isdigitalbutton(ei); -#ifndef INPUTDEVICE_SIMPLE + ismouse (ei); + isdigitalbutton (ei); isqualifier (ei); -#endif if (joysticks[i].eventid[ID_BUTTON_OFFSET + j][k] > 0) use_joysticks[i] = 1; } - if ((mice[i].enabled && i < n_mouse) || mice[i].enabled < 0) - { + if ((mice[i].enabled && i < n_mouse) || mice[i].enabled < 0) { ei = mice[i].eventid[ID_BUTTON_OFFSET + j][k]; e = &events[ei]; - iscd32(ei); -#ifndef INPUTDEVICE_SIMPLE + iscd32 (ei); isparport (ei); -#endif - ismouse(ei); - isdigitalbutton(ei); -#ifndef INPUTDEVICE_SIMPLE + ismouse (ei); + isdigitalbutton (ei); isqualifier (ei); -#endif if (mice[i].eventid[ID_BUTTON_OFFSET + j][k] > 0) use_mice[i] = 1; } + } - for (j = 0; j < ID_AXIS_TOTAL; j++) - { - if ((joysticks[i].enabled && i < n_joy) || joysticks[i].enabled < 0) - { + for (j = 0; j < ID_AXIS_TOTAL; j++) { + + if ((joysticks[i].enabled && i < n_joy) || joysticks[i].enabled < 0) { ei = joysticks[i].eventid[ID_AXIS_OFFSET + j][k]; - iscd32(ei); -#ifndef INPUTDEVICE_SIMPLE + iscd32 (ei); isparport (ei); -#endif - ismouse(ei); -#ifndef INPUTDEVICE_SIMPLE + ismouse (ei); isanalog (ei); -#endif - isdigitalbutton(ei); -#ifndef INPUTDEVICE_SIMPLE + isdigitalbutton (ei); isqualifier (ei); -#endif if (ei > 0) use_joysticks[i] = 1; } - if ((mice[i].enabled && i < n_mouse) || mice[i].enabled < 0) - { + if ((mice[i].enabled && i < n_mouse) || mice[i].enabled < 0) { ei = mice[i].eventid[ID_AXIS_OFFSET + j][k]; - iscd32(ei); -#ifndef INPUTDEVICE_SIMPLE + iscd32 (ei); isparport (ei); -#endif - ismouse(ei); -#ifndef INPUTDEVICE_SIMPLE + ismouse (ei); isanalog (ei); -#endif - isdigitalbutton(ei); -#ifndef INPUTDEVICE_SIMPLE + isdigitalbutton (ei); isqualifier (ei); -#endif if (ei > 0) use_mice[i] = 1; } } } } - memset(scancodeused, 0, sizeof scancodeused); - for (i = 0; i < MAX_INPUT_DEVICES; i++) - { + memset (scancodeused, 0, sizeof scancodeused); + for (i = 0; i < MAX_INPUT_DEVICES; i++) { use_keyboards[i] = 0; - if (keyboards[i].enabled && i < idev[IDTYPE_KEYBOARD].get_num()) - { + if (keyboards[i].enabled && i < idev[IDTYPE_KEYBOARD].get_num ()) { j = 0; - while (j < MAX_INPUT_DEVICE_EVENTS && keyboards[i].extra[j] >= 0) - { + while (j < MAX_INPUT_DEVICE_EVENTS && keyboards[i].extra[j] >= 0) { use_keyboards[i] = 1; - for (k = 0; k < MAX_INPUT_SUB_EVENT; k++) - { + for (k = 0; k < MAX_INPUT_SUB_EVENT; k++) { ei = keyboards[i].eventid[j][k]; - iscd32(ei); -#ifndef INPUTDEVICE_SIMPLE + iscd32 (ei); isparport (ei); -#endif - ismouse(ei); - isdigitalbutton(ei); -#ifndef INPUTDEVICE_SIMPLE + ismouse (ei); + isdigitalbutton (ei); isqualifier (ei); -#endif if (ei > 0) scancodeused[i][keyboards[i].extra[j]] = ei; } @@ -4227,21 +3601,16 @@ static const int axistable[] = { INPUTEVENT_JOY1_VERT, INPUTEVENT_JOY1_UP, INPUTEVENT_JOY1_DOWN, INPUTEVENT_JOY2_HORIZ, INPUTEVENT_JOY2_LEFT, INPUTEVENT_JOY2_RIGHT, INPUTEVENT_JOY2_VERT, INPUTEVENT_JOY2_UP, INPUTEVENT_JOY2_DOWN, - INPUTEVENT_LIGHTPEN_HORIZ, INPUTEVENT_LIGHTPEN_LEFT, INPUTEVENT_LIGHTPEN_RIGHT, - INPUTEVENT_LIGHTPEN_VERT, INPUTEVENT_LIGHTPEN_UP, INPUTEVENT_LIGHTPEN_DOWN, INPUTEVENT_PAR_JOY1_HORIZ, INPUTEVENT_PAR_JOY1_LEFT, INPUTEVENT_PAR_JOY1_RIGHT, INPUTEVENT_PAR_JOY1_VERT, INPUTEVENT_PAR_JOY1_UP, INPUTEVENT_PAR_JOY1_DOWN, INPUTEVENT_PAR_JOY2_HORIZ, INPUTEVENT_PAR_JOY2_LEFT, INPUTEVENT_PAR_JOY2_RIGHT, INPUTEVENT_PAR_JOY2_VERT, INPUTEVENT_PAR_JOY2_UP, INPUTEVENT_PAR_JOY2_DOWN, - INPUTEVENT_MOUSE_CDTV_HORIZ, INPUTEVENT_MOUSE_CDTV_LEFT, INPUTEVENT_MOUSE_CDTV_RIGHT, - INPUTEVENT_MOUSE_CDTV_VERT, INPUTEVENT_MOUSE_CDTV_UP, INPUTEVENT_MOUSE_CDTV_DOWN, -1 }; -int intputdevice_compa_get_eventtype(int evt, const int** axistablep) +int intputdevice_compa_get_eventtype (int evt, const int **axistablep) { - for (int i = 0; axistable[i] >= 0; i += 3) - { + for (int i = 0; axistable[i] >= 0; i += 3) { *axistablep = &axistable[i]; if (axistable[i] == evt) return IDEV_WIDGET_AXIS; @@ -4254,7 +3623,7 @@ int intputdevice_compa_get_eventtype(int evt, const int** axistablep) return IDEV_WIDGET_BUTTON; } -static int rem_port1[] = { +static const int rem_port1[] = { INPUTEVENT_MOUSE1_HORIZ, INPUTEVENT_MOUSE1_VERT, INPUTEVENT_JOY1_HORIZ, INPUTEVENT_JOY1_VERT, #ifndef INPUTDEVICE_SIMPLE @@ -4263,11 +3632,9 @@ static int rem_port1[] = { INPUTEVENT_JOY1_FIRE_BUTTON, INPUTEVENT_JOY1_2ND_BUTTON, INPUTEVENT_JOY1_3RD_BUTTON, INPUTEVENT_JOY1_CD32_RED, INPUTEVENT_JOY1_CD32_BLUE, INPUTEVENT_JOY1_CD32_GREEN, INPUTEVENT_JOY1_CD32_YELLOW, INPUTEVENT_JOY1_CD32_RWD, INPUTEVENT_JOY1_CD32_FFW, INPUTEVENT_JOY1_CD32_PLAY, - INPUTEVENT_MOUSE_CDTV_HORIZ, INPUTEVENT_MOUSE_CDTV_VERT, - INPUTEVENT_LIGHTPEN_HORIZ, INPUTEVENT_LIGHTPEN_VERT, -1 }; -static int rem_port2[] = { +static const int rem_port2[] = { INPUTEVENT_MOUSE2_HORIZ, INPUTEVENT_MOUSE2_VERT, INPUTEVENT_JOY2_HORIZ, INPUTEVENT_JOY2_VERT, #ifndef INPUTDEVICE_SIMPLE @@ -4280,150 +3647,101 @@ static int rem_port2[] = { -1, -1, -1 }; -static int rem_port3[] = { +static const int rem_port3[] = { INPUTEVENT_PAR_JOY1_LEFT, INPUTEVENT_PAR_JOY1_RIGHT, INPUTEVENT_PAR_JOY1_UP, INPUTEVENT_PAR_JOY1_DOWN, INPUTEVENT_PAR_JOY1_FIRE_BUTTON, INPUTEVENT_PAR_JOY1_2ND_BUTTON, -1 }; -static int rem_port4[] = { +static const int rem_port4[] = { INPUTEVENT_PAR_JOY2_LEFT, INPUTEVENT_PAR_JOY2_RIGHT, INPUTEVENT_PAR_JOY2_UP, INPUTEVENT_PAR_JOY2_DOWN, INPUTEVENT_PAR_JOY2_FIRE_BUTTON, INPUTEVENT_PAR_JOY2_2ND_BUTTON, -1 }; -static int* rem_ports[] = {rem_port1, rem_port2, rem_port3, rem_port4}; -static int af_port1[] = { - INPUTEVENT_JOY1_FIRE_BUTTON, INPUTEVENT_JOY1_CD32_RED, - -1 -}; -static int af_port2[] = { - INPUTEVENT_JOY2_FIRE_BUTTON, INPUTEVENT_JOY2_CD32_RED, - -1 -}; -static int af_port3[] = { - INPUTEVENT_PAR_JOY1_FIRE_BUTTON, INPUTEVENT_PAR_JOY1_2ND_BUTTON, - -1 -}; -static int af_port4[] = { - INPUTEVENT_PAR_JOY2_FIRE_BUTTON, INPUTEVENT_PAR_JOY2_2ND_BUTTON, - -1 -}; -static int* af_ports[] = {af_port1, af_port2, af_port3, af_port4}; -static int ip_joy1[] = { +static const int *rem_ports[] = { rem_port1, rem_port2, rem_port3, rem_port4 }; +static const int ip_joy1[] = { INPUTEVENT_JOY1_LEFT, INPUTEVENT_JOY1_RIGHT, INPUTEVENT_JOY1_UP, INPUTEVENT_JOY1_DOWN, INPUTEVENT_JOY1_FIRE_BUTTON, INPUTEVENT_JOY1_2ND_BUTTON, -1 }; -static int ip_joy2[] = { +static const int ip_joy2[] = { INPUTEVENT_JOY2_LEFT, INPUTEVENT_JOY2_RIGHT, INPUTEVENT_JOY2_UP, INPUTEVENT_JOY2_DOWN, INPUTEVENT_JOY2_FIRE_BUTTON, INPUTEVENT_JOY2_2ND_BUTTON, -1 }; -static int ip_joypad1[] = { +static const int ip_joypad1[] = { INPUTEVENT_JOY1_LEFT, INPUTEVENT_JOY1_RIGHT, INPUTEVENT_JOY1_UP, INPUTEVENT_JOY1_DOWN, INPUTEVENT_JOY1_FIRE_BUTTON, INPUTEVENT_JOY1_2ND_BUTTON, INPUTEVENT_JOY1_3RD_BUTTON, -1 }; -static int ip_joypad2[] = { +static const int ip_joypad2[] = { INPUTEVENT_JOY2_LEFT, INPUTEVENT_JOY2_RIGHT, INPUTEVENT_JOY2_UP, INPUTEVENT_JOY2_DOWN, INPUTEVENT_JOY2_FIRE_BUTTON, INPUTEVENT_JOY2_2ND_BUTTON, INPUTEVENT_JOY2_3RD_BUTTON, -1 }; -static int ip_joycd321[] = { +static const int ip_joycd321[] = { INPUTEVENT_JOY1_LEFT, INPUTEVENT_JOY1_RIGHT, INPUTEVENT_JOY1_UP, INPUTEVENT_JOY1_DOWN, INPUTEVENT_JOY1_CD32_RED, INPUTEVENT_JOY1_CD32_BLUE, INPUTEVENT_JOY1_CD32_GREEN, INPUTEVENT_JOY1_CD32_YELLOW, INPUTEVENT_JOY1_CD32_RWD, INPUTEVENT_JOY1_CD32_FFW, INPUTEVENT_JOY1_CD32_PLAY, -1 }; -static int ip_joycd322[] = { +static const int ip_joycd322[] = { INPUTEVENT_JOY2_LEFT, INPUTEVENT_JOY2_RIGHT, INPUTEVENT_JOY2_UP, INPUTEVENT_JOY2_DOWN, INPUTEVENT_JOY2_CD32_RED, INPUTEVENT_JOY2_CD32_BLUE, INPUTEVENT_JOY2_CD32_GREEN, INPUTEVENT_JOY2_CD32_YELLOW, INPUTEVENT_JOY2_CD32_RWD, INPUTEVENT_JOY2_CD32_FFW, INPUTEVENT_JOY2_CD32_PLAY, -1 }; -static int ip_parjoy1[] = { +static const int ip_parjoy1[] = { INPUTEVENT_PAR_JOY1_LEFT, INPUTEVENT_PAR_JOY1_RIGHT, INPUTEVENT_PAR_JOY1_UP, INPUTEVENT_PAR_JOY1_DOWN, INPUTEVENT_PAR_JOY1_FIRE_BUTTON, INPUTEVENT_PAR_JOY1_2ND_BUTTON, -1 }; -static int ip_parjoy2[] = { +static const int ip_parjoy2[] = { INPUTEVENT_PAR_JOY2_LEFT, INPUTEVENT_PAR_JOY2_RIGHT, INPUTEVENT_PAR_JOY2_UP, INPUTEVENT_PAR_JOY2_DOWN, INPUTEVENT_PAR_JOY2_FIRE_BUTTON, INPUTEVENT_PAR_JOY2_2ND_BUTTON, -1 }; -static int ip_parjoy1default[] = { +static const int ip_parjoy1default[] = { INPUTEVENT_PAR_JOY1_LEFT, INPUTEVENT_PAR_JOY1_RIGHT, INPUTEVENT_PAR_JOY1_UP, INPUTEVENT_PAR_JOY1_DOWN, INPUTEVENT_PAR_JOY1_FIRE_BUTTON, -1 }; -static int ip_parjoy2default[] = { +static const int ip_parjoy2default[] = { INPUTEVENT_PAR_JOY2_LEFT, INPUTEVENT_PAR_JOY2_RIGHT, INPUTEVENT_PAR_JOY2_UP, INPUTEVENT_PAR_JOY2_DOWN, INPUTEVENT_PAR_JOY2_FIRE_BUTTON, -1 }; -static int ip_mouse1[] = { +static const int ip_mouse1[] = { INPUTEVENT_MOUSE1_LEFT, INPUTEVENT_MOUSE1_RIGHT, INPUTEVENT_MOUSE1_UP, INPUTEVENT_MOUSE1_DOWN, INPUTEVENT_JOY1_FIRE_BUTTON, INPUTEVENT_JOY1_2ND_BUTTON, -1 }; -static int ip_mouse2[] = { +static const int ip_mouse2[] = { INPUTEVENT_MOUSE2_LEFT, INPUTEVENT_MOUSE2_RIGHT, INPUTEVENT_MOUSE2_UP, INPUTEVENT_MOUSE2_DOWN, INPUTEVENT_JOY2_FIRE_BUTTON, INPUTEVENT_JOY2_2ND_BUTTON, -1 }; -static int ip_mousecdtv[] = -{ - INPUTEVENT_MOUSE_CDTV_LEFT, INPUTEVENT_MOUSE_CDTV_RIGHT, INPUTEVENT_MOUSE_CDTV_UP, INPUTEVENT_MOUSE_CDTV_DOWN, - INPUTEVENT_JOY1_FIRE_BUTTON, INPUTEVENT_JOY1_2ND_BUTTON, - -1 -}; -static int ip_mediacdtv[] = -{ - INPUTEVENT_KEY_CDTV_PLAYPAUSE, INPUTEVENT_KEY_CDTV_STOP, INPUTEVENT_KEY_CDTV_PREV, INPUTEVENT_KEY_CDTV_NEXT, - -1 -}; -static int ip_arcadia[] = { - INPUTEVENT_SPC_ARCADIA_DIAGNOSTICS, INPUTEVENT_SPC_ARCADIA_PLAYER1, INPUTEVENT_SPC_ARCADIA_PLAYER2, - INPUTEVENT_SPC_ARCADIA_COIN1, INPUTEVENT_SPC_ARCADIA_COIN2, - -1 -}; -static int ip_lightpen1[] = { - INPUTEVENT_LIGHTPEN_HORIZ, INPUTEVENT_LIGHTPEN_VERT, INPUTEVENT_JOY1_3RD_BUTTON, - -1 -}; -static int ip_lightpen2[] = { - INPUTEVENT_LIGHTPEN_HORIZ, INPUTEVENT_LIGHTPEN_VERT, INPUTEVENT_JOY2_3RD_BUTTON, - -1 -}; -static int ip_analog1[] = { +static const int ip_analog1[] = { INPUTEVENT_JOY1_HORIZ_POT, INPUTEVENT_JOY1_VERT_POT, INPUTEVENT_JOY1_LEFT, INPUTEVENT_JOY1_RIGHT, -1 }; -static int ip_analog2[] = { +static const int ip_analog2[] = { INPUTEVENT_JOY2_HORIZ_POT, INPUTEVENT_JOY2_VERT_POT, INPUTEVENT_JOY2_LEFT, INPUTEVENT_JOY2_RIGHT, -1 }; -static int ip_arcadiaxa[] = { - -1 -}; - -static void checkcompakb(int* kb, int* srcmap) +static void checkcompakb (int *kb, const int *srcmap) { int found = 0, avail = 0; int j, k; k = j = 0; - while (kb[j] >= 0) - { - struct uae_input_device* uid = &keyboards[0]; - while (kb[j] >= 0 && srcmap[k] >= 0) - { + while (kb[j] >= 0) { + struct uae_input_device *uid = &keyboards[0]; + while (kb[j] >= 0 && srcmap[k] >= 0) { int id = kb[j]; - for (int l = 0; l < MAX_INPUT_DEVICE_EVENTS; l++) - { - if (uid->extra[l] == id) - { + for (int l = 0; l < MAX_INPUT_DEVICE_EVENTS; l++) { + if (uid->extra[l] == id) { avail++; if (uid->eventid[l][0] == srcmap[k]) found++; @@ -4440,24 +3758,16 @@ static void checkcompakb(int* kb, int* srcmap) if (avail != found || avail == 0) return; k = j = 0; - while (kb[j] >= 0) - { - struct uae_input_device* uid = &keyboards[0]; - while (kb[j] >= 0) - { + while (kb[j] >= 0) { + struct uae_input_device *uid = &keyboards[0]; + while (kb[j] >= 0) { int id = kb[j]; - int evt0 = 0, evt1 = 0; k = 0; - while (keyboard_default[k].scancode >= 0) - { - if (keyboard_default[k].scancode == kb[j]) - { - for (int l = 0; l < MAX_INPUT_DEVICE_EVENTS; l++) - { - if (uid->extra[l] == id && uid->port[l][0] == 0) - { - for (int m = 0; m < MAX_INPUT_SUB_EVENT && keyboard_default[k].node[m].evt; m++) - { + while (keyboard_default[k].scancode >= 0) { + if (keyboard_default[k].scancode == kb[j]) { + for (int l = 0; l < MAX_INPUT_DEVICE_EVENTS; l++) { + if (uid->extra[l] == id && uid->port[l][0] == 0) { + for (int m = 0; m < MAX_INPUT_SUB_EVENT && keyboard_default[k].node[m].evt; m++) { uid->eventid[l][m] = keyboard_default[k].node[m].evt; uid->port[l][m] = 0; uid->flags[l][m] = 0; @@ -4475,39 +3785,13 @@ static void checkcompakb(int* kb, int* srcmap) } } -static void setautofireevent(struct uae_input_device* uid, int num, int sub, int af, int index) +static void inputdevice_sparerestore (struct uae_input_device *uid, int num, int sub) { - if (!af) - return; - int* afp = af_ports[index]; - for (int k = 0; afp[k] >= 0; k++) - { - if (afp[k] == uid->eventid[num][sub]) - { - uid->flags[num][sub] &= ~ID_FLAG_AUTOFIRE_MASK; - if (af >= JPORT_AF_NORMAL) - uid->flags[num][sub] |= ID_FLAG_AUTOFIRE; -#ifndef INPUTDEVICE_SIMPLE - if (af == JPORT_AF_TOGGLE) - uid->flags[num][sub] |= ID_FLAG_TOGGLE; - if (af == JPORT_AF_ALWAYS) - uid->flags[num][sub] |= ID_FLAG_INVERTTOGGLE; -#endif - return; - } - } -} - -static void inputdevice_sparerestore(struct uae_input_device* uid, int num, int sub) -{ - if (uid->port[num][SPARE_SUB_EVENT]) - { - uid->eventid[num][sub] = uid->eventid[num][SPARE_SUB_EVENT]; - uid->flags[num][sub] = uid->flags[num][SPARE_SUB_EVENT]; - uid->custom[num][sub] = uid->custom[num][SPARE_SUB_EVENT]; - } - else - { + if (uid->port[num][SPARE_SUB_EVENT]) { + uid->eventid[num][sub] = uid->eventid[num][SPARE_SUB_EVENT]; + uid->flags[num][sub] = uid->flags[num][SPARE_SUB_EVENT]; + uid->custom[num][sub] = uid->custom[num][SPARE_SUB_EVENT]; + } else { uid->eventid[num][sub] = 0; uid->flags[num][sub] = 0; xfree (uid->custom[num][sub]); @@ -4517,8 +3801,7 @@ static void inputdevice_sparerestore(struct uae_input_device* uid, int num, int uid->flags[num][SPARE_SUB_EVENT] = 0; uid->port[num][SPARE_SUB_EVENT] = 0; uid->custom[num][SPARE_SUB_EVENT] = 0; - if (uid->flags[num][MAX_INPUT_SUB_EVENT - 1] & ID_FLAG_RESERVEDGAMEPORTSCUSTOM) - { + if (uid->flags[num][MAX_INPUT_SUB_EVENT - 1] & ID_FLAG_RESERVEDGAMEPORTSCUSTOM) { uid->eventid[num][MAX_INPUT_SUB_EVENT - 1] = 0; uid->flags[num][MAX_INPUT_SUB_EVENT - 1] = 0; uid->port[num][MAX_INPUT_SUB_EVENT - 1] = 0; @@ -4526,62 +3809,42 @@ static void inputdevice_sparerestore(struct uae_input_device* uid, int num, int } } -void inputdevice_sparecopy(struct uae_input_device* uid, int num, int sub) +void inputdevice_sparecopy (struct uae_input_device *uid, int num, int sub) { if (uid->port[num][SPARE_SUB_EVENT] != 0) return; - if (uid->eventid[num][sub] <= 0 && uid->custom[num][sub] == NULL) - { + if (uid->eventid[num][sub] <= 0 && uid->custom[num][sub] == NULL) { uid->eventid[num][SPARE_SUB_EVENT] = 0; uid->flags[num][SPARE_SUB_EVENT] = 0; uid->port[num][SPARE_SUB_EVENT] = 0; xfree (uid->custom[num][SPARE_SUB_EVENT]); uid->custom[num][SPARE_SUB_EVENT] = NULL; - } - else - { - uid->eventid[num][SPARE_SUB_EVENT] = uid->eventid[num][sub]; - uid->flags[num][SPARE_SUB_EVENT] = uid->flags[num][sub]; - uid->port[num][SPARE_SUB_EVENT] = MAX_JPORTS + 1; - xfree (uid->custom[num][SPARE_SUB_EVENT]); - uid->custom[num][SPARE_SUB_EVENT] = uid->custom[num][sub]; - uid->custom[num][sub] = NULL; - } + } else { + uid->eventid[num][SPARE_SUB_EVENT] = uid->eventid[num][sub]; + uid->flags[num][SPARE_SUB_EVENT] = uid->flags[num][sub]; + uid->port[num][SPARE_SUB_EVENT] = MAX_JPORTS + 1; + xfree (uid->custom[num][SPARE_SUB_EVENT]); + uid->custom[num][SPARE_SUB_EVENT] = uid->custom[num][sub]; + uid->custom[num][sub] = NULL; + } } -static void setcompakb(struct uae_prefs* p, int* kb, int* srcmap, int index, int af) +static void setcompakb (struct uae_prefs *p, int *kb, const int *srcmap, int index, int af) { int j, k; k = j = 0; - while (kb[j] >= 0 && srcmap[k] >= 0) - { - while (kb[j] >= 0) - { + while (kb[j] >= 0 && srcmap[k] >= 0) { + while (kb[j] >= 0) { int id = kb[j]; - for (int m = 0; m < MAX_INPUT_DEVICES; m++) - { - struct uae_input_device* uid = &keyboards[m]; - for (int l = 0; l < MAX_INPUT_DEVICE_EVENTS; l++) - { - if (uid->extra[l] == id) - { - inputdevice_sparecopy(uid, l, 0); - - if (p->jports[index].nokeyboardoverride && uid->port[l][0] == 0) - { - uid->eventid[l][MAX_INPUT_SUB_EVENT - 1] = uid->eventid[l][0]; - uid->flags[l][MAX_INPUT_SUB_EVENT - 1] = uid->flags[l][0] | ID_FLAG_RESERVEDGAMEPORTSCUSTOM; - uid->custom[l][MAX_INPUT_SUB_EVENT - 1] = my_strdup(uid->custom[l][0]); - uid->eventid[l][MAX_INPUT_SUB_EVENT - 1] = uid->eventid[l][0]; + // default and active KB only + for (int m = 0; m < MAX_INPUT_DEVICES; m++) { + struct uae_input_device *uid = &keyboards[m]; + if (m == 0 || uid->enabled) { + for (int l = 0; l < MAX_INPUT_DEVICE_EVENTS; l++) { + if (uid->extra[l] == id) { + setcompakbevent(p, uid, l, srcmap[k], index, af); + break; } - - uid->eventid[l][0] = srcmap[k]; - uid->flags[l][0] &= COMPA_RESERVED_FLAGS; - uid->port[l][0] = index + 1; - xfree (uid->custom[l][0]); - uid->custom[l][0] = NULL; - setautofireevent(uid, l, 0, af, index); - break; } } } @@ -4592,61 +3855,50 @@ static void setcompakb(struct uae_prefs* p, int* kb, int* srcmap, int index, int } } -int inputdevice_get_compatibility_input(struct uae_prefs* prefs, int index, int* typelist, int* inputlist, const int** at) +int inputdevice_get_compatibility_input (struct uae_prefs *prefs, int index, int *typelist, int *inputlist, const int **at) { if (index >= MAX_JPORTS || joymodes[index] < 0) return -1; if (typelist != NULL) - *typelist = joymodes[index]; + *typelist = joymodes[index]; if (at != NULL) - *at = axistable; + *at = axistable; if (inputlist == NULL) return -1; - + //write_log (_T("%d %p %p\n"), *typelist, *inputlist, *at); int cnt; - for (cnt = 0; joyinputs[index] && joyinputs[index][cnt] >= 0; cnt++) - { + for (cnt = 0; joyinputs[index] && joyinputs[index][cnt] >= 0; cnt++) { inputlist[cnt] = joyinputs[index][cnt]; } inputlist[cnt] = -1; // find custom events (custom event = event that is mapped to same port but not included in joyinputs[] int devnum = 0; - while (inputdevice_get_device_status(devnum) >= 0) - { - for (int j = 0; j < inputdevice_get_widget_num(devnum); j++) - { - for (int sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) - { + while (inputdevice_get_device_status (devnum) >= 0) { + for (int j = 0; j < inputdevice_get_widget_num (devnum); j++) { + for (int sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) { int port, k, l; uae_u64 flags; bool ignore = false; - int evtnum2 = inputdevice_get_mapping(devnum, j, &flags, &port, NULL, NULL, sub); + int evtnum2 = inputdevice_get_mapping (devnum, j, &flags, &port, NULL, NULL, sub); if (port - 1 != index) continue; - for (k = 0; axistable[k] >= 0; k += 3) - { - if (evtnum2 == axistable[k] || evtnum2 == axistable[k + 1] || evtnum2 == axistable[k + 2]) - { - for (l = 0; inputlist[l] >= 0; l++) - { - if (inputlist[l] == axistable[k] || inputlist[l] == axistable[k + 1] || inputlist[l] == axistable[k + 1]) - { + for (k = 0; axistable[k] >= 0; k += 3) { + if (evtnum2 == axistable[k] || evtnum2 == axistable[k + 1] || evtnum2 == axistable[k + 2]) { + for (l = 0; inputlist[l] >= 0; l++) { + if (inputlist[l] == axistable[k] || inputlist[l] == axistable[k + 1] || inputlist[l] == axistable[k + 1]) { ignore = true; } } } } - if (!ignore) - { - for (k = 0; inputlist[k] >= 0; k++) - { + if (!ignore) { + for (k = 0; inputlist[k] >= 0; k++) { if (evtnum2 == inputlist[k]) break; } - if (inputlist[k] < 0) - { + if (inputlist[k] < 0) { inputlist[k] = evtnum2; inputlist[k + 1] = -1; cnt++; @@ -4656,18 +3908,14 @@ int inputdevice_get_compatibility_input(struct uae_prefs* prefs, int index, int* } devnum++; } - return cnt; } -static void clearevent(struct uae_input_device* uid, int evt) +static void clearevent (struct uae_input_device *uid, int evt) { - for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) - { - for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) - { - if (uid->eventid[i][j] == evt) - { + for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { + for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) { + if (uid->eventid[i][j] == evt) { uid->eventid[i][j] = 0; uid->flags[i][j] &= COMPA_RESERVED_FLAGS; xfree (uid->custom[i][j]); @@ -4676,50 +3924,40 @@ static void clearevent(struct uae_input_device* uid, int evt) } } } - -static void clearkbrevent(struct uae_input_device* uid, int evt) +static void clearkbrevent (struct uae_input_device *uid, int evt) { - for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) - { - for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) - { - if (uid->eventid[i][j] == evt) - { + for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { + for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) { + if (uid->eventid[i][j] == evt) { uid->eventid[i][j] = 0; uid->flags[i][j] &= COMPA_RESERVED_FLAGS; xfree (uid->custom[i][j]); uid->custom[i][j] = NULL; if (j == 0) - set_kbr_default_event(uid, keyboard_default, i); + set_kbr_default_event (uid, keyboard_default, i); } } } } -static void resetjport(struct uae_prefs* prefs, int index) +static void resetjport (struct uae_prefs *prefs, int index) { - int* p = rem_ports[index]; - while (*p >= 0) - { + const int *p = rem_ports[index]; + while (*p >= 0) { int evtnum = *p++; - for (int l = 0; l < MAX_INPUT_DEVICES; l++) - { - clearevent(&prefs->joystick_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum); - clearevent(&prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum); - clearkbrevent(&prefs->keyboard_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum); + for (int l = 0; l < MAX_INPUT_DEVICES; l++) { + clearevent (&prefs->joystick_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum); + clearevent (&prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum); + clearkbrevent (&prefs->keyboard_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum); } - for (int i = 0; axistable[i] >= 0; i += 3) - { - if (evtnum == axistable[i] || evtnum == axistable[i + 1] || evtnum == axistable[i + 2]) - { - for (int j = 0; j < 3; j++) - { + for (int i = 0; axistable[i] >= 0; i += 3) { + if (evtnum == axistable[i] || evtnum == axistable[i + 1] || evtnum == axistable[i + 2]) { + for (int j = 0; j < 3; j++) { int evtnum2 = axistable[i + j]; - for (int l = 0; l < MAX_INPUT_DEVICES; l++) - { - clearevent(&prefs->joystick_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum2); - clearevent(&prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum2); - clearkbrevent(&prefs->keyboard_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum2); + for (int l = 0; l < MAX_INPUT_DEVICES; l++) { + clearevent (&prefs->joystick_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum2); + clearevent (&prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum2); + clearkbrevent (&prefs->keyboard_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum2); } } break; @@ -4728,41 +3966,36 @@ static void resetjport(struct uae_prefs* prefs, int index) } } -static void remove_compa_config(struct uae_prefs* prefs, int index) +static void remove_compa_config (struct uae_prefs *prefs, int index) { int typelist; - const int* atp; + const int *atpp; int inputlist[MAX_COMPA_INPUTLIST]; - if (inputdevice_get_compatibility_input(prefs, index, &typelist, inputlist, &atp) <= 0) + if (inputdevice_get_compatibility_input (prefs, index, &typelist, inputlist, &atpp) <= 0) return; - for (int i = 0; inputlist[i] >= 0; i++) - { + for (int i = 0; inputlist[i] >= 0; i++) { int evtnum = inputlist[i]; + const int *atp = atpp; int atpidx = 0; - while (*atp >= 0) - { - if (*atp == evtnum) - { + while (*atp >= 0) { + if (*atp == evtnum) { atp++; atpidx = 2; break; } - if (atp[1] == evtnum || atp[2] == evtnum) - { + if (atp[1] == evtnum || atp[2] == evtnum) { atpidx = 1; break; } atp += 3; } - while (atpidx >= 0) - { - for (int l = 0; l < MAX_INPUT_DEVICES; l++) - { - clearevent(&prefs->joystick_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum); - clearevent(&prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum); - clearkbrevent(&prefs->keyboard_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum); + while (atpidx >= 0) { + for (int l = 0; l < MAX_INPUT_DEVICES; l++) { + clearevent (&prefs->joystick_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum); + clearevent (&prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum); + clearkbrevent (&prefs->keyboard_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum); } evtnum = *atp++; atpidx--; @@ -4770,50 +4003,36 @@ static void remove_compa_config(struct uae_prefs* prefs, int index) } } -static void cleardevgp(struct uae_input_device* uid, int num, bool nocustom, int index) +static void cleardev_custom (struct uae_input_device *uid, int num, int index) { - for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) - { - for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) - { - if (uid[num].port[i][j] == index + 1) - { - if (nocustom && (uid[num].flags[i][j] & ID_FLAG_GAMEPORTSCUSTOM_MASK)) - continue; + for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { + for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) { + if (uid[num].port[i][j] == index + 1) { uid[num].eventid[i][j] = 0; uid[num].flags[i][j] &= COMPA_RESERVED_FLAGS; xfree (uid[num].custom[i][j]); uid[num].custom[i][j] = NULL; uid[num].port[i][j] = 0; if (uid[num].port[i][SPARE_SUB_EVENT]) - inputdevice_sparerestore(&uid[num], i, j); + inputdevice_sparerestore (&uid[num], i, j); } } } } - -static void cleardevkbrgp(struct uae_input_device* uid, int num, bool nocustom, int index) +static void cleardevkbr_custom(struct uae_input_device *uid, int num, int index) { - for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) - { - for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) - { - if (uid[num].port[i][j] == index + 1) - { - if (nocustom && (uid[num].flags[i][j] & ID_FLAG_GAMEPORTSCUSTOM_MASK)) - continue; + for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { + for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) { + if (uid[num].port[i][j] == index + 1) { uid[num].eventid[i][j] = 0; uid[num].flags[i][j] &= COMPA_RESERVED_FLAGS; xfree (uid[num].custom[i][j]); uid[num].custom[i][j] = NULL; uid[num].port[i][j] = 0; - if (uid[num].port[i][SPARE_SUB_EVENT]) - { - inputdevice_sparerestore(&uid[num], i, j); - } - else if (j == 0) - { - set_kbr_default_event(&uid[num], keyboard_default, i); + if (uid[num].port[i][SPARE_SUB_EVENT]) { + inputdevice_sparerestore (&uid[num], i, j); + } else if (j == 0) { + set_kbr_default_event (&uid[num], keyboard_default, i); } } } @@ -4821,50 +4040,44 @@ static void cleardevkbrgp(struct uae_input_device* uid, int num, bool nocustom, } // remove all gameports mappings mapped to port 'index' -static void remove_custom_config(struct uae_prefs* prefs, bool nocustom, int index) +static void remove_custom_config (struct uae_prefs *prefs, int index) { - for (int l = 0; l < MAX_INPUT_DEVICES; l++) - { - cleardevgp(joysticks, l, nocustom, index); - cleardevgp(mice, l, nocustom, index); - cleardevkbrgp(keyboards, l, nocustom, index); + for (int l = 0; l < MAX_INPUT_DEVICES; l++) { + cleardev_custom(joysticks, l, index); + cleardev_custom(mice, l, index); + cleardevkbr_custom (keyboards, l, index); } } // prepare port for custom mapping, remove all current Amiga side device mappings -void inputdevice_compa_prepare_custom(struct uae_prefs *prefs, int index, int newmode, bool removeold) +void inputdevice_compa_prepare_custom (struct uae_prefs *prefs, int index, int newmode, bool removeold) { int mode = prefs->jports[index].mode; if (newmode >= 0) { mode = newmode; - } - else if (mode == 0) { + } else if (mode == 0) { mode = index == 0 ? JSEM_MODE_WHEELMOUSE : (prefs->cs_cd32cd ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK); } prefs->jports[index].mode = mode; if (removeold) { - prefs->jports_custom[JSEM_GETCUSTOMIDX(index, prefs)].custom[0] = 0; - remove_compa_config(prefs, index); - remove_custom_config(prefs, false, index); - } + remove_compa_config (prefs, index); + remove_custom_config (prefs, index); + } } - // clear device before switching to new one -void inputdevice_compa_clear(struct uae_prefs* prefs, int index) +void inputdevice_compa_clear (struct uae_prefs *prefs, int index) { - freejport(prefs, index); - resetjport(prefs, index); - remove_compa_config(prefs, index); + freejport (prefs, index); + resetjport (prefs, index); + remove_compa_config (prefs, index); } -static void cleardev(struct uae_input_device* uid, int num) +static void cleardev (struct uae_input_device *uid, int num) { - for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) - { - inputdevice_sparecopy(&uid[num], i, 0); - for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) - { + for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { + inputdevice_sparecopy (&uid[num], i, 0); + for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) { uid[num].eventid[i][j] = 0; uid[num].flags[i][j] = 0; xfree (uid[num].custom[i][j]); @@ -4873,96 +4086,79 @@ static void cleardev(struct uae_input_device* uid, int num) } } -static void enablejoydevice(struct uae_input_device* uid, bool gameportsmode, int evtnum) +static void enablejoydevice (struct uae_input_device *uid, bool gameportsmode, int evtnum) { - for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) - { - for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) - { - if ((gameportsmode && uid->eventid[i][j] == evtnum) || uid->port[i][j] > 0) - { - uid->enabled = 1; + for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { + for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) { + if ((gameportsmode && uid->eventid[i][j] == evtnum) || uid->port[i][j] > 0) { + if (!uid->enabled) + uid->enabled = -1; } } } } -static void setjoydevices(struct uae_prefs* prefs, bool gameportsmode, int port) +static void setjoydevices (struct uae_prefs *prefs, bool gameportsmode, int port) { - for (int i = 0; joyinputs[port] && joyinputs[port][i] >= 0; i++) - { + for (int i = 0; joyinputs[port] && joyinputs[port][i] >= 0; i++) { int evtnum = joyinputs[port][i]; - for (int l = 0; l < MAX_INPUT_DEVICES; l++) - { - enablejoydevice(&joysticks[l], gameportsmode, evtnum); - enablejoydevice(&mice[l], gameportsmode, evtnum); - enablejoydevice(&keyboards[l], gameportsmode, evtnum); + for (int l = 0; l < MAX_INPUT_DEVICES; l++) { + enablejoydevice (&joysticks[l], gameportsmode, evtnum); + enablejoydevice (&mice[l], gameportsmode, evtnum); + //enablejoydevice (&keyboards[l], gameportsmode, evtnum); } - for (int k = 0; axistable[k] >= 0; k += 3) - { - if (evtnum == axistable[k] || evtnum == axistable[k + 1] || evtnum == axistable[k + 2]) - { - for (int j = 0; j < 3; j++) - { + for (int k = 0; axistable[k] >= 0; k += 3) { + if (evtnum == axistable[k] || evtnum == axistable[k + 1] || evtnum == axistable[k + 2]) { + for (int j = 0; j < 3; j++) { int evtnum2 = axistable[k + j]; - for (int l = 0; l < MAX_INPUT_DEVICES; l++) - { - enablejoydevice(&joysticks[l], gameportsmode, evtnum2); - enablejoydevice(&mice[l], gameportsmode, evtnum2); - enablejoydevice(&keyboards[l], gameportsmode, evtnum2); + for (int l = 0; l < MAX_INPUT_DEVICES; l++) { + enablejoydevice (&joysticks[l], gameportsmode, evtnum2); + enablejoydevice (&mice[l], gameportsmode, evtnum2); + //enablejoydevice (&keyboards[l], gameportsmode, evtnum2); } } break; } } + } } -static void setjoyinputs(struct uae_prefs* prefs, int port) +static void setjoyinputs (struct uae_prefs *prefs, int port) { joyinputs[port] = NULL; switch (joymodes[port]) { - case JSEM_MODE_JOYSTICK: - if (port >= 2) - joyinputs[port] = port == 3 ? ip_parjoy2 : ip_parjoy1; - else - joyinputs[port] = port == 1 ? ip_joy2 : ip_joy1; - break; - case JSEM_MODE_GAMEPAD: - joyinputs[port] = port ? ip_joypad2 : ip_joypad1; - break; - case JSEM_MODE_JOYSTICK_CD32: - joyinputs[port] = port ? ip_joycd322 : ip_joycd321; - break; - case JSEM_MODE_JOYSTICK_ANALOG: - joyinputs[port] = port ? ip_analog2 : ip_analog1; - break; - case JSEM_MODE_WHEELMOUSE: - case JSEM_MODE_MOUSE: - joyinputs[port] = port ? ip_mouse2 : ip_mouse1; - break; - case JSEM_MODE_LIGHTPEN: - joyinputs[port] = port ? ip_lightpen2 : ip_lightpen1; - break; - case JSEM_MODE_MOUSE_CDTV: - joyinputs[port] = ip_mousecdtv; - break; + case JSEM_MODE_JOYSTICK: + if (port >= 2) + joyinputs[port] = port == 3 ? ip_parjoy2 : ip_parjoy1; + else + joyinputs[port] = port == 1 ? ip_joy2 : ip_joy1; + break; + case JSEM_MODE_GAMEPAD: + joyinputs[port] = port ? ip_joypad2 : ip_joypad1; + break; + case JSEM_MODE_JOYSTICK_CD32: + joyinputs[port] = port ? ip_joycd322 : ip_joycd321; + break; + case JSEM_MODE_JOYSTICK_ANALOG: + joyinputs[port] = port ? ip_analog2 : ip_analog1; + break; + case JSEM_MODE_WHEELMOUSE: + case JSEM_MODE_MOUSE: + joyinputs[port] = port ? ip_mouse2 : ip_mouse1; + break; } //write_log (_T("joyinput %d = %p\n"), port, joyinputs[port]); } -static void setautofire(struct uae_input_device* uid, int port, int af) +static void setautofire (struct uae_input_device *uid, int port, int af) { - int* afp = af_ports[port]; - for (int k = 0; afp[k] >= 0; k++) - { - for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) - { - for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) - { - if (uid->eventid[i][j] == afp[k]) - { + const int *afp = af_ports[port]; + for (int k = 0; afp[k] >= 0; k++) { + for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { + for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) { + if (uid->eventid[i][j] == afp[k]) { uid->flags[i][j] &= ~ID_FLAG_AUTOFIRE_MASK; if (af >= JPORT_AF_NORMAL) uid->flags[i][j] |= ID_FLAG_AUTOFIRE; @@ -4978,77 +4174,58 @@ static void setautofire(struct uae_input_device* uid, int port, int af) } } -static void setautofires(struct uae_prefs* prefs, int port, int af) +static void setautofires (struct uae_prefs *prefs, int port, int af) { - for (int l = 0; l < MAX_INPUT_DEVICES; l++) - { - setautofire(&joysticks[l], port, af); - setautofire(&mice[l], port, af); - setautofire(&keyboards[l], port, af); + for (int l = 0; l < MAX_INPUT_DEVICES; l++) { + setautofire (&joysticks[l], port, af); + setautofire (&mice[l], port, af); + setautofire (&keyboards[l], port, af); } } // merge gameport settings with current input configuration -static void compatibility_copy(struct uae_prefs* prefs, bool gameports) +static void compatibility_copy (struct uae_prefs *prefs, bool gameports) { - int used[MAX_INPUT_DEVICES] = {0}; + int used[MAX_INPUT_DEVICES] = { 0 }; int i, joy; - for (i = 0; i < MAX_JPORTS; i++) - { + for (i = 0; i < MAX_JPORTS; i++) { joymodes[i] = prefs->jports[i].mode; - joyinputs[i] = NULL; - // remove all mappings from this port, except if custom + joyinputs[i]= NULL; + // remove all mappings from this port if (gameports) - remove_compa_config(prefs, i); - remove_custom_config(prefs, false, i); - setjoyinputs(prefs, i); + remove_compa_config (prefs, i); + remove_custom_config (prefs, i); + setjoyinputs (prefs, i); } - for (i = 0; i < 2; i++) - { - int af = prefs->jports[i].autofire; - if (prefs->jports[i].id >= 0 && joymodes[i] <= 0) - { + for (i = 0; i < 2; i++) { + if (prefs->jports[i].id >= 0 && joymodes[i] <= 0) { int mode = prefs->jports[i].mode; - if (jsem_ismouse(i, prefs) >= 0) - { + if (jsem_ismouse (i, prefs) >= 0) { switch (mode) { - case JSEM_MODE_DEFAULT: - case JSEM_MODE_MOUSE: - case JSEM_MODE_WHEELMOUSE: - default: + case JSEM_MODE_DEFAULT: + case JSEM_MODE_MOUSE: + case JSEM_MODE_WHEELMOUSE: + default: joymodes[i] = JSEM_MODE_WHEELMOUSE; joyinputs[i] = i ? ip_mouse2 : ip_mouse1; break; -#ifndef INPUTDEVICE_SIMPLE - case JSEM_MODE_LIGHTPEN: - joymodes[i] = JSEM_MODE_LIGHTPEN; - joyinputs[i] = i ? ip_lightpen2 : ip_lightpen1; - break; - case JSEM_MODE_MOUSE_CDTV: - joymodes[i] = JSEM_MODE_MOUSE_CDTV; - joyinputs[i] = ip_mousecdtv; - break; -#endif } - } - else if (jsem_isjoy(i, prefs) >= 0) - { + } else if (jsem_isjoy (i, prefs) >= 0) { switch (mode) { - case JSEM_MODE_DEFAULT: - case JSEM_MODE_JOYSTICK: + case JSEM_MODE_DEFAULT: + case JSEM_MODE_JOYSTICK: #ifndef INPUTDEVICE_SIMPLE case JSEM_MODE_GAMEPAD: #endif - case JSEM_MODE_JOYSTICK_CD32: - default: + case JSEM_MODE_JOYSTICK_CD32: + default: { bool iscd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd); - if (iscd32) - { + if (iscd32) { joymodes[i] = JSEM_MODE_JOYSTICK_CD32; joyinputs[i] = i ? ip_joycd322 : ip_joycd321; #ifndef INPUTDEVICE_SIMPLE @@ -5056,9 +4233,7 @@ static void compatibility_copy(struct uae_prefs* prefs, bool gameports) joymodes[i] = JSEM_MODE_GAMEPAD; joyinputs[i] = i ? ip_joypad2 : ip_joypad1; #endif - } - else - { + } else { joymodes[i] = JSEM_MODE_JOYSTICK; joyinputs[i] = i ? ip_joy2 : ip_joy1; } @@ -5070,25 +4245,13 @@ static void compatibility_copy(struct uae_prefs* prefs, bool gameports) joyinputs[i] = i ? ip_analog2 : ip_analog1; break; #endif - case JSEM_MODE_MOUSE: - case JSEM_MODE_WHEELMOUSE: - joymodes[i] = JSEM_MODE_WHEELMOUSE; - joyinputs[i] = i ? ip_mouse2 : ip_mouse1; - break; -#ifndef INPUTDEVICE_SIMPLE - case JSEM_MODE_LIGHTPEN: - joymodes[i] = JSEM_MODE_LIGHTPEN; - joyinputs[i] = i ? ip_lightpen2 : ip_lightpen1; + case JSEM_MODE_MOUSE: + case JSEM_MODE_WHEELMOUSE: + joymodes[i] = JSEM_MODE_WHEELMOUSE; + joyinputs[i] = i ? ip_mouse2 : ip_mouse1; break; - case JSEM_MODE_MOUSE_CDTV: - joymodes[i] = JSEM_MODE_MOUSE_CDTV; - joyinputs[i] = ip_mousecdtv; - break; -#endif } - } - else if (prefs->jports[i].id >= 0) - { + } else if (prefs->jports[i].id >= 0) { joymodes[i] = i ? JSEM_MODE_JOYSTICK : JSEM_MODE_WHEELMOUSE; joyinputs[i] = i ? ip_joy2 : ip_mouse1; } @@ -5098,7 +4261,6 @@ static void compatibility_copy(struct uae_prefs* prefs, bool gameports) #ifndef INPUTDEVICE_SIMPLE for (i = 2; i < MAX_JPORTS; i++) { if (prefs->jports[i].id >= 0 && joymodes[i] <= 0) { - int mode = prefs->jports[i].mode; if (jsem_isjoy (i, prefs) >= 0) { joymodes[i] = JSEM_MODE_JOYSTICK; joyinputs[i] = i == 3 ? ip_parjoy2 : ip_parjoy1; @@ -5110,29 +4272,26 @@ static void compatibility_copy(struct uae_prefs* prefs, bool gameports) } #endif - for (i = 0; i < 2; i++) - { + for (i = 0; i < 2; i++) { int af = prefs->jports[i].autofire; - if (prefs->jports[i].id >= 0) - { + if (prefs->jports[i].id >= 0) { int mode = prefs->jports[i].mode; - if ((joy = jsem_ismouse(i, prefs)) >= 0) - { + if ((joy = jsem_ismouse (i, prefs)) >= 0) { if (gameports) - cleardev(mice, joy); + cleardev (mice, joy); switch (mode) { case JSEM_MODE_DEFAULT: case JSEM_MODE_MOUSE: case JSEM_MODE_WHEELMOUSE: default: - input_get_default_mouse(mice, joy, i, af, !gameports, mode != JSEM_MODE_MOUSE, false); + input_get_default_mouse (mice, joy, i, af, !gameports, mode != JSEM_MODE_MOUSE, false); joymodes[i] = JSEM_MODE_WHEELMOUSE; break; case JSEM_MODE_JOYSTICK: case JSEM_MODE_GAMEPAD: case JSEM_MODE_JOYSTICK_CD32: - input_get_default_joystick(mice, joy, i, af, mode, !gameports, true); + input_get_default_joystick (mice, joy, i, af, mode, !gameports, true); joymodes[i] = mode; break; #ifndef INPUTDEVICE_SIMPLE @@ -5142,23 +4301,20 @@ static void compatibility_copy(struct uae_prefs* prefs, bool gameports) break; #endif } - _tcsncpy(prefs->jports[i].idc.name, idev[IDTYPE_MOUSE].get_friendlyname (joy), MAX_JPORTNAME - 1); - _tcsncpy(prefs->jports[i].idc.configname, idev[IDTYPE_MOUSE].get_uniquename (joy), MAX_JPORTNAME - 1); + _tcsncpy (prefs->jports[i].idc.name, idev[IDTYPE_MOUSE].get_friendlyname (joy), MAX_JPORTNAME - 1); + _tcsncpy (prefs->jports[i].idc.configname, idev[IDTYPE_MOUSE].get_uniquename (joy), MAX_JPORTNAME - 1); } } } - for (i = 1; i >= 0; i--) - { + for (i = 1; i >= 0; i--) { int af = prefs->jports[i].autofire; - if (prefs->jports[i].id >= 0) - { + if (prefs->jports[i].id >= 0) { int mode = prefs->jports[i].mode; - joy = jsem_isjoy(i, prefs); - if (joy >= 0) - { + joy = jsem_isjoy (i, prefs); + if (joy >= 0) { if (gameports) - cleardev(joysticks, joy); + cleardev (joysticks, joy); switch (mode) { case JSEM_MODE_DEFAULT: @@ -5168,19 +4324,19 @@ static void compatibility_copy(struct uae_prefs* prefs, bool gameports) #endif case JSEM_MODE_JOYSTICK_CD32: default: - { - bool iscd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd); - input_get_default_joystick(joysticks, joy, i, af, mode, !gameports, false); - if (iscd32) - joymodes[i] = JSEM_MODE_JOYSTICK_CD32; + { + bool iscd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd); + input_get_default_joystick (joysticks, joy, i, af, mode, !gameports, false); + if (iscd32) + joymodes[i] = JSEM_MODE_JOYSTICK_CD32; #ifndef INPUTDEVICE_SIMPLE else if (mode == JSEM_MODE_GAMEPAD) joymodes[i] = JSEM_MODE_GAMEPAD; #endif - else - joymodes[i] = JSEM_MODE_JOYSTICK; - break; - } + else + joymodes[i] = JSEM_MODE_JOYSTICK; + break; + } #ifndef INPUTDEVICE_SIMPLE case JSEM_MODE_JOYSTICK_ANALOG: input_get_default_joystick_analog (joysticks, joy, i, af, !gameports, false); @@ -5189,59 +4345,46 @@ static void compatibility_copy(struct uae_prefs* prefs, bool gameports) #endif case JSEM_MODE_MOUSE: case JSEM_MODE_WHEELMOUSE: - input_get_default_mouse(joysticks, joy, i, af, !gameports, mode == JSEM_MODE_WHEELMOUSE, true); + input_get_default_mouse (joysticks, joy, i, af, !gameports, mode == JSEM_MODE_WHEELMOUSE, true); joymodes[i] = JSEM_MODE_WHEELMOUSE; break; -#ifndef INPUTDEVICE_SIMPLE - case JSEM_MODE_MOUSE_CDTV: - joymodes[i] = JSEM_MODE_MOUSE_CDTV; - input_get_default_joystick (joysticks, joy, i, af, mode, !gameports, false); - break; -#endif } - _tcsncpy(prefs->jports[i].idc.name, idev[IDTYPE_JOYSTICK].get_friendlyname (joy), MAX_JPORTNAME - 1); - _tcsncpy(prefs->jports[i].idc.configname, idev[IDTYPE_JOYSTICK].get_uniquename (joy), MAX_JPORTNAME - 1); + _tcsncpy (prefs->jports[i].idc.name, idev[IDTYPE_JOYSTICK].get_friendlyname (joy), MAX_JPORTNAME - 1); + _tcsncpy (prefs->jports[i].idc.configname, idev[IDTYPE_JOYSTICK].get_uniquename (joy), MAX_JPORTNAME - 1); used[joy] = 1; } } } - if (gameports) - { + if (gameports) { // replace possible old mappings with default keyboard mapping - for (i = KBR_DEFAULT_MAP_FIRST; i <= KBR_DEFAULT_MAP_LAST; i++) - { - checkcompakb(keyboard_default_kbmaps[i], ip_joy2); - checkcompakb(keyboard_default_kbmaps[i], ip_joy1); + for (i = KBR_DEFAULT_MAP_FIRST; i <= KBR_DEFAULT_MAP_LAST; i++) { + checkcompakb (keyboard_default_kbmaps[i], ip_joy2); + checkcompakb (keyboard_default_kbmaps[i], ip_joy1); #ifndef INPUTDEVICE_SIMPLE checkcompakb (keyboard_default_kbmaps[i], ip_joypad2); checkcompakb (keyboard_default_kbmaps[i], ip_joypad1); checkcompakb (keyboard_default_kbmaps[i], ip_parjoy2); checkcompakb (keyboard_default_kbmaps[i], ip_parjoy1); #endif - checkcompakb(keyboard_default_kbmaps[i], ip_mouse2); - checkcompakb(keyboard_default_kbmaps[i], ip_mouse1); + checkcompakb (keyboard_default_kbmaps[i], ip_mouse2); + checkcompakb (keyboard_default_kbmaps[i], ip_mouse1); } - for (i = KBR_DEFAULT_MAP_CD32_FIRST; i <= KBR_DEFAULT_MAP_CD32_LAST; i++) - { - checkcompakb(keyboard_default_kbmaps[i], ip_joycd321); - checkcompakb(keyboard_default_kbmaps[i], ip_joycd322); + for (i = KBR_DEFAULT_MAP_CD32_FIRST; i <= KBR_DEFAULT_MAP_CD32_LAST; i++) { + checkcompakb (keyboard_default_kbmaps[i], ip_joycd321); + checkcompakb (keyboard_default_kbmaps[i], ip_joycd322); } } - for (i = 0; i < 2; i++) - { - if (prefs->jports[i].id >= 0) - { - int* kb = NULL; + for (i = 0; i < 2; i++) { + if (prefs->jports[i].id >= 0) { + int *kb = NULL; int mode = prefs->jports[i].mode; int af = prefs->jports[i].autofire; for (joy = 0; used[joy]; joy++); - if (JSEM_ISANYKBD (i, prefs)) - { + if (JSEM_ISANYKBD (i, prefs)) { bool cd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd); - if (JSEM_ISNUMPAD (i, prefs)) - { + if (JSEM_ISNUMPAD (i, prefs)) { if (cd32) kb = keyboard_default_kbmaps[KBR_DEFAULT_MAP_CD32_NP]; #ifndef INPUTDEVICE_SIMPLE @@ -5250,9 +4393,7 @@ static void compatibility_copy(struct uae_prefs* prefs, bool gameports) #endif else kb = keyboard_default_kbmaps[KBR_DEFAULT_MAP_NP]; - } - else if (JSEM_ISCURSOR (i, prefs)) - { + } else if (JSEM_ISCURSOR (i, prefs)) { if (cd32) kb = keyboard_default_kbmaps[KBR_DEFAULT_MAP_CD32_CK]; #ifndef INPUTDEVICE_SIMPLE @@ -5261,9 +4402,7 @@ static void compatibility_copy(struct uae_prefs* prefs, bool gameports) #endif else kb = keyboard_default_kbmaps[KBR_DEFAULT_MAP_CK]; - } - else if (JSEM_ISSOMEWHEREELSE (i, prefs)) - { + } else if (JSEM_ISSOMEWHEREELSE (i, prefs)) { if (cd32) kb = keyboard_default_kbmaps[KBR_DEFAULT_MAP_CD32_SE]; #ifndef INPUTDEVICE_SIMPLE @@ -5273,8 +4412,7 @@ static void compatibility_copy(struct uae_prefs* prefs, bool gameports) else kb = keyboard_default_kbmaps[KBR_DEFAULT_MAP_SE]; } - if (kb) - { + if (kb) { switch (mode) { case JSEM_MODE_JOYSTICK: @@ -5283,25 +4421,22 @@ static void compatibility_copy(struct uae_prefs* prefs, bool gameports) #endif case JSEM_MODE_JOYSTICK_CD32: case JSEM_MODE_DEFAULT: - if (cd32) - { - setcompakb(prefs, kb, i ? ip_joycd322 : ip_joycd321, i, af); + if (cd32) { + setcompakb (prefs, kb, i ? ip_joycd322 : ip_joycd321, i, af); joymodes[i] = JSEM_MODE_JOYSTICK_CD32; #ifndef INPUTDEVICE_SIMPLE } else if (mode == JSEM_MODE_GAMEPAD) { setcompakb (prefs, kb, i ? ip_joypad2 : ip_joypad1, i, af); joymodes[i] = JSEM_MODE_GAMEPAD; #endif - } - else - { - setcompakb(prefs, kb, i ? ip_joy2 : ip_joy1, i, af); + } else { + setcompakb (prefs, kb, i ? ip_joy2 : ip_joy1, i, af); joymodes[i] = JSEM_MODE_JOYSTICK; } break; case JSEM_MODE_MOUSE: case JSEM_MODE_WHEELMOUSE: - setcompakb(prefs, kb, i ? ip_mouse2 : ip_mouse1, i, af); + setcompakb (prefs, kb, i ? ip_mouse2 : ip_mouse1, i, af); joymodes[i] = JSEM_MODE_WHEELMOUSE; break; } @@ -5311,19 +4446,18 @@ static void compatibility_copy(struct uae_prefs* prefs, bool gameports) } } -#ifndef INPUTDEVICE_SIMPLE +//#ifndef INPUTDEVICE_SIMPLE // parport for (i = 2; i < MAX_JPORTS; i++) { int af = prefs->jports[i].autofire; if (prefs->jports[i].id >= 0) { - int *kb = NULL; joy = jsem_isjoy (i, prefs); if (joy >= 0) { if (gameports) cleardev (joysticks, joy); input_get_default_joystick (joysticks, joy, i, af, 0, !gameports, false); - _tcsncpy (prefs->jports[i].name, idev[IDTYPE_JOYSTICK].get_friendlyname (joy), MAX_JPORTNAME - 1); - _tcsncpy (prefs->jports[i].configname, idev[IDTYPE_JOYSTICK].get_uniquename (joy), MAX_JPORTNAME - 1); + _tcsncpy (prefs->jports[i].idc.name, idev[IDTYPE_JOYSTICK].get_friendlyname (joy), MAX_JPORTNAME - 1); + _tcsncpy (prefs->jports[i].idc.configname, idev[IDTYPE_JOYSTICK].get_uniquename (joy), MAX_JPORTNAME - 1); used[joy] = 1; joymodes[i] = JSEM_MODE_JOYSTICK; } @@ -5340,10 +4474,6 @@ static void compatibility_copy(struct uae_prefs* prefs, bool gameports) kb = keyboard_default_kbmaps[KBR_DEFAULT_MAP_CK]; else if (JSEM_ISSOMEWHEREELSE (i, prefs)) kb = keyboard_default_kbmaps[KBR_DEFAULT_MAP_SE]; - else if (JSEM_ISXARCADE1 (i, prefs)) - kb = keyboard_default_kbmaps[KBR_DEFAULT_MAP_XA1]; - else if (JSEM_ISXARCADE2 (i, prefs)) - kb = keyboard_default_kbmaps[KBR_DEFAULT_MAP_XA2]; if (kb) { setcompakb (prefs, kb, i == 3 ? ip_parjoy2default : ip_parjoy1default, i, prefs->jports[i].autofire); used[joy] = 1; @@ -5352,224 +4482,205 @@ static void compatibility_copy(struct uae_prefs* prefs, bool gameports) } } } -#endif +//#endif - for (i = 0; i < MAX_JPORTS; i++) - { + for (i = 0; i < MAX_JPORTS; i++) { if (gameports) - setautofires(prefs, i, prefs->jports[i].autofire); + setautofires (prefs, i, prefs->jports[i].autofire); } - for (i = 0; i < MAX_JPORTS; i++) - { - setjoyinputs(prefs, i); - setjoydevices(prefs, gameports, i); + for (i = 0; i < MAX_JPORTS; i++) { + setjoyinputs (prefs, i); + setjoydevices (prefs, gameports, i); } } -static void disableifempty2(struct uae_input_device* uid) +static void disableifempty2 (struct uae_input_device *uid) { - for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) - { - for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) - { + for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { + for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) { if (uid->eventid[i][j] > 0 || uid->custom[i][j] != NULL) return; } } - uid->enabled = false; + if (uid->enabled < 0) + uid->enabled = 0; } - -static void disableifempty(struct uae_prefs* prefs) +static void disableifempty (struct uae_prefs *prefs) { - for (int l = 0; l < MAX_INPUT_DEVICES; l++) - { - disableifempty2(&joysticks[l]); - disableifempty2(&mice[l]); - disableifempty2(&keyboards[l]); + for (int l = 0; l < MAX_INPUT_DEVICES; l++) { + disableifempty2 (&joysticks[l]); + disableifempty2 (&mice[l]); + if (!input_get_default_keyboard(l)) + disableifempty2 (&keyboards[l]); } -#ifndef INPUTDEVICE_SIMPLE - prefs->internalevent_settings[0]->enabled = true; -#endif } -static void matchdevices(struct inputdevice_functions* inf, struct uae_input_device* uid) +static void matchdevices (struct inputdevice_functions *inf, struct uae_input_device *uid) { int i, j; - for (i = 0; i < inf->get_num(); i++) - { - const char* aname1 = inf->get_friendlyname(i); - const char* aname2 = inf->get_uniquename(i); + for (int l = 0; l < 2; l++) { + bool fullmatch = l == 0; int match = -1; - for (j = 0; j < MAX_INPUT_DEVICES; j++) - { - if (aname2 && uid[j].configname) - { - bool matched = false; - TCHAR bname[MAX_DPATH]; - TCHAR bname2[MAX_DPATH]; - TCHAR *p1, *p2; - _tcscpy (bname, uid[j].configname); - _tcscpy (bname2, aname2); - // strip possible local guid part - p1 = _tcschr (bname, '{'); - p2 = _tcschr (bname2, '{'); - if (!p1 && !p2) - { - // check possible directinput names too - p1 = _tcschr (bname, ' '); - p2 = _tcschr (bname2, ' '); - } - if (!_tcscmp (bname, bname2)) - { - matched = true; - } - else if (p1 && p2 && p1 - bname == p2 - bname2) - { - *p1 = 0; - *p2 = 0; - if (bname && !_tcscmp (bname2, bname)) + for (i = 0; i < inf->get_num (); i++) { + const TCHAR* aname1 = inf->get_friendlyname(i); + const TCHAR* aname2 = inf->get_uniquename(i); + for (j = 0; j < MAX_INPUT_DEVICES; j++) { + if (aname2 && uid[j].configname) { + bool matched = false; + TCHAR bname[MAX_DPATH]; + TCHAR bname2[MAX_DPATH]; + TCHAR *p1 ,*p2; + TCHAR *bname1 = uid[j].name; + + if (fullmatch && (!bname1 || aname1)) + continue; + _tcscpy (bname, uid[j].configname); + _tcscpy (bname2, aname2); + // strip possible local guid part + p1 = _tcschr (bname, '{'); + p2 = _tcschr (bname2, '{'); + if (!p1 && !p2) { + // check possible directinput names too + p1 = _tcschr (bname, ' '); + p2 = _tcschr (bname2, ' '); + } + if (!_tcscmp (bname, bname2)) { matched = true; - } - if (matched) - { - if (match >= 0) - match = -2; - else - match = j; - } - if (match == -2) - break; - } - } - // multiple matches -> use complete local-only id string for comparisons - if (match == -2) - { - for (j = 0; j < MAX_INPUT_DEVICES; j++) - { - TCHAR* bname2 = uid[j].configname; - if (aname2 && bname2 && !_tcscmp (aname2, bname2)) - { - match = j; - break; + } else if (p1 && p2 && p1 - bname == p2 - bname2) { + *p1 = 0; + *p2 = 0; + if (bname[0] && !_tcscmp (bname2, bname)) + matched = true; + } + if (matched && fullmatch && _tcscmp(aname1, bname1) != 0) + matched = false; + if (matched) { + if (match >= 0) + match = -2; + else + match = j; + } + if (match == -2) + break; } } - } - if (match < 0) - { - // no match, try friend names - for (j = 0; j < MAX_INPUT_DEVICES; j++) - { - TCHAR* bname1 = uid[j].name; - if (aname1 && bname1 && !_tcscmp (aname1, bname1)) - { - match = j; - break; + if (!fullmatch) { + // multiple matches -> use complete local-only id string for comparisons + if (match == -2) { + for (j = 0; j < MAX_INPUT_DEVICES; j++) { + TCHAR *bname2 = uid[j].configname; + if (aname2 && bname2 && !_tcscmp (aname2, bname2)) { + match = j; + break; + } + } + } + if (match < 0) { + // no match, try friendly names only + for (j = 0; j < MAX_INPUT_DEVICES; j++) { + TCHAR *bname1 = uid[j].name; + if (aname1 && bname1 && !_tcscmp (aname1, bname1)) { + match = j; + break; + } + } + } + } + if (match >= 0) { + j = match; + if (j != i) { + struct uae_input_device *tmp = xmalloc (struct uae_input_device, 1); + memcpy (tmp, &uid[j], sizeof (struct uae_input_device)); + memcpy (&uid[j], &uid[i], sizeof (struct uae_input_device)); + memcpy (&uid[i], tmp, sizeof (struct uae_input_device)); + xfree (tmp); } } } if (match >= 0) - { - j = match; - if (j != i) - { - struct uae_input_device* tmp = xmalloc (struct uae_input_device, 1); - memcpy(tmp, &uid[j], sizeof (struct uae_input_device)); - memcpy(&uid[j], &uid[i], sizeof (struct uae_input_device)); - memcpy(&uid[i], tmp, sizeof (struct uae_input_device)); - xfree (tmp); - } - } + break; } - for (i = 0; i < inf->get_num(); i++) - { + for (i = 0; i < inf->get_num (); i++) { if (uid[i].name == NULL) - uid[i].name = my_strdup(inf->get_friendlyname(i)); + uid[i].name = my_strdup (inf->get_friendlyname (i)); if (uid[i].configname == NULL) - uid[i].configname = my_strdup(inf->get_uniquename(i)); + uid[i].configname = my_strdup (inf->get_uniquename (i)); } } -static void matchdevices_all(struct uae_prefs* prefs) +static void matchdevices_all (struct uae_prefs *prefs) { int i; - for (i = 0; i < MAX_INPUT_SETTINGS; i++) - { - matchdevices(&idev[IDTYPE_MOUSE], prefs->mouse_settings[i]); - matchdevices(&idev[IDTYPE_JOYSTICK], prefs->joystick_settings[i]); - matchdevices(&idev[IDTYPE_KEYBOARD], prefs->keyboard_settings[i]); + for (i = 0; i < MAX_INPUT_SETTINGS; i++) { + matchdevices (&idev[IDTYPE_MOUSE], prefs->mouse_settings[i]); + matchdevices (&idev[IDTYPE_JOYSTICK], prefs->joystick_settings[i]); + matchdevices (&idev[IDTYPE_KEYBOARD], prefs->keyboard_settings[i]); } } -bool inputdevice_set_gameports_mapping(struct uae_prefs* prefs, int devnum, int num, int evtnum, uae_u64 flags, int port, int input_selected_setting) +bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int num, int evtnum, uae_u64 flags, int port, int input_selected_setting) { TCHAR name[256]; - struct inputevent* ie; + const struct inputevent *ie; int sub; - if (evtnum < 0) - { + if (evtnum < 0) { joysticks = prefs->joystick_settings[input_selected_setting]; mice = prefs->mouse_settings[input_selected_setting]; keyboards = prefs->keyboard_settings[input_selected_setting]; - for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) - { + for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) { int port2 = 0; - inputdevice_get_mapping(devnum, num, NULL, &port2, NULL, NULL, sub); - if (port2 == port + 1) - { - inputdevice_set_mapping(devnum, num, NULL, NULL, 0, 0, sub); + inputdevice_get_mapping (devnum, num, NULL, &port2, NULL, NULL, sub); + if (port2 == port + 1) { + inputdevice_set_mapping (devnum, num, NULL, NULL, 0, 0, sub); } } return true; } - ie = inputdevice_get_eventinfo(evtnum); - if (!inputdevice_get_eventname(ie, name)) + ie = inputdevice_get_eventinfo (evtnum); + if (!inputdevice_get_eventname (ie, name)) return false; joysticks = prefs->joystick_settings[input_selected_setting]; mice = prefs->mouse_settings[input_selected_setting]; keyboards = prefs->keyboard_settings[input_selected_setting]; sub = 0; - if (inputdevice_get_widget_type(devnum, num, NULL) != IDEV_WIDGET_KEY) - { - for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) - { + if (inputdevice_get_widget_type (devnum, num, NULL, false) != IDEV_WIDGET_KEY) { + for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) { int port2 = 0; - int evt = inputdevice_get_mapping(devnum, num, NULL, &port2, NULL, NULL, sub); + int evt = inputdevice_get_mapping (devnum, num, NULL, &port2, NULL, NULL, sub); if (port2 == port + 1 && evt == evtnum) break; - if (!inputdevice_get_mapping(devnum, num, NULL, NULL, NULL, NULL, sub)) + if (!inputdevice_get_mapping (devnum, num, NULL, NULL, NULL, NULL, sub)) break; } } if (sub >= MAX_INPUT_SUB_EVENT) sub = MAX_INPUT_SUB_EVENT - 1; - inputdevice_set_mapping(devnum, num, name, NULL, IDEV_MAPPED_GAMEPORTSCUSTOM1 | flags, port + 1, sub); + inputdevice_set_mapping (devnum, num, name, NULL, IDEV_MAPPED_GAMEPORTSCUSTOM1 | flags, port + 1, sub); joysticks = prefs->joystick_settings[prefs->input_selected_setting]; mice = prefs->mouse_settings[prefs->input_selected_setting]; keyboards = prefs->keyboard_settings[prefs->input_selected_setting]; - if (prefs->input_selected_setting != GAMEPORT_INPUT_SETTINGS) - { + if (prefs->input_selected_setting != GAMEPORT_INPUT_SETTINGS) { int xport; uae_u64 xflags; TCHAR xname[MAX_DPATH], xcustom[MAX_DPATH]; - inputdevice_get_mapping(devnum, num, &xflags, &xport, xname, xcustom, 0); + inputdevice_get_mapping (devnum, num, &xflags, &xport, xname, xcustom, 0); if (xport == 0) - inputdevice_set_mapping(devnum, num, xname, xcustom, xflags, MAX_JPORTS + 1, SPARE_SUB_EVENT); - inputdevice_set_mapping(devnum, num, name, NULL, IDEV_MAPPED_GAMEPORTSCUSTOM1 | flags, port + 1, 0); + inputdevice_set_mapping (devnum, num, xname, xcustom, xflags, MAX_JPORTS + 1, SPARE_SUB_EVENT); + inputdevice_set_mapping (devnum, num, name, NULL, IDEV_MAPPED_GAMEPORTSCUSTOM1 | flags, port + 1, 0); } return true; } -static void resetinput() +static void resetinput (void) { cd32_shifter[0] = cd32_shifter[1] = 8; - for (int i = 0; i < MAX_JPORTS; i++) - { + for (int i = 0; i < MAX_JPORTS; i++) { oleft[i] = 0; oright[i] = 0; otop[i] = 0; @@ -5582,210 +4693,279 @@ static void resetinput() mouse_delta[i][1] = 0; mouse_deltanoreset[i][2] = 0; mouse_delta[i][2] = 0; - } - memset(keybuf, 0, sizeof keybuf); + } + memset (keybuf, 0, sizeof keybuf); for (int i = 0; i < INPUT_QUEUE_SIZE; i++) input_queue[i].linecnt = input_queue[i].nextlinecnt = -1; - for (int i = 0; i < MAX_INPUT_SUB_EVENT; i++) - { + for (int i = 0; i < MAX_INPUT_SUB_EVENT; i++) { sublevdir[0][i] = i; sublevdir[1][i] = MAX_INPUT_SUB_EVENT - i - 1; } } -void inputdevice_updateconfig_internal(const struct uae_prefs* srcprrefs, struct uae_prefs* dstprefs) +void inputdevice_copyjports(struct uae_prefs *srcprefs, struct uae_prefs *dstprefs) { - int i; + for (int i = 0; i < MAX_JPORTS; i++) { + copyjport(srcprefs, dstprefs, i); + } +} +void inputdevice_updateconfig_internal (struct uae_prefs *srcprefs, struct uae_prefs *dstprefs) +{ keyboard_default = keyboard_default_table[currprefs.input_keyboard_type]; - copyjport(srcprrefs, dstprefs, 0); - copyjport(srcprrefs, dstprefs, 1); - copyjport(srcprrefs, dstprefs, 2); - copyjport(srcprrefs, dstprefs, 3); - - resetinput(); + inputdevice_copyjports(srcprefs, dstprefs); + resetinput (); joysticks = dstprefs->joystick_settings[dstprefs->input_selected_setting]; mice = dstprefs->mouse_settings[dstprefs->input_selected_setting]; keyboards = dstprefs->keyboard_settings[dstprefs->input_selected_setting]; -#ifndef INPUTDEVICE_SIMPLE - internalevents = dstprefs->internalevent_settings[dstprefs->input_selected_setting]; -#endif - matchdevices_all(dstprefs); + matchdevices_all (dstprefs); - memset(joysticks2, 0, sizeof joysticks2); - memset(mice2, 0, sizeof mice2); + memset (joysticks2, 0, sizeof joysticks2); + memset (mice2, 0, sizeof mice2); + + int input_selected_setting = dstprefs->input_selected_setting; joysticks = dstprefs->joystick_settings[GAMEPORT_INPUT_SETTINGS]; mice = dstprefs->mouse_settings[GAMEPORT_INPUT_SETTINGS]; keyboards = dstprefs->keyboard_settings[GAMEPORT_INPUT_SETTINGS]; -#ifndef INPUTDEVICE_SIMPLE - internalevents = dstprefs->internalevent_settings[GAMEPORT_INPUT_SETTINGS]; -#endif - for (i = 0; i < MAX_INPUT_SETTINGS; i++) - { + dstprefs->input_selected_setting = GAMEPORT_INPUT_SETTINGS; + + for (int i = 0; i < MAX_INPUT_SETTINGS; i++) { joysticks[i].enabled = 0; mice[i].enabled = 0; } - compatibility_copy(dstprefs, true); + compatibility_copy (dstprefs, true); + + dstprefs->input_selected_setting = input_selected_setting; + joysticks = dstprefs->joystick_settings[dstprefs->input_selected_setting]; mice = dstprefs->mouse_settings[dstprefs->input_selected_setting]; keyboards = dstprefs->keyboard_settings[dstprefs->input_selected_setting]; -#ifndef INPUTDEVICE_SIMPLE - internalevents = dstprefs->internalevent_settings[dstprefs->input_selected_setting]; -#endif - if (dstprefs->input_selected_setting != GAMEPORT_INPUT_SETTINGS) - { - compatibility_copy(dstprefs, false); + if (dstprefs->input_selected_setting != GAMEPORT_INPUT_SETTINGS) { + compatibility_copy (dstprefs, false); } - disableifempty(dstprefs); - scanevents(dstprefs); + disableifempty (dstprefs); + scanevents (dstprefs); + + if (srcprefs) { + for (int i = 0; i < MAX_JPORTS; i++) { + copyjport(dstprefs, srcprefs, i); + } + } } -void inputdevice_updateconfig(const struct uae_prefs* srcprefs, struct uae_prefs* dstprefs) +void inputdevice_updateconfig (struct uae_prefs *srcprefs, struct uae_prefs *dstprefs) { - inputdevice_updateconfig_internal(srcprefs, dstprefs); + inputdevice_updateconfig_internal (srcprefs, dstprefs); - set_config_changed(); + set_config_changed (); + + for (int i = 0; i < MAX_JPORTS; i++) { + inputdevice_store_used_device(&dstprefs->jports[i], i, false); + } } +#ifndef INPUTDEVICE_SIMPLE /* called when devices get inserted or removed * store old devices temporarily, enumerate all devices * restore old devices back (order may have changed) */ -void inputdevice_devicechange(struct uae_prefs *prefs) +void inputdevice_devicechange (struct uae_prefs *prefs) { int acc = input_acquired; int i, idx; - TCHAR *jports[MAX_JPORTS]; - int jportskb[MAX_JPORTS], jportsmode[MAX_JPORTS]; + TCHAR *jports_name[MAX_JPORTS]; + TCHAR *jports_configname[MAX_JPORTS]; + int jportskb[MAX_JPORTS], jportscustom[MAX_JPORTS]; + int jportsmode[MAX_JPORTS]; int jportid[MAX_JPORTS], jportaf[MAX_JPORTS]; for (i = 0; i < MAX_JPORTS; i++) { - jports[i] = NULL; jportskb[i] = -1; + jportscustom[i] = -1; jportid[i] = prefs->jports[i].id; jportaf[i] = prefs->jports[i].autofire; - idx = inputdevice_getjoyportdevice(i, prefs->jports[i].id); - if (idx >= JSEM_LASTKBD) { - struct inputdevice_functions *idf; - int devidx; - idx -= JSEM_LASTKBD; - idf = getidf(idx); - devidx = inputdevice_get_device_index(idx); - jports[i] = my_strdup(idf->get_uniquename(devidx)); - } - else { + jports_name[i] = NULL; + jports_configname[i] = NULL; + idx = inputdevice_getjoyportdevice (i, prefs->jports[i].id); + if (idx >= JSEM_LASTKBD + inputdevice_get_device_total(IDTYPE_MOUSE) + inputdevice_get_device_total(IDTYPE_JOYSTICK)) { + jportscustom[i] = idx - (JSEM_LASTKBD + inputdevice_get_device_total(IDTYPE_MOUSE) + inputdevice_get_device_total(IDTYPE_JOYSTICK)); + } else if (idx >= JSEM_LASTKBD) { + if (prefs->jports[i].idc.name[0] == 0 && prefs->jports[i].idc.configname[0] == 0) { + struct inputdevice_functions *idf; + int devidx; + idx -= JSEM_LASTKBD; + idf = getidf (idx); + devidx = inputdevice_get_device_index (idx); + jports_name[i] = my_strdup (idf->get_friendlyname (devidx)); + jports_configname[i] = my_strdup (idf->get_uniquename (devidx)); + } + } else { jportskb[i] = idx; } jportsmode[i] = prefs->jports[i].mode; + if (jports_name[i] == NULL) + jports_name[i] = my_strdup(prefs->jports[i].idc.name); + if (jports_configname[i] == NULL) + jports_configname[i] = my_strdup(prefs->jports[i].idc.configname); } - inputdevice_unacquire(); - idev[IDTYPE_JOYSTICK].close(); - idev[IDTYPE_MOUSE].close(); - idev[IDTYPE_KEYBOARD].close(); - idev[IDTYPE_JOYSTICK].init(); - idev[IDTYPE_MOUSE].init(); - idev[IDTYPE_KEYBOARD].init(); - matchdevices(&idev[IDTYPE_MOUSE], mice); - matchdevices(&idev[IDTYPE_JOYSTICK], joysticks); - matchdevices(&idev[IDTYPE_KEYBOARD], keyboards); + // store old devices + struct inputdevconfig devcfg[MAX_INPUT_DEVICES][IDTYPE_MAX] = { 0 }; + int dev_nums[IDTYPE_MAX]; + for (int j = 0; j <= IDTYPE_KEYBOARD; j++) { + struct inputdevice_functions *inf = &idev[j]; + dev_nums[j] = inf->get_num(); + for (i = 0; i < dev_nums[j]; i++) { + TCHAR *un = inf->get_uniquename(i); + TCHAR *fn = inf->get_friendlyname(i); + _tcscpy(devcfg[i][j].name, fn); + _tcscpy(devcfg[i][j].configname, un); + } + } + inputdevice_unacquire (); + idev[IDTYPE_JOYSTICK].close (); + idev[IDTYPE_MOUSE].close (); + idev[IDTYPE_KEYBOARD].close (); + idev[IDTYPE_JOYSTICK].init (); + idev[IDTYPE_MOUSE].init (); + idev[IDTYPE_KEYBOARD].init (); + matchdevices (&idev[IDTYPE_MOUSE], mice); + matchdevices (&idev[IDTYPE_JOYSTICK], joysticks); + matchdevices (&idev[IDTYPE_KEYBOARD], keyboards); + + // find out which one was removed or inserted + for (int j = 0; j <= IDTYPE_KEYBOARD; j++) { + struct inputdevice_functions *inf = &idev[j]; + int num = inf->get_num(); + bool df[MAX_INPUT_DEVICES]; + for (i = 0; i < MAX_INPUT_DEVICES; i++) { + TCHAR *fn2 = devcfg[i][j].name; + TCHAR *un2 = devcfg[i][j].configname; + df[i] = false; + if (fn2[0] && un2[0]) { + for (int k = 0; k < num; k++) { + TCHAR *un = inf->get_uniquename(k); + TCHAR *fn = inf->get_friendlyname(k); + if (!_tcscmp(fn2, fn) && !_tcscmp(un2, un)) { + devcfg[i][j].name[0] = 0; + devcfg[i][j].configname[0] = 0; + df[k] = true; + } + } + } + } + for (i = 0; i < MAX_INPUT_DEVICES; i++) { + if (devcfg[i][j].name[0]) { + write_log(_T("REMOVED: %s (%s)\n"), devcfg[i][j].name, devcfg[i][j].configname); + inputdevice_store_unplugged_port(prefs, &devcfg[i][j]); + } + if (i < num && df[i] == false) { + struct inputdevconfig idc; + _tcscpy(idc.configname, inf->get_uniquename(i)); + _tcscpy(idc.name, inf->get_friendlyname(i)); + write_log(_T("INSERTED: %s (%s)\n"), idc.name, idc.configname); + int portnum = inputdevice_get_unplugged_device(&idc); + if (portnum >= 0) { + write_log(_T("Inserting to port %d\n"), portnum); + jportscustom[i] = -1; + xfree(jports_name[portnum]); + xfree(jports_configname[portnum]); + jports_name[portnum] = my_strdup(idc.name); + jports_configname[portnum] = my_strdup(idc.configname); + } else { + write_log(_T("Not inserted to any port\n")); + } + } + } + } + + bool fixedports[MAX_JPORTS]; for (i = 0; i < MAX_JPORTS; i++) { - freejport(prefs, i); - //if (jportid[i] == JPORT_CUSTOM) { - // inputdevice_joyport_config(prefs, _T("custom"), i, jportsmode[i], 0, true); - //} - //else - if (jports[i]) { - inputdevice_joyport_config(prefs, jports[i], i, jportsmode[i], 2, true); - } - else if (jportskb[i] >= 0) { + freejport (prefs, i); + fixedports[i] = false; + } + for (i = 0; i < MAX_JPORTS; i++) { + bool found = true; + if (jportscustom[i] >= 0) { TCHAR tmp[10]; - _stprintf(tmp, _T("kbd%d"), jportskb[i]); - inputdevice_joyport_config(prefs, tmp, i, jportsmode[i], 0, true); + _stprintf(tmp, _T("custom%d"), jportscustom[i]); + found = inputdevice_joyport_config(prefs, tmp, NULL, i, jportsmode[i], 0, true) != 0; + } else if (jports_name[i][0] || jports_configname[i][0]) { + if (!inputdevice_joyport_config (prefs, jports_name[i], jports_configname[i], i, jportsmode[i], 1, true)) { + found = inputdevice_joyport_config (prefs, jports_name[i], NULL, i, jportsmode[i], 1, true) != 0; + } + if (!found) { + inputdevice_joyport_config(prefs, _T("joydefault"), NULL, i, jportsmode[i], 0, true); + } + } else if (jportskb[i] >= 0) { + TCHAR tmp[10]; + _stprintf (tmp, _T("kbd%d"), jportskb[i] + 1); + found = inputdevice_joyport_config (prefs, tmp, NULL, i, jportsmode[i], 0, true) != 0; + } + fixedports[i] = found; prefs->jports[i].autofire = jportaf[i]; - xfree(jports[i]); + xfree (jports_name[i]); + xfree (jports_configname[i]); + inputdevice_validate_jports(prefs, i, fixedports); } if (prefs == &changed_prefs) - inputdevice_copyconfig(&changed_prefs, &currprefs); + inputdevice_copyconfig (&changed_prefs, &currprefs); if (acc) - inputdevice_acquire(TRUE); -#ifdef RETROPLATFORM - rp_enumdevices(); -#endif - set_config_changed(); + inputdevice_acquire (TRUE); + set_config_changed (); } +#endif // set default prefs to all input configuration settings -void inputdevice_default_prefs(struct uae_prefs* p) +void inputdevice_default_prefs (struct uae_prefs *p) { - inputdevice_init(); + inputdevice_init (); p->input_selected_setting = GAMEPORT_INPUT_SETTINGS; - p->input_joymouse_multiplier = 2; +#if defined (PANDORA) || defined(ANDROID) + p->input_joymouse_multiplier = 20; +#else + p->input_joymouse_multiplier = 2; +#endif p->input_joymouse_deadzone = 33; p->input_joystick_deadzone = 33; p->input_joymouse_speed = 10; p->input_analog_joystick_mult = 15; p->input_analog_joystick_offset = -1; p->input_mouse_speed = 100; - p->input_autofire_linecnt = 8 * 312; + p->input_autofire_linecnt = 8 * 312; p->input_keyboard_type = 0; keyboard_default = keyboard_default_table[p->input_keyboard_type]; - inputdevice_default_kb_all(p); + inputdevice_default_kb_all (p); } // set default keyboard and keyboard>joystick layouts -void inputdevice_setkeytranslation(struct uae_input_device_kbr_default** trans, int** kbmaps) +void inputdevice_setkeytranslation (struct uae_input_device_kbr_default **trans, int **kbmaps) { keyboard_default_table = trans; keyboard_default_kbmaps = kbmaps; } // return true if keyboard/scancode pair is mapped -int inputdevice_iskeymapped(int keyboard, int scancode) +int inputdevice_iskeymapped (int keyboard, int scancode) { - struct uae_input_device* na = &keyboards[keyboard]; - if (!keyboards || scancode < 0) return 0; return scancodeused[keyboard][scancode]; } -int inputdevice_synccapslock(int oldcaps, int *capstable) -{ - struct uae_input_device *na = &keyboards[0]; - int j, i; - - if (!keyboards) - return -1; - for (j = 0; na->extra[j]; j++) { - if (na->extra[j] == INPUTEVENT_KEY_CAPS_LOCK) { - for (i = 0; capstable[i]; i += 2) { - if (na->extra[j] == capstable[i]) { - if (oldcaps != capstable[i + 1]) { - oldcaps = capstable[i + 1]; - inputdevice_translatekeycode(0, capstable[i], oldcaps ? -1 : 0); - } - return i; - } - } - } - } - return -1; -} - -static void rqualifiers(uae_u64 flags, bool release) +static void rqualifiers (uae_u64 flags, bool release) { uae_u64 mask = ID_FLAG_QUALIFIER1 << 1; for (int i = 0; i < MAX_INPUT_QUALIFIERS; i++) { @@ -5796,20 +4976,19 @@ static void rqualifiers(uae_u64 flags, bool release) for (int ii = 0; ii < MAX_INPUT_SUB_EVENT; ii++) { int qevt = qualifiers_evt[i][ii]; if (qevt > 0) { - write_log(_T("Released %d '%s'\n"), qevt, events[qevt].name); - inputdevice_do_keyboard(events[qevt].data, 0); + write_log (_T("Released %d '%s'\n"), qevt, events[qevt].name); + inputdevice_do_keyboard (events[qevt].data, 0); } } } - } - else { + } else { if ((mask & qualifiers_r)) { qualifiers_r &= ~mask; for (int ii = 0; ii < MAX_INPUT_SUB_EVENT; ii++) { int qevt = qualifiers_evt[i][ii]; if (qevt > 0) { - write_log(_T("Pressed %d '%s'\n"), qevt, events[qevt].name); - inputdevice_do_keyboard(events[qevt].data, 1); + write_log (_T("Pressed %d '%s'\n"), qevt, events[qevt].name); + inputdevice_do_keyboard (events[qevt].data, 1); } } } @@ -5819,48 +4998,44 @@ static void rqualifiers(uae_u64 flags, bool release) } } -static int inputdevice_translatekeycode_2(int keyboard, int scancode, int keystate, bool qualifiercheckonly) +static int inputdevice_translatekeycode_2 (int keyboard, int scancode, int keystate, bool qualifiercheckonly) { - struct uae_input_device* na = &keyboards[keyboard]; + struct uae_input_device *na = &keyboards[keyboard]; int j, k; int handled = 0; - bool didcustom = false; if (!keyboards || scancode < 0) return handled; j = 0; - while (j < MAX_INPUT_DEVICE_EVENTS && na->extra[j] >= 0) - { - if (na->extra[j] == scancode) - { + while (j < MAX_INPUT_DEVICE_EVENTS && na->extra[j] >= 0) { + if (na->extra[j] == scancode) { bool qualonly; uae_u64 qualmask[MAX_INPUT_SUB_EVENT]; - getqualmask(qualmask, na, j, &qualonly); + getqualmask (qualmask, na, j, &qualonly); if (qualonly) qualifiercheckonly = true; - for (k = 0; k < MAX_INPUT_SUB_EVENT; k++) - {/* send key release events in reverse order */ - uae_u64* flagsp = &na->flags[j][sublevdir[keystate == 0 ? 1 : 0][k]]; + for (k = 0; k < MAX_INPUT_SUB_EVENT; k++) {/* send key release events in reverse order */ + uae_u64 *flagsp = &na->flags[j][sublevdir[keystate == 0 ? 1 : 0][k]]; int evt = na->eventid[j][sublevdir[keystate == 0 ? 1 : 0][k]]; uae_u64 flags = *flagsp; int autofire = (flags & ID_FLAG_AUTOFIRE) ? 1 : 0; +#ifndef INPUTDEVICE_SIMPLE int toggle = (flags & ID_FLAG_TOGGLE) ? 1 : 0; int inverttoggle = (flags & ID_FLAG_INVERTTOGGLE) ? 1 : 0; +#endif int invert = (flags & ID_FLAG_INVERT) ? 1 : 0; - int setmode = (flags & ID_FLAG_SET_ONOFF) ? 1 : 0; + int setmode = (flags & ID_FLAG_SET_ONOFF) ? 1: 0; int setval = (flags & ID_FLAG_SET_ONOFF_VAL) ? SET_ONOFF_ON_VALUE : SET_ONOFF_OFF_VALUE; int toggled; int state; if (keystate < 0) { state = keystate; - } - else if (invert) { + } else if (invert) { state = keystate ? 0 : 1; - } - else { + } else { state = keystate; } if (setmode) { @@ -5868,106 +5043,59 @@ static int inputdevice_translatekeycode_2(int keyboard, int scancode, int keysta state = setval; } - setqualifiers(evt, state > 0); - if (qualifiercheckonly) - { - if (!state && (flags & ID_FLAG_CANRELEASE)) - { + setqualifiers (evt, state > 0); + + if (qualifiercheckonly) { + if (!state && (flags & ID_FLAG_CANRELEASE)) { *flagsp &= ~ID_FLAG_CANRELEASE; -#ifdef INPUTDEVICE_SIMPLE - handle_input_event(evt, state, 1, autofire); -#else - handle_input_event (evt, state, 1, autofire, true, false); - if (k == 0) { - process_custom_event (na, j, state, qualmask, autofire, k); - } -#endif + handle_input_event (evt, state, 1, autofire); } continue; - } + } - // if evt == caps and scan == caps: sync with native caps led - if (evt == INPUTEVENT_KEY_CAPS_LOCK) { - int v; - if (state < 0) - state = 1; - v = target_checkcapslock(scancode, &state); - if (v < 0) - continue; - if (v > 0) - toggle = 0; - } else if (state < 0) { - // it was caps lock resync, ignore, not mapped to caps - continue; - } #ifndef INPUTDEVICE_SIMPLE - if (!state) { - didcustom |= process_custom_event (na, j, state, qualmask, autofire, k); - } - if (inverttoggle) { na->flags[j][sublevdir[state == 0 ? 1 : 0][k]] &= ~ID_FLAG_TOGGLED; if (state) { - queue_input_event (evt, NULL, -1, 0, 0, 1); - handled |= handle_input_event (evt, 1, 1, 0, true, false); + queue_input_event (evt, -1, 0, 0); + handled |= handle_input_event (evt, 2, 1, 0); } else { - handled |= handle_input_event (evt, 1, 1, autofire, true, false); + handled |= handle_input_event (evt, 2, 1, autofire); } - didcustom |= process_custom_event (na, j, state, qualmask, autofire, k); } else if (toggle) { if (!state) continue; if (!checkqualifiers (evt, flags, qualmask, na->eventid[j])) continue; *flagsp ^= ID_FLAG_TOGGLED; - toggled = (*flagsp & ID_FLAG_TOGGLED) ? 1 : 0; - handled |= handle_input_event (evt, toggled, 1, autofire, true, false); - if (k == 0) { - didcustom |= process_custom_event (na, j, state, qualmask, autofire, k); - } + toggled = (*flagsp & ID_FLAG_TOGGLED) ? 2 : 0; + handled |= handle_input_event (evt, toggled, 1, autofire); } else { #endif - rqualifiers(flags, state ? true : false); - if (!checkqualifiers(evt, flags, qualmask, na->eventid[j])) - { - if (!state && !(flags & ID_FLAG_CANRELEASE)) - { - if (!invert) - continue; + rqualifiers (flags, state ? true : false); + if (!checkqualifiers (evt, flags, qualmask, na->eventid[j])) { + if (!state && !(flags & ID_FLAG_CANRELEASE)) { + if (!invert) + continue; + } else if (state) { + continue; + } } - else if (state) - { - continue; - } - } - if (state) - { - if (!invert) - *flagsp |= ID_FLAG_CANRELEASE; - } - else - { - if (!(flags & ID_FLAG_CANRELEASE) && !invert) - continue; - *flagsp &= ~ID_FLAG_CANRELEASE; - } -#ifdef INPUTDEVICE_SIMPLE - handled |= handle_input_event(evt, state, 1, autofire); -#else - handled |= handle_input_event (evt, state, 1, autofire, true, false); - didcustom |= process_custom_event (na, j, state, qualmask, autofire, k); -#endif + if (state) { + if (!invert) + *flagsp |= ID_FLAG_CANRELEASE; + } else { + if (!(flags & ID_FLAG_CANRELEASE) && !invert) + continue; + *flagsp &= ~ID_FLAG_CANRELEASE; + } + handled |= handle_input_event (evt, state, 1, autofire); #ifndef INPUTDEVICE_SIMPLE } #endif } - if (!didcustom) -#ifdef INPUTDEVICE_SIMPLE - queue_input_event(-1, -1, 0, 0); -#else - queue_input_event (-1, NULL, -1, 0, 0, 1); -#endif + queue_input_event (-1, -1, 0, 0); return handled; } j++; @@ -5975,174 +5103,59 @@ static int inputdevice_translatekeycode_2(int keyboard, int scancode, int keysta return handled; } -#define IECODE_UP_PREFIX 0x80 -#define RAW_STEALTH 0x68 -#define STEALTHF_E0KEY 0x08 -#define STEALTHF_UPSTROKE 0x04 -#define STEALTHF_SPECIAL 0x02 -#define STEALTHF_E1KEY 0x01 - -static void sendmmcodes(int code, int newstate) -{ - uae_u8 b; - - b = RAW_STEALTH | IECODE_UP_PREFIX; - record_key(((b << 1) | (b >> 7)) & 0xff); - b = IECODE_UP_PREFIX; - if ((code >> 8) == 0x01) - b |= STEALTHF_E0KEY; - if ((code >> 8) == 0x02) - b |= STEALTHF_E1KEY; - if (!newstate) - b |= STEALTHF_UPSTROKE; - record_key(((b << 1) | (b >> 7)) & 0xff); - b = ((code >> 4) & 0x0f) | IECODE_UP_PREFIX; - record_key(((b << 1) | (b >> 7)) & 0xff); - b = (code & 0x0f) | IECODE_UP_PREFIX; - record_key(((b << 1) | (b >> 7)) & 0xff); -} - // main keyboard press/release entry point -int inputdevice_translatekeycode(int keyboard, int scancode, int state) +int inputdevice_translatekeycode (int keyboard, int scancode, int state) { - if (inputdevice_translatekeycode_2(keyboard, scancode, state, false)) + // if not default keyboard and all events are empty: use default keyboard + if (!input_get_default_keyboard(keyboard) && isemptykey(keyboard, scancode)) { + keyboard = input_get_default_keyboard(-1); + } + if (inputdevice_translatekeycode_2 (keyboard, scancode, state, false)) return 1; - if (currprefs.mmkeyboard && scancode > 0) - sendmmcodes(scancode, state); return 0; } - -void inputdevice_checkqualifierkeycode(int keyboard, int scancode, int state) +void inputdevice_checkqualifierkeycode (int keyboard, int scancode, int state) { - inputdevice_translatekeycode_2(keyboard, scancode, state, true); + inputdevice_translatekeycode_2 (keyboard, scancode, state, true); } -static const TCHAR *internaleventlabels[] = { - _T("CPU reset"), - _T("Keyboard reset"), - NULL -}; -static int init_int () -{ - return 1; -} -static void close_int () -{ -} -static int acquire_int (int num, int flags) -{ - return 1; -} -static void unacquire_int (int num) -{ -} -static void read_int () -{ -} -static int get_int_num () -{ - return 1; -} -static TCHAR *get_int_friendlyname (int num) -{ - return _T("Internal events"); -} -static TCHAR *get_int_uniquename (int num) -{ - return _T("INTERNALEVENTS1"); -} -static int get_int_widget_num (int num) -{ - int i; - for (i = 0; internaleventlabels[i]; i++); - return i; -} -static int get_int_widget_type (int kb, int num, TCHAR *name, uae_u32 *code) -{ - if (code) - *code = num; - if (name) - _tcscpy (name, internaleventlabels[num]); - return IDEV_WIDGET_BUTTON; -} -static int get_int_widget_first (int kb, int type) -{ - return 0; -} -static int get_int_flags (int num) -{ - return 0; -} -#ifndef INPUTDEVICE_SIMPLE -static struct inputdevice_functions inputdevicefunc_internalevent = { - init_int, close_int, acquire_int, unacquire_int, read_int, - get_int_num, get_int_friendlyname, get_int_uniquename, - get_int_widget_num, get_int_widget_type, - get_int_widget_first, - get_int_flags -}; - -void send_internalevent (int eventid) -{ - setbuttonstateall (&internalevents[0], NULL, eventid, -1); -} -#endif - -void inputdevice_init() +void inputdevice_init (void) { idev[IDTYPE_JOYSTICK] = inputdevicefunc_joystick; - idev[IDTYPE_JOYSTICK].init(); + idev[IDTYPE_JOYSTICK].init (); idev[IDTYPE_MOUSE] = inputdevicefunc_mouse; - idev[IDTYPE_MOUSE].init(); + idev[IDTYPE_MOUSE].init (); idev[IDTYPE_KEYBOARD] = inputdevicefunc_keyboard; - idev[IDTYPE_KEYBOARD].init(); -#ifndef INPUTDEVICE_SIMPLE - idev[IDTYPE_INTERNALEVENT] = inputdevicefunc_internalevent; - idev[IDTYPE_INTERNALEVENT].init (); -#endif + idev[IDTYPE_KEYBOARD].init (); } -void inputdevice_close() +void inputdevice_close (void) { - idev[IDTYPE_JOYSTICK].close(); - idev[IDTYPE_MOUSE].close(); - idev[IDTYPE_KEYBOARD].close(); -#ifndef INPUTDEVICE_SIMPLE - idev[IDTYPE_INTERNALEVENT].close (); - inprec_close(true); -#endif + idev[IDTYPE_JOYSTICK].close (); + idev[IDTYPE_MOUSE].close (); + idev[IDTYPE_KEYBOARD].close (); } -static struct uae_input_device* get_uid(const struct inputdevice_functions* id, int devnum) +static struct uae_input_device *get_uid (const struct inputdevice_functions *id, int devnum) { - struct uae_input_device* uid = 0; - if (id == &idev[IDTYPE_JOYSTICK]) - { + struct uae_input_device *uid = 0; + if (id == &idev[IDTYPE_JOYSTICK]) { uid = &joysticks[devnum]; - } - else if (id == &idev[IDTYPE_MOUSE]) - { + } else if (id == &idev[IDTYPE_MOUSE]) { uid = &mice[devnum]; - } - else if (id == &idev[IDTYPE_KEYBOARD]) - { + } else if (id == &idev[IDTYPE_KEYBOARD]) { uid = &keyboards[devnum]; -#ifndef INPUTDEVICE_SIMPLE - } else if (id == &idev[IDTYPE_INTERNALEVENT]) { - uid = &internalevents[devnum]; -#endif } return uid; } -static int get_event_data(const struct inputdevice_functions* id, int devnum, int num, int* eventid, TCHAR** custom, uae_u64* flags, int* port, int sub) +static int get_event_data (const struct inputdevice_functions *id, int devnum, int num, int *eventid, TCHAR **custom, uae_u64 *flags, int *port, int sub) { - const struct uae_input_device* uid = get_uid(id, devnum); - int type = id->get_widget_type(devnum, num, 0, 0); + const struct uae_input_device *uid = get_uid (id, devnum); + int type = id->get_widget_type (devnum, num, 0, 0); int i; - if (type == IDEV_WIDGET_BUTTON || type == IDEV_WIDGET_BUTTONAXIS) - { - i = num - id->get_widget_first(devnum, IDEV_WIDGET_BUTTON) + ID_BUTTON_OFFSET; + if (type == IDEV_WIDGET_BUTTON || type == IDEV_WIDGET_BUTTONAXIS) { + i = num - id->get_widget_first (devnum, IDEV_WIDGET_BUTTON) + ID_BUTTON_OFFSET; *eventid = uid->eventid[i][sub]; if (flags) *flags = uid->flags[i][sub]; @@ -6151,10 +5164,8 @@ static int get_event_data(const struct inputdevice_functions* id, int devnum, in if (custom) *custom = uid->custom[i][sub]; return i; - } - else if (type == IDEV_WIDGET_AXIS) - { - i = num - id->get_widget_first(devnum, type) + ID_AXIS_OFFSET; + } else if (type == IDEV_WIDGET_AXIS) { + i = num - id->get_widget_first (devnum, type) + ID_AXIS_OFFSET; *eventid = uid->eventid[i][sub]; if (flags) *flags = uid->flags[i][sub]; @@ -6163,10 +5174,8 @@ static int get_event_data(const struct inputdevice_functions* id, int devnum, in if (custom) *custom = uid->custom[i][sub]; return i; - } - else if (type == IDEV_WIDGET_KEY) - { - i = num - id->get_widget_first(devnum, type); + } else if (type == IDEV_WIDGET_KEY) { + i = num - id->get_widget_first (devnum, type); *eventid = uid->eventid[i][sub]; if (flags) *flags = uid->flags[i][sub]; @@ -6179,27 +5188,25 @@ static int get_event_data(const struct inputdevice_functions* id, int devnum, in return -1; } -static TCHAR* stripstrdup(const TCHAR* s) +static TCHAR *stripstrdup (const TCHAR *s) { - TCHAR* out = my_strdup(s); + TCHAR *out = my_strdup (s); if (!out) return NULL; - for (int i = 0; out[i]; i++) - { + for (int i = 0; out[i]; i++) { if (out[i] < ' ') out[i] = ' '; } return out; } -static int put_event_data(const struct inputdevice_functions* id, int devnum, int num, int eventid, TCHAR* custom, uae_u64 flags, int port, int sub) +static int put_event_data (const struct inputdevice_functions *id, int devnum, int num, int eventid, TCHAR *custom, uae_u64 flags, int port, int sub) { - struct uae_input_device* uid = get_uid(id, devnum); - int type = id->get_widget_type(devnum, num, 0, 0); + struct uae_input_device *uid = get_uid (id, devnum); + int type = id->get_widget_type (devnum, num, 0, 0); int i, ret; - for (i = 0; i < MAX_INPUT_QUALIFIERS; i++) - { + for (i = 0; i < MAX_INPUT_QUALIFIERS; i++) { uae_u64 mask1 = ID_FLAG_QUALIFIER1 << (i * 2); uae_u64 mask2 = mask1 << 1; if ((flags & (mask1 | mask2)) == (mask1 | mask2)) @@ -6213,40 +5220,26 @@ static int put_event_data(const struct inputdevice_functions* id, int devnum, in flags = 0; ret = -1; - if (type == IDEV_WIDGET_BUTTON || type == IDEV_WIDGET_BUTTONAXIS) - { - i = num - id->get_widget_first(devnum, IDEV_WIDGET_BUTTON) + ID_BUTTON_OFFSET; + if (type == IDEV_WIDGET_BUTTON || type == IDEV_WIDGET_BUTTONAXIS) { + i = num - id->get_widget_first (devnum, IDEV_WIDGET_BUTTON) + ID_BUTTON_OFFSET; uid->eventid[i][sub] = eventid; uid->flags[i][sub] = flags; uid->port[i][sub] = port; xfree (uid->custom[i][sub]); -#ifndef INPUTDEVICE_SIMPLE - uid->custom[i][sub] = custom && _tcslen (custom) > 0 ? stripstrdup (custom) : NULL; -#endif ret = i; - } - else if (type == IDEV_WIDGET_AXIS) - { - i = num - id->get_widget_first(devnum, type) + ID_AXIS_OFFSET; + } else if (type == IDEV_WIDGET_AXIS) { + i = num - id->get_widget_first (devnum, type) + ID_AXIS_OFFSET; uid->eventid[i][sub] = eventid; uid->flags[i][sub] = flags; uid->port[i][sub] = port; xfree (uid->custom[i][sub]); -#ifndef INPUTDEVICE_SIMPLE - uid->custom[i][sub] = custom && _tcslen (custom) > 0 ? stripstrdup (custom) : NULL; -#endif ret = i; - } - else if (type == IDEV_WIDGET_KEY) - { - i = num - id->get_widget_first(devnum, type); + } else if (type == IDEV_WIDGET_KEY) { + i = num - id->get_widget_first (devnum, type); uid->eventid[i][sub] = eventid; uid->flags[i][sub] = flags; uid->port[i][sub] = port; xfree (uid->custom[i][sub]); -#ifndef INPUTDEVICE_SIMPLE - uid->custom[i][sub] = custom && _tcslen (custom) > 0 ? stripstrdup (custom) : NULL; -#endif ret = i; } if (ret < 0) @@ -6256,17 +5249,14 @@ static int put_event_data(const struct inputdevice_functions* id, int devnum, in return ret; } -static int is_event_used(const struct inputdevice_functions* id, int devnum, int isnum, int isevent) +static int is_event_used (const struct inputdevice_functions *id, int devnum, int isnum, int isevent) { - struct uae_input_device* uid = get_uid(id, devnum); + struct uae_input_device *uid = get_uid (id, devnum); int num, evt, sub; - for (num = 0; num < id->get_widget_num(devnum); num++) - { - for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) - { - if (get_event_data(id, devnum, num, &evt, NULL, NULL, NULL, sub) >= 0) - { + for (num = 0; num < id->get_widget_num (devnum); num++) { + for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) { + if (get_event_data (id, devnum, num, &evt, NULL, NULL, NULL, sub) >= 0) { if (evt == isevent && isnum != num) return 1; } @@ -6276,11 +5266,11 @@ static int is_event_used(const struct inputdevice_functions* id, int devnum, int } // device based index from global device index -int inputdevice_get_device_index(int devnum) +int inputdevice_get_device_index (int devnum) { - int jcnt = idev[IDTYPE_JOYSTICK].get_num(); - int mcnt = idev[IDTYPE_MOUSE].get_num(); - int kcnt = idev[IDTYPE_KEYBOARD].get_num(); + int jcnt = idev[IDTYPE_JOYSTICK].get_num (); + int mcnt = idev[IDTYPE_MOUSE].get_num (); + int kcnt = idev[IDTYPE_KEYBOARD].get_num (); if (devnum < jcnt) return devnum; @@ -6288,114 +5278,49 @@ int inputdevice_get_device_index(int devnum) return devnum - jcnt; else if (devnum < jcnt + mcnt + kcnt) return devnum - (jcnt + mcnt); -#ifndef INPUTDEVICE_SIMPLE - else if (devnum < jcnt + mcnt + kcnt + INTERNALEVENT_COUNT) - return devnum - (jcnt + mcnt + kcnt); -#endif return -1; } -static int getdevnum(int type, int devnum) -{ - int jcnt = idev[IDTYPE_JOYSTICK].get_num(); - int mcnt = idev[IDTYPE_MOUSE].get_num(); - int kcnt = idev[IDTYPE_KEYBOARD].get_num(); - - if (type == IDTYPE_JOYSTICK) - return devnum; - else if (type == IDTYPE_MOUSE) - return jcnt + devnum; - else if (type == IDTYPE_KEYBOARD) - return jcnt + mcnt + devnum; -#ifndef INPUTDEVICE_SIMPLE - else if (type == IDTYPE_INTERNALEVENT) - return jcnt + mcnt + kcnt + devnum; -#endif - return -1; -} - -static int gettype(int devnum) -{ - int jcnt = idev[IDTYPE_JOYSTICK].get_num(); - int mcnt = idev[IDTYPE_MOUSE].get_num(); - int kcnt = idev[IDTYPE_KEYBOARD].get_num(); - - if (devnum < jcnt) - return IDTYPE_JOYSTICK; - else if (devnum < jcnt + mcnt) - return IDTYPE_MOUSE; - else if (devnum < jcnt + mcnt + kcnt) - return IDTYPE_KEYBOARD; -#ifndef INPUTDEVICE_SIMPLE - else if (devnum < jcnt + mcnt + kcnt + INTERNALEVENT_COUNT) - return IDTYPE_INTERNALEVENT; -#endif - return -1; -} - -static struct inputdevice_functions* getidf(int devnum) -{ - int type = gettype(devnum); - if (type < 0) - return NULL; - return &idev[type]; -} - -struct inputevent* inputdevice_get_eventinfo(int evt) -{ - if (evt > 0 && !events[evt].name) - return NULL; - return &events[evt]; -} - - /* returns number of devices of type "type" */ -int inputdevice_get_device_total(int type) +int inputdevice_get_device_total (int type) { - return idev[type].get_num(); + return idev[type].get_num (); } - /* returns the name of device */ -const char* inputdevice_get_device_name(int type, int devnum) +const TCHAR *inputdevice_get_device_name (int type, int devnum) { - return idev[type].get_friendlyname(devnum); + return idev[type].get_friendlyname (devnum); } - /* returns the name of device */ -const char* inputdevice_get_device_name2(int devnum) +const TCHAR *inputdevice_get_device_name2 (int devnum) { - return getidf(devnum)->get_friendlyname(inputdevice_get_device_index(devnum)); + return getidf (devnum)->get_friendlyname (inputdevice_get_device_index (devnum)); } - /* returns machine readable name of device */ -const char* inputdevice_get_device_unique_name(int type, int devnum) +const TCHAR *inputdevice_get_device_unique_name (int type, int devnum) { - return idev[type].get_uniquename(devnum); + return idev[type].get_uniquename (devnum); } - /* returns state (enabled/disabled) */ -int inputdevice_get_device_status(int devnum) +int inputdevice_get_device_status (int devnum) { - const struct inputdevice_functions* idf = getidf(devnum); + const struct inputdevice_functions *idf = getidf (devnum); if (idf == NULL) return -1; - struct uae_input_device* uid = get_uid(idf, inputdevice_get_device_index(devnum)); - return uid->enabled; + struct uae_input_device *uid = get_uid (idf, inputdevice_get_device_index (devnum)); + return uid->enabled != 0; } /* set state (enabled/disabled) */ -void inputdevice_set_device_status(int devnum, int enabled) +void inputdevice_set_device_status (int devnum, int enabled) { - const struct inputdevice_functions* idf = getidf(devnum); - int num = inputdevice_get_device_index(devnum); - struct uae_input_device* uid = get_uid(idf, num); - if (enabled) - { // disable incompatible devices ("super device" vs "raw device") - for (int i = 0; i < idf->get_num(); i++) - { - if (idf->get_flags(i) != idf->get_flags(num)) - { - struct uae_input_device* uid2 = get_uid(idf, i); + const struct inputdevice_functions *idf = getidf (devnum); + int num = inputdevice_get_device_index (devnum); + struct uae_input_device *uid = get_uid (idf, num); + if (enabled) { // disable incompatible devices ("super device" vs "raw device") + for (int i = 0; i < idf->get_num (); i++) { + if (idf->get_flags (i) != idf->get_flags (num)) { + struct uae_input_device *uid2 = get_uid (idf, i); uid2->enabled = 0; } } @@ -6404,14 +5329,14 @@ void inputdevice_set_device_status(int devnum, int enabled) } /* returns number of axis/buttons and keys from selected device */ -int inputdevice_get_widget_num(int devnum) +int inputdevice_get_widget_num (int devnum) { - const struct inputdevice_functions* idf = getidf(devnum); - return idf->get_widget_num(inputdevice_get_device_index(devnum)); + const struct inputdevice_functions *idf = getidf (devnum); + return idf->get_widget_num (inputdevice_get_device_index (devnum)); } // return name of event, do not use ie->name directly -bool inputdevice_get_eventname(const struct inputevent* ie, TCHAR* out) +bool inputdevice_get_eventname (const struct inputevent *ie, TCHAR *out) { if (!out) return false; @@ -6419,60 +5344,44 @@ bool inputdevice_get_eventname(const struct inputevent* ie, TCHAR* out) return true; } -int inputdevice_iterate(int devnum, int num, TCHAR* name, int* af) +int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af) { - const struct inputdevice_functions* idf = getidf(devnum); + const struct inputdevice_functions *idf = getidf (devnum); static int id_iterator; - struct inputevent* ie; + const struct inputevent *ie; int mask, data, type; uae_u64 flags; - int devindex = inputdevice_get_device_index(devnum); + int devindex = inputdevice_get_device_index (devnum); *af = 0; *name = 0; - for (;;) - { + for (;;) { ie = &events[++id_iterator]; - if (!ie->confname) - { + if (!ie->confname) { id_iterator = 0; return 0; } mask = 0; - type = idf->get_widget_type(devindex, num, NULL, NULL); - if (type == IDEV_WIDGET_BUTTON || type == IDEV_WIDGET_BUTTONAXIS) - { - if (idf == &idev[IDTYPE_JOYSTICK]) - { + type = idf->get_widget_type (devindex, num, NULL, NULL); + if (type == IDEV_WIDGET_BUTTON || type == IDEV_WIDGET_BUTTONAXIS) { + if (idf == &idev[IDTYPE_JOYSTICK]) { mask |= AM_JOY_BUT; - } - else - { + } else { mask |= AM_MOUSE_BUT; } - } - else if (type == IDEV_WIDGET_AXIS) - { - if (idf == &idev[IDTYPE_JOYSTICK]) - { + } else if (type == IDEV_WIDGET_AXIS) { + if (idf == &idev[IDTYPE_JOYSTICK]) { mask |= AM_JOY_AXIS; - } - else - { + } else { mask |= AM_MOUSE_AXIS; } - } - else if (type == IDEV_WIDGET_KEY) - { + } else if (type == IDEV_WIDGET_KEY) { mask |= AM_K; } - if (ie->allow_mask & AM_INFO) - { - struct inputevent* ie2 = ie + 1; - while (!(ie2->allow_mask & AM_INFO)) - { - if (is_event_used(idf, devindex, ie2 - ie, -1)) - { + if (ie->allow_mask & AM_INFO) { + const struct inputevent *ie2 = ie + 1; + while (!(ie2->allow_mask & AM_INFO)) { + if (is_event_used (idf, devindex, ie2 - ie, -1)) { ie2++; continue; } @@ -6485,25 +5394,25 @@ int inputdevice_iterate(int devnum, int num, TCHAR* name, int* af) } if (!(ie->allow_mask & mask)) continue; - get_event_data(idf, devindex, num, &data, NULL, &flags, NULL, 0); - inputdevice_get_eventname(ie, name); + get_event_data (idf, devindex, num, &data, NULL, &flags, NULL, 0); + inputdevice_get_eventname (ie, name); *af = (flags & ID_FLAG_AUTOFIRE) ? 1 : 0; return 1; } } // return mapped event from devnum/num/sub -int inputdevice_get_mapping(int devnum, int num, uae_u64* pflags, int* pport, TCHAR* name, TCHAR* custom, int sub) +int inputdevice_get_mapping (int devnum, int num, uae_u64 *pflags, int *pport, TCHAR *name, TCHAR *custom, int sub) { - const struct inputdevice_functions* idf = getidf(devnum); - const struct uae_input_device* uid = get_uid(idf, inputdevice_get_device_index(devnum)); + const struct inputdevice_functions *idf = getidf (devnum); + const struct uae_input_device *uid = get_uid (idf, inputdevice_get_device_index (devnum)); int port, data; uae_u64 flags = 0, flag; - int devindex = inputdevice_get_device_index(devnum); - TCHAR* customp = NULL; + int devindex = inputdevice_get_device_index (devnum); + TCHAR *customp = NULL; if (name) - _tcscpy (name, _T("")); + _tcscpy (name, _T("")); if (custom) custom[0] = 0; if (pflags) @@ -6512,22 +5421,26 @@ int inputdevice_get_mapping(int devnum, int num, uae_u64* pflags, int* pport, TC *pport = 0; if (uid == 0 || num < 0) return 0; - if (get_event_data(idf, devindex, num, &data, &customp, &flag, &port, sub) < 0) + if (get_event_data (idf, devindex, num, &data, &customp, &flag, &port, sub) < 0) return 0; if (customp && custom) - _tcscpy (custom, customp); + _tcscpy (custom, customp); if (flag & ID_FLAG_AUTOFIRE) flags |= IDEV_MAPPED_AUTOFIRE_SET; +#ifndef INPUTDEVICE_SIMPLE if (flag & ID_FLAG_TOGGLE) flags |= IDEV_MAPPED_TOGGLE; if (flag & ID_FLAG_INVERTTOGGLE) flags |= IDEV_MAPPED_INVERTTOGGLE; +#endif if (flag & ID_FLAG_INVERT) flags |= IDEV_MAPPED_INVERT; if (flag & ID_FLAG_GAMEPORTSCUSTOM1) flags |= IDEV_MAPPED_GAMEPORTSCUSTOM1; +#ifndef INPUTDEVICE_SIMPLE if (flag & ID_FLAG_GAMEPORTSCUSTOM2) flags |= IDEV_MAPPED_GAMEPORTSCUSTOM2; +#endif if (flag & ID_FLAG_QUALIFIER_MASK) flags |= flag & ID_FLAG_QUALIFIER_MASK; if (flag & ID_FLAG_SET_ONOFF) @@ -6544,29 +5457,27 @@ int inputdevice_get_mapping(int devnum, int num, uae_u64* pflags, int* pport, TC flags |= IDEV_MAPPED_AUTOFIRE_POSSIBLE; if (pflags) *pflags = flags; - inputdevice_get_eventname(&events[data], name); + inputdevice_get_eventname (&events[data], name); return data; } // set event name/custom/flags to devnum/num/sub -int inputdevice_set_mapping(int devnum, int num, const TCHAR* name, TCHAR* custom, uae_u64 flags, int port, int sub) +int inputdevice_set_mapping (int devnum, int num, const TCHAR *name, TCHAR *custom, uae_u64 flags, int port, int sub) { - const struct inputdevice_functions* idf = getidf(devnum); - const struct uae_input_device* uid = get_uid(idf, inputdevice_get_device_index(devnum)); + const struct inputdevice_functions *idf = getidf (devnum); + const struct uae_input_device *uid = get_uid (idf, inputdevice_get_device_index (devnum)); int eid, data, portp, amask; uae_u64 flag; TCHAR ename[256]; - int devindex = inputdevice_get_device_index(devnum); - TCHAR* customp = NULL; + int devindex = inputdevice_get_device_index (devnum); + TCHAR *customp = NULL; if (uid == 0 || num < 0) return 0; - if (name) - { + if (name) { eid = 1; - while (events[eid].name) - { - inputdevice_get_eventname(&events[eid], ename); + while (events[eid].name) { + inputdevice_get_eventname (&events[eid], ename); if (!_tcscmp(ename, name)) break; eid++; @@ -6575,55 +5486,61 @@ int inputdevice_set_mapping(int devnum, int num, const TCHAR* name, TCHAR* custo return 0; if (events[eid].allow_mask & AM_INFO) return 0; - } - else - { + } else { eid = 0; } - if (get_event_data(idf, devindex, num, &data, &customp, &flag, &portp, sub) < 0) + if (get_event_data (idf, devindex, num, &data, &customp, &flag, &portp, sub) < 0) return 0; - if (data >= 0) - { + if (data >= 0) { amask = events[eid].allow_mask; flag &= ~(ID_FLAG_AUTOFIRE_MASK | ID_FLAG_GAMEPORTSCUSTOM_MASK | IDEV_MAPPED_QUALIFIER_MASK | ID_FLAG_INVERT); - if (amask & AM_AF) - { + if (amask & AM_AF) { flag |= (flags & IDEV_MAPPED_AUTOFIRE_SET) ? ID_FLAG_AUTOFIRE : 0; +#ifndef INPUTDEVICE_SIMPLE flag |= (flags & IDEV_MAPPED_TOGGLE) ? ID_FLAG_TOGGLE : 0; flag |= (flags & IDEV_MAPPED_INVERTTOGGLE) ? ID_FLAG_INVERTTOGGLE : 0; +#endif } flag |= (flags & IDEV_MAPPED_INVERT) ? ID_FLAG_INVERT : 0; flag |= (flags & IDEV_MAPPED_GAMEPORTSCUSTOM1) ? ID_FLAG_GAMEPORTSCUSTOM1 : 0; +#ifndef INPUTDEVICE_SIMPLE flag |= (flags & IDEV_MAPPED_GAMEPORTSCUSTOM2) ? ID_FLAG_GAMEPORTSCUSTOM2 : 0; +#endif flag |= flags & IDEV_MAPPED_QUALIFIER_MASK; flag &= ~(IDEV_MAPPED_SET_ONOFF | IDEV_MAPPED_SET_ONOFF_VAL); - if (amask & AM_SETTOGGLE) - { + if (amask & AM_SETTOGGLE) { flag |= (flags & IDEV_MAPPED_SET_ONOFF) ? ID_FLAG_SET_ONOFF : 0; flag |= (flags & IDEV_MAPPED_SET_ONOFF_VAL) ? ID_FLAG_SET_ONOFF_VAL : 0; } if (port >= 0) portp = port; - put_event_data(idf, devindex, num, eid, custom, flag, portp, sub); + put_event_data (idf, devindex, num, eid, custom, flag, portp, sub); return 1; } return 0; } -int inputdevice_get_widget_type(int devnum, int num, TCHAR* name) +int inputdevice_get_widget_type (int devnum, int num, TCHAR *name, bool inccode) { - const struct inputdevice_functions* idf = getidf(devnum); - return idf->get_widget_type(inputdevice_get_device_index(devnum), num, name, 0); + uae_u32 code = 0; + const struct inputdevice_functions *idf = getidf (devnum); + int r = idf->get_widget_type (inputdevice_get_device_index (devnum), num, name, &code); + if (r && inccode && &idev[IDTYPE_KEYBOARD] == idf) { + TCHAR *p = name + _tcslen(name); + if (_tcsncmp(name, _T("KEY_"), 4)) + _stprintf(p, _T(" [0x%02X]"), code); + } + return r; } static int config_change; -void inputdevice_config_change() +void inputdevice_config_change (void) { config_change = 1; } -int inputdevice_config_change_test() +int inputdevice_config_change_test (void) { int v = config_change; config_change = 0; @@ -6631,10 +5548,8 @@ int inputdevice_config_change_test() } // copy configuration #src to configuration #dst -void inputdevice_copyconfig(const struct uae_prefs* src, struct uae_prefs* dst) +void inputdevice_copyconfig(struct uae_prefs *src, struct uae_prefs *dst) { - int i, j; - dst->input_selected_setting = src->input_selected_setting; dst->input_joymouse_multiplier = src->input_joymouse_multiplier; dst->input_joymouse_deadzone = src->input_joymouse_deadzone; @@ -6642,34 +5557,30 @@ void inputdevice_copyconfig(const struct uae_prefs* src, struct uae_prefs* dst) dst->input_joymouse_speed = src->input_joymouse_speed; dst->input_mouse_speed = src->input_mouse_speed; dst->input_autofire_linecnt = src->input_autofire_linecnt; - dst->input_tablet = src->input_tablet; +#ifdef AMIBERRY + strcpy(dst->open_gui, src->open_gui); + strcpy(dst->quit_amiberry, src->quit_amiberry); + dst->amiberry_use_retroarch_quit = src->amiberry_use_retroarch_quit; + dst->amiberry_use_retroarch_menu = src->amiberry_use_retroarch_menu; + dst->amiberry_use_retroarch_reset = src->amiberry_use_retroarch_reset; +#endif - dst->amiberry_customControls = src->amiberry_customControls; + for (int i = 0; i < MAX_JPORTS; i++) { + copyjport(src, dst, i); + } - dst->key_for_menu = src->key_for_menu; - dst->key_for_quit = src->key_for_quit; - dst->button_for_menu = src->button_for_menu; - dst->button_for_quit = src->button_for_quit; - - copyjport(src, dst, 0); - copyjport(src, dst, 1); - copyjport(src, dst, 2); - copyjport(src, dst, 3); - - for (i = 0; i < MAX_INPUT_SETTINGS; i++) - { - for (j = 0; j < MAX_INPUT_DEVICES; j++) - { - memcpy(&dst->joystick_settings[i][j], &src->joystick_settings[i][j], sizeof (struct uae_input_device)); - memcpy(&dst->mouse_settings[i][j], &src->mouse_settings[i][j], sizeof (struct uae_input_device)); - memcpy(&dst->keyboard_settings[i][j], &src->keyboard_settings[i][j], sizeof (struct uae_input_device)); + for (int i = 0; i < MAX_INPUT_SETTINGS; i++) { + for (int j = 0; j < MAX_INPUT_DEVICES; j++) { + memcpy(&dst->joystick_settings[i][j], &src->joystick_settings[i][j], sizeof(struct uae_input_device)); + memcpy(&dst->mouse_settings[i][j], &src->mouse_settings[i][j], sizeof(struct uae_input_device)); + memcpy(&dst->keyboard_settings[i][j], &src->keyboard_settings[i][j], sizeof(struct uae_input_device)); } } inputdevice_updateconfig(src, dst); } -static void swapevent(struct uae_input_device* uid, int i, int j, int evt) +static void swapevent (struct uae_input_device *uid, int i, int j, int evt) { uid->eventid[i][j] = evt; int port = uid->port[i][j]; @@ -6684,7 +5595,7 @@ static void swapevent(struct uae_input_device* uid, int i, int j, int evt) uid->port[i][j] = port; } -static void swapjoydevice(struct uae_input_device *uid, int **swaps) +static void swapjoydevice (struct uae_input_device *uid, const int **swaps) { for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) { @@ -6693,10 +5604,9 @@ static void swapjoydevice(struct uae_input_device *uid, int **swaps) int evtnum; for (int kk = 0; (evtnum = swaps[k][kk]) >= 0 && !found; kk++) { if (uid->eventid[i][j] == evtnum) { - swapevent(uid, i, j, swaps[1 - k][kk]); + swapevent (uid, i, j, swaps[1 - k][kk]); found = true; - } - else { + } else { for (int jj = 0; axistable[jj] >= 0; jj += 3) { if (evtnum == axistable[jj] || evtnum == axistable[jj + 1] || evtnum == axistable[jj + 2]) { for (int ii = 0; ii < 3; ii++) { @@ -6704,7 +5614,7 @@ static void swapjoydevice(struct uae_input_device *uid, int **swaps) int evtnum2 = swaps[1 - k][kk]; for (int m = 0; axistable[m] >= 0; m += 3) { if (evtnum2 == axistable[m] || evtnum2 == axistable[m + 1] || evtnum2 == axistable[m + 2]) { - swapevent(uid, i, j, axistable[m + ii]); + swapevent (uid, i, j, axistable[m + ii]); found = true; } } @@ -6720,39 +5630,25 @@ static void swapjoydevice(struct uae_input_device *uid, int **swaps) } // swap gameports ports, remember to handle customized ports too -void inputdevice_swap_compa_ports(struct uae_prefs* prefs, int portswap) +void inputdevice_swap_compa_ports (struct uae_prefs *prefs, int portswap) { struct jport tmp; -#if 0 - if ((prefs->jports[portswap].id == JPORT_CUSTOM || prefs->jports[portswap + 1].id == JPORT_CUSTOM)) { - const int *swaps[2]; - swaps[0] = rem_ports[portswap]; - swaps[1] = rem_ports[portswap + 1]; - for (int l = 0; l < MAX_INPUT_DEVICES; l++) { - swapjoydevice(&prefs->joystick_settings[GAMEPORT_INPUT_SETTINGS][l], swaps); - swapjoydevice(&prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS][l], swaps); - swapjoydevice(&prefs->keyboard_settings[GAMEPORT_INPUT_SETTINGS][l], swaps); - } - } -#endif - memcpy(&tmp, &prefs->jports[portswap], sizeof (struct jport)); - memcpy(&prefs->jports[portswap], &prefs->jports[portswap + 1], sizeof (struct jport)); - memcpy(&prefs->jports[portswap + 1], &tmp, sizeof (struct jport)); - inputdevice_updateconfig(NULL, prefs); + memcpy (&tmp, &prefs->jports[portswap], sizeof (struct jport)); + memcpy (&prefs->jports[portswap], &prefs->jports[portswap + 1], sizeof (struct jport)); + memcpy (&prefs->jports[portswap + 1], &tmp, sizeof (struct jport)); + inputdevice_updateconfig (NULL, prefs); } // swap device "devnum" ports 0<>1 and 2<>3 -void inputdevice_swap_ports(struct uae_prefs* p, int devnum) +void inputdevice_swap_ports (struct uae_prefs *p, int devnum) { - const struct inputdevice_functions* idf = getidf(devnum); - struct uae_input_device* uid = get_uid(idf, inputdevice_get_device_index(devnum)); + const struct inputdevice_functions *idf = getidf (devnum); + struct uae_input_device *uid = get_uid (idf, inputdevice_get_device_index (devnum)); int i, j, k, event, unit; const struct inputevent *ie, *ie2; - for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) - { - for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) - { + for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { + for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) { event = uid->eventid[i][j]; if (event <= 0) continue; @@ -6761,12 +5657,10 @@ void inputdevice_swap_ports(struct uae_prefs* p, int devnum) continue; unit = ie->unit; k = 1; - while (events[k].confname) - { + while (events[k].confname) { ie2 = &events[k]; if (ie2->type == ie->type && ie2->data == ie->data && ie2->unit - 1 == ((ie->unit - 1) ^ 1) && - ie2->allow_mask == ie->allow_mask && uid->port[i][j] == 0) - { + ie2->allow_mask == ie->allow_mask && uid->port[i][j] == 0) { uid->eventid[i][j] = k; break; } @@ -6777,37 +5671,27 @@ void inputdevice_swap_ports(struct uae_prefs* p, int devnum) } //memcpy (p->joystick_settings[dst], p->joystick_settings[src], sizeof (struct uae_input_device) * MAX_INPUT_DEVICES); -static void copydev(struct uae_input_device* dst, struct uae_input_device* src, int selectedwidget) +static void copydev (struct uae_input_device *dst, struct uae_input_device *src, int selectedwidget) { - for (int i = 0; i < MAX_INPUT_DEVICES; i++) - { - for (int j = 0; j < MAX_INPUT_DEVICE_EVENTS; j++) - { - if (j == selectedwidget || selectedwidget < 0) - { - for (int k = 0; k < MAX_INPUT_SUB_EVENT_ALL; k++) - { - xfree (dst[i].custom[j][k]); - } - } - } - if (selectedwidget < 0) - { - xfree (dst[i].configname); - xfree (dst[i].name); + for (int i = 0; i < MAX_INPUT_DEVICES; i++) { + for (int j = 0; j < MAX_INPUT_DEVICE_EVENTS; j++) { + if (j == selectedwidget || selectedwidget < 0) { + for (int k = 0; k < MAX_INPUT_SUB_EVENT_ALL; k++) { + xfree (dst[i].custom[j][k]); + } + } } + if (selectedwidget < 0) { + xfree (dst[i].configname); + xfree (dst[i].name); + } } - if (selectedwidget < 0) - { - memcpy(dst, src, sizeof (struct uae_input_device) * MAX_INPUT_DEVICES); - } - else - { + if (selectedwidget < 0) { + memcpy (dst, src, sizeof (struct uae_input_device) * MAX_INPUT_DEVICES); + } else { int j = selectedwidget; - for (int i = 0; i < MAX_INPUT_DEVICES; i++) - { - for (int k = 0; k < MAX_INPUT_SUB_EVENT_ALL; k++) - { + for (int i = 0; i < MAX_INPUT_DEVICES; i++) { + for (int k = 0; k < MAX_INPUT_SUB_EVENT_ALL; k++) { dst[i].eventid[j][k] = src[i].eventid[j][k]; dst[i].custom[j][k] = src[i].custom[j][k]; dst[i].flags[j][k] = src[i].flags[j][k]; @@ -6816,121 +5700,128 @@ static void copydev(struct uae_input_device* dst, struct uae_input_device* src, dst[i].extra[j] = src[i].extra[j]; } } - for (int i = 0; i < MAX_INPUT_DEVICES; i++) - { - for (int j = 0; j < MAX_INPUT_DEVICE_EVENTS; j++) - { - if (j == selectedwidget || selectedwidget < 0) - { - for (int k = 0; k < MAX_INPUT_SUB_EVENT_ALL; k++) - { - if (dst[i].custom) - dst[i].custom[j][k] = my_strdup(dst[i].custom[j][k]); - } - } + for (int i = 0; i < MAX_INPUT_DEVICES; i++) { + for (int j = 0; j < MAX_INPUT_DEVICE_EVENTS; j++) { + if (j == selectedwidget || selectedwidget < 0) { + for (int k = 0; k < MAX_INPUT_SUB_EVENT_ALL; k++) { + if (dst[i].custom) + dst[i].custom[j][k] = my_strdup (dst[i].custom[j][k]); + } + } } - if (selectedwidget < 0) - { - dst[i].configname = my_strdup(dst[i].configname); - dst[i].name = my_strdup(dst[i].name); + if (selectedwidget < 0) { + dst[i].configname = my_strdup (dst[i].configname); + dst[i].name = my_strdup (dst[i].name); } - } + } } // copy whole configuration #x-slot to another // +1 = default // +2 = default (pc keyboard) -void inputdevice_copy_single_config(struct uae_prefs* p, int src, int dst, int devnum, int selectedwidget) +void inputdevice_copy_single_config (struct uae_prefs *p, int src, int dst, int devnum, int selectedwidget) { - if (selectedwidget >= 0) - { + if (selectedwidget >= 0) { if (devnum < 0) return; - if (gettype(devnum) != IDTYPE_KEYBOARD) + if (gettype (devnum) != IDTYPE_KEYBOARD) return; } - if (src >= MAX_INPUT_SETTINGS) - { - if (gettype(devnum) == IDTYPE_KEYBOARD) - { + if (src >= MAX_INPUT_SETTINGS) { + if (gettype (devnum) == IDTYPE_KEYBOARD) { p->input_keyboard_type = src > MAX_INPUT_SETTINGS ? 1 : 0; keyboard_default = keyboard_default_table[p->input_keyboard_type]; - inputdevice_default_kb(p, dst); + inputdevice_default_kb (p, dst); } } if (src == dst) return; - if (src < MAX_INPUT_SETTINGS) - { - if (devnum < 0 || gettype(devnum) == IDTYPE_JOYSTICK) - copydev(p->joystick_settings[dst], p->joystick_settings[src], selectedwidget); - if (devnum < 0 || gettype(devnum) == IDTYPE_MOUSE) - copydev(p->mouse_settings[dst], p->mouse_settings[src], selectedwidget); - if (devnum < 0 || gettype(devnum) == IDTYPE_KEYBOARD) - copydev(p->keyboard_settings[dst], p->keyboard_settings[src], selectedwidget); + if (src < MAX_INPUT_SETTINGS) { + if (devnum < 0 || gettype (devnum) == IDTYPE_JOYSTICK) + copydev (p->joystick_settings[dst], p->joystick_settings[src], selectedwidget); + if (devnum < 0 || gettype (devnum) == IDTYPE_MOUSE) + copydev (p->mouse_settings[dst], p->mouse_settings[src], selectedwidget); + if (devnum < 0 || gettype (devnum) == IDTYPE_KEYBOARD) + copydev (p->keyboard_settings[dst], p->keyboard_settings[src], selectedwidget); } } -void inputdevice_acquire(int allmode) +void inputdevice_acquire (int allmode) { int i; //write_log (_T("inputdevice_acquire\n")); for (i = 0; i < MAX_INPUT_DEVICES; i++) - idev[IDTYPE_JOYSTICK].unacquire(i); + idev[IDTYPE_JOYSTICK].unacquire (i); for (i = 0; i < MAX_INPUT_DEVICES; i++) - idev[IDTYPE_MOUSE].unacquire(i); + idev[IDTYPE_MOUSE].unacquire (i); for (i = 0; i < MAX_INPUT_DEVICES; i++) - idev[IDTYPE_KEYBOARD].unacquire(i); + idev[IDTYPE_KEYBOARD].unacquire (i); - for (i = 0; i < MAX_INPUT_DEVICES; i++) - { - if ((use_joysticks[i] && allmode >= 0) || (allmode && !idev[IDTYPE_JOYSTICK].get_flags(i))) - idev[IDTYPE_JOYSTICK].acquire(i, 0); + for (i = 0; i < MAX_INPUT_DEVICES; i++) { + if ((use_joysticks[i] && allmode >= 0) || (allmode && !idev[IDTYPE_JOYSTICK].get_flags (i))) + idev[IDTYPE_JOYSTICK].acquire (i, 0); } - for (i = 0; i < MAX_INPUT_DEVICES; i++) - { - if ((use_mice[i] && allmode >= 0) || (allmode && !idev[IDTYPE_MOUSE].get_flags(i))) - idev[IDTYPE_MOUSE].acquire(i, allmode < 0); + for (i = 0; i < MAX_INPUT_DEVICES; i++) { + if ((use_mice[i] && allmode >= 0) || (allmode && !idev[IDTYPE_MOUSE].get_flags (i))) + idev[IDTYPE_MOUSE].acquire (i, allmode < 0); } - for (i = 0; i < MAX_INPUT_DEVICES; i++) - { - if ((use_keyboards[i] && allmode >= 0) || (allmode < 0 && !idev[IDTYPE_KEYBOARD].get_flags(i))) - idev[IDTYPE_KEYBOARD].acquire(i, allmode < 0); + // Always acquire first + enabled keyboards + for (i = 0; i < MAX_INPUT_DEVICES; i++) { + if (use_keyboards[i] || i == 0) + idev[IDTYPE_KEYBOARD].acquire (i, allmode < 0); } if (input_acquired) return; - idev[IDTYPE_JOYSTICK].acquire(-1, 0); - idev[IDTYPE_MOUSE].acquire(-1, 0); - idev[IDTYPE_KEYBOARD].acquire(-1, 0); + idev[IDTYPE_JOYSTICK].acquire (-1, 0); + idev[IDTYPE_MOUSE].acquire (-1, 0); + idev[IDTYPE_KEYBOARD].acquire (-1, 0); // if (!input_acquired) // write_log (_T("input devices acquired (%s)\n"), allmode ? "all" : "selected only"); input_acquired = 1; } -void inputdevice_unacquire() +void inputdevice_unacquire(bool emulationactive, int inputmask) { int i; - //write_log (_T("inputdevice_unacquire\n")); + //write_log (_T("inputdevice_unacquire %d %d\n"), emulationactive, inputmask); - for (i = 0; i < MAX_INPUT_DEVICES; i++) - idev[IDTYPE_JOYSTICK].unacquire(i); - for (i = 0; i < MAX_INPUT_DEVICES; i++) - idev[IDTYPE_MOUSE].unacquire(i); - for (i = 0; i < MAX_INPUT_DEVICES; i++) - idev[IDTYPE_KEYBOARD].unacquire(i); + if (!emulationactive) + inputmask = 0; + + + if (!(inputmask & 4)) { + for (i = 0; i < MAX_INPUT_DEVICES; i++) + idev[IDTYPE_JOYSTICK].unacquire (i); + } + if (!(inputmask & 2)) { + for (i = 0; i < MAX_INPUT_DEVICES; i++) + idev[IDTYPE_MOUSE].unacquire (i); + } + if (!(inputmask & 1)) { + for (i = 0; i < MAX_INPUT_DEVICES; i++) + idev[IDTYPE_KEYBOARD].unacquire (i); + } if (!input_acquired) return; input_acquired = 0; - idev[IDTYPE_JOYSTICK].unacquire(-1); - idev[IDTYPE_MOUSE].unacquire(-1); - idev[IDTYPE_KEYBOARD].unacquire(-1); + if (!(inputmask & 4)) + idev[IDTYPE_JOYSTICK].unacquire (-1); + if (!(inputmask & 2)) + idev[IDTYPE_MOUSE].unacquire (-1); + if (!(inputmask & 1)) + idev[IDTYPE_KEYBOARD].unacquire (-1); +} + +void inputdevice_unacquire(void) +{ + inputdevice_unacquire(false, 0); } /* Call this function when host machine's joystick/joypad/etc button state changes @@ -6943,58 +5834,26 @@ void inputdevice_unacquire() * state = 0 -> button released */ -void setjoybuttonstate(int joy, int button, int state) +void setjoybuttonstate (int joy, int button, int state) { - setbuttonstateall(&joysticks[joy], &joysticks2[joy], button, state ? 1 : 0); + setbuttonstateall (&joysticks[joy], &joysticks2[joy], button, state ? 1 : 0); } -/* buttonmask = 1 = normal toggle button, 0 = mouse wheel turn or similar -*/ -void setjoybuttonstateall (int joy, uae_u32 buttonbits, uae_u32 buttonmask) -{ - int i; - - for (i = 0; i < ID_BUTTON_TOTAL; i++) { - if (buttonmask & (1 << i)) - setbuttonstateall(&joysticks[joy], &joysticks2[joy], i, (buttonbits & (1 << i)) ? 1 : 0); - else if (buttonbits & (1 << i)) - setbuttonstateall(&joysticks[joy], &joysticks2[joy], i, -1); - } -} -/* mouse buttons (just like joystick buttons) -*/ -void setmousebuttonstateall(int mouse, uae_u32 buttonbits, uae_u32 buttonmask) -{ - int i; - uae_u32 obuttonmask = mice2[mouse].buttonmask; - - for (i = 0; i < ID_BUTTON_TOTAL; i++) { - if (buttonmask & (1 << i)) - setbuttonstateall(&mice[mouse], &mice2[mouse], i, (buttonbits & (1 << i)) ? 1 : 0); - else if (buttonbits & (1 << i)) - setbuttonstateall(&mice[mouse], &mice2[mouse], i, -1); - } - if (obuttonmask != mice2[mouse].buttonmask) - mousehack_helper(mice2[mouse].buttonmask); -} - -void setmousebuttonstate(int mouse, int button, int state) +void setmousebuttonstate (int mouse, int button, int state) { uae_u32 obuttonmask = mice2[mouse].buttonmask; - - setbuttonstateall(&mice[mouse], &mice2[mouse], button, state); + setbuttonstateall (&mice[mouse], &mice2[mouse], button, state); if (obuttonmask != mice2[mouse].buttonmask) - mousehack_helper(mice2[mouse].buttonmask); + mousehack_helper (mice2[mouse].buttonmask); } - /* same for joystick axis (analog or digital) * (0 = center, -max = full left/top, max = full right/bottom) */ -void setjoystickstate(int joy, int axis, int state, int max) +void setjoystickstate (int joy, int axis, int state, int max) { - struct uae_input_device* id = &joysticks[joy]; - struct uae_input_device2* id2 = &joysticks2[joy]; + struct uae_input_device *id = &joysticks[joy]; + struct uae_input_device2 *id2 = &joysticks2[joy]; int deadzone = currprefs.input_joymouse_deadzone * max / 100; int i, v1, v2; @@ -7008,8 +5867,7 @@ void setjoystickstate(int joy, int axis, int state, int max) //write_log (_T("%d:%d new=%d old=%d state=%d max=%d\n"), joy, axis, v1, v2, state, max); - if (!joysticks[joy].enabled) - { + if (!joysticks[joy].enabled) { if (v1 > 0) v1 = 1; else if (v1 < 0) @@ -7018,21 +5876,17 @@ void setjoystickstate(int joy, int axis, int state, int max) v2 = 1; else if (v2 < 0) v2 = -1; - if (v1 && v1 != v2 && (axis == 0 || axis == 1)) - { + if (v1 && v1 != v2 && (axis == 0 || axis == 1)) { static int prevdir; static struct timeval tv1; struct timeval tv2; - gettimeofday(&tv2, NULL); - if ((uae_s64)tv2.tv_sec * 1000000 + tv2.tv_usec < (uae_s64)tv1.tv_sec * 1000000 + tv1.tv_usec + 500000 && prevdir == v1) - { - switchdevice(&joysticks[joy], v1 < 0 ? 0 : 1, false); + gettimeofday (&tv2, NULL); + if ((uae_s64)tv2.tv_sec * 1000000 + tv2.tv_usec < (uae_s64)tv1.tv_sec * 1000000 + tv1.tv_usec + 500000 && prevdir == v1) { + switchdevice (&joysticks[joy], v1 < 0 ? 0 : 1, false); tv1.tv_sec = 0; tv1.tv_usec = 0; prevdir = 0; - } - else - { + } else { tv1.tv_sec = tv2.tv_sec; tv1.tv_usec = tv2.tv_usec; prevdir = v1; @@ -7040,66 +5894,54 @@ void setjoystickstate(int joy, int axis, int state, int max) } return; } - for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) - { + for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) { uae_u64 flags = id->flags[ID_AXIS_OFFSET + axis][i]; int state2 = v1; if (flags & ID_FLAG_INVERT) state2 = -state2; - if (state2 != id2->states[axis][i]) - { + if (state2 != id2->states[axis][i]) { //write_log(_T("-> %d %d\n"), i, state2); -#ifdef INPUTDEVICE_SIMPLE - handle_input_event(id->eventid[ID_AXIS_OFFSET + axis][i], state2, max, flags & ID_FLAG_AUTOFIRE); -#else - handle_input_event (id->eventid[ID_AXIS_OFFSET + axis][i], state2, max, flags & ID_FLAG_AUTOFIRE, true, false); -#endif + handle_input_event (id->eventid[ID_AXIS_OFFSET + axis][i], state2, max, flags & ID_FLAG_AUTOFIRE); id2->states[axis][i] = state2; } } id2->states[axis][MAX_INPUT_SUB_EVENT] = v1; } - -int getjoystickstate(int joy) +int getjoystickstate (int joy) { return joysticks[joy].enabled; } -void setmousestate(int mouse, int axis, int data, int isabs) +void setmousestate (int mouse, int axis, int data, int isabs) { int i, v, diff; int *mouse_p, *oldm_p; float d; - struct uae_input_device* id = &mice[mouse]; + struct uae_input_device *id = &mice[mouse]; static float fract[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS]; - if (!mice[mouse].enabled) - { - if (isabs && currprefs.input_tablet > 0) - { + if (!mice[mouse].enabled) { + if (isabs && currprefs.input_tablet > 0) { if (axis == 0) lastmx = data; else lastmy = data; if (axis) - mousehack_helper(mice2[mouse].buttonmask); + mousehack_helper (mice2[mouse].buttonmask); } return; } d = 0; mouse_p = &mouse_axis[mouse][axis]; oldm_p = &oldm_axis[mouse][axis]; - if (!isabs) - { + if (!isabs) { // eat relative movements while in mousehack mode - if (currprefs.input_tablet == TABLET_MOUSEHACK && mousehack_alive()) + if (currprefs.input_tablet == TABLET_MOUSEHACK && mousehack_alive () && axis < 2) return; *oldm_p = *mouse_p; *mouse_p += data; d = (*mouse_p - *oldm_p) * currprefs.input_mouse_speed / 100.0f; - } - else - { + } else { d = data - *oldm_p; *oldm_p = data; *mouse_p += d; @@ -7108,111 +5950,51 @@ void setmousestate(int mouse, int axis, int data, int isabs) else lastmy = data; if (axis) - mousehack_helper(mice2[mouse].buttonmask); - if (currprefs.input_tablet == TABLET_MOUSEHACK && mousehack_alive()) + mousehack_helper (mice2[mouse].buttonmask); + if (currprefs.input_tablet == TABLET_MOUSEHACK && mousehack_alive () && axis < 2) return; } - v = int(d); + v = (int)d; fract[mouse][axis] += d - v; - diff = int(fract[mouse][axis]); + diff = (int)fract[mouse][axis]; v += diff; fract[mouse][axis] -= diff; - for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) - { + for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) { uae_u64 flags = id->flags[ID_AXIS_OFFSET + axis][i]; if (!isabs && (flags & ID_FLAG_INVERT)) v = -v; -#ifdef INPUTDEVICE_SIMPLE - handle_input_event(id->eventid[ID_AXIS_OFFSET + axis][i], v, 0, 0); -#else - handle_input_event (id->eventid[ID_AXIS_OFFSET + axis][i], v, 0, 0, true, false); -#endif - } + handle_input_event (id->eventid[ID_AXIS_OFFSET + axis][i], v, 0, 0); + } } -int getmousestate(int joy) +int getmousestate (int joy) { return mice[joy].enabled; } -void warpmode(int mode) -{ - int fr, fr2; - - fr = currprefs.gfx_framerate; - if (fr == 0) - fr = -1; - fr2 = currprefs.turbo_emulation; - if (fr2 == -1) - fr2 = 0; - - if (mode < 0) { - if (currprefs.turbo_emulation) { - changed_prefs.gfx_framerate = currprefs.gfx_framerate = fr2; - currprefs.turbo_emulation = 0; - } - else { - currprefs.turbo_emulation = fr; - } - } - else if (mode == 0 && currprefs.turbo_emulation) { - if (currprefs.turbo_emulation > 0) - changed_prefs.gfx_framerate = currprefs.gfx_framerate = fr2; - currprefs.turbo_emulation = 0; - } - else if (mode > 0 && !currprefs.turbo_emulation) { - currprefs.turbo_emulation = fr; - } - if (currprefs.turbo_emulation) { - if (!currprefs.cpu_cycle_exact && !currprefs.blitter_cycle_exact) - changed_prefs.gfx_framerate = currprefs.gfx_framerate = 10; - pause_sound(); - } - else { - resume_sound(); - } - compute_vsynctime(); -#ifdef RETROPLATFORM - rp_turbo_cpu(currprefs.turbo_emulation); -#endif - changed_prefs.turbo_emulation = currprefs.turbo_emulation; - set_config_changed(); - setsystime(); -} - -void pausemode(int mode) -{ - if (mode < 0) - pause_emulation = pause_emulation ? 0 : 9; - else - pause_emulation = mode; - set_config_changed(); - setsystime(); -} - -int jsem_isjoy(int port, const struct uae_prefs* p) +int jsem_isjoy (int port, const struct uae_prefs *p) { int v = JSEM_DECODEVAL (port, p); if (v < JSEM_JOYS) return -1; v -= JSEM_JOYS; - if (v >= inputdevice_get_device_total(IDTYPE_JOYSTICK)) + if (v >= inputdevice_get_device_total (IDTYPE_JOYSTICK)) return -1; return v; } -int jsem_ismouse(int port, const struct uae_prefs* p) +int jsem_ismouse (int port, const struct uae_prefs *p) { int v = JSEM_DECODEVAL (port, p); if (v < JSEM_MICE) return -1; v -= JSEM_MICE; - if (v >= inputdevice_get_device_total(IDTYPE_MOUSE)) + if (v >= inputdevice_get_device_total (IDTYPE_MOUSE)) return -1; return v; } -int jsem_iskbdjoy(int port, const struct uae_prefs* p) +int jsem_iskbdjoy (int port, const struct uae_prefs *p) { int v = JSEM_DECODEVAL (port, p); if (v < JSEM_KBDLAYOUT) @@ -7223,9 +6005,7 @@ int jsem_iskbdjoy(int port, const struct uae_prefs* p) return v; } -static struct jport stored_ports[MAX_JPORTS]; - -static bool fixjport(struct jport *port, int add, bool always) +static bool fixjport (struct jport *port, int add, bool always) { bool wasinvalid = false; int vv = port->id; @@ -7234,254 +6014,265 @@ static bool fixjport(struct jport *port, int add, bool always) if (vv >= JSEM_JOYS && vv < JSEM_MICE) { vv -= JSEM_JOYS; vv += add; - if (vv >= inputdevice_get_device_total(IDTYPE_JOYSTICK)) + if (vv >= inputdevice_get_device_total (IDTYPE_JOYSTICK)) vv = 0; vv += JSEM_JOYS; - } - else if (vv >= JSEM_MICE && vv < JSEM_END) { + } else if (vv >= JSEM_MICE && vv < JSEM_END) { vv -= JSEM_MICE; vv += add; - if (vv >= inputdevice_get_device_total(IDTYPE_MOUSE)) + if (vv >= inputdevice_get_device_total (IDTYPE_MOUSE)) vv = 0; vv += JSEM_MICE; - } - else if (vv >= JSEM_KBDLAYOUT && vv < JSEM_LASTKBD) { + } else if (vv >= JSEM_KBDLAYOUT && vv < JSEM_LASTKBD) { vv -= JSEM_KBDLAYOUT; vv += add; if (vv >= JSEM_LASTKBD) vv = 0; vv += JSEM_KBDLAYOUT; } - else if (vv >= JSEM_CUSTOM && vv < JSEM_CUSTOM + MAX_JPORTS_CUSTOM) { - vv -= JSEM_CUSTOM; - vv += add; - if (vv >= MAX_JPORTS_CUSTOM) - vv = 0; - vv += JSEM_CUSTOM; - } if (port->id != vv || always) { port->idc.shortid[0] = 0; port->idc.configname[0] = 0; port->idc.name[0] = 0; if (vv >= JSEM_JOYS && vv < JSEM_MICE) { - _tcscpy(port->idc.name, inputdevice_get_device_name(IDTYPE_JOYSTICK, vv - JSEM_JOYS)); - _tcscpy(port->idc.configname, inputdevice_get_device_unique_name(IDTYPE_JOYSTICK, vv - JSEM_JOYS)); - } - else if (vv >= JSEM_MICE && vv < JSEM_END) { - _tcscpy(port->idc.name, inputdevice_get_device_name(IDTYPE_MOUSE, vv - JSEM_MICE)); - _tcscpy(port->idc.configname, inputdevice_get_device_unique_name(IDTYPE_MOUSE, vv - JSEM_MICE)); - } - else if (vv >= JSEM_KBDLAYOUT && vv < JSEM_CUSTOM) { + _tcscpy(port->idc.name, inputdevice_get_device_name (IDTYPE_JOYSTICK, vv - JSEM_JOYS)); + _tcscpy(port->idc.configname, inputdevice_get_device_unique_name (IDTYPE_JOYSTICK, vv - JSEM_JOYS)); + } else if (vv >= JSEM_MICE && vv < JSEM_END) { + _tcscpy(port->idc.name, inputdevice_get_device_name (IDTYPE_MOUSE, vv - JSEM_MICE)); + _tcscpy(port->idc.configname, inputdevice_get_device_unique_name (IDTYPE_MOUSE, vv - JSEM_MICE)); + } else if (vv >= JSEM_KBDLAYOUT && vv < JSEM_CUSTOM) { _stprintf(port->idc.shortid, _T("kbd%d"), vv - JSEM_KBDLAYOUT + 1); } wasinvalid = true; -#if 0 - write_log(_T("fixjport %d %d %d (%s)\n"), port->id, vv, add, port->name); -#endif } port->id = vv; return wasinvalid; } -void inputdevice_validate_jports(struct uae_prefs* p, int changedport) +static void inputdevice_get_previous_joy(struct uae_prefs *p, int portnum) { - int i, j; - for (i = 0; i < MAX_JPORTS; i++) { - fixjport(&p->jports[i], 0, changedport == i); + struct jport *jpx = &p->jports[portnum]; + bool found = false; + int idx = 0; + for (;;) { + struct jport *jp = inputdevice_get_used_device(portnum, idx); + if (!jp) + break; + if (jp->idc.configname[0]) { + found = inputdevice_joyport_config(p, jp->idc.name, jp->idc.configname, portnum, jp->mode, 1, true) != 0; + if (!found && jp->id == JPORT_UNPLUGGED) + found = inputdevice_joyport_config(p, jp->idc.name, NULL, portnum, jp->mode, 1, true) != 0; + } else if (jp->id < JSEM_JOYS && jp->id >= 0) { + jpx->id = jp->id; + found = true; + } + if (found) { + jpx->mode = jp->mode; + jpx->autofire = jp->autofire; + inputdevice_set_newest_used_device(portnum, jp); + break; + } + idx++; } - for (i = 0; i < MAX_JPORTS; i++) - { + if (!found) { + if (default_keyboard_layout[portnum] > 0) { + p->jports[portnum].id = default_keyboard_layout[portnum] - 1; + } else { + p->jports[portnum].id = JPORT_NONE; + } + } +} + +void inputdevice_validate_jports (struct uae_prefs *p, int changedport, bool *fixedports) +{ + for (int i = 0; i < MAX_JPORTS; i++) { + fixjport (&p->jports[i], 0, changedport == i); + } + + for (int i = 0; i < MAX_JPORTS; i++) { if (p->jports[i].id < 0) continue; - for (j = 0; j < MAX_JPORTS; j++) - { + for (int j = 0; j < MAX_JPORTS; j++) { if (p->jports[j].id < 0) continue; if (j == i) continue; - if (p->jports[i].id == p->jports[j].id) - { - if (i == changedport) - { - restore_inputdevice_config(p, j); - } - else if (j == changedport) - { - restore_inputdevice_config(p, i); - } + if (p->jports[i].id == p->jports[j].id) { int cnt = 0; - while (p->jports[i].id == p->jports[j].id) - { + for (;;) { int k; - if (i == changedport) - { + if (i == changedport) { k = j; - } - else - { + if (fixedports && fixedports[k]) { + k = i; + } + } else { k = i; } - fixjport(&p->jports[k], 1, false); - cnt++; - if (cnt > 10) - p->jports[k].id = JSEM_KBDLAYOUT; - if (cnt > 20) + // same in other slots too? + bool other = false; + for (int l = 0; l < MAX_JPORTS; l++) { + if (l == k) + continue; + if (p->jports[l].id == p->jports[k].id) { + other = true; + } + } + + if (!other && p->jports[i].id != p->jports[j].id) break; + + struct jport *jp = NULL; + for (;;) { + jp = inputdevice_get_used_device(k, cnt); + cnt++; + if (!jp) + break; + if (jp->id < 0) + continue; + memcpy(&p->jports[k].id, jp, sizeof(struct jport)); + if (fixjport(&p->jports[k], 0, false)) + continue; + inputdevice_set_newest_used_device(k, &p->jports[k]); + break; + } + if (jp) + continue; + freejport(p, k); + break; } } } } } -static void inputdevice_inserted(struct uae_prefs* p, int portnum, int id, int type) -{ - for (int k = 0; k < MAX_JPORTS; k++) - { - if (p->jports[k].id == id && k != portnum) - { - if (type == IDTYPE_JOYSTICK) - { - // if this joystick is already in port 0, reset port 0 back to original - if (k == 0 && portnum == 1) - { - memcpy(&p->jports[0], &stored_ports[0], sizeof (struct jport)); - return; - } - } - else if (type == IDTYPE_MOUSE) - { - return; - } - return; - } - } -} - -void store_inputdevice_config(struct uae_prefs* p) -{ - for (int i = 0; i < MAX_JPORTS; i++) - { - memcpy(&stored_ports[i], &p->jports[i], sizeof (struct jport)); - } -} - -void restore_inputdevice_config(struct uae_prefs* p, int portnum) -{ - memcpy(&p->jports[portnum], &stored_ports[portnum], sizeof (struct jport)); -} - void inputdevice_joyport_config_store(struct uae_prefs *p, const TCHAR *value, int portnum, int mode, int type) { struct jport *jp = &p->jports[portnum]; if (type == 2) { _tcscpy(jp->idc.name, value); - } - else if (type == 1) { + } else if (type == 1) { _tcscpy(jp->idc.configname, value); - } - else { + } else { _tcscpy(jp->idc.shortid, value); } if (mode >= 0) jp->mode = mode; } -int inputdevice_joyport_config(struct uae_prefs* p, const TCHAR* value, int portnum, int mode, int type, bool validate) +int inputdevice_joyport_config (struct uae_prefs *p, const TCHAR *value1, const TCHAR *value2, int portnum, int mode, int type, bool candefault) { switch (type) { - case 1: - case 2: + case 1: // check and set + case 2: // check only { - int i, j; - for (j = 0; j < MAX_JPORTS; j++) - { - struct inputdevice_functions* idf; - int type = IDTYPE_MOUSE; + for (int j = 0; j < 2; j++) { + int matched = -1; + struct inputdevice_functions *idf; + int dtype = IDTYPE_MOUSE; int idnum = JSEM_MICE; - if (j > 0) - { - type = IDTYPE_JOYSTICK; + if (j > 0) { + dtype = IDTYPE_JOYSTICK; idnum = JSEM_JOYS; } - idf = &idev[type]; - for (i = 0; i < idf->get_num(); i++) - { - const char* name2 = idf->get_uniquename(i); - if (name2 && !_tcscmp (name2, value)) - { - if (validate) - inputdevice_inserted(p, portnum, idnum + i, type); - p->jports[portnum].id = idnum + i; - if (mode >= 0) - p->jports[portnum].mode = mode; - return 1; + idf = &idev[dtype]; + if (value1 && value2) { + for (int i = 0; i < idf->get_num(); i++) { + const TCHAR* name1 = idf->get_friendlyname(i); + const TCHAR* name2 = idf->get_uniquename(i); + if (name2 && !_tcscmp(name2, value2) && name1 && !_tcscmp(name1, value1)) { + // config+friendlyname matched: don't bother to check for duplicates + matched = i; + break; + } } } - for (i = 0; i < idf->get_num(); i++) - { - const char* name1 = idf->get_friendlyname(i); - if (name1 && !_tcscmp (name1, value)) - { - if (validate) - inputdevice_inserted(p, portnum, idnum + i, type); - p->jports[portnum].id = idnum + i; + if (matched < 0 && value2) { + matched = -1; + for (int i = 0; i < idf->get_num (); i++) { + const TCHAR* name2 = idf->get_uniquename(i); + if (name2 && !_tcscmp (name2, value2)) { + if (matched >= 0) { + matched = -2; + break; + } else { + matched = i; + } + } + } + } + if (matched < 0 && value1) { + matched = -1; + for (int i = 0; i < idf->get_num (); i++) { + const TCHAR* name1 = idf->get_friendlyname(i); + if (name1 && !_tcscmp (name1, value1)) { + if (matched >= 0) { + matched = -2; + break; + } else { + matched = i; + } + } + } + } + if (matched >= 0) { + if (type == 1) { + if (value1) + _tcscpy(p->jports[portnum].idc.name, value1); + if (value2) + _tcscpy(p->jports[portnum].idc.configname, value2); + p->jports[portnum].id = idnum + matched; if (mode >= 0) p->jports[portnum].mode = mode; - return 1; + set_config_changed (); } + return 1; } } + return 0; } break; case 0: { int start = JPORT_NONE, got = 0, max = -1; int type = -1; - const TCHAR* pp = 0; - if (_tcsncmp (value, _T("kbd"), 3) == 0) - { + const TCHAR *pp = NULL; + if (_tcsncmp (value1, _T("kbd"), 3) == 0) { start = JSEM_KBDLAYOUT; - pp = value + 3; + pp = value1 + 3; got = 1; max = JSEM_LASTKBD; - } - else if (_tcsncmp (value, _T("joy"), 3) == 0) - { + } else if (_tcscmp(value1, _T("joydefault")) == 0) { type = IDTYPE_JOYSTICK; start = JSEM_JOYS; - pp = value + 3; got = 1; - max = idev[IDTYPE_JOYSTICK].get_num(); - } - else if (_tcsncmp (value, _T("mouse"), 5) == 0) - { + } else if (_tcscmp(value1, _T("mousedefault")) == 0) { type = IDTYPE_MOUSE; start = JSEM_MICE; - pp = value + 5; got = 1; - max = idev[IDTYPE_MOUSE].get_num(); - } - else if (_tcscmp (value, _T("none")) == 0) - { + } else if (_tcsncmp (value1, _T("joy"), 3) == 0) { + type = IDTYPE_JOYSTICK; + start = JSEM_JOYS; + pp = value1 + 3; + got = 1; + max = idev[IDTYPE_JOYSTICK].get_num (); + } else if (_tcsncmp (value1, _T("mouse"), 5) == 0) { + type = IDTYPE_MOUSE; + start = JSEM_MICE; + pp = value1 + 5; + got = 1; + max = idev[IDTYPE_MOUSE].get_num (); + } else if (_tcscmp(value1, _T("none")) == 0) { got = 2; } - else if (_tcscmp (value, _T("custom")) == 0) - { - got = 2; - start = JSEM_CUSTOM; - } - if (got) - { - if (pp && max != 0) - { + if (got) { + if (pp && max != 0) { int v = _tstol (pp); - if (start >= 0) - { + if (start >= 0) { if (start == JSEM_KBDLAYOUT && v > 0) v--; - if (v >= 0) - { + if (v >= 0) { if (v >= max) v = 0; start += v; @@ -7489,21 +6280,22 @@ int inputdevice_joyport_config(struct uae_prefs* p, const TCHAR* value, int port } } } - if (got == 2) - { - if (validate) - inputdevice_inserted(p, portnum, start, type); + if (got >= 2) { p->jports[portnum].id = start; if (mode >= 0) p->jports[portnum].mode = mode; if (start < JSEM_JOYS) - default_keyboard_layout[portnum] = start; + default_keyboard_layout[portnum] = start + 1; + if (got == 2 && candefault) { + inputdevice_store_used_device(&p->jports[portnum], portnum, false); + } + set_config_changed (); return 1; } - // joystick not found, select default - if (start == JSEM_JOYS && p->jports[portnum].id < JSEM_JOYS) - { - p->jports[portnum].id = default_keyboard_layout[portnum]; + // joystick not found, select previously used or default + if (start == JSEM_JOYS && p->jports[portnum].id < JSEM_JOYS) { + inputdevice_get_previous_joy(p, portnum); + set_config_changed (); return 1; } } @@ -7513,108 +6305,116 @@ int inputdevice_joyport_config(struct uae_prefs* p, const TCHAR* value, int port return 0; } -int inputdevice_getjoyportdevice(int port, int val) +int inputdevice_getjoyportdevice (int port, int val) { int idx; - if (val == JSEM_CUSTOM) - { - idx = inputdevice_get_device_total(IDTYPE_JOYSTICK) + JSEM_LASTKBD; - if (port < 2) - idx += inputdevice_get_device_total(IDTYPE_MOUSE); - } - else if (val < 0) - { + if (val < 0) { idx = -1; - } - else if (val >= JSEM_MICE) - { + } else if (val >= JSEM_MICE) { idx = val - JSEM_MICE; - if (idx >= inputdevice_get_device_total(IDTYPE_MOUSE)) + if (idx >= inputdevice_get_device_total (IDTYPE_MOUSE)) idx = 0; else - idx += inputdevice_get_device_total(IDTYPE_JOYSTICK); + idx += inputdevice_get_device_total (IDTYPE_JOYSTICK); idx += JSEM_LASTKBD; - } - else if (val >= JSEM_JOYS) - { + } else if (val >= JSEM_JOYS) { idx = val - JSEM_JOYS; - if (idx >= inputdevice_get_device_total(IDTYPE_JOYSTICK)) + if (idx >= inputdevice_get_device_total (IDTYPE_JOYSTICK)) idx = 0; idx += JSEM_LASTKBD; - } - else - { + } else { idx = val - JSEM_KBDLAYOUT; } return idx; } -// for state recorder use only! - -uae_u8 *save_inputstate(int *len, uae_u8 *dstptr) +void inputdevice_fix_prefs(struct uae_prefs *p, bool userconfig) { - uae_u8 *dstbak, *dst; + struct jport jport_config_store[MAX_JPORTS]; - if (dstptr) - dstbak = dst = dstptr; - else - dstbak = dst = xmalloc(uae_u8, 1000); for (int i = 0; i < MAX_JPORTS; i++) { - save_u16(joydir[i]); - save_u16(joybutton[i]); - save_u16(otop[i]); - save_u16(obot[i]); - save_u16(oleft[i]); - save_u16(oright[i]); + memcpy(&jport_config_store[i], &p->jports[i], sizeof(struct jport)); } - for (int i = 0; i < NORMAL_JPORTS; i++) { - save_u16(cd32_shifter[i]); - for (int j = 0; j < 2; j++) { - save_u16(pot_cap[i][j]); - save_u16(joydirpot[i][j]); - } - } - for (int i = 0; i < NORMAL_JPORTS; i++) { - for (int j = 0; j < MOUSE_AXIS_TOTAL; j++) { - save_u16(mouse_delta[i][j]); - save_u16(mouse_deltanoreset[i][j]); - } - save_u16(mouse_frame_x[i]); - save_u16(mouse_frame_y[i]); - } - *len = dst - dstbak; - return dstbak; -} -uae_u8 *restore_inputstate(uae_u8 *src) -{ + bool defaultports = userconfig == false; + bool matched[MAX_JPORTS]; + // configname+friendlyname first for (int i = 0; i < MAX_JPORTS; i++) { - joydir[i] = restore_u16(); - joybutton[i] = restore_u16(); - otop[i] = restore_u16(); - obot[i] = restore_u16(); - oleft[i] = restore_u16(); - oright[i] = restore_u16(); - } - for (int i = 0; i < NORMAL_JPORTS; i++) { - cd32_shifter[i] = restore_u16(); - for (int j = 0; j < 2; j++) { - pot_cap[i][j] = restore_u16(); - joydirpot[i][j] = restore_u16(); + struct jport *jp = &jport_config_store[i]; + matched[i] = false; + if (jp->idc.configname[0] && jp->idc.name[0]) { + if (inputdevice_joyport_config(p, jp->idc.name, jp->idc.configname, i, jp->mode, 1, userconfig)) { + inputdevice_validate_jports(p, i, matched); + inputdevice_store_used_device(&p->jports[i], i, defaultports); + matched[i] = true; + write_log(_T("Port%d: COMBO '%s' + '%s' matched\n"), i, jp->idc.name, jp->idc.configname); + } } } - for (int i = 0; i < NORMAL_JPORTS; i++) { - for (int j = 0; j < MOUSE_AXIS_TOTAL; j++) { - mouse_delta[i][j] = restore_u16(); - mouse_deltanoreset[i][j] = restore_u16(); + // configname next + for (int i = 0; i < MAX_JPORTS; i++) { + if (!matched[i]) { + struct jport *jp = &jport_config_store[i]; + if (jp->idc.configname[0]) { + if (inputdevice_joyport_config(p, NULL, jp->idc.configname, i, jp->mode, 1, userconfig)) { + inputdevice_validate_jports(p, i, matched); + inputdevice_store_used_device(&p->jports[i], i, defaultports); + matched[i] = true; + write_log(_T("Port%d: CONFIG '%s' matched\n"), i, jp->idc.configname); + } + } + } + } + // friendly name next + for (int i = 0; i < MAX_JPORTS; i++) { + if (!matched[i]) { + struct jport *jp = &jport_config_store[i]; + if (jp->idc.name[0]) { + if (inputdevice_joyport_config(p, jp->idc.name, NULL, i, jp->mode, 1, userconfig)) { + inputdevice_validate_jports(p, i, matched); + inputdevice_store_used_device(&p->jports[i], i, defaultports); + matched[i] = true; + write_log(_T("Port%d: NAME '%s' matched\n"), i, jp->idc.name); + } + } + } + } + // joyportX last and only if no name/configname + for (int i = 0; i < MAX_JPORTS; i++) { + if (!matched[i]) { + struct jport *jp = &jport_config_store[i]; + if (jp->idc.shortid[0] && !jp->idc.name[0] && !jp->idc.configname[0]) { + if (inputdevice_joyport_config(p, jp->idc.shortid, NULL, i, jp->mode, 0, userconfig)) { + inputdevice_validate_jports(p, i, matched); + inputdevice_store_used_device(&p->jports[i], i, defaultports); + matched[i] = true; + write_log(_T("Port%d: ID '%s' matched\n"), i, jp->idc.shortid); + } + } + if (!matched[i]) { + if (jp->idc.configname[0] && jp->idc.name[0]) { + struct jport jpt = { 0 }; + memcpy(&jpt.idc, &jp->idc, sizeof(struct inputdevconfig)); + jpt.id = JPORT_UNPLUGGED; + write_log(_T("Unplugged stored, port %d '%s' (%s)\n"), i, jp->idc.name, jp->idc.configname); + inputdevice_store_used_device(&jpt, i, defaultports); + freejport(p, i); + inputdevice_get_previous_joy(p, i); + matched[i] = true; + } + } + } + } + for (int i = 0; i < MAX_JPORTS; i++) { + if (!matched[i]) { + struct jport *jp = &jport_config_store[i]; + freejport(p, i); + if (jp->id != JPORT_NONE) { + inputdevice_get_previous_joy(p, i); + write_log(_T("Port%d: ID=%d getting previous: %d\n"), i, jp->id, p->jports[i].id); + } else { + write_log(_T("Port%d: NONE\n"), i); + } } - mouse_frame_x[i] = restore_u16(); - mouse_frame_y[i] = restore_u16(); } - return src; } - -void clear_inputstate() -{ - -} \ No newline at end of file diff --git a/src/jit/compemu.h b/src/jit/compemu.h index 5ea9ca9e..247dfed4 100644 --- a/src/jit/compemu.h +++ b/src/jit/compemu.h @@ -2,7 +2,7 @@ * compiler/compemu.h - Public interface and definitions * * Copyright (c) 2001-2004 Milan Jurik of ARAnyM dev team (see AUTHORS) - * + * * Inspired by Christian Bauer's Basilisk II * * This file is part of the ARAnyM project which builds a new and powerful @@ -29,12 +29,16 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -typedef uae_u32 uintptr; +#ifndef COMPEMU_H +#define COMPEMU_H -#define panicbug printf +typedef uae_u32 uintptr; /* Flags for Bernie during development/debugging. Should go away eventually */ #define DISTRUST_CONSISTENT_MEM 0 +/* Now that we do block chaining, and also have linked lists on each tag, + TAGMASK can be much smaller and still do its job. Saves several megs + of memory! */ #define TAGMASK 0x0000ffff #define TAGSIZE (TAGMASK+1) #define MAXRUN 1024 @@ -45,15 +49,13 @@ extern uae_u32 start_pc; struct blockinfo_t; -typedef struct -{ - uae_u16* location; - uae_u8 cycles; - uae_u8 specmem; +typedef struct { + uae_u16* location; + uae_u8 cycles; + uae_u8 specmem; } cpu_history; -typedef union -{ +typedef union { cpuop_func* handler; struct blockinfo_t* bi; } cacheline; @@ -75,8 +77,6 @@ typedef union #define USE_CHECKSUM_INFO 1 #endif -#define USE_ALIAS 1 -#define USE_F_ALIAS 1 #define COMP_DEBUG 0 #if COMP_DEBUG @@ -131,7 +131,6 @@ typedef union /* Functions exposed to newcpu, or to what was moved from newcpu.c to * compemu_support.c */ -extern void compiler_init(void); extern void compiler_exit(void); extern void init_comp(void); extern void flush(int save_regs); @@ -143,8 +142,8 @@ extern void set_cache_state(int enabled); extern int get_cache_state(void); extern uae_u32 get_jitted_size(void); #ifdef JIT -extern void (*flush_icache)(uaecptr ptr, int n); -extern void flush_icache_hard(uaecptr ptr, int n); +extern void flush_icache(int n); +extern void flush_icache_hard(int n); #endif extern void alloc_cache(void); extern void compile_block(cpu_history* pc_hist, int blocklen, int totcyles); @@ -157,9 +156,6 @@ extern uae_u8* comp_pc_p; extern void* pushall_call_handler; #define VREGS 32 -#ifdef USE_JIT_FPU -#define VFREGS 16 -#endif #define INMEM 1 #define CLEAN 2 @@ -167,42 +163,28 @@ extern void* pushall_call_handler; #define UNDEF 4 #define ISCONST 5 -typedef struct -{ - uae_u32* mem; - uae_u32 val; - uae_u8 status; - uae_s8 realreg; /* gb-- realreg can hold -1 */ - uae_u8 realind; /* The index in the holds[] array */ - uae_u8 validsize; - uae_u8 dirtysize; +typedef struct { + uae_u32* mem; + uae_u32 val; + uae_u8 status; + uae_s8 realreg; /* gb-- realreg can hold -1 */ + uae_u8 realind; /* The index in the holds[] array */ + uae_u8 validsize; + uae_u8 dirtysize; } reg_status; -#ifdef USE_JIT_FPU -typedef struct -{ - uae_u32* mem; - double val; - uae_u8 status; - uae_s8 realreg; /* gb-- realreg can hold -1 */ - uae_u8 realind; - uae_u8 needflush; -} freg_status; -#endif - -typedef struct -{ +typedef struct { uae_u8 use_flags; uae_u8 set_flags; uae_u8 is_addx; - uae_u8 cflow; + uae_u8 cflow; } op_properties; extern op_properties prop[65536]; STATIC_INLINE int end_block(uae_u16 opcode) { - return (prop[opcode].cflow & fl_end_block); + return (prop[opcode].cflow & fl_end_block); } #define PC_P 16 @@ -227,24 +209,13 @@ STATIC_INLINE int end_block(uae_u16 opcode) #define FS2 10 #define FS3 11 -typedef struct -{ - uae_u32 touched; - uae_s8 holds[VREGS]; - uae_u8 nholds; - uae_u8 locked; +typedef struct { + uae_u32 touched; + uae_s8 holds[VREGS]; + uae_u8 nholds; + uae_u8 locked; } n_status; -#ifdef USE_JIT_FPU -typedef struct -{ - uae_u32 touched; - uae_s8 holds[VFREGS]; - uae_u8 nholds; - uae_u8 locked; -} fn_status; -#endif - /* For flag handling */ #define NADA 1 #define TRASH 2 @@ -255,31 +226,23 @@ typedef struct #define NF_TOMEM 1 #define NF_HANDLER 2 -typedef struct -{ +typedef struct { /* Integer part */ reg_status state[VREGS]; n_status nat[N_REGS]; uae_u32 flags_on_stack; uae_u32 flags_in_flags; uae_u32 flags_are_important; -#ifdef USE_JIT_FPU - /* FPU part */ - freg_status fate[VFREGS]; - fn_status fat[N_FREGS]; -#endif } bigstate; -typedef struct -{ +typedef struct { /* Integer part */ - uae_s8 virt[VREGS]; - uae_s8 nat[N_REGS]; + uae_s8 virt[VREGS]; + uae_s8 nat[N_REGS]; } smallstate; extern int touchcnt; - #define IMM uae_s32 #define RR1 uae_u32 #define RR2 uae_u32 @@ -311,10 +274,12 @@ extern int touchcnt; #if defined(CPU_arm) #include "compemu_midfunc_arm.h" #include "compemu_midfunc_arm2.h" -#else -#include "compemu_midfunc_x86.h" #endif +//#if defined(CPU_i386) || defined(CPU_x86_64) +//#include "compemu_midfunc_x86.h" +//#endif + #undef DECLARE_MIDFUNC extern int failure; @@ -344,24 +309,21 @@ extern void register_branch(uae_u32 not_taken, uae_u32 taken, uae_u8 cond); struct blockinfo_t; -typedef struct dep_t -{ - uae_u32* jmp_off; - struct blockinfo_t* target; - struct blockinfo_t* source; - struct dep_t** prev_p; - struct dep_t* next; +typedef struct dep_t { + uae_u32* jmp_off; + struct blockinfo_t* target; + struct blockinfo_t* source; + struct dep_t** prev_p; + struct dep_t* next; } dependency; -typedef struct checksum_info_t -{ - uae_u8 *start_p; - uae_u32 length; - struct checksum_info_t *next; +typedef struct checksum_info_t { + uae_u8 *start_p; + uae_u32 length; + struct checksum_info_t *next; } checksum_info; -typedef struct blockinfo_t -{ +typedef struct blockinfo_t { uae_s32 count; cpuop_func* direct_handler_to_use; cpuop_func* handler_to_use; @@ -373,6 +335,7 @@ typedef struct blockinfo_t cpuop_func* direct_pen; cpuop_func* direct_pcc; + uae_u8* nexthandler; uae_u8* pc_p; uae_u32 c1; @@ -397,11 +360,6 @@ typedef struct blockinfo_t dependency dep[2]; /* Holds things we depend on */ dependency* deplist; /* List of things that depend on this */ smallstate env; - -#ifdef JIT_DEBUG - /* (gb) size of the compiled block (direct handler) */ - uae_u32 direct_handler_size; -#endif } blockinfo; #define BI_INVALID 0 @@ -423,3 +381,9 @@ void comp_fbcc_opp (uae_u32 opcode); void comp_fsave_opp (uae_u32 opcode); void comp_frestore_opp (uae_u32 opcode); void comp_fpp_opp (uae_u32 opcode, uae_u16 extra); + +void jit_abort(const TCHAR *format,...); + +#define uae_p32(x) ((uae_u32)(x)) + +#endif /* COMPEMU_H */ diff --git a/src/jit/compemu_support.cpp b/src/jit/compemu_support.cpp index 32624363..699033ce 100644 --- a/src/jit/compemu_support.cpp +++ b/src/jit/compemu_support.cpp @@ -29,7 +29,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #define writemem_special writemem #define readmem_special readmem @@ -44,10 +43,22 @@ #include "custom.h" #include "comptbl.h" #include "compemu.h" -#include "SDL.h" +#include #define DEBUG 0 -#include "debug.h" + +#if DEBUG +#define PROFILE_COMPILE_TIME 1 +#define PROFILE_UNTRANSLATED_INSNS 1 +#endif + +#ifndef UNUSED +#define UNUSED(x) ((void)x) +#endif + +#define jit_log(format, ...) \ + write_log("JIT: " format "\n", ##__VA_ARGS__); +#define jit_log2(format, ...) #ifdef JIT_DEBUG #undef abort @@ -59,11 +70,28 @@ } while (0) #endif +#ifdef PROFILE_COMPILE_TIME +#include +static uae_u32 compile_count = 0; +static clock_t compile_time = 0; +static clock_t emul_start_time = 0; +static clock_t emul_end_time = 0; +#endif + +#ifdef PROFILE_UNTRANSLATED_INSNS +static int untranslated_top_ten = 30; +static uae_u32 raw_cputbl_count[65536] = { 0, }; +static uae_u16 opcode_nums[65536]; + + +static int untranslated_compfn(const void *e1, const void *e2) +{ + return raw_cputbl_count[*(const uae_u16 *)e1] < raw_cputbl_count[*(const uae_u16 *)e2]; +} +#endif + #define NATMEM_OFFSETX (uae_u32)natmem_offset -// %%% BRIAN KING WAS HERE %%% -#include -extern void jit_abort(const TCHAR*,...); static compop_func *compfunctbl[65536]; static compop_func *nfcompfunctbl[65536]; #ifdef NOFLAGS_SUPPORT @@ -72,31 +100,19 @@ static cpuop_func *nfcpufunctbl[65536]; uae_u8* comp_pc_p; // gb-- Extra data for Basilisk II/JIT -#ifdef JIT_DEBUG -static int JITDebug = 0; // Enable runtime disassemblers through mon? -#else -const int JITDebug= 0; // Don't use JIT debug mode at all -#endif #if USE_INLINING -static int follow_const_jumps = 1; // Flag: translation through constant jumps +#define follow_const_jumps (true) #else const int follow_const_jumps = 0; #endif +static uae_u32 cache_size = 0; // Size of total cache allocated for compiled blocks static uae_u32 current_cache_size = 0; // Cache grows upwards: how much has been consumed already -static int lazy_flush = 1; // Flag: lazy translation cache invalidation -static int avoid_fpu = 1; // Flag: compile FPU instructions ? -const int tune_alignment = 1; // Tune code alignments for running CPU ? -const int tune_nop_fillers = 1; // Tune no-op fillers for architecture -static int setzflg_uses_bsf = 0; // setzflg virtual instruction can use native BSF instruction correctly? -static int align_loops = 0; // Align the start of loops -static int align_jumps = 0; // Align the start of jumps -static int optcount[10] = { -#ifdef UAE +#define avoid_fpu (true) +static const int align_loops = 0; // Align the start of loops +static const int align_jumps = 0; // Align the start of jumps +static int optcount[10] = { 4, // How often a block has to be executed before it is translated -#else - 10, // How often a block has to be executed before it is translated -#endif 0, // How often to use naive translation 0, 0, 0, 0, -1, -1, -1, -1 @@ -109,11 +125,6 @@ STATIC_INLINE bool is_const_jump(uae_u32 opcode) return (prop[opcode].cflow == fl_const_jump); } -STATIC_INLINE bool may_trap(uae_u32 opcode) -{ - return (prop[opcode].cflow & fl_trap); -} - STATIC_INLINE unsigned int cft_map (unsigned int f) { return f; @@ -130,11 +141,11 @@ static int branch_cc; static int redo_current_block; int segvcount = 0; -static uae_u8* current_compile_p = NULL; +uae_u8* current_compile_p = NULL; static uae_u8* max_compile_start; uae_u8* compiled_code = NULL; const int POPALLSPACE_SIZE = 2048; /* That should be enough space */ -static uae_u8 *popallspace = NULL; +uae_u8 *popallspace = NULL; void* pushall_call_handler = NULL; static void* popall_do_nothing = NULL; @@ -145,16 +156,18 @@ static void* popall_recompile_block = NULL; static void* popall_check_checksum = NULL; /* The 68k only ever executes from even addresses. So right now, we - waste half the entries in this array - UPDATE: We now use those entries to store the start of the linked - lists that we maintain for each hash result. */ + * waste half the entries in this array + * UPDATE: We now use those entries to store the start of the linked + * lists that we maintain for each hash result. + */ static cacheline cache_tags[TAGSIZE]; static int letit=0; static blockinfo* hold_bi[MAX_HOLD_BI]; -static blockinfo* active; -static blockinfo* dormant; +blockinfo* active; +blockinfo* dormant; -#ifdef AMIBERRY +#if !defined (WIN32) || !defined(ANDROID) +#include void cache_free (uae_u8 *cache, int size) { @@ -171,7 +184,7 @@ uae_u8 *cache_alloc (int size) } else memset(cache, 0, size); - return static_cast(cache); + return (uae_u8 *) cache; } #endif @@ -182,6 +195,7 @@ extern const struct cputbl op_smalltbl_0_nf[]; #endif extern const struct comptbl op_smalltbl_0_comp_nf[]; extern const struct comptbl op_smalltbl_0_comp_ff[]; + #ifdef NOFLAGS_SUPPORT /* 68020 + 68881 */ extern const struct cputbl op_smalltbl_1_nf[]; @@ -195,11 +209,6 @@ extern const struct cputbl op_smalltbl_4_nf[]; extern const struct cputbl op_smalltbl_5_nf[]; #endif -//static void flush_icache_hard(uaecptr ptr, int n); -static void flush_icache_lazy(uaecptr ptr, int n); -static void flush_icache_none(uaecptr ptr, int n); -void (*flush_icache)(uaecptr ptr, int n) = flush_icache_none; - static bigstate live; static smallstate empty_ss; static smallstate default_ss; @@ -212,18 +221,15 @@ static int readreg_specific(int r, int size, int spec); static int writereg_specific(int r, int size, int spec); static void prepare_for_call_1(void); static void prepare_for_call_2(void); -#ifndef ALIGN_NOT_NEEDED -static void align_target(uae_u32 a); -#endif +STATIC_INLINE void align_target(uae_u32 a); -static void inline flush_cpu_icache(void *from, void *to); -static void inline write_jmp_target(uae_u32 *jmpaddr, cpuop_func* a); -static void inline emit_jmp_target(uae_u32 a); +STATIC_INLINE void flush_cpu_icache(void *from, void *to); +STATIC_INLINE void write_jmp_target(uae_u32 *jmpaddr, cpuop_func* a); +STATIC_INLINE void emit_jmp_target(uae_u32 a); uae_u32 m68k_pc_offset; /* Flag handling is complicated. - * * x86 instructions create flags, which quite often are exactly what we * want. So at times, the "68k" flags are actually in the x86 flags. @@ -312,7 +318,7 @@ STATIC_INLINE void add_to_cl_list(blockinfo* bi) cache_tags[cl].handler = bi->handler_to_use; } -STATIC_INLINE void raise_in_cl_list(blockinfo* bi) +void raise_in_cl_list(blockinfo* bi) { remove_from_cl_list(bi); add_to_cl_list(bi); @@ -367,14 +373,14 @@ STATIC_INLINE void adjust_jmpdep(dependency* d, cpuop_func* a) STATIC_INLINE void set_dhtu(blockinfo* bi, cpuop_func* dh) { - D2(panicbug("bi is %p\n", bi)); + jit_log2("bi is %p", bi); if (dh != bi->direct_handler_to_use) { dependency* x = bi->deplist; - D2(panicbug("bi->deplist=%p\n", bi->deplist)); + jit_log2("bi->deplist=%p", bi->deplist); while (x) { - D2(panicbug("x is %p\n", x)); - D2(panicbug("x->next is %p\n", x->next)); - D2(panicbug("x->prev_p is %p\n", x->prev_p)); + jit_log2("x is %p", x); + jit_log2("x->next is %p", x->next); + jit_log2("x->prev_p is %p", x->prev_p); if (x->jmp_off) { adjust_jmpdep(x, dh); @@ -385,32 +391,29 @@ STATIC_INLINE void set_dhtu(blockinfo* bi, cpuop_func* dh) } } -static inline void invalidate_block(blockinfo* bi) +void invalidate_block(blockinfo* bi) { - int i; + int i; - bi->optlevel = 0; - bi->count = optcount[0] - 1; - bi->handler = NULL; - bi->handler_to_use = (cpuop_func*)popall_execute_normal; - bi->direct_handler = NULL; - set_dhtu(bi, bi->direct_pen); - bi->needed_flags = 0xff; + bi->optlevel = 0; + bi->count = optcount[0]-1; + bi->handler = NULL; + bi->handler_to_use = (cpuop_func *)popall_execute_normal; + bi->direct_handler = NULL; + set_dhtu(bi, bi->direct_pen); + bi->needed_flags = 0xff; bi->status = BI_INVALID; - for (i = 0; i<2; i++) { - bi->dep[i].jmp_off = NULL; - bi->dep[i].target = NULL; - } - remove_deps(bi); + for (i=0; i<2; i++) { + bi->dep[i].jmp_off = NULL; + bi->dep[i].target = NULL; + } + remove_deps(bi); } STATIC_INLINE void create_jmpdep(blockinfo* bi, int i, uae_u32* jmpaddr, uae_u32 target) { blockinfo* tbi = get_blockinfo_addr((void*)(uintptr)target); - Dif(!tbi) { - jit_abort (_T("JIT: Could not create jmpdep!\n")); - } bi->dep[i].jmp_off = jmpaddr; bi->dep[i].source = bi; bi->dep[i].target = tbi; @@ -446,9 +449,6 @@ STATIC_INLINE void mark_callers_recompile(blockinfo * bi) if (x->jmp_off) { blockinfo *cbi = x->source; - Dif(cbi->status == BI_INVALID) { - jit_abort(_T("invalid block in dependency list\n")); // FIXME? - } if (cbi->status == BI_ACTIVE || cbi->status == BI_NEED_CHECK) { block_need_recompile(cbi); mark_callers_recompile(cbi); @@ -460,7 +460,7 @@ STATIC_INLINE void mark_callers_recompile(blockinfo * bi) /* nothing */ } else { - D2(panicbug(_T("Status %d in mark_callers\n"), cbi->status)); // FIXME? + jit_log2("Status %d in mark_callers", cbi->status); // FIXME? } } x = next; @@ -494,7 +494,7 @@ STATIC_INLINE blockinfo* get_blockinfo_addr_new(void* addr, int setstate) static void prepare_block(blockinfo* bi); -/* Managment of blockinfos. +/* Management of blockinfos. A blockinfo struct is allocated whenever a new block has to be compiled. If the list of free blockinfos is empty, we allocate a new @@ -638,24 +638,30 @@ STATIC_INLINE void alloc_blockinfos(void) if (hold_bi[i]) return; bi=hold_bi[i]=alloc_blockinfo(); - prepare_block(bi); } } -/******************************************************************** - * Preferences handling. This is just a convenient place to put it * - ********************************************************************/ -bool check_prefs_changed_comp (void) +bool check_prefs_changed_comp(bool checkonly) { - bool changed = 0; + bool changed = 0; - if (currprefs.cachesize != changed_prefs.cachesize) { - currprefs.cachesize = changed_prefs.cachesize; - alloc_cache(); - changed = 1; - } - return changed; + if (currprefs.fpu_strict != changed_prefs.fpu_strict || + currprefs.cachesize != changed_prefs.cachesize) + changed = 1; + + if (checkonly) + return changed; + + currprefs.fpu_strict = changed_prefs.fpu_strict; + + if (currprefs.cachesize != changed_prefs.cachesize) { + currprefs.cachesize = changed_prefs.cachesize; + alloc_cache(); + changed = 1; + } + + return changed; } /******************************************************************** @@ -671,10 +677,15 @@ STATIC_INLINE void emit_byte(uae_u8 x) STATIC_INLINE void emit_long(uae_u32 x) { - *reinterpret_cast(target) = x; + *((uae_u32*)target) = x; target += 4; } +STATIC_INLINE void skip_long() +{ + target += 4; +} + #define MAX_COMPILE_PTR max_compile_start STATIC_INLINE uae_u32 reverse32(uae_u32 v) @@ -702,7 +713,6 @@ STATIC_INLINE uae_u8* get_target(void) return get_target_noopt(); } - /******************************************************************** * New version of data buffer: interleave data and code * ********************************************************************/ @@ -795,8 +805,9 @@ STATIC_INLINE void clobber_flags(void); #if defined(CPU_arm) #include "codegen_arm.cpp" -#else -#include "compemu_raw_x86.cpp" +#endif +#if defined(CPU_i386) || defined(CPU_x86_64) +#include "codegen_x86.cpp" #endif @@ -808,9 +819,6 @@ static void make_flags_live_internal(void) { if (live.flags_in_flags == VALID) return; - Dif (live.flags_on_stack == TRASH) { - jit_abort (_T("JIT: Want flags, got something on stack, but it is TRASH\n")); - } if (live.flags_on_stack == VALID) { int tmp; tmp = readreg_specific(FLAGTMP, 4, FLAG_NREG2); @@ -820,7 +828,7 @@ static void make_flags_live_internal(void) live.flags_in_flags = VALID; return; } - jit_abort (_T("JIT: Huh? live.flags_in_flags=%d, live.flags_on_stack=%d, but need to make live\n"), + jit_abort("Huh? live.flags_in_flags=%d, live.flags_on_stack=%d, but need to make live", live.flags_in_flags, live.flags_on_stack); } @@ -832,9 +840,7 @@ static void flags_to_stack(void) live.flags_on_stack = VALID; return; } - Dif (live.flags_in_flags != VALID) - jit_abort(_T("flags_to_stack != VALID")); - else { + { int tmp; tmp = writereg_specific(FLAGTMP, 4, FLAG_NREG1); raw_flags_to_reg(tmp); @@ -945,11 +951,6 @@ static void evict(int r) tomem(r); rr = live.state[r].realreg; - Dif (live.nat[rr].locked && - live.nat[rr].nholds == 1) { - jit_abort (_T("JIT: register %d in nreg %d is locked!\n"), r, live.state[r].realreg); - } - live.nat[rr].nholds--; if (live.nat[rr].nholds != live.state[r].realind) { /* Was not last */ int topreg = live.nat[rr].holds[live.nat[rr].nholds]; @@ -972,9 +973,6 @@ STATIC_INLINE void free_nreg(int r) vr = live.nat[r].holds[i]; evict(vr); } - Dif (live.nat[r].nholds != 0) { - jit_abort (_T("JIT: Failed to free nreg %d, nholds is %d\n"), r, live.nat[r].nholds); - } } /* Use with care! */ @@ -1026,8 +1024,6 @@ static int alloc_reg_hinted(int r, int size, int willclobber, int hint) break; } } - Dif (bestreg == -1) - jit_abort(_T("alloc_reg_hinted bestreg=-1")); if (live.nat[bestreg].nholds > 0) { free_nreg(bestreg); @@ -1036,10 +1032,6 @@ static int alloc_reg_hinted(int r, int size, int willclobber, int hint) int rr = live.state[r].realreg; /* This will happen if we read a partially dirty register at a bigger size */ - Dif (willclobber || live.state[r].validsize >= size) - jit_abort(_T("willclobber || live.state[r].validsize>=size")); - Dif (live.nat[rr].nholds != 1) - jit_abort(_T("live.nat[rr].nholds!=1")); if (size == 4 && live.state[r].validsize == 2) { compemu_raw_mov_l_rm(bestreg, (uintptr)live.state[r].mem); compemu_raw_MERGE_rr(rr, bestreg); @@ -1103,8 +1095,6 @@ static int alloc_reg_hinted(int r, int size, int willclobber, int hint) static void unlock2(int r) { - Dif (!live.nat[r].locked) - jit_abort(_T("unlock2 %d not locked"), r); live.nat[r].locked--; } @@ -1168,10 +1158,6 @@ STATIC_INLINE void make_exclusive(int r, int size, int spec) i--; /* Try that index again! */ } } - Dif (live.nat[rr].nholds != 1) { - jit_abort (_T("JIT: natreg %d holds %d vregs, %d not exclusive\n"), - rr, live.nat[rr].nholds, r); - } return; } @@ -1216,7 +1202,7 @@ STATIC_INLINE int readreg_general(int r, int size, int spec) int answer = -1; if (live.state[r].status == UNDEF) { - D(panicbug("JIT: WARNING: Unexpected read of undefined register %d\n", r)); + jit_log("WARNING: Unexpected read of undefined register %d", r); } if (isinreg(r) && live.state[r].validsize >= size) { @@ -1277,9 +1263,6 @@ STATIC_INLINE int writereg_general(int r, int size, int spec) int ndsize = size > live.state[r].dirtysize ? size : live.state[r].dirtysize; n = live.state[r].realreg; - Dif (live.nat[n].nholds != 1) - jit_abort(_T("live.nat[%d].nholds!=1"), n); - live.state[r].dirtysize = ndsize; live.state[r].validsize = nvsize; answer = n; @@ -1306,11 +1289,6 @@ STATIC_INLINE int writereg_general(int r, int size, int spec) if (size == 4) { live.state[r].val = 0; } - else { - Dif (live.state[r].val) { - jit_abort (_T("JIT: Problem with val\n")); - } - } set_status(r, DIRTY); return answer; } @@ -1331,17 +1309,12 @@ STATIC_INLINE int rmw_general(int r, int wsize, int rsize) int answer = -1; if (live.state[r].status == UNDEF) { - D(panicbug("JIT: WARNING: Unexpected read of undefined register %d\n", r)); + jit_log("WARNING: Unexpected read of undefined register %d", r); } make_exclusive(r, 0, -1); - Dif (wsize < rsize) { - jit_abort (_T("JIT: Cannot handle wsize= rsize) { n = live.state[r].realreg; - Dif (live.nat[n].nholds != 1) - jit_abort(_T("live.nat[n].nholds!=1"), n); answer = n; if (answer < 0) @@ -1362,9 +1335,6 @@ STATIC_INLINE int rmw_general(int r, int wsize, int rsize) live.nat[answer].locked++; live.nat[answer].touched = touchcnt++; - Dif (live.state[r].val) { - jit_abort (_T("JIT: Problem with val(rmw)\n")); - } return answer; } @@ -1373,303 +1343,15 @@ static int rmw(int r, int wsize, int rsize) return rmw_general(r, wsize, rsize); } -/******************************************************************** - * FPU register status handling. EMIT TIME! * - ********************************************************************/ - -#ifdef USE_JIT_FPU -static void f_tomem(int r) -{ - if (live.fate[r].status == DIRTY) { -#if USE_LONG_DOUBLE - raw_fmov_ext_mr((uintptr)live.fate[r].mem, live.fate[r].realreg); -#else - raw_fmov_mr((uintptr)live.fate[r].mem, live.fate[r].realreg); -#endif - live.fate[r].status = CLEAN; - } -} - -static void f_tomem_drop(int r) -{ - if (live.fate[r].status == DIRTY) { -#if USE_LONG_DOUBLE - raw_fmov_ext_mr_drop((uintptr)live.fate[r].mem, live.fate[r].realreg); -#else - raw_fmov_mr_drop((uintptr)live.fate[r].mem, live.fate[r].realreg); -#endif - live.fate[r].status = INMEM; - } -} - - -STATIC_INLINE int f_isinreg(int r) -{ - return live.fate[r].status == CLEAN || live.fate[r].status == DIRTY; -} - -static void f_evict(int r) -{ - int rr; - - if (!f_isinreg(r)) - return; - rr = live.fate[r].realreg; - if (live.fat[rr].nholds == 1) - f_tomem_drop(r); - else - f_tomem(r); - - Dif (live.fat[rr].locked && - live.fat[rr].nholds==1) { - jit_abort (_T("JIT: FPU register %d in nreg %d is locked!\n"),r,live.fate[r].realreg); - } - live.fat[rr].nholds--; - if (live.fat[rr].nholds!=live.fate[r].realind) { /* Was not last */ - int topreg=live.fat[rr].holds[live.fat[rr].nholds]; - int thisind=live.fate[r].realind; - live.fat[rr].holds[thisind]=topreg; - live.fate[topreg].realind=thisind; - } - live.fate[r].status=INMEM; - live.fate[r].realreg=-1; -} - -STATIC_INLINE void f_free_nreg(int r) -{ - int i=live.fat[r].nholds; - - while (i) { - int vr; - - --i; - vr=live.fat[r].holds[i]; - f_evict(vr); - } - Dif (live.fat[r].nholds!=0) { - jit_abort (_T("JIT: Failed to free nreg %d, nholds is %d\n"),r,live.fat[r].nholds); - } -} - - -/* Use with care! */ -STATIC_INLINE void f_isclean(int r) -{ - if (!f_isinreg(r)) - return; - live.fate[r].status=CLEAN; -} - -STATIC_INLINE void f_disassociate(int r) -{ - f_isclean(r); - f_evict(r); -} - - - -static int f_alloc_reg(int r, int willclobber) -{ - int bestreg; - uae_s32 when; - int i; - uae_s32 badness; - bestreg=-1; - when=2000000000; - for (i=N_FREGS;i--;) { - badness=live.fat[i].touched; - if (live.fat[i].nholds==0) - badness=0; - - if (!live.fat[i].locked && badness0) { - f_free_nreg(bestreg); - } - if (f_isinreg(r)) { - f_evict(r); - } - - if (!willclobber) { - if (live.fate[r].status!=UNDEF) { -#if USE_LONG_DOUBLE - raw_fmov_ext_rm(bestreg,(uintptr)live.fate[r].mem); -#else - raw_fmov_rm(bestreg,(uintptr)live.fate[r].mem); -#endif - } - live.fate[r].status=CLEAN; - } - else { - live.fate[r].status=DIRTY; - } - live.fate[r].realreg=bestreg; - live.fate[r].realind=live.fat[bestreg].nholds; - live.fat[bestreg].touched=touchcnt++; - live.fat[bestreg].holds[live.fat[bestreg].nholds]=r; - live.fat[bestreg].nholds++; - - return bestreg; -} - -static void f_unlock(int r) -{ - Dif (!live.fat[r].locked) - jit_abort(_T("unlock %d"), r); - live.fat[r].locked--; -} - -static void f_setlock(int r) -{ - live.fat[r].locked++; -} - -STATIC_INLINE int f_readreg(int r) -{ - int n; - int answer=-1; - - if (f_isinreg(r)) { - n=live.fate[r].realreg; - answer=n; - } - /* either the value was in memory to start with, or it was evicted and - is in memory now */ - if (answer<0) - answer=f_alloc_reg(r,0); - - live.fat[answer].locked++; - live.fat[answer].touched=touchcnt++; - return answer; -} - -STATIC_INLINE void f_make_exclusive(int r, int clobber) -{ - freg_status oldstate; - int rr=live.fate[r].realreg; - int nr; - int nind; - int ndirt=0; - int i; - - if (!f_isinreg(r)) - return; - if (live.fat[rr].nholds==1) - return; - for (i=0;i : compile FPU instructions : %s", !avoid_fpu ? "yes" : "no")); - // Initialize target CPU (check for features, e.g. CMOV, rat stalls) - raw_init_cpu(); - - // Translation cache flush mechanism - lazy_flush = 1; //(bx_options.jit.jitlazyflush == 0) ? 0 : 1; - flush_icache = lazy_flush ? flush_icache_lazy : flush_icache_hard; - - // Compiler features -#if USE_INLINING - follow_const_jumps = 1; //bx_options.jit.jitinline; -#endif - - // Build compiler tables - // build_comp(); // moved to newcpu.cpp -> build_cpufunctbl - - initialized = 1; + initialized = true; #ifdef PROFILE_UNTRANSLATED_INSNS - bug(" : gather statistics on untranslated insns count\n"); + jit_log(" : gather statistics on untranslated insns count"); #endif #ifdef PROFILE_COMPILE_TIME - bug(" : gather statistics on translation time"); + jit_log(" : gather statistics on translation time"); emul_start_time = clock(); #endif } @@ -1767,7 +1419,7 @@ void compiler_exit(void) // Deallocate translation cache if (compiled_code) { - cache_free(compiled_code, currprefs.cachesize * 1024); + cache_free(compiled_code, cache_size * 1024); compiled_code = 0; } @@ -1778,11 +1430,11 @@ void compiler_exit(void) } #ifdef PROFILE_COMPILE_TIME - bug("### Compile Block statistics"); - bug("Number of calls to compile_block : %d", compile_count); + jit_log("### Compile Block statistics"); + jit_log("Number of calls to compile_block : %d", compile_count); uae_u32 emul_time = emul_end_time - emul_start_time; - bug("Total emulation time : %.1f sec", double(emul_time)/double(CLOCKS_PER_SEC)); - bug("Total compilation time : %.1f sec (%.1f%%)", double(compile_time)/double(CLOCKS_PER_SEC), 100.0*double(compile_time)/double(emul_time)); + jit_log("Total emulation time : %.1f sec", double(emul_time)/double(CLOCKS_PER_SEC)); + jit_log("Total compilation time : %.1f sec (%.1f%%)", double(compile_time)/double(CLOCKS_PER_SEC), 100.0*double(compile_time)/double(emul_time)); #endif #ifdef PROFILE_UNTRANSLATED_INSNS @@ -1791,9 +1443,9 @@ void compiler_exit(void) opcode_nums[i] = i; untranslated_count += raw_cputbl_count[i]; } - bug("Sorting out untranslated instructions count...\n"); + jit_log("Sorting out untranslated instructions count..."); qsort(opcode_nums, 65536, sizeof(uae_u16), untranslated_compfn); - bug("Rank Opc Count Name\n"); + jit_log("Rank Opc Count Name"); for (int i = 0; i < untranslated_top_ten && i < 65536; i++) { uae_u32 count = raw_cputbl_count[opcode_nums[i]]; struct instr *dp; @@ -1811,7 +1463,7 @@ void compiler_exit(void) untranslated_top_ten++; // Ignore this } else - bug("%03d: %04x %10u %s\n", i, opcode_nums[i], count, lookup->name); + jit_log("%03d: %04x %10u %s", i, opcode_nums[i], count, lookup->name); } #endif } @@ -1821,25 +1473,12 @@ void init_comp(void) int i; uae_s8* au = always_used; -#ifdef RECORD_REGISTER_USAGE - for (i=0; i<16; i++) - reg_count_local[i] = 0; -#endif - for (i=0; i= (uae_u32)kickmem_bank.baseaddr && - addr < (uae_u32)kickmem_bank.baseaddr + 8 * 65536); + return (addr >= uae_p32(kickmem_bank.baseaddr) && + addr < uae_p32(kickmem_bank.baseaddr + 8 * 65536)); } static void flush_all(void) @@ -2018,12 +1598,6 @@ static void flush_all(void) tomem(i); } } -#ifdef USE_JIT_FPU - for (i = 0; i < VFREGS; i++) - if (f_isinreg(i)) - f_evict(i); - raw_fp_cleanup_drop(); -#endif } /* Make sure all registers that will get clobbered by a call are @@ -2045,12 +1619,6 @@ static void prepare_for_call_2(void) free_nreg(i); } -#ifdef USE_JIT_FPU - for (i = 0; i < N_FREGS; i++) - if (live.fat[i].nholds > 0) - f_free_nreg(i); -#endif - live.flags_in_flags = TRASH; /* Note: We assume we already rescued the flags at the very start of the call_r functions! */ @@ -2319,7 +1887,7 @@ void calc_disp_ea_020(int base, uae_u32 dp, int target, int tmp) void set_cache_state(int enabled) { if (enabled != letit) - flush_icache_hard(0, 3); + flush_icache_hard(3); letit = enabled; } @@ -2338,24 +1906,28 @@ uae_u32 get_jitted_size(void) void alloc_cache(void) { if (compiled_code) { - flush_icache_hard(0, 3); - cache_free(compiled_code, currprefs.cachesize * 1024); + flush_icache_hard(3); + cache_free(compiled_code, cache_size * 1024); compiled_code = 0; } - if (currprefs.cachesize == 0) + cache_size = currprefs.cachesize; + if (cache_size == 0) return; - while (!compiled_code && currprefs.cachesize) { - compiled_code = cache_alloc(currprefs.cachesize * 1024); - if (!compiled_code) - currprefs.cachesize /= 2; + while (!compiled_code && cache_size) { + compiled_code = cache_alloc(cache_size * 1024); + if (compiled_code == NULL) { + cache_size /= 2; + } } + if (compiled_code) { + jit_log("Actual translation cache size : %d KB at %p-%p", cache_size, compiled_code, compiled_code + cache_size*1024); #if defined(CPU_arm) && !defined(ARMV6T2) - max_compile_start = compiled_code + currprefs.cachesize*1024 - BYTES_PER_INST - DATA_BUFFER_SIZE; + max_compile_start = compiled_code + cache_size*1024 - BYTES_PER_INST - DATA_BUFFER_SIZE; #else - max_compile_start = compiled_code + currprefs.cachesize*1024 - BYTES_PER_INST; + max_compile_start = compiled_code + cache_size*1024 - BYTES_PER_INST; #endif current_compile_p = compiled_code; current_cache_size = 0; @@ -2372,7 +1944,6 @@ static void calc_checksum(blockinfo* bi, uae_u32* c1, uae_u32* c2) #if USE_CHECKSUM_INFO checksum_info *csi = bi->csi; - Dif(!csi) abort(); while (csi) { uae_s32 len = csi->length; uintptr tmp = (uintptr)csi->start_p; @@ -2427,8 +1998,6 @@ static void recompile_block(void) perceived cache miss... */ blockinfo* bi = get_blockinfo_addr(regs.pc_p); - Dif (!bi) - jit_abort(_T("recompile_block")); raise_in_cl_list(bi); execute_normal(); return; @@ -2437,20 +2006,11 @@ static void recompile_block(void) static void cache_miss(void) { blockinfo* bi = get_blockinfo_addr(regs.pc_p); -#if COMP_DEBUG - uae_u32 cl = cacheline(regs.pc_p); - blockinfo* bi2 = get_blockinfo(cl); -#endif if (!bi) { execute_normal(); /* Compile this block now */ return; } -#if COMP_DEBUG - Dif (!bi2 || bi == bi2) { - jit_abort (_T("Unexplained cache miss %p %p\n"), bi, bi2); - } -#endif raise_in_cl_list(bi); return; } @@ -2465,8 +2025,6 @@ STATIC_INLINE int block_check_checksum(blockinfo* bi) if (bi->status != BI_NEED_CHECK) return 1; /* This block is in a checked state */ -// checksum_count++; - if (bi->c1 || bi->c2) calc_checksum(bi, &c1, &c2); else { @@ -2485,7 +2043,7 @@ STATIC_INLINE int block_check_checksum(blockinfo* bi) isgood = called_check_checksum(bi) != 0; } if (isgood) { - D2(bug("JIT: reactivate %p/%p (%x %x/%x %x)", bi, bi->pc_p, c1, c2, bi->c1, bi->c2)); + jit_log2("reactivate %p/%p (%x %x/%x %x)", bi, bi->pc_p, c1, c2, bi->c1, bi->c2); remove_from_list(bi); add_to_active(bi); raise_in_cl_list(bi); @@ -2494,7 +2052,7 @@ STATIC_INLINE int block_check_checksum(blockinfo* bi) else { /* This block actually changed. We need to invalidate it, and set it up to be recompiled */ - D2(bug("JIT: discard %p/%p (%x %x/%x %x)", bi, bi->pc_p, c1, c2, bi->c1, bi->c2)); + jit_log2("discard %p/%p (%x %x/%x %x)", bi, bi->pc_p, c1, c2, bi->c1, bi->c2); invalidate_block(bi); raise_in_cl_list(bi); } @@ -2552,7 +2110,7 @@ STATIC_INLINE void match_states(blockinfo* bi) certain vregs) */ for (i = 0; i < 16; i++) { if (s->virt[i] == L_UNNEEDED) { - D2(panicbug("unneeded reg %d at %p\n", i, target)); + jit_log2("unneeded reg %d at %p", i, target); COMPCALL(forget_about)(i); // FIXME } } @@ -2581,8 +2139,15 @@ STATIC_INLINE void create_popalls(void) { int i, r; - if (popallspace == NULL) - popallspace = cache_alloc (POPALLSPACE_SIZE); + if (popallspace == NULL) { + if ((popallspace = cache_alloc (POPALLSPACE_SIZE)) == NULL) { + jit_log("WARNING: Could not allocate popallspace!"); + /* This is not fatal if JIT is not used. If JIT is + * turned on, it will crash, but it would have crashed + * anyway. */ + return; + } + } int stack_space = STACK_OFFSET; for (i = 0; i< N_REGS; i++) { @@ -2592,6 +2157,7 @@ STATIC_INLINE void create_popalls(void) stack_space %= STACK_ALIGN; if (stack_space) stack_space = STACK_ALIGN - stack_space; + current_compile_p = popallspace; set_target(current_compile_p); @@ -2608,67 +2174,53 @@ STATIC_INLINE void create_popalls(void) In summary, JIT generated code is not leaf so we have to deal with it here to maintain correct stack alignment. */ -#ifndef ALIGN_NOT_NEEDED align_target(align_jumps); -#endif current_compile_p = get_target(); pushall_call_handler = get_target(); raw_push_regs_to_preserve(); raw_dec_sp(stack_space); - compemu_raw_init_r_regstruct(uintptr(®s)); + compemu_raw_init_r_regstruct((uintptr)®s); r = REG_PC_TMP; - compemu_raw_mov_l_rm(r,uintptr(®s.pc_p)); + compemu_raw_mov_l_rm(r, uae_p32(®s.pc_p)); compemu_raw_and_TAGMASK(r); - compemu_raw_jmp_m_indexed(uintptr(cache_tags), r, SIZEOF_VOID_P); + compemu_raw_jmp_m_indexed(uae_p32(cache_tags), r, SIZEOF_VOID_P); /* now the exit points */ -#ifndef ALIGN_NOT_NEEDED align_target(align_jumps); -#endif popall_do_nothing = get_target(); raw_inc_sp(stack_space); raw_pop_preserved_regs(); - compemu_raw_jmp(uintptr(do_nothing)); + compemu_raw_jmp(uae_p32(do_nothing)); -#ifndef ALIGN_NOT_NEEDED align_target(align_jumps); -#endif popall_execute_normal = get_target(); raw_inc_sp(stack_space); raw_pop_preserved_regs(); - compemu_raw_jmp(uintptr(execute_normal)); + compemu_raw_jmp(uae_p32(execute_normal)); -#ifndef ALIGN_NOT_NEEDED align_target(align_jumps); -#endif popall_cache_miss = get_target(); raw_inc_sp(stack_space); raw_pop_preserved_regs(); - compemu_raw_jmp(uintptr(cache_miss)); + compemu_raw_jmp(uae_p32(cache_miss)); -#ifndef ALIGN_NOT_NEEDED align_target(align_jumps); -#endif popall_recompile_block = get_target(); raw_inc_sp(stack_space); raw_pop_preserved_regs(); - compemu_raw_jmp((uintptr)recompile_block); + compemu_raw_jmp(uae_p32(recompile_block)); -#ifndef ALIGN_NOT_NEEDED align_target(align_jumps); -#endif popall_exec_nostats = get_target(); raw_inc_sp(stack_space); raw_pop_preserved_regs(); - compemu_raw_jmp((uintptr)exec_nostats); + compemu_raw_jmp(uae_p32(exec_nostats)); -#ifndef ALIGN_NOT_NEEDED align_target(align_jumps); -#endif popall_check_checksum = get_target(); raw_inc_sp(stack_space); raw_pop_preserved_regs(); - compemu_raw_jmp((uintptr)check_checksum); + compemu_raw_jmp(uae_p32(check_checksum)); #if defined(CPU_arm) && !defined(ARMV6T2) reset_data_buffer(); @@ -2693,17 +2245,13 @@ static void prepare_block(blockinfo* bi) int i; set_target(current_compile_p); -#ifndef ALIGN_NOT_NEEDED align_target(align_jumps); -#endif bi->direct_pen = (cpuop_func *)get_target(); compemu_raw_mov_l_rm(0, (uintptr)&(bi->pc_p)); compemu_raw_mov_l_mr((uintptr)®s.pc_p, 0); compemu_raw_jmp((uintptr)popall_execute_normal); -#ifndef ALIGN_NOT_NEEDED align_target(align_jumps); -#endif bi->direct_pcc = (cpuop_func *)get_target(); compemu_raw_mov_l_rm(0, (uintptr)&(bi->pc_p)); compemu_raw_mov_l_mr((uintptr)®s.pc_p, 0); @@ -2768,7 +2316,7 @@ void build_comp(void) cflow &= ~fl_const_jump; prop[cft_map(tbl[i].opcode)].cflow = cflow; - int uses_fpu = (tbl[i].specific & 32) != 0; + bool uses_fpu = (tbl[i].specific & COMP_OPCODE_USES_FPU) != 0; if (uses_fpu && avoid_fpu) compfunctbl[cft_map(tbl[i].opcode)] = NULL; else @@ -2776,7 +2324,7 @@ void build_comp(void) } for (i = 0; nftbl[i].opcode < 65536; i++) { - int uses_fpu = tbl[i].specific & 32; + int uses_fpu = tbl[i].specific & COMP_OPCODE_USES_FPU; if (uses_fpu && avoid_fpu) nfcompfunctbl[cft_map(nftbl[i].opcode)] = NULL; else @@ -2841,7 +2389,7 @@ void build_comp(void) if (compfunctbl[cft_map(opcode)]) count++; } -// D(bug(" : supposedly %d compileable opcodes!",count)); + jit_log("Supposedly %d compileable opcodes!",count); /* Initialise state */ create_popalls(); @@ -2863,19 +2411,10 @@ void build_comp(void) default_ss = empty_ss; } -static void flush_icache_none(uaecptr ptr, int n) -{ - /* Nothing to do. */ -} - -void flush_icache_hard(uaecptr ptr, int n) +void flush_icache_hard(int n) { blockinfo* bi, *dbi; -// hard_flush_count++; - D(bug("JIT: Flush Icache_hard(%d/%x/%p), %u KB\n", - n, regs.pc, regs.pc_p, current_cache_size / 1024)); - UNUSED(n); bi = active; while(bi) { cache_tags[cacheline(bi->pc_p)].handler = (cpuop_func *)popall_execute_normal; @@ -2910,12 +2449,11 @@ void flush_icache_hard(uaecptr ptr, int n) we simply mark everything as "needs to be checked". */ -STATIC_INLINE void flush_icache_lazy(uaecptr ptr, int n) +void flush_icache(int n) { blockinfo* bi; blockinfo* bi2; -// soft_flush_count++; if (!active) return; @@ -2958,39 +2496,6 @@ STATIC_INLINE unsigned int get_opcode_cft_map(unsigned int f) } #define DO_GET_OPCODE(a) (get_opcode_cft_map((uae_u16)*(a))) -#ifdef JIT_DEBUG -static uae_u8 *last_regs_pc_p = 0; -static uae_u8 *last_compiled_block_addr = 0; - -void compiler_dumpstate(void) -{ - if (!JITDebug) - return; - - bug("### Host addresses"); - bug("MEM_BASE : %x", NATMEM_OFFSET); - bug("PC_P : %p", ®s.pc_p); - bug("SPCFLAGS : %p", ®s.spcflags); - bug("D0-D7 : %p-%p", ®s.regs[0], ®s.regs[7]); - bug("A0-A7 : %p-%p", ®s.regs[8], ®s.regs[15]); - bug(""); - - bug("### M68k processor state"); - m68k_dumpstate(stderr, 0); - bug(""); - - bug("### Block in Atari address space"); - bug("M68K block : %p", - (void *)(uintptr)last_regs_pc_p); - if (last_regs_pc_p != 0) { - bug("Native block : %p (%d bytes)", - (void *)last_compiled_block_addr, - get_blockinfo_addr(last_regs_pc_p)->direct_handler_size); - } - bug(""); -} -#endif - void compile_block(cpu_history* pc_hist, int blocklen, int totcycles) { if (letit && compiled_code && currprefs.cpu_model >= 68020) { @@ -2998,9 +2503,6 @@ void compile_block(cpu_history* pc_hist, int blocklen, int totcycles) compile_count++; clock_t start_time = clock(); #endif -#ifdef JIT_DEBUG - bool disasm_block = false; -#endif /* OK, here we need to 'compile' a block */ int i; @@ -3008,7 +2510,7 @@ void compile_block(cpu_history* pc_hist, int blocklen, int totcycles) int was_comp = 0; uae_u8 liveflags[MAXRUN+1]; #if USE_CHECKSUM_INFO - bool trace_in_rom = isinrom((uintptr)pc_hist[0].location); + bool trace_in_rom = isinrom((uintptr)pc_hist[0].location) != 0; uintptr max_pcp = (uintptr)pc_hist[blocklen - 1].location; uintptr min_pcp = max_pcp; #else @@ -3023,7 +2525,7 @@ void compile_block(cpu_history* pc_hist, int blocklen, int totcycles) redo_current_block = 0; if (current_compile_p >= MAX_COMPILE_PTR) - flush_icache_hard(0, 3); + flush_icache_hard(3); alloc_blockinfos(); @@ -3031,26 +2533,11 @@ void compile_block(cpu_history* pc_hist, int blocklen, int totcycles) bi2 = get_blockinfo(cl); optlev = bi->optlevel; - if (bi->status != BI_INVALID) { - Dif (bi != bi2) { - /* I don't think it can happen anymore. Shouldn't, in - any case. So let's make sure... */ - jit_abort (_T("JIT: WOOOWOO count=%d, ol=%d %p %p\n"), - bi->count, bi->optlevel, bi->handler_to_use, - cache_tags[cl].handler); - } - - Dif (bi->count != -1 && bi->status != BI_NEED_RECOMP) { - panicbug("bi->count=%d, bi->status=%d,bi->optlevel=%d\n", bi->count, bi->status, bi->optlevel); - /* What the heck? We are not supposed to be here! */ - jit_abort(_T("BI_TARGETTED")); - } - } if (bi->count == -1) { - optlev++; - while (!optcount[optlev]) - optlev++; - bi->count = optcount[optlev] - 1; + optlev++; + while (!optcount[optlev]) + optlev++; + bi->count = optcount[optlev] - 1; } current_block_pc_p = (uintptr)pc_hist[0].location; @@ -3104,9 +2591,7 @@ void compile_block(cpu_history* pc_hist, int blocklen, int totcycles) bi->needed_flags = liveflags[0]; /* This is the non-direct handler */ -#ifndef ALIGN_NOT_NEEDED align_target(align_loops); -#endif was_comp = 0; bi->direct_handler = (cpuop_func *)get_target(); @@ -3133,20 +2618,12 @@ void compile_block(cpu_history* pc_hist, int blocklen, int totcycles) init_comp(); was_comp = 1; -#ifdef JIT_DEBUG - if (JITDebug) { - compemu_raw_mov_l_mi((uintptr)&last_regs_pc_p, (uintptr)pc_hist[0].location); - compemu_raw_mov_l_mi((uintptr)&last_compiled_block_addr, current_block_start_target); - } -#endif - for (i = 0; i < blocklen && get_target_noopt() < MAX_COMPILE_PTR; i++) { cpuop_func **cputbl; compop_func **comptbl; uae_u32 opcode = DO_GET_OPCODE(pc_hist[i].location); needed_flags = (liveflags[i+1] & prop[opcode].set_flags); special_mem = pc_hist[i].specmem; - D(bug(" 0x%08x: %04x (special_mem=%d, needed_flags=%d)\n", pc_hist[i].location, opcode, special_mem, needed_flags)); if (!needed_flags) { #ifdef NOFLAGS_SUPPORT cputbl=nfcpufunctbl; @@ -3182,6 +2659,7 @@ void compile_block(cpu_history* pc_hist, int blocklen, int totcycles) was_comp = 0; #endif } + if (failure) { if (was_comp) { flush(1); @@ -3206,10 +2684,9 @@ void compile_block(cpu_history* pc_hist, int blocklen, int totcycles) #endif compemu_raw_jz_b_oponly(); branchadd = (uae_s8 *)get_target(); - compemu_raw_sub_l_mi((uintptr)&countdown, scaled_cycles(totcycles)); + compemu_raw_sub_l_mi(uae_p32(&countdown), scaled_cycles(totcycles)); compemu_raw_jmp((uintptr)popall_do_nothing); *(branchadd - 4) = (((uintptr)get_target() - (uintptr)branchadd) - 4) >> 2; - D(bug(" branchadd(byte) to 0x%08x: 0x%02x\n", branchadd, *branchadd)); } } } @@ -3236,7 +2713,7 @@ void compile_block(cpu_history* pc_hist, int blocklen, int totcycles) tmp = live; /* ouch! This is big... */ compemu_raw_jcc_l_oponly(cc); branchadd = (uae_u32*)get_target(); - emit_long(0); + skip_long(); /* predicted outcome */ tbi = get_blockinfo_addr_new((void*)t1, 1); @@ -3250,12 +2727,9 @@ void compile_block(cpu_history* pc_hist, int blocklen, int totcycles) emit_jmp_target(get_handler(t1)); create_jmpdep(bi, 0, tba, t1); -#ifndef ALIGN_NOT_NEEDED align_target(align_jumps); -#endif /* not-predicted outcome */ write_jmp_target(branchadd, (cpuop_func*)get_target()); - D(bug(" write_jmp_target to 0x%08x: 0x%08x\n", branchadd, get_target())); live = tmp; /* Ouch again */ tbi = get_blockinfo_addr_new((void*)t2, 1); match_states(tbi); @@ -3345,14 +2819,7 @@ void compile_block(cpu_history* pc_hist, int blocklen, int totcycles) current_cache_size += get_target() - (uae_u8 *)current_compile_p; -#ifdef JIT_DEBUG - if (JITDebug) - bi->direct_handler_size = get_target() - (uae_u8 *)current_block_start_target; -#endif - -#ifndef ALIGN_NOT_NEEDED align_target(align_jumps); -#endif /* This is the non-direct handler */ bi->handler = bi->handler_to_use = (cpuop_func *)get_target(); @@ -3370,10 +2837,11 @@ void compile_block(cpu_history* pc_hist, int blocklen, int totcycles) flush_cpu_icache((void *)current_block_start_target, (void *)target); current_compile_p = get_target(); raise_in_cl_list(bi); + bi->nexthandler=current_compile_p; /* We will flush soon, anyway, so let's do it now */ if (current_compile_p >= MAX_COMPILE_PTR) - flush_icache_hard(0, 3); + flush_icache_hard(3); bi->status = BI_ACTIVE; if (redo_current_block) @@ -3382,35 +2850,9 @@ void compile_block(cpu_history* pc_hist, int blocklen, int totcycles) #ifdef PROFILE_COMPILE_TIME compile_time += (clock() - start_time); #endif + /* Account for compilation time */ + do_extra_cycles(totcycles); } } - -void dump_compiler(uae_u32* sp) -{ - int i, j; - - for(i=-16; i<16; i+=4) - { - printf("0x%08x: 0x%08x 0x%08x 0x%08x 0x%08x\n", sp + i, sp[i], sp[i+1], sp[i+2], sp[i+3]); - } - - printf("compile cache: 0x%08x - 0x%08x\n", compiled_code, compiled_code + currprefs.cachesize * 1024); - printf("start_pc_p=0x%08x, start_pc=0x%08x, current_block_pc_p=0x%08x\n", start_pc_p, start_pc, current_block_pc_p); - printf("current_block_start_target=0x%08x, needed_flags=%d\n", current_block_start_target, needed_flags); - printf("current_compile_p=0x%08x, max_compile_start=0x%08x\n", current_compile_p, max_compile_start); - -/* - printf("PC history:\n"); - for(i=trace_pc_idx - 16, j=0; i < trace_pc_idx; ++i, ++j) - { - printf("0x%08x (%d) \t", i >= 0 ? trace_pc[i] : trace_pc[i + TRACE_PC_HISTORY], - i >= 0 ? trace_pc_i[i] : trace_pc_i[i + TRACE_PC_HISTORY]); - if((j & 3) == 3) - printf("\n"); - } -*/ -} - - -#endif \ No newline at end of file +#endif /* JIT */ diff --git a/src/linetoscr.cpp b/src/linetoscr.cpp index 5ce9cac1..d6b71760 100644 --- a/src/linetoscr.cpp +++ b/src/linetoscr.cpp @@ -1,37 +1,32 @@ -/* - * UAE - The portable Amiga emulator. - * - * This file was generated by genlinetoscr. Don't edit. +/* Note: + * p_xcolors[] contains 16-bit color information in both words + * p_acolors contains 16-bit color information in both words */ + STATIC_INLINE uae_u32 merge_words(uae_u32 val, uae_u32 val2) { - __asm__( - "pkhbt %[o], %[o], %[d], lsl #16 \n\t" - : [o] "+r" (val) : [d] "r" (val2)); - return val; + __asm__ ( + "pkhbt %[o], %[o], %[d], lsl #16 \n\t" + : [o] "+r" (val) : [d] "r" (val2) ); + return val; } STATIC_INLINE uae_u32 double_word(uae_u32 val) { - __asm__( - "pkhbt %[o], %[o], %[o], lsl #16 \n\t" - : [o] "+r" (val)); - return val; + __asm__ ( + "pkhbt %[o], %[o], %[o], lsl #16 \n\t" + : [o] "+r" (val) ); + return val; } - -static int NOINLINE linetoscr_16(int spix, int dpix, int dpix_end) + +static int NOINLINE linetoscr_16 (int spix, int dpix, int dpix_end) { uae_u16 *buf = (uae_u16 *) xlinebuffer; if (bplham) { int rem; if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - buf[dpix++] = dpix_val; + buf[dpix++] = ham_linebuf[spix++]; } if (dpix >= dpix_end) return spix; @@ -39,39 +34,23 @@ static int NOINLINE linetoscr_16(int spix, int dpix, int dpix_end) if (rem) dpix_end--; while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - out_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); + out_val = *((uae_u32 *)&ham_linebuf[spix]); + spix += 2; *((uae_u32 *)&buf[dpix]) = out_val; dpix += 2; } if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - buf[dpix++] = dpix_val; + buf[dpix++] = ham_linebuf[spix++]; } } else if (bpldualpf) { int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; int rem; if (((uintptr_t)&buf[dpix]) & 2) { uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - buf[dpix++] = dpix_val; + spix_val = pixdata.apixels[spix++]; + buf[dpix++] = p_acolors[lookup[spix_val]]; } if (dpix >= dpix_end) return spix; @@ -83,36 +62,28 @@ static int NOINLINE linetoscr_16(int spix, int dpix, int dpix_end) uae_u32 dpix_val; uae_u32 out_val; - spix_val = pixdata.apixels[spix]; + spix_val = pixdata.apixels[spix++]; + out_val = p_acolors[lookup[spix_val]]; + spix_val = pixdata.apixels[spix++]; dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; + *((uae_u32 *)&buf[dpix]) = merge_words(out_val, dpix_val); dpix += 2; } if (rem) { uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - buf[dpix++] = dpix_val; + spix_val = pixdata.apixels[spix++]; + buf[dpix++] = p_acolors[lookup[spix_val]]; } } else if (bplehb) { int rem; if (((uintptr_t)&buf[dpix]) & 2) { uae_u32 spix_val; uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; + spix_val = pixdata.apixels[spix++]; if (spix_val <= 31) dpix_val = p_acolors[spix_val]; else dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; buf[dpix++] = dpix_val; } if (dpix >= dpix_end) @@ -125,43 +96,35 @@ static int NOINLINE linetoscr_16(int spix, int dpix, int dpix_end) uae_u32 dpix_val; uae_u32 out_val; - spix_val = pixdata.apixels[spix]; + spix_val = pixdata.apixels[spix++]; + if (spix_val <= 31) + out_val = p_acolors[spix_val]; + else + out_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; + spix_val = pixdata.apixels[spix++]; if (spix_val <= 31) dpix_val = p_acolors[spix_val]; else dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; + *((uae_u32 *)&buf[dpix]) = merge_words(out_val, dpix_val); dpix += 2; } if (rem) { uae_u32 spix_val; uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; + spix_val = pixdata.apixels[spix++]; if (spix_val <= 31) dpix_val = p_acolors[spix_val]; else dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; buf[dpix++] = dpix_val; } } else { int rem; if (((uintptr_t)&buf[dpix]) & 2) { uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - buf[dpix++] = dpix_val; + spix_val = pixdata.apixels[spix++]; + buf[dpix++] = p_acolors[spix_val]; } if (dpix >= dpix_end) return spix; @@ -173,271 +136,61 @@ static int NOINLINE linetoscr_16(int spix, int dpix, int dpix_end) uae_u32 dpix_val; uae_u32 out_val; - spix_val = pixdata.apixels[spix]; + spix_val = pixdata.apixels[spix++]; + out_val = p_acolors[spix_val]; + spix_val = pixdata.apixels[spix++]; dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; + *((uae_u32 *)&buf[dpix]) = merge_words(out_val, dpix_val); dpix += 2; } if (rem) { uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - buf[dpix++] = dpix_val; + spix_val = pixdata.apixels[spix++]; + buf[dpix++] = p_acolors[spix_val]; } } return spix; } -static int NOINLINE linetoscr_16_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - - if (bplham) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - buf[dpix++] = dpix_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - buf[dpix++] = dpix_val; - } - } else if (bplehb) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - buf[dpix++] = dpix_val; - } - } else { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - buf[dpix++] = dpix_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_stretch1(int spix, int dpix, int dpix_end) +static int NOINLINE linetoscr_16_stretch1 (int spix, int dpix, int dpix_end) { uae_u16 *buf = (uae_u16 *) xlinebuffer; if (bplham) { while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - out_val = dpix_val; - *((uae_u32 *)&buf[dpix]) = out_val; + uae_u32 out_val = ham_linebuf[spix++]; + *((uae_u32 *)&buf[dpix]) = double_word(out_val); dpix += 2; } } else if (bpldualpf) { int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; while (dpix < dpix_end) { uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - *((uae_u32 *)&buf[dpix]) = out_val; + spix_val = pixdata.apixels[spix++]; + *((uae_u32 *)&buf[dpix]) = p_acolors[lookup[spix_val]]; dpix += 2; } } else if (bplehb) { while (dpix < dpix_end) { uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; - spix_val = pixdata.apixels[spix]; + spix_val = pixdata.apixels[spix++]; if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - *((uae_u32 *)&buf[dpix]) = out_val; + out_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x0777]; + *((uae_u32 *)&buf[dpix]) = out_val; dpix += 2; } } else { while (dpix < dpix_end) { uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - *((uae_u32 *)&buf[dpix]) = out_val; + spix_val = pixdata.apixels[spix++]; + *((uae_u32 *)&buf[dpix]) = p_acolors[spix_val]; dpix += 2; } } @@ -445,254 +198,15 @@ static int NOINLINE linetoscr_16_stretch1(int spix, int dpix, int dpix_end) return spix; } -static int NOINLINE linetoscr_16_stretch1_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 15); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 1] = get_genlock_transparency(lookup[spix_val]); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 31); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_stretch2(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - out_val = dpix_val; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_stretch2_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 15); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val & 15); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val & 15); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 1] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 2] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 3] = get_genlock_transparency(lookup[spix_val]); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val & 31); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_shrink1(int spix, int dpix, int dpix_end) +static int NOINLINE linetoscr_16_shrink1 (int spix, int dpix, int dpix_end) { uae_u16 *buf = (uae_u16 *) xlinebuffer; if (bplham) { int rem; if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; + dpix_val = ham_linebuf[spix]; spix += 2; buf[dpix++] = dpix_val; } @@ -702,26 +216,21 @@ static int NOINLINE linetoscr_16_shrink1(int spix, int dpix, int dpix_end) if (rem) dpix_end--; while (dpix < dpix_end) { - uae_u32 spix_val; uae_u32 dpix_val; uae_u32 out_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; + out_val = ham_linebuf[spix]; spix += 2; - out_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; + dpix_val = ham_linebuf[spix]; spix += 2; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); + out_val = merge_words(out_val, dpix_val); + *((uae_u32 *)&buf[dpix]) = out_val; dpix += 2; } if (rem) { - uae_u32 spix_val; uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; + dpix_val = ham_linebuf[spix]; spix += 2; buf[dpix++] = dpix_val; } @@ -747,14 +256,12 @@ static int NOINLINE linetoscr_16_shrink1(int spix, int dpix, int dpix_end) uae_u32 out_val; spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; + out_val = p_acolors[lookup[spix_val]]; spix += 2; - out_val = dpix_val; spix_val = pixdata.apixels[spix]; dpix_val = p_acolors[lookup[spix_val]]; spix += 2; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; + *((uae_u32 *)&buf[dpix]) = merge_words(out_val, dpix_val); dpix += 2; } if (rem) { @@ -790,19 +297,17 @@ static int NOINLINE linetoscr_16_shrink1(int spix, int dpix, int dpix_end) spix_val = pixdata.apixels[spix]; if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; + out_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; spix += 2; - out_val = dpix_val; spix_val = pixdata.apixels[spix]; if (spix_val <= 31) dpix_val = p_acolors[spix_val]; else dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; spix += 2; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; + *((uae_u32 *)&buf[dpix]) = merge_words(out_val, dpix_val); dpix += 2; } if (rem) { @@ -819,2235 +324,35 @@ static int NOINLINE linetoscr_16_shrink1(int spix, int dpix, int dpix_end) } else { int rem; if (((uintptr_t)&buf[dpix]) & 2) { + uae_u32 spix_val; + spix_val = pixdata.apixels[spix]; + spix += 2; + buf[dpix++] = p_acolors[spix_val]; + } + if (dpix >= dpix_end) + return spix; + rem = (((uintptr_t)&buf[dpix_end]) & 2); + if (rem) + dpix_end--; + while (dpix < dpix_end) { uae_u32 spix_val; uae_u32 dpix_val; + uae_u32 out_val; + + spix_val = pixdata.apixels[spix]; + out_val = p_acolors[spix_val]; + spix += 2; spix_val = pixdata.apixels[spix]; dpix_val = p_acolors[spix_val]; spix += 2; - buf[dpix++] = dpix_val; + *((uae_u32 *)&buf[dpix]) = merge_words(out_val, dpix_val); + dpix += 2; } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { + if (rem) { uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; spix += 2; - out_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 2; - buf[dpix++] = dpix_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_shrink1_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - - if (bplham) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix += 2; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix += 2; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix += 2; - buf[dpix++] = dpix_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 2; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 2; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 2; - buf[dpix++] = dpix_val; - } - } else if (bplehb) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 2; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 2; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 2; - buf[dpix++] = dpix_val; - } - } else { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 2; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 2; - buf[dpix++] = dpix_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_shrink1f(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - - if (bplham) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - } else if (bplehb) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - } else { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_shrink1f_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - - if (bplham) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - } else if (bplehb) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - } else { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_shrink2(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - - if (bplham) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix += 4; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix += 4; - out_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix += 4; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix += 4; - buf[dpix++] = dpix_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 4; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 4; - out_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 4; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 4; - buf[dpix++] = dpix_val; - } - } else if (bplehb) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 4; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 4; - out_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 4; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 4; - buf[dpix++] = dpix_val; - } - } else { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 4; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 4; - buf[dpix++] = dpix_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_shrink2_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - - if (bplham) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix += 4; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix += 4; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix += 4; - buf[dpix++] = dpix_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 4; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 4; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 4; - buf[dpix++] = dpix_val; - } - } else if (bplehb) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 4; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 4; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 4; - buf[dpix++] = dpix_val; - } - } else { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 4; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 4; - buf[dpix++] = dpix_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_shrink2f(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - - if (bplham) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - } else if (bplehb) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - } else { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_shrink2f_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - - if (bplham) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - } else if (bplehb) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - } else { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; + buf[dpix++] = p_acolors[spix_val]; } } @@ -3062,15 +367,11 @@ static int NOINLINE linetoscr_16_spr(int spix, int dpix, int dpix_end) if (bplham) { while (dpix < dpix_end) { uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; + out_val = ham_linebuf[spix]; sprpix_val = pixdata.apixels[spix]; spix++; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix, 0, sprpix_val, 0); if (sprcol) { @@ -3085,14 +386,12 @@ static int NOINLINE linetoscr_16_spr(int spix, int dpix, int dpix_end) while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; spix_val = pixdata.apixels[spix]; sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; + out_val = p_acolors[lookup[spix_val]]; spix++; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix, 1, sprpix_val, 0); if (sprcol) { @@ -3106,17 +405,15 @@ static int NOINLINE linetoscr_16_spr(int spix, int dpix, int dpix_end) while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; spix_val = pixdata.apixels[spix]; sprpix_val = spix_val; if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; + out_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; spix++; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix, 0, sprpix_val, 0); if (sprcol) { @@ -3130,14 +427,12 @@ static int NOINLINE linetoscr_16_spr(int spix, int dpix, int dpix_end) while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; spix_val = pixdata.apixels[spix]; sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix++; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix, 0, sprpix_val, 0); if (sprcol) { @@ -3152,113 +447,6 @@ static int NOINLINE linetoscr_16_spr(int spix, int dpix, int dpix_end) return spix; } -static int NOINLINE linetoscr_16_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - static int NOINLINE linetoscr_16_stretch1_spr(int spix, int dpix, int dpix_end) { uae_u16 *buf = (uae_u16 *) xlinebuffer; @@ -3268,14 +456,11 @@ static int NOINLINE linetoscr_16_stretch1_spr(int spix, int dpix, int dpix_end) while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; + out_val = ham_linebuf[spix]; sprpix_val = pixdata.apixels[spix]; spix++; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix, 0, sprpix_val, 0); if (sprcol) { @@ -3283,22 +468,20 @@ static int NOINLINE linetoscr_16_stretch1_spr(int spix, int dpix, int dpix_end) out_val = spcol; } } - buf[dpix++] = out_val; - buf[dpix++] = out_val; + *((uae_u32 *)&buf[dpix]) = double_word(out_val); + dpix += 2; } } else if (bpldualpf) { int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; spix_val = pixdata.apixels[spix]; sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; + out_val = p_acolors[lookup[spix_val]]; spix++; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix, 1, sprpix_val, 0); if (sprcol) { @@ -3306,24 +489,22 @@ static int NOINLINE linetoscr_16_stretch1_spr(int spix, int dpix, int dpix_end) out_val = spcol; } } - buf[dpix++] = out_val; - buf[dpix++] = out_val; + *((uae_u32 *)&buf[dpix]) = double_word(out_val); + dpix += 2; } } else if (bplehb) { while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; spix_val = pixdata.apixels[spix]; sprpix_val = spix_val; if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; + out_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; spix++; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix, 0, sprpix_val, 0); if (sprcol) { @@ -3331,21 +512,19 @@ static int NOINLINE linetoscr_16_stretch1_spr(int spix, int dpix, int dpix_end) out_val = spcol; } } - buf[dpix++] = out_val; - buf[dpix++] = out_val; + *((uae_u32 *)&buf[dpix]) = double_word(out_val); + dpix += 2; } } else { while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; spix_val = pixdata.apixels[spix]; sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix++; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix, 0, sprpix_val, 0); if (sprcol) { @@ -3353,364 +532,8 @@ static int NOINLINE linetoscr_16_stretch1_spr(int spix, int dpix, int dpix_end) out_val = spcol; } } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_stretch1_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 15); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 1] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_stretch2_spr(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_stretch2_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 15); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val & 15); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val & 15); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 1] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 2] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 3] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; + *((uae_u32 *)&buf[dpix]) = double_word(out_val); + dpix += 2; } } @@ -3726,14 +549,11 @@ static int NOINLINE linetoscr_16_shrink1_spr(int spix, int dpix, int dpix_end) while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; + out_val = ham_linebuf[spix]; sprpix_val = pixdata.apixels[spix]; spix += 2; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix, 0, sprpix_val, 0); if (sprcol) { @@ -3748,14 +568,12 @@ static int NOINLINE linetoscr_16_shrink1_spr(int spix, int dpix, int dpix_end) while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; spix_val = pixdata.apixels[spix]; sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; + out_val = p_acolors[lookup[spix_val]]; spix += 2; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix, 1, sprpix_val, 0); if (sprcol) { @@ -3769,17 +587,15 @@ static int NOINLINE linetoscr_16_shrink1_spr(int spix, int dpix, int dpix_end) while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; spix_val = pixdata.apixels[spix]; sprpix_val = spix_val; if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; + out_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; spix += 2; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix, 0, sprpix_val, 0); if (sprcol) { @@ -3793,14 +609,12 @@ static int NOINLINE linetoscr_16_shrink1_spr(int spix, int dpix, int dpix_end) while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; spix_val = pixdata.apixels[spix]; sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix += 2; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix, 0, sprpix_val, 0); if (sprcol) { @@ -3815,1014 +629,24 @@ static int NOINLINE linetoscr_16_shrink1_spr(int spix, int dpix, int dpix_end) return spix; } -static int NOINLINE linetoscr_16_shrink1_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_shrink1f_spr(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_shrink1f_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_shrink2_spr(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix += 4; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 4; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 4; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_shrink2_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_shrink2f_spr(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_16_shrink2f_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - #ifdef AGA static int NOINLINE linetoscr_16_aga_spronly(int spix, int dpix, int dpix_end) { uae_u16 *buf = (uae_u16 *) xlinebuffer; uae_u8 sprcol; - if (1) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 out_val; - - sprpix_val = 0; - spix++; - out_val = p_acolors[0]; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } + while (dpix < dpix_end) { + uae_u32 out_val; + + spix++; + out_val = p_acolors[0]; + if (spritepixels[dpix].data) { + sprcol = render_sprites (dpix, 0, 0, 1); + if (sprcol) { + out_val = p_acolors[sprcol]; } - buf[dpix++] = out_val; } + buf[dpix++] = out_val; } return spix; @@ -4835,88 +659,29 @@ static int NOINLINE linetoscr_16_stretch1_aga_spronly(int spix, int dpix, int dp uae_u16 *buf = (uae_u16 *) xlinebuffer; uae_u8 sprcol; - if (1) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 out_val; - - sprpix_val = 0; - spix++; - out_val = p_acolors[0]; - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; + while (dpix < dpix_end) { + uae_u32 out_val; + + spix++; + out_val = p_acolors[0]; + { + uae_u32 out_val1 = out_val; + uae_u32 out_val2 = out_val; + if (spritepixels[dpix + 0].data) { + sprcol = render_sprites (dpix + 0, 0, 0, 1); + if (sprcol) { + out_val1 = p_acolors[sprcol]; } } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_stretch2_aga_spronly(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 sprcol; - - if (1) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 out_val; - - sprpix_val = 0; - spix++; - out_val = p_acolors[0]; - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 0, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 0, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; + if (spritepixels[dpix + 1].data) { + sprcol = render_sprites (dpix + 1, 0, 0, 1); + if (sprcol) { + out_val2 = p_acolors[sprcol]; } } + buf[dpix++] = out_val1; + buf[dpix++] = out_val2; + } } return spix; @@ -4929,50 +694,18 @@ static int NOINLINE linetoscr_16_shrink1_aga_spronly(int spix, int dpix, int dpi uae_u16 *buf = (uae_u16 *) xlinebuffer; uae_u8 sprcol; - if (1) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 out_val; - - sprpix_val = 0; - spix++; - out_val = p_acolors[0]; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } + while (dpix < dpix_end) { + uae_u32 out_val; + + spix++; + out_val = p_acolors[0]; + if (spritepixels[dpix].data) { + sprcol = render_sprites (dpix, 0, 0, 1); + if (sprcol) { + out_val = p_acolors[sprcol]; } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_shrink1f_aga_spronly(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 sprcol; - - if (1) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 out_val; - - sprpix_val = 0; - spix++; - out_val = p_acolors[0]; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; } + buf[dpix++] = out_val; } return spix; @@ -4985,22 +718,18 @@ static int NOINLINE linetoscr_16_shrink2_aga_spronly(int spix, int dpix, int dpi uae_u16 *buf = (uae_u16 *) xlinebuffer; uae_u8 sprcol; - if (1) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 out_val; - - sprpix_val = 0; - spix++; - out_val = p_acolors[0]; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } + while (dpix < dpix_end) { + uae_u32 out_val; + + spix++; + out_val = p_acolors[0]; + if (spritepixels[dpix].data) { + sprcol = render_sprites (dpix, 0, 0, 1); + if (sprcol) { + out_val = p_acolors[sprcol]; } - buf[dpix++] = out_val; } + buf[dpix++] = out_val; } return spix; @@ -5008,49 +737,17 @@ static int NOINLINE linetoscr_16_shrink2_aga_spronly(int spix, int dpix, int dpi #endif #ifdef AGA -static int NOINLINE linetoscr_16_shrink2f_aga_spronly(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 sprcol; - - if (1) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 out_val; - - sprpix_val = 0; - spix++; - out_val = p_acolors[0]; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_aga(int spix, int dpix, int dpix_end) +static int NOINLINE linetoscr_16_aga (int spix, int dpix, int dpix_end) { uae_u16 *buf = (uae_u16 *) xlinebuffer; uae_u8 xor_val = bplxor; uae_u8 and_val = bpland; - + if (bplham) { int rem; if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); + buf[dpix++] = ham_linebuf[spix]; spix++; - buf[dpix++] = dpix_val; } if (dpix >= dpix_end) return spix; @@ -5058,28 +755,16 @@ static int NOINLINE linetoscr_16_aga(int spix, int dpix, int dpix_end) if (rem) dpix_end--; while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); + out_val = *((uae_u32 *)&ham_linebuf[spix]); + spix += 2; *((uae_u32 *)&buf[dpix]) = out_val; dpix += 2; } if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); + buf[dpix++] = ham_linebuf[spix]; spix++; - buf[dpix++] = dpix_val; } } else if (bpldualpf) { int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; @@ -5089,13 +774,11 @@ static int NOINLINE linetoscr_16_aga(int spix, int dpix, int dpix_end) uae_u32 spix_val; uae_u32 dpix_val; spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + uae_u8 val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + dpix_val = p_acolors[val]; spix++; buf[dpix++] = dpix_val; } @@ -5110,39 +793,31 @@ static int NOINLINE linetoscr_16_aga(int spix, int dpix, int dpix_end) uae_u32 out_val; spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + uae_u8 val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + out_val = p_acolors[val]; spix++; - out_val = dpix_val; spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + dpix_val = p_acolors[val]; spix++; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; + *((uae_u32 *)&buf[dpix]) = merge_words(out_val, dpix_val); dpix += 2; } if (rem) { uae_u32 spix_val; uae_u32 dpix_val; spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + uae_u8 val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + dpix_val = p_acolors[val]; spix++; buf[dpix++] = dpix_val; } @@ -5154,7 +829,7 @@ static int NOINLINE linetoscr_16_aga(int spix, int dpix, int dpix_end) spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + dpix_val = CONVERT_RGB_16 (c); } else dpix_val = p_acolors[spix_val]; spix++; @@ -5173,20 +848,18 @@ static int NOINLINE linetoscr_16_aga(int spix, int dpix, int dpix_end) spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + out_val = CONVERT_RGB_16 (c); } else - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix++; - out_val = dpix_val; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + dpix_val = CONVERT_RGB_16 (c); } else dpix_val = p_acolors[spix_val]; spix++; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; + *((uae_u32 *)&buf[dpix]) = merge_words(out_val, dpix_val); dpix += 2; } if (rem) { @@ -5195,7 +868,7 @@ static int NOINLINE linetoscr_16_aga(int spix, int dpix, int dpix_end) spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + dpix_val = CONVERT_RGB_16 (c); } else dpix_val = p_acolors[spix_val]; spix++; @@ -5205,11 +878,8 @@ static int NOINLINE linetoscr_16_aga(int spix, int dpix, int dpix_end) int rem; if (((uintptr_t)&buf[dpix]) & 2) { uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - buf[dpix++] = dpix_val; + spix_val = (pixdata.apixels[spix++] ^ xor_val) & and_val; + buf[dpix++] = p_acolors[spix_val]; } if (dpix >= dpix_end) return spix; @@ -5221,24 +891,17 @@ static int NOINLINE linetoscr_16_aga(int spix, int dpix, int dpix_end) uae_u32 dpix_val; uae_u32 out_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; + spix_val = (pixdata.apixels[spix++] ^ xor_val) & and_val; + out_val = p_acolors[spix_val]; + spix_val = (pixdata.apixels[spix++] ^ xor_val) & and_val; dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; + *((uae_u32 *)&buf[dpix]) = merge_words(out_val, dpix_val); dpix += 2; } if (rem) { uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - buf[dpix++] = dpix_val; + spix_val = (pixdata.apixels[spix++] ^ xor_val) & and_val; + buf[dpix++] = p_acolors[spix_val]; } } @@ -5247,223 +910,7 @@ static int NOINLINE linetoscr_16_aga(int spix, int dpix, int dpix_end) #endif #ifdef AGA -static int NOINLINE linetoscr_16_aga_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - buf[dpix++] = dpix_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - buf[dpix++] = dpix_val; - } - } else if (bplehb) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - buf[dpix++] = dpix_val; - } - } else { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - buf[dpix++] = dpix_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_stretch1_aga(int spix, int dpix, int dpix_end) +static int NOINLINE linetoscr_16_stretch1_aga (int spix, int dpix, int dpix_end) { uae_u16 *buf = (uae_u16 *) xlinebuffer; uae_u8 xor_val = bplxor; @@ -5471,15 +918,9 @@ static int NOINLINE linetoscr_16_stretch1_aga(int spix, int dpix, int dpix_end) if (bplham) { while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - *((uae_u32 *)&buf[dpix]) = out_val; + out_val = ham_linebuf[spix++]; + *((uae_u32 *)&buf[dpix]) = double_word(out_val); dpix += 2; } } else if (bpldualpf) { @@ -5487,49 +928,40 @@ static int NOINLINE linetoscr_16_stretch1_aga(int spix, int dpix, int dpix_end) int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; while (dpix < dpix_end) { uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + uae_u8 val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + out_val = p_acolors[val]; spix++; - out_val = dpix_val; *((uae_u32 *)&buf[dpix]) = out_val; dpix += 2; } } else if (bplehb) { while (dpix < dpix_end) { uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + out_val = CONVERT_RGB (c); } else - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix++; - out_val = dpix_val; *((uae_u32 *)&buf[dpix]) = out_val; dpix += 2; } } else { while (dpix < dpix_end) { uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; + spix_val = (pixdata.apixels[spix++] ^ xor_val) & and_val; + out_val = p_acolors[spix_val]; *((uae_u32 *)&buf[dpix]) = out_val; dpix += 2; } @@ -5540,280 +972,7 @@ static int NOINLINE linetoscr_16_stretch1_aga(int spix, int dpix, int dpix_end) #endif #ifdef AGA -static int NOINLINE linetoscr_16_stretch1_aga_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - genlock_buf[dpix + 1] = get_genlock_transparency((spix_val >> 2) & 63); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 1] = get_genlock_transparency(lookup[spix_val]); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 31); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_stretch2_aga(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_stretch2_aga_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - genlock_buf[dpix + 1] = get_genlock_transparency((spix_val >> 2) & 63); - genlock_buf[dpix + 2] = get_genlock_transparency((spix_val >> 2) & 63); - genlock_buf[dpix + 3] = get_genlock_transparency((spix_val >> 2) & 63); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 1] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 2] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 3] = get_genlock_transparency(lookup[spix_val]); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val & 31); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_shrink1_aga(int spix, int dpix, int dpix_end) +static int NOINLINE linetoscr_16_shrink1_aga (int spix, int dpix, int dpix_end) { uae_u16 *buf = (uae_u16 *) xlinebuffer; uae_u8 xor_val = bplxor; @@ -5822,12 +981,8 @@ static int NOINLINE linetoscr_16_shrink1_aga(int spix, int dpix, int dpix_end) if (bplham) { int rem; if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); + buf[dpix++] = ham_linebuf[spix]; spix += 2; - buf[dpix++] = dpix_val; } if (dpix >= dpix_end) return spix; @@ -5835,28 +990,20 @@ static int NOINLINE linetoscr_16_shrink1_aga(int spix, int dpix, int dpix_end) if (rem) dpix_end--; while (dpix < dpix_end) { - uae_u32 spix_val; uae_u32 dpix_val; uae_u32 out_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); + out_val = ham_linebuf[spix]; spix += 2; - out_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); + dpix_val = ham_linebuf[spix]; spix += 2; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); + out_val = merge_words(out_val, dpix_val); *((uae_u32 *)&buf[dpix]) = out_val; dpix += 2; } if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); + buf[dpix++] = ham_linebuf[spix]; spix += 2; - buf[dpix++] = dpix_val; } } else if (bpldualpf) { int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; @@ -5866,13 +1013,11 @@ static int NOINLINE linetoscr_16_shrink1_aga(int spix, int dpix, int dpix_end) uae_u32 spix_val; uae_u32 dpix_val; spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + uae_u8 val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + dpix_val = p_acolors[val]; spix += 2; buf[dpix++] = dpix_val; } @@ -5887,39 +1032,31 @@ static int NOINLINE linetoscr_16_shrink1_aga(int spix, int dpix, int dpix_end) uae_u32 out_val; spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + uae_u8 val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + out_val = p_acolors[val]; spix += 2; - out_val = dpix_val; spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + dpix_val = p_acolors[val]; spix += 2; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; + *((uae_u32 *)&buf[dpix]) = merge_words(out_val, dpix_val); dpix += 2; } if (rem) { uae_u32 spix_val; uae_u32 dpix_val; spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + uae_u8 val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + dpix_val = p_acolors[val]; spix += 2; buf[dpix++] = dpix_val; } @@ -5931,7 +1068,7 @@ static int NOINLINE linetoscr_16_shrink1_aga(int spix, int dpix, int dpix_end) spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + dpix_val = CONVERT_RGB_16 (c); } else dpix_val = p_acolors[spix_val]; spix += 2; @@ -5950,20 +1087,18 @@ static int NOINLINE linetoscr_16_shrink1_aga(int spix, int dpix, int dpix_end) spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + out_val = CONVERT_RGB_16 (c); } else - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix += 2; - out_val = dpix_val; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + dpix_val = CONVERT_RGB_16 (c); } else dpix_val = p_acolors[spix_val]; spix += 2; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; + *((uae_u32 *)&buf[dpix]) = merge_words(out_val, dpix_val); dpix += 2; } if (rem) { @@ -5972,7 +1107,7 @@ static int NOINLINE linetoscr_16_shrink1_aga(int spix, int dpix, int dpix_end) spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + dpix_val = CONVERT_RGB_16 (c); } else dpix_val = p_acolors[spix_val]; spix += 2; @@ -5982,11 +1117,9 @@ static int NOINLINE linetoscr_16_shrink1_aga(int spix, int dpix, int dpix_end) int rem; if (((uintptr_t)&buf[dpix]) & 2) { uae_u32 spix_val; - uae_u32 dpix_val; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; spix += 2; - buf[dpix++] = dpix_val; + buf[dpix++] = p_acolors[spix_val]; } if (dpix >= dpix_end) return spix; @@ -5999,23 +1132,19 @@ static int NOINLINE linetoscr_16_shrink1_aga(int spix, int dpix, int dpix_end) uae_u32 out_val; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix += 2; - out_val = dpix_val; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; dpix_val = p_acolors[spix_val]; spix += 2; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; + *((uae_u32 *)&buf[dpix]) = merge_words(out_val, dpix_val); dpix += 2; } if (rem) { uae_u32 spix_val; - uae_u32 dpix_val; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; spix += 2; - buf[dpix++] = dpix_val; + buf[dpix++] = p_acolors[spix_val]; } } @@ -6024,22 +1153,17 @@ static int NOINLINE linetoscr_16_shrink1_aga(int spix, int dpix, int dpix_end) #endif #ifdef AGA -static int NOINLINE linetoscr_16_shrink1_aga_genlock(int spix, int dpix, int dpix_end) +static int NOINLINE linetoscr_16_shrink2_aga (int spix, int dpix, int dpix_end) { uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; uae_u8 xor_val = bplxor; uae_u8 and_val = bpland; if (bplham) { int rem; if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 2; - buf[dpix++] = dpix_val; + buf[dpix++] = ham_linebuf[spix]; + spix += 4; } if (dpix >= dpix_end) return spix; @@ -6047,29 +1171,20 @@ static int NOINLINE linetoscr_16_shrink1_aga_genlock(int spix, int dpix, int dpi if (rem) dpix_end--; while (dpix < dpix_end) { - uae_u32 spix_val; uae_u32 dpix_val; uae_u32 out_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 2; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); + out_val = ham_linebuf[spix]; + spix += 4; + dpix_val = ham_linebuf[spix]; + spix += 4; + out_val = merge_words(out_val, dpix_val); *((uae_u32 *)&buf[dpix]) = out_val; dpix += 2; } if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 2; - buf[dpix++] = dpix_val; + buf[dpix++] = ham_linebuf[spix]; + spix += 4; } } else if (bpldualpf) { int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; @@ -6079,990 +1194,11 @@ static int NOINLINE linetoscr_16_shrink1_aga_genlock(int spix, int dpix, int dpi uae_u32 spix_val; uae_u32 dpix_val; spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 2; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 2; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 2; - buf[dpix++] = dpix_val; - } - } else if (bplehb) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 2; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 2; - buf[dpix++] = dpix_val; - } - } else { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 2; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 2; - buf[dpix++] = dpix_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_shrink1f_aga(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - } else if (bplehb) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - } else { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_shrink1f_aga_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - } else if (bplehb) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - } else { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - buf[dpix++] = dpix_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_shrink2_aga(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 4; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 4; - out_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 4; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 4; - buf[dpix++] = dpix_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + uae_u8 val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + dpix_val = p_acolors[val]; spix += 4; buf[dpix++] = dpix_val; } @@ -7077,39 +1213,31 @@ static int NOINLINE linetoscr_16_shrink2_aga(int spix, int dpix, int dpix_end) uae_u32 out_val; spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + uae_u8 val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + out_val = p_acolors[val]; spix += 4; - out_val = dpix_val; spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + dpix_val = p_acolors[val]; spix += 4; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; + *((uae_u32 *)&buf[dpix]) = merge_words(out_val, dpix_val); dpix += 2; } if (rem) { uae_u32 spix_val; uae_u32 dpix_val; spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + uae_u8 val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + dpix_val = p_acolors[val]; spix += 4; buf[dpix++] = dpix_val; } @@ -7121,7 +1249,7 @@ static int NOINLINE linetoscr_16_shrink2_aga(int spix, int dpix, int dpix_end) spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + dpix_val = CONVERT_RGB_16 (c); } else dpix_val = p_acolors[spix_val]; spix += 4; @@ -7140,20 +1268,18 @@ static int NOINLINE linetoscr_16_shrink2_aga(int spix, int dpix, int dpix_end) spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + out_val = CONVERT_RGB_16 (c); } else - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix += 4; - out_val = dpix_val; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + dpix_val = CONVERT_RGB_16 (c); } else dpix_val = p_acolors[spix_val]; spix += 4; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; + *((uae_u32 *)&buf[dpix]) = merge_words(out_val, dpix_val); dpix += 2; } if (rem) { @@ -7162,7 +1288,7 @@ static int NOINLINE linetoscr_16_shrink2_aga(int spix, int dpix, int dpix_end) spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + dpix_val = CONVERT_RGB_16 (c); } else dpix_val = p_acolors[spix_val]; spix += 4; @@ -7172,11 +1298,9 @@ static int NOINLINE linetoscr_16_shrink2_aga(int spix, int dpix, int dpix_end) int rem; if (((uintptr_t)&buf[dpix]) & 2) { uae_u32 spix_val; - uae_u32 dpix_val; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; spix += 4; - buf[dpix++] = dpix_val; + buf[dpix++] = p_acolors[spix_val]; } if (dpix >= dpix_end) return spix; @@ -7189,1482 +1313,19 @@ static int NOINLINE linetoscr_16_shrink2_aga(int spix, int dpix, int dpix_end) uae_u32 out_val; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix += 4; - out_val = dpix_val; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; dpix_val = p_acolors[spix_val]; spix += 4; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; + *((uae_u32 *)&buf[dpix]) = merge_words(out_val, dpix_val); dpix += 2; } if (rem) { uae_u32 spix_val; - uae_u32 dpix_val; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; spix += 4; - buf[dpix++] = dpix_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_shrink2_aga_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 4; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 4; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 4; - buf[dpix++] = dpix_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 4; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 4; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 4; - buf[dpix++] = dpix_val; - } - } else if (bplehb) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 4; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 4; - buf[dpix++] = dpix_val; - } - } else { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 4; - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 4; - buf[dpix++] = dpix_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_shrink2f_aga(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - } else if (bplehb) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - } else { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_shrink2f_aga_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - } else if (bplehb) { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - } else { - int rem; - if (((uintptr_t)&buf[dpix]) & 2) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; - } - if (dpix >= dpix_end) - return spix; - rem = (((uintptr_t)&buf[dpix_end]) & 2); - if (rem) - dpix_end--; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = (out_val & 0xFFFF) | (dpix_val << 16); - *((uae_u32 *)&buf[dpix]) = out_val; - dpix += 2; - } - if (rem) { - uae_u32 spix_val; - uae_u32 dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - buf[dpix++] = dpix_val; + buf[dpix++] = p_acolors[spix_val]; } } @@ -8683,15 +1344,10 @@ static int NOINLINE linetoscr_16_aga_spr(int spix, int dpix, int dpix_end) if (bplham) { while (dpix < dpix_end) { uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; + out_val = ham_linebuf[spix++]; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); if (sprcol) { @@ -8706,20 +1362,16 @@ static int NOINLINE linetoscr_16_aga_spr(int spix, int dpix, int dpix_end) while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; spix_val = pixdata.apixels[spix]; sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + uae_u8 val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + out_val = p_acolors[val]; spix++; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); if (sprcol) { @@ -8732,18 +1384,16 @@ static int NOINLINE linetoscr_16_aga_spr(int spix, int dpix, int dpix_end) while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; sprpix_val = pixdata.apixels[spix]; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + out_val = CONVERT_RGB (c); } else - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix++; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); if (sprcol) { @@ -8756,14 +1406,12 @@ static int NOINLINE linetoscr_16_aga_spr(int spix, int dpix, int dpix_end) while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; sprpix_val = pixdata.apixels[spix]; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix++; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); if (sprcol) { @@ -8778,121 +1426,6 @@ static int NOINLINE linetoscr_16_aga_spr(int spix, int dpix, int dpix_end) } #endif -#ifdef AGA -static int NOINLINE linetoscr_16_aga_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - #ifdef AGA static int NOINLINE linetoscr_16_stretch1_aga_spr(int spix, int dpix, int dpix_end) { @@ -8905,14 +1438,11 @@ static int NOINLINE linetoscr_16_stretch1_aga_spr(int spix, int dpix, int dpix_e while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); + out_val = ham_linebuf[spix]; spix++; - out_val = dpix_val; { uae_u32 out_val1 = out_val; uae_u32 out_val2 = out_val; @@ -8938,20 +1468,16 @@ static int NOINLINE linetoscr_16_stretch1_aga_spr(int spix, int dpix, int dpix_e while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; spix_val = pixdata.apixels[spix]; sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + uae_u8 val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + out_val = p_acolors[val]; spix++; - out_val = dpix_val; { uae_u32 out_val1 = out_val; uae_u32 out_val2 = out_val; @@ -8975,18 +1501,16 @@ static int NOINLINE linetoscr_16_stretch1_aga_spr(int spix, int dpix, int dpix_e while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; sprpix_val = pixdata.apixels[spix]; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + out_val = CONVERT_RGB (c); } else - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix++; - out_val = dpix_val; { uae_u32 out_val1 = out_val; uae_u32 out_val2 = out_val; @@ -9010,14 +1534,12 @@ static int NOINLINE linetoscr_16_stretch1_aga_spr(int spix, int dpix, int dpix_e while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; sprpix_val = pixdata.apixels[spix]; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix++; - out_val = dpix_val; { uae_u32 out_val1 = out_val; uae_u32 out_val2 = out_val; @@ -9043,634 +1565,6 @@ static int NOINLINE linetoscr_16_stretch1_aga_spr(int spix, int dpix, int dpix_e } #endif -#ifdef AGA -static int NOINLINE linetoscr_16_stretch1_aga_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - genlock_buf[dpix + 1] = get_genlock_transparency((spix_val >> 2) & 63); - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - genlock_buf[dpix + 1] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - } - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 1] = get_genlock_transparency(lookup[spix_val]); - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 1, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - genlock_buf[dpix + 1] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - } - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 31); - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - genlock_buf[dpix + 1] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - } - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val); - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - genlock_buf[dpix + 1] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - } - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_stretch2_aga_spr(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 0, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 0, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 1, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 1, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 1, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 0, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 0, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 0, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 0, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_stretch2_aga_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - genlock_buf[dpix + 1] = get_genlock_transparency((spix_val >> 2) & 63); - genlock_buf[dpix + 2] = get_genlock_transparency((spix_val >> 2) & 63); - genlock_buf[dpix + 3] = get_genlock_transparency((spix_val >> 2) & 63); - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - genlock_buf[dpix + 1] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 0, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - genlock_buf[dpix + 2] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 0, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - genlock_buf[dpix + 3] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 1] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 2] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 3] = get_genlock_transparency(lookup[spix_val]); - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 1, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - genlock_buf[dpix + 1] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 1, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - genlock_buf[dpix + 2] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 1, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - genlock_buf[dpix + 3] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val & 31); - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - genlock_buf[dpix + 1] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 0, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - genlock_buf[dpix + 2] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 0, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - genlock_buf[dpix + 3] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val); - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - genlock_buf[dpix + 1] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 0, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - genlock_buf[dpix + 2] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 0, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - genlock_buf[dpix + 3] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } - - return spix; -} -#endif - #ifdef AGA static int NOINLINE linetoscr_16_shrink1_aga_spr(int spix, int dpix, int dpix_end) { @@ -9682,15 +1576,11 @@ static int NOINLINE linetoscr_16_shrink1_aga_spr(int spix, int dpix, int dpix_en if (bplham) { while (dpix < dpix_end) { uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); + out_val = ham_linebuf[spix]; spix += 2; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); if (sprcol) { @@ -9705,20 +1595,16 @@ static int NOINLINE linetoscr_16_shrink1_aga_spr(int spix, int dpix, int dpix_en while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; spix_val = pixdata.apixels[spix]; sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + uae_u8 val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + out_val = p_acolors[val]; spix += 2; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); if (sprcol) { @@ -9731,18 +1617,16 @@ static int NOINLINE linetoscr_16_shrink1_aga_spr(int spix, int dpix, int dpix_en while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; sprpix_val = pixdata.apixels[spix]; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + out_val = CONVERT_RGB (c); } else - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix += 2; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); if (sprcol) { @@ -9755,14 +1639,12 @@ static int NOINLINE linetoscr_16_shrink1_aga_spr(int spix, int dpix, int dpix_en while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; sprpix_val = pixdata.apixels[spix]; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix += 2; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); if (sprcol) { @@ -9777,434 +1659,6 @@ static int NOINLINE linetoscr_16_shrink1_aga_spr(int spix, int dpix, int dpix_en } #endif -#ifdef AGA -static int NOINLINE linetoscr_16_shrink1_aga_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_shrink1f_aga_spr(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_shrink1f_aga_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel16 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - #ifdef AGA static int NOINLINE linetoscr_16_shrink2_aga_spr(int spix, int dpix, int dpix_end) { @@ -10216,15 +1670,11 @@ static int NOINLINE linetoscr_16_shrink2_aga_spr(int spix, int dpix, int dpix_en if (bplham) { while (dpix < dpix_end) { uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); + out_val = ham_linebuf[spix]; spix += 4; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); if (sprcol) { @@ -10239,20 +1689,16 @@ static int NOINLINE linetoscr_16_shrink2_aga_spr(int spix, int dpix, int dpix_en while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; spix_val = pixdata.apixels[spix]; sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } + uae_u8 val = lookup[spix_val]; + if (lookup_no[spix_val]) + val += dblpfofs[bpldualpf2of]; + val ^= xor_val; + out_val = p_acolors[val]; spix += 4; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); if (sprcol) { @@ -10265,18 +1711,16 @@ static int NOINLINE linetoscr_16_shrink2_aga_spr(int spix, int dpix, int dpix_en while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; sprpix_val = pixdata.apixels[spix]; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; if (pixdata.apixels[spix] & 0x20) { unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); + out_val = CONVERT_RGB (c); } else - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix += 4; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); if (sprcol) { @@ -10289,14 +1733,12 @@ static int NOINLINE linetoscr_16_shrink2_aga_spr(int spix, int dpix, int dpix_en while (dpix < dpix_end) { uae_u32 sprpix_val; uae_u32 spix_val; - uae_u32 dpix_val; uae_u32 out_val; sprpix_val = pixdata.apixels[spix]; spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; + out_val = p_acolors[spix_val]; spix += 4; - out_val = dpix_val; if (spritepixels[dpix].data) { sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); if (sprcol) { @@ -10310,7314 +1752,3 @@ static int NOINLINE linetoscr_16_shrink2_aga_spr(int spix, int dpix, int dpix_en return spix; } #endif - -#ifdef AGA -static int NOINLINE linetoscr_16_shrink2_aga_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_shrink2f_aga_spr(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val2 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val3 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_16_shrink2f_aga_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u16 *buf = (uae_u16 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val2 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val3 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel16 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel16 (tmp_val3, dpix_val); - dpix_val = merge_2pixel16 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -static int NOINLINE linetoscr_32(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_stretch1(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_stretch1_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 15); - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 1] = get_genlock_transparency(lookup[spix_val]); - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 31); - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val); - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_stretch2(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_stretch2_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 15); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val & 15); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val & 15); - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 1] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 2] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 3] = get_genlock_transparency(lookup[spix_val]); - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val & 31); - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val); - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_shrink1(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix += 2; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 2; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 2; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_shrink1_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_shrink1f(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_shrink1f_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_shrink2(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix += 4; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 4; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 4; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_shrink2_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_shrink2f(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_shrink2f_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[lookup[spix_val]]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_spr(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_stretch1_spr(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_stretch1_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 15); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 1] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_stretch2_spr(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_stretch2_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 15); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val & 15); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val & 15); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 1] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 2] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 3] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_shrink1_spr(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix += 2; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 2; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 2; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_shrink1_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_shrink1f_spr(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_shrink1f_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_shrink2_spr(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix += 4; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 4; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 4; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_shrink2_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_shrink2f_spr(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - -static int NOINLINE linetoscr_32_shrink2f_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = p_xcolors[spix_val]; - sprpix_val = pixdata.apixels[spix]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 15); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[lookup[spix_val]]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 1, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - if (spix_val <= 31) - dpix_val = p_acolors[spix_val]; - else - dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix, 0, sprpix_val, 0); - genlock_buf[dpix] = get_genlock_transparency(sprcol); - if (sprcol) { - uae_u32 spcol = p_acolors[sprcol]; - out_val = spcol; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} - -#ifdef AGA -static int NOINLINE linetoscr_32_aga_spronly(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - - if (1) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 out_val; - - sprpix_val = 0; - spix++; - out_val = p_acolors[0]; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_stretch1_aga_spronly(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - - if (1) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 out_val; - - sprpix_val = 0; - spix++; - out_val = p_acolors[0]; - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - } - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_stretch2_aga_spronly(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - - if (1) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 out_val; - - sprpix_val = 0; - spix++; - out_val = p_acolors[0]; - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 0, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 0, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink1_aga_spronly(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - - if (1) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 out_val; - - sprpix_val = 0; - spix++; - out_val = p_acolors[0]; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink1f_aga_spronly(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - - if (1) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 out_val; - - sprpix_val = 0; - spix++; - out_val = p_acolors[0]; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink2_aga_spronly(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - - if (1) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 out_val; - - sprpix_val = 0; - spix++; - out_val = p_acolors[0]; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink2f_aga_spronly(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - - if (1) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 out_val; - - sprpix_val = 0; - spix++; - out_val = p_acolors[0]; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_aga(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_aga_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_stretch1_aga(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_stretch1_aga_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - genlock_buf[dpix + 1] = get_genlock_transparency((spix_val >> 2) & 63); - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 1] = get_genlock_transparency(lookup[spix_val]); - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 31); - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val); - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_stretch2_aga(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_stretch2_aga_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - genlock_buf[dpix + 1] = get_genlock_transparency((spix_val >> 2) & 63); - genlock_buf[dpix + 2] = get_genlock_transparency((spix_val >> 2) & 63); - genlock_buf[dpix + 3] = get_genlock_transparency((spix_val >> 2) & 63); - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 1] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 2] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 3] = get_genlock_transparency(lookup[spix_val]); - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val & 31); - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val); - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink1_aga(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 2; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 2; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink1_aga_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink1f_aga(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink1f_aga_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink2_aga(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 4; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 4; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink2_aga_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink2f_aga(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink2f_aga_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val2 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val3 = dpix_val; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_aga_spr(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_aga_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_stretch1_aga_spr(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - } - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 1, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - } - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - } - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - } - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_stretch1_aga_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - genlock_buf[dpix + 1] = get_genlock_transparency((spix_val >> 2) & 63); - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - genlock_buf[dpix + 1] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - } - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 1] = get_genlock_transparency(lookup[spix_val]); - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 1, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - genlock_buf[dpix + 1] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - } - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 31); - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - genlock_buf[dpix + 1] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - } - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val); - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - genlock_buf[dpix + 1] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - } - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_stretch2_aga_spr(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 0, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 0, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 1, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 1, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 1, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 0, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 0, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 0, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 0, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_stretch2_aga_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - genlock_buf[dpix + 1] = get_genlock_transparency((spix_val >> 2) & 63); - genlock_buf[dpix + 2] = get_genlock_transparency((spix_val >> 2) & 63); - genlock_buf[dpix + 3] = get_genlock_transparency((spix_val >> 2) & 63); - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - genlock_buf[dpix + 1] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 0, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - genlock_buf[dpix + 2] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 0, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - genlock_buf[dpix + 3] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 1] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 2] = get_genlock_transparency(lookup[spix_val]); - genlock_buf[dpix + 3] = get_genlock_transparency(lookup[spix_val]); - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 1, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - genlock_buf[dpix + 1] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 1, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - genlock_buf[dpix + 2] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 1, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - genlock_buf[dpix + 3] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val & 31); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val & 31); - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - genlock_buf[dpix + 1] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 0, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - genlock_buf[dpix + 2] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 0, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - genlock_buf[dpix + 3] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 1] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 2] = get_genlock_transparency(spix_val); - genlock_buf[dpix + 3] = get_genlock_transparency(spix_val); - { - uae_u32 out_val1 = out_val; - uae_u32 out_val2 = out_val; - uae_u32 out_val3 = out_val; - uae_u32 out_val4 = out_val; - if (spritepixels[dpix + 0].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val1 = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 1].data) { - sprcol = render_sprites (dpix + 1, 0, sprpix_val, 1); - if (sprcol) { - out_val2 = p_acolors[sprcol]; - genlock_buf[dpix + 1] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 2].data) { - sprcol = render_sprites (dpix + 2, 0, sprpix_val, 1); - if (sprcol) { - out_val3 = p_acolors[sprcol]; - genlock_buf[dpix + 2] = get_genlock_transparency(sprcol); - } - } - if (spritepixels[dpix + 3].data) { - sprcol = render_sprites (dpix + 3, 0, sprpix_val, 1); - if (sprcol) { - out_val4 = p_acolors[sprcol]; - genlock_buf[dpix + 3] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val1; - buf[dpix++] = out_val2; - buf[dpix++] = out_val3; - buf[dpix++] = out_val4; - } - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink1_aga_spr(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 2; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 2; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink1_aga_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 2; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink1f_aga_spr(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink1f_aga_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - dpix_val = merge_2pixel32 (dpix_val, tmp_val); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink2_aga_spr(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 4; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 4; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink2_aga_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix += 4; - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink2f_aga_spr(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val2 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val3 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - -#ifdef AGA -static int NOINLINE linetoscr_32_shrink2f_aga_spr_genlock(int spix, int dpix, int dpix_end) -{ - uae_u32 *buf = (uae_u32 *) xlinebuffer; - uae_u8 *genlock_buf = xlinebuffer_genlock; - uae_u8 sprcol; - uae_u8 xor_val = bplxor; - uae_u8 and_val = bpland; - - if (bplham) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val2 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - spix++; - tmp_val3 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = ham_linebuf[spix]; - dpix_val = CONVERT_RGB (spix_val); - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency((spix_val >> 2) & 63); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bpldualpf) { - int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga; - int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1; - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val2 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - spix++; - tmp_val3 = dpix_val; - spix_val = pixdata.apixels[spix]; - sprpix_val = spix_val; - { - uae_u8 val = lookup[spix_val]; - if (lookup_no[spix_val]) - val += dblpfofs[bpldualpf2of]; - val ^= xor_val; - dpix_val = p_acolors[val]; - } - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(lookup[spix_val]); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 1, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else if (bplehb) { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - if (pixdata.apixels[spix] & 0x20) { - unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F; - dpix_val = CONVERT_RGB (c); - } else - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val & 31); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } else { - while (dpix < dpix_end) { - uae_u32 sprpix_val; - uae_u32 spix_val; - uae_u32 dpix_val; - uae_u32 out_val; - - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - { - uae_u32 tmp_val, tmp_val2, tmp_val3; - spix++; - tmp_val = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val2 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - spix++; - tmp_val3 = dpix_val; - sprpix_val = pixdata.apixels[spix]; - spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val; - dpix_val = p_acolors[spix_val]; - tmp_val = merge_2pixel32 (tmp_val, tmp_val2); - tmp_val2 = merge_2pixel32 (tmp_val3, dpix_val); - dpix_val = merge_2pixel32 (tmp_val, tmp_val2); - spix++; - } - out_val = dpix_val; - genlock_buf[dpix] = get_genlock_transparency(spix_val); - if (spritepixels[dpix].data) { - sprcol = render_sprites (dpix + 0, 0, sprpix_val, 1); - if (sprcol) { - out_val = p_acolors[sprcol]; - genlock_buf[dpix] = get_genlock_transparency(sprcol); - } - } - buf[dpix++] = out_val; - } - } - - return spix; -} -#endif - diff --git a/src/machdep/maccess.h b/src/machdep/maccess.h index d86f1210..49db277a 100644 --- a/src/machdep/maccess.h +++ b/src/machdep/maccess.h @@ -1,96 +1,100 @@ -/* - * UAE - The Un*x Amiga Emulator - * - * Memory access functions - * - * Copyright 1996 Bernd Schmidt - */ + /* + * UAE - The Un*x Amiga Emulator + * + * Memory access functions + * + * Copyright 1996 Bernd Schmidt + */ #ifndef MACCESS_UAE_H #define MACCESS_UAE_H -#define ALIGN_POINTER_TO32(p) ((~(unsigned long)(p)) & 3) +#ifdef ARMV6_ASSEMBLY - #ifdef ARMV6_ASSEMBLY - - STATIC_INLINE uae_u32 do_get_mem_long(uae_u32 *a) - { - uae_u32 v; - __asm__ ( - "ldr %[v], [%[a]] \n\t" - "rev %[v], %[v] \n\t" - : [v] "=r" (v) : [a] "r" (a) ); - return v; - } - #else -STATIC_INLINE uae_u32 do_get_mem_long(uae_u32 *a) +STATIC_INLINE uae_u16 do_get_mem_word(uae_u16 *_GCCRES_ a) { - uae_u8 *b = (uae_u8 *)a; - return (*b << 24) | (*(b + 1) << 16) | (*(b + 2) << 8) | (*(b + 3)); + uae_u16 v; + __asm__ ( + "ldrh %[v], [%[a]] \n\t" + "rev16 %[v], %[v] \n\t" + : [v] "=r" (v) : [a] "r" (a) ); + return v; +} +#else +STATIC_INLINE uae_u16 do_get_mem_word(uae_u16 *_GCCRES_ a) +{ + uae_u8 *b = (uae_u8 *)a; + + return (*b << 8) | (*(b+1)); +} +#endif + + +#ifdef ARMV6_ASSEMBLY + +STATIC_INLINE uae_u32 do_get_mem_long(uae_u32 *a) +{ + uae_u32 v; + __asm__ ( + "ldr %[v], [%[a]] \n\t" + "rev %[v], %[v] \n\t" + : [v] "=r" (v) : [a] "r" (a) ); + return v; +} +#else +STATIC_INLINE uae_u32 do_get_mem_long(uae_u32 *_GCCRES_ a) +{ + uae_u8 *b = (uae_u8 *)a; + + return (*b << 24) | (*(b+1) << 16) | (*(b+2) << 8) | (*(b+3)); +} +#endif + + +STATIC_INLINE uae_u8 do_get_mem_byte(uae_u8 *_GCCRES_ a) +{ + return *a; +} + +#ifdef ARMV6_ASSEMBLY +STATIC_INLINE void do_put_mem_word(uae_u16 *_GCCRES_ a, uae_u16 v) +{ + __asm__ ( + "rev16 r2, %[v] \n\t" + "strh r2, [%[a]] \n\t" + : : [v] "r" (v), [a] "r" (a) : "r2", "memory" ); +} +#else +STATIC_INLINE void do_put_mem_word(uae_u16 *_GCCRES_ a, uae_u16 v) +{ + uae_u8 *b = (uae_u8 *)a; + + *b = v >> 8; + *(b+1) = v; } #endif #ifdef ARMV6_ASSEMBLY - -STATIC_INLINE uae_u16 do_get_mem_word(uae_u16 *a) +STATIC_INLINE void do_put_mem_long(uae_u32 *_GCCRES_ a, uae_u32 v) { - uae_u16 v; - __asm__ ( - "ldrh %[v], [%[a]] \n\t" - "rev16 %[v], %[v] \n\t" - : [v] "=r" (v) : [a] "r" (a) ); - return v; + __asm__ ( + "rev r2, %[v] \n\t" + "str r2, [%[a]] \n\t" + : : [v] "r" (v), [a] "r" (a) : "r2", "memory" ); } #else -STATIC_INLINE uae_u16 do_get_mem_word(uae_u16 *a) +STATIC_INLINE void do_put_mem_long(uae_u32 *_GCCRES_ a, uae_u32 v) { - uae_u8 *b = (uae_u8 *)a; - - return (*b << 8) | (*(b + 1)); + uae_u8 *b = (uae_u8 *)a; + + *b = v >> 24; + *(b+1) = v >> 16; + *(b+2) = v >> 8; + *(b+3) = v; } #endif -#define do_get_mem_byte(a) ((uae_u32)*(uae_u8 *)(a)) - -#ifdef ARMV6_ASSEMBLY -STATIC_INLINE void do_put_mem_long(uae_u32 *a, uae_u32 v) -{ - __asm__ ( - "rev r2, %[v] \n\t" - "str r2, [%[a]] \n\t" - : : [v] "r" (v), [a] "r" (a) : "r2", "memory" ); -} -#else -STATIC_INLINE void do_put_mem_long(uae_u32 *a, uae_u32 v) -{ - uae_u8 *b = (uae_u8 *)a; - - *b = v >> 24; - *(b + 1) = v >> 16; - *(b + 2) = v >> 8; - *(b + 3) = v; -} -#endif - -#ifdef ARMV6_ASSEMBLY -STATIC_INLINE void do_put_mem_word(uae_u16 *a, uae_u16 v) -{ - __asm__ ( - "rev16 r2, %[v] \n\t" - "strh r2, [%[a]] \n\t" - : : [v] "r" (v), [a] "r" (a) : "r2", "memory" ); -} -#else -STATIC_INLINE void do_put_mem_word(uae_u16 *a, uae_u16 v) -{ - uae_u8 *b = (uae_u8 *)a; - - *b = v >> 8; - *(b + 1) = (uae_u8)v; -} -#endif - -STATIC_INLINE void do_put_mem_byte(uae_u8 *a, uae_u8 v) +STATIC_INLINE void do_put_mem_byte(uae_u8 *_GCCRES_ a, uae_u8 v) { *a = v; } @@ -98,4 +102,8 @@ STATIC_INLINE void do_put_mem_byte(uae_u8 *a, uae_u8 v) #define call_mem_get_func(func, addr) ((*func)(addr)) #define call_mem_put_func(func, addr, v) ((*func)(addr, v)) +#undef MD_HAVE_MEM_1_FUNCS + +#define ALIGN_POINTER_TO32(p) ((~(unsigned long)(p)) & 3) + #endif diff --git a/src/main.cpp b/src/main.cpp index 79538a92..05ba8390 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,22 +25,20 @@ #include "gui.h" #include "zfile.h" #include "autoconf.h" -#include "traps.h" -#include "osemu.h" #include "picasso96.h" -#include "bsdsocket.h" #include "native2amiga.h" -#include "akiko.h" #include "savestate.h" +#include "filesys.h" #include "blkdev.h" -#include "uaeresource.h" #include "gfxboard.h" - -#ifdef JIT +#include "devices.h" #include "jit/compemu.h" + +#ifdef USE_SDL1 +#include "SDL.h" #endif -#ifdef USE_SDL +#ifdef USE_SDL2 #include "SDL.h" #include #include "amiberry_gfx.h" @@ -54,515 +52,320 @@ SDL_DisplayMode sdlMode; #include #include "keyboard.h" -long int version = 256 * 65536L*UAEMAJOR + 65536L*UAEMINOR + UAESUBREV; +long int version = 256*65536L*UAEMAJOR + 65536L*UAEMINOR + UAESUBREV; struct uae_prefs currprefs, changed_prefs; int config_changed; -bool no_gui = false, quit_to_gui = false; -bool cloanto_rom = false; -bool kickstart_rom = true; -bool console_emulation = false; +bool no_gui = 0; +bool cloanto_rom = 0; +bool kickstart_rom = 1; struct gui_info gui_data; -TCHAR warning_buffer[256]; - TCHAR optionsfile[256]; -static uae_u32 randseed; -static int oldhcounter; - -uae_u32 uaesrand(uae_u32 seed) -{ - oldhcounter = -1; - randseed = seed; - //randseed = 0x12345678; - //write_log (_T("seed=%08x\n"), randseed); - return randseed; -} -uae_u32 uaerand() -{ - if (oldhcounter != hsync_counter) { - srand(hsync_counter ^ randseed); - oldhcounter = hsync_counter; - } - uae_u32 r = rand(); - //write_log (_T("rand=%08x\n"), r); - return r; -} -uae_u32 uaerandgetseed() -{ - return randseed; -} - -void my_trim(TCHAR *s) +void my_trim (TCHAR *s) { int len; - while (_tcslen(s) > 0 && _tcscspn(s, _T("\t \r\n")) == 0) - memmove(s, s + 1, (_tcslen(s + 1) + 1) * sizeof(TCHAR)); - len = _tcslen(s); - while (len > 0 && _tcscspn(s + len - 1, _T("\t \r\n")) == 0) + while (_tcslen (s) > 0 && _tcscspn (s, _T("\t \r\n")) == 0) + memmove (s, s + 1, (_tcslen (s + 1) + 1) * sizeof (TCHAR)); + len = _tcslen (s); + while (len > 0 && _tcscspn (s + len - 1, _T("\t \r\n")) == 0) s[--len] = '\0'; } -TCHAR *my_strdup_trim(const TCHAR *s) +TCHAR *my_strdup_trim (const TCHAR *s) { TCHAR *out; int len; - while (_tcscspn(s, _T("\t \r\n")) == 0) + if (s[0] == 0) + return my_strdup(s); + while (_tcscspn (s, _T("\t \r\n")) == 0) s++; - len = _tcslen(s); - while (len > 0 && _tcscspn(s + len - 1, _T("\t \r\n")) == 0) + len = _tcslen (s); + while (len > 0 && _tcscspn (s + len - 1, _T("\t \r\n")) == 0) len--; - out = xmalloc(TCHAR, len + 1); - memcpy(out, s, len * sizeof(TCHAR)); + out = xmalloc (TCHAR, len + 1); + memcpy (out, s, len * sizeof (TCHAR)); out[len] = 0; return out; } -void discard_prefs(struct uae_prefs *p, int type) +void discard_prefs (struct uae_prefs *p, int type) { - struct strlist **ps = &p->all_lines; - while (*ps) { - struct strlist *s = *ps; - *ps = s->next; - xfree(s->value); - xfree(s->option); - xfree(s); - } + struct strlist **ps = &p->all_lines; + while (*ps) { + struct strlist *s = *ps; + *ps = s->next; + xfree (s->value); + xfree (s->option); + xfree (s); + } + p->all_lines = NULL; + currprefs.all_lines = changed_prefs.all_lines = NULL; #ifdef FILESYS - filesys_cleanup(); + filesys_cleanup (); #endif } -static void fixup_prefs_dim2(struct wh *wh) +static void fixup_prefs_dim2 (struct wh *wh) { - if (wh->special) - return; - if (wh->width < 160) { - error_log(_T("Width (%d) must be at least 128."), wh->width); - wh->width = 160; + if (wh->width < 320) { + error_log (_T("Width (%d) must be at least 320."), wh->width); + wh->width = 320; } - if (wh->height < 128) { - error_log(_T("Height (%d) must be at least 128."), wh->height); - wh->height = 128; + if (wh->height < 200) { + error_log (_T("Height (%d) must be at least 200."), wh->height); + wh->height = 200; } if (wh->width > max_uae_width) { - error_log(_T("Width (%d) max is %d."), wh->width, max_uae_width); + error_log (_T("Width (%d) max is %d."), wh->width, max_uae_width); wh->width = max_uae_width; - } + } if (wh->height > max_uae_height) { - error_log(_T("Height (%d) max is %d."), wh->height, max_uae_height); + error_log (_T("Height (%d) max is %d."), wh->height, max_uae_height); wh->height = max_uae_height; } } -void fixup_prefs_dimensions(struct uae_prefs *prefs) +void fixup_prefs_dimensions (struct uae_prefs *prefs) { - fixup_prefs_dim2(&prefs->gfx_size_fs); - fixup_prefs_dim2(&prefs->gfx_size_win); - if (prefs->gfx_apmode[1].gfx_vsync) - prefs->gfx_apmode[1].gfx_vsyncmode = 1; + fixup_prefs_dim2(&prefs->gfx_size); for (int i = 0; i < 2; i++) { struct apmode *ap = &prefs->gfx_apmode[i]; ap->gfx_vflip = 0; - ap->gfx_strobo = false; - if (ap->gfx_vsync) { - if (ap->gfx_vsyncmode) { - // low latency vsync: no flip only if no-buffer - if (ap->gfx_backbuffers >= 1) - ap->gfx_vflip = 1; - if (!i && ap->gfx_backbuffers == 2) - ap->gfx_vflip = 1; - ap->gfx_strobo = prefs->lightboost_strobo; - } - else { - // legacy vsync: always wait for flip - ap->gfx_vflip = -1; - if (prefs->gfx_api && ap->gfx_backbuffers < 1) - ap->gfx_backbuffers = 1; - if (ap->gfx_vflip) - ap->gfx_strobo = prefs->lightboost_strobo;; - } - } - else { - // no vsync: wait if triple bufferirng - if (ap->gfx_backbuffers >= 2) - ap->gfx_vflip = -1; - } - if (prefs->gf[i].gfx_filter == 0 && ((prefs->gf[i].gfx_filter_autoscale && !prefs->gfx_api) || (prefs->gfx_apmode[APMODE_NATIVE].gfx_vsyncmode))) { - prefs->gf[i].gfx_filter = 1; - } - if (i == 0 && prefs->gf[i].gfx_filter == 0 && prefs->monitoremu) { - error_log(_T("A2024 and Graffiti require at least null filter enabled.")); - prefs->gf[i].gfx_filter = 1; - } - } + if (ap->gfx_vsync > 0) { + // legacy vsync: always wait for flip + ap->gfx_vflip = -1; + } + } } void fixup_cpu(struct uae_prefs *p) { - if (p->cpu_frequency == 1000000) - p->cpu_frequency = 0; - - if (p->cpu_model >= 68030 && p->address_space_24) { - error_log(_T("24-bit address space is not supported in 68030/040/060 configurations.")); - p->address_space_24 = false; + if (p->cpu_model >= 68040 && p->address_space_24) { + error_log (_T("24-bit address space is not supported with 68040/060 configurations.")); + p->address_space_24 = 0; } - if (p->cpu_model < 68020 && p->fpu_model && (p->cpu_compatible || p->cpu_cycle_exact)) { - error_log(_T("FPU is not supported in 68000/010 configurations.")); + if (p->cpu_model < 68020 && p->fpu_model && p->cpu_compatible) { + error_log (_T("FPU is not supported with 68000/010 configurations.")); p->fpu_model = 0; } + if (p->cpu_model > 68010 && p->cpu_compatible) { + error_log(_T("CPU Compatible is only supported with 68000/010 configurations.")); + p->cpu_compatible = 0; + } - switch (p->cpu_model) - { - case 68000: - p->address_space_24 = true; - break; - case 68010: - p->address_space_24 = true; - break; - case 68020: - break; - case 68030: - break; - case 68040: - if (p->fpu_model) - p->fpu_model = 68040; - break; - case 68060: - if (p->fpu_model) - p->fpu_model = 68060; - break; - } + switch(p->cpu_model) + { + case 68000: + break; + case 68010: + break; + case 68020: + break; + case 68030: + break; + case 68040: + if (p->fpu_model) + p->fpu_model = 68040; + break; + } - if (p->cpu_model < 68020 && p->cachesize) { - p->cachesize = 0; - error_log(_T("JIT requires 68020 or better CPU.")); - } - - if (p->cpu_model >= 68040 && p->cachesize && p->cpu_compatible) + if (p->cpu_model >= 68020 && p->cachesize && p->cpu_compatible) p->cpu_compatible = false; - if (p->cpu_model >= 68040 && p->cpu_cycle_exact) { - p->cpu_cycle_exact = false; - error_log(_T("68040/060 cycle-exact is not supported.")); + if (p->cachesize && (p->fpu_no_unimplemented)) { + error_log (_T("JIT is not compatible with unimplemented FPU instruction emulation.")); + p->fpu_no_unimplemented = false; } - if ((p->cpu_model < 68030 || p->cachesize) && p->mmu_model) { - error_log(_T("MMU emulation requires 68030/040/060 and it is not JIT compatible.")); - p->mmu_model = 0; - } - - if (p->cachesize && p->cpu_cycle_exact) { - error_log(_T("JIT and cycle-exact can't be enabled simultaneously.")); - p->cachesize = 0; - } - if (p->cachesize && (p->fpu_no_unimplemented || p->int_no_unimplemented)) { - error_log(_T("JIT is not compatible with unimplemented CPU/FPU instruction emulation.")); - p->fpu_no_unimplemented = p->int_no_unimplemented = false; - } - - if (p->cpu_cycle_exact && p->m68k_speed < 0) - p->m68k_speed = 0; - - if (p->immediate_blits && p->blitter_cycle_exact) { - error_log(_T("Cycle-exact and immediate blitter can't be enabled simultaneously.\n")); - p->immediate_blits = false; - } if (p->immediate_blits && p->waiting_blits) { - error_log(_T("Immediate blitter and waiting blits can't be enabled simultaneously.\n")); + error_log (_T("Immediate blitter and waiting blits can't be enabled simultaneously.\n")); p->waiting_blits = 0; - } - if (p->cpu_cycle_exact) - p->cpu_compatible = true; + } } - -void fixup_prefs(struct uae_prefs *p, bool userconfig) +void fixup_prefs (struct uae_prefs *p, bool userconfig) { - int err = 0; + int err = 0; - built_in_chipset_prefs(p); - fixup_cpu(p); + built_in_chipset_prefs (p); + fixup_cpu(p); cfgfile_compatibility_rtg(p); cfgfile_compatibility_romtype(p); read_kickstart_version(p); - //if (p->cpuboard_type && p->cpuboardmem1_size > cpuboard_maxmemory(p)) { - // error_log(_T("Unsupported accelerator board memory size %d (0x%x).\n"), p->cpuboardmem1_size, p->cpuboardmem1_size); - // p->cpuboardmem1_size = cpuboard_maxmemory(p); - //} - //if (cpuboard_memorytype(p) == BOARD_MEMORY_HIGHMEM) { - // p->mbresmem_high_size = p->cpuboardmem1_size; - //} - //else if (cpuboard_memorytype(p) == BOARD_MEMORY_Z2) { - // p->fastmem[0].size = p->cpuboardmem1_size; - //} - //else if (cpuboard_memorytype(p) == BOARD_MEMORY_25BITMEM) { - // p->mem25bit_size = p->cpuboardmem1_size; - //} - - if (((p->chipmem_size & (p->chipmem_size - 1)) != 0 && p->chipmem_size != 0x180000) - || p->chipmem_size < 0x20000 - || p->chipmem_size > 0x800000) - { - error_log(_T("Unsupported chipmem size %d (0x%x)."), p->chipmem_size, p->chipmem_size); - p->chipmem_size = 0x200000; - err = 1; - } + if (((p->chipmem_size & (p->chipmem_size - 1)) != 0 && p->chipmem_size != 0x180000) + || p->chipmem_size < 0x20000 + || p->chipmem_size > 0x800000) + { + error_log (_T("Unsupported chipmem size %d (0x%x)."), p->chipmem_size, p->chipmem_size); + p->chipmem_size = 0x200000; + err = 1; + } for (int i = 0; i < MAX_RAM_BOARDS; i++) { - if ((p->fastmem[i].size & (p->fastmem[i].size - 1)) != 0 - || (p->fastmem[i].size != 0 && (p->fastmem[i].size < 0x10000 || p->fastmem[i].size > 0x800000))) - { - error_log(_T("Unsupported fastmem size %d (0x%x)."), p->fastmem[i].size, p->fastmem[i].size); - p->fastmem[i].size = 0; - err = 1; - } + if ((p->fastmem[i].size & (p->fastmem[i].size - 1)) != 0 + || (p->fastmem[i].size != 0 && (p->fastmem[i].size < 0x10000 || p->fastmem[i].size > 0x800000))) + { + error_log (_T("Unsupported fastmem size %d (0x%x)."), p->fastmem[i].size, p->fastmem[i].size); + p->fastmem[i].size = 0; + err = 1; + } + } + + for (int i = 0; i < MAX_RTG_BOARDS; i++) { + struct rtgboardconfig *rbc = &p->rtgboards[i]; + if (rbc->rtgmem_size > 0x1000000 && rbc->rtgmem_type == GFXBOARD_UAE_Z3) { + error_log (_T("Graphics card memory size %d (0x%x) larger than maximum reserved %d (0x%x)."), rbc->rtgmem_size, rbc->rtgmem_size, 0x1000000, 0x1000000); + rbc->rtgmem_size = 0x1000000; + err = 1; + } + + if ((rbc->rtgmem_size & (rbc->rtgmem_size - 1)) != 0 || (rbc->rtgmem_size != 0 && (rbc->rtgmem_size < 0x100000))) { + error_log (_T("Unsupported graphics card memory size %d (0x%x)."), rbc->rtgmem_size, rbc->rtgmem_size); + if (rbc->rtgmem_size > 0x1000000) + rbc->rtgmem_size = 0x1000000; + else + rbc->rtgmem_size = 0; + err = 1; + } + } + + for (int i = 0; i < MAX_RAM_BOARDS; i++) { + if ((p->z3fastmem[i].size & (p->z3fastmem[i].size - 1)) != 0 || (p->z3fastmem[i].size != 0 && p->z3fastmem[i].size < 0x100000)) + { + error_log (_T("Unsupported Zorro III fastmem size %d (0x%x)."), p->z3fastmem[i].size, p->z3fastmem[i].size); + p->z3fastmem[i].size = 0; + err = 1; + } + } + + p->z3autoconfig_start &= ~0xffff; + if (p->z3autoconfig_start != 0 && p->z3autoconfig_start < 0x1000000) + p->z3autoconfig_start = 0x1000000; + + if (p->address_space_24 && (p->z3fastmem[0].size != 0)) { + p->z3fastmem[0].size = 0; + error_log (_T("Can't use 32-bit memory when using a 24 bit address space.")); + } + + if (p->bogomem_size != 0 && p->bogomem_size != 0x80000 && p->bogomem_size != 0x100000 && p->bogomem_size != 0x180000 && p->bogomem_size != 0x1c0000) { + error_log (_T("Unsupported bogomem size %d (0x%x)"), p->bogomem_size, p->bogomem_size); + p->bogomem_size = 0; + err = 1; + } + + if (p->bogomem_size > 0x180000 && (p->cs_fatgaryrev >= 0 || p->cs_ide || p->cs_ramseyrev >= 0)) { + p->bogomem_size = 0x180000; + error_log (_T("Possible Gayle bogomem conflict fixed.")); + } + if (p->chipmem_size > 0x200000 && p->fastmem[0].size > 262144) { + error_log (_T("You can't use fastmem and more than 2MB chip at the same time.")); + p->chipmem_size = 0x200000; + err = 1; + } + if (p->mbresmem_low_size > 0x01000000 || (p->mbresmem_low_size & 0xfffff)) { + p->mbresmem_low_size = 0; + error_log (_T("Unsupported Mainboard RAM size")); + } + if (p->mbresmem_high_size > 0x02000000 || (p->mbresmem_high_size & 0xfffff)) { + p->mbresmem_high_size = 0; + error_log (_T("Unsupported CPU Board RAM size.")); } for (int i = 0; i < MAX_RTG_BOARDS; i++) { struct rtgboardconfig *rbc = &p->rtgboards[i]; - if (rbc->rtgmem_size > max_z3fastmem && rbc->rtgmem_type == GFXBOARD_UAE_Z3) { - error_log(_T("Graphics card memory size %d (0x%x) larger than maximum reserved %d (0x%x)."), rbc->rtgmem_size, rbc->rtgmem_size, max_z3fastmem, max_z3fastmem); - rbc->rtgmem_size = max_z3fastmem; - err = 1; - } - - if ((rbc->rtgmem_size & (rbc->rtgmem_size - 1)) != 0 || (rbc->rtgmem_size != 0 && (rbc->rtgmem_size < 0x100000))) { - error_log(_T("Unsupported graphics card memory size %d (0x%x)."), rbc->rtgmem_size, rbc->rtgmem_size); - if (rbc->rtgmem_size > max_z3fastmem) - rbc->rtgmem_size = max_z3fastmem; - else - rbc->rtgmem_size = 0; + if (p->chipmem_size > 0x200000 && rbc->rtgmem_size && gfxboard_get_configtype(rbc) == 2) { + error_log(_T("You can't use Zorro II RTG and more than 2MB chip at the same time.")); + p->chipmem_size = 0x200000; err = 1; } + if (p->address_space_24 && rbc->rtgmem_size && rbc->rtgmem_type == GFXBOARD_UAE_Z3) { + error_log (_T("Z3 RTG and 24bit address space are not compatible.")); + rbc->rtgmem_type = GFXBOARD_UAE_Z2; + rbc->rtgmem_size = 0; + } } - for (int i = 0; i < MAX_RAM_BOARDS; i++) { - if ((p->z3fastmem[i].size & (p->z3fastmem[i].size - 1)) != 0 || (p->z3fastmem[i].size != 0 && p->z3fastmem[i].size < 0x100000)) - { - error_log(_T("Unsupported Zorro III fastmem size %d (0x%x)."), p->z3fastmem[i].size, p->z3fastmem[i].size); - p->z3fastmem[i].size = 0; - err = 1; - } - } - - p->z3autoconfig_start &= ~0xffff; - if (p->z3autoconfig_start < 0x1000000) - p->z3autoconfig_start = 0x1000000; - - if (p->z3chipmem_size > max_z3fastmem) { - error_log(_T("Zorro III fake chipmem size %d (0x%x) larger than max reserved %d (0x%x)."), p->z3chipmem_size, p->z3chipmem_size, max_z3fastmem, max_z3fastmem); - p->z3chipmem_size = max_z3fastmem; - err = 1; - } - if (((p->z3chipmem_size & (p->z3chipmem_size - 1)) != 0 && p->z3chipmem_size != 0x18000000 && p->z3chipmem_size != 0x30000000) || (p->z3chipmem_size != 0 && p->z3chipmem_size < 0x100000)) - { - error_log(_T("Unsupported 32-bit chipmem size %d (0x%x)."), p->z3chipmem_size, p->z3chipmem_size); - p->z3chipmem_size = 0; - err = 1; - } - - if (p->address_space_24 && (p->z3fastmem[0].size != 0 || p->z3fastmem[1].size != 0 || p->z3fastmem[2].size != 0 || p->z3fastmem[3].size != 0 || p->z3chipmem_size != 0)) { - p->z3fastmem[0].size = p->z3fastmem[1].size = p->z3fastmem[2].size = p->z3fastmem[3].size = 0; - p->z3chipmem_size = 0; - error_log(_T("Can't use a Z3 graphics card or 32-bit memory when using a 24 bit address space.")); - } - - if (p->bogomem_size != 0 && p->bogomem_size != 0x80000 && p->bogomem_size != 0x100000 && p->bogomem_size != 0x180000 && p->bogomem_size != 0x1c0000) { - error_log(_T("Unsupported bogomem size %d (0x%x)"), p->bogomem_size, p->bogomem_size); - p->bogomem_size = 0; - err = 1; - } - - if (p->bogomem_size > 0x180000 && (p->cs_fatgaryrev >= 0 || p->cs_ide || p->cs_ramseyrev >= 0)) { - p->bogomem_size = 0x180000; - error_log(_T("Possible Gayle bogomem conflict fixed.")); - } - if (p->chipmem_size > 0x200000 && (p->fastmem[0].size > 262144 || p->fastmem[1].size > 262144)) { - error_log(_T("You can't use fastmem and more than 2MB chip at the same time.")); - p->chipmem_size = 0x200000; - err = 1; - } - if (p->mem25bit_size > 128 * 1024 * 1024 || (p->mem25bit_size & 0xfffff)) { - p->mem25bit_size = 0; - error_log(_T("Unsupported 25bit RAM size")); - } - if (p->mbresmem_low_size > 0x04000000 || (p->mbresmem_low_size & 0xfffff)) { - p->mbresmem_low_size = 0; - error_log(_T("Unsupported Mainboard RAM size")); - } - if (p->mbresmem_high_size > 0x08000000 || (p->mbresmem_high_size & 0xfffff)) { - p->mbresmem_high_size = 0; - error_log(_T("Unsupported CPU Board RAM size.")); - } - - //for (int i = 0; i < MAX_RTG_BOARDS; i++) { - // struct rtgboardconfig *rbc = &p->rtgboards[i]; - // if (p->chipmem_size > 0x200000 && rbc->rtgmem_size && gfxboard_get_configtype(rbc) == 2) { - // error_log(_T("You can't use Zorro II RTG and more than 2MB chip at the same time.")); - // p->chipmem_size = 0x200000; - // err = 1; - // } - // if (rbc->rtgmem_type >= GFXBOARD_HARDWARE) { - // if (gfxboard_get_vram_min(rbc) > 0 && rbc->rtgmem_size < gfxboard_get_vram_min(rbc)) { - // error_log(_T("Graphics card memory size %d (0x%x) smaller than minimum hardware supported %d (0x%x)."), - // rbc->rtgmem_size, rbc->rtgmem_size, gfxboard_get_vram_min(rbc), gfxboard_get_vram_min(rbc)); - // rbc->rtgmem_size = gfxboard_get_vram_min(rbc); - // } - // if (p->address_space_24 && gfxboard_get_configtype(rbc) == 3) { - // rbc->rtgmem_type = GFXBOARD_UAE_Z2; - // rbc->rtgmem_size = 0; - // error_log(_T("Z3 RTG and 24-bit address space are not compatible.")); - // } - // if (gfxboard_get_vram_max(rbc) > 0 && rbc->rtgmem_size > gfxboard_get_vram_max(rbc)) { - // error_log(_T("Graphics card memory size %d (0x%x) larger than maximum hardware supported %d (0x%x)."), - // rbc->rtgmem_size, rbc->rtgmem_size, gfxboard_get_vram_max(rbc), gfxboard_get_vram_max(rbc)); - // rbc->rtgmem_size = gfxboard_get_vram_max(rbc); - // } - // } - // if (p->address_space_24 && rbc->rtgmem_size && rbc->rtgmem_type == GFXBOARD_UAE_Z3) { - // error_log(_T("Z3 RTG and 24bit address space are not compatible.")); - // rbc->rtgmem_type = GFXBOARD_UAE_Z2; - // rbc->rtgmem_size = 0; - // } - //} - if (p->cs_z3autoconfig && p->address_space_24) { p->cs_z3autoconfig = false; - error_log(_T("Z3 autoconfig and 24bit address space are not compatible.")); + error_log (_T("Z3 autoconfig and 24bit address space are not compatible.")); } -#if 0 - if (p->m68k_speed < -1 || p->m68k_speed > 20) { - write_log(_T("Bad value for -w parameter: must be -1, 0, or within 1..20.\n")); - p->m68k_speed = 4; - err = 1; - } -#endif - - if (p->produce_sound < 0 || p->produce_sound > 3) { - error_log(_T("Bad value for -S parameter: enable value must be within 0..3.")); - p->produce_sound = 0; - err = 1; - } - if (p->comptrustbyte < 0 || p->comptrustbyte > 3) { - error_log(_T("Bad value for comptrustbyte parameter: value must be within 0..2.")); - p->comptrustbyte = 1; - err = 1; - } - if (p->comptrustword < 0 || p->comptrustword > 3) { - error_log(_T("Bad value for comptrustword parameter: value must be within 0..2.")); - p->comptrustword = 1; - err = 1; - } - if (p->comptrustlong < 0 || p->comptrustlong > 3) { - error_log(_T("Bad value for comptrustlong parameter: value must be within 0..2.")); - p->comptrustlong = 1; - err = 1; - } - if (p->comptrustnaddr < 0 || p->comptrustnaddr > 3) { - error_log(_T("Bad value for comptrustnaddr parameter: value must be within 0..2.")); - p->comptrustnaddr = 1; - err = 1; - } - if (p->cachesize < 0 || p->cachesize > 16384) { - error_log(_T("Bad value for cachesize parameter: value must be within 0..16384.")); - p->cachesize = 0; - err = 1; - } - if ((p->z3fastmem[0].size || p->z3fastmem[1].size || p->z3fastmem[2].size || p->z3fastmem[3].size || p->z3chipmem_size) && p->address_space_24) { - error_log(_T("Z3 fast memory can't be used if address space is 24-bit.")); - p->z3fastmem[0].size = 0; - p->z3fastmem[1].size = 0; - p->z3fastmem[2].size = 0; - p->z3fastmem[3].size = 0; - p->z3chipmem_size = 0; - err = 1; - } + if (p->produce_sound < 0 || p->produce_sound > 3) { + error_log (_T("Bad value for -S parameter: enable value must be within 0..3.")); + p->produce_sound = 0; + err = 1; + } + if (p->cachesize < 0 || p->cachesize > 16384) { + error_log (_T("Bad value for cachesize parameter: value must be within 0..16384.")); + p->cachesize = 0; + err = 1; + } + if ((p->z3fastmem[0].size) && p->address_space_24) { + error_log (_T("Z3 fast memory can't be used if address space is 24-bit.")); + p->z3fastmem[0].size = 0; + err = 1; + } for (int i = 0; i < MAX_RTG_BOARDS; i++) { if ((p->rtgboards[i].rtgmem_size > 0 && p->rtgboards[i].rtgmem_type == GFXBOARD_UAE_Z3) && p->address_space_24) { - error_log(_T("UAEGFX Z3 RTG can't be used if address space is 24-bit.")); + error_log (_T("UAEGFX Z3 RTG can't be used if address space is 24-bit.")); p->rtgboards[i].rtgmem_size = 0; - err = 1; + err = 1; } - } + } #if !defined (BSDSOCKET) if (p->socket_emu) { - write_log(_T("Compile-time option of BSDSOCKET_SUPPORTED was not enabled. You can't use bsd-socket emulation.\n")); + write_log (_T("Compile-time option of BSDSOCKET_SUPPORTED was not enabled. You can't use bsd-socket emulation.\n")); p->socket_emu = 0; err = 1; } #endif - if (p->socket_emu && p->uaeboard >= 3) { - write_log(_T("bsdsocket.library is not compatible with indirect UAE Boot ROM.\n")); - p->socket_emu = 0; - } - if (p->nr_floppies < 0 || p->nr_floppies > 4) { - error_log(_T("Invalid number of floppies. Using 2.")); + if (p->nr_floppies < 0 || p->nr_floppies > 4) { + error_log (_T("Invalid number of floppies. Using 2.")); p->nr_floppies = 2; - p->floppyslots[0].dfxtype = 0; - p->floppyslots[1].dfxtype = 0; + p->floppyslots[0].dfxtype = 0; + p->floppyslots[1].dfxtype = 0; p->floppyslots[2].dfxtype = -1; p->floppyslots[3].dfxtype = -1; - err = 1; - } - if (p->floppy_speed > 0 && p->floppy_speed < 10) { - error_log(_T("Invalid floppy speed.")); - p->floppy_speed = 100; - } - if (p->input_mouse_speed < 1 || p->input_mouse_speed > 1000) { - error_log(_T("Invalid mouse speed.")); - p->input_mouse_speed = 100; - } - if (p->collision_level < 0 || p->collision_level > 3) { - error_log(_T("Invalid collision support level. Using 1.")); - p->collision_level = 1; - err = 1; - } - if (p->parallel_postscript_emulation) - p->parallel_postscript_detection = 1; + err = 1; + } + + if (p->floppy_speed > 0 && p->floppy_speed < 10) { + error_log (_T("Invalid floppy speed.")); + p->floppy_speed = 100; + } + if (p->collision_level < 0 || p->collision_level > 3) { + error_log (_T("Invalid collision support level. Using 1.")); + p->collision_level = 1; + err = 1; + } if (p->cs_compatible == CP_GENERIC) { - p->cs_fatgaryrev = p->cs_ramseyrev = p->cs_mbdmac = -1; + p->cs_fatgaryrev = p->cs_ramseyrev = -1; p->cs_ide = 0; if (p->cpu_model >= 68020) { p->cs_fatgaryrev = 0; p->cs_ide = -1; p->cs_ramseyrev = 0x0f; - p->cs_mbdmac = 0; - } -} - else if (p->cs_compatible == 0) { + } + } else if (p->cs_compatible == 0) { if (p->cs_ide == IDE_A4000) { if (p->cs_fatgaryrev < 0) p->cs_fatgaryrev = 0; if (p->cs_ramseyrev < 0) p->cs_ramseyrev = 0x0f; - } - } - if (p->chipmem_size >= 0x100000) - p->cs_1mchipjumper = true; + } + } - /* Can't fit genlock and A2024 or Graffiti at the same time, - * also Graffiti uses genlock audio bit as an enable signal - */ - if (p->genlock && p->monitoremu) { - error_log(_T("Genlock and A2024 or Graffiti can't be active simultaneously.")); - p->genlock = false; - } - if (p->cs_hacks) { - error_log(_T("chipset_hacks is nonzero (0x%04x)."), p->cs_hacks); - } - - fixup_prefs_dimensions(p); + fixup_prefs_dimensions (p); #if !defined (JIT) p->cachesize = 0; @@ -571,78 +374,22 @@ void fixup_prefs(struct uae_prefs *p, bool userconfig) p->cpu_model = 68000; p->fpu_model = 0; #endif -#ifndef CPUEMU_0 - p->cpu_compatible = 1; - p->address_space_24 = 1; -#endif -#if !defined (CPUEMU_11) && !defined (CPUEMU_13) - p->cpu_compatible = 0; - p->address_space_24 = 0; -#endif -#if !defined (CPUEMU_13) - p->cpu_cycle_exact = p->blitter_cycle_exact = 0; -#endif #ifndef AGA p->chipset_mask &= ~CSMASK_AGA; #endif #ifndef AUTOCONFIG - p->z3fastmem_size = 0; - p->fastmem_size = 0; - p->rtgmem_size = 0; + p->z3fastmem[0].size = 0; + p->fastmem[0].size = 0; + p->rtgboards[0].rtgmem_size = 0; #endif #if !defined (BSDSOCKET) p->socket_emu = 0; #endif -#if !defined (SCSIEMU) - p->scsi = 0; -//#ifdef _WIN32 -// p->win32_aspi = 0; -//#endif -#endif -#if !defined (SANA2) - p->sana2 = 0; -#endif -#if !defined (UAESERIAL) - p->uaeserial = 0; -#endif -#if defined (CPUEMU_13) - if (p->cpu_memory_cycle_exact) { - if (p->gfx_framerate > 1) { - error_log(_T("Cycle-exact requires disabled frameskip.")); - p->gfx_framerate = 1; - } - if (p->cachesize) { - error_log(_T("Cycle-exact and JIT can't be active simultaneously.")); - p->cachesize = 0; - } -#if 0 - if (p->m68k_speed) { - error_log(_T("Adjustable CPU speed is not available in cycle-exact mode.")); - p->m68k_speed = 0; - } -#endif - } -#endif - if (p->gfx_framerate < 1) - p->gfx_framerate = 1; - if (p->maprom && !p->address_space_24) { - p->maprom = 0x0f000000; - } - if (((p->maprom & 0xff000000) && p->address_space_24) || (p->maprom && p->mbresmem_high_size >= 0x08000000)) { - p->maprom = 0x00e00000; - } - if (p->maprom && p->cpuboard_type) { - error_log(_T("UAE Maprom and accelerator board emulation are not compatible.")); - p->maprom = 0; - } - if (p->tod_hack && p->cs_ciaatod == 0) - p->cs_ciaatod = p->ntscmode ? 2 : 1; - - built_in_chipset_prefs(p); - blkdev_fix_prefs(p); - //inputdevice_fix_prefs(p, userconfig); - target_fixup_options(p); + built_in_chipset_prefs (p); + blkdev_fix_prefs (p); + inputdevice_fix_prefs(p, userconfig); + target_fixup_options (p); } int quit_program = 0; @@ -650,261 +397,224 @@ static int restart_program; static TCHAR restart_config[MAX_DPATH]; static int default_config; -void uae_reset(int hardreset, int keyboardreset) +void uae_reset (int hardreset, int keyboardreset) { - currprefs.quitstatefile[0] = changed_prefs.quitstatefile[0] = 0; - - if (quit_program == 0) { + if (quit_program == 0) { quit_program = -UAE_RESET; if (keyboardreset) quit_program = -UAE_RESET_KEYBOARD; - if (hardreset) + if (hardreset) quit_program = -UAE_RESET_HARD; - } + } } -void uae_quit() +void uae_quit (void) { - if (quit_program != -UAE_QUIT) { - quit_program = -UAE_QUIT; - } - target_quit(); + if (quit_program != -UAE_QUIT) { + quit_program = -UAE_QUIT; + } + target_quit (); } -void host_shutdown() +void host_shutdown(void) { system("sudo poweroff"); } /* 0 = normal, 1 = nogui, -1 = disable nogui */ -void uae_restart(int opengui, const TCHAR *cfgfile) +void uae_restart (int opengui, const TCHAR *cfgfile) { - uae_quit(); - restart_program = opengui > 0 ? 1 : (opengui == 0 ? 2 : 3); - restart_config[0] = 0; + uae_quit (); + restart_program = opengui > 0 ? 1 : (opengui == 0 ? 2 : 3); + restart_config[0] = 0; default_config = 0; - if (cfgfile) - _tcscpy(restart_config, cfgfile); - target_restart(); + if (cfgfile) + _tcscpy (restart_config, cfgfile); + target_restart (); } -void usage() +#ifndef DONT_PARSE_CMDLINE + +static void parse_cmdline_2 (int argc, TCHAR **argv) { + int i; + + cfgfile_addcfgparam (0); + for (i = 1; i < argc; i++) { + if (_tcsncmp (argv[i], _T("-cfgparam="), 10) == 0) { + cfgfile_addcfgparam (argv[i] + 10); + } else if (_tcscmp (argv[i], _T("-cfgparam")) == 0) { + if (i + 1 == argc) + write_log (_T("Missing argument for '-cfgparam' option.\n")); + else + cfgfile_addcfgparam (argv[++i]); + } + } } -static void parse_cmdline_2(int argc, TCHAR **argv) +static TCHAR *parsetext (const TCHAR *s) { - int i; - - cfgfile_addcfgparam(nullptr); - for (i = 1; i < argc; i++) { - if (_tcsncmp(argv[i], _T("-cfgparam="), 10) == 0) { - cfgfile_addcfgparam(argv[i] + 10); - } - else if (_tcscmp(argv[i], _T("-cfgparam")) == 0) { - if (i + 1 == argc) - write_log(_T("Missing argument for '-cfgparam' option.\n")); - else - cfgfile_addcfgparam(argv[++i]); - } - } + if (*s == '"' || *s == '\'') { + TCHAR *d; + TCHAR c = *s++; + int i; + d = my_strdup (s); + for (i = 0; i < _tcslen (d); i++) { + if (d[i] == c) { + d[i] = 0; + break; + } + } + return d; + } else { + return my_strdup (s); + } } - -static int diskswapper_cb(struct zfile *f, void *vrsd) +static TCHAR *parsetextpath (const TCHAR *s) { - int *num = static_cast(vrsd); - if (*num >= MAX_SPARE_DRIVES) - return 1; - if (zfile_gettype(f) == ZFILE_DISKIMAGE) { - _tcsncpy(currprefs.dfxlist[*num], zfile_getname(f), 255); - (*num)++; - } - return 0; -} - -static void parse_diskswapper(const TCHAR *s) -{ - TCHAR *tmp = my_strdup(s); - TCHAR *delim = _T(","); - TCHAR *p1, *p2; - int num = 0; - - p1 = tmp; - for (;;) { - p2 = strtok(p1, delim); - if (!p2) - break; - p1 = nullptr; - if (num >= MAX_SPARE_DRIVES) - break; - if (!zfile_zopen(p2, diskswapper_cb, &num)) { - _tcsncpy(currprefs.dfxlist[num], p2, 255); - num++; - } - } - free(tmp); -} - -static TCHAR *parsetext(const TCHAR *s) -{ - if (*s == '"' || *s == '\'') { - TCHAR *d; - TCHAR c = *s++; - int i; - d = my_strdup(s); - for (i = 0; i < _tcslen(d); i++) { - if (d[i] == c) { - d[i] = 0; - break; - } - } - return d; - } - else { - return my_strdup(s); - } -} -static TCHAR *parsetextpath(const TCHAR *s) -{ - TCHAR *s2 = parsetext(s); - TCHAR *s3 = target_expand_environment(s2); - xfree(s2); + TCHAR *s2 = parsetext (s); + TCHAR *s3 = target_expand_environment (s2, NULL, 0); + xfree (s2); return s3; } -static void parse_cmdline(int argc, TCHAR **argv) +void print_usage() { - int i; + printf("\nUsage:\n"); + printf(" -f Load a configuration file.\n"); + printf(" -config= Load a configuration file.\n"); + printf(" -statefile= Load a save state file.\n"); + printf(" -s = Set the configuration parameter with value.\n"); + printf(" Edit a configuration file in order to know valid parameters and settings.\n"); + printf("\nAdditional options:\n"); + printf(" -0 Set adf for drive 0.\n"); + printf(" -1 Set adf for drive 1.\n"); + printf(" -2 Set adf for drive 2.\n"); + printf(" -3 Set adf for drive 3.\n"); + printf(" -r Set kickstart rom file.\n"); + printf(" -G Start directly into emulation.\n"); + printf(" -c Size of chip memory (in number of 512 KBytes chunks).\n"); + printf(" -F Size of fast memory (in number of 1024 KBytes chunks).\n"); + printf("\nNote:\n"); + printf("Parameters are parsed from the beginning of command line, so in case of ambiguity for parameters, last one will be used.\n"); + printf("File names should be with absolute path.\n"); + printf("\nExample:\n"); + printf("amiberry -config=conf/A500.uae -statefile=savestates/game.uss -s use_gui=no\n"); + printf("It will load A500.uae configuration with the save state named game.\n"); + printf("It will override use_gui to 'no' so that it enters emulation directly.\n"); + exit(1); +} - for (i = 1; i < argc; i++) { - if (!_tcsncmp(argv[i], _T("-diskswapper="), 13)) { - TCHAR *txt = parsetextpath(argv[i] + 13); - parse_diskswapper(txt); - xfree(txt); - } - else if (_tcsncmp(argv[i], _T("-cfgparam="), 10) == 0) { - ; - } - else if (_tcscmp(argv[i], _T("-cfgparam")) == 0) { - if (i + 1 < argc) - i++; - } - else if (_tcsncmp(argv[i], _T("-config="), 8) == 0) { - TCHAR *txt = parsetextpath(argv[i] + 8); - currprefs.mountitems = 0; - target_cfgfile_load(&currprefs, txt, -1, 0); - xfree(txt); - } - else if (_tcsncmp(argv[i], _T("-statefile="), 11) == 0) { - TCHAR *txt = parsetextpath(argv[i] + 11); - savestate_state = STATE_DORESTORE; - _tcscpy(savestate_fname, txt); - xfree(txt); - } - else if (_tcscmp(argv[i], _T("-f")) == 0) { - /* Check for new-style "-f xxx" argument, where xxx is config-file */ - if (i + 1 == argc) { - write_log(_T("Missing argument for '-f' option.\n")); - } - else { - TCHAR *txt = parsetextpath(argv[++i]); - currprefs.mountitems = 0; - target_cfgfile_load(&currprefs, txt, -1, 0); - xfree(txt); - } - } - else if (_tcscmp(argv[i], _T("-s")) == 0) { - if (i + 1 == argc) - write_log(_T("Missing argument for '-s' option.\n")); - else - cfgfile_parse_line(&currprefs, argv[++i], 0); - } - else if (_tcscmp(argv[i], _T("-h")) == 0 || _tcscmp(argv[i], _T("-help")) == 0) { - usage(); - exit(0); - } - else if (_tcsncmp(argv[i], _T("-cdimage="), 9) == 0) { - TCHAR *txt = parsetextpath(argv[i] + 9); +static void parse_cmdline (int argc, TCHAR **argv) +{ + int i; + static bool started; + bool firstconfig = true; + bool loaded = false; + + // only parse command line when starting for the first time + if (started) + return; + started = true; + + for (i = 1; i < argc; i++) { + if (_tcscmp (argv[i], _T("-cfgparam")) == 0) { + if (i + 1 < argc) + i++; + } else if (_tcsncmp (argv[i], _T("-config="), 8) == 0) { + TCHAR *txt = parsetextpath (argv[i] + 8); + currprefs.mountitems = 0; + target_cfgfile_load (&currprefs, txt, firstconfig ? CONFIG_TYPE_ALL : CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST | CONFIG_TYPE_NORESET, 0); + xfree (txt); + firstconfig = false; + loaded = true; + } else if (_tcsncmp (argv[i], _T("-statefile="), 11) == 0) { + TCHAR *txt = parsetextpath (argv[i] + 11); + savestate_state = STATE_DORESTORE; + _tcscpy (savestate_fname, txt); + xfree (txt); + loaded = true; + } else if (_tcscmp (argv[i], _T("-f")) == 0) { + /* Check for new-style "-f xxx" argument, where xxx is config-file */ + if (i + 1 == argc) { + write_log (_T("Missing argument for '-f' option.\n")); + } else { + TCHAR *txt = parsetextpath (argv[++i]); + currprefs.mountitems = 0; + target_cfgfile_load (&currprefs, txt, firstconfig ? CONFIG_TYPE_ALL : CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST | CONFIG_TYPE_NORESET, 0); + xfree (txt); + firstconfig = false; + } + loaded = true; + } else if (_tcscmp (argv[i], _T("-s")) == 0) { + if (i + 1 == argc) + write_log (_T("Missing argument for '-s' option.\n")); + else + cfgfile_parse_line (&currprefs, argv[++i], 0); + } else if (_tcsncmp (argv[i], _T("-cdimage="), 9) == 0) { + TCHAR *txt = parsetextpath (argv[i] + 9); TCHAR *txt2 = xmalloc(TCHAR, _tcslen(txt) + 2); _tcscpy(txt2, txt); if (_tcsrchr(txt2, ',') != NULL) _tcscat(txt2, _T(",")); - cfgfile_parse_option(&currprefs, _T("cdimage0"), txt2, 0); + cfgfile_parse_option (&currprefs, _T("cdimage0"), txt2, 0); xfree(txt2); xfree(txt); - } - else { - if (argv[i][0] == '-' && argv[i][1] != '\0') { - const TCHAR *arg = argv[i] + 2; - int extra_arg = *arg == '\0'; - if (extra_arg) - arg = i + 1 < argc ? argv[i + 1] : 0; - if (parse_cmdline_option(&currprefs, argv[i][1], arg) && extra_arg) - i++; + loaded = true; + } else if (argv[i][0] == '-' && argv[i][1] != '\0') { + int ret; + const TCHAR *arg = argv[i] + 2; + int extra_arg = *arg == '\0'; + if (extra_arg) + arg = i + 1 < argc ? argv[i + 1] : 0; + ret = parse_cmdline_option (&currprefs, argv[i][1], arg); + if (ret == -1) + print_usage(); + if (ret && extra_arg) + i++; + } else if (i == argc - 1) { + // if last config entry is an orphan and nothing else was loaded: + // check if it is config file or statefile + if (!loaded) { + TCHAR *txt = parsetextpath(argv[i]); + struct zfile *z = zfile_fopen(txt, _T("rb"), ZFD_NORMAL); + if (z) { + int type = zfile_gettype(z); + zfile_fclose(z); + if (type == ZFILE_CONFIGURATION) { + currprefs.mountitems = 0; + target_cfgfile_load(&currprefs, txt, CONFIG_TYPE_ALL, 0); + } else if (type == ZFILE_STATEFILE) { + savestate_state = STATE_DORESTORE; + _tcscpy(savestate_fname, txt); + } + } + xfree(txt); } - } - } + else + { + printf("Unknown option %s\n", argv[i]); + print_usage(); + } + } + } } +#endif -static void parse_cmdline_and_init_file(int argc, TCHAR **argv) +static void parse_cmdline_and_init_file (int argc, TCHAR **argv) { - _tcscpy(optionsfile, _T("")); + _tcscpy (optionsfile, _T("")); - parse_cmdline_2(argc, argv); + parse_cmdline_2 (argc, argv); - _tcscat(optionsfile, restart_config); + _tcscat (optionsfile, restart_config); - if (!target_cfgfile_load(&currprefs, optionsfile, 0, default_config)) { - write_log(_T("failed to load config '%s'\n"), optionsfile); - } - fixup_prefs(&currprefs, false); + if (! target_cfgfile_load (&currprefs, optionsfile, CONFIG_TYPE_DEFAULT, default_config)) { + write_log (_T("failed to load config '%s'\n"), optionsfile); + } + fixup_prefs (&currprefs, false); - parse_cmdline(argc, argv); -} - -void reset_all_systems() -{ - init_eventtab(); - -#ifdef PICASSO96 - picasso_reset(); -#endif -#ifdef SCSIEMU - scsi_reset(); - scsidev_reset(); - scsidev_start_threads(); -#endif -#ifdef A2065 - a2065_reset(); -#endif -#ifdef SANA2 - netdev_reset(); - netdev_start_threads(); -#endif -#ifdef FILESYS - filesys_prepare_reset(); - filesys_reset(); -#endif - //TODO - //init_shm(); - memory_reset(); -#if defined (BSDSOCKET) - bsdlib_reset(); -#endif -#ifdef FILESYS - filesys_start_threads(); - hardfile_reset(); -#endif -#ifdef UAESERIAL - uaeserialdev_reset(); - uaeserialdev_start_threads(); -#endif -#if defined (PARALLEL_PORT) - initparallel(); -#endif - native2amiga_reset(); - //dongle_reset(); - //sampler_init(); + parse_cmdline (argc, argv); } /* Okay, this stuff looks strange, but it is here to encourage people who @@ -916,75 +626,18 @@ void reset_all_systems() * of start_program() and leave_program() if you need to do anything special. * Add #ifdefs around these as appropriate. */ -void do_start_program() +void do_start_program (void) { if (quit_program == -UAE_QUIT) - return; - - /* Do a reset on startup. Whether this is elegant is debatable. */ - inputdevice_updateconfig(&changed_prefs, &currprefs); - if (quit_program >= 0) - quit_program = UAE_RESET; -#ifdef WITH_LUA - uae_lua_loadall(); -#endif - m68k_go(1); + return; + /* Do a reset on startup. Whether this is elegant is debatable. */ + inputdevice_updateconfig (&changed_prefs, &currprefs); + if (quit_program >= 0) + quit_program = UAE_RESET; + m68k_go (1); } -void do_leave_program() -{ -#ifdef JIT - compiler_exit(); -#endif - //sampler_free (); - graphics_leave(); - inputdevice_close(); - DISK_free(); - close_sound(); - dump_counts(); -#ifdef SERIAL_PORT - serial_exit(); -#endif -#ifdef CDTV - cdtv_free(); -#endif -#ifdef A2091 - a2091_free(); - a3000scsi_free(); -#endif -#ifdef NCR - ncr_free(); -#endif - #ifdef CD32 - akiko_free(); -#endif - if (!no_gui) - gui_exit(); -#ifdef USE_SDL - SDL_Quit(); -#endif - hardfile_reset(); -#ifdef AUTOCONFIG - expansion_cleanup(); -#endif -#ifdef FILESYS - filesys_cleanup(); -#endif -#ifdef BSDSOCKET - bsdlib_reset(); -#endif - device_func_reset(); -#ifdef WITH_LUA - uae_lua_free(); -#endif - memory_cleanup(); - //TODO - //free_shm(); - cfgfile_addcfgparam(nullptr); - machdep_free(); -} - -void start_program() +void start_program (void) { #ifdef CAPSLOCK_DEBIAN_WORKAROUND char kbd_flags; @@ -992,56 +645,19 @@ void start_program() ioctl(0, KDGKBLED, &kbd_flags); if ((kbd_flags & 07) & LED_CAP) { - // record capslock pressed + // record capslock pressed inputdevice_do_keyboard(AK_CAPSLOCK, 1); } #endif - do_start_program(); + do_start_program (); } -void leave_program() +void leave_program (void) { - do_leave_program(); -} - -void virtualdevice_init() -{ -#ifdef AUTOCONFIG - rtarea_setup(); -#endif -#ifdef FILESYS - rtarea_init(); - uaeres_install(); - hardfile_install(); -#endif -#ifdef SCSIEMU - scsi_reset(); - scsidev_install(); -#endif -#ifdef SANA2 - netdev_install(); -#endif -#ifdef UAESERIAL - uaeserialdev_install(); -#endif -#ifdef AUTOCONFIG - expansion_init(); - emulib_install(); -#endif -#ifdef FILESYS - filesys_install(); -#endif -#if defined (BSDSOCKET) - bsdlib_install(); -#endif -#ifdef WITH_UAENATIVE - uaenative_install(); -#endif -#ifdef WITH_TABLETLIBRARY - tabletlib_install(); -#endif + do_leave_program (); } +#ifdef USE_SDL2 // In case of error, print the error code and close the application void check_error_sdl(bool check, const char* message) { if (check) { @@ -1051,10 +667,8 @@ void check_error_sdl(bool check, const char* message) { } } -static int real_main2 (int argc, TCHAR **argv) +static void initialize_sdl2() { - printf("Amiberry-SDL2 by Dimitris (MiDWaN) Panokostas\n"); - if (SDL_Init(SDL_INIT_EVERYTHING) != 0) { SDL_Log("SDL could not initialize! SDL_Error: %s\n", SDL_GetError()); @@ -1068,7 +682,7 @@ static int real_main2 (int argc, TCHAR **argv) 0, SDL_WINDOW_FULLSCREEN_DESKTOP); check_error_sdl(sdlWindow == nullptr, "Unable to create window"); - + renderer = SDL_CreateRenderer(sdlWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); check_error_sdl(renderer == nullptr, "Unable to create a renderer"); @@ -1076,12 +690,34 @@ static int real_main2 (int argc, TCHAR **argv) { SDL_Log("Could not get information about SDL Mode! SDL_Error: %s\n", SDL_GetError()); } - + if (SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1") != SDL_TRUE) SDL_Log("SDL could not grab the keyboard"); - - SDL_ShowCursor(SDL_DISABLE); + SDL_ShowCursor(SDL_DISABLE); +} +#endif + +static int real_main2 (int argc, TCHAR **argv) +{ +#ifdef USE_SDL1 + int ret; +#ifdef PANDORA + ret = SDL_Init(SDL_INIT_NOPARACHUTE | SDL_INIT_VIDEO); +#else + ret = SDL_Init(SDL_INIT_NOPARACHUTE | SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK); +#endif + if (ret < 0) + { + printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError()); + abort(); + }; +#endif + +#ifdef USE_SDL2 + initialize_sdl2(); +#endif + keyboard_settrans(); set_config_changed(); if (restart_config[0]) { default_prefs(&currprefs, true, 0); @@ -1106,7 +742,6 @@ static int real_main2 (int argc, TCHAR **argv) write_log(_T("Sound driver unavailable: Sound output disabled\n")); currprefs.produce_sound = 0; } - inputdevice_init(); changed_prefs = currprefs; @@ -1117,47 +752,41 @@ static int real_main2 (int argc, TCHAR **argv) no_gui = false; restart_program = 0; if (!no_gui) { - int err = gui_init(); + const int err = gui_init(); currprefs = changed_prefs; set_config_changed(); if (err == -1) { write_log(_T("Failed to initialize the GUI\n")); return -1; } - else if (err == -2) { + if (err == -2) { return 1; } } - + else + { + setCpuSpeed(); + update_display(&currprefs); + } memset(&gui_data, 0, sizeof gui_data); gui_data.cd = -1; gui_data.hd = -1; - gui_data.md = -1; -#ifdef NATMEM_OFFSET if (!init_shm()) { if (currprefs.start_gui) - uae_restart(-1, NULL); + uae_restart(-1, nullptr); return 0; -} -#endif -#ifdef WITH_LUA - uae_lua_init(); -#endif + } #ifdef PICASSO96 picasso_reset(); #endif fixup_prefs(&currprefs, true); -#ifdef RETROPLATFORM - rp_fixup_options(&currprefs); -#endif changed_prefs = currprefs; target_run(); - /* force sound settings change */ + /* force sound settings change */ currprefs.produce_sound = 0; - //savestate_init(); keybuf_init(); /* Must come after init_joystick */ memory_hardreset(2); @@ -1166,14 +795,9 @@ static int real_main2 (int argc, TCHAR **argv) #ifdef AUTOCONFIG native2amiga_install(); #endif + custom_init(); /* Must come after memory_init */ -#ifdef SERIAL_PORT - serial_init(); -#endif DISK_init(); -#ifdef WITH_PPC - uae_ppc_reset(true); -#endif reset_frame_rate_hack(); init_m68k(); /* must come after reset_frame_rate_hack (); */ @@ -1197,16 +821,14 @@ void real_main(int argc, TCHAR **argv) { restart_program = 1; - fetch_configurationpath(restart_config, sizeof(restart_config) / sizeof(TCHAR)); + fetch_configurationpath(restart_config, sizeof restart_config / sizeof(TCHAR)); _tcscat(restart_config, OPTIONSFILENAME); + _tcscat(restart_config, ".uae"); default_config = 1; while (restart_program) { - int ret; changed_prefs = currprefs; - ret = real_main2(argc, argv); - if (ret == 0 && quit_to_gui) - restart_program = 1; + real_main2(argc, argv); leave_program(); quit_program = 0; } @@ -1220,8 +842,3 @@ int main(int argc, TCHAR **argv) return 0; } #endif - -#ifdef SINGLEFILE -uae_u8 singlefile_config[50000] = { "_CONFIG_STARTS_HERE" }; -uae_u8 singlefile_data[1500000] = { "_DATA_STARTS_HERE" }; -#endif diff --git a/src/memory.cpp b/src/memory.cpp index 82c7f0ec..a019f50e 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -11,144 +11,113 @@ #include "options.h" #include "uae.h" -#include "include/memory.h" +#include "memory.h" #include "rommgr.h" -#include "ersatz.h" #include "zfile.h" #include "custom.h" #include "newcpu.h" #include "autoconf.h" #include "savestate.h" +#include "ar.h" #include "crc32.h" #include "gui.h" #include "akiko.h" +#include "threaddep/thread.h" +#include "gayle.h" #include "gfxboard.h" -#include "jit/compemu.h" +#include "audio.h" +#include "devices.h" -bool canbang; -static bool rom_write_enabled; #ifdef JIT /* Set by each memory handler that does not simply access real memory. */ int special_mem; #endif static int mem_hardreset; -static bool roms_modified; -#define FLASHEMU 0 - -static bool isdirectjit(void) -{ - return currprefs.cachesize && !currprefs.comptrustbyte; -} - -static bool canjit(void) -{ - if (currprefs.cpu_model < 68020 || currprefs.address_space_24) - return false; - return true; -} -static bool needmman(void) -{ - //if (!jit_direct_compatible_memory) - // return false; -//#ifdef _WIN32 -// return true; -//#endif - if (canjit()) - return true; - return false; -} - -static void nocanbang(void) -{ - if (canbang) { - write_log(_T("Switching JIT direct off!\n")); - } - canbang = 0; -} - -uae_u8 ce_banktype[65536]; -uae_u8 ce_cachable[65536]; - -static size_t bootrom_filepos, chip_filepos, bogo_filepos, a3000lmem_filepos, a3000hmem_filepos, mem25bit_filepos; +static size_t bootrom_filepos, chip_filepos, bogo_filepos, a3000lmem_filepos, a3000hmem_filepos; /* Set if we notice during initialization that settings changed, and we must clear all memory to prevent bogus contents from confusing the Kickstart. */ static bool need_hardreset; -static int bogomem_aliasing; /* The address space setting used during the last reset. */ static bool last_address_space_24; addrbank *mem_banks[MEMORY_BANKS]; -/* This has two functions. It either holds a host address that, when added -to the 68k address, gives the host address corresponding to that 68k -address (in which case the value in this array is even), OR it holds the -same value as mem_banks, for those banks that have baseaddr==0. In that -case, bit 0 is set (the memory access routines will take care of it). */ - -uae_u8 *baseaddr[MEMORY_BANKS]; - -#ifdef NO_INLINE_MEMORY_ACCESS -__inline__ uae_u32 longget(uaecptr addr) -{ - return call_mem_get_func(get_mem_bank(addr).lget, addr); -} -__inline__ uae_u32 wordget(uaecptr addr) -{ - return call_mem_get_func(get_mem_bank(addr).wget, addr); -} -__inline__ uae_u32 byteget(uaecptr addr) -{ - return call_mem_get_func(get_mem_bank(addr).bget, addr); -} -__inline__ void longput(uaecptr addr, uae_u32 l) -{ - call_mem_put_func(get_mem_bank(addr).lput, addr, l); -} -__inline__ void wordput(uaecptr addr, uae_u32 w) -{ - call_mem_put_func(get_mem_bank(addr).wput, addr, w); -} -__inline__ void byteput(uaecptr addr, uae_u32 b) -{ - call_mem_put_func(get_mem_bank(addr).bput, addr, b); -} -#endif - int addr_valid(const TCHAR *txt, uaecptr addr, uae_u32 len) { - addrbank *ab = &get_mem_bank(addr); - if (ab == 0 || !(ab->flags & (ABFLAG_RAM | ABFLAG_ROM)) || addr < 0x100 || len > 16777215 || !valid_address(addr, len)) { - write_log(_T("corrupt %s pointer %x (%d) detected!\n"), txt, addr, len); - return 0; - } - return 1; + addrbank *ab = &get_mem_bank(addr); + if (ab == 0 || !(ab->flags & (ABFLAG_RAM | ABFLAG_ROM)) || addr < 0x100 || len > 16777215 || !valid_address(addr, len)) { + write_log (_T("corrupt %s pointer %x (%d) detected!\n"), txt, addr, len); + return 0; + } + return 1; } -static int illegal_count; /* A dummy bank that only contains zeros */ -static uae_u32 REGPARAM3 dummy_lget(uaecptr) REGPARAM; -static uae_u32 REGPARAM3 dummy_wget(uaecptr) REGPARAM; -static uae_u32 REGPARAM3 dummy_bget(uaecptr) REGPARAM; -static void REGPARAM3 dummy_lput(uaecptr, uae_u32) REGPARAM; -static void REGPARAM3 dummy_wput(uaecptr, uae_u32) REGPARAM; -static void REGPARAM3 dummy_bput(uaecptr, uae_u32) REGPARAM; -static int REGPARAM3 dummy_check(uaecptr addr, uae_u32 size) REGPARAM; +static uae_u32 REGPARAM3 dummy_lget (uaecptr) REGPARAM; +static uae_u32 REGPARAM3 dummy_wget (uaecptr) REGPARAM; +static uae_u32 REGPARAM3 dummy_bget (uaecptr) REGPARAM; +static void REGPARAM3 dummy_lput (uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 dummy_wput (uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 dummy_bput (uaecptr, uae_u32) REGPARAM; +static int REGPARAM3 dummy_check (uaecptr addr, uae_u32 size) REGPARAM; + +/* fake UAE ROM */ + +extern addrbank fakeuaebootrom_bank; +MEMORY_FUNCTIONS(fakeuaebootrom); #define MAX_ILG 1000 #define NONEXISTINGDATA 0 //#define NONEXISTINGDATA 0xffffffff -void dummy_put(uaecptr addr, int size, uae_u32 val) +static bool map_uae_boot_rom_direct(void) { - + if (!fakeuaebootrom_bank.allocated_size) { + fakeuaebootrom_bank.start = 0xf00000; + fakeuaebootrom_bank.reserved_size = 65536; + fakeuaebootrom_bank.mask = fakeuaebootrom_bank.reserved_size - 1; + if (!mapped_malloc (&fakeuaebootrom_bank)) + return false; + // create jump table to real uae boot rom + for (int i = 0xff00; i < 0xfff8; i += 8) { + uae_u8 *p = fakeuaebootrom_bank.baseaddr + i; + p[0] = 0x4e; + p[1] = 0xf9; + uaecptr p2 = rtarea_base + i; + p[2] = p2 >> 24; + p[3] = p2 >> 16; + p[4] = p2 >> 8; + p[5] = p2 >> 0; + } + } + map_banks(&fakeuaebootrom_bank, 0xf0, 1, 1); + write_log(_T("Mapped fake UAE Boot ROM jump table.\n")); + return true; } -uae_u32 dummy_get(uaecptr addr, int size, bool inst, uae_u32 defvalue) +static bool gary_nonrange(uaecptr addr) +{ + if (currprefs.cs_fatgaryrev < 0) + return false; + if (addr < 0xb80000) + return false; + if (addr >= 0xd00000 && addr < 0xdc0000) + return true; + if (addr >= 0xdd0000 && addr < 0xde0000) + return true; + if (addr >= 0xdf8000 && addr < 0xe00000) + return false; + if (addr >= 0xe80000 && addr < 0xf80000) + return false; + return true; +} + +uae_u32 dummy_get_safe(uaecptr addr, int size, bool inst, uae_u32 defvalue) { uae_u32 v = defvalue; uae_u32 mask = size == 4 ? 0xffffffff : (1 << (size * 8)) - 1; @@ -164,100 +133,74 @@ uae_u32 dummy_get(uaecptr addr, int size, bool inst, uae_u32 defvalue) if (currprefs.cs_cd32cd) return 0; if ((currprefs.cpu_model <= 68010) || (currprefs.cpu_model == 68020 && (currprefs.chipset_mask & CSMASK_AGA) && currprefs.address_space_24)) { - if (size == 4) { + if (size == 4) { v = regs.db & 0xffff; if (addr & 1) v = (v << 8) | (v >> 8); v = (v << 16) | v; - } - else if (size == 2) { + } else if (size == 2) { v = regs.db & 0xffff; if (addr & 1) v = (v << 8) | (v >> 8); - } - else { + } else { v = regs.db; - v = (addr & 1) ? (v & 0xff) : ((v >> 8) & 0xff); + v = (addr & 1) ? (v & 0xff) : ((v >> 8) & 0xff); } } return v & mask; } +uae_u32 dummy_get (uaecptr addr, int size, bool inst, uae_u32 defvalue) +{ + uae_u32 v = defvalue; + + if (gary_nonrange(addr) || (size > 1 && gary_nonrange(addr + size - 1))) { + if (gary_toenb) + exception2 (addr, false, size, (regs.s ? 4 : 0) | (inst ? 0 : 1)); + return v; + } + + return dummy_get_safe(addr, size, inst, defvalue); +} + static uae_u32 REGPARAM2 dummy_lget (uaecptr addr) { -#ifdef JIT - special_mem |= S_READ; -#endif - return dummy_get(addr, 4, false, NONEXISTINGDATA); + return dummy_get (addr, 4, false, NONEXISTINGDATA); } uae_u32 REGPARAM2 dummy_lgeti (uaecptr addr) { -#ifdef JIT - special_mem |= S_READ; -#endif - return dummy_get(addr, 4, true, NONEXISTINGDATA); + return dummy_get (addr, 4, true, NONEXISTINGDATA); } static uae_u32 REGPARAM2 dummy_wget (uaecptr addr) { -#ifdef JIT - special_mem |= S_READ; -#endif - return dummy_get(addr, 2, false, NONEXISTINGDATA); + return dummy_get (addr, 2, false, NONEXISTINGDATA); } uae_u32 REGPARAM2 dummy_wgeti (uaecptr addr) { -#ifdef JIT - special_mem |= S_READ; -#endif - return dummy_get(addr, 2, true, NONEXISTINGDATA); + return dummy_get (addr, 2, true, NONEXISTINGDATA); } static uae_u32 REGPARAM2 dummy_bget (uaecptr addr) { -#ifdef JIT - special_mem |= S_READ; -#endif - return dummy_get(addr, 1, false, NONEXISTINGDATA); + return dummy_get (addr, 1, false, NONEXISTINGDATA); } static void REGPARAM2 dummy_lput (uaecptr addr, uae_u32 l) { -#ifdef JIT - special_mem |= S_WRITE; -#endif } - static void REGPARAM2 dummy_wput (uaecptr addr, uae_u32 w) { -#ifdef JIT - special_mem |= S_WRITE; -#endif } - static void REGPARAM2 dummy_bput (uaecptr addr, uae_u32 b) { -#ifdef JIT - special_mem |= S_WRITE; -#endif } static int REGPARAM2 dummy_check (uaecptr addr, uae_u32 size) { -#ifdef JIT - special_mem |= S_READ; -#endif return 0; } -static void REGPARAM2 none_put(uaecptr addr, uae_u32 v) -{ -} -static uae_u32 REGPARAM2 ones_get(uaecptr addr) -{ - return 0xffffffff; -} - addrbank *get_sub_bank(uaecptr *paddr) { int i; @@ -280,7 +223,7 @@ addrbank *get_sub_bank(uaecptr *paddr) *paddr = addr - sb[i - 1].suboffset; return sb[i - 1].bank; } -uae_u32 REGPARAM3 sub_bank_lget(uaecptr addr) REGPARAM +uae_u32 REGPARAM3 sub_bank_lget (uaecptr addr) REGPARAM { addrbank *ab = get_sub_bank(&addr); return ab->lget(addr); @@ -331,358 +274,102 @@ uae_u8 *REGPARAM3 sub_bank_xlate(uaecptr addr) REGPARAM return ab->xlateaddr(addr); } + /* Chip memory */ -static uae_u32 chipmem_full_mask; -static uae_u32 chipmem_full_size; +uae_u32 chipmem_full_mask; -static int REGPARAM3 chipmem_check(uaecptr addr, uae_u32 size) REGPARAM; -static uae_u8 *REGPARAM3 chipmem_xlate(uaecptr addr) REGPARAM; +static int REGPARAM3 chipmem_check (uaecptr addr, uae_u32 size) REGPARAM; +static uae_u8 *REGPARAM3 chipmem_xlate (uaecptr addr) REGPARAM; -#ifdef AGA - -/* AGA ce-chipram access */ - -static void ce2_timeout(void) +static uae_u32 REGPARAM2 chipmem_lget (uaecptr addr) { -#ifdef CPUEMU_13 - wait_cpu_cycle_read(0, -1); -#endif + uae_u32 *m; + + addr &= chipmem_bank.mask; + m = (uae_u32 *)(chipmem_bank.baseaddr + addr); + return do_get_mem_long (m); } -static uae_u32 REGPARAM2 chipmem_lget_ce2(uaecptr addr) +static uae_u32 REGPARAM2 chipmem_wget (uaecptr addr) { - uae_u32 *m; + uae_u16 *m, v; - addr &= chipmem_bank.mask; - m = (uae_u32 *)(chipmem_bank.baseaddr + addr); - ce2_timeout(); - return do_get_mem_long(m); + addr &= chipmem_bank.mask; + m = (uae_u16 *)(chipmem_bank.baseaddr + addr); + v = do_get_mem_word (m); + return v; } -static uae_u32 REGPARAM2 chipmem_wget_ce2(uaecptr addr) -{ - uae_u16 *m, v; - - addr &= chipmem_bank.mask; - m = (uae_u16 *)(chipmem_bank.baseaddr + addr); - ce2_timeout(); - v = do_get_mem_word(m); - return v; -} - -static uae_u32 REGPARAM2 chipmem_bget_ce2(uaecptr addr) -{ - addr &= chipmem_bank.mask; - ce2_timeout(); - return chipmem_bank.baseaddr[addr]; -} - -static void REGPARAM2 chipmem_lput_ce2(uaecptr addr, uae_u32 l) -{ - uae_u32 *m; - - addr &= chipmem_bank.mask; - m = (uae_u32 *)(chipmem_bank.baseaddr + addr); - ce2_timeout(); - do_put_mem_long(m, l); -} - -static void REGPARAM2 chipmem_wput_ce2(uaecptr addr, uae_u32 w) -{ - uae_u16 *m; - - addr &= chipmem_bank.mask; - m = (uae_u16 *)(chipmem_bank.baseaddr + addr); - ce2_timeout(); - do_put_mem_word(m, w); -} - -static void REGPARAM2 chipmem_bput_ce2(uaecptr addr, uae_u32 b) -{ - addr &= chipmem_bank.mask; - ce2_timeout(); - chipmem_bank.baseaddr[addr] = b; -} - -#endif - -static uae_u32 REGPARAM2 chipmem_lget(uaecptr addr) -{ - uae_u32 *m; - - addr &= chipmem_bank.mask; - m = (uae_u32 *)(chipmem_bank.baseaddr + addr); - return do_get_mem_long(m); -} - -static uae_u32 REGPARAM2 chipmem_wget(uaecptr addr) -{ - uae_u16 *m, v; - - addr &= chipmem_bank.mask; - m = (uae_u16 *)(chipmem_bank.baseaddr + addr); - v = do_get_mem_word(m); - return v; -} - -static uae_u32 REGPARAM2 chipmem_bget(uaecptr addr) +static uae_u32 REGPARAM2 chipmem_bget (uaecptr addr) { uae_u8 v; - addr &= chipmem_bank.mask; + addr &= chipmem_bank.mask; v = chipmem_bank.baseaddr[addr]; return v; } -void REGPARAM2 chipmem_lput(uaecptr addr, uae_u32 l) +void REGPARAM2 chipmem_lput (uaecptr addr, uae_u32 l) { - uae_u32 *m; + uae_u32 *m; - addr &= chipmem_bank.mask; - m = (uae_u32 *)(chipmem_bank.baseaddr + addr); - do_put_mem_long(m, l); + addr &= chipmem_bank.mask; + m = (uae_u32 *)(chipmem_bank.baseaddr + addr); + do_put_mem_long(m, l); } -void REGPARAM2 chipmem_wput(uaecptr addr, uae_u32 w) +void REGPARAM2 chipmem_wput (uaecptr addr, uae_u32 w) { - uae_u16 *m; + uae_u16 *m; - addr &= chipmem_bank.mask; - m = (uae_u16 *)(chipmem_bank.baseaddr + addr); - do_put_mem_word(m, w); + addr &= chipmem_bank.mask; + m = (uae_u16 *)(chipmem_bank.baseaddr + addr); + do_put_mem_word (m, w); } -void REGPARAM2 chipmem_bput(uaecptr addr, uae_u32 b) +void REGPARAM2 chipmem_bput (uaecptr addr, uae_u32 b) { - addr &= chipmem_bank.mask; + addr &= chipmem_bank.mask; chipmem_bank.baseaddr[addr] = b; } -/* cpu chipmem access inside agnus addressable ram but no ram available */ -static uae_u32 chipmem_dummy(void) +void REGPARAM2 chipmem_agnus_wput (uaecptr addr, uae_u32 w) { - /* not really right but something random that has more ones than zeros.. */ - return 0xffff & ~((1 << (uaerand() & 31)) | (1 << (uaerand() & 31))); + uae_u16 *m; + + addr &= chipmem_full_mask; + m = (uae_u16 *)(chipmem_bank.baseaddr + addr); + do_put_mem_word (m, w); } -static void REGPARAM2 chipmem_dummy_bput(uaecptr addr, uae_u32 b) -{ -} -static void REGPARAM2 chipmem_dummy_wput(uaecptr addr, uae_u32 b) -{ -} -static void REGPARAM2 chipmem_dummy_lput(uaecptr addr, uae_u32 b) +static int REGPARAM2 chipmem_check (uaecptr addr, uae_u32 size) { + addr &= chipmem_bank.mask; + return (addr + size) <= chipmem_bank.allocated_size; } -static uae_u32 REGPARAM2 chipmem_dummy_bget(uaecptr addr) -{ - return chipmem_dummy(); -} -static uae_u32 REGPARAM2 chipmem_dummy_wget(uaecptr addr) -{ - return chipmem_dummy(); -} -static uae_u32 REGPARAM2 chipmem_dummy_lget(uaecptr addr) -{ - return (chipmem_dummy() << 16) | chipmem_dummy(); -} - -static uae_u32 REGPARAM2 chipmem_agnus_lget(uaecptr addr) -{ - uae_u32 *m; - - addr &= chipmem_full_mask; - if (addr >= chipmem_full_size - 3) - return 0; - m = (uae_u32 *)(chipmem_bank.baseaddr + addr); - return do_get_mem_long(m); -} - -uae_u32 REGPARAM2 chipmem_agnus_wget(uaecptr addr) -{ - uae_u16 *m; - - addr &= chipmem_full_mask; - if (addr >= chipmem_full_size - 1) - return 0; - m = (uae_u16 *)(chipmem_bank.baseaddr + addr); - return do_get_mem_word(m); -} - -static uae_u32 REGPARAM2 chipmem_agnus_bget(uaecptr addr) -{ - addr &= chipmem_full_mask; - if (addr >= chipmem_full_size) - return 0; - return chipmem_bank.baseaddr[addr]; -} - -static void REGPARAM2 chipmem_agnus_lput(uaecptr addr, uae_u32 l) -{ - uae_u32 *m; - - addr &= chipmem_full_mask; - if (addr >= chipmem_full_size - 3) - return; - m = (uae_u32 *)(chipmem_bank.baseaddr + addr); - do_put_mem_long(m, l); -} - -void REGPARAM2 chipmem_agnus_wput(uaecptr addr, uae_u32 w) -{ - uae_u16 *m; - - addr &= chipmem_full_mask; - if (addr >= chipmem_full_size - 1) - return; - m = (uae_u16 *)(chipmem_bank.baseaddr + addr); - do_put_mem_word(m, w); -} - -static void REGPARAM2 chipmem_agnus_bput(uaecptr addr, uae_u32 b) -{ - addr &= chipmem_full_mask; - if (addr >= chipmem_full_size) - return; - chipmem_bank.baseaddr[addr] = b; -} - -static int REGPARAM2 chipmem_check(uaecptr addr, uae_u32 size) +static uae_u8 *REGPARAM2 chipmem_xlate (uaecptr addr) { addr &= chipmem_bank.mask; - return (addr + size) <= chipmem_full_size; -} - -static uae_u8 *REGPARAM2 chipmem_xlate(uaecptr addr) -{ - addr &= chipmem_bank.mask; - return chipmem_bank.baseaddr + addr; -} - -STATIC_INLINE void REGPARAM2 chipmem_lput_bigmem(uaecptr addr, uae_u32 v) -{ - put_long(addr, v); -} -STATIC_INLINE void REGPARAM2 chipmem_wput_bigmem(uaecptr addr, uae_u32 v) -{ - put_word(addr, v); -} -STATIC_INLINE void REGPARAM2 chipmem_bput_bigmem(uaecptr addr, uae_u32 v) -{ - put_byte(addr, v); -} -STATIC_INLINE uae_u32 REGPARAM2 chipmem_lget_bigmem(uaecptr addr) -{ - return get_long(addr); -} -STATIC_INLINE uae_u32 REGPARAM2 chipmem_wget_bigmem(uaecptr addr) -{ - return get_word(addr); -} -STATIC_INLINE uae_u32 REGPARAM2 chipmem_bget_bigmem(uaecptr addr) -{ - return get_byte(addr); -} -STATIC_INLINE int REGPARAM2 chipmem_check_bigmem(uaecptr addr, uae_u32 size) -{ - return valid_address(addr, size); -} -STATIC_INLINE uae_u8* REGPARAM2 chipmem_xlate_bigmem(uaecptr addr) -{ - return get_real_address(addr); -} - -uae_u32(REGPARAM2 *chipmem_lget_indirect)(uaecptr); -uae_u32(REGPARAM2 *chipmem_wget_indirect)(uaecptr); -uae_u32(REGPARAM2 *chipmem_bget_indirect)(uaecptr); -void (REGPARAM2 *chipmem_lput_indirect)(uaecptr, uae_u32); -void (REGPARAM2 *chipmem_wput_indirect)(uaecptr, uae_u32); -void (REGPARAM2 *chipmem_bput_indirect)(uaecptr, uae_u32); -int (REGPARAM2 *chipmem_check_indirect)(uaecptr, uae_u32); -uae_u8 *(REGPARAM2 *chipmem_xlate_indirect)(uaecptr); - -static void chipmem_setindirect(void) -{ - if (currprefs.z3chipmem_size) { - chipmem_lget_indirect = chipmem_lget_bigmem; - chipmem_wget_indirect = chipmem_wget_bigmem; - chipmem_bget_indirect = chipmem_bget_bigmem; - chipmem_lput_indirect = chipmem_lput_bigmem; - chipmem_wput_indirect = chipmem_wput_bigmem; - chipmem_bput_indirect = chipmem_bput_bigmem; - chipmem_check_indirect = chipmem_check_bigmem; - chipmem_xlate_indirect = chipmem_xlate_bigmem; - } - else { - chipmem_lget_indirect = chipmem_lget; - chipmem_wget_indirect = chipmem_agnus_wget; - chipmem_bget_indirect = chipmem_agnus_bget; - chipmem_lput_indirect = chipmem_lput; - chipmem_wput_indirect = chipmem_agnus_wput; - chipmem_bput_indirect = chipmem_agnus_bput; - chipmem_check_indirect = chipmem_check; - chipmem_xlate_indirect = chipmem_xlate; - } + return chipmem_bank.baseaddr + addr; } /* Slow memory */ MEMORY_FUNCTIONS(bogomem); -/* CDTV expension memory card memory */ - -MEMORY_FUNCTIONS(cardmem); - /* A3000 motherboard fast memory */ MEMORY_FUNCTIONS(a3000lmem); MEMORY_FUNCTIONS(a3000hmem); -/* 25bit memory (0x01000000) */ - -MEMORY_FUNCTIONS(mem25bit); - /* Kick memory */ uae_u16 kickstart_version; -/* -* A1000 kickstart RAM handling -* -* RESET instruction unhides boot ROM and disables write protection -* write access to boot ROM hides boot ROM and enables write protection -* -*/ -static int a1000_kickstart_mode; -static uae_u8 *a1000_bootrom; -static void a1000_handle_kickstart(int mode) -{ - if (!a1000_bootrom) - return; - protect_roms(false); - if (mode == 0) { - a1000_kickstart_mode = 0; - memcpy(kickmem_bank.baseaddr, kickmem_bank.baseaddr + ROM_SIZE_256, ROM_SIZE_256); - kickstart_version = (kickmem_bank.baseaddr[ROM_SIZE_256 + 12] << 8) | kickmem_bank.baseaddr[ROM_SIZE_256 + 13]; - } - else { - a1000_kickstart_mode = 1; - memcpy(kickmem_bank.baseaddr, a1000_bootrom, ROM_SIZE_256); - kickstart_version = 0; - } - if (kickstart_version == 0xffff) - kickstart_version = 0; -} - -void a1000_reset(void) -{ - a1000_handle_kickstart(1); -} - -static void REGPARAM3 kickmem_lput(uaecptr, uae_u32) REGPARAM; -static void REGPARAM3 kickmem_wput(uaecptr, uae_u32) REGPARAM; -static void REGPARAM3 kickmem_bput(uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 kickmem_lput (uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 kickmem_wput (uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 kickmem_bput (uaecptr, uae_u32) REGPARAM; MEMORY_BGET(kickmem); MEMORY_WGET(kickmem); @@ -690,98 +377,16 @@ MEMORY_LGET(kickmem); MEMORY_CHECK(kickmem); MEMORY_XLATE(kickmem); -static void REGPARAM2 kickmem_lput(uaecptr addr, uae_u32 b) +static void REGPARAM2 kickmem_lput (uaecptr addr, uae_u32 b) { - uae_u32 *m; - if (currprefs.rom_readwrite && rom_write_enabled) { - addr &= kickmem_bank.mask; - m = (uae_u32 *)(kickmem_bank.baseaddr + addr); - do_put_mem_long(m, b); -#if 0 - if (addr == ROM_SIZE_512 - 4) { - rom_write_enabled = false; - write_log(_T("ROM write disabled\n")); - } -#endif - } - else if (a1000_kickstart_mode) { - if (addr >= 0xfc0000) { - addr &= kickmem_bank.mask; - m = (uae_u32 *)(kickmem_bank.baseaddr + addr); - do_put_mem_long(m, b); - return; - } - else - a1000_handle_kickstart(0); - } - else if (currprefs.illegal_mem) { - write_log(_T("Illegal kickmem lput at %08x\n"), addr); - } } -static void REGPARAM2 kickmem_wput(uaecptr addr, uae_u32 b) +static void REGPARAM2 kickmem_wput (uaecptr addr, uae_u32 b) { - uae_u16 *m; - if (currprefs.rom_readwrite && rom_write_enabled) { - addr &= kickmem_bank.mask; - m = (uae_u16 *)(kickmem_bank.baseaddr + addr); - do_put_mem_word(m, b); - } - else if (a1000_kickstart_mode) { - if (addr >= 0xfc0000) { - addr &= kickmem_bank.mask; - m = (uae_u16 *)(kickmem_bank.baseaddr + addr); - do_put_mem_word(m, b); - return; - } - else - a1000_handle_kickstart(0); - } - else if (currprefs.illegal_mem) { - write_log(_T("Illegal kickmem wput at %08x\n"), addr); - } } -static void REGPARAM2 kickmem_bput(uaecptr addr, uae_u32 b) +static void REGPARAM2 kickmem_bput (uaecptr addr, uae_u32 b) { - if (currprefs.rom_readwrite && rom_write_enabled) { - addr &= kickmem_bank.mask; - kickmem_bank.baseaddr[addr] = b; - } - else if (a1000_kickstart_mode) { - if (addr >= 0xfc0000) { - addr &= kickmem_bank.mask; - kickmem_bank.baseaddr[addr] = b; - return; - } - else - a1000_handle_kickstart(0); - } - else if (currprefs.illegal_mem) { - write_log(_T("Illegal kickmem bput at %08x\n"), addr); - } -} - -static void REGPARAM2 kickmem2_lput(uaecptr addr, uae_u32 l) -{ - uae_u32 *m; - addr &= kickmem_bank.mask; - m = (uae_u32 *)(kickmem_bank.baseaddr + addr); - do_put_mem_long(m, l); -} - -static void REGPARAM2 kickmem2_wput(uaecptr addr, uae_u32 w) -{ - uae_u16 *m; - addr &= kickmem_bank.mask; - m = (uae_u16 *)(kickmem_bank.baseaddr + addr); - do_put_mem_word(m, w); -} - -static void REGPARAM2 kickmem2_bput(uaecptr addr, uae_u32 b) -{ - addr &= kickmem_bank.mask; - kickmem_bank.baseaddr[addr] = b; } /* CD32/CDTV extended kick memory */ @@ -791,12 +396,10 @@ static int extendedkickmem_type; #define EXTENDED_ROM_CD32 1 #define EXTENDED_ROM_CDTV 2 #define EXTENDED_ROM_KS 3 -#define EXTENDED_ROM_ARCADIA 4 -#define EXTENDED_ROM_ALG 5 -static void REGPARAM3 extendedkickmem_lput(uaecptr, uae_u32) REGPARAM; -static void REGPARAM3 extendedkickmem_wput(uaecptr, uae_u32) REGPARAM; -static void REGPARAM3 extendedkickmem_bput(uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 extendedkickmem_lput (uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 extendedkickmem_wput (uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 extendedkickmem_bput (uaecptr, uae_u32) REGPARAM; MEMORY_BGET(extendedkickmem); MEMORY_WGET(extendedkickmem); @@ -804,26 +407,20 @@ MEMORY_LGET(extendedkickmem); MEMORY_CHECK(extendedkickmem); MEMORY_XLATE(extendedkickmem); -static void REGPARAM2 extendedkickmem_lput(uaecptr addr, uae_u32 b) +static void REGPARAM2 extendedkickmem_lput (uaecptr addr, uae_u32 b) { - if (currprefs.illegal_mem) - write_log(_T("Illegal extendedkickmem lput at %08x\n"), addr); } -static void REGPARAM2 extendedkickmem_wput(uaecptr addr, uae_u32 b) +static void REGPARAM2 extendedkickmem_wput (uaecptr addr, uae_u32 b) { - if (currprefs.illegal_mem) - write_log(_T("Illegal extendedkickmem wput at %08x\n"), addr); } -static void REGPARAM2 extendedkickmem_bput(uaecptr addr, uae_u32 b) +static void REGPARAM2 extendedkickmem_bput (uaecptr addr, uae_u32 b) { - if (currprefs.illegal_mem) - write_log(_T("Illegal extendedkickmem lput at %08x\n"), addr); } -static void REGPARAM3 extendedkickmem2_lput(uaecptr, uae_u32) REGPARAM; -static void REGPARAM3 extendedkickmem2_wput(uaecptr, uae_u32) REGPARAM; -static void REGPARAM3 extendedkickmem2_bput(uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 extendedkickmem2_lput (uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 extendedkickmem2_wput (uaecptr, uae_u32) REGPARAM; +static void REGPARAM3 extendedkickmem2_bput (uaecptr, uae_u32) REGPARAM; MEMORY_BGET(extendedkickmem2); MEMORY_WGET(extendedkickmem2); @@ -831,136 +428,77 @@ MEMORY_LGET(extendedkickmem2); MEMORY_CHECK(extendedkickmem2); MEMORY_XLATE(extendedkickmem2); -static void REGPARAM2 extendedkickmem2_lput(uaecptr addr, uae_u32 b) +static void REGPARAM2 extendedkickmem2_lput (uaecptr addr, uae_u32 b) { - if (currprefs.illegal_mem) - write_log(_T("Illegal extendedkickmem2 lput at %08x\n"), addr); } -static void REGPARAM2 extendedkickmem2_wput(uaecptr addr, uae_u32 b) +static void REGPARAM2 extendedkickmem2_wput (uaecptr addr, uae_u32 b) { - if (currprefs.illegal_mem) - write_log(_T("Illegal extendedkickmem2 wput at %08x\n"), addr); } -static void REGPARAM2 extendedkickmem2_bput(uaecptr addr, uae_u32 b) +static void REGPARAM2 extendedkickmem2_bput (uaecptr addr, uae_u32 b) { - if (currprefs.illegal_mem) - write_log(_T("Illegal extendedkickmem2 lput at %08x\n"), addr); } /* Default memory access functions */ -int REGPARAM2 default_check(uaecptr a, uae_u32 b) +int REGPARAM2 default_check (uaecptr a, uae_u32 b) { - return 0; + return 0; } -static int be_cnt; +static int be_cnt, be_recursive; -uae_u8 *REGPARAM2 default_xlate(uaecptr addr) +uae_u8 *REGPARAM2 default_xlate (uaecptr addr) { - static int recursive; - - if (recursive) { - cpu_halt(3); + if (be_recursive) { + cpu_halt(CPU_HALT_OPCODE_FETCH_FROM_NON_EXISTING_ADDRESS); return kickmem_xlate(2); } - recursive++; - int size = currprefs.cpu_model >= 68020 ? 4 : 2; - if (quit_program == 0) { - /* do this only in 68010+ mode, there are some tricky A500 programs.. */ - if (currprefs.cpu_model > 68000 || !currprefs.cpu_compatible) { + be_recursive++; + int size = currprefs.cpu_model >= 68020 ? 4 : 2; + if (quit_program == 0) { + /* do this only in 68010+ mode, there are some tricky A500 programs.. */ + if(currprefs.cpu_model > 68000 || !currprefs.cpu_compatible) { if (be_cnt < 3) { - int i, j; - uaecptr a2 = addr - 32; - uaecptr a3 = m68k_getpc() - 32; - write_log(_T("Your Amiga program just did something terribly stupid %08X PC=%08X\n"), addr, M68K_GETPC); - } - be_cnt++; - if (regs.s || be_cnt > 1000) { - cpu_halt(3); - be_cnt = 0; - } - else { - regs.panic = 4; - regs.panic_pc = m68k_getpc(); - regs.panic_addr = addr; - set_special(SPCFLAG_BRK); - } - } + write_log (_T("Your Amiga program just did something terribly stupid %08X PC=%08X\n"), addr, M68K_GETPC); + } + if (gary_toenb && (gary_nonrange(addr) || (size > 1 && gary_nonrange(addr + size - 1)))) { + exception2 (addr, false, size, regs.s ? 4 : 0); + } else { + cpu_halt (CPU_HALT_OPCODE_FETCH_FROM_NON_EXISTING_ADDRESS); + } + } } - recursive--; - return kickmem_xlate(2); /* So we don't crash. */ + be_recursive--; + return kickmem_xlate (2); /* So we don't crash. */ } /* Address banks */ addrbank dummy_bank = { - dummy_lget, dummy_wget, dummy_bget, - dummy_lput, dummy_wput, dummy_bput, - default_xlate, dummy_check, NULL, NULL, NULL, - dummy_lgeti, dummy_wgeti, - ABFLAG_NONE, S_READ, S_WRITE -}; - -addrbank ones_bank = { - ones_get, ones_get, ones_get, - none_put, none_put, none_put, - default_xlate, dummy_check, NULL, NULL, _T("Ones"), + dummy_lget, dummy_wget, dummy_bget, + dummy_lput, dummy_wput, dummy_bput, + default_xlate, dummy_check, NULL, NULL, NULL, dummy_lgeti, dummy_wgeti, ABFLAG_NONE, S_READ, S_WRITE }; addrbank chipmem_bank = { - chipmem_lget, chipmem_wget, chipmem_bget, - chipmem_lput, chipmem_wput, chipmem_bput, + chipmem_lget, chipmem_wget, chipmem_bget, + chipmem_lput, chipmem_wput, chipmem_bput, chipmem_xlate, chipmem_check, NULL, _T("chip"), _T("Chip memory"), chipmem_lget, chipmem_wget, ABFLAG_RAM | ABFLAG_THREADSAFE | ABFLAG_CHIPRAM, 0, 0 }; -addrbank chipmem_dummy_bank = { - chipmem_dummy_lget, chipmem_dummy_wget, chipmem_dummy_bget, - chipmem_dummy_lput, chipmem_dummy_wput, chipmem_dummy_bput, - default_xlate, dummy_check, NULL, NULL, _T("Dummy Chip memory"), - dummy_lgeti, dummy_wgeti, - ABFLAG_IO | ABFLAG_CHIPRAM, S_READ, S_WRITE -}; - -#ifdef AGA -addrbank chipmem_bank_ce2 = { - chipmem_lget_ce2, chipmem_wget_ce2, chipmem_bget_ce2, - chipmem_lput_ce2, chipmem_wput_ce2, chipmem_bput_ce2, - chipmem_xlate, chipmem_check, NULL, NULL, _T("Chip memory (68020 'ce')"), - chipmem_lget_ce2, chipmem_wget_ce2, - ABFLAG_RAM | ABFLAG_CHIPRAM, S_READ, S_WRITE -}; -#endif - addrbank bogomem_bank = { - bogomem_lget, bogomem_wget, bogomem_bget, - bogomem_lput, bogomem_wput, bogomem_bput, + bogomem_lget, bogomem_wget, bogomem_bget, + bogomem_lput, bogomem_wput, bogomem_bput, bogomem_xlate, bogomem_check, NULL, _T("bogo"), _T("Slow memory"), bogomem_lget, bogomem_wget, ABFLAG_RAM | ABFLAG_THREADSAFE, 0, 0 }; -addrbank cardmem_bank = { - cardmem_lget, cardmem_wget, cardmem_bget, - cardmem_lput, cardmem_wput, cardmem_bput, - cardmem_xlate, cardmem_check, NULL, _T("rom_e0"), _T("CDTV memory card"), - cardmem_lget, cardmem_wget, - ABFLAG_RAM, 0, 0 -}; - -addrbank mem25bit_bank = { - mem25bit_lget, mem25bit_wget, mem25bit_bget, - mem25bit_lput, mem25bit_wput, mem25bit_bput, - mem25bit_xlate, mem25bit_check, NULL, _T("25bitmem"), _T("25bit memory"), - mem25bit_lget, mem25bit_wget, - ABFLAG_RAM | ABFLAG_THREADSAFE, 0, 0 -}; - addrbank a3000lmem_bank = { a3000lmem_lget, a3000lmem_wget, a3000lmem_bget, a3000lmem_lput, a3000lmem_wput, a3000lmem_bput, @@ -978,35 +516,34 @@ addrbank a3000hmem_bank = { }; addrbank kickmem_bank = { - kickmem_lget, kickmem_wget, kickmem_bget, - kickmem_lput, kickmem_wput, kickmem_bput, + kickmem_lget, kickmem_wget, kickmem_bget, + kickmem_lput, kickmem_wput, kickmem_bput, kickmem_xlate, kickmem_check, NULL, _T("kick"), _T("Kickstart ROM"), kickmem_lget, kickmem_wget, ABFLAG_ROM | ABFLAG_THREADSAFE, 0, S_WRITE }; -addrbank kickram_bank = { - kickmem_lget, kickmem_wget, kickmem_bget, - kickmem2_lput, kickmem2_wput, kickmem2_bput, - kickmem_xlate, kickmem_check, NULL, NULL, _T("Kickstart Shadow RAM"), - kickmem_lget, kickmem_wget, - ABFLAG_UNK | ABFLAG_SAFE, 0, S_WRITE -}; - addrbank extendedkickmem_bank = { - extendedkickmem_lget, extendedkickmem_wget, extendedkickmem_bget, - extendedkickmem_lput, extendedkickmem_wput, extendedkickmem_bput, + extendedkickmem_lget, extendedkickmem_wget, extendedkickmem_bget, + extendedkickmem_lput, extendedkickmem_wput, extendedkickmem_bput, extendedkickmem_xlate, extendedkickmem_check, NULL, NULL, _T("Extended Kickstart ROM"), extendedkickmem_lget, extendedkickmem_wget, ABFLAG_ROM | ABFLAG_THREADSAFE, 0, S_WRITE }; addrbank extendedkickmem2_bank = { - extendedkickmem2_lget, extendedkickmem2_wget, extendedkickmem2_bget, - extendedkickmem2_lput, extendedkickmem2_wput, extendedkickmem2_bput, + extendedkickmem2_lget, extendedkickmem2_wget, extendedkickmem2_bget, + extendedkickmem2_lput, extendedkickmem2_wput, extendedkickmem2_bput, extendedkickmem2_xlate, extendedkickmem2_check, NULL, _T("rom_a8"), _T("Extended 2nd Kickstart ROM"), extendedkickmem2_lget, extendedkickmem2_wget, ABFLAG_ROM | ABFLAG_THREADSAFE, 0, S_WRITE }; +addrbank fakeuaebootrom_bank = { + fakeuaebootrom_lget, fakeuaebootrom_wget, fakeuaebootrom_bget, + fakeuaebootrom_lput, fakeuaebootrom_wput, fakeuaebootrom_bput, + fakeuaebootrom_xlate, fakeuaebootrom_check, NULL, _T("*"), _T("fakeuaerom"), + fakeuaebootrom_lget, fakeuaebootrom_wget, + ABFLAG_RAM | ABFLAG_THREADSAFE, 0, 0 +}; MEMORY_FUNCTIONS(custmem1); MEMORY_FUNCTIONS(custmem2); @@ -1026,332 +563,177 @@ addrbank custmem2_bank = { ABFLAG_RAM | ABFLAG_THREADSAFE, 0, 0 }; -#define fkickmem_size ROM_SIZE_512 -static int a3000_f0; -void a3000_fakekick(int map) +static const uae_char *kickstring = "exec.library"; + +static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksum, int noalias) { - static uae_u8 *kickstore; + uae_char buffer[20]; + int i, j, oldpos; + int cr = 0, kickdisk = 0; - protect_roms(false); - if (map) { - uae_u8 *fkickmemory = a3000lmem_bank.baseaddr + a3000lmem_bank.reserved_size - fkickmem_size; - if (fkickmemory[2] == 0x4e && fkickmemory[3] == 0xf9 && fkickmemory[4] == 0x00) { - if (!kickstore) - kickstore = xmalloc(uae_u8, fkickmem_size); - memcpy(kickstore, kickmem_bank.baseaddr, fkickmem_size); - if (fkickmemory[5] == 0xfc) { - memcpy(kickmem_bank.baseaddr, fkickmemory, fkickmem_size / 2); - memcpy(kickmem_bank.baseaddr + fkickmem_size / 2, fkickmemory, fkickmem_size / 2); - extendedkickmem_bank.reserved_size = 65536; - extendedkickmem_bank.label = _T("rom_f0"); - extendedkickmem_bank.mask = extendedkickmem_bank.reserved_size - 1; - mapped_malloc(&extendedkickmem_bank); - memcpy(extendedkickmem_bank.baseaddr, fkickmemory + fkickmem_size / 2, 65536); - map_banks(&extendedkickmem_bank, 0xf0, 1, 1); - a3000_f0 = 1; - } - else { - memcpy(kickmem_bank.baseaddr, fkickmemory, fkickmem_size); - } - } - } - else { - if (a3000_f0) { - map_banks(&dummy_bank, 0xf0, 1, 1); - mapped_free(&extendedkickmem_bank); - a3000_f0 = 0; - } - if (kickstore) - memcpy(kickmem_bank.baseaddr, kickstore, fkickmem_size); - xfree(kickstore); - kickstore = NULL; - } - protect_roms(true); -} + if (size < 0) { + zfile_fseek (f, 0, SEEK_END); + size = zfile_ftell (f) & ~0x3ff; + zfile_fseek (f, 0, SEEK_SET); + } + oldpos = zfile_ftell (f); + i = zfile_fread (buffer, 1, 11, f); + if (!memcmp(buffer, "KICK", 4)) { + zfile_fseek (f, 512, SEEK_SET); + kickdisk = 1; + } else if (memcmp ((uae_char*)buffer, "AMIROMTYPE1", 11) != 0) { + zfile_fseek (f, oldpos, SEEK_SET); + } else { + cloanto_rom = 1; + cr = 1; + } -static bool is_alg_rom(const TCHAR *name) -{ - struct romdata *rd = getromdatabypath(name); - if (!rd) - return false; - return (rd->type & ROMTYPE_ALG) != 0; -} - -static void descramble_alg(uae_u8 *data, int size) -{ - uae_u8 *tbuf = xmalloc(uae_u8, size); - memcpy(tbuf, data, size); - for (int mode = 0; mode < 3; mode++) { - if ((data[8] == 0x4a && data[9] == 0xfc)) - break; - for (int s = 0; s < size; s++) { - int d = s; - if (mode == 0) { - if (s & 0x2000) - d ^= 0x1000; - if (s & 0x8000) - d ^= 0x4000; - } - else if (mode == 1) { - if (s & 0x2000) - d ^= 0x1000; - } - else { - if ((~s) & 0x2000) - d ^= 0x1000; - if (s & 0x8000) - d ^= 0x4000; - d ^= 0x20000; - } - data[d] = tbuf[s]; - } - } - xfree(tbuf); -} - -static const char *kickstring = "exec.library"; - -static int read_kickstart(struct zfile *f, uae_u8 *mem, int size, int dochecksum, int noalias) -{ - uae_char buffer[20]; - int i, j, oldpos; - int cr = 0, kickdisk = 0; - - if (size < 0) { - zfile_fseek(f, 0, SEEK_END); - size = zfile_ftell(f) & ~0x3ff; - zfile_fseek(f, 0, SEEK_SET); - } - oldpos = zfile_ftell(f); - i = zfile_fread(buffer, 1, 11, f); - if (!memcmp(buffer, "KICK", 4)) { - zfile_fseek(f, 512, SEEK_SET); - kickdisk = 1; - } - else if (memcmp(static_cast(buffer), "AMIROMTYPE1", 11) != 0) { - zfile_fseek(f, oldpos, SEEK_SET); - } - else { - cloanto_rom = 1; - cr = 1; - } - - memset(mem, 0, size); + memset (mem, 0, size); if (size >= 131072) { for (i = 0; i < 8; i++) { - mem[size - 16 + i * 2 + 1] = 0x18 + i; + mem[size - 16 + i * 2 + 1] = 0x18 + i; } - mem[size - 20] = size >> 24; - mem[size - 19] = size >> 16; - mem[size - 18] = size >> 8; - mem[size - 17] = size >> 0; + mem[size - 20] = size >> 24; + mem[size - 19] = size >> 16; + mem[size - 18] = size >> 8; + mem[size - 17] = size >> 0; } - i = zfile_fread(mem, 1, size, f); + i = zfile_fread (mem, 1, size, f); - if (kickdisk && i > ROM_SIZE_256) - i = ROM_SIZE_256; + if (kickdisk && i > ROM_SIZE_256) + i = ROM_SIZE_256; + if (i < size - 20) + kickstart_fix_checksum (mem, size); + j = 1; + while (j < i) + j <<= 1; + i = j; - if (i < size - 20) - kickstart_fix_checksum(mem, size); - j = 1; - while (j < i) - j <<= 1; - i = j; + if (!noalias && i == size / 2) + memcpy (mem + size / 2, mem, size / 2); - if (!noalias && i == size / 2) - memcpy(mem + size / 2, mem, size / 2); - - if (cr) { - if (!decode_rom(mem, size, cr, i)) - return 0; - } + if (cr) { + if(!decode_rom (mem, size, cr, i)) + return 0; + } if (size <= 256) return size; - if (currprefs.cs_a1000ram && i < ROM_SIZE_256) { - int off = 0; - if (!a1000_bootrom) - a1000_bootrom = xcalloc(uae_u8, ROM_SIZE_256); - while (off + i < ROM_SIZE_256) { - memcpy(a1000_bootrom + off, kickmem_bank.baseaddr, i); - off += i; - } - memset(kickmem_bank.baseaddr, 0, kickmem_bank.allocated_size); - a1000_handle_kickstart(1); - dochecksum = 0; - i = ROM_SIZE_512; - } + for (j = 0; j < 256 && i >= ROM_SIZE_256; j++) { + if (!memcmp (mem + j, kickstring, strlen (kickstring) + 1)) + break; + } - for (j = 0; j < 256 && i >= ROM_SIZE_256; j++) { - if (!memcmp(mem + j, kickstring, strlen(kickstring) + 1)) - break; - } - - if (j == 256 || i < ROM_SIZE_256) - dochecksum = 0; - if (dochecksum) - kickstart_checksum(mem, size); - return i; + if (j == 256 || i < ROM_SIZE_256) + dochecksum = 0; + if (dochecksum) + kickstart_checksum (mem, size); + return i; } -static bool load_extendedkickstart(const TCHAR *romextfile, int type) +static bool load_extendedkickstart (const TCHAR *romextfile, int type) { - struct zfile *f; - int size, off; + struct zfile *f; + int size, off; bool ret = false; - if (_tcslen(romextfile) == 0) - return false; - //if (is_arcadia_rom(romextfile) == ARCADIA_BIOS) { - // extendedkickmem_type = EXTENDED_ROM_ARCADIA; - // return false; - //} - if (is_alg_rom(romextfile)) { - type = EXTENDED_ROM_ALG; - - } - f = read_rom_name(romextfile); - if (!f) { - notify_user(NUMSG_NOEXTROM); - return false; - } - zfile_fseek(f, 0, SEEK_END); - size = zfile_ftell(f); + if (_tcslen (romextfile) == 0) + return false; + f = read_rom_name (romextfile); + if (!f) { + notify_user (NUMSG_NOEXTROM); + return false; + } + zfile_fseek (f, 0, SEEK_END); + size = zfile_ftell (f); extendedkickmem_bank.reserved_size = ROM_SIZE_512; - off = 0; + off = 0; if (type == 0) { if (currprefs.cs_cd32cd) { extendedkickmem_type = EXTENDED_ROM_CD32; - } - else if (currprefs.cs_cdtvcd || currprefs.cs_cdtvram) { - extendedkickmem_type = EXTENDED_ROM_CDTV; - } - else if (size > 300000) { - extendedkickmem_type = EXTENDED_ROM_CD32; - } - else if (need_uae_boot_rom(&currprefs) != 0xf00000) { - extendedkickmem_type = EXTENDED_ROM_CDTV; - } - } - else { + } else if (size > 300000) { + extendedkickmem_type = EXTENDED_ROM_CD32; + } + } else { extendedkickmem_type = type; } if (extendedkickmem_type) { - zfile_fseek(f, off, SEEK_SET); - switch (extendedkickmem_type) { - case EXTENDED_ROM_CDTV: - extendedkickmem_bank.label = _T("rom_f0"); - mapped_malloc(&extendedkickmem_bank); - extendedkickmem_bank.start = 0xf00000; - break; - case EXTENDED_ROM_CD32: + zfile_fseek (f, off, SEEK_SET); + switch (extendedkickmem_type) { + case EXTENDED_ROM_CD32: extendedkickmem_bank.label = _T("rom_e0"); - mapped_malloc(&extendedkickmem_bank); - extendedkickmem_bank.start = 0xe00000; - break; - case EXTENDED_ROM_ALG: - extendedkickmem_bank.label = _T("rom_f0"); - mapped_malloc(&extendedkickmem_bank); - extendedkickmem_bank.start = 0xf00000; - break; - } + mapped_malloc (&extendedkickmem_bank); + extendedkickmem_bank.start = 0xe00000; + break; + } if (extendedkickmem_bank.baseaddr) { - read_kickstart(f, extendedkickmem_bank.baseaddr, extendedkickmem_bank.allocated_size, 0, 1); - if (extendedkickmem_type == EXTENDED_ROM_ALG) - descramble_alg(extendedkickmem_bank.baseaddr, 262144); - extendedkickmem_bank.mask = extendedkickmem_bank.allocated_size - 1; + read_kickstart (f, extendedkickmem_bank.baseaddr, extendedkickmem_bank.allocated_size, 0, 1); + extendedkickmem_bank.mask = extendedkickmem_bank.allocated_size - 1; ret = true; } } - zfile_fclose(f); - return ret; -} - -static int patch_shapeshifter(uae_u8 *kickmemory) -{ - /* Patch Kickstart ROM for ShapeShifter - from Christian Bauer. - * Changes 'lea $400,a0' and 'lea $1000,a0' to 'lea $3000,a0' for - * ShapeShifter compatability. - */ - int i, patched = 0; - uae_u8 kickshift1[] = { 0x41, 0xf8, 0x04, 0x00 }; - uae_u8 kickshift2[] = { 0x41, 0xf8, 0x10, 0x00 }; - uae_u8 kickshift3[] = { 0x43, 0xf8, 0x04, 0x00 }; - - for (i = 0x200; i < 0x300; i++) { - if (!memcmp(kickmemory + i, kickshift1, sizeof(kickshift1)) || - !memcmp(kickmemory + i, kickshift2, sizeof(kickshift2)) || - !memcmp(kickmemory + i, kickshift3, sizeof(kickshift3))) { - kickmemory[i + 2] = 0x30; - write_log(_T("Kickstart KickShifted @%04X\n"), i); - patched++; - } - } - return patched; + zfile_fclose (f); + return ret; } /* disable incompatible drivers */ -static int patch_residents(uae_u8 *kickmemory, int size) +static int patch_residents (uae_u8 *kickmemory, int size) { - int i, j, patched = 0; - const uae_char *residents[] = { "NCR scsi.device", NULL }; - // "scsi.device", "carddisk.device", "card.resource" }; - uaecptr base = size == ROM_SIZE_512 ? 0xf80000 : 0xfc0000; + int i, j, patched = 0; + const uae_char *residents[] = { "NCR scsi.device", NULL }; + // "scsi.device", "carddisk.device", "card.resource" }; + uaecptr base = size == ROM_SIZE_512 ? 0xf80000 : 0xfc0000; - if (is_device_rom(&currprefs, ROMTYPE_SCSI_A4000T, 0) < 0) { - for (i = 0; i < size - 100; i++) { - if (kickmemory[i] == 0x4a && kickmemory[i + 1] == 0xfc) { - uaecptr addr; - addr = (kickmemory[i + 2] << 24) | (kickmemory[i + 3] << 16) | (kickmemory[i + 4] << 8) | (kickmemory[i + 5] << 0); - if (addr != i + base) - continue; - addr = (kickmemory[i + 14] << 24) | (kickmemory[i + 15] << 16) | (kickmemory[i + 16] << 8) | (kickmemory[i + 17] << 0); - if (addr >= base && addr < base + size) { - j = 0; - while (residents[j]) { - if (!memcmp(residents[j], kickmemory + addr - base, strlen(residents[j]) + 1)) { - TCHAR *s = au(residents[j]); - write_log(_T("KSPatcher: '%s' at %08X disabled\n"), s, i + base); - xfree(s); - kickmemory[i] = 0x4b; /* destroy RTC_MATCHWORD */ - patched++; - break; - } - j++; - } - } - } - } - } - return patched; + for (i = 0; i < size - 100; i++) { + if (kickmemory[i] == 0x4a && kickmemory[i + 1] == 0xfc) { + uaecptr addr; + addr = (kickmemory[i + 2] << 24) | (kickmemory[i + 3] << 16) | (kickmemory[i + 4] << 8) | (kickmemory[i + 5] << 0); + if (addr != i + base) + continue; + addr = (kickmemory[i + 14] << 24) | (kickmemory[i + 15] << 16) | (kickmemory[i + 16] << 8) | (kickmemory[i + 17] << 0); + if (addr >= base && addr < base + size) { + j = 0; + while (residents[j]) { + if (!memcmp (residents[j], kickmemory + addr - base, strlen (residents[j]) + 1)) { + TCHAR *s = au (residents[j]); + write_log (_T("KSPatcher: '%s' at %08X disabled\n"), s, i + base); + xfree (s); + kickmemory[i] = 0x4b; /* destroy RTC_MATCHWORD */ + patched++; + break; + } + j++; + } + } + } + } + return patched; } static void patch_kick(void) { - int patched = 0; - if (kickmem_bank.allocated_size >= ROM_SIZE_512 && currprefs.kickshifter) - patched += patch_shapeshifter(kickmem_bank.baseaddr); - patched += patch_residents(kickmem_bank.baseaddr, kickmem_bank.allocated_size); - if (extendedkickmem_bank.baseaddr) { - patched += patch_residents(extendedkickmem_bank.baseaddr, extendedkickmem_bank.allocated_size); - if (patched) - kickstart_fix_checksum(extendedkickmem_bank.baseaddr, extendedkickmem_bank.allocated_size); - } - if (patched) - kickstart_fix_checksum(kickmem_bank.baseaddr, kickmem_bank.allocated_size); + int patched = 0; + patched += patch_residents (kickmem_bank.baseaddr, kickmem_bank.allocated_size); + if (extendedkickmem_bank.baseaddr) { + patched += patch_residents (extendedkickmem_bank.baseaddr, extendedkickmem_bank.allocated_size); + if (patched) + kickstart_fix_checksum (extendedkickmem_bank.baseaddr, extendedkickmem_bank.allocated_size); + } + if (patched) + kickstart_fix_checksum (kickmem_bank.baseaddr, kickmem_bank.allocated_size); } extern unsigned char arosrom[]; extern unsigned int arosrom_len; -static bool load_kickstart_replacement(void) +static bool load_kickstart_replacement (void) { struct zfile *f; - f = zfile_fopen_data(_T("aros.gz"), arosrom_len, arosrom); + f = zfile_fopen_data (_T("aros.gz"), arosrom_len, arosrom); if (!f) return false; - f = zfile_gunzip(f); + f = zfile_gunzip (f); if (!f) return false; @@ -1359,17 +741,14 @@ static bool load_kickstart_replacement(void) extendedkickmem_bank.mask = ROM_SIZE_512 - 1; extendedkickmem_bank.label = _T("rom_e0"); extendedkickmem_type = EXTENDED_ROM_KS; - mapped_malloc(&extendedkickmem_bank); - read_kickstart(f, extendedkickmem_bank.baseaddr, ROM_SIZE_512, 0, 1); - + mapped_malloc (&extendedkickmem_bank); + read_kickstart (f, extendedkickmem_bank.baseaddr, ROM_SIZE_512, 0, 1); kickmem_bank.reserved_size = ROM_SIZE_512; kickmem_bank.mask = ROM_SIZE_512 - 1; - read_kickstart(f, kickmem_bank.baseaddr, ROM_SIZE_512, 1, 0); + read_kickstart (f, kickmem_bank.baseaddr, ROM_SIZE_512, 1, 0); - zfile_fclose(f); - - //seriallog = -1; + zfile_fclose (f); // if 68000-68020 config without any other fast ram with m68k aros: enable special extra RAM. if (currprefs.cpu_model <= 68020 && @@ -1377,8 +756,7 @@ static bool load_kickstart_replacement(void) currprefs.fastmem[0].size == 0 && currprefs.z3fastmem[0].size == 0 && currprefs.mbresmem_high_size == 0 && - currprefs.mbresmem_low_size == 0 && - currprefs.cpuboardmem1_size == 0) { + currprefs.mbresmem_low_size == 0) { changed_prefs.custom_memory_addrs[0] = currprefs.custom_memory_addrs[0] = 0xa80000; changed_prefs.custom_memory_sizes[0] = currprefs.custom_memory_sizes[0] = 512 * 1024; @@ -1386,7 +764,6 @@ static bool load_kickstart_replacement(void) changed_prefs.custom_memory_addrs[1] = currprefs.custom_memory_addrs[1] = 0xb00000; changed_prefs.custom_memory_sizes[1] = currprefs.custom_memory_sizes[1] = 512 * 1024; changed_prefs.custom_memory_mask[1] = currprefs.custom_memory_mask[1] = 0; - } return true; @@ -1394,843 +771,358 @@ static bool load_kickstart_replacement(void) static struct zfile *get_kickstart_filehandle(struct uae_prefs *p) { - struct zfile *f; - TCHAR tmprom[MAX_DPATH], tmprom2[MAX_DPATH]; + struct zfile *f; + TCHAR tmprom[MAX_DPATH], tmprom2[MAX_DPATH]; - f = read_rom_name(p->romfile); - _tcscpy(tmprom, p->romfile); - if (f == NULL) { - _stprintf(tmprom2, _T("%s%s"), start_path_data, p->romfile); - f = rom_fopen(tmprom2, _T("rb"), ZFD_NORMAL); - if (f == NULL) { - _stprintf(p->romfile, _T("%sroms/kick.rom"), start_path_data); - f = rom_fopen(p->romfile, _T("rb"), ZFD_NORMAL); - if (f == NULL) { - _stprintf(p->romfile, _T("%skick.rom"), start_path_data); - f = rom_fopen(p->romfile, _T("rb"), ZFD_NORMAL); - if (f == NULL) { - _stprintf(p->romfile, _T("%s../shared/rom/kick.rom"), start_path_data); - f = rom_fopen(p->romfile, _T("rb"), ZFD_NORMAL); - if (f == NULL) { - _stprintf(p->romfile, _T("%s../System/rom/kick.rom"), start_path_data); - f = rom_fopen(p->romfile, _T("rb"), ZFD_NORMAL); - if (f == NULL) - f = read_rom_name_guess(tmprom); - } - } - } - } - else { - _tcscpy(p->romfile, tmprom2); - } - } + f = read_rom_name (p->romfile); + _tcscpy (tmprom, p->romfile); + if (f == NULL) { + _stprintf (tmprom2, _T("%s%s"), start_path_data, p->romfile); + f = rom_fopen (tmprom2, _T("rb"), ZFD_NORMAL); + if (f == NULL) { + _stprintf (p->romfile, _T("%sroms/kick.rom"), start_path_data); + f = rom_fopen (p->romfile, _T("rb"), ZFD_NORMAL); + if (f == NULL) { + _stprintf (p->romfile, _T("%skick.rom"), start_path_data); + f = rom_fopen(p->romfile, _T("rb"), ZFD_NORMAL); + if (f == NULL) + f = read_rom_name_guess (tmprom); + } + } else { + _tcscpy (p->romfile, tmprom2); + } + } return f; } -static int load_kickstart(void) +static int load_kickstart (void) { TCHAR tmprom[MAX_DPATH]; - cloanto_rom = 0; - if (!_tcscmp(currprefs.romfile, _T(":AROS"))) { - return load_kickstart_replacement(); - } + cloanto_rom = 0; + if (!_tcscmp (currprefs.romfile, _T(":AROS"))) { + return load_kickstart_replacement (); + } _tcscpy(tmprom, currprefs.romfile); struct zfile *f = get_kickstart_filehandle(&currprefs); - addkeydir(currprefs.romfile); + addkeydir (currprefs.romfile); if (f == NULL) /* still no luck */ - goto err; + goto err; - if (f != NULL) { - int filesize, size, maxsize; - int kspos = ROM_SIZE_512; - int extpos = 0; + if (f != NULL) { + int filesize, size, maxsize; + int kspos = ROM_SIZE_512; + int extpos = 0; - maxsize = ROM_SIZE_512; - zfile_fseek(f, 0, SEEK_END); - filesize = zfile_ftell(f); - zfile_fseek(f, 0, SEEK_SET); - if (filesize == 1760 * 512) { - filesize = ROM_SIZE_256; - maxsize = ROM_SIZE_256; - } - if (filesize == ROM_SIZE_512 + 8) { - /* GVP 0xf0 kickstart */ - zfile_fseek(f, 8, SEEK_SET); - } - if (filesize >= ROM_SIZE_512 * 2) { - struct romdata *rd = getromdatabyzfile(f); - zfile_fseek(f, kspos, SEEK_SET); - } - if (filesize >= ROM_SIZE_512 * 4) { - kspos = ROM_SIZE_512 * 3; - extpos = 0; - zfile_fseek(f, kspos, SEEK_SET); - } - size = read_kickstart(f, kickmem_bank.baseaddr, maxsize, 1, 0); - if (size == 0) - goto err; - kickmem_bank.mask = size - 1; - kickmem_bank.reserved_size = size; - if (filesize >= ROM_SIZE_512 * 2 && !extendedkickmem_type) { - extendedkickmem_bank.reserved_size = ROM_SIZE_512; - if (currprefs.cs_cdtvcd || currprefs.cs_cdtvram) { - extendedkickmem_type = EXTENDED_ROM_CDTV; - extendedkickmem_bank.reserved_size *= 2; - extendedkickmem_bank.label = _T("rom_f0"); - extendedkickmem_bank.start = 0xf00000; - } - else { - extendedkickmem_type = EXTENDED_ROM_KS; - extendedkickmem_bank.label = _T("rom_e0"); - extendedkickmem_bank.start = 0xe00000; - } - mapped_malloc(&extendedkickmem_bank); - zfile_fseek(f, extpos, SEEK_SET); - read_kickstart(f, extendedkickmem_bank.baseaddr, extendedkickmem_bank.allocated_size, 0, 1); - extendedkickmem_bank.mask = extendedkickmem_bank.allocated_size - 1; - } - if (filesize > ROM_SIZE_512 * 2) { - extendedkickmem2_bank.reserved_size = ROM_SIZE_512 * 2; - mapped_malloc(&extendedkickmem2_bank); - zfile_fseek(f, extpos + ROM_SIZE_512, SEEK_SET); - read_kickstart(f, extendedkickmem2_bank.baseaddr, ROM_SIZE_512, 0, 1); - zfile_fseek(f, extpos + ROM_SIZE_512 * 2, SEEK_SET); - read_kickstart(f, extendedkickmem2_bank.baseaddr + ROM_SIZE_512, ROM_SIZE_512, 0, 1); - extendedkickmem2_bank.mask = extendedkickmem2_bank.allocated_size - 1; + maxsize = ROM_SIZE_512; + zfile_fseek (f, 0, SEEK_END); + filesize = zfile_ftell (f); + zfile_fseek (f, 0, SEEK_SET); + if (filesize == 1760 * 512) { + filesize = ROM_SIZE_256; + maxsize = ROM_SIZE_256; + } + if (filesize == ROM_SIZE_512 + 8) { + /* GVP 0xf0 kickstart */ + zfile_fseek (f, 8, SEEK_SET); + } + if (filesize >= ROM_SIZE_512 * 2) { + struct romdata *rd = getromdatabyzfile(f); + zfile_fseek (f, kspos, SEEK_SET); + } + if (filesize >= ROM_SIZE_512 * 4) { + kspos = ROM_SIZE_512 * 3; + extpos = 0; + zfile_fseek (f, kspos, SEEK_SET); + } + size = read_kickstart (f, kickmem_bank.baseaddr, maxsize, 1, 0); + if (size == 0) + goto err; + kickmem_bank.mask = size - 1; + kickmem_bank.reserved_size = size; + if (filesize >= ROM_SIZE_512 * 2 && !extendedkickmem_type) { + extendedkickmem_bank.reserved_size = ROM_SIZE_512; + extendedkickmem_type = EXTENDED_ROM_KS; + extendedkickmem_bank.label = _T("rom_e0"); + extendedkickmem_bank.start = 0xe00000; + mapped_malloc (&extendedkickmem_bank); + zfile_fseek (f, extpos, SEEK_SET); + read_kickstart (f, extendedkickmem_bank.baseaddr, extendedkickmem_bank.allocated_size, 0, 1); + extendedkickmem_bank.mask = extendedkickmem_bank.allocated_size - 1; + } + if (filesize > ROM_SIZE_512 * 2) { + extendedkickmem2_bank.reserved_size = ROM_SIZE_512 * 2; + mapped_malloc (&extendedkickmem2_bank); + zfile_fseek (f, extpos + ROM_SIZE_512, SEEK_SET); + read_kickstart (f, extendedkickmem2_bank.baseaddr, ROM_SIZE_512, 0, 1); + zfile_fseek (f, extpos + ROM_SIZE_512 * 2, SEEK_SET); + read_kickstart (f, extendedkickmem2_bank.baseaddr + ROM_SIZE_512, ROM_SIZE_512, 0, 1); + extendedkickmem2_bank.mask = extendedkickmem2_bank.allocated_size - 1; extendedkickmem2_bank.start = 0xa80000; - } + } + } + + kickstart_version = (kickmem_bank.baseaddr[12] << 8) | kickmem_bank.baseaddr[13]; + if (kickstart_version == 0xffff) { + // 1.0-1.1 and older + kickstart_version = (kickmem_bank.baseaddr[16] << 8) | kickmem_bank.baseaddr[17]; + if (kickstart_version > 33) + kickstart_version = 0; } - -#if defined(AMIGA) - chk_sum: -#endif - - kickstart_version = (kickmem_bank.baseaddr[12] << 8) | kickmem_bank.baseaddr[13]; - if (kickstart_version == 0xffff) { - // 1.0-1.1 and older - kickstart_version = (kickmem_bank.baseaddr[16] << 8) | kickmem_bank.baseaddr[17]; - if (kickstart_version > 33) - kickstart_version = 0; - } - zfile_fclose(f); - return 1; - err: - _tcscpy(currprefs.romfile, tmprom); - zfile_fclose(f); - return 0; + zfile_fclose (f); + return 1; +err: + _tcscpy (currprefs.romfile, tmprom); + zfile_fclose (f); + return 0; } -#ifndef NATMEM_OFFSET -bool mapped_malloc(addrbank *ab) -{ - ab->startmask = ab->start; - ab->baseaddr = xcalloc(uae_u8, ab->reserved_size + 4); - ab->allocated_size = ab->baseaddr != NULL ? ab->reserved_size : 0; - return ab->baseaddr != NULL; -} - -void mapped_free(addrbank *ab) -{ - xfree(ab->baseaddr); - ab->allocated_size = 0; - ab->baseaddr = NULL; -} - -#else - -#include - -shmpiece *shm_start; - -static void dumplist(void) -{ - shmpiece *x = shm_start; - write_log(_T("Start Dump:\n")); - while (x) { - write_log(_T("this=%p,Native %p,id %d,prev=%p,next=%p,size=0x%08x\n"), - x, x->native_address, x->id, x->prev, x->next, x->size); - x = x->next; - } - write_log(_T("End Dump:\n")); -} - -static shmpiece *find_shmpiece(uae_u8 *base, bool safe) -{ - shmpiece *x = shm_start; - - while (x && x->native_address != base) - x = x->next; - if (!x) { - if (safe || bogomem_aliasing) - return 0; - write_log(_T("NATMEM: Failure to find mapping at %08lx, %p\n"), base - NATMEM_OFFSET, base); - nocanbang(); - return 0; - } - return x; -} - -static void delete_shmmaps(uae_u32 start, uae_u32 size) -{ - if (!needmman()) - return; - - while (size) { - uae_u8 *base = mem_banks[bankindex(start)]->baseaddr; - if (base) { - shmpiece *x; - //base = ((uae_u8*)NATMEM_OFFSET)+start; - - x = find_shmpiece(base, true); - if (!x) - return; - - if (x->size > size) { - if (isdirectjit()) - write_log(_T("NATMEM WARNING: size mismatch mapping at %08x (size %08x, delsize %08x)\n"), start, x->size, size); - size = x->size; - } - - uae_shmdt(x->native_address); - size -= x->size; - start += x->size; - if (x->next) - x->next->prev = x->prev; /* remove this one from the list */ - if (x->prev) - x->prev->next = x->next; - else - shm_start = x->next; - xfree(x); - } - else { - size -= 0x10000; - start += 0x10000; - } - } -} - -static void add_shmmaps(uae_u32 start, Addrbank *what) -{ - shmpiece *x = shm_start; - shmpiece *y; - uae_u8 *base = what->baseaddr; - - if (!needmman()) - return; - - if (!base) - return; - - if (what->jit_read_flag && what->jit_write_flag) - return; - - x = find_shmpiece(base, false); - if (!x) - return; - - y = xmalloc(shmpiece, 1); - *y = *x; - base = ((uae_u8 *)NATMEM_OFFSET) + start; - y->native_address = (uae_u8*)uae_shmat(what, y->id, base, 0); - if (y->native_address == (void *)-1) { - write_log(_T("NATMEM: Failure to map existing at %08x (%p)\n"), start, base); - dumplist(); - nocanbang(); - return; - } - y->next = shm_start; - y->prev = NULL; - if (y->next) - y->next->prev = y; - shm_start = y; -} - -#define MAPPED_MALLOC_DEBUG 0 - -bool mapped_malloc(Addrbank *ab) -{ - int id; - void *answer; - shmpiece *x; - bool rtgmem = (ab->flags & ABFLAG_RTG) != 0; - static int recurse; - - if (ab->allocated_size) { - write_log(_T("mapped_malloc with memory bank '%s' already allocated!?\n"), ab->name); - } - ab->allocated_size = 0; - - if (ab->label && ab->label[0] == '*') { - if (ab->start == 0 || ab->start == 0xffffffff) { - write_log(_T("mapped_malloc(*) without start address!\n")); - return false; - } - } - - struct uae_mman_data md = { 0 }; - uaecptr start = ab->start; - if (uae_mman_info(ab, &md)) { - start = md.start; - } - ab->startmask = start; - if (!md.directsupport || (ab->flags & ABFLAG_ALLOCINDIRECT)) { - if (!(ab->flags & ABFLAG_ALLOCINDIRECT)) { - if (canbang) { - write_log(_T("JIT direct switched off: %s\n"), ab->name); - } - nocanbang(); - } - ab->flags &= ~ABFLAG_DIRECTMAP; - if (ab->flags & ABFLAG_NOALLOC) { - ab->allocated_size = ab->reserved_size; -#if MAPPED_MALLOC_DEBUG - write_log(_T("mapped_malloc noalloc %s\n"), ab->name); -#endif - return true; - } - ab->baseaddr = xcalloc(uae_u8, ab->reserved_size + 4); - if (ab->baseaddr) { - // fill end of ram with ILLEGAL to catch direct PC falling out of RAM. - put_long_host(ab->baseaddr + ab->reserved_size, 0x4afc4afc); - ab->allocated_size = ab->reserved_size; - } -#if MAPPED_MALLOC_DEBUG - write_log(_T("mapped_malloc nodirect %s %p\n"), ab->name, ab->baseaddr); -#endif - return ab->baseaddr != NULL; - } - - id = uae_shmget(UAE_IPC_PRIVATE, ab, 0x1ff); - if (id == -1) { - nocanbang(); - if (recurse) - return NULL; - recurse++; - mapped_malloc(ab); - recurse--; - return ab->baseaddr != NULL; - } - if (!(ab->flags & ABFLAG_NOALLOC)) { - answer = uae_shmat(ab, id, 0, 0); - uae_shmctl(id, UAE_IPC_RMID, NULL); - } - else { - write_log(_T("MMAN: mapped_malloc using existing baseaddr %p\n"), ab->baseaddr); - answer = ab->baseaddr; - } - if (answer != (void *)-1) { - x = xmalloc(shmpiece, 1); - x->native_address = (uae_u8*)answer; - x->id = id; - x->size = ab->reserved_size; - x->name = ab->label; - x->next = shm_start; - x->prev = NULL; - if (x->next) - x->next->prev = x; - shm_start = x; - ab->baseaddr = x->native_address; - if (ab->baseaddr) { - if (md.hasbarrier) { - // fill end of ram with ILLEGAL to catch direct PC falling out of RAM. - put_long_host(ab->baseaddr + ab->reserved_size, 0x4afc4afc); - } - ab->allocated_size = ab->reserved_size; - } - ab->flags |= ABFLAG_DIRECTMAP; -#if MAPPED_MALLOC_DEBUG - write_log(_T("mapped_malloc direct %s %p\n"), ab->name, ab->baseaddr); -#endif - return ab->baseaddr != NULL; - } - if (recurse) - return NULL; - nocanbang(); - recurse++; - mapped_malloc(ab); - recurse--; -#if MAPPED_MALLOC_DEBUG - write_log(_T("mapped_malloc indirect %s %p\n"), ab->name, ab->baseaddr); -#endif - return ab->baseaddr != NULL; -} - -#endif - -static void init_mem_banks(void) +void init_mem_banks (void) { // unsigned so i << 16 won't overflow to negative when i >= 32768 - for (unsigned int i = 0; i < MEMORY_BANKS; i++) - put_mem_bank(i << 16, &dummy_bank, 0); -#ifdef NATMEM_OFFSET - delete_shmmaps(0, 0xFFFF0000); -#endif + for (unsigned int i = 0; i < MEMORY_BANKS; i++) + mem_banks[i] = &dummy_bank; } -static bool singlebit(uae_u32 v) +static bool singlebit (uae_u32 v) { while (v && !(v & 1)) v >>= 1; return (v & ~1) == 0; } -static void allocate_memory(void) +static void allocate_memory (void) { - bogomem_aliasing = 0; + mapped_free(&fakeuaebootrom_bank); - bool bogoreset = (bogomem_bank.flags & ABFLAG_NOALLOC) != 0 && - (chipmem_bank.reserved_size != currprefs.chipmem_size || bogomem_bank.reserved_size != currprefs.bogomem_size); - - if (bogoreset) { - mapped_free(&chipmem_bank); - mapped_free(&bogomem_bank); - } - - /* emulate 0.5M+0.5M with 1M Agnus chip ram aliasing */ - if (currprefs.chipmem_size == 0x80000 && currprefs.bogomem_size >= 0x80000 && - (currprefs.chipset_mask & CSMASK_ECS_AGNUS) && !(currprefs.chipset_mask & CSMASK_AGA) && currprefs.cpu_model < 68020) { - if ((chipmem_bank.reserved_size != currprefs.chipmem_size || bogomem_bank.reserved_size != currprefs.bogomem_size)) { - int memsize1, memsize2; - mapped_free(&chipmem_bank); - mapped_free(&bogomem_bank); - bogomem_bank.reserved_size = 0; - memsize1 = chipmem_bank.reserved_size = currprefs.chipmem_size; - memsize2 = bogomem_bank.reserved_size = currprefs.bogomem_size; - chipmem_bank.mask = chipmem_bank.reserved_size - 1; - chipmem_bank.start = chipmem_start_addr; - chipmem_full_mask = bogomem_bank.reserved_size * 2 - 1; - chipmem_full_size = 0x80000 * 2; - chipmem_bank.reserved_size = memsize1 + memsize2; - mapped_malloc(&chipmem_bank); - chipmem_bank.reserved_size = currprefs.chipmem_size; - chipmem_bank.allocated_size = currprefs.chipmem_size; - bogomem_bank.baseaddr = chipmem_bank.baseaddr + memsize1; - bogomem_bank.mask = bogomem_bank.reserved_size - 1; - bogomem_bank.start = bogomem_start_addr; - bogomem_bank.flags |= ABFLAG_NOALLOC; - bogomem_bank.allocated_size = bogomem_bank.reserved_size; - if (chipmem_bank.baseaddr == 0) { - write_log(_T("Fatal error: out of memory for chipmem.\n")); - chipmem_bank.reserved_size = 0; - } - else { - need_hardreset = true; - } - } - bogomem_aliasing = 1; - } - else if (currprefs.chipmem_size == 0x80000 && currprefs.bogomem_size >= 0x80000 && - !(currprefs.chipset_mask & CSMASK_ECS_AGNUS) && currprefs.cs_1mchipjumper && currprefs.cpu_model < 68020) { - if ((chipmem_bank.reserved_size != currprefs.chipmem_size || bogomem_bank.reserved_size != currprefs.bogomem_size)) { - int memsize1, memsize2; - mapped_free(&chipmem_bank); - mapped_free(&bogomem_bank); - bogomem_bank.reserved_size = 0; - memsize1 = chipmem_bank.reserved_size = currprefs.chipmem_size; - memsize2 = bogomem_bank.reserved_size = currprefs.bogomem_size; - chipmem_bank.mask = chipmem_bank.reserved_size - 1; - chipmem_bank.start = chipmem_start_addr; - chipmem_full_mask = chipmem_bank.reserved_size - 1; - chipmem_full_size = chipmem_bank.reserved_size; - chipmem_bank.reserved_size = memsize1 + memsize2; - mapped_malloc(&chipmem_bank); - chipmem_bank.reserved_size = currprefs.chipmem_size; - chipmem_bank.allocated_size = currprefs.chipmem_size; - bogomem_bank.baseaddr = chipmem_bank.baseaddr + memsize1; - bogomem_bank.mask = bogomem_bank.reserved_size - 1; - bogomem_bank.start = chipmem_bank.start + currprefs.chipmem_size; - bogomem_bank.flags |= ABFLAG_NOALLOC; - if (chipmem_bank.baseaddr == 0) { - write_log(_T("Fatal error: out of memory for chipmem.\n")); - chipmem_bank.reserved_size = 0; - } - else { - need_hardreset = true; - } - } - bogomem_aliasing = 2; - } - - if (chipmem_bank.reserved_size != currprefs.chipmem_size || bogoreset) { - int memsize; - mapped_free(&chipmem_bank); + if (chipmem_bank.reserved_size != currprefs.chipmem_size) { + int memsize; + mapped_free (&chipmem_bank); chipmem_bank.flags &= ~ABFLAG_NOALLOC; + if (currprefs.chipmem_size > 2 * 1024 * 1024) { + free_fastmemory (0); + } - memsize = chipmem_bank.reserved_size = chipmem_full_size = currprefs.chipmem_size; - chipmem_full_mask = chipmem_bank.mask = chipmem_bank.reserved_size - 1; + memsize = chipmem_bank.reserved_size = currprefs.chipmem_size; + chipmem_full_mask = chipmem_bank.mask = chipmem_bank.reserved_size - 1; chipmem_bank.start = chipmem_start_addr; if (!currprefs.cachesize && memsize < 0x100000) memsize = 0x100000; - if (memsize > 0x100000 && memsize < 0x200000) - memsize = 0x200000; + if (memsize > 0x100000 && memsize < 0x200000) + memsize = 0x200000; chipmem_bank.reserved_size = memsize; - mapped_malloc(&chipmem_bank); + mapped_malloc (&chipmem_bank); chipmem_bank.reserved_size = currprefs.chipmem_size; chipmem_bank.allocated_size = currprefs.chipmem_size; if (chipmem_bank.baseaddr == 0) { - write_log(_T("Fatal error: out of memory for chipmem.\n")); + write_log (_T("Fatal error: out of memory for chipmem.\n")); chipmem_bank.reserved_size = 0; - } - else { + } else { need_hardreset = true; - if (memsize > chipmem_bank.allocated_size) - memset(chipmem_bank.baseaddr + chipmem_bank.allocated_size, 0xff, memsize - chipmem_bank.allocated_size); - } - currprefs.chipset_mask = changed_prefs.chipset_mask; - chipmem_full_mask = chipmem_bank.allocated_size - 1; + if (memsize > chipmem_bank.allocated_size) + memset (chipmem_bank.baseaddr + chipmem_bank.allocated_size, 0xff, memsize - chipmem_bank.allocated_size); + } + currprefs.chipset_mask = changed_prefs.chipset_mask; + chipmem_full_mask = chipmem_bank.allocated_size - 1; if (!currprefs.cachesize) { - if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { - if (chipmem_bank.allocated_size < 0x100000) - chipmem_full_mask = 0x100000 - 1; - if (chipmem_bank.allocated_size > 0x100000 && chipmem_bank.allocated_size < 0x200000) - chipmem_full_mask = chipmem_bank.mask = 0x200000 - 1; - } - else if (currprefs.cs_1mchipjumper) { - chipmem_full_mask = 0x80000 - 1; - } + if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { + if (chipmem_bank.allocated_size < 0x100000) + chipmem_full_mask = 0x100000 - 1; + if (chipmem_bank.allocated_size > 0x100000 && chipmem_bank.allocated_size < 0x200000) + chipmem_full_mask = chipmem_bank.mask = 0x200000 - 1; + } + } + } + + if (bogomem_bank.reserved_size != currprefs.bogomem_size) { + mapped_free (&bogomem_bank); + bogomem_bank.reserved_size = 0; + + if(currprefs.bogomem_size > 0x1c0000) + currprefs.bogomem_size = 0x1c0000; + if (currprefs.bogomem_size > 0x180000 && ((changed_prefs.chipset_mask & CSMASK_AGA) || (currprefs.cpu_model >= 68020))) + currprefs.bogomem_size = 0x180000; + + bogomem_bank.reserved_size = currprefs.bogomem_size; + if (bogomem_bank.reserved_size >= 0x180000) + bogomem_bank.reserved_size = 0x200000; + bogomem_bank.mask = bogomem_bank.reserved_size - 1; + bogomem_bank.start = bogomem_start_addr; + + if (bogomem_bank.reserved_size) { + if (!mapped_malloc (&bogomem_bank)) { + write_log (_T("Out of memory for bogomem.\n")); + bogomem_bank.reserved_size = 0; + } } - } - - if (bogomem_bank.reserved_size != currprefs.bogomem_size || bogoreset) { - if (!(bogomem_bank.reserved_size == 0x200000 && currprefs.bogomem_size == 0x180000)) { - mapped_free(&bogomem_bank); - bogomem_bank.flags &= ~ABFLAG_NOALLOC; - bogomem_bank.reserved_size = 0; - - bogomem_bank.reserved_size = currprefs.bogomem_size; - if (bogomem_bank.reserved_size >= 0x180000) - bogomem_bank.reserved_size = 0x200000; - bogomem_bank.mask = bogomem_bank.reserved_size - 1; - bogomem_bank.start = bogomem_start_addr; - - if (bogomem_bank.reserved_size) { - if (!mapped_malloc(&bogomem_bank)) { - write_log(_T("Out of memory for bogomem.\n")); - bogomem_bank.reserved_size = 0; - } - } - need_hardreset = true; - } - } - if (mem25bit_bank.reserved_size != currprefs.mem25bit_size) { - mapped_free(&mem25bit_bank); - - mem25bit_bank.reserved_size = currprefs.mem25bit_size; - mem25bit_bank.mask = mem25bit_bank.reserved_size - 1; - mem25bit_bank.start = 0x01000000; - if (mem25bit_bank.reserved_size) { - if (!mapped_malloc(&mem25bit_bank)) { - write_log(_T("Out of memory for 25 bit memory.\n")); - mem25bit_bank.reserved_size = 0; - } - } - need_hardreset = true; + need_hardreset = true; } if (a3000lmem_bank.reserved_size != currprefs.mbresmem_low_size) { - mapped_free(&a3000lmem_bank); + mapped_free (&a3000lmem_bank); a3000lmem_bank.reserved_size = currprefs.mbresmem_low_size; a3000lmem_bank.mask = a3000lmem_bank.reserved_size - 1; a3000lmem_bank.start = 0x08000000 - a3000lmem_bank.reserved_size; if (a3000lmem_bank.reserved_size) { - if (!mapped_malloc(&a3000lmem_bank)) { - write_log(_T("Out of memory for a3000lowmem.\n")); + if (!mapped_malloc (&a3000lmem_bank)) { + write_log (_T("Out of memory for a3000lowmem.\n")); a3000lmem_bank.reserved_size = 0; } } need_hardreset = true; } if (a3000hmem_bank.reserved_size != currprefs.mbresmem_high_size) { - mapped_free(&a3000hmem_bank); + mapped_free (&a3000hmem_bank); a3000hmem_bank.reserved_size = currprefs.mbresmem_high_size; a3000hmem_bank.mask = a3000hmem_bank.reserved_size - 1; a3000hmem_bank.start = 0x08000000; if (a3000hmem_bank.reserved_size) { - if (!mapped_malloc(&a3000hmem_bank)) { - write_log(_T("Out of memory for a3000highmem.\n")); + if (!mapped_malloc (&a3000hmem_bank)) { + write_log (_T("Out of memory for a3000highmem.\n")); a3000hmem_bank.reserved_size = 0; } } need_hardreset = true; } -#ifdef CDTV - if (cardmem_bank.reserved_size != currprefs.cs_cdtvcard * 1024) { - mapped_free(&cardmem_bank); - cardmem_bank.baseaddr = NULL; - - cardmem_bank.reserved_size = currprefs.cs_cdtvcard * 1024; - cardmem_bank.mask = cardmem_bank.reserved_size - 1; - cardmem_bank.start = 0xe00000; - if (cardmem_bank.reserved_size) { - if (!mapped_malloc(&cardmem_bank)) { - write_log(_T("Out of memory for cardmem.\n")); - cardmem_bank.reserved_size = 0; - } - } - cdtv_loadcardmem(cardmem_bank.baseaddr, cardmem_bank.reserved_size); - } -#endif if (custmem1_bank.reserved_size != currprefs.custom_memory_sizes[0]) { - mapped_free(&custmem1_bank); + mapped_free (&custmem1_bank); custmem1_bank.reserved_size = currprefs.custom_memory_sizes[0]; // custmem1 and 2 can have non-power of 2 size so only set correct mask if size is power of 2. - custmem1_bank.mask = singlebit(custmem1_bank.reserved_size) ? custmem1_bank.reserved_size - 1 : -1; + custmem1_bank.mask = singlebit (custmem1_bank.reserved_size) ? custmem1_bank.reserved_size - 1 : -1; custmem1_bank.start = currprefs.custom_memory_addrs[0]; if (custmem1_bank.reserved_size) { - if (!mapped_malloc(&custmem1_bank)) + if (!mapped_malloc (&custmem1_bank)) custmem1_bank.reserved_size = 0; } } if (custmem2_bank.reserved_size != currprefs.custom_memory_sizes[1]) { - mapped_free(&custmem2_bank); + mapped_free (&custmem2_bank); custmem2_bank.reserved_size = currprefs.custom_memory_sizes[1]; - custmem2_bank.mask = singlebit(custmem2_bank.reserved_size) ? custmem2_bank.reserved_size - 1 : -1; + custmem2_bank.mask = singlebit (custmem2_bank.reserved_size) ? custmem2_bank.reserved_size - 1 : -1; custmem2_bank.start = currprefs.custom_memory_addrs[1]; if (custmem2_bank.reserved_size) { - if (!mapped_malloc(&custmem2_bank)) + if (!mapped_malloc (&custmem2_bank)) custmem2_bank.reserved_size = 0; } } - if (savestate_state == STATE_RESTORE) { - if (bootrom_filepos) { - protect_roms(false); - restore_ram(bootrom_filepos, rtarea_bank.baseaddr); - protect_roms(true); - } - restore_ram(chip_filepos, chipmem_bank.baseaddr); - if (bogomem_bank.allocated_size > 0) - restore_ram(bogo_filepos, bogomem_bank.baseaddr); - if (mem25bit_bank.allocated_size > 0) - restore_ram(mem25bit_filepos, mem25bit_bank.baseaddr); + if (savestate_state == STATE_RESTORE) { + if (bootrom_filepos) { + protect_roms (false); + restore_ram (bootrom_filepos, rtarea_bank.baseaddr); + protect_roms (true); + } + restore_ram (chip_filepos, chipmem_bank.baseaddr); + if (bogomem_bank.allocated_size > 0) + restore_ram (bogo_filepos, bogomem_bank.baseaddr); if (a3000lmem_bank.allocated_size > 0) - restore_ram(a3000lmem_filepos, a3000lmem_bank.baseaddr); + restore_ram (a3000lmem_filepos, a3000lmem_bank.baseaddr); if (a3000hmem_bank.allocated_size > 0) - restore_ram(a3000hmem_filepos, a3000hmem_bank.baseaddr); - } -#ifdef AGA - chipmem_bank_ce2.baseaddr = chipmem_bank.baseaddr; -#endif - bootrom_filepos = 0; - chip_filepos = 0; - bogo_filepos = 0; + restore_ram (a3000hmem_filepos, a3000hmem_bank.baseaddr); + } + bootrom_filepos = 0; + chip_filepos = 0; + bogo_filepos = 0; a3000lmem_filepos = 0; a3000hmem_filepos = 0; - //cpuboard_init(); } -static void fill_ce_banks(void) +void map_overlay (int chip) { - int i; + int size; + addrbank *cb; + + int currPC = m68k_getpc(); - if (currprefs.cpu_model <= 68010) { - memset(ce_banktype, CE_MEMBANK_FAST16, sizeof ce_banktype); - } - else { - memset(ce_banktype, CE_MEMBANK_FAST32, sizeof ce_banktype); - } - // data cachable regions (2 = burst supported) - memset(ce_cachable, 0, sizeof ce_cachable); - memset(ce_cachable + (0x00c00000 >> 16), 1, currprefs.bogomem_size >> 16); - for (int i = 0; i < MAX_RAM_BOARDS; i++) { - if (fastmem_bank[i].start != 0xffffffff) - memset(ce_cachable + (fastmem_bank[i].start >> 16), 1 | 2, currprefs.fastmem[i].size >> 16); - if (z3fastmem_bank[i].start != 0xffffffff) - memset(ce_cachable + (z3fastmem_bank[i].start >> 16), 1 | 2, currprefs.z3fastmem[i].size >> 16); - } - memset(ce_cachable + (a3000hmem_bank.start >> 16), 1 | 2, currprefs.mbresmem_high_size >> 16); - memset(ce_cachable + (a3000lmem_bank.start >> 16), 1 | 2, currprefs.mbresmem_low_size >> 16); - memset(ce_cachable + (mem25bit_bank.start >> 16), 1 | 2, currprefs.mem25bit_size >> 16); - - addrbank *ab = &get_mem_bank(0); - if (ab && (ab->flags & ABFLAG_CHIPRAM)) { - for (i = 0; i < (0x200000 >> 16); i++) { - ce_banktype[i] = (currprefs.cs_mbdmac || (currprefs.chipset_mask & CSMASK_AGA)) ? CE_MEMBANK_CHIP32 : CE_MEMBANK_CHIP16; - } - } - if (!currprefs.cs_slowmemisfast) { - for (i = (0xc00000 >> 16); i < (0xe00000 >> 16); i++) - ce_banktype[i] = ce_banktype[0]; - for (i = (bogomem_bank.start >> 16); i < ((bogomem_bank.start + bogomem_bank.allocated_size) >> 16); i++) - ce_banktype[i] = ce_banktype[0]; - } - for (i = (0xd00000 >> 16); i < (0xe00000 >> 16); i++) - ce_banktype[i] = CE_MEMBANK_CHIP16; - for (i = (0xa00000 >> 16); i < (0xc00000 >> 16); i++) { - addrbank *b; - ce_banktype[i] = CE_MEMBANK_CIA; - b = &get_mem_bank(i << 16); - if (b && !(b->flags & ABFLAG_CIA)) { - ce_banktype[i] = CE_MEMBANK_FAST32; - ce_cachable[i] = 1; - } - } - // CD32 ROM is 16-bit - if (currprefs.cs_cd32cd) { - for (i = (0xe00000 >> 16); i < (0xe80000 >> 16); i++) - ce_banktype[i] = CE_MEMBANK_FAST16; - for (i = (0xf80000 >> 16); i <= (0xff0000 >> 16); i++) - ce_banktype[i] = CE_MEMBANK_FAST16; - } - - // A4000T NCR is 32-bit - if (is_device_rom(&currprefs, ROMTYPE_SCSI_A4000T, 0) >= 0) { - ce_banktype[0xdd0000 >> 16] = CE_MEMBANK_FAST32; - } - - if (currprefs.address_space_24) { - for (i = 1; i < 256; i++) - memcpy(&ce_banktype[i * 256], &ce_banktype[0], 256); - } -} - -void map_overlay(int chip) -{ - int size; - addrbank *cb; - - size = chipmem_bank.allocated_size >= 0x180000 ? (chipmem_bank.allocated_size >> 16) : 32; - if (bogomem_aliasing) - size = 8; - cb = &chipmem_bank; -#ifdef AGA -#if 0 - if (currprefs.cpu_cycle_exact && currprefs.cpu_model >= 68020) - cb = &chipmem_bank_ce2; -#endif -#endif - if (chip) { - map_banks(&dummy_bank, 0, size, 0); - if (!isdirectjit()) { - if ((currprefs.chipset_mask & CSMASK_ECS_AGNUS) && bogomem_bank.allocated_size == 0) { - map_banks(cb, 0, size, chipmem_bank.allocated_size); - int start = chipmem_bank.allocated_size >> 16; - if (chipmem_bank.allocated_size < 0x100000) { - if (currprefs.cs_1mchipjumper) { - int dummy = (0x100000 - chipmem_bank.allocated_size) >> 16; - map_banks(&chipmem_dummy_bank, start, dummy, 0); - map_banks(&chipmem_dummy_bank, start + 16, dummy, 0); - } - } - else if (chipmem_bank.allocated_size < 0x200000 && chipmem_bank.allocated_size > 0x100000) { - int dummy = (0x200000 - chipmem_bank.allocated_size) >> 16; - map_banks(&chipmem_dummy_bank, start, dummy, 0); - } - } - else { - int mapsize = 32; - if ((chipmem_bank.allocated_size >> 16) > mapsize) - mapsize = chipmem_bank.allocated_size >> 16; - map_banks(cb, 0, mapsize, chipmem_bank.allocated_size); - } - } - else { - map_banks(cb, 0, chipmem_bank.allocated_size >> 16, 0); - } - } - else { - addrbank *rb = NULL; - if (size < 32 && bogomem_aliasing == 0) - size = 32; - cb = &get_mem_bank(0xf00000); - if (!rb && cb && (cb->flags & ABFLAG_ROM) && get_word(0xf00000) == 0x1114) - rb = cb; - cb = &get_mem_bank(0xe00000); - if (!rb && cb && (cb->flags & ABFLAG_ROM) && get_word(0xe00000) == 0x1114) - rb = cb; - if (!rb) - rb = &kickmem_bank; - map_banks(rb, 0, size, 0x80000); - } - fill_ce_banks(); - //cpuboard_overlay_override(); - if (!isrestore() && valid_address(regs.pc, 4)) - m68k_setpc_normal(m68k_getpc()); + size = chipmem_bank.allocated_size >= 0x180000 ? (chipmem_bank.allocated_size >> 16) : 32; + cb = &chipmem_bank; + if (chip) { + map_banks (&dummy_bank, 0, size, 0); + map_banks (cb, 0, size, chipmem_bank.allocated_size); + } else { + addrbank *rb = NULL; + if (size < 32) + size = 32; + cb = &get_mem_bank (0xf00000); + if (!rb && cb && (cb->flags & ABFLAG_ROM) && get_word (0xf00000) == 0x1114) + rb = cb; + cb = &get_mem_bank (0xe00000); + if (!rb && cb && (cb->flags & ABFLAG_ROM) && get_word (0xe00000) == 0x1114) + rb = cb; + if (!rb) + rb = &kickmem_bank; + map_banks (rb, 0, size, 0x80000); + } + if (!isrestore () && valid_address (regs.pc, 4)) + m68k_setpc_normal (currPC); } static void map_banks_set(addrbank *bank, int start, int size, int realsize) { - bank->startmask = start << 16; map_banks(bank, start, size, realsize); } -void memory_clear(void) +void memory_clear (void) { mem_hardreset = 0; if (savestate_state == STATE_RESTORE) return; if (chipmem_bank.baseaddr) - memset(chipmem_bank.baseaddr, 0, chipmem_bank.allocated_size); + memset (chipmem_bank.baseaddr, 0, chipmem_bank.allocated_size); if (bogomem_bank.baseaddr) - memset(bogomem_bank.baseaddr, 0, bogomem_bank.allocated_size); - if (mem25bit_bank.baseaddr) - memset(mem25bit_bank.baseaddr, 0, mem25bit_bank.allocated_size); + memset (bogomem_bank.baseaddr, 0, bogomem_bank.allocated_size); if (a3000lmem_bank.baseaddr) memset(a3000lmem_bank.baseaddr, 0, a3000lmem_bank.allocated_size); if (a3000hmem_bank.baseaddr) memset(a3000hmem_bank.baseaddr, 0, a3000hmem_bank.allocated_size); - expansion_clear(); - //cpuboard_clear(); + expansion_clear (); } static void restore_roms(void) { - roms_modified = false; - protect_roms(false); - write_log(_T("ROM loader.. (%s)\n"), currprefs.romfile); - kickstart_rom = 1; - a1000_handle_kickstart(0); - xfree(a1000_bootrom); - a1000_bootrom = 0; - a1000_kickstart_mode = 0; + protect_roms (false); + write_log (_T("ROM loader.. (%s)\n"), currprefs.romfile); + kickstart_rom = 1; - memcpy(currprefs.romfile, changed_prefs.romfile, sizeof currprefs.romfile); - memcpy(currprefs.romextfile, changed_prefs.romextfile, sizeof currprefs.romextfile); + memcpy (currprefs.romfile, changed_prefs.romfile, sizeof currprefs.romfile); + memcpy (currprefs.romextfile, changed_prefs.romextfile, sizeof currprefs.romextfile); need_hardreset = true; - mapped_free(&extendedkickmem_bank); - mapped_free(&extendedkickmem2_bank); - extendedkickmem_bank.reserved_size = 0; + mapped_free (&extendedkickmem_bank); + mapped_free (&extendedkickmem2_bank); + extendedkickmem_bank.reserved_size = 0; extendedkickmem2_bank.reserved_size = 0; extendedkickmem_type = 0; - load_extendedkickstart(currprefs.romextfile, 0); - load_extendedkickstart(currprefs.romextfile2, EXTENDED_ROM_CDTV); + load_extendedkickstart (currprefs.romextfile, 0); kickmem_bank.mask = ROM_SIZE_512 - 1; - if (!load_kickstart()) { - if (_tcslen(currprefs.romfile) > 0) { - error_log(_T("Failed to open '%s'\n"), currprefs.romfile); - notify_user(NUMSG_NOROM); - } - load_kickstart_replacement(); - } - else { - struct romdata *rd = getromdatabydata(kickmem_bank.baseaddr, kickmem_bank.reserved_size); - if (rd) { - write_log(_T("Known ROM '%s' loaded\n"), rd->name); -#if 1 + if (!load_kickstart ()) { + if (_tcslen (currprefs.romfile) > 0) { + error_log (_T("Failed to open '%s'\n"), currprefs.romfile); + notify_user (NUMSG_NOROM); + } + load_kickstart_replacement (); + } else { + struct romdata *rd = getromdatabydata (kickmem_bank.baseaddr, kickmem_bank.reserved_size); + if (rd) { + write_log (_T("Known ROM '%s' loaded\n"), rd->name); if ((rd->cpu & 8) && changed_prefs.cpu_model < 68030) { - notify_user(NUMSG_KS68030PLUS); - uae_restart(-1, NULL); - } - else if ((rd->cpu & 3) == 3 && changed_prefs.cpu_model != 68030) { - notify_user(NUMSG_KS68030); - uae_restart(-1, NULL); - } - else if ((rd->cpu & 3) == 1 && changed_prefs.cpu_model < 68020) { - notify_user(NUMSG_KS68EC020); - uae_restart(-1, NULL); - } - else if ((rd->cpu & 3) == 2 && (changed_prefs.cpu_model < 68020 || changed_prefs.address_space_24)) { - notify_user(NUMSG_KS68020); - uae_restart(-1, NULL); - } -#endif - if (rd->cloanto) - cloanto_rom = 1; - kickstart_rom = 0; + notify_user (NUMSG_KS68030PLUS); + uae_restart (-1, NULL); + } else if ((rd->cpu & 3) == 3 && changed_prefs.cpu_model != 68030) { + notify_user (NUMSG_KS68030); + uae_restart (-1, NULL); + } else if ((rd->cpu & 3) == 1 && changed_prefs.cpu_model < 68020) { + notify_user (NUMSG_KS68EC020); + uae_restart (-1, NULL); + } else if ((rd->cpu & 3) == 2 && (changed_prefs.cpu_model < 68020 || changed_prefs.address_space_24)) { + notify_user (NUMSG_KS68020); + uae_restart (-1, NULL); + } + if (rd->cloanto) + cloanto_rom = 1; + kickstart_rom = 0; if ((rd->type & (ROMTYPE_SPECIALKICK | ROMTYPE_KICK)) == ROMTYPE_KICK) - kickstart_rom = 1; + kickstart_rom = 1; if ((rd->cpu & 4) && currprefs.cs_compatible) { /* A4000 ROM = need ramsey, gary and ide */ if (currprefs.cs_ramseyrev < 0) @@ -2238,15 +1130,14 @@ static void restore_roms(void) changed_prefs.cs_fatgaryrev = currprefs.cs_fatgaryrev = 0; if (currprefs.cs_ide != IDE_A4000) changed_prefs.cs_ide = currprefs.cs_ide = -1; - } - } - else { - write_log(_T("Unknown ROM '%s' loaded\n"), currprefs.romfile); - } - } - patch_kick(); - write_log(_T("ROM loader end\n")); - protect_roms(true); + } + } else { + write_log (_T("Unknown ROM '%s' loaded\n"), currprefs.romfile); + } + } + patch_kick (); + write_log (_T("ROM loader end\n")); + protect_roms (true); } bool read_kickstart_version(struct uae_prefs *p) @@ -2270,244 +1161,170 @@ bool read_kickstart_version(struct uae_prefs *p) return true; } -void reload_roms(void) +void memory_reset (void) { - if (roms_modified) - restore_roms(); -} - -void memory_restore(void) -{ - last_address_space_24 = currprefs.address_space_24; - //cpuboard_map(); - map_banks_set(&kickmem_bank, 0xF8, 8, 0); -} - -void memory_reset(void) -{ - int bnk, bnk_end; + int bnk, bnk_end; bool gayleorfatgary; - //alg_flag = 0; + need_hardreset = false; - rom_write_enabled = true; /* Use changed_prefs, as m68k_reset is called later. */ if (last_address_space_24 != changed_prefs.address_space_24) need_hardreset = true; last_address_space_24 = changed_prefs.address_space_24; if (mem_hardreset > 2) - memory_init(); + memory_init (); - be_cnt = 0; - currprefs.chipmem_size = changed_prefs.chipmem_size; - currprefs.bogomem_size = changed_prefs.bogomem_size; + be_cnt = be_recursive = 0; + currprefs.chipmem_size = changed_prefs.chipmem_size; + currprefs.bogomem_size = changed_prefs.bogomem_size; currprefs.mbresmem_low_size = changed_prefs.mbresmem_low_size; currprefs.mbresmem_high_size = changed_prefs.mbresmem_high_size; currprefs.cs_ksmirror_e0 = changed_prefs.cs_ksmirror_e0; currprefs.cs_ksmirror_a8 = changed_prefs.cs_ksmirror_a8; currprefs.cs_ciaoverlay = changed_prefs.cs_ciaoverlay; - currprefs.cs_cdtvram = changed_prefs.cs_cdtvram; - currprefs.cs_cdtvcard = changed_prefs.cs_cdtvcard; - currprefs.cs_a1000ram = changed_prefs.cs_a1000ram; currprefs.cs_ide = changed_prefs.cs_ide; currprefs.cs_fatgaryrev = changed_prefs.cs_fatgaryrev; currprefs.cs_ramseyrev = changed_prefs.cs_ramseyrev; - //cpuboard_reset(); - gayleorfatgary = ((currprefs.chipset_mask & CSMASK_AGA) || currprefs.cs_pcmcia || currprefs.cs_ide > 0 || currprefs.cs_mbdmac) && !currprefs.cs_cd32cd; + gayleorfatgary = ((currprefs.chipset_mask & CSMASK_AGA) || currprefs.cs_pcmcia || currprefs.cs_ide > 0) && !currprefs.cs_cd32cd; - init_mem_banks(); - allocate_memory(); - chipmem_setindirect(); + init_mem_banks (); + allocate_memory (); - if (mem_hardreset > 1 || ((roms_modified || a1000_bootrom)) //&& is_hardreset()) - || _tcscmp(currprefs.romfile, changed_prefs.romfile) != 0 - || _tcscmp(currprefs.romextfile, changed_prefs.romextfile) != 0) - { + if (mem_hardreset > 1 + || _tcscmp (currprefs.romfile, changed_prefs.romfile) != 0 + || _tcscmp (currprefs.romextfile, changed_prefs.romextfile) != 0) + { restore_roms(); - } + } - if ((cloanto_rom || extendedkickmem_bank.allocated_size) && currprefs.maprom && currprefs.maprom < 0x01000000) { - currprefs.maprom = changed_prefs.maprom = 0x00a80000; - if (extendedkickmem2_bank.allocated_size) // can't do if 2M ROM - currprefs.maprom = changed_prefs.maprom = 0; - } + map_banks (&custom_bank, 0xC0, 0xE0 - 0xC0, 0); + map_banks (&cia_bank, 0xA0, 32, 0); + if (currprefs.cs_rtc != 3) + /* D80000 - DDFFFF not mapped (A1000 or A2000 = custom chips) */ + map_banks (&dummy_bank, 0xD8, 6, 0); - map_banks(&custom_bank, 0xC0, 0xE0 - 0xC0, 0); - map_banks(&cia_bank, 0xA0, 32, 0); - if (!currprefs.cs_a1000ram && currprefs.cs_rtc != 3) - /* D80000 - DDFFFF not mapped (A1000 or A2000 = custom chips) */ - map_banks(&dummy_bank, 0xD8, 6, 0); - - /* map "nothing" to 0x200000 - 0x9FFFFF (0xBEFFFF if Gayle or Fat Gary) */ - bnk = chipmem_bank.allocated_size >> 16; - if (bnk < 0x20 + (currprefs.fastmem[0].size >> 16)) - bnk = 0x20 + (currprefs.fastmem[0].size >> 16); + /* map "nothing" to 0x200000 - 0x9FFFFF (0xBEFFFF if Gayle or Fat Gary) */ + bnk = chipmem_bank.allocated_size >> 16; + if (bnk < 0x20 + (currprefs.fastmem[0].size >> 16)) + bnk = 0x20 + (currprefs.fastmem[0].size >> 16); bnk_end = currprefs.cs_cd32cd ? 0xBE : (gayleorfatgary ? 0xBF : 0xA0); - map_banks(&dummy_bank, bnk, bnk_end - bnk, 0); - if (gayleorfatgary) { - // a3000 or a4000 = custom chips from 0xc0 to 0xd0 - if (currprefs.cs_ide == IDE_A4000 || currprefs.cs_mbdmac) - map_banks(&dummy_bank, 0xd0, 8, 0); + map_banks (&dummy_bank, bnk, bnk_end - bnk, 0); + if (gayleorfatgary) { + // a3000 or a4000 = custom chips from 0xc0 to 0xd0 + if (currprefs.cs_ide == IDE_A4000) + map_banks (&dummy_bank, 0xd0, 8, 0); else - map_banks(&dummy_bank, 0xc0, 0xd8 - 0xc0, 0); - } - else if (currprefs.cs_cd32cd) { + map_banks (&dummy_bank, 0xc0, 0xd8 - 0xc0, 0); + } else if (currprefs.cs_cd32cd) { // CD32: 0xc0 to 0xd0 map_banks(&dummy_bank, 0xd0, 8, 0); // strange 64k custom mirror map_banks(&custom_bank, 0xb9, 1, 0); - } + } - if (bogomem_bank.baseaddr) { - int t = currprefs.bogomem_size >> 16; - if (t > 0x1C) - t = 0x1C; - if (t > 0x18 && ((currprefs.chipset_mask & CSMASK_AGA) || (currprefs.cpu_model >= 68020 && !currprefs.address_space_24))) - t = 0x18; - if (bogomem_aliasing == 2) - map_banks(&bogomem_bank, 0x08, t, 0); - else - map_banks(&bogomem_bank, 0xC0, t, 0); - } - //if (currprefs.cs_ide || currprefs.cs_pcmcia) { - // if (currprefs.cs_ide == IDE_A600A1200 || currprefs.cs_pcmcia) { - // map_banks(&gayle_bank, 0xD8, 6, 0); - // map_banks(&gayle2_bank, 0xDD, 2, 0); - // } - // //gayle_map_pcmcia(); - // if (currprefs.cs_ide == IDE_A4000 || is_device_rom(&currprefs, ROMTYPE_SCSI_A4000T, 0)) - // map_banks(&gayle_bank, 0xDD, 1, 0); - // if (currprefs.cs_ide < 0 && !currprefs.cs_pcmcia) - // map_banks(&gayle_bank, 0xD8, 6, 0); - // if (currprefs.cs_ide < 0) - // map_banks(&gayle_bank, 0xDD, 1, 0); - //} + if (bogomem_bank.baseaddr) { + int t = currprefs.bogomem_size >> 16; + if (t > 0x1C) + t = 0x1C; + if (t > 0x18 && ((currprefs.chipset_mask & CSMASK_AGA) || (currprefs.cpu_model >= 68020 && !currprefs.address_space_24))) + t = 0x18; + map_banks (&bogomem_bank, 0xC0, t, 0); + } + if (currprefs.cs_ide || currprefs.cs_pcmcia) { + if (currprefs.cs_ide == IDE_A600A1200 || currprefs.cs_pcmcia) { + map_banks (&gayle_bank, 0xD8, 6, 0); + map_banks (&gayle2_bank, 0xDD, 2, 0); + } + gayle_map_pcmcia (); + if (currprefs.cs_ide == IDE_A4000) + map_banks (&gayle_bank, 0xDD, 1, 0); + if (currprefs.cs_ide < 0 && !currprefs.cs_pcmcia) + map_banks (&gayle_bank, 0xD8, 6, 0); + if (currprefs.cs_ide < 0) + map_banks (&gayle_bank, 0xDD, 1, 0); + } if (currprefs.cs_rtc == 3) // A2000 clock - map_banks(&clock_bank, 0xD8, 4, 0); - if (currprefs.cs_rtc == 1 || currprefs.cs_rtc == 2 || currprefs.cs_cdtvram) - map_banks(&clock_bank, 0xDC, 1, 0); + map_banks (&clock_bank, 0xD8, 4, 0); + if (currprefs.cs_rtc == 1 || currprefs.cs_rtc == 2) + map_banks (&clock_bank, 0xDC, 1, 0); else if (currprefs.cs_ksmirror_a8 || currprefs.cs_ide > 0 || currprefs.cs_pcmcia) - map_banks(&clock_bank, 0xDC, 1, 0); /* none clock */ - //if (currprefs.cs_fatgaryrev >= 0 || currprefs.cs_ramseyrev >= 0) - // map_banks(&mbres_bank, 0xDE, 1, 0); + map_banks (&clock_bank, 0xDC, 1, 0); /* none clock */ + if (currprefs.cs_fatgaryrev >= 0 || currprefs.cs_ramseyrev >= 0) + map_banks (&mbres_bank, 0xDE, 1, 0); #ifdef CD32 - //if (currprefs.cs_cd32c2p || currprefs.cs_cd32cd || currprefs.cs_cd32nvram) { - // map_banks(&akiko_bank, AKIKO_BASE >> 16, 1, 0); - // map_banks(&gayle2_bank, 0xDD, 2, 0); - //} + if (currprefs.cs_cd32c2p || currprefs.cs_cd32cd || currprefs.cs_cd32nvram) { + map_banks (&akiko_bank, AKIKO_BASE >> 16, 1, 0); + map_banks (&gayle2_bank, 0xDD, 2, 0); + } #endif - if (mem25bit_bank.baseaddr) - map_banks(&mem25bit_bank, mem25bit_bank.start >> 16, mem25bit_bank.allocated_size >> 16, 0); + if (a3000lmem_bank.baseaddr) map_banks(&a3000lmem_bank, a3000lmem_bank.start >> 16, a3000lmem_bank.allocated_size >> 16, 0); if (a3000hmem_bank.baseaddr) map_banks(&a3000hmem_bank, a3000hmem_bank.start >> 16, a3000hmem_bank.allocated_size >> 16, 0); -#ifdef CDTV - if (cardmem_bank.baseaddr) - map_banks(&cardmem_bank, cardmem_bank.start >> 16, cardmem_bank.allocated_size >> 16, 0); -#endif - //cpuboard_map(); - map_banks_set(&kickmem_bank, 0xF8, 8, 0); - if (currprefs.maprom) { - //if (!cpuboard_maprom()) - map_banks_set(&kickram_bank, currprefs.maprom >> 16, extendedkickmem2_bank.allocated_size ? 32 : (extendedkickmem_bank.allocated_size ? 16 : 8), 0); - } - /* map beta Kickstarts at 0x200000/0xC00000/0xF00000 */ - if (kickmem_bank.baseaddr[0] == 0x11 && kickmem_bank.baseaddr[2] == 0x4e && kickmem_bank.baseaddr[3] == 0xf9 && kickmem_bank.baseaddr[4] == 0x00) { - uae_u32 addr = kickmem_bank.baseaddr[5]; + map_banks_set(&kickmem_bank, 0xF8, 8, 0); + /* map beta Kickstarts at 0x200000/0xC00000/0xF00000 */ + if (kickmem_bank.baseaddr[0] == 0x11 && kickmem_bank.baseaddr[2] == 0x4e && kickmem_bank.baseaddr[3] == 0xf9 && kickmem_bank.baseaddr[4] == 0x00) { + uae_u32 addr = kickmem_bank.baseaddr[5]; if (addr == 0x20 && currprefs.chipmem_size <= 0x200000 && currprefs.fastmem[0].size == 0) - map_banks_set(&kickmem_bank, addr, 8, 0); + map_banks_set(&kickmem_bank, addr, 8, 0); if (addr == 0xC0 && currprefs.bogomem_size == 0) - map_banks_set(&kickmem_bank, addr, 8, 0); - if (addr == 0xF0) - map_banks_set(&kickmem_bank, addr, 8, 0); - } - - if (a1000_bootrom) - a1000_handle_kickstart(1); + map_banks_set(&kickmem_bank, addr, 8, 0); + if (addr == 0xF0) + map_banks_set(&kickmem_bank, addr, 8, 0); + } #ifdef AUTOCONFIG expansion_map(); #endif - if (a3000_f0) - map_banks_set(&extendedkickmem_bank, 0xf0, 1, 0); + /* Map the chipmem into all of the lower 8MB */ + map_overlay (1); - /* Map the chipmem into all of the lower 8MB */ - map_overlay(1); - - switch (extendedkickmem_type) { - case EXTENDED_ROM_KS: - map_banks_set(&extendedkickmem_bank, 0xE0, 8, 0); - break; -#ifdef CDTV - case EXTENDED_ROM_CDTV: - map_banks_set(&extendedkickmem_bank, 0xF0, extendedkickmem_bank.allocated_size == 2 * ROM_SIZE_512 ? 16 : 8, 0); - break; -#endif + switch (extendedkickmem_type) { + case EXTENDED_ROM_KS: + map_banks_set(&extendedkickmem_bank, 0xE0, 8, 0); + break; #ifdef CD32 - case EXTENDED_ROM_CD32: - map_banks_set(&extendedkickmem_bank, 0xE0, 8, 0); - break; + case EXTENDED_ROM_CD32: + map_banks_set(&extendedkickmem_bank, 0xE0, 8, 0); + break; #endif - case EXTENDED_ROM_ALG: - map_banks_set(&extendedkickmem_bank, 0xF0, 4, 0); - //alg_map_banks(); - break; - } + } #ifdef AUTOCONFIG - if (need_uae_boot_rom(&currprefs) && currprefs.uaeboard < 2) - map_banks_set(&rtarea_bank, rtarea_base >> 16, 1, 0); + if (need_uae_boot_rom (&currprefs)) + map_banks_set(&rtarea_bank, rtarea_base >> 16, 1, 0); #endif - if ((cloanto_rom || currprefs.cs_ksmirror_e0) && (currprefs.maprom != 0xe00000) && !extendedkickmem_type) { - map_banks(&kickmem_bank, 0xE0, 8, 0); - } + if ((cloanto_rom || currprefs.cs_ksmirror_e0) && !extendedkickmem_type) { + map_banks (&kickmem_bank, 0xE0, 8, 0); + } if (currprefs.cs_ksmirror_a8) { if (extendedkickmem2_bank.allocated_size) { map_banks_set(&extendedkickmem2_bank, 0xa8, 16, 0); - } - else { - struct romdata *rd = getromdatabypath(currprefs.cartfile); - if (!rd || rd->id != 63) { - if (extendedkickmem_type == EXTENDED_ROM_CD32 || extendedkickmem_type == EXTENDED_ROM_KS) - map_banks(&extendedkickmem_bank, 0xb0, 8, 0); - else - map_banks(&kickmem_bank, 0xb0, 8, 0); - map_banks(&kickmem_bank, 0xa8, 8, 0); - } - } - } - -#ifdef ARCADIA - if (is_arcadia_rom(currprefs.romextfile) == ARCADIA_BIOS) { - if (_tcscmp(currprefs.romextfile, changed_prefs.romextfile) != 0) - memcpy(currprefs.romextfile, changed_prefs.romextfile, sizeof currprefs.romextfile); - if (_tcscmp(currprefs.cartfile, changed_prefs.cartfile) != 0) - memcpy(currprefs.cartfile, changed_prefs.cartfile, sizeof currprefs.cartfile); - arcadia_unmap(); - is_arcadia_rom(currprefs.romextfile); - is_arcadia_rom(currprefs.cartfile); - arcadia_map_banks(); - } -#endif + } else { + struct romdata *rd = getromdatabypath (currprefs.cartfile); + if (!rd || rd->id != 63) { + if (extendedkickmem_type == EXTENDED_ROM_CD32 || extendedkickmem_type == EXTENDED_ROM_KS) + map_banks (&extendedkickmem_bank, 0xb0, 8, 0); + else + map_banks (&kickmem_bank, 0xb0, 8, 0); + map_banks (&kickmem_bank, 0xa8, 8, 0); + } + } + } #ifdef ACTION_REPLAY -#ifdef ARCADIA - if (!arcadia_bios) { -#endif - action_replay_memory_reset(); -#ifdef ARCADIA - } -#endif + action_replay_memory_reset (); #endif for (int i = 0; i < 2; i++) { if (currprefs.custom_memory_sizes[i]) { - map_banks(i == 0 ? &custmem1_bank : &custmem2_bank, + map_banks (i == 0 ? &custmem1_bank : &custmem2_bank, currprefs.custom_memory_addrs[i] >> 16, currprefs.custom_memory_sizes[i] >> 16, 0); if (currprefs.custom_memory_mask[i]) { @@ -2519,102 +1336,79 @@ void memory_reset(void) } if (mem_hardreset) { - memory_clear(); + memory_clear (); } - write_log(_T("memory init end\n")); + write_log (_T("memory init end\n")); } -void memory_init(void) +void memory_init (void) { - init_mem_banks(); - virtualdevice_init(); + init_mem_banks (); + virtualdevice_init (); - chipmem_bank.reserved_size = 0; - bogomem_bank.reserved_size = 0; - kickmem_bank.baseaddr = NULL; - extendedkickmem_bank.baseaddr = NULL; - extendedkickmem_bank.reserved_size = 0; - extendedkickmem2_bank.baseaddr = NULL; - extendedkickmem2_bank.reserved_size = 0; - extendedkickmem_type = 0; - chipmem_bank.baseaddr = 0; - mem25bit_bank.reserved_size = mem25bit_bank.reserved_size = 0; + chipmem_bank.reserved_size = 0; + bogomem_bank.reserved_size = 0; + kickmem_bank.baseaddr = NULL; + extendedkickmem_bank.baseaddr = NULL; + extendedkickmem_bank.reserved_size = 0; + extendedkickmem2_bank.baseaddr = NULL; + extendedkickmem2_bank.reserved_size = 0; + extendedkickmem_type = 0; + chipmem_bank.baseaddr = 0; a3000lmem_bank.reserved_size = a3000hmem_bank.reserved_size = 0; a3000lmem_bank.baseaddr = a3000hmem_bank.baseaddr = NULL; - bogomem_bank.baseaddr = NULL; - cardmem_bank.baseaddr = NULL; + bogomem_bank.baseaddr = NULL; custmem1_bank.reserved_size = custmem2_bank.reserved_size = 0; custmem1_bank.baseaddr = NULL; custmem2_bank.baseaddr = NULL; kickmem_bank.reserved_size = ROM_SIZE_512; - mapped_malloc(&kickmem_bank); - memset(kickmem_bank.baseaddr, 0, ROM_SIZE_512); - _tcscpy(currprefs.romfile, _T("")); - currprefs.romextfile[0] = 0; - //cpuboard_reset(); + mapped_malloc (&kickmem_bank); + memset (kickmem_bank.baseaddr, 0, ROM_SIZE_512); + _tcscpy (currprefs.romfile, _T("")); + currprefs.romextfile[0] = 0; #ifdef ACTION_REPLAY - action_replay_unload(0); - action_replay_load(); - action_replay_init(1); + action_replay_unload (0); + action_replay_load (); + action_replay_init (1); #ifdef ACTION_REPLAY_HRTMON - hrtmon_load(); + hrtmon_load (); #endif #endif } -void memory_cleanup(void) +void memory_cleanup (void) { - mapped_free(&mem25bit_bank); mapped_free(&a3000lmem_bank); mapped_free(&a3000hmem_bank); - mapped_free(&bogomem_bank); - mapped_free(&kickmem_bank); - xfree(a1000_bootrom); - mapped_free(&chipmem_bank); -#ifdef CDTV - if (cardmem_bank.baseaddr) { - cdtv_savecardmem(cardmem_bank.baseaddr, cardmem_bank.allocated_size); - mapped_free(&cardmem_bank); - } -#endif - mapped_free(&custmem1_bank); - mapped_free(&custmem2_bank); - - bogomem_bank.baseaddr = NULL; - kickmem_bank.baseaddr = NULL; - mem25bit_bank.baseaddr = NULL; + mapped_free (&bogomem_bank); + mapped_free (&kickmem_bank); + mapped_free (&chipmem_bank); + mapped_free (&custmem1_bank); + mapped_free (&custmem2_bank); + mapped_free(&fakeuaebootrom_bank); + + bogomem_bank.baseaddr = NULL; + kickmem_bank.baseaddr = NULL; a3000lmem_bank.baseaddr = a3000hmem_bank.baseaddr = NULL; - a1000_bootrom = NULL; - a1000_kickstart_mode = 0; - chipmem_bank.baseaddr = NULL; - cardmem_bank.baseaddr = NULL; + chipmem_bank.baseaddr = NULL; custmem1_bank.baseaddr = NULL; custmem2_bank.baseaddr = NULL; - - //cpuboard_cleanup(); + #ifdef ACTION_REPLAY action_replay_cleanup(); #endif -#ifdef ARCADIA - arcadia_unmap(); -#endif } -void set_roms_modified(void) -{ - roms_modified = true; -} - -void memory_hardreset(int mode) +void memory_hardreset (int mode) { if (mode + 1 > mem_hardreset) mem_hardreset = mode + 1; } // do not map if it conflicts with custom banks -void map_banks_cond(addrbank *bank, int start, int size, int realsize) +void map_banks_cond (addrbank *bank, int start, int size, int realsize) { for (int i = 0; i < MAX_CUSTOM_MEMORY_ADDRS; i++) { int cstart = currprefs.custom_memory_addrs[i] >> 16; @@ -2628,221 +1422,61 @@ void map_banks_cond(addrbank *bank, int start, int size, int realsize) if (cstart <= start && (cstart + size >= start || start + size > cstart)) return; } - map_banks(bank, start, size, realsize); + map_banks (bank, start, size, realsize); } -#ifdef WITH_THREADED_CPU - -struct addrbank_thread { - Addrbank *orig; - Addrbank ab; -}; - -#define MAX_THREAD_BANKS 200 -static addrbank_thread *thread_banks[MAX_THREAD_BANKS]; -static Addrbank *thread_mem_banks[MEMORY_BANKS]; -static int thread_banks_used; - -static void REGPARAM2 threadcpu_lput(uaecptr addr, uae_u32 l) +static void map_banks2 (addrbank *bank, int start, int size, int realsize, int quick) { - cpu_semaphore_get(); - thread_mem_banks[bankindex(addr)]->lput(addr, l); - cpu_semaphore_release(); -} + int bnr; + unsigned long int hioffs = 0, endhioffs = 0x100; + uae_u32 realstart = start; -static void REGPARAM2 threadcpu_wput(uaecptr addr, uae_u32 w) -{ - cpu_semaphore_get(); - thread_mem_banks[bankindex(addr)]->wput(addr, w); - cpu_semaphore_release(); -} + flush_icache_hard (3); /* Sure don't want to keep any old mappings around! */ -static void REGPARAM2 threadcpu_bput(uaecptr addr, uae_u32 b) -{ - cpu_semaphore_get(); - thread_mem_banks[bankindex(addr)]->bput(addr, b); - cpu_semaphore_release(); -} -static uae_u32 REGPARAM2 threadcpu_lget(uaecptr addr) -{ - cpu_semaphore_get(); - uae_u32 v = thread_mem_banks[bankindex(addr)]->lget(addr); - cpu_semaphore_release(); - return v; -} -static uae_u32 REGPARAM2 threadcpu_wget(uaecptr addr) -{ - cpu_semaphore_get(); - uae_u32 v = thread_mem_banks[bankindex(addr)]->wget(addr); - cpu_semaphore_release(); - return v; -} -uae_u32 REGPARAM2 threadcpu_bget(uaecptr addr) -{ - cpu_semaphore_get(); - uae_u32 v = thread_mem_banks[bankindex(addr)]->bget(addr); - cpu_semaphore_release(); - return v; -} + if (!realsize) + realsize = size << 16; -static Addrbank *get_bank_cpu_thread(Addrbank *bank) -{ - if (bank->flags & ABFLAG_THREADSAFE) - return bank; - if (bank == &dummy_bank) - return bank; - - for (int i = 0; i < thread_banks_used; i++) { - if (thread_banks[i]->orig == bank) { - return &thread_banks[i]->ab; - } - } - struct addrbank_thread *at = thread_banks[thread_banks_used]; - if (!at) - at = xcalloc(addrbank_thread, 1); - thread_banks[thread_banks_used++] = at; - at->orig = bank; - memcpy(&at->ab, bank, sizeof Addrbank); - Addrbank *tb = &at->ab; - tb->lget = threadcpu_lget; - tb->wget = threadcpu_wget; - tb->bget = threadcpu_bget; - tb->lput = threadcpu_lput; - tb->wput = threadcpu_wput; - tb->bput = threadcpu_bput; - // wgeti/lgeti should always point to real RAM - return tb; -} -#endif - -static void map_banks2(addrbank *bank, int start, int size, int realsize, int quick) -{ - int bnr, old; - unsigned long int hioffs = 0, endhioffs = 0x100; - uae_u32 realstart = start; - addrbank *orig_bank = NULL; - -#ifdef WITH_THREADED_CPU - if (currprefs.cpu_thread) { - Addrbank *b = bank; - bank = get_bank_cpu_thread(bank); - if (b != bank) - orig_bank = b; - } -#endif - - //if (quick <= 0) - // old = debug_bankchange(-1); - flush_icache_hard(0, 3); /* Sure don't want to keep any old mappings around! */ -#ifdef NATMEM_OFFSET - if (!quick) - delete_shmmaps(start << 16, size << 16); -#endif - - if (!realsize) - realsize = size << 16; - - if ((size << 16) < realsize) { - write_log(_T("Broken mapping, size=%x, realsize=%x\nStart is %x\n"), - size, realsize, start); - } + if ((size << 16) < realsize) { + write_log (_T("Broken mapping, size=%x, realsize=%x\nStart is %x\n"), + size, realsize, start); + } #ifndef ADDRESS_SPACE_24BIT - if (start >= 0x100) { - int real_left = 0; - for (bnr = start; bnr < start + size; bnr++) { - if (!real_left) { - realstart = bnr; - real_left = realsize >> 16; -#ifdef NATMEM_OFFSET - if (!quick) - add_shmmaps(realstart << 16, bank); + if (start >= 0x100) { + for (bnr = start; bnr < start + size; bnr++) { + mem_banks[bnr] = bank; + } + return; + } #endif - } - put_mem_bank(bnr << 16, bank, realstart << 16); -#ifdef WITH_THREADED_CPU - if (currprefs.cpu_thread) { - if (orig_bank) - put_mem_bank(bnr << 16, orig_bank, realstart << 16); - thread_mem_banks[bnr] = orig_bank; - } -#endif - real_left--; - } - //if (quick <= 0) - // debug_bankchange(old); - return; - } -#endif - if (last_address_space_24) - endhioffs = 0x10000; + if (last_address_space_24) + endhioffs = 0x10000; #ifdef ADDRESS_SPACE_24BIT - endhioffs = 0x100; + endhioffs = 0x100; #endif - for (hioffs = 0; hioffs < endhioffs; hioffs += 0x100) { - int real_left = 0; - for (bnr = start; bnr < start + size; bnr++) { - if (!real_left) { - realstart = bnr + hioffs; - real_left = realsize >> 16; -#ifdef NATMEM_OFFSET - if (!quick) - add_shmmaps(realstart << 16, bank); -#endif - } - put_mem_bank((bnr + hioffs) << 16, bank, realstart << 16); -#ifdef WITH_THREADED_CPU - if (currprefs.cpu_thread) { - if (orig_bank) - put_mem_bank((bnr + hioffs) << 16, bank, realstart << 16); - thread_mem_banks[bnr + hioffs] = orig_bank; - } -#endif - real_left--; - } - } - //if (quick <= 0) - // debug_bankchange(old); - fill_ce_banks(); + for (hioffs = 0; hioffs < endhioffs; hioffs += 0x100) { + for (bnr = start; bnr < start + size; bnr++) { + mem_banks[bnr + hioffs] = bank; + } + } } -static addrbank *highram_temp_bank[65536 - 0x100]; - -void restore_banks(void) -{ - for (int bnr = 0x100; bnr < 65536; bnr++) { - if (highram_temp_bank[bnr - 0x100]) { - map_banks(highram_temp_bank[bnr - 0x100], bnr, 1, 0); - } - else { - map_banks(&dummy_bank, bnr, 1, 0); - } - } -} - -void map_banks(addrbank *bank, int start, int size, int realsize) +void map_banks (addrbank *bank, int start, int size, int realsize) { if (start == 0xffffffff) return; if (start >= 0x100) { - int real_left = 0; - for (int bnr = start; bnr < start + size; bnr++) { - highram_temp_bank[bnr - 0x100] = bank; - } if (currprefs.address_space_24) return; } - map_banks2(bank, start, size, realsize, 0); -#ifdef WITH_PPC - ppc_generate_map_banks(bank, start, size); -#endif + map_banks2 (bank, start, size, realsize, 0); } bool validate_banks_z3(addrbank *bank, int start, int size) { if (start < 0x1000 || size <= 0) { error_log(_T("Z3 invalid map_banks(%s) start=%08x size=%08x\n"), bank->name, start << 16, size << 16); - cpu_halt(7); + cpu_halt(CPU_HALT_AUTOCONFIG_CONFLICT); return false; } if (size > 0x4000 || start + size > 0xf000) { @@ -2870,26 +1504,25 @@ bool validate_banks_z2(addrbank *bank, int start, int size) { if (start < 0x20 || (start >= 0xa0 && start < 0xe9) || start >= 0xf0) { error_log(_T("Z2 map_banks(%s) with invalid start address %08X\n"), bank->name, start << 16); - cpu_halt(7); + cpu_halt(CPU_HALT_AUTOCONFIG_CONFLICT); return false; } if (start >= 0xe9) { if (start + size > 0xf0) { error_log(_T("Z2 map_banks(%s) with invalid region %08x - %08X\n"), bank->name, start << 16, (start + size) << 16); - cpu_halt(7); + cpu_halt(CPU_HALT_AUTOCONFIG_CONFLICT); return false; } - } - else { + } else { if (start + size > 0xa0) { error_log(_T("Z2 map_banks(%s) with invalid region %08x - %08X\n"), bank->name, start << 16, (start + size) << 16); - cpu_halt(7); + cpu_halt(CPU_HALT_AUTOCONFIG_CONFLICT); return false; } } if (size <= 0 || size > 0x80) { error_log(_T("Z2 map_banks(%s) with invalid size %08x\n"), bank->name, size); - cpu_halt(7); + cpu_halt(CPU_HALT_AUTOCONFIG_CONFLICT); return false; } for (int i = start; i < start + size; i++) { @@ -2903,37 +1536,16 @@ bool validate_banks_z2(addrbank *bank, int start, int size) } -void map_banks_z2(addrbank *bank, int start, int size) +void map_banks_z2 (addrbank *bank, int start, int size) { if (!validate_banks_z2(bank, start, size)) return; - map_banks(bank, start, size, 0); + map_banks (bank, start, size, 0); } -uae_u32 map_banks_z2_autosize(addrbank *bank, int start) +void map_banks_quick (addrbank *bank, int start, int size, int realsize) { - uae_u32 size = expansion_board_size(bank); - if (!size) { - error_log(_T("Z2 map_banks(%s) %08x, invalid size!\n"), bank->name, start << 16); - return 0; - } - map_banks_z2(bank, start, size >> 16); - return size; -} - -void map_banks_quick(addrbank *bank, int start, int size, int realsize) -{ - map_banks2(bank, start, size, realsize, 1); -#ifdef WITH_PPC - ppc_generate_map_banks(bank, start, size); -#endif -} -void map_banks_nojitdirect(addrbank *bank, int start, int size, int realsize) -{ - map_banks2(bank, start, size, realsize, -1); -#ifdef WITH_PPC - ppc_generate_map_banks(bank, start, size); -#endif + map_banks2 (bank, start, size, realsize, 1); } #ifdef SAVESTATE @@ -2943,257 +1555,250 @@ void map_banks_nojitdirect(addrbank *bank, int start, int size, int realsize) uae_u8 *save_bootrom(int *len) { if (!uae_boot_rom_type) - return 0; - *len = uae_boot_rom_size; + return 0; + *len = uae_boot_rom_size; return rtarea_bank.baseaddr; } -uae_u8 *save_cram(int *len) +uae_u8 *save_cram (int *len) { - *len = chipmem_bank.allocated_size; - return chipmem_bank.baseaddr; + *len = chipmem_bank.allocated_size; + return chipmem_bank.baseaddr; } -uae_u8 *save_bram(int *len) +uae_u8 *save_bram (int *len) { - *len = bogomem_bank.allocated_size; - return bogomem_bank.baseaddr; + *len = bogomem_bank.allocated_size; + return bogomem_bank.baseaddr; } -static uae_u8 *save_mem25bitram(int *len) -{ - *len = mem25bit_bank.allocated_size; - return mem25bit_bank.baseaddr; -} - -uae_u8 *save_a3000lram(int *len) +uae_u8 *save_a3000lram (int *len) { *len = a3000lmem_bank.allocated_size; return a3000lmem_bank.baseaddr; } -uae_u8 *save_a3000hram(int *len) +uae_u8 *save_a3000hram (int *len) { *len = a3000hmem_bank.allocated_size; return a3000hmem_bank.baseaddr; } -void restore_bootrom(int len, size_t filepos) +void restore_bootrom (int len, size_t filepos) { - bootrom_filepos = filepos; + bootrom_filepos = filepos; } -void restore_cram(int len, size_t filepos) +void restore_cram (int len, size_t filepos) { - chip_filepos = filepos; - changed_prefs.chipmem_size = len; + chip_filepos = filepos; + changed_prefs.chipmem_size = len; } -void restore_bram(int len, size_t filepos) +void restore_bram (int len, size_t filepos) { - bogo_filepos = filepos; - changed_prefs.bogomem_size = len; + bogo_filepos = filepos; + changed_prefs.bogomem_size = len; } -void restore_a3000lram(int len, size_t filepos) +void restore_a3000lram (int len, size_t filepos) { a3000lmem_filepos = filepos; changed_prefs.mbresmem_low_size = len; } -void restore_a3000hram(int len, size_t filepos) +void restore_a3000hram (int len, size_t filepos) { a3000hmem_filepos = filepos; changed_prefs.mbresmem_high_size = len; } -uae_u8 *restore_rom(uae_u8 *src) +uae_u8 *restore_rom (uae_u8 *src) { - uae_u32 crc32, mem_start, mem_size, mem_type, version; - TCHAR *s, *romn; - int i, crcdet; - struct romlist *rl = romlist_getit(); + uae_u32 crc32, mem_start, mem_size, mem_type, version; + TCHAR *s, *romn; + int i, crcdet; + struct romlist *rl = romlist_getit (); - mem_start = restore_u32(); - mem_size = restore_u32(); - mem_type = restore_u32(); - version = restore_u32(); - crc32 = restore_u32(); - romn = restore_string(); - crcdet = 0; - for (i = 0; i < romlist_count(); i++) { - if (rl[i].rd->crc32 == crc32 && crc32) { - if (zfile_exists(rl[i].path)) { - switch (mem_type) - { - case 0: - _tcsncpy(changed_prefs.romfile, rl[i].path, 255); - break; - case 1: - _tcsncpy(changed_prefs.romextfile, rl[i].path, 255); - break; - } - write_log(_T("ROM '%s' = '%s'\n"), romn, rl[i].path); - crcdet = 1; - } - else { - write_log(_T("ROM '%s' = '%s' invalid rom scanner path!"), romn, rl[i].path); - } - break; - } - } - s = restore_string(); - if (!crcdet) { - if (zfile_exists(s)) { - switch (mem_type) - { - case 0: - _tcsncpy(changed_prefs.romfile, s, 255); - break; - case 1: - _tcsncpy(changed_prefs.romextfile, s, 255); - break; - } - write_log(_T("ROM detected (path) as '%s'\n"), s); - crcdet = 1; - } - } - xfree(s); - if (!crcdet) - write_log(_T("WARNING: ROM '%s' %d.%d (CRC32=%08x %08x-%08x) not found!\n"), + mem_start = restore_u32 (); + mem_size = restore_u32 (); + mem_type = restore_u32 (); + version = restore_u32 (); + crc32 = restore_u32 (); + romn = restore_string (); + crcdet = 0; + for (i = 0; i < romlist_count (); i++) { + if (rl[i].rd->crc32 == crc32 && crc32) { + if (zfile_exists (rl[i].path)) { + switch (mem_type) + { + case 0: + _tcsncpy (changed_prefs.romfile, rl[i].path, 255); + break; + case 1: + _tcsncpy (changed_prefs.romextfile, rl[i].path, 255); + break; + } + write_log (_T("ROM '%s' = '%s'\n"), romn, rl[i].path); + crcdet = 1; + } else { + write_log (_T("ROM '%s' = '%s' invalid rom scanner path!"), romn, rl[i].path); + } + break; + } + } + s = restore_string (); + if (!crcdet) { + if(zfile_exists (s)) { + switch (mem_type) + { + case 0: + _tcsncpy (changed_prefs.romfile, s, 255); + break; + case 1: + _tcsncpy (changed_prefs.romextfile, s, 255); + break; + } + write_log (_T("ROM detected (path) as '%s'\n"), s); + crcdet = 1; + } + } + xfree (s); + if (!crcdet) + write_log (_T("WARNING: ROM '%s' %d.%d (CRC32=%08x %08x-%08x) not found!\n"), romn, version >> 16, version & 0xffff, crc32, mem_start, mem_start + mem_size - 1); - xfree(romn); - return src; + xfree (romn); + return src; } -uae_u8 *save_rom(int first, int *len, uae_u8 *dstptr) +uae_u8 *save_rom (int first, int *len, uae_u8 *dstptr) { - static int count; - uae_u8 *dst, *dstbak; - uae_u8 *mem_real_start; - uae_u32 version; - TCHAR *path; - int mem_start, mem_size, mem_type, saverom; - int i; - TCHAR tmpname[1000]; + static int count; + uae_u8 *dst, *dstbak; + uae_u8 *mem_real_start; + uae_u32 version; + TCHAR *path; + int mem_start, mem_size, mem_type, saverom; + int i; + TCHAR tmpname[1000]; - version = 0; - saverom = 0; - if (first) - count = 0; - for (;;) { - mem_type = count; - mem_size = 0; - switch (count) { - case 0: /* Kickstart ROM */ - mem_start = 0xf80000; - mem_real_start = kickmem_bank.baseaddr; - mem_size = kickmem_bank.allocated_size; - path = currprefs.romfile; - /* 256KB or 512KB ROM? */ - for (i = 0; i < mem_size / 2 - 4; i++) { - if (longget(i + mem_start) != longget(i + mem_start + mem_size / 2)) - break; - } - if (i == mem_size / 2 - 4) { - mem_size /= 2; - mem_start += ROM_SIZE_256; - } - version = longget(mem_start + 12); /* version+revision */ - _stprintf(tmpname, _T("Kickstart %d.%d"), wordget(mem_start + 12), wordget(mem_start + 14)); - break; - case 1: /* Extended ROM */ - if (!extendedkickmem_type) - break; - mem_start = extendedkickmem_bank.start; - mem_real_start = extendedkickmem_bank.baseaddr; - mem_size = extendedkickmem_bank.allocated_size; - path = currprefs.romextfile; - version = longget(mem_start + 12); /* version+revision */ + version = 0; + saverom = 0; + if (first) + count = 0; + for (;;) { + mem_type = count; + mem_size = 0; + switch (count) { + case 0: /* Kickstart ROM */ + mem_start = 0xf80000; + mem_real_start = kickmem_bank.baseaddr; + mem_size = kickmem_bank.allocated_size; + path = currprefs.romfile; + /* 256KB or 512KB ROM? */ + for (i = 0; i < mem_size / 2 - 4; i++) { + if (longget (i + mem_start) != longget (i + mem_start + mem_size / 2)) + break; + } + if (i == mem_size / 2 - 4) { + mem_size /= 2; + mem_start += ROM_SIZE_256; + } + version = longget (mem_start + 12); /* version+revision */ + _stprintf (tmpname, _T("Kickstart %d.%d"), wordget (mem_start + 12), wordget (mem_start + 14)); + break; + case 1: /* Extended ROM */ + if (!extendedkickmem_type) + break; + mem_start = extendedkickmem_bank.start; + mem_real_start = extendedkickmem_bank.baseaddr; + mem_size = extendedkickmem_bank.allocated_size; + path = currprefs.romextfile; + version = longget (mem_start + 12); /* version+revision */ if (version == 0xffffffff) - version = longget(mem_start + 16); - _stprintf(tmpname, _T("Extended")); - break; - default: - return 0; - } - count++; - if (mem_size) - break; - } - if (dstptr) - dstbak = dst = dstptr; - else - dstbak = dst = xmalloc(uae_u8, 4 + 4 + 4 + 4 + 4 + 256 + 256 + mem_size); - save_u32(mem_start); - save_u32(mem_size); - save_u32(mem_type); - save_u32(version); - save_u32(get_crc32(mem_real_start, mem_size)); - save_string(tmpname); - save_string(path); - if (saverom) { - for (i = 0; i < mem_size; i++) - *dst++ = byteget(mem_start + i); - } - *len = dst - dstbak; - return dstbak; + version = longget (mem_start + 16); + _stprintf (tmpname, _T("Extended")); + break; + default: + return 0; + } + count++; + if (mem_size) + break; + } + if (dstptr) + dstbak = dst = dstptr; + else + dstbak = dst = xmalloc (uae_u8, 4 + 4 + 4 + 4 + 4 + 256 + 256 + mem_size); + save_u32 (mem_start); + save_u32 (mem_size); + save_u32 (mem_type); + save_u32 (version); + save_u32 (get_crc32 (mem_real_start, mem_size)); + save_string (tmpname); + save_string (path); + if (saverom) { + for (i = 0; i < mem_size; i++) + *dst++ = byteget (mem_start + i); + } + *len = dst - dstbak; + return dstbak; } #endif /* SAVESTATE */ /* memory helpers */ -void memcpyha_safe(uaecptr dst, const uae_u8 *src, int size) +void memcpyha_safe (uaecptr dst, const uae_u8 *src, int size) { - if (!addr_valid(_T("memcpyha"), dst, size)) - return; - while (size--) - put_byte(dst++, *src++); + if (!addr_valid (_T("memcpyha"), dst, size)) + return; + while (size--) + put_byte (dst++, *src++); } -void memcpyha(uaecptr dst, const uae_u8 *src, int size) +void memcpyha (uaecptr dst, const uae_u8 *src, int size) { - while (size--) - put_byte(dst++, *src++); + while (size--) + put_byte (dst++, *src++); } -void memcpyah_safe(uae_u8 *dst, uaecptr src, int size) +void memcpyah_safe (uae_u8 *dst, uaecptr src, int size) { - if (!addr_valid(_T("memcpyah"), src, size)) - return; - while (size--) - *dst++ = get_byte(src++); + if (!addr_valid (_T("memcpyah"), src, size)) + return; + while (size--) + *dst++ = get_byte(src++); } -void memcpyah(uae_u8 *dst, uaecptr src, int size) +void memcpyah (uae_u8 *dst, uaecptr src, int size) { - while (size--) - *dst++ = get_byte(src++); + while (size--) + *dst++ = get_byte(src++); } -uae_char *strcpyah_safe(uae_char *dst, uaecptr src, int maxsize) +uae_char *strcpyah_safe (uae_char *dst, uaecptr src, int maxsize) { uae_char *res = dst; - uae_u8 b; + uae_u8 b; dst[0] = 0; - do { - if (!addr_valid(_T("_tcscpyah"), src, 1)) - return res; - b = get_byte(src++); - *dst++ = b; + do { + if (!addr_valid (_T("_tcscpyah"), src, 1)) + return res; + b = get_byte(src++); + *dst++ = b; *dst = 0; - maxsize--; + maxsize--; if (maxsize <= 1) - break; - } while (b); - return res; + break; + } while (b); + return res; } -uaecptr strcpyha_safe(uaecptr dst, const uae_char *src) +uaecptr strcpyha_safe (uaecptr dst, const uae_char *src) { - uaecptr res = dst; - uae_u8 b; - do { - if (!addr_valid(_T("_tcscpyha"), dst, 1)) - return res; - b = *src++; - put_byte(dst++, b); - } while (b); - return res; + uaecptr res = dst; + uae_u8 b; + do { + if (!addr_valid (_T("_tcscpyha"), dst, 1)) + return res; + b = *src++; + put_byte (dst++, b); + } while (b); + return res; } diff --git a/src/newcpu.cpp b/src/newcpu.cpp index 129df783..868a5168 100644 --- a/src/newcpu.cpp +++ b/src/newcpu.cpp @@ -1,28 +1,3 @@ -/* - * newcpu.cpp - CPU emulation - * - * Copyright (c) 2010 ARAnyM dev team (see AUTHORS) - * - * - * Inspired by Christian Bauer's Basilisk II - * - * This file is part of the ARAnyM project which builds a new and powerful - * TOS/FreeMiNT compatible virtual machine running on almost any hardware. - * - * ARAnyM 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. - * - * ARAnyM 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 ARAnyM; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ /* * UAE - The Un*x Amiga Emulator * @@ -39,10 +14,10 @@ #include "memory.h" #include "custom.h" #include "newcpu.h" +#include "cpummu.h" #include "cpu_prefetch.h" #include "autoconf.h" #include "traps.h" -#include "debug.h" #include "gui.h" #include "savestate.h" #include "blitter.h" @@ -50,17 +25,16 @@ #include "cia.h" #include "inputdevice.h" #include "audio.h" -#include +#include "fpp.h" +#include "threaddep/thread.h" +#include "bsdsocket.h" #ifdef JIT #include "jit/compemu.h" #include #else /* Need to have these somewhere */ -static void build_comp(void) {} -bool check_prefs_changed_comp (void) { return false; } +bool check_prefs_changed_comp (bool checkonly) { return false; } #endif -/* For faster JIT cycles handling */ -uae_s32 pissoff = 0; /* Opcode of faulting instruction */ static uae_u16 last_op_for_exception_3; @@ -69,11 +43,16 @@ static uaecptr last_addr_for_exception_3; /* Address that generated the exception */ static uaecptr last_fault_for_exception_3; /* read (0) or write (1) access */ -static int last_writeaccess_for_exception_3; +static bool last_writeaccess_for_exception_3; /* instruction (1) or data (0) access */ -static int last_instructionaccess_for_exception_3; +static bool last_instructionaccess_for_exception_3; +/* not instruction */ +static bool last_notinstruction_for_exception_3; +/* set when writing exception stack frame */ +static int exception_in_exception; + int cpu_cycles; -bool m68k_pc_indirect; +int m68k_pc_indirect; static int cpu_prefs_changed_flag; const int areg_byteinc[] = { 1,1,1,1,1,1,1,2 }; @@ -85,18 +64,20 @@ int movem_next[256]; cpuop_func *cpufunctbl[65536]; -extern uae_u32 get_fpsr(void); +struct cputbl_data +{ + uae_s16 length; + uae_s8 disp020[2]; + uae_u8 branch; +}; +static struct cputbl_data cpudatatbl[65536]; #define COUNT_INSTRS 0 -#define MC68060_PCR 0x04300000 -#define MC68EC060_PCR 0x04310000 static uae_u64 fake_srp_030, fake_crp_030; static uae_u32 fake_tt0_030, fake_tt1_030, fake_tc_030; static uae_u16 fake_mmusr_030; -int cpu_last_stop_vpos, cpu_stopped_lines; - #if COUNT_INSTRS static unsigned long int instrcount[65536]; static uae_u16 opcodenums[65536]; @@ -111,7 +92,7 @@ static TCHAR *icountfilename (void) TCHAR *name = getenv ("INSNCOUNT"); if (name) return name; - return COUNT_INSTRS == 2 ? "frequent.68k" : "insncount"; + return (TCHAR *)(COUNT_INSTRS == 2 ? _T("frequent.68k") : _T("insncount")); } void dump_counts (void) @@ -137,7 +118,7 @@ void dump_counts (void) dp = table68k + opcodenums[i]; for (lookup = lookuptab;lookup->mnemo != dp->mnemo; lookup++) ; - fprintf (f, "%04x: %lu %s\n", opcodenums[i], cnt, lookup->name); + fprintf (f, "%04x: %8lu %s\n", opcodenums[i], cnt, lookup->name); } fclose (f); } @@ -155,35 +136,92 @@ STATIC_INLINE void count_instr (unsigned int opcode) } #endif -void set_cpu_caches(bool flush) +uae_u32 (*x_get_iword)(int); +uae_u32 (*x_get_long)(uaecptr); +uae_u32 (*x_get_word)(uaecptr); +uae_u32 (*x_get_byte)(uaecptr); +void (*x_put_long)(uaecptr,uae_u32); +void (*x_put_word)(uaecptr,uae_u32); +void (*x_put_byte)(uaecptr,uae_u32); + +static void set_x_ifetches(void) +{ + // direct to memory + x_get_iword = get_diword; +} + +// indirect memory access functions +static void set_x_funcs (void) +{ + if (currprefs.cpu_model < 68020) { + // 68000/010 + if (currprefs.cpu_compatible) { + // cpu_compatible only + x_get_iword = get_iiword; + x_put_long = put_long; + x_put_word = put_word; + x_put_byte = put_byte; + x_get_long = get_long; + x_get_word = get_word; + x_get_byte = get_byte; + } else { + x_get_iword = get_diword; + x_put_long = put_long; + x_put_word = put_word; + x_put_byte = put_byte; + x_get_long = get_long; + x_get_word = get_word; + x_get_byte = get_byte; + } + } else { + // 68020+ no ce + set_x_ifetches(); + if (currprefs.cachesize) { + x_put_long = put_long_jit; + x_put_word = put_word_jit; + x_put_byte = put_byte_jit; + x_get_long = get_long_jit; + x_get_word = get_word_jit; + x_get_byte = get_byte_jit; + } else { + x_put_long = put_long; + x_put_word = put_word; + x_put_byte = put_byte; + x_get_long = get_long; + x_get_word = get_word; + x_get_byte = get_byte; + } + } +} + +static void flush_cpu_caches(bool force) +{ + if (currprefs.cpu_model == 68020) { + regs.cacr &= ~0x08; + regs.cacr &= ~0x04; + } else if (currprefs.cpu_model == 68030) { + regs.cacr &= ~0x08; + regs.cacr &= ~0x04; + regs.cacr &= ~0x800; + regs.cacr &= ~0x400; + } +} + +void set_cpu_caches (bool flush) { #ifdef JIT if (currprefs.cachesize) { - if (currprefs.cpu_model < 68040) { - set_cache_state(regs.cacr & 1); - if (regs.cacr & 0x08) { - flush_icache (0, 3); - } - } else { - set_cache_state((regs.cacr & 0x8000) ? 1 : 0); - } - } + if (currprefs.cpu_model < 68040) { + set_cache_state (regs.cacr & 1); + if (regs.cacr & 0x08) { + flush_icache (3); + } + } else { + set_cache_state ((regs.cacr & 0x8000) ? 1 : 0); + } + } #endif - if (currprefs.cpu_model == 68020) { - if (regs.cacr & 0x04) { // clear entry in instr cache - regs.cacr &= ~0x04; - } - } else if (currprefs.cpu_model == 68030) { - if (regs.cacr & 0x04) { // clear entry in instr cache - regs.cacr &= ~0x04; - } - if ((regs.cacr & 0x800) || flush) { // clear data cache - regs.cacr &= ~0x800; - } - if (regs.cacr & 0x400) { // clear entry in data cache - regs.cacr &= ~0x400; - } - } + flush_cpu_caches(flush); } static uae_u32 REGPARAM2 op_illg_1 (uae_u32 opcode) @@ -191,59 +229,46 @@ static uae_u32 REGPARAM2 op_illg_1 (uae_u32 opcode) op_illg (opcode); return 4; } -static uae_u32 REGPARAM2 op_unimpl_1 (uae_u32 opcode) + +// generic+direct, generic+direct+jit, generic+indirect, more compatible +static const struct cputbl *cputbls[5][4] = { - op_illg (opcode); - return 4; -} + // 68000 + { op_smalltbl_5_ff, op_smalltbl_45_ff, NULL, op_smalltbl_12_ff }, + // 68010 + { op_smalltbl_4_ff, op_smalltbl_44_ff, NULL, op_smalltbl_11_ff }, + // 68020 + { op_smalltbl_3_ff, op_smalltbl_43_ff, NULL, NULL }, + // 68030 + { op_smalltbl_2_ff, op_smalltbl_42_ff, NULL, NULL }, + // 68040 + { op_smalltbl_1_ff, op_smalltbl_41_ff, NULL, NULL }, +}; static void build_cpufunctbl (void) { int i; unsigned long opcode; const struct cputbl *tbl = 0; - int lvl; + int lvl, mode; - switch (currprefs.cpu_model) - { -#ifdef CPUEMU_0 -#ifndef CPUEMU_68000_ONLY - case 68040: - lvl = 4; - tbl = op_smalltbl_1_ff; - break; - case 68030: - lvl = 3; - tbl = op_smalltbl_2_ff; - break; - case 68020: - lvl = 2; - tbl = op_smalltbl_3_ff; - break; - case 68010: - lvl = 1; - tbl = op_smalltbl_4_ff; -#ifdef CPUEMU_11 + if (!currprefs.cachesize) { if (currprefs.cpu_compatible) - tbl = op_smalltbl_11_ff; /* prefetch */ -#endif - break; -#endif -#endif - default: - changed_prefs.cpu_model = currprefs.cpu_model = 68000; - case 68000: - lvl = 0; - tbl = op_smalltbl_5_ff; -#ifdef CPUEMU_11 - if (currprefs.cpu_compatible) - tbl = op_smalltbl_12_ff; /* prefetch */ -#endif - break; - } + mode = 3; + else + mode = 0; + m68k_pc_indirect = mode != 0 ? 1 : 0; + } else { + mode = 1; + m68k_pc_indirect = 0; + } + lvl = (currprefs.cpu_model - 68000) / 10; + if (lvl >= 4) + lvl = 4; + tbl = cputbls[lvl][mode]; - if (tbl == 0) { - write_log (_T("no CPU emulation cores available CPU=%d!\n"), currprefs.cpu_model); + if (tbl == NULL) { + write_log (_T("no CPU emulation cores available CPU=%d!"), currprefs.cpu_model); abort (); } @@ -252,16 +277,26 @@ static void build_cpufunctbl (void) for (i = 0; tbl[i].handler != NULL; i++) { opcode = tbl[i].opcode; cpufunctbl[opcode] = tbl[i].handler; + cpudatatbl[opcode].length = tbl[i].length; + cpudatatbl[opcode].disp020[0] = tbl[i].disp020[0]; + cpudatatbl[opcode].disp020[1] = tbl[i].disp020[1]; + cpudatatbl[opcode].branch = tbl[i].branch; } /* hack fpu to 68000/68010 mode */ if (currprefs.fpu_model && currprefs.cpu_model < 68020) { tbl = op_smalltbl_3_ff; for (i = 0; tbl[i].handler != NULL; i++) { - if ((tbl[i].opcode & 0xfe00) == 0xf200) + if ((tbl[i].opcode & 0xfe00) == 0xf200) { cpufunctbl[tbl[i].opcode] = tbl[i].handler; + cpudatatbl[tbl[i].opcode].length = tbl[i].length; + cpudatatbl[tbl[i].opcode].disp020[0] = tbl[i].disp020[0]; + cpudatatbl[tbl[i].opcode].disp020[1] = tbl[i].disp020[1]; + cpudatatbl[tbl[i].opcode].branch = tbl[i].branch; + } } } + for (opcode = 0; opcode < 65536; opcode++) { cpuop_func *f; instr *table = &table68k[opcode]; @@ -289,10 +324,12 @@ static void build_cpufunctbl (void) if (f == op_illg_1) abort(); cpufunctbl[opcode] = f; + memcpy(&cpudatatbl[opcode], &cpudatatbl[idx], sizeof(struct cputbl_data)); } } #ifdef JIT - compiler_init (); + write_log(_T("JIT: &countdown = %p\n"), &countdown); + write_log(_T("JIT: &build_comp = %p\n"), &build_comp); build_comp (); #endif @@ -303,25 +340,26 @@ static void build_cpufunctbl (void) regs.address_space_mask = 0xffffffff; if (currprefs.cpu_compatible) { - if (currprefs.address_space_24 && currprefs.cpu_model >= 68030) + if (currprefs.address_space_24 && currprefs.cpu_model >= 68040) currprefs.address_space_24 = false; } + if (currprefs.cpu_compatible) { if (currprefs.cpu_model <= 68020) { write_log (_T(" prefetch")); - } else { - write_log (_T(" fake prefetch")); } } + if (currprefs.m68k_speed < 0) + write_log(_T(" fast")); + if (currprefs.fpu_no_unimplemented && currprefs.fpu_model) { + write_log(_T(" no unimplemented floating point instructions")); + } if (currprefs.address_space_24) { regs.address_space_mask = 0x00ffffff; write_log (_T(" 24-bit")); } write_log (_T("\n")); - m68k_pc_indirect = (currprefs.cpu_compatible) && !currprefs.cachesize; - if (tbl == op_smalltbl_1_ff || tbl == op_smalltbl_2_ff || tbl == op_smalltbl_3_ff || tbl == op_smalltbl_4_ff || tbl == op_smalltbl_5_ff) - m68k_pc_indirect = false; set_cpu_caches (true); } @@ -332,18 +370,22 @@ static void update_68k_cycles (void) { cycles_shift = 0; cycles_shift_2 = 0; - if(currprefs.m68k_speed == M68K_SPEED_14MHZ_CYCLES) - cycles_shift = 1; - else if(currprefs.m68k_speed == M68K_SPEED_25MHZ_CYCLES) - { - cycles_shift = 2; - cycles_shift_2 = 5; + if(currprefs.m68k_speed >= 0) { + if(currprefs.m68k_speed == M68K_SPEED_14MHZ_CYCLES) + cycles_shift = 1; + else if(currprefs.m68k_speed == M68K_SPEED_25MHZ_CYCLES) + { + cycles_shift = 2; + cycles_shift_2 = 5; + } } - if(currprefs.m68k_speed < 0 || currprefs.cachesize > 0) + if(currprefs.m68k_speed < 0 || currprefs.cachesize > 0) do_cycles = do_cycles_cpu_fastest; else do_cycles = do_cycles_cpu_norm; + + set_config_changed (); } STATIC_INLINE unsigned long adjust_cycles(unsigned long cycles) @@ -357,15 +399,13 @@ STATIC_INLINE unsigned long adjust_cycles(unsigned long cycles) static void prefs_changed_cpu (void) { - fixup_cpu(&changed_prefs); - currprefs.cpu_model = changed_prefs.cpu_model; - currprefs.fpu_model = changed_prefs.fpu_model; - currprefs.mmu_model = changed_prefs.mmu_model; - currprefs.cpu_compatible = changed_prefs.cpu_compatible; - currprefs.cpu_cycle_exact = changed_prefs.cpu_cycle_exact; - currprefs.int_no_unimplemented = changed_prefs.int_no_unimplemented; + fixup_cpu (&changed_prefs); + check_prefs_changed_comp(false); + currprefs.cpu_model = changed_prefs.cpu_model; + currprefs.fpu_model = changed_prefs.fpu_model; + currprefs.cpu_compatible = changed_prefs.cpu_compatible; + currprefs.address_space_24 = changed_prefs.address_space_24; currprefs.fpu_no_unimplemented = changed_prefs.fpu_no_unimplemented; - currprefs.blitter_cycle_exact = changed_prefs.blitter_cycle_exact; } static int check_prefs_changed_cpu2(void) @@ -373,25 +413,20 @@ static int check_prefs_changed_cpu2(void) int changed = 0; #ifdef JIT - changed = check_prefs_changed_comp() ? 1 : 0; + changed = check_prefs_changed_comp(true) ? 1 : 0; #endif - if (changed - || currprefs.cpu_model != changed_prefs.cpu_model - || currprefs.fpu_model != changed_prefs.fpu_model - || currprefs.mmu_model != changed_prefs.mmu_model - || currprefs.int_no_unimplemented != changed_prefs.int_no_unimplemented - || currprefs.fpu_no_unimplemented != changed_prefs.fpu_no_unimplemented - || currprefs.cpu_compatible != changed_prefs.cpu_compatible - || currprefs.cpu_cycle_exact != changed_prefs.cpu_cycle_exact) { - cpu_prefs_changed_flag |= 1; - } - if (changed - || currprefs.m68k_speed != changed_prefs.m68k_speed - || currprefs.m68k_speed_throttle != changed_prefs.m68k_speed_throttle - || currprefs.cpu_clock_multiplier != changed_prefs.cpu_clock_multiplier - || currprefs.cpu_frequency != changed_prefs.cpu_frequency) { - cpu_prefs_changed_flag |= 2; - } + if (changed + || currprefs.cpu_model != changed_prefs.cpu_model + || currprefs.fpu_model != changed_prefs.fpu_model + || currprefs.fpu_no_unimplemented != changed_prefs.fpu_no_unimplemented + || currprefs.cpu_compatible != changed_prefs.cpu_compatible + || currprefs.fpu_softfloat != changed_prefs.fpu_softfloat) { + cpu_prefs_changed_flag |= 1; + } + if (changed + || currprefs.m68k_speed != changed_prefs.m68k_speed) { + cpu_prefs_changed_flag |= 2; + } return cpu_prefs_changed_flag; } @@ -400,38 +435,9 @@ void check_prefs_changed_cpu(void) if (!config_changed) return; - if (currprefs.cpu_idle != changed_prefs.cpu_idle) { - currprefs.cpu_idle = changed_prefs.cpu_idle; - } if (check_prefs_changed_cpu2()) { - set_special(SPCFLAG_MODE_CHANGE); - reset_frame_rate_hack(); - } -} - -#define LAST_SPEEDUP_LINE 30 -#define SPEEDUP_CYCLES_JIT 2800 -#define SPEEDUP_CYCLES_NONJIT 600 -#define SPEEDUP_TIMELIMIT_JIT -1500 -#define SPEEDUP_TIMELIMIT_NONJIT -2000 -//int pissoff_value = SPEEDUP_CYCLES_JIT * CYCLE_UNIT; -int speedup_timelimit = SPEEDUP_TIMELIMIT_JIT; - -void set_speedup_values(void) -{ - if (currprefs.m68k_speed < 0) { - if (currprefs.cachesize) { - pissoff_value = SPEEDUP_CYCLES_JIT * CYCLE_UNIT; - speedup_timelimit = SPEEDUP_TIMELIMIT_JIT; - } - else { - pissoff_value = SPEEDUP_CYCLES_NONJIT * CYCLE_UNIT; - speedup_timelimit = SPEEDUP_TIMELIMIT_NONJIT; - } - } - else { - pissoff_value = 0; - speedup_timelimit = 0; + set_special (SPCFLAG_MODE_CHANGE); + reset_frame_rate_hack (); } } @@ -458,12 +464,8 @@ void init_m68k (void) do_merges (); build_cpufunctbl (); - -#ifdef JIT - /* We need to check whether NATMEM settings have changed - * before starting the CPU */ - check_prefs_changed_comp (); -#endif + set_x_funcs (); + set_speedup_values(); } struct regstruct regs; @@ -478,9 +480,29 @@ STATIC_INLINE int in_rom (uaecptr pc) return (munge24 (pc) & 0xFFF80000) == 0xF80000; } -STATIC_INLINE int in_rtarea(uaecptr pc) +STATIC_INLINE int in_rtarea (uaecptr pc) { - return (munge24(pc) & 0xFFFF0000) == rtarea_base && uae_boot_rom_type; + return (munge24 (pc) & 0xFFFF0000) == rtarea_base && uae_boot_rom_type; +} + +STATIC_INLINE void m68k_set_stop(void) +{ + if (regs.stopped) + return; + regs.stopped = 1; + set_special(SPCFLAG_STOP); +} + +STATIC_INLINE void m68k_unset_stop(void) +{ + regs.stopped = 0; + unset_special(SPCFLAG_STOP); +} + +static void activate_trace(void) +{ + unset_special (SPCFLAG_TRACE); + set_special (SPCFLAG_DOTRACE); } void REGPARAM2 MakeSR (void) @@ -492,10 +514,12 @@ void REGPARAM2 MakeSR (void) | GET_CFLG()); } -void REGPARAM2 MakeFromSR (void) +STATIC_INLINE void MakeFromSR_x(int t0trace) { int oldm = regs.m; int olds = regs.s; + int oldt0 = regs.t0; + int oldt1 = regs.t1; SET_XFLG ((regs.sr >> 4) & 1); SET_NFLG ((regs.sr >> 3) & 1); @@ -548,12 +572,63 @@ void REGPARAM2 MakeFromSR (void) } doint(); - if (regs.t1 || regs.t0) + if (regs.t1 || regs.t0) { set_special (SPCFLAG_TRACE); - else + } else { /* Keep SPCFLAG_DOTRACE, we still want a trace exception for SR-modifying instructions (including STOP). */ unset_special (SPCFLAG_TRACE); + } + // Stop SR-modification does not generate T0 + // If this SR modification set Tx bit, no trace until next instruction. + if ((oldt0 && t0trace && currprefs.cpu_model >= 68020) || oldt1) { + // Always trace if Tx bits were already set, even if this SR modification cleared them. + activate_trace(); + } +} + +void REGPARAM2 MakeFromSR_T0(void) +{ + MakeFromSR_x(1); +} +void REGPARAM2 MakeFromSR(void) +{ + MakeFromSR_x(0); +} + +static void exception_check_trace (int nr) +{ + unset_special (SPCFLAG_TRACE | SPCFLAG_DOTRACE); + if (regs.t1 && !regs.t0) { + /* trace stays pending if exception is div by zero, chk, + * trapv or trap #x + */ + if (nr == 5 || nr == 6 || nr == 7 || (nr >= 32 && nr <= 47)) + set_special (SPCFLAG_DOTRACE); + } + regs.t1 = regs.t0 = 0; +} + +STATIC_INLINE int iack_cycle(int nr) +{ + int vector; + + if (1) { + // non-autovectored + vector = x_get_byte(0x00fffff1 | ((nr - 24) << 1)); + } else { + // autovectored + + } + return vector; +} + +static uae_u32 exception_pc (int nr) +{ + // bus error, address error, illegal instruction, privilege violation, a-line, f-line + if (nr == 2 || nr == 3 || nr == 4 || nr == 8 || nr == 10 || nr == 11) + return regs.instruction_pc; + return m68k_getpc (); } static void add_approximate_exception_cycles(int nr) @@ -614,40 +689,83 @@ static void add_approximate_exception_cycles(int nr) } } cycles = adjust_cycles(cycles); - do_cycles(cycles); + x_do_cycles(cycles); } -static void exception_trace (int nr) +static void Exception_build_stack_frame (uae_u32 oldpc, uae_u32 currpc, uae_u32 ssw, int nr, int format) { - unset_special (SPCFLAG_TRACE | SPCFLAG_DOTRACE); - if (regs.t1 && !regs.t0) { - /* trace stays pending if exception is div by zero, chk, - * trapv or trap #x - */ - if (nr == 5 || nr == 6 || nr == 7 || (nr >= 32 && nr <= 47)) - set_special (SPCFLAG_DOTRACE); - } - regs.t1 = regs.t0 = regs.m = 0; + switch (format) { + case 0x0: // four word stack frame + case 0x1: // throwaway four word stack frame + break; + case 0x2: // six word stack frame + m68k_areg (regs, 7) -= 4; + x_put_long (m68k_areg (regs, 7), oldpc); + break; + case 0x3: // floating point post-instruction stack frame (68040) + m68k_areg (regs, 7) -= 4; + x_put_long (m68k_areg (regs, 7), regs.fp_ea); + break; + case 0x4: // floating point unimplemented stack frame (68LC040, 68EC040) + m68k_areg (regs, 7) -= 4; + x_put_long (m68k_areg (regs, 7), ssw); + m68k_areg (regs, 7) -= 4; + x_put_long (m68k_areg (regs, 7), oldpc); + break; + default: + write_log(_T("Unknown exception stack frame format: %X\n"), format); + return; + } + m68k_areg (regs, 7) -= 2; + x_put_word (m68k_areg (regs, 7), (format << 12) | (nr * 4)); + m68k_areg (regs, 7) -= 4; + x_put_long (m68k_areg (regs, 7), currpc); + m68k_areg (regs, 7) -= 2; + x_put_word (m68k_areg (regs, 7), regs.sr); } -static uae_u32 exception_pc (int nr) +static void Exception_build_stack_frame_common (uae_u32 oldpc, uae_u32 currpc, uae_u32 ssw, int nr) { - // zero divide, chk, trapcc/trapv, trace, trap# - if (nr == 5 || nr == 6 || nr == 7 || nr == 9 || (nr >= 32 && nr <= 47)) - return m68k_getpc (); - return regs.instruction_pc; + if (nr == 5 || nr == 6 || nr == 7 || nr == 9) { + Exception_build_stack_frame(oldpc, currpc, 0, nr, 0x2); + } else if (nr == 60 || nr == 61) { + Exception_build_stack_frame(oldpc, regs.instruction_pc, 0, nr, 0x0); + } else if (nr >= 48 && nr <= 55) { + if (regs.fpu_exp_pre) { + Exception_build_stack_frame(oldpc, regs.instruction_pc, 0, nr, 0x0); + } else { /* post-instruction */ + Exception_build_stack_frame(oldpc, currpc, 0, nr, 0x3); + } + } else if (nr == 11 && regs.fp_unimp_ins) { + regs.fp_unimp_ins = false; + if ((currprefs.cpu_model == 68040 && currprefs.fpu_model == 0)) { + Exception_build_stack_frame(regs.fp_ea, currpc, regs.instruction_pc, nr, 0x4); + } else { + Exception_build_stack_frame(regs.fp_ea, currpc, 0, nr, 0x2); + } + } else { + Exception_build_stack_frame(oldpc, currpc, 0, nr, 0x0); + } } void Exception (int nr) { - uae_u32 currpc, newpc; + uae_u32 newpc; + uae_u32 currpc = m68k_getpc(); + uae_u32 nextpc; int sv = regs.s; + int interrupt; + int vector_nr = nr; - if (currprefs.cachesize && nr != 61) + interrupt = nr >= 24 && nr < 24 + 8; + +#ifdef JIT + if (currprefs.cachesize) regs.instruction_pc = m68k_getpc (); +#endif - if (nr >= 24 && nr < 24 + 8 && currprefs.cpu_model <= 68010) - nr = get_byte (0x00fffff1 | (nr << 1)); + if (interrupt && currprefs.cpu_model <= 68010) + vector_nr = iack_cycle(nr); MakeSR (); @@ -661,14 +779,38 @@ void Exception (int nr) regs.s = 1; } + if ((m68k_areg(regs, 7) & 1) && currprefs.cpu_model < 68020) { + if (nr == 2 || nr == 3) + cpu_halt (CPU_HALT_DOUBLE_FAULT); + else + exception3_notinstruction(regs.ir, m68k_areg(regs, 7)); + return; + } + if ((nr == 2 || nr == 3) && exception_in_exception < 0) { + cpu_halt (CPU_HALT_DOUBLE_FAULT); + return; + } + + if (!currprefs.cpu_compatible) { + addrbank *ab = &get_mem_bank(m68k_areg(regs, 7) - 4); + // Not plain RAM check because some CPU type tests that + // don't need to return set stack to ROM.. + if (!ab || ab == &dummy_bank || (ab->flags & ABFLAG_IO)) { + cpu_halt(CPU_HALT_SSP_IN_NON_EXISTING_ADDRESS); + return; + } + } + + bool used_exception_build_stack_frame = false; + add_approximate_exception_cycles(nr); if (currprefs.cpu_model > 68000) { - currpc = exception_pc (nr); + uae_u32 oldpc = regs.instruction_pc; + nextpc = exception_pc (nr); if (nr == 2 || nr == 3) { int i; if (currprefs.cpu_model >= 68040) { if (nr == 2) { - // 68040 bus error (not really, some garbage?) for (i = 0 ; i < 18 ; i++) { m68k_areg(regs, 7) -= 2; @@ -687,7 +829,7 @@ void Exception (int nr) m68k_areg(regs, 7) -= 4; x_put_long (m68k_areg(regs, 7), last_addr_for_exception_3); m68k_areg(regs, 7) -= 2; - x_put_word (m68k_areg(regs, 7), 0x7000 + nr * 4); + x_put_word (m68k_areg (regs, 7), 0x7000 + vector_nr * 4); m68k_areg (regs, 7) -= 4; x_put_long (m68k_areg (regs, 7), regs.instruction_pc); m68k_areg (regs, 7) -= 2; @@ -698,7 +840,7 @@ void Exception (int nr) m68k_areg(regs, 7) -= 4; x_put_long (m68k_areg(regs, 7), last_fault_for_exception_3); m68k_areg(regs, 7) -= 2; - x_put_word (m68k_areg(regs, 7), 0x2000 + nr * 4); + x_put_word (m68k_areg (regs, 7), 0x2000 + vector_nr * 4); } } else { // 68020 address error @@ -720,17 +862,11 @@ void Exception (int nr) m68k_areg(regs, 7) -= 2; x_put_word (m68k_areg(regs, 7), ssw); m68k_areg(regs, 7) -= 2; - x_put_word (m68k_areg(regs, 7), 0xb000 + nr * 4); + x_put_word (m68k_areg(regs, 7), 0xb000 + vector_nr * 4); } - write_log (_T("Exception %d (%x) at %x -> %x!\n"), nr, regs.instruction_pc, currpc, x_get_long (regs.vbr + 4*nr)); - } else if (nr ==5 || nr == 6 || nr == 7 || nr == 9) { - m68k_areg(regs, 7) -= 4; - x_put_long (m68k_areg(regs, 7), regs.instruction_pc); + } else if (regs.m && interrupt) { /* M + Interrupt */ m68k_areg(regs, 7) -= 2; - x_put_word (m68k_areg(regs, 7), 0x2000 + nr * 4); - } else if (regs.m && nr >= 24 && nr < 32) { /* M + Interrupt */ - m68k_areg(regs, 7) -= 2; - x_put_word (m68k_areg(regs, 7), nr * 4); + x_put_word (m68k_areg(regs, 7), vector_nr * 4); m68k_areg(regs, 7) -= 4; x_put_long (m68k_areg(regs, 7), currpc); m68k_areg(regs, 7) -= 2; @@ -740,39 +876,44 @@ void Exception (int nr) regs.m = 0; m68k_areg(regs, 7) = regs.isp; m68k_areg(regs, 7) -= 2; - x_put_word (m68k_areg(regs, 7), 0x1000 + nr * 4); + x_put_word (m68k_areg(regs, 7), 0x1000 + vector_nr * 4); } else { - m68k_areg(regs, 7) -= 2; - x_put_word (m68k_areg(regs, 7), nr * 4); + Exception_build_stack_frame_common(oldpc, currpc, 0, nr); + used_exception_build_stack_frame = true; } } else { - currpc = m68k_getpc (); + nextpc = m68k_getpc (); if (nr == 2 || nr == 3) { // 68000 address error uae_u16 mode = (sv ? 4 : 0) | (last_instructionaccess_for_exception_3 ? 2 : 1); mode |= last_writeaccess_for_exception_3 ? 0 : 16; + mode |= last_notinstruction_for_exception_3 ? 8 : 0; + // undocumented bits seem to contain opcode + mode |= last_op_for_exception_3 & ~31; m68k_areg(regs, 7) -= 14; - /* fixme: bit3=I/N */ + exception_in_exception = -1; x_put_word (m68k_areg(regs, 7) + 0, mode); x_put_long (m68k_areg(regs, 7) + 2, last_fault_for_exception_3); x_put_word (m68k_areg(regs, 7) + 6, last_op_for_exception_3); x_put_word (m68k_areg(regs, 7) + 8, regs.sr); x_put_long (m68k_areg(regs, 7) + 10, last_addr_for_exception_3); - write_log (_T("Exception %d (%x) at %x -> %x!\n"), nr, last_fault_for_exception_3, currpc, x_get_long (regs.vbr + 4*nr)); goto kludge_me_do; } } - m68k_areg(regs, 7) -= 4; - x_put_long (m68k_areg(regs, 7), currpc); - m68k_areg(regs, 7) -= 2; - x_put_word (m68k_areg(regs, 7), regs.sr); + if (!used_exception_build_stack_frame) { + m68k_areg(regs, 7) -= 4; + x_put_long (m68k_areg (regs, 7), nextpc); + m68k_areg(regs, 7) -= 2; + x_put_word (m68k_areg(regs, 7), regs.sr); + } kludge_me_do: - newpc = x_get_long (regs.vbr + 4 * nr); + newpc = x_get_long (regs.vbr + 4 * vector_nr); + exception_in_exception = 0; if (newpc & 1) { if (nr == 2 || nr == 3) - cpu_halt (2); + cpu_halt (CPU_HALT_DOUBLE_FAULT); else - exception3 (regs.ir, newpc); + exception3_notinstruction(regs.ir, newpc); return; } m68k_setpc (newpc); @@ -780,31 +921,52 @@ kludge_me_do: set_special(SPCFLAG_END_COMPILE); #endif fill_prefetch (); - exception_trace (nr); + exception_check_trace (nr); +} + +void REGPARAM2 Exception_cpu(int nr) +{ + bool t0 = currprefs.cpu_model >= 68020 && regs.t0; + Exception (nr); + // check T0 trace + if (t0) { + activate_trace(); + } +} + +static void bus_error(void) +{ + TRY (prb2) { + Exception (2); + } CATCH (prb2) { + cpu_halt (CPU_HALT_BUS_ERROR_DOUBLE_FAULT); + } ENDTRY } static void do_interrupt (int nr) { - regs.stopped = 0; - unset_special (SPCFLAG_STOP); + m68k_unset_stop(); - Exception (nr + 24); + for (;;) { + Exception (nr + 24); + regs.intmask = nr; + if (!currprefs.cpu_compatible) + break; + nr = intlev(); + if (nr <= 0 || regs.intmask >= nr) + break; + } - regs.intmask = nr; doint(); } -static void m68k_reset (bool hardreset) +void NMI (void) { - uae_u32 v; + do_interrupt (7); +} - pissoff = 0; - cpu_cycles = 0; - - regs.spcflags = 0; -#ifdef SAVESTATE - if (isrestore ()) { - m68k_setpc_normal (regs.pc); +static void m68k_reset_sr(void) +{ SET_XFLG ((regs.sr >> 4) & 1); SET_NFLG ((regs.sr >> 3) & 1); SET_ZFLG ((regs.sr >> 2) & 1); @@ -820,13 +982,35 @@ static void m68k_reset (bool hardreset) m68k_areg(regs, 7) = regs.isp; else m68k_areg(regs, 7) = regs.usp; +} + +static void m68k_reset (bool hardreset) +{ + uae_u32 v; + + regs.pissoff = 0; + cpu_cycles = 0; + + regs.halted = 0; + gui_data.cpu_halted = 0; + gui_led (LED_CPU, 0, -1); + + regs.spcflags = 0; + +#ifdef SAVESTATE + if (isrestore ()) { + m68k_reset_sr(); + m68k_setpc_normal (regs.pc); return; - } + } else { + set_special(SPCFLAG_CHECK); + } #endif + regs.s = 1; v = get_long (4); m68k_areg (regs, 7) = get_long (0); + m68k_setpc_normal(v); - regs.s = 1; regs.m = 0; regs.stopped = 0; regs.t1 = 0; @@ -860,24 +1044,22 @@ static void m68k_reset (bool hardreset) } fake_mmusr_030 = 0; - regs.halted = 0; - gui_data.cpu_halted = false; - gui_led (LED_CPU, 0); - + regs.pcr = 0; fill_prefetch (); } -void REGPARAM2 op_unimpl (uae_u16 opcode) -{ - Exception (61); -} - uae_u32 REGPARAM2 op_illg (uae_u32 opcode) { uaecptr pc = m68k_getpc (); int inrom = in_rom(pc); int inrt = in_rtarea(pc); + if ((opcode == 0x4afc || opcode == 0xfc4a) && !valid_address(pc, 4) && valid_address(pc - 4, 4)) { + // PC fell off the end of RAM + bus_error(); + return 4; + } + if (cloanto_rom && (opcode & 0xF100) == 0x7100) { m68k_dreg (regs, (opcode >> 9) & 7) = (uae_s8)(opcode & 0xFF); m68k_incpc_normal (2); @@ -889,6 +1071,8 @@ uae_u32 REGPARAM2 op_illg (uae_u32 opcode) if (get_long (0x10) == 0) { notify_user (NUMSG_KS68020); uae_restart (-1, NULL); + m68k_setstopped(); + return 4; } } @@ -923,19 +1107,20 @@ uae_u32 REGPARAM2 op_illg (uae_u32 opcode) #ifdef CPUEMU_0 -static void mmu_op30fake_pmove(uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra) +static bool mmu_op30fake_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra) { int mode = (opcode >> 3) & 7; + int rreg = opcode & 7; int preg = (next >> 10) & 31; int rw = (next >> 9) & 1; int fd = (next >> 8) & 1; - const char *reg = NULL; + const TCHAR *reg = NULL; int siz; - // Dn, An, (An)+, -(An), abs and indirect - if (mode == 0 || mode == 1 || mode == 3 || mode == 4 || mode >= 6) { + // Dn, An, (An)+, -(An), immediate and PC-relative not allowed + if (mode == 0 || mode == 1 || mode == 3 || mode == 4 || mode == 6 || (mode == 7 && rreg > 1)) { op_illg (opcode); - return; + return true; } switch (preg) @@ -953,7 +1138,7 @@ static void mmu_op30fake_pmove(uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr siz = 8; if (rw) { x_put_long (extra, fake_srp_030 >> 32); - x_put_long (extra + 4, fake_srp_030); + x_put_long (extra + 4, (uae_u32)fake_srp_030); } else { fake_srp_030 = (uae_u64)x_get_long (extra) << 32; fake_srp_030 |= x_get_long (extra + 4); @@ -964,7 +1149,7 @@ static void mmu_op30fake_pmove(uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr siz = 8; if (rw) { x_put_long (extra, fake_crp_030 >> 32); - x_put_long (extra + 4, fake_crp_030); + x_put_long (extra + 4, (uae_u32)fake_crp_030); } else { fake_crp_030 = (uae_u64)x_get_long (extra) << 32; fake_crp_030 |= x_get_long (extra + 4); @@ -998,27 +1183,30 @@ static void mmu_op30fake_pmove(uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr if (!reg) { op_illg(opcode); - return; + return true; } + return false; } -static void mmu_op30fake_ptest(uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra) +static bool mmu_op30fake_ptest (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra) { fake_mmusr_030 = 0; + return false; } -static void mmu_op30fake_pflush(uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra) +static bool mmu_op30fake_pflush (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra) { int mode = (opcode >> 3) & 7; + int rreg = opcode & 7; int flushmode = (next >> 10) & 7; switch (flushmode) { case 6: - // Dn, An, (An)+, -(An), abs and indirect - if (mode == 0 || mode == 1 || mode == 3 || mode == 4 || mode >= 6) { + // Dn, An, (An)+, -(An), immediate and PC-relative not allowed + if (mode == 0 || mode == 1 || mode == 3 || mode == 4 || mode == 6 || (mode == 7 && rreg > 1)) { op_illg (opcode); - return; + return true; } break; case 4: @@ -1027,12 +1215,13 @@ static void mmu_op30fake_pflush(uaecptr pc, uae_u32 opcode, uae_u16 next, uaecpt break; default: op_illg (opcode); - return; + return true; } + return false; } // 68030 (68851) MMU instructions only -void mmu_op30 (uaecptr pc, uae_u32 opcode, uae_u16 extra, uaecptr extraa) +bool mmu_op30 (uaecptr pc, uae_u32 opcode, uae_u16 extra, uaecptr extraa) { int type = extra >> 13; @@ -1041,20 +1230,60 @@ void mmu_op30 (uaecptr pc, uae_u32 opcode, uae_u16 extra, uaecptr extraa) case 0: case 2: case 3: - mmu_op30fake_pmove (pc, opcode, extra, extraa); + return mmu_op30fake_pmove (pc, opcode, extra, extraa); break; case 1: - mmu_op30fake_pflush (pc, opcode, extra, extraa); + return mmu_op30fake_pflush (pc, opcode, extra, extraa); break; case 4: - mmu_op30fake_ptest (pc, opcode, extra, extraa); + return mmu_op30fake_ptest (pc, opcode, extra, extraa); break; default: op_illg (opcode); + return true; break; } } +/* check if an address matches a ttr */ +static int fake_mmu_do_match_ttr(uae_u32 ttr, uaecptr addr, bool super) +{ + if (ttr & MMU_TTR_BIT_ENABLED) { /* TTR enabled */ + uae_u8 msb, mask; + + msb = ((addr ^ ttr) & MMU_TTR_LOGICAL_BASE) >> 24; + mask = (ttr & MMU_TTR_LOGICAL_MASK) >> 16; + + if (!(msb & ~mask)) { + + if ((ttr & MMU_TTR_BIT_SFIELD_ENABLED) == 0) { + if (((ttr & MMU_TTR_BIT_SFIELD_SUPER) == 0) != (super == 0)) { + return TTR_NO_MATCH; + } + } + + return (ttr & MMU_TTR_BIT_WRITE_PROTECT) ? TTR_NO_WRITE : TTR_OK_MATCH; + } + } + return TTR_NO_MATCH; +} + +static int fake_mmu_match_ttr(uaecptr addr, bool super, bool data) +{ + int res; + + if (data) { + res = fake_mmu_do_match_ttr(regs.dtt0, addr, super); + if (res == TTR_NO_MATCH) + res = fake_mmu_do_match_ttr(regs.dtt1, addr, super); + } else { + res = fake_mmu_do_match_ttr(regs.itt0, addr, super); + if (res == TTR_NO_MATCH) + res = fake_mmu_do_match_ttr(regs.itt1, addr, super); + } + return res; +} + // 68040+ MMU instructions only void mmu_op(uae_u32 opcode, uae_u32 extra) { @@ -1064,9 +1293,18 @@ void mmu_op(uae_u32 opcode, uae_u32 extra) return; } else if ((opcode & 0x0FD8) == 0x548) { /* PTEST */ + int regno = opcode & 7; + uae_u32 addr = m68k_areg(regs, regno); + bool write = (opcode & 32) == 0; + bool super = (regs.dfc & 4) != 0; + bool data = (regs.dfc & 3) != 2; + + regs.mmusr = 0; + if (fake_mmu_match_ttr(addr, super, data) != TTR_NO_MATCH) { + regs.mmusr = MMU_MMUSR_T | MMU_MMUSR_R; + } + regs.mmusr |= addr & 0xfffff000; return; - } else if ((opcode & 0x0FB8) == 0x588) { - /* PLPA */ } m68k_setpc_normal (m68k_getpc () - 2); op_illg (opcode); @@ -1077,34 +1315,55 @@ void mmu_op(uae_u32 opcode, uae_u32 extra) static void do_trace (void) { if (regs.t0 && currprefs.cpu_model >= 68020) { - uae_u16 opcode; - /* should also include TRAP, CHK, SR modification FPcc */ - /* probably never used so why bother */ - /* We can afford this to be inefficient... */ - m68k_setpc_normal (m68k_getpc ()); - fill_prefetch (); - opcode = x_get_word (regs.pc); - if (opcode == 0x4e73 /* RTE */ - || opcode == 0x4e74 /* RTD */ - || opcode == 0x4e75 /* RTS */ - || opcode == 0x4e77 /* RTR */ - || opcode == 0x4e76 /* TRAPV */ - || (opcode & 0xffc0) == 0x4e80 /* JSR */ - || (opcode & 0xffc0) == 0x4ec0 /* JMP */ - || (opcode & 0xff00) == 0x6100 /* BSR */ - || ((opcode & 0xf000) == 0x6000 /* Bcc */ - && cctrue (regs.ccrflags, (opcode >> 8) & 0xf)) - || ((opcode & 0xf0f0) == 0x5050 /* DBcc */ - && !cctrue (regs.ccrflags, (opcode >> 8) & 0xf) - && uae_s16(m68k_dreg (regs, opcode & 7)) != 0)) - { - unset_special (SPCFLAG_TRACE); - set_special (SPCFLAG_DOTRACE); - } - } else if (regs.t1) { - unset_special (SPCFLAG_TRACE); - set_special (SPCFLAG_DOTRACE); + // this is obsolete + return; } + if (regs.t1) { + activate_trace(); + } +} + +static void check_uae_int_request(void) +{ + if (uae_int_requested) { + bool irq = false; + if (uae_int_requested & 0x00ff) { + INTREQ_f(0x8000 | 0x0008); + irq = true; + } + if (uae_int_requested & 0xff00) { + INTREQ_f(0x8000 | 0x2000); + irq = true; + } + if (uae_int_requested & 0xff0000) { + atomic_and(&uae_int_requested, ~0x010000); + } + if (irq) + doint(); + } +} + +static bool haltloop(void) +{ + while (regs.halted) { + static int prevvpos; + if (vpos == 0 && prevvpos) { + prevvpos = 0; + } + if (vpos) + prevvpos = 1; + x_do_cycles(8 * CYCLE_UNIT); + + if (regs.spcflags & SPCFLAG_COPPER) + do_copper(); + + if (regs.spcflags) { + if ((regs.spcflags & (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE))) + return true; + } + } + + return false; } void doint (void) @@ -1120,7 +1379,47 @@ static int do_specialties (int cycles) if (regs.spcflags & SPCFLAG_MODE_CHANGE) return 1; - regs.instruction_pc = m68k_getpc (); + if (regs.spcflags & SPCFLAG_CHECK) { + if (regs.halted) { + unset_special(SPCFLAG_CHECK); + if (haltloop()) + return 1; + } + unset_special(SPCFLAG_CHECK); + } + +#ifdef ACTION_REPLAY +#ifdef ACTION_REPLAY_HRTMON + if ((regs.spcflags & SPCFLAG_ACTION_REPLAY) && hrtmon_flag != ACTION_REPLAY_INACTIVE) { + int isinhrt = (m68k_getpc () >= hrtmem_start && m68k_getpc () < hrtmem_start + hrtmem_size); + /* exit from HRTMon? */ + if (hrtmon_flag == ACTION_REPLAY_ACTIVE && !isinhrt) + hrtmon_hide (); + /* HRTMon breakpoint? (not via IRQ7) */ + if (hrtmon_flag == ACTION_REPLAY_IDLE && isinhrt) + hrtmon_breakenter (); + if (hrtmon_flag == ACTION_REPLAY_ACTIVATE) + hrtmon_enter (); + } +#endif + if ((regs.spcflags & SPCFLAG_ACTION_REPLAY) && action_replay_flag != ACTION_REPLAY_INACTIVE) { + /*if (action_replay_flag == ACTION_REPLAY_ACTIVE && !is_ar_pc_in_rom ())*/ + /* write_log (_T("PC:%p\n"), m68k_getpc ());*/ + + if (action_replay_flag == ACTION_REPLAY_ACTIVATE || action_replay_flag == ACTION_REPLAY_DORESET) + action_replay_enter (); + if ((action_replay_flag == ACTION_REPLAY_HIDE || action_replay_flag == ACTION_REPLAY_ACTIVE) && !is_ar_pc_in_rom ()) { + action_replay_hide (); + unset_special (SPCFLAG_ACTION_REPLAY); + } + if (action_replay_flag == ACTION_REPLAY_WAIT_PC) { + /*write_log (_T("Waiting for PC: %p, current PC= %p\n"), wait_for_pc, m68k_getpc ());*/ + if (m68k_getpc () == wait_for_pc) { + action_replay_flag = ACTION_REPLAY_ACTIVATE; /* Activate after next instruction. */ + } + } + } +#endif if (regs.spcflags & SPCFLAG_COPPER) do_copper (); @@ -1146,20 +1445,18 @@ static int do_specialties (int cycles) if (regs.spcflags & SPCFLAG_DOTRACE) Exception (9); - while (regs.spcflags & SPCFLAG_STOP) { + bool first = true; + while ((regs.spcflags & SPCFLAG_STOP) && !(regs.spcflags & SPCFLAG_BRK)) { - if (uae_int_requested) { - INTREQ_f (0x8008); - set_special (SPCFLAG_INT); - } + check_uae_int_request(); { - extern void bsdsock_fake_int_handler (void); - extern int volatile bsd_int_requested; if (bsd_int_requested) bsdsock_fake_int_handler (); } - x_do_cycles (4 * CYCLE_UNIT); + if (!first) + x_do_cycles (4 * CYCLE_UNIT); + first = false; if (regs.spcflags & SPCFLAG_COPPER) do_copper (); @@ -1204,29 +1501,39 @@ static int do_specialties (int cycles) static void m68k_run_1 (void) { struct regstruct *r = ®s; + bool exit = false; - for (;;) { - uae_u16 opcode = r->ir; + while (!exit) { + TRY (prb) { + while (!exit) { + r->opcode = r->ir; -#if defined (CPU_arm) & defined(USE_ARMNEON) - // Well not really since pli is ArmV7... - /* Load ARM code for next opcode into L2 cache during execute of do_cycles() */ - __asm__ volatile ("pli [%[radr]]\n\t" \ - : : [radr] "r" (cpufunctbl[opcode]) : ); +#if defined (CPU_arm) && defined(USE_ARMNEON) + // Well not really since pli is ArmV7... + /* Load ARM code for next opcode into L2 cache during execute of do_cycles() */ + __asm__ volatile ("pli [%[radr]]\n\t" \ + : : [radr] "r" (cpufunctbl[r->opcode]) : ); #endif - count_instr (opcode); + count_instr (r->opcode); - do_cycles (cpu_cycles); - r->instruction_pc = m68k_getpc (); - cpu_cycles = (*cpufunctbl[opcode])(opcode); - cpu_cycles = adjust_cycles(cpu_cycles); - if (r->spcflags) { - if (do_specialties (cpu_cycles)) { - return; + do_cycles (cpu_cycles); + r->instruction_pc = m68k_getpc (); + cpu_cycles = (*cpufunctbl[r->opcode])(r->opcode); + cpu_cycles = adjust_cycles(cpu_cycles); + if (r->spcflags) { + if (do_specialties (cpu_cycles)) + exit = true; + } + if (!currprefs.cpu_compatible) + exit = true; } - } - if (!currprefs.cpu_compatible) - return; + } CATCH (prb) { + bus_error(); + if (r->spcflags) { + if (do_specialties(cpu_cycles)) + exit = true; + } + } ENDTRY } } @@ -1245,12 +1552,13 @@ void exec_nostats(void) for (;;) { - uae_u16 opcode = get_diword (0); - cpu_cycles = (*cpufunctbl[opcode])(opcode); + r->opcode = x_get_iword (0); + cpu_cycles = (*cpufunctbl[r->opcode])(r->opcode); cpu_cycles = adjust_cycles(cpu_cycles); + do_cycles (cpu_cycles); - if (end_block(opcode) || r->spcflags || uae_int_requested) + if (end_block(r->opcode) || r->spcflags || uae_int_requested) return; /* We will deal with the spcflags in the caller */ } } @@ -1271,21 +1579,19 @@ void execute_normal(void) start_pc = r->pc; for (;;) { /* Take note: This is the do-it-normal loop */ - uae_u16 opcode; - regs.instruction_pc = m68k_getpc (); - opcode = get_diword (0); + r->opcode = x_get_iword (0); special_mem = DISTRUST_CONSISTENT_MEM; pc_hist[blocklen].location = (uae_u16*)r->pc_p; - cpu_cycles = (*cpufunctbl[opcode])(opcode); + cpu_cycles = (*cpufunctbl[r->opcode])(r->opcode); cpu_cycles = adjust_cycles(cpu_cycles); do_cycles (cpu_cycles); total_cycles += cpu_cycles; pc_hist[blocklen].specmem = special_mem; blocklen++; - if (end_block(opcode) || blocklen >= MAXRUN || r->spcflags || uae_int_requested) { + if (end_block(r->opcode) || blocklen >= MAXRUN || r->spcflags || uae_int_requested) { compile_block(pc_hist,blocklen,total_cycles); return; /* We will deal with the spcflags in the caller */ } @@ -1299,12 +1605,9 @@ typedef void compiled_handler(void); static void m68k_run_jit (void) { for (;;) { - ((compiled_handler*)pushall_call_handler)(); + ((compiled_handler*)(pushall_call_handler))(); /* Whenever we return from that, we should check spcflags */ - if (uae_int_requested) { - INTREQ_f (0x8008); - set_special (SPCFLAG_INT); - } + check_uae_int_request(); if (regs.spcflags) { if (do_specialties (0)) { return; @@ -1316,23 +1619,16 @@ static void m68k_run_jit (void) void cpu_halt (int id) { + // id > 0: emulation halted. if (!regs.halted) { - write_log (_T("CPU halted: reason = %d\n"), id); + write_log (_T("CPU halted: reason = %d PC=%08x\n"), id, M68K_GETPC); regs.halted = id; - gui_data.cpu_halted = true; - gui_led (LED_CPU, 0); - regs.intmask = 7; - MakeSR (); - audio_deactivate (); - } - while (regs.halted) { - if (vpos == 0) - sleep_millis_main (8); - x_do_cycles (100 * CYCLE_UNIT); - if (regs.spcflags) { - if ((regs.spcflags & (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE))) - return; - } + gui_data.cpu_halted = id; + gui_led (LED_CPU, 0, -1); + regs.intmask = 7; + MakeSR (); + audio_deactivate (); + set_special(SPCFLAG_CHECK); } } @@ -1340,165 +1636,173 @@ void cpu_halt (int id) static void m68k_run_2 (void) { struct regstruct *r = ®s; + bool exit = false; - for (;;) { - r->instruction_pc = m68k_getpc (); - uae_u16 opcode = get_diword (0); - -#if defined (CPU_arm) & defined(USE_ARMNEON) - // Well not really since pli is ArmV7... - /* Load ARM code for next opcode into L2 cache during execute of do_cycles() */ - __asm__ volatile ("pli [%[radr]]\n\t" \ - : : [radr] "r" (cpufunctbl[opcode]) : ); + while (!exit) { + TRY(prb) { + while (!exit) { + r->instruction_pc = m68k_getpc (); + + r->opcode = x_get_iword (0); +#if defined (CPU_arm) && defined(USE_ARMNEON) + // Well not really since pli is ArmV7... + /* Load ARM code for next opcode into L2 cache during execute of do_cycles() */ + __asm__ volatile ("pli [%[radr]]\n\t" \ + : : [radr] "r" (cpufunctbl[r->opcode]) : ); #endif - count_instr (opcode); - do_cycles (cpu_cycles); - cpu_cycles = (*cpufunctbl[opcode])(opcode); - cpu_cycles = adjust_cycles(cpu_cycles); - if (r->spcflags) { - if (do_specialties (cpu_cycles)) { - break; + count_instr (r->opcode); + + do_cycles (cpu_cycles); + + cpu_cycles = (*cpufunctbl[r->opcode])(r->opcode); + cpu_cycles = adjust_cycles(cpu_cycles); + + if (r->spcflags) { + if (do_specialties (cpu_cycles)) + exit = true; + } } - } - } + } CATCH(prb) { + bus_error(); + if (r->spcflags) { + if (do_specialties(cpu_cycles)) + exit = true; + } + } ENDTRY + } } static int in_m68k_go = 0; -static void exception2_handle (uaecptr addr, uaecptr fault) +static bool cpu_hardreset; + +bool is_hardreset(void) { - last_addr_for_exception_3 = addr; - last_fault_for_exception_3 = fault; - last_writeaccess_for_exception_3 = 0; - last_instructionaccess_for_exception_3 = 0; - Exception (2); + return cpu_hardreset; } -void m68k_go(int may_quit) +void m68k_go (int may_quit) { - int hardboot = 1; + int hardboot = 1; int startup = 1; - if (in_m68k_go || !may_quit) { - write_log(_T("Bug! m68k_go is not reentrant.\n")); - abort(); - } + if (in_m68k_go || !may_quit) { + write_log (_T("Bug! m68k_go is not reentrant.\n")); + abort (); + } - reset_frame_rate_hack(); - update_68k_cycles(); - start_cycles = 0; + reset_frame_rate_hack (); + update_68k_cycles (); cpu_prefs_changed_flag = 0; - in_m68k_go++; -#ifdef DEBUG - ProfilerStart("amiberry-sdl2.prof"); -#endif - for (;;) { - void(*run_func)(void); + in_m68k_go++; + for (;;) { + void (*run_func)(void); - if (quit_program > 0) { - int hardreset = (quit_program == UAE_RESET_HARD ? 1 : 0) | hardboot; - bool kbreset = quit_program == UAE_RESET_KEYBOARD; - if (quit_program == UAE_QUIT) - break; - if (quit_program == UAE_RESET_HARD) - reinit_amiga(); + if (quit_program > 0) { int restored = 0; + bool cpu_keyboardreset = quit_program == UAE_RESET_KEYBOARD; + cpu_hardreset = ((quit_program == UAE_RESET_HARD ? 1 : 0) | hardboot) != 0; + + if (quit_program == UAE_QUIT) + break; hsync_counter = 0; - vsync_counter = 0; - quit_program = 0; - hardboot = 0; + quit_program = 0; + hardboot = 0; #ifdef SAVESTATE if (savestate_state == STATE_DORESTORE) savestate_state = STATE_RESTORE; - if (savestate_state == STATE_RESTORE) - restore_state(savestate_fname); + if (savestate_state == STATE_RESTORE) + restore_state (savestate_fname); #endif - //prefs_changed_cpu(); - //build_cpufunctbl(); - //set_x_funcs(); //TODO - set_cycles(start_cycles); - custom_reset(hardreset != 0, kbreset); - m68k_reset(hardreset != 0); - if (hardreset) { - memory_clear(); - write_log(_T("hardreset, memory cleared\n")); - } + prefs_changed_cpu(); + build_cpufunctbl (); + set_x_funcs (); + set_cycles (0); + custom_reset (cpu_hardreset != 0, cpu_keyboardreset); + m68k_reset (cpu_hardreset != 0); + if (cpu_hardreset) { + memory_clear (); + write_log (_T("hardreset, memory cleared\n")); + } + cpu_hardreset = false; #ifdef SAVESTATE - /* We may have been restoring state, but we're done now. */ - if (isrestore()) { - savestate_restore_finish(); + /* We may have been restoring state, but we're done now. */ + if (isrestore ()) { + savestate_restore_finish (); startup = 1; restored = 1; - } + } #endif - if (currprefs.produce_sound == 0) - eventtab[ev_audio].active = 0; - m68k_setpc_normal(regs.pc); - check_prefs_changed_audio(); + if (currprefs.produce_sound == 0) + eventtab[ev_audio].active = 0; + m68k_setpc_normal (regs.pc); + check_prefs_changed_audio (); if (!restored || hsync_counter == 0) - savestate_check(); - } - - if (regs.panic) { - regs.panic = 0; - /* program jumped to non-existing memory and cpu was >= 68020 */ - get_real_address(regs.isp); /* stack in no one's land? -> halt */ - if (regs.isp & 1) - regs.panic = 5; - if (!regs.panic) - exception2_handle(regs.panic_pc, regs.panic_addr); - if (regs.panic) { - int id = regs.panic; - /* system is very badly confused */ - regs.panic = 0; - cpu_halt(id); - } - } + savestate_check (); + } if (regs.spcflags & SPCFLAG_MODE_CHANGE) { if (cpu_prefs_changed_flag & 1) { uaecptr pc = m68k_getpc(); prefs_changed_cpu(); + fpu_modechange(); build_cpufunctbl(); m68k_setpc_normal(pc); fill_prefetch(); - } + } if (cpu_prefs_changed_flag & 2) { fixup_cpu(&changed_prefs); currprefs.m68k_speed = changed_prefs.m68k_speed; update_68k_cycles(); } cpu_prefs_changed_flag = 0; + set_speedup_values(); } - if (startup) { - custom_prepare(); - protect_roms(true); + set_x_funcs(); + if (startup) { + custom_prepare (); + protect_roms (true); } - startup = 0; - if (regs.halted) { - cpu_halt(regs.halted); - continue; - } - run_func = - currprefs.cpu_compatible && currprefs.cpu_model <= 68010 ? m68k_run_1 : -#ifdef JIT - currprefs.cpu_model >= 68020 && currprefs.cachesize ? m68k_run_jit : -#endif - m68k_run_2; + startup = 0; unset_special(SPCFLAG_MODE_CHANGE); - unset_special(SPCFLAG_BRK); - run_func(); - } -#ifdef DEBUG - ProfilerStop(); + + if (!regs.halted) { + // check that PC points to something that looks like memory. + uaecptr pc = m68k_getpc(); + addrbank *ab = &get_mem_bank(pc); + if (ab == NULL || ab == &dummy_bank || (!currprefs.cpu_compatible && !valid_address(pc, 2)) || (pc & 1)) { + cpu_halt(CPU_HALT_INVALID_START_ADDRESS); + } + } + if (regs.halted) { + cpu_halt (regs.halted); + if (regs.halted < 0) { + haltloop(); + continue; + } + } + + run_func = + currprefs.cpu_compatible && currprefs.cpu_model <= 68010 ? m68k_run_1 : +#ifdef JIT + currprefs.cpu_model >= 68020 && currprefs.cachesize ? m68k_run_jit : #endif - protect_roms(false); - in_m68k_go--; + m68k_run_2; + run_func (); + } + protect_roms (false); + + // Prepare for a restart: reset pc + regs.pc = 0; + regs.pc_p = NULL; + regs.pc_oldp = NULL; + + in_m68k_go--; } #ifdef SAVESTATE @@ -1562,9 +1866,6 @@ uae_u8 *restore_cpu (uae_u8 *src) regs.srp = restore_u32(); } if (flags & 0x80000000) { - regs.chipset_latch_rw = restore_u32(); - regs.chipset_latch_read = restore_u32(); - regs.chipset_latch_write = restore_u32(); int khz = restore_u32(); restore_u32(); if (khz > 0 && khz < 800000) @@ -1572,6 +1873,8 @@ uae_u8 *restore_cpu (uae_u8 *src) } set_cpu_caches(true); + m68k_reset_sr(); + write_log (_T("CPU: %d%s%03d, PC=%08X\n"), model / 1000, flags & 1 ? _T("EC") : _T(""), model % 1000, regs.pc); @@ -1607,7 +1910,6 @@ uae_u8 *restore_cpu_extra (uae_u8 *src) uae_u32 flags = restore_u32 (); currprefs.cpu_compatible = changed_prefs.cpu_compatible = (flags & 2) ? true : false; - //currprefs.cachesize = changed_prefs.cachesize = (flags & 8) ? 8192 : 0; currprefs.m68k_speed = changed_prefs.m68k_speed = 0; if (flags & 4) @@ -1651,7 +1953,7 @@ uae_u8 *save_cpu (int *len, uae_u8 *dstptr) dstbak = dst = xmalloc (uae_u8, 1000); model = currprefs.cpu_model; save_u32 (model); /* MODEL */ - save_u32 (0x80000000 | 0x40000000 | (currprefs.address_space_24 ? 1 : 0)); /* FLAGS */ + save_u32 (0x80000000 | (currprefs.address_space_24 ? 1 : 0)); /* FLAGS */ for(i = 0;i < 15; i++) save_u32 (regs.regs[i]); /* D0-D7 A0-A6 */ save_u32 (m68k_getpc ()); /* PC */ @@ -1695,9 +1997,6 @@ uae_u8 *save_cpu (int *len, uae_u8 *dstptr) if (currprefs.cpu_model >= 68020) khz *= 2; } - save_u32(regs.chipset_latch_rw); - save_u32(regs.chipset_latch_read); - save_u32(regs.chipset_latch_write); save_u32 (khz); // clock rate in KHz: -1 = fastest possible save_u32 (0); // spare *len = dst - dstbak; @@ -1706,7 +2005,7 @@ uae_u8 *save_cpu (int *len, uae_u8 *dstptr) #endif /* SAVESTATE */ -static void exception3f (uae_u32 opcode, uaecptr addr, int writeaccess, int instructionaccess, uaecptr pc) +static void exception3f (uae_u32 opcode, uaecptr addr, bool writeaccess, bool instructionaccess, bool notinstruction, uaecptr pc, bool plus2) { if (currprefs.cpu_model >= 68040) addr &= ~1; @@ -1716,7 +2015,9 @@ static void exception3f (uae_u32 opcode, uaecptr addr, int writeaccess, int inst else last_addr_for_exception_3 = pc; } else if (pc == 0xffffffff) { - last_addr_for_exception_3 = m68k_getpc () + 2; + last_addr_for_exception_3 = m68k_getpc (); + if (plus2) + last_addr_for_exception_3 += 2; } else { last_addr_for_exception_3 = pc; } @@ -1724,40 +2025,40 @@ static void exception3f (uae_u32 opcode, uaecptr addr, int writeaccess, int inst last_op_for_exception_3 = opcode; last_writeaccess_for_exception_3 = writeaccess; last_instructionaccess_for_exception_3 = instructionaccess; + last_notinstruction_for_exception_3 = notinstruction; Exception (3); } -void exception3 (uae_u32 opcode, uaecptr addr) +void exception3_notinstruction(uae_u32 opcode, uaecptr addr) { - exception3f (opcode, addr, 0, 0, 0xffffffff); + exception3f (opcode, addr, true, false, true, 0xffffffff, false); +} +void exception3_read(uae_u32 opcode, uaecptr addr) +{ + exception3f (opcode, addr, false, 0, false, 0xffffffff, false); +} +void exception3_write(uae_u32 opcode, uaecptr addr) +{ + exception3f (opcode, addr, true, 0, false, 0xffffffff, false); } - void exception3i (uae_u32 opcode, uaecptr addr) { - exception3f (opcode, addr, 0, 1, 0xffffffff); + exception3f (opcode, addr, 0, 1, false, 0xffffffff, true); } void exception3b (uae_u32 opcode, uaecptr addr, bool w, bool i, uaecptr pc) { - exception3f (opcode, addr, w, i, pc); + exception3f (opcode, addr, w, i, false, pc, true); } -void exception2 (uaecptr addr) +void exception2 (uaecptr addr, bool read, int size, uae_u32 fc) { - exception2_handle (addr, addr); -} - -void exception2_fake (uaecptr addr) -{ - write_log (_T("delayed exception2!\n")); - regs.panic_pc = m68k_getpc (); - regs.panic_addr = addr; - regs.panic = 6; - set_special (SPCFLAG_BRK); - m68k_setpc_normal (0xf80000); -#ifdef JIT - set_special (SPCFLAG_END_COMPILE); -#endif - fill_prefetch (); + last_addr_for_exception_3 = m68k_getpc(); + last_fault_for_exception_3 = addr; + last_writeaccess_for_exception_3 = read == 0; + last_instructionaccess_for_exception_3 = (fc & 1) == 0; + last_op_for_exception_3 = regs.opcode; + last_notinstruction_for_exception_3 = exception_in_exception != 0; + THROW(2); } void cpureset (void) @@ -1768,6 +2069,7 @@ void cpureset (void) uae_u16 ins; addrbank *ab; + set_special(SPCFLAG_CHECK); if (currprefs.cpu_compatible && currprefs.cpu_model <= 68020) { custom_reset (false, false); return; @@ -1787,7 +2089,7 @@ void cpureset (void) uae_u32 addr = m68k_areg (regs, reg); if (addr < 0x80000) addr += 0xf80000; - write_log (_T("reset/jmp (ax) combination emulated -> %x\n"), addr); + write_log (_T("reset/jmp (ax) combination at %08x emulated -> %x\n"), pc, addr); m68k_setpc_normal (addr - 2); return; } @@ -1801,32 +2103,37 @@ void cpureset (void) void m68k_setstopped (void) { - regs.stopped = 1; /* A traced STOP instruction drops through immediately without actually stopping. */ if ((regs.spcflags & SPCFLAG_DOTRACE) == 0) { - set_special(SPCFLAG_STOP); - cpu_last_stop_vpos = vpos; - } - else + m68k_set_stop(); + } else { m68k_resumestopped (); + } } void m68k_resumestopped (void) { if (!regs.stopped) return; - regs.stopped = 0; fill_prefetch (); - unset_special (SPCFLAG_STOP); - cpu_stopped_lines += vpos - cpu_last_stop_vpos; - cpu_last_stop_vpos = vpos; + m68k_unset_stop(); +} + +void check_t0_trace(void) +{ + if (regs.t0 && currprefs.cpu_model >= 68020) { + unset_special (SPCFLAG_TRACE); + set_special (SPCFLAG_DOTRACE); + } } void fill_prefetch (void) { if (currprefs.cachesize) return; + if (!currprefs.cpu_compatible) + return; if (currprefs.cpu_model <= 68010) { uaecptr pc = m68k_getpc (); regs.ir = x_get_word (pc); diff --git a/src/osdep/amiberry.cpp b/src/osdep/amiberry.cpp index 3cfe7c8c..c5a56c20 100644 --- a/src/osdep/amiberry.cpp +++ b/src/osdep/amiberry.cpp @@ -6,55 +6,65 @@ */ #include +#include #include -#include #include #include #include #include +#include +#ifndef ANDROID +#include +#endif #include "sysconfig.h" #include "sysdeps.h" #include "config.h" -#include "autoconf.h" #include "uae.h" #include "options.h" #include "threaddep/thread.h" #include "gui.h" #include "include/memory.h" -#include "newcpu.h" -#include "custom.h" -#include "xwin.h" -#include "drawing.h" #include "inputdevice.h" -#include "keybuf.h" #include "keyboard.h" #include "disk.h" #include "savestate.h" -#include "traps.h" -#include "bsdsocket.h" -#include "blkdev.h" -#include "native2amiga.h" #include "rtgmodes.h" -#include "uaeresource.h" #include "rommgr.h" -#include "akiko.h" -#include "SDL.h" -#include "amiberry_rp9.h" +#include "zfile.h" +#include "gfxboard.h" +#include +#ifdef USE_SDL2 #include -#include "scsidev.h" +#endif +#include "amiberry_rp9.h" -int pissoff_value = 15000 * CYCLE_UNIT; +#ifdef WITH_LOGGING +extern FILE *debugfile; +#endif + +int quickstart_start = 1; +int quickstart_model = 0; +int quickstart_conf = 0; +bool host_poweroff = false; extern void signal_segv(int signum, siginfo_t* info, void* ptr); -extern void gui_force_rtarea_hdchange(); +extern void signal_buserror(int signum, siginfo_t* info, void* ptr); +extern void signal_term(int signum, siginfo_t* info, void* ptr); +extern void gui_force_rtarea_hdchange(void); + +static int delayed_mousebutton = 0; +static int doStylusRightClick; -extern int loadconfig_old(struct uae_prefs* p, const char* orgpath); extern void SetLastActiveConfig(const char* filename); -int pause_emulation; - /* Keyboard */ -map customControlMap; // No SDLK_LAST. SDL2 migration guide suggests std::map +#ifdef USE_SDL1 +int customControlMap[SDLK_LAST]; +#endif + +#ifdef USE_SDL2 +std::map customControlMap; // No SDLK_LAST. SDL2 migration guide suggests std::map +#endif char start_path_data[MAX_DPATH]; char currentDir[MAX_DPATH]; @@ -67,127 +77,71 @@ char kbd_flags; static char config_path[MAX_DPATH]; static char rom_path[MAX_DPATH]; static char rp9_path[MAX_DPATH]; +static char controllers_path[MAX_DPATH]; +static char retroarch_file[MAX_DPATH]; + char last_loaded_config[MAX_DPATH] = {'\0'}; +static bool cpuSpeedChanged = false; +static int lastCpuSpeed = 600; +int defaultCpuSpeed = 600; + int max_uae_width; int max_uae_height; + extern "C" int main(int argc, char* argv[]); -void reinit_amiga() -{ - write_log("reinit_amiga() called\n"); - DISK_free(); -#ifdef CD32 - akiko_free(); -#endif -#ifdef FILESYS - filesys_cleanup(); - hardfile_reset(); -#endif -#ifdef AUTOCONFIG -#if defined (BSDSOCKET) - bsdlib_reset(); -#endif - expansion_cleanup(); -#endif - device_func_reset(); - memory_cleanup(); - - currprefs = changed_prefs; - /* force sound settings change */ - currprefs.produce_sound = 0; - - framecnt = 1; -#ifdef AUTOCONFIG - rtarea_setup(); -#endif -#ifdef FILESYS - rtarea_init(); - uaeres_install(); - hardfile_install(); -#endif - keybuf_init(); - -#ifdef AUTOCONFIG - expansion_init(); -#endif -#ifdef FILESYS - filesys_install(); -#endif - memory_init(); - memory_reset(); - -#ifdef AUTOCONFIG -#if defined (BSDSOCKET) - bsdlib_install(); -#endif - emulib_install(); - native2amiga_install(); -#endif - - custom_init(); /* Must come after memory_init */ - DISK_init(); - - reset_frame_rate_hack(); - init_m68k(); -} - -void sleep_millis_main(int ms) -{ - usleep(ms * 1000); -} void sleep_millis(int ms) { usleep(ms * 1000); } -void logging_init() + +void logging_init(void) { #ifdef WITH_LOGGING - static int started; - static int first; - char debugfilename[MAX_DPATH]; + static int started; + static int first; + char debugfilename[MAX_DPATH]; - if (first > 1) - { - write_log ("***** RESTART *****\n"); - return; - } - if (first == 1) - { - if (debugfile) - fclose (debugfile); - debugfile = 0; - } - - sprintf(debugfilename, "%s/amiberry_log.txt", start_path_data); - if(!debugfile) - debugfile = fopen(debugfilename, "wt"); - - first++; - write_log ( "Amiberry Logfile\n\n"); -#endif -} - -void logging_cleanup() -{ -#ifdef WITH_LOGGING - if(debugfile) - fclose(debugfile); + if (first > 1) { + write_log ("***** RESTART *****\n"); + return; + } + if (first == 1) { + if (debugfile) + fclose (debugfile); debugfile = 0; + } + + sprintf(debugfilename, "%s/amiberry_log.txt", start_path_data); + if (!debugfile) + debugfile = fopen(debugfilename, "wt"); + + first++; + write_log("AMIBERRY Logfile\n\n"); +#endif +} + +void logging_cleanup(void) +{ +#ifdef WITH_LOGGING + if (debugfile) + fclose(debugfile); + debugfile = 0; #endif } -void stripslashes(TCHAR* p) +void stripslashes(TCHAR *p) { - while (_tcslen (p) > 0 && (p[_tcslen (p) - 1] == '\\' || p[_tcslen (p) - 1] == '/')) - p[_tcslen (p) - 1] = 0; + while (_tcslen(p) > 0 && (p[_tcslen(p) - 1] == '\\' || p[_tcslen(p) - 1] == '/')) + p[_tcslen(p) - 1] = 0; } -void fixtrailing(TCHAR* p) +void fixtrailing(TCHAR *p) { if (_tcslen(p) == 0) return; @@ -196,43 +150,85 @@ void fixtrailing(TCHAR* p) _tcscat(p, "/"); } -void getpathpart(TCHAR* outpath, int size, const TCHAR* inpath) +void getpathpart(TCHAR *outpath, int size, const TCHAR *inpath) { - _tcscpy (outpath, inpath); - TCHAR* p = _tcsrchr (outpath, '/'); + _tcscpy(outpath, inpath); + TCHAR *p = _tcsrchr(outpath, '/'); if (p) p[0] = 0; fixtrailing(outpath); } -void getfilepart(TCHAR* out, int size, const TCHAR* path) +void getfilepart(TCHAR *out, int size, const TCHAR *path) { out[0] = 0; - const TCHAR* p = _tcsrchr (path, '/'); + const TCHAR *p = _tcsrchr(path, '/'); if (p) - _tcscpy (out, p + 1); + _tcscpy(out, p + 1); else - _tcscpy (out, path); + _tcscpy(out, path); } -uae_u8* target_load_keyfile(struct uae_prefs* p, const char* path, int* sizep, char* name) +uae_u8 *target_load_keyfile(struct uae_prefs *p, const char *path, int *sizep, char *name) { return nullptr; } -void target_run() +void target_run(void) +{ + // Reset counter for access violations + init_max_signals(); +} + +void target_quit(void) { } -void target_quit() +static void fix_apmodes(struct uae_prefs *p) { + if (p->ntscmode) + { + p->gfx_apmode[0].gfx_refreshrate = 60; + p->gfx_apmode[1].gfx_refreshrate = 60; + } + else + { + p->gfx_apmode[0].gfx_refreshrate = 50; + p->gfx_apmode[1].gfx_refreshrate = 50; + } + + p->gfx_apmode[0].gfx_vsync = 2; + p->gfx_apmode[1].gfx_vsync = 2; + p->gfx_apmode[0].gfx_vflip = -1; + p->gfx_apmode[1].gfx_vflip = -1; + + fixup_prefs_dimensions(p); } void target_fixup_options(struct uae_prefs* p) { - p->rtgboards[0].rtgmem_type = 1; - if (p->z3fastmem[0].start_address != z3_start_adr) - p->z3fastmem[0].start_address = z3_start_adr; + p->rtgboards[0].rtgmem_type = GFXBOARD_UAE_Z3; + + if (z3base_adr == Z3BASE_REAL) { + // map Z3 memory at real address (0x40000000) + p->z3_mapping_mode = Z3MAPPING_REAL; + p->z3autoconfig_start = z3base_adr; + } + else { + // map Z3 memory at UAE address (0x10000000) + p->z3_mapping_mode = Z3MAPPING_UAE; + p->z3autoconfig_start = z3base_adr; + } + + if (p->cs_cd32cd && p->cs_cd32nvram && (p->cs_compatible == CP_GENERIC || p->cs_compatible == 0)) { + // Old config without cs_compatible, but other cd32-flags + p->cs_compatible = CP_CD32; + built_in_chipset_prefs(p); + } + + if (p->cs_cd32cd && p->cartfile[0]) { + p->cs_cd32fmv = true; + } p->picasso96_modeflags = RGBFF_CLUT | RGBFF_R5G6B5 | RGBFF_R8G8B8A8; if (p->gfx_size.width == 0) @@ -240,137 +236,380 @@ void target_fixup_options(struct uae_prefs* p) if (p->gfx_size.height == 0) p->gfx_size.height == 256; p->gfx_resolution = p->gfx_size.width > 600 ? 1 : 0; + + if (p->cachesize > 0) + p->fpu_no_unimplemented = false; + else + p->fpu_no_unimplemented = true; + + fix_apmodes(p); } void target_default_options(struct uae_prefs* p, int type) { - p->amiberry_customControls = 0; +#ifdef PANDORA + p->gfx_size.width = 320; + p->gfx_size.height = 240; + p->gfx_resolution = RES_LORES; + p->pandora_vertical_offset = OFFSET_Y_ADJUST; + p->pandora_cpu_speed = defaultCpuSpeed; + p->pandora_hide_idle_led = 0; + p->pandora_tapDelay = 10; +#endif //PANDORA + +#ifdef PANDORA + p->fast_copper = 1; +#else + p->fast_copper = 0; +#endif + + p->customControls = false; + _tcscpy(p->custom_up, ""); + _tcscpy(p->custom_down, ""); + _tcscpy(p->custom_left, ""); + _tcscpy(p->custom_right, ""); + _tcscpy(p->custom_a, ""); + _tcscpy(p->custom_b, ""); + _tcscpy(p->custom_x, ""); + _tcscpy(p->custom_y, ""); + _tcscpy(p->custom_l, ""); + _tcscpy(p->custom_r, ""); + _tcscpy(p->custom_play, ""); + p->picasso96_modeflags = RGBFF_CLUT | RGBFF_R5G6B5 | RGBFF_R8G8B8A8; p->kbd_led_num = -1; // No status on numlock p->kbd_led_scr = -1; // No status on scrollock + +#ifdef USE_SDL1 + p->gfx_correct_aspect = 1; + p->gfx_fullscreen_ratio = 100; +#endif + +#ifdef USE_SDL2 p->scaling_method = -1; //Default is Auto - p->key_for_menu = SDLK_F12; - p->key_for_quit = 0; - p->button_for_menu = -1; - p->button_for_quit = -1; +#endif + + _tcscpy(p->open_gui, "F12"); + _tcscpy(p->quit_amiberry, ""); + + p->amiberry_use_retroarch_quit = true; + p->amiberry_use_retroarch_menu = true; + p->amiberry_use_retroarch_reset = false; + +#ifdef ANDROIDSDL + p->onScreen = 1; + p->onScreen_textinput = 1; + p->onScreen_dpad = 1; + p->onScreen_button1 = 1; + p->onScreen_button2 = 1; + p->onScreen_button3 = 1; + p->onScreen_button4 = 1; + p->onScreen_button5 = 0; + p->onScreen_button6 = 0; + p->custom_position = 0; + p->pos_x_textinput = 0; + p->pos_y_textinput = 0; + p->pos_x_dpad = 4; + p->pos_y_dpad = 215; + p->pos_x_button1 = 430; + p->pos_y_button1 = 286; + p->pos_x_button2 = 378; + p->pos_y_button2 = 286; + p->pos_x_button3 = 430; + p->pos_y_button3 = 214; + p->pos_x_button4 = 378; + p->pos_y_button4 = 214; + p->pos_x_button5 = 430; + p->pos_y_button5 = 142; + p->pos_x_button6 = 378; + p->pos_y_button6 = 142; + p->extfilter = 1; + p->quickSwitch = 0; + p->floatingJoystick = 0; + p->disableMenuVKeyb = 0; +#endif + +#ifdef USE_SDL1 + memset(customControlMap, 0, sizeof(customControlMap)); +#endif + + p->cr[CHIPSET_REFRESH_PAL].locked = true; + p->cr[CHIPSET_REFRESH_PAL].vsync = 1; + + p->cr[CHIPSET_REFRESH_NTSC].locked = true; + p->cr[CHIPSET_REFRESH_NTSC].vsync = 1; + + p->cr[0].index = 0; + p->cr[0].horiz = -1; + p->cr[0].vert = -1; + p->cr[0].lace = -1; + p->cr[0].resolution = 0; + p->cr[0].vsync = -1; + p->cr[0].rate = 60.0; + p->cr[0].ntsc = 1; + p->cr[0].locked = true; + p->cr[0].rtg = true; + _tcscpy(p->cr[0].label, _T("RTG")); } void target_save_options(struct zfile* f, struct uae_prefs* p) { +#ifdef PANDORA + cfgfile_write(f, "pandora.cpu_speed", "%d", p->pandora_cpu_speed); + cfgfile_write(f, "pandora.hide_idle_led", "%d", p->pandora_hide_idle_led); + cfgfile_write(f, "pandora.tap_delay", "%d", p->pandora_tapDelay); + cfgfile_write(f, "pandora.move_y", "%d", p->pandora_vertical_offset - OFFSET_Y_ADJUST); +#endif //PANDORA + +#ifdef USE_SDL1 cfgfile_write(f, _T("gfx_correct_aspect"), _T("%d"), p->gfx_correct_aspect); - cfgfile_write(f, _T("kbd_led_num"), _T("%d"), p->kbd_led_num); - cfgfile_write(f, _T("kbd_led_scr"), _T("%d"), p->kbd_led_scr); - cfgfile_write(f, _T("scaling_method"), _T("%d"), p->scaling_method); - cfgfile_write(f, _T("key_for_menu"), _T("%d"), p->key_for_menu); - cfgfile_write(f, _T("key_for_quit"), _T("%d"), p->key_for_quit); - cfgfile_write(f, _T("button_for_menu"), _T("%d"), p->button_for_menu); - cfgfile_write(f, _T("button_for_quit"), _T("%d"), p->button_for_quit); + cfgfile_write(f, _T("gfx_fullscreen_ratio"), _T("%d"), p->gfx_fullscreen_ratio); +#endif - cfgfile_write(f, "amiberry.custom_controls", "%d", p->amiberry_customControls); - cfgfile_write(f, "amiberry.custom_up", "%d", customControlMap[VK_UP]); - cfgfile_write(f, "amiberry.custom_down", "%d", customControlMap[VK_DOWN]); - cfgfile_write(f, "amiberry.custom_left", "%d", customControlMap[VK_LEFT]); - cfgfile_write(f, "amiberry.custom_right", "%d", customControlMap[VK_RIGHT]); - cfgfile_write(f, "amiberry.custom_a", "%d", customControlMap[VK_Green]); - cfgfile_write(f, "amiberry.custom_b", "%d", customControlMap[VK_Blue]); - cfgfile_write(f, "amiberry.custom_x", "%d", customControlMap[VK_Red]); - cfgfile_write(f, "amiberry.custom_y", "%d", customControlMap[VK_Yellow]); - cfgfile_write(f, "amiberry.custom_l", "%d", customControlMap[VK_LShoulder]); - cfgfile_write(f, "amiberry.custom_r", "%d", customControlMap[VK_RShoulder]); - cfgfile_write(f, "amiberry.custom_play", "%d", customControlMap[VK_Play]); + cfgfile_write(f, _T("amiberry.kbd_led_num"), _T("%d"), p->kbd_led_num); + cfgfile_write(f, _T("amiberry.kbd_led_scr"), _T("%d"), p->kbd_led_scr); + +#ifdef USE_SDL2 + cfgfile_write(f, _T("amiberry.scaling_method"), _T("%d"), p->scaling_method); +#endif + + cfgfile_write_str(f, _T("amiberry.open_gui"), p->open_gui); + cfgfile_write_str(f, _T("amiberry.quit_amiberry"), p->quit_amiberry); + + cfgfile_write_bool(f, _T("amiberry_use_retroarch_quit"), p->amiberry_use_retroarch_quit); + cfgfile_write_bool(f, _T("amiberry_use_retroarch_menu"), p->amiberry_use_retroarch_menu); + cfgfile_write_bool(f, _T("amiberry_use_retroarch_reset"), p->amiberry_use_retroarch_reset); + + cfgfile_write_bool(f, "amiberry.custom_controls", p->customControls); + cfgfile_write(f, "amiberry.custom_up", "%d", p->custom_up); + cfgfile_write(f, "amiberry.custom_down", "%d", p->custom_down); + cfgfile_write(f, "amiberry.custom_left", "%d", p->custom_left); + cfgfile_write(f, "amiberry.custom_right", "%d", p->custom_right); + cfgfile_write(f, "amiberry.custom_a", "%d", p->custom_a); + cfgfile_write(f, "amiberry.custom_b", "%d", p->custom_b); + cfgfile_write(f, "amiberry.custom_x", "%d", p->custom_x); + cfgfile_write(f, "amiberry.custom_y", "%d", p->custom_y); + cfgfile_write(f, "amiberry.custom_l", "%d", p->custom_l); + cfgfile_write(f, "amiberry.custom_r", "%d", p->custom_r); + cfgfile_write(f, "amiberry.custom_play", "%d", p->custom_play); + +#ifdef ANDROIDSDL + cfgfile_write(f, "pandora.onscreen", "%d", p->onScreen); + cfgfile_write(f, "pandora.onscreen_textinput", "%d", p->onScreen_textinput); + cfgfile_write(f, "pandora.onscreen_dpad", "%d", p->onScreen_dpad); + cfgfile_write(f, "pandora.onscreen_button1", "%d", p->onScreen_button1); + cfgfile_write(f, "pandora.onscreen_button2", "%d", p->onScreen_button2); + cfgfile_write(f, "pandora.onscreen_button3", "%d", p->onScreen_button3); + cfgfile_write(f, "pandora.onscreen_button4", "%d", p->onScreen_button4); + cfgfile_write(f, "pandora.onscreen_button5", "%d", p->onScreen_button5); + cfgfile_write(f, "pandora.onscreen_button6", "%d", p->onScreen_button6); + cfgfile_write(f, "pandora.custom_position", "%d", p->custom_position); + cfgfile_write(f, "pandora.pos_x_textinput", "%d", p->pos_x_textinput); + cfgfile_write(f, "pandora.pos_y_textinput", "%d", p->pos_y_textinput); + cfgfile_write(f, "pandora.pos_x_dpad", "%d", p->pos_x_dpad); + cfgfile_write(f, "pandora.pos_y_dpad", "%d", p->pos_y_dpad); + cfgfile_write(f, "pandora.pos_x_button1", "%d", p->pos_x_button1); + cfgfile_write(f, "pandora.pos_y_button1", "%d", p->pos_y_button1); + cfgfile_write(f, "pandora.pos_x_button2", "%d", p->pos_x_button2); + cfgfile_write(f, "pandora.pos_y_button2", "%d", p->pos_y_button2); + cfgfile_write(f, "pandora.pos_x_button3", "%d", p->pos_x_button3); + cfgfile_write(f, "pandora.pos_y_button3", "%d", p->pos_y_button3); + cfgfile_write(f, "pandora.pos_x_button4", "%d", p->pos_x_button4); + cfgfile_write(f, "pandora.pos_y_button4", "%d", p->pos_y_button4); + cfgfile_write(f, "pandora.pos_x_button5", "%d", p->pos_x_button5); + cfgfile_write(f, "pandora.pos_y_button5", "%d", p->pos_y_button5); + cfgfile_write(f, "pandora.pos_x_button6", "%d", p->pos_x_button6); + cfgfile_write(f, "pandora.pos_y_button6", "%d", p->pos_y_button6); + cfgfile_write(f, "pandora.floating_joystick", "%d", p->floatingJoystick); + cfgfile_write(f, "pandora.disable_menu_vkeyb", "%d", p->disableMenuVKeyb); +#endif } -void target_restart() +void target_restart(void) { + emulating = 0; + gui_restart(); } -TCHAR* target_expand_environment(const TCHAR* path) +TCHAR *target_expand_environment(const TCHAR *path, TCHAR *out, int maxlen) { - if (!path) - return nullptr; - return strdup(path); + if (out == nullptr) + { + return strdup(path); + } + _tcscpy(out, path); + return out; } int target_parse_option(struct uae_prefs* p, const char* option, const char* value) { - - if (cfgfile_intval(option, value, "gfx_correct_aspect", &p->gfx_correct_aspect, 1)) +#ifdef PANDORA + if (cfgfile_intval(option, value, "cpu_speed", &p->pandora_cpu_speed, 1) return 1; + if (cfgfile_intval(option, value, "hide_idle_led", &p->pandora_hide_idle_led, 1) + return 1; + if (cfgfile_intval(option, value, "tap_delay", &p->pandora_tapDelay, 1) + return 1; + if (cfgfile_intval(option, value, "move_y", &p->pandora_vertical_offset, 1) { + p->pandora_vertical_offset += OFFSET_Y_ADJUST; + return 1; + } +#endif //PANDORA + +#ifdef ANDROIDSDL + || cfgfile_intval(option, value, "onscreen", &p->onScreen, 1) + || cfgfile_intval(option, value, "onscreen_textinput", &p->onScreen_textinput, 1) + || cfgfile_intval(option, value, "onscreen_dpad", &p->onScreen_dpad, 1) + || cfgfile_intval(option, value, "onscreen_button1", &p->onScreen_button1, 1) + || cfgfile_intval(option, value, "onscreen_button2", &p->onScreen_button2, 1) + || cfgfile_intval(option, value, "onscreen_button3", &p->onScreen_button3, 1) + || cfgfile_intval(option, value, "onscreen_button4", &p->onScreen_button4, 1) + || cfgfile_intval(option, value, "onscreen_button5", &p->onScreen_button5, 1) + || cfgfile_intval(option, value, "onscreen_button6", &p->onScreen_button6, 1) + || cfgfile_intval(option, value, "custom_position", &p->custom_position, 1) + || cfgfile_intval(option, value, "pos_x_textinput", &p->pos_x_textinput, 1) + || cfgfile_intval(option, value, "pos_y_textinput", &p->pos_y_textinput, 1) + || cfgfile_intval(option, value, "pos_x_dpad", &p->pos_x_dpad, 1) + || cfgfile_intval(option, value, "pos_y_dpad", &p->pos_y_dpad, 1) + || cfgfile_intval(option, value, "pos_x_button1", &p->pos_x_button1, 1) + || cfgfile_intval(option, value, "pos_y_button1", &p->pos_y_button1, 1) + || cfgfile_intval(option, value, "pos_x_button2", &p->pos_x_button2, 1) + || cfgfile_intval(option, value, "pos_y_button2", &p->pos_y_button2, 1) + || cfgfile_intval(option, value, "pos_x_button3", &p->pos_x_button3, 1) + || cfgfile_intval(option, value, "pos_y_button3", &p->pos_y_button3, 1) + || cfgfile_intval(option, value, "pos_x_button4", &p->pos_x_button4, 1) + || cfgfile_intval(option, value, "pos_y_button4", &p->pos_y_button4, 1) + || cfgfile_intval(option, value, "pos_x_button5", &p->pos_x_button5, 1) + || cfgfile_intval(option, value, "pos_y_button5", &p->pos_y_button5, 1) + || cfgfile_intval(option, value, "pos_x_button6", &p->pos_x_button6, 1) + || cfgfile_intval(option, value, "pos_y_button6", &p->pos_y_button6, 1) + || cfgfile_intval(option, value, "floating_joystick", &p->floatingJoystick, 1) + || cfgfile_intval(option, value, "disable_menu_vkeyb", &p->disableMenuVKeyb, 1) +#endif + + if (cfgfile_yesno(option, value, _T("amiberry_use_retroarch_quit"), &p->amiberry_use_retroarch_quit)) + return 1; + if (cfgfile_yesno(option, value, _T("amiberry_use_retroarch_menu"), &p->amiberry_use_retroarch_menu)) + return 1; + if (cfgfile_yesno(option, value, _T("amiberry_use_retroarch_reset"), &p->amiberry_use_retroarch_reset)) + return 1; + if (cfgfile_intval(option, value, "kbd_led_num", &p->kbd_led_num, 1)) return 1; if (cfgfile_intval(option, value, "kbd_led_scr", &p->kbd_led_scr, 1)) return 1; + +#ifdef USE_SDL1 + if (cfgfile_intval(option, value, "gfx_correct_aspect", &p->gfx_correct_aspect, 1)) + return 1; + if (cfgfile_intval(option, value, "gfx_fullscreen_ratio", &p->gfx_fullscreen_ratio, 1)) + return 1; +#endif + +#ifdef USE_SDL2 if (cfgfile_intval(option, value, "scaling_method", &p->scaling_method, 1)) return 1; - if (cfgfile_intval(option, value, "key_for_menu", &p->key_for_menu, 1)) +#endif + + if (cfgfile_string(option, value, "open_gui", p->open_gui, sizeof p->open_gui)) return 1; - if (cfgfile_intval(option, value, "key_for_quit", &p->key_for_quit, 1)) - return 1; - if (cfgfile_intval(option, value, "button_for_menu", &p->button_for_menu, 1)) - return 1; - if (cfgfile_intval(option, value, "button_for_quit", &p->button_for_quit, 1)) + if (cfgfile_string(option, value, "quit_amiberry", p->quit_amiberry, sizeof p->quit_amiberry)) return 1; - int result = cfgfile_intval(option, value, "custom_controls", &p->amiberry_customControls, 1) - || cfgfile_intval(option, value, "custom_up", &customControlMap[VK_UP], 1) - || cfgfile_intval(option, value, "custom_down", &customControlMap[VK_DOWN], 1) - || cfgfile_intval(option, value, "custom_left", &customControlMap[VK_LEFT], 1) - || cfgfile_intval(option, value, "custom_right", &customControlMap[VK_RIGHT], 1) - || cfgfile_intval(option, value, "custom_a", &customControlMap[VK_Green], 1) - || cfgfile_intval(option, value, "custom_b", &customControlMap[VK_Blue], 1) - || cfgfile_intval(option, value, "custom_x", &customControlMap[VK_Red], 1) - || cfgfile_intval(option, value, "custom_y", &customControlMap[VK_Yellow], 1) - || cfgfile_intval(option, value, "custom_l", &customControlMap[VK_LShoulder], 1) - || cfgfile_intval(option, value, "custom_r", &customControlMap[VK_RShoulder], 1) - || cfgfile_intval(option, value, "custom_play", &customControlMap[VK_Play], 1); - return result; + if (cfgfile_yesno(option, value, "custom_controls", &p->customControls)) + return 1; + if (cfgfile_string(option, value, "custom_up", p->custom_up, sizeof p->custom_up)) + return 1; + if (cfgfile_string(option, value, "custom_down", p->custom_down, sizeof p->custom_down)) + return 1; + if (cfgfile_string(option, value, "custom_left", p->custom_left, sizeof p->custom_left)) + return 1; + if (cfgfile_string(option, value, "custom_right", p->custom_right, sizeof p->custom_right)) + return 1; + if (cfgfile_string(option, value, "custom_a", p->custom_a, sizeof p->custom_a)) + return 1; + if (cfgfile_string(option, value, "custom_b", p->custom_b, sizeof p->custom_b)) + return 1; + if (cfgfile_string(option, value, "custom_x", p->custom_x, sizeof p->custom_x)) + return 1; + if (cfgfile_string(option, value, "custom_y", p->custom_y, sizeof p->custom_y)) + return 1; + if (cfgfile_string(option, value, "custom_l", p->custom_l, sizeof p->custom_l)) + return 1; + if (cfgfile_string(option, value, "custom_r", p->custom_r, sizeof p->custom_r)) + return 1; + if (cfgfile_string(option, value, "custom_play", p->custom_play, sizeof p->custom_play)) + return 1; + return 0; } -void fetch_datapath(char* out, int size) +void fetch_datapath(char *out, int size) { strncpy(out, start_path_data, size); strncat(out, "/", size); } -void fetch_saveimagepath(char* out, int size, int dir) +void fetch_saveimagepath(char *out, int size, int dir) { strncpy(out, start_path_data, size); strncat(out, "/savestates/", size); } -void fetch_configurationpath(char* out, int size) +void fetch_configurationpath(char *out, int size) { strncpy(out, config_path, size); } -void set_configurationpath(char* newpath) +void set_configurationpath(char *newpath) { strncpy(config_path, newpath, MAX_DPATH); } +void fetch_controllerspath(char* out, int size) +{ + strncpy(out, controllers_path, size); +} + +void set_controllerspath(char* newpath) +{ + strncpy(controllers_path, newpath, MAX_DPATH); +} + +void fetch_retroarchfile(char* out, int size) +{ + strncpy(out, retroarch_file, size); +} + +void set_retroarchfile(char* newpath) +{ + strncpy(retroarch_file, newpath, MAX_DPATH); +} + + void fetch_rompath(char* out, int size) { strncpy(out, rom_path, size); } -void set_rompath(char* newpath) +void set_rompath(char *newpath) { strncpy(rom_path, newpath, MAX_DPATH); } -void fetch_rp9path(char* out, int size) + +void fetch_rp9path(char *out, int size) { strncpy(out, rp9_path, size); } -void fetch_statefilepath(char* out, int size) +void fetch_savestatepath(char *out, int size) { strncpy(out, start_path_data, size); strncat(out, "/savestates/", size); } -void fetch_screenshotpath(char* out, int size) +void fetch_screenshotpath(char *out, int size) { strncpy(out, start_path_data, size); strncat(out, "/screenshots/", size); @@ -381,13 +620,12 @@ int target_cfgfile_load(struct uae_prefs* p, const char* filename, int type, int int i; int result = 0; - if (emulating && changed_prefs.cdslots[0].inuse) - gui_force_rtarea_hdchange(); + write_log(_T("target_cfgfile_load(): load file %s\n"), filename); discard_prefs(p, type); default_prefs(p, true, 0); - const char* ptr = strstr(filename, ".rp9"); + const char* ptr = strstr((char *)filename, ".rp9"); if (ptr > nullptr) { // Load rp9 config @@ -397,7 +635,7 @@ int target_cfgfile_load(struct uae_prefs* p, const char* filename, int type, int } else { - ptr = strstr(filename, ".uae"); + ptr = strstr((char *)filename, ".uae"); if (ptr > nullptr) { int type = CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST; @@ -405,8 +643,6 @@ int target_cfgfile_load(struct uae_prefs* p, const char* filename, int type, int } if (result) extractFileName(filename, last_loaded_config); - else - result = loadconfig_old(p, filename); } if (result) @@ -422,33 +658,32 @@ int target_cfgfile_load(struct uae_prefs* p, const char* filename, int type, int if (!isdefault) inputdevice_updateconfig(nullptr, p); - +#ifdef WITH_LOGGING + p->leds_on_screen = true; +#endif SetLastActiveConfig(filename); - - if (count_HDs(p) > 0) // When loading a config with HDs, always do a hardreset - gui_force_rtarea_hdchange(); } return result; } -int check_configfile(char* file) +int check_configfile(char *file) { char tmp[MAX_PATH]; - FILE* f = fopen(file, "rt"); + FILE *f = fopen(file, "rt"); if (f) { fclose(f); return 1; } - strcpy(tmp, file); + strncpy(tmp, file, MAX_PATH); char* ptr = strstr(tmp, ".uae"); if (ptr > nullptr) { *(ptr + 1) = '\0'; - strcat(tmp, "conf"); + strncat(tmp, "conf", MAX_PATH); f = fopen(tmp, "rt"); if (f) { @@ -456,31 +691,30 @@ int check_configfile(char* file) return 2; } } - return 0; } -void extractFileName(const char* str, char* buffer) +void extractFileName(const char * str, char *buffer) { - const char* p = str + strlen(str) - 1; + const char *p = str + strlen(str) - 1; while (*p != '/' && p > str) p--; p++; - strcpy(buffer, p); + strncpy(buffer, p, MAX_PATH); } -void extractPath(char* str, char* buffer) +void extractPath(char *str, char *buffer) { - strcpy(buffer, str); + strncpy(buffer, str, MAX_PATH); char* p = buffer + strlen(buffer) - 1; while (*p != '/' && p > buffer) p--; p[1] = '\0'; } -void removeFileExtension(char* filename) +void removeFileExtension(char *filename) { - char* p = filename + strlen(filename) - 1; + char *p = filename + strlen(filename) - 1; while (p > filename && *p != '.') { *p = '\0'; @@ -489,17 +723,16 @@ void removeFileExtension(char* filename) *p = '\0'; } -void ReadDirectory(const char* path, vector* dirs, vector* files) +void ReadDirectory(const char *path, std::vector *dirs, std::vector *files) { - DIR* dir; - struct dirent* dent; + struct dirent *dent; if (dirs != nullptr) dirs->clear(); if (files != nullptr) files->clear(); - dir = opendir(path); + DIR * dir = opendir(path); if (dir != nullptr) { while ((dent = readdir(dir)) != nullptr) @@ -518,18 +751,18 @@ void ReadDirectory(const char* path, vector* dirs, vector* files } if (dirs != nullptr) - std::sort(dirs->begin(), dirs->end()); + sort(dirs->begin(), dirs->end()); if (files != nullptr) - std::sort(files->begin(), files->end()); + sort(files->begin(), files->end()); } -void saveAdfDir() +void saveAdfDir(void) { char path[MAX_DPATH]; int i; snprintf(path, MAX_DPATH, "%s/conf/adfdir.conf", start_path_data); - FILE* f = fopen(path, "w"); + FILE *f = fopen(path, "w"); if (!f) return; @@ -540,12 +773,18 @@ void saveAdfDir() snprintf(buffer, MAX_DPATH, "config_path=%s\n", config_path); fputs(buffer, f); + snprintf(buffer, MAX_DPATH, "controllers_path=%s\n", controllers_path); + fputs(buffer, f); + + snprintf(buffer, MAX_DPATH, "retroarch_config=%s\n", retroarch_file); + fputs(buffer, f); + snprintf(buffer, MAX_DPATH, "rom_path=%s\n", rom_path); fputs(buffer, f); snprintf(buffer, MAX_DPATH, "ROMs=%d\n", lstAvailableROMs.size()); fputs(buffer, f); - for (i = 0; i < lstAvailableROMs.size(); ++i) + for (i = 0; iName); fputs(buffer, f); @@ -557,7 +796,7 @@ void saveAdfDir() snprintf(buffer, MAX_DPATH, "MRUDiskList=%d\n", lstMRUDiskList.size()); fputs(buffer, f); - for (i = 0; i < lstMRUDiskList.size(); ++i) + for (i = 0; i 0 && strcspn(s + len - 1, "\t \r\n") == 0) + s[--len] = '\0'; +} + +void loadAdfDir(void) { char path[MAX_DPATH]; int i; - - strcpy(currentDir, start_path_data); +#ifdef ANDROID + strncpy(currentDir, getenv("SDCARD"), MAX_DPATH); +#else + strncpy(currentDir, start_path_data, MAX_DPATH); +#endif snprintf(config_path, MAX_DPATH, "%s/conf/", start_path_data); + snprintf(controllers_path, MAX_DPATH, "%s/controllers/", start_path_data); + snprintf(retroarch_file, MAX_DPATH, "%s/conf/retroarch.cfg", start_path_data); + +#ifdef ANDROID + char afepath[MAX_DPATH]; + snprintf(afepath, MAX_DPATH, "%s/Android/data/com.cloanto.amigaforever.essentials/files/rom/", getenv("SDCARD")); + DIR *afedir = opendir(afepath); + if (afedir) { + snprintf(rom_path, MAX_DPATH, "%s", afepath); + closedir(afedir); + } + else + snprintf(rom_path, MAX_DPATH, "%s/kickstarts/", start_path_data); +#else snprintf(rom_path, MAX_DPATH, "%s/kickstarts/", start_path_data); +#endif snprintf(rp9_path, MAX_DPATH, "%s/rp9/", start_path_data); snprintf(path, MAX_DPATH, "%s/conf/adfdir.conf", start_path_data); - FILE* f1 = fopen(path, "rt"); - if (f1) - { - fscanf(f1, "path="); - get_string(f1, currentDir, sizeof(currentDir)); - if (!feof(f1)) + struct zfile *fh; + fh = zfile_fopen(path, _T("r"), ZFD_NORMAL); + if (fh) { + char linea[CONFIG_BLEN]; + TCHAR option[CONFIG_BLEN], value[CONFIG_BLEN]; + int numROMs, numDisks, numCDs; + int romType = -1; + char romName[MAX_PATH] = { '\0' }; + char romPath[MAX_PATH] = { '\0' }; + char tmpFile[MAX_PATH]; + + while (zfile_fgetsa(linea, sizeof (linea), fh) != nullptr) { - fscanf(f1, "config_path="); - get_string(f1, config_path, sizeof(config_path)); - fscanf(f1, "rom_path="); - get_string(f1, rom_path, sizeof(rom_path)); + trimwsa(linea); + if (strlen(linea) > 0) { + if (!cfgfile_separate_linea(path, linea, option, value)) + continue; - int numROMs; - fscanf(f1, "ROMs=%d\n", &numROMs); - for (i = 0; i < numROMs; ++i) - { - AvailableROM* tmp; - tmp = new AvailableROM(); - fscanf(f1, "ROMName="); - get_string(f1, tmp->Name, sizeof(tmp->Name)); - fscanf(f1, "ROMPath="); - get_string(f1, tmp->Path, sizeof(tmp->Path)); - fscanf(f1, "ROMType=%d\n", &(tmp->ROMType)); - lstAvailableROMs.push_back(tmp); - } - - lstMRUDiskList.clear(); - int numDisks = 0; - char disk[MAX_PATH]; - fscanf(f1, "MRUDiskList=%d\n", &numDisks); - for (i = 0; i < numDisks; ++i) - { - fscanf(f1, "Diskfile="); - get_string(f1, disk, sizeof(disk)); - FILE * f = fopen(disk, "rb"); - if (f != NULL) - { - fclose(f); - lstMRUDiskList.push_back(disk); + if (cfgfile_string(option, value, "ROMName", romName, sizeof(romName)) + || cfgfile_string(option, value, "ROMPath", romPath, sizeof(romPath)) + || cfgfile_intval(option, value, "ROMType", &romType, 1)) { + if (strlen(romName) > 0 && strlen(romPath) > 0 && romType != -1) { + AvailableROM *tmp = new AvailableROM(); + strncpy(tmp->Name, romName, sizeof(tmp->Name)); + strncpy(tmp->Path, romPath, sizeof(tmp->Path)); + tmp->ROMType = romType; + lstAvailableROMs.push_back(tmp); + strncpy(romName, "", sizeof(romName)); + strncpy(romPath, "", sizeof(romPath)); + romType = -1; + } } - } - - lstMRUCDList.clear(); - int numCD = 0; - char cd[MAX_PATH]; - fscanf(f1, "MRUCDList=%d\n", &numCD); - for (i = 0; i < numCD; ++i) - { - fscanf(f1, "CDfile="); - get_string(f1, cd, sizeof(cd)); - FILE * f = fopen(cd, "rb"); - if (f != NULL) + else if (cfgfile_string(option, value, "Diskfile", tmpFile, sizeof(tmpFile))) { - fclose(f); - lstMRUCDList.push_back(cd); + FILE* f = fopen(tmpFile, "rb"); + if (f != nullptr) + { + fclose(f); + lstMRUDiskList.push_back(tmpFile); + } + } + else if (cfgfile_string(option, value, "CDfile", tmpFile, sizeof(tmpFile))) + { + FILE* f = fopen(tmpFile, "rb"); + if (f != nullptr) + { + fclose(f); + lstMRUCDList.push_back(tmpFile); + } + } + else { + cfgfile_string(option, value, "path", currentDir, sizeof(currentDir)); + cfgfile_string(option, value, "config_path", config_path, sizeof(config_path)); + cfgfile_string(option, value, "controllers_path", controllers_path, sizeof(controllers_path)); + cfgfile_string(option, value, "retroarch_config", retroarch_file, sizeof(retroarch_file)); + cfgfile_string(option, value, "rom_path", rom_path, sizeof(rom_path)); + cfgfile_intval(option, value, "ROMs", &numROMs, 1); + cfgfile_intval(option, value, "MRUDiskList", &numDisks, 1); + cfgfile_intval(option, value, "MRUCDList", &numCDs, 1); + cfgfile_intval(option, value, "Quickstart", &quickstart_start, 1); } } } - fclose(f1); + zfile_fclose(fh); } } -void target_reset() +int currVSyncRate = 0; +bool SetVSyncRate(int hz) +{ + char cmd[64]; + + if(currVSyncRate != hz && (hz == 50 || hz == 60)) + { +#ifdef PANDORA + snprintf((char*)cmd, 64, "sudo /usr/pandora/scripts/op_lcdrate.sh %d", hz); + system(cmd); +#endif + currVSyncRate = hz; + return true; + } + return false; +} + +void setCpuSpeed() +{ +#ifdef PANDORA + char speedCmd[128]; + + currprefs.pandora_cpu_speed = changed_prefs.pandora_cpu_speed; + + if(currprefs.pandora_cpu_speed != lastCpuSpeed) + { + snprintf((char*)speedCmd, 128, "unset DISPLAY; echo y | sudo -n /usr/pandora/scripts/op_cpuspeed.sh %d", currprefs.pandora_cpu_speed); + system(speedCmd); + lastCpuSpeed = currprefs.pandora_cpu_speed; + cpuSpeedChanged = true; + } +#endif + if(changed_prefs.ntscmode != currprefs.ntscmode) + { + if(changed_prefs.ntscmode) + SetVSyncRate(60); + else + SetVSyncRate(50); + fix_apmodes(&changed_prefs); + } +} + + +int getDefaultCpuSpeed(void) +{ +#ifdef PANDORA + int speed = 600; + FILE* f = fopen ("/etc/pandora/conf/cpu.conf", "rt"); + if(f) + { + char line[128]; + for(int i=0; i<6; ++i) + { + fscanf(f, "%s\n", &line); + if(strncmp(line, "default:", 8) == 0) + { + int value = 0; + sscanf(line, "default:%d", &value); + if(value > 500 && value < 1200) + { + speed = value; + } + } + } + fclose(f); + } + return speed; +#else + return 0; +#endif +} + + +void resetCpuSpeed(void) +{ +#ifdef PANDORA + if(cpuSpeedChanged) + { + lastCpuSpeed = defaultCpuSpeed - 10; + currprefs.pandora_cpu_speed = changed_prefs.pandora_cpu_speed = defaultCpuSpeed; + setCpuSpeed(); + } +#endif +} + +void target_addtorecent(const TCHAR *name, int t) { } -uae_u32 emulib_target_getcpurate(uae_u32 v, uae_u32* low) + +void target_reset(void) +{ +} + +bool target_can_autoswitchdevice(void) +{ + return true; +} + +uae_u32 emulib_target_getcpurate(uae_u32 v, uae_u32 *low) { *low = 0; - if (v == 1) - { + if (v == 1) { *low = 1e+9; /* We have nano seconds */ return 0; } - - if (v == 2) - { - int64_t time; + if (v == 2) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - time = (int64_t(ts.tv_sec) * 1000000000) + ts.tv_nsec; - *low = uae_u32(time & 0xffffffff); - return uae_u32(time >> 32); + int64_t time = int64_t(ts.tv_sec) * 1000000000 + ts.tv_nsec; + *low = (uae_u32)(time & 0xffffffff); + return (uae_u32)(time >> 32); } return 0; } +static void target_shutdown(void) +{ + system("sudo poweroff"); +} int main(int argc, char* argv[]) { struct sigaction action; + +#ifdef AMIBERRY + printf("Amiberry v2.6, by Dimitris (MiDWaN) Panokostas, Dom (Horace&TheSpider) Cresswell and TomB\n"); +#endif max_uae_width = 1920; max_uae_height = 1080; + defaultCpuSpeed = getDefaultCpuSpeed(); + // Get startup path getcwd(start_path_data, MAX_DPATH); loadAdfDir(); rp9_init(); - snprintf(savestate_fname, MAX_PATH, "%s/saves/default.ads", start_path_data); + snprintf(savestate_fname, sizeof savestate_fname, "%s/saves/default.ads", start_path_data); logging_init(); memset(&action, 0, sizeof(action)); @@ -711,9 +1085,26 @@ int main(int argc, char* argv[]) abort(); } + memset(&action, 0, sizeof(action)); + action.sa_sigaction = signal_buserror; + action.sa_flags = SA_SIGINFO; + if (sigaction(SIGBUS, &action, nullptr) < 0) + { + printf("Failed to set signal handler (SIGBUS).\n"); + abort(); + } + + memset(&action, 0, sizeof(action)); + action.sa_sigaction = signal_term; + action.sa_flags = SA_SIGINFO; + if (sigaction(SIGTERM, &action, nullptr) < 0) + { + printf("Failed to set signal handler (SIGTERM).\n"); + abort(); + } + alloc_AmigaMem(); RescanROMs(); - keyboard_settrans(); #ifdef CAPSLOCK_DEBIAN_WORKAROUND // set capslock state based upon current "real" state @@ -736,7 +1127,7 @@ int main(int argc, char* argv[]) real_main(argc, argv); -#ifdef CAPSLOCK_DEBIAN_WORKAROUND +#ifdef CAPSLOCK_DEBIAN_WORKAROUND // restore keyboard LEDs to normal state ioctl(0, KDSETLED, 0xFF); #endif @@ -751,19 +1142,50 @@ int main(int argc, char* argv[]) logging_cleanup(); + if(host_poweroff) + target_shutdown(); return 0; } +void PopulateCustomControlMap() +{ + strcpy(customControlMap[VK_UP], currprefs.custom_up); + strcpy(customControlMap[VK_DOWN], currprefs.custom_down); + strcpy(customControlMap[VK_LEFT], currprefs.custom_left); + strcpy(customControlMap[VK_RIGHT], currprefs.custom_right); + strcpy(customControlMap[VK_Green], currprefs.custom_a); + strcpy(customControlMap[VK_Blue], currprefs.custom_b); + strcpy(customControlMap[VK_Red], currprefs.custom_x); + strcpy(customControlMap[VK_Yellow], currprefs.custom_y); + strcpy(customControlMap[VK_LShoulder], currprefs.custom_l); + strcpy(customControlMap[VK_RShoulder], currprefs.custom_r); + strcpy(customControlMap[VK_Play], currprefs.custom_play); +} + int handle_msgpump() { int got = 0; SDL_Event rEvent; int keycode; + if (delayed_mousebutton) { + --delayed_mousebutton; + if (delayed_mousebutton == 0) + setmousebuttonstate(0, 0, 1); + } + + if (currprefs.customControls) + PopulateCustomControlMap(); while (SDL_PollEvent(&rEvent)) { got = 1; +#ifdef USE_SDL1 + Uint8* keystate = SDL_GetKeyState(nullptr); +#endif + +#ifdef USE_SDL2 const Uint8* keystate = SDL_GetKeyboardState(nullptr); +#endif switch (rEvent.type) { @@ -771,40 +1193,51 @@ int handle_msgpump() uae_quit(); break; - case SDL_JOYBUTTONDOWN: - if (currprefs.button_for_menu != -1 && rEvent.jbutton.button == currprefs.button_for_menu) - inputdevice_add_inputcode(AKS_ENTERGUI, 1); - if (currprefs.button_for_quit != -1 && rEvent.jbutton.button == currprefs.button_for_quit) - inputdevice_add_inputcode(AKS_QUIT, 1); - break; + //case SDL_JOYBUTTONDOWN: + // if (currprefs.button_for_menu != -1 && rEvent.jbutton.button == currprefs.button_for_menu) + // inputdevice_add_inputcode(AKS_ENTERGUI, 1); + // if (currprefs.button_for_quit != -1 && rEvent.jbutton.button == currprefs.button_for_quit) + // inputdevice_add_inputcode(AKS_QUIT, 1); + // break; case SDL_KEYDOWN: +#ifdef USE_SDL1 + // Strangely in FBCON left window is seen as left alt ?? + if (keyboard_type == 2) // KEYCODE_FBCON + { + if (keystate[SDLK_LCTRL] && (keystate[SDLK_LSUPER] || keystate[SDLK_LALT]) && (keystate[SDLK_RSUPER] || keystate[ + SDLK_MENU])) +#endif +#ifdef USE_SDL2 if (keystate[SDL_SCANCODE_LCTRL] && keystate[SDL_SCANCODE_LGUI] && (keystate[SDL_SCANCODE_RGUI] || keystate[SDL_SCANCODE_APPLICATION])) +#endif { uae_reset(0, 1); break; } +#ifdef USE_SDL1 + } + else + { + if (keystate[SDLK_LCTRL] && keystate[SDLK_LSUPER] && (keystate[SDLK_RSUPER] || keystate[SDLK_MENU])) + { + uae_reset(0, 1); + break; + } + } + + // fix Caps Lock keypress shown as SDLK_UNKNOWN (scancode = 58) + if (rEvent.key.keysym.scancode == 58 && rEvent.key.keysym.sym == SDLK_UNKNOWN) + rEvent.key.keysym.sym = SDLK_CAPSLOCK; +#endif switch (rEvent.key.keysym.sym) { - case SDLK_NUMLOCKCLEAR: - if (currprefs.keyboard_leds[KBLED_NUMLOCKB] > 0) - { - //oldleds ^= KBLED_NUMLOCKM; - //ch = true; - } - break; - case SDLK_CAPSLOCK: // capslock - if (currprefs.keyboard_leds[KBLED_CAPSLOCKB] > 0) - { - //oldleds ^= KBLED_CAPSLOCKM; - //ch = true; - } // Treat CAPSLOCK as a toggle. If on, set off and vice/versa ioctl(0, KDGKBLED, &kbd_flags); ioctl(0, KDGETLED, &kbd_led_status); - if ((kbd_flags & 07) & LED_CAP) + if (kbd_flags & 07 & LED_CAP) { // On, so turn off kbd_led_status &= ~LED_CAP; @@ -821,19 +1254,31 @@ int handle_msgpump() ioctl(0, KDSETLED, kbd_led_status); ioctl(0, KDSKBLED, kbd_flags); break; +#ifdef PANDORA + case SDLK_LCTRL: // Select key + inputdevice_add_inputcode (AKS_ENTERGUI, 1); + break; - case SDLK_SCROLLLOCK: - if (currprefs.keyboard_leds[KBLED_SCROLLLOCKB] > 0) - { - //oldleds ^= KBLED_SCROLLLOCKM; - //ch = true; - } + case SDLK_LSHIFT: // Shift key + inputdevice_do_keyboard(AK_LSH, 1); break; + case SDLK_RSHIFT: // Left shoulder button + case SDLK_RCTRL: // Right shoulder button + if(currprefs.input_tablet > TABLET_OFF) { + // Holding left or right shoulder button -> stylus does right mousebutton + doStylusRightClick = 1; + } +#endif default: - if (currprefs.amiberry_customControls) + if (currprefs.customControls) { +#ifdef USE_SDL1 keycode = customControlMap[rEvent.key.keysym.sym]; +#endif +#ifdef USE_SDL2 + keycode = SDL_GetKeyFromName(customControlMap[rEvent.key.keysym.sym]); +#endif if (keycode < 0) { // Simulate mouse or joystick @@ -853,31 +1298,42 @@ int handle_msgpump() break; case SDL_KEYUP: - if (currprefs.amiberry_customControls) + if (currprefs.customControls) + { +#ifdef USE_SDL1 + keycode = customControlMap[rEvent.key.keysym.sym]; +#endif +#ifdef USE_SDL2 + keycode = SDL_GetKeyFromName(customControlMap[rEvent.key.keysym.sym]); +#endif + if (keycode < 0) { - keycode = customControlMap[rEvent.key.keysym.sym]; - if (keycode < 0) - { - // Simulate mouse or joystick - SimulateMouseOrJoy(keycode, 0); - break; - } - if (keycode > 0) - { - // Send mapped key release - inputdevice_do_keyboard(keycode, 0); - break; - } + // Simulate mouse or joystick + SimulateMouseOrJoy(keycode, 0); + break; } + if (keycode > 0) + { + // Send mapped key release + inputdevice_do_keyboard(keycode, 0); + break; + } + } - translate_amiberry_keys(rEvent.key.keysym.sym, 0); - break; + translate_amiberry_keys(rEvent.key.keysym.sym, 0); + break; case SDL_MOUSEBUTTONDOWN: if (currprefs.jports[0].id == JSEM_MICE || currprefs.jports[1].id == JSEM_MICE) { - if (rEvent.button.button == SDL_BUTTON_LEFT) - setmousebuttonstate(0, 0, 1); + if (rEvent.button.button == SDL_BUTTON_LEFT) { +#ifdef PANDORA + if (currprefs.input_tablet > TABLET_OFF && !doStylusRightClick) + delayed_mousebutton = currprefs.pandora_tapDelay << 1; + else +#endif //PANDORA + setmousebuttonstate(0, doStylusRightClick, 1); + } if (rEvent.button.button == SDL_BUTTON_RIGHT) setmousebuttonstate(0, 1, 1); if (rEvent.button.button == SDL_BUTTON_MIDDLE) @@ -889,7 +1345,7 @@ int handle_msgpump() if (currprefs.jports[0].id == JSEM_MICE || currprefs.jports[1].id == JSEM_MICE) { if (rEvent.button.button == SDL_BUTTON_LEFT) - setmousebuttonstate(0, 0, 0); + setmousebuttonstate(0, doStylusRightClick, 0); if (rEvent.button.button == SDL_BUTTON_RIGHT) setmousebuttonstate(0, 1, 0); if (rEvent.button.button == SDL_BUTTON_MIDDLE) @@ -902,11 +1358,19 @@ int handle_msgpump() { if (currprefs.jports[0].id == JSEM_MICE || currprefs.jports[1].id == JSEM_MICE) { - int x, y; - int mouseScale = currprefs.input_joymouse_multiplier / 2; - x = rEvent.motion.xrel; - y = rEvent.motion.yrel; - + const int mouseScale = currprefs.input_joymouse_multiplier / 2; + const int x = rEvent.motion.xrel; + const int y = rEvent.motion.yrel; +#if defined (PANDORA) || defined (ANDROIDSDL) + if(rEvent.motion.x == 0 && x > -4) + x = -4; + if(rEvent.motion.y == 0 && y > -4) + y = -4; + if(rEvent.motion.x == currprefs.gfx_size.width - 1 && x < 4) + x = 4; + if(rEvent.motion.y == currprefs.gfx_size.height - 1 && y < 4) + y = 4; +#endif //PANDORA setmousestate(0, 0, x * mouseScale, 0); setmousestate(0, 1, y * mouseScale, 0); } @@ -916,8 +1380,8 @@ int handle_msgpump() case SDL_MOUSEWHEEL: if (currprefs.jports[0].id == JSEM_MICE || currprefs.jports[1].id == JSEM_MICE) { - int valY = rEvent.wheel.y; - int valX = rEvent.wheel.x; + const int valY = rEvent.wheel.y; + const int valX = rEvent.wheel.x; setmousestate(0, 2, valY, 0); setmousestate(0, 3, valX, 0); } diff --git a/src/osdep/amiberry_filesys.cpp b/src/osdep/amiberry_filesys.cpp index bd1eb292..d0548562 100644 --- a/src/osdep/amiberry_filesys.cpp +++ b/src/osdep/amiberry_filesys.cpp @@ -3,210 +3,229 @@ #include #include "sysconfig.h" #include "sysdeps.h" -#include "options.h" #include "config.h" #include "zfile.h" +#include "options.h" -int my_setcurrentdir (const TCHAR *curdir, TCHAR *oldcur) +int my_setcurrentdir(const TCHAR* curdir, TCHAR* oldcur) { - int ret = 0; - if (oldcur) - getcwd(oldcur, MAX_DPATH); - if (curdir) - chdir (curdir); - return ret; + const int ret = 0; + if (oldcur) + getcwd(oldcur, MAX_DPATH); + if (curdir) + chdir(curdir); + return ret; } -int my_mkdir (const char*name) +int my_mkdir(const char* name) { - return mkdir(name, 0777); + return mkdir(name, 0777); } -int my_rmdir (const char*name) +int my_rmdir(const char* name) { - return rmdir(name); + return rmdir(name); } -int my_unlink (const char* name) +int my_unlink(const char* name) { - return unlink(name); + return unlink(name); } -int my_rename (const char* oldname, const char* newname) +int my_rename(const char* oldname, const char* newname) { - return rename(oldname, newname); + return rename(oldname, newname); } struct my_opendir_s { - void *h; + void* h; }; -struct my_opendir_s *my_opendir (const char* name) +struct my_opendir_s* my_opendir(const char* name) { - struct my_opendir_s *mod; + struct my_opendir_s* mod; - mod = xmalloc (struct my_opendir_s, 1); - if (!mod) - return NULL; - mod->h = opendir(name); - if (mod->h == NULL) - { - xfree (mod); - return NULL; - } - return mod; + mod = xmalloc (struct my_opendir_s, 1); + if (!mod) + return nullptr; + mod->h = opendir(name); + if (mod->h == nullptr) + { + xfree (mod); + return nullptr; + } + return mod; } -void my_closedir (struct my_opendir_s *mod) +void my_closedir(struct my_opendir_s* mod) { - if (mod) - closedir((DIR *) mod->h); - xfree (mod); + if (mod) + closedir(static_cast

(mod->h)); + xfree (mod); } -int my_readdir (struct my_opendir_s *mod, char* name) +int my_readdir(struct my_opendir_s* mod, char* name) { - struct dirent *de; + if (!mod) + return 0; - if (!mod) - return 0; - - de = readdir((DIR *) mod->h); - if(de == 0) - return 0; - strncpy(name, de->d_name, MAX_PATH); - return 1; + struct dirent * de = readdir(static_cast(mod->h)); + if (de == nullptr) + return 0; + strncpy(name, de->d_name, MAX_PATH); + return 1; } struct my_openfile_s { - void *h; + void* h; }; -void my_close (struct my_openfile_s *mos) +void my_close(struct my_openfile_s* mos) { - if(mos) - close((int) mos->h); - xfree (mos); + if (mos) + close(int(mos->h)); + xfree (mos); } -uae_s64 int my_lseek (struct my_openfile_s *mos, uae_s64 int offset, int pos) +uae_s64 int my_lseek(struct my_openfile_s* mos,const uae_s64 int offset, const int pos) { - return lseek((int) mos->h, offset, pos); + return lseek(int(mos->h), offset, pos); } -uae_s64 int my_fsize (struct my_openfile_s *mos) +uae_s64 int my_fsize(struct my_openfile_s* mos) { - uae_s64 pos = lseek((int) mos->h, 0, SEEK_CUR); - uae_s64 size = lseek((int) mos->h, 0, SEEK_END); - lseek((int) mos->h, pos, SEEK_SET); - return size; + uae_s64 pos = lseek(int(mos->h), 0, SEEK_CUR); + uae_s64 size = lseek(int(mos->h), 0, SEEK_END); + lseek(int(mos->h), pos, SEEK_SET); + return size; } -unsigned int my_read (struct my_openfile_s *mos, void *b, unsigned int size) +unsigned int my_read(struct my_openfile_s* mos, void* b, unsigned int size) { - return read((int) mos->h, b, size); + return read(int(mos->h), b, size); } -unsigned int my_write (struct my_openfile_s *mos, void *b, unsigned int size) +unsigned int my_write(struct my_openfile_s* mos, void* b, unsigned int size) { - return write((int) mos->h, b, size); + return write(int(mos->h), b, size); } -int my_existsfile (const char *name) +int my_existsfile(const char* name) { - struct stat st; - if (lstat (name, &st) == -1) - { - return 0; - } - else - { - if (!S_ISDIR(st.st_mode)) - return 1; - } - return 0; + struct stat st; + if (lstat(name, &st) == -1) + { + return 0; + } + if (!S_ISDIR(st.st_mode)) + return 1; + return 0; } -int my_existsdir(const char *name) +int my_existsdir(const char* name) { - struct stat st; + struct stat st; - if(lstat(name, &st) == -1) - { - return 0; - } - else - { - if (S_ISDIR(st.st_mode)) - return 1; - } - return 0; + if (lstat(name, &st) == -1) + { + return 0; + } + if (S_ISDIR(st.st_mode)) + return 1; + return 0; } -struct my_openfile_s *my_open (const TCHAR *name, int flags) +struct my_openfile_s* my_open(const TCHAR* name, const int flags) { - struct my_openfile_s *mos; + struct my_openfile_s* mos; - mos = xmalloc (struct my_openfile_s, 1); - if (!mos) - return NULL; - mos->h = (void *) open(name, flags); - if (!mos->h) - { - xfree (mos); - mos = NULL; - } - return mos; + mos = xmalloc (struct my_openfile_s, 1); + if (!mos) + return nullptr; + if (flags & O_CREAT) + mos->h = reinterpret_cast(open(name, flags, 0660)); + else + mos->h = reinterpret_cast(open(name, flags)); + if (!mos->h) + { + xfree (mos); + mos = nullptr; + } + return mos; } -int my_truncate (const TCHAR *name, uae_u64 len) +int my_truncate(const TCHAR* name, uae_u64 len) { - return truncate(name, len); + return truncate(name, len); } -int my_getvolumeinfo (const char *root) +int my_getvolumeinfo(const char* root) { - struct stat st; - int ret = 0; + struct stat st; + const int ret = 0; - if (lstat (root, &st) == -1) - return -1; - if (!S_ISDIR(st.st_mode)) - return -1; - return ret; + if (lstat(root, &st) == -1) + return -1; + if (!S_ISDIR(st.st_mode)) + return -2; + return ret; } -FILE *my_opentext (const TCHAR *name) +FILE* my_opentext(const TCHAR* name) { - return fopen (name, "r"); + return fopen(name, "r"); } + +bool my_issamepath(const TCHAR* path1, const TCHAR* path2) +{ + if (!_tcsicmp(path1, path2)) + return true; + return false; +} + + +const TCHAR* my_getfilepart(const TCHAR* filename) +{ + const TCHAR* p; + + p = _tcsrchr(filename, '\\'); + if (p) + return p + 1; + p = _tcsrchr(filename, '/'); + if (p) + return p + 1; + return filename; +} + + /* Returns 1 if an actual volume-name was found, 2 if no volume-name (so uses some defaults) */ -int target_get_volume_name(struct uaedev_mount_info *mtinf, struct uaedev_config_info *ci, bool inserted, bool fullcheck, int cnt) +int target_get_volume_name(struct uaedev_mount_info* mtinf, struct uaedev_config_info* ci, bool inserted, + bool fullcheck, int cnt) { - _stprintf(ci->volname, _T("DH_%c"), ci->rootdir[0]); - return 2; + sprintf(ci->volname, "DH_%c", ci->rootdir[0]); + return 2; } diff --git a/src/osdep/amiberry_gfx.cpp b/src/osdep/amiberry_gfx.cpp index dc89500a..fd86daa4 100644 --- a/src/osdep/amiberry_gfx.cpp +++ b/src/osdep/amiberry_gfx.cpp @@ -15,12 +15,33 @@ #include "amiberry_gfx.h" #include -#include "SDL.h" +#include +#ifdef USE_SDL1 +#include +#include +#include +#include "threaddep/thread.h" +#include "bcm_host.h" +#endif + +#ifdef ANDROIDSDL +#include +#endif + /* SDL variable for output of emulation */ SDL_Surface* screen = nullptr; -static int oldtex_w, oldtex_h, oldtex_rtg; +static unsigned int current_vsync_frame = 0; +unsigned long time_per_frame = 20000; // Default for PAL (50 Hz): 20000 microsecs +static unsigned long last_synctime; +static int vsync_modulo = 1; +static int host_hz = 50; + +#ifdef USE_SDL1 +/* Dummy SDL variable for screen init */ +SDL_Surface *Dummy_prSDLScreen = NULL; +#endif /* Possible screen modes (x and y resolutions) */ #define MAX_SCREEN_MODES 14 @@ -33,7 +54,7 @@ struct MultiDisplay Displays[MAX_DISPLAYS]; int screen_is_picasso = 0; static SDL_Surface* current_screenshot = nullptr; -static char screenshot_filename_default[255] = +static char screenshot_filename_default[MAX_DPATH] = { '/', 't', 'm', 'p', '/', 'n', 'u', 'l', 'l', '.', 'p', 'n', 'g', '\0' }; @@ -43,11 +64,58 @@ static void CreateScreenshot(); static int save_thumb(char* path); int delay_savestate_frame = 0; +static unsigned long next_synctime = 0; + +#ifdef USE_SDL1 +DISPMANX_DISPLAY_HANDLE_T dispmanxdisplay; +DISPMANX_MODEINFO_T dispmanxdinfo; +DISPMANX_RESOURCE_HANDLE_T dispmanxresource_amigafb_1 = 0; +DISPMANX_RESOURCE_HANDLE_T dispmanxresource_amigafb_2 = 0; +DISPMANX_ELEMENT_HANDLE_T dispmanxelement; +DISPMANX_UPDATE_HANDLE_T dispmanxupdate; +VC_RECT_T src_rect; +VC_RECT_T dst_rect; +VC_RECT_T blit_rect; + +static int DispManXElementpresent = 0; +static unsigned char current_resource_amigafb = 0; +#endif + +static volatile uae_atomic vsync_counter = 0; +void vsync_callback(unsigned int a, void* b) +{ + atomic_inc(&vsync_counter); +} + int graphics_setup(void) { #ifdef PICASSO96 picasso_InitResolutions(); InitPicasso96(); +#endif +#ifdef USE_SDL1 + VCHI_INSTANCE_T vchi_instance; + VCHI_CONNECTION_T *vchi_connection; + TV_DISPLAY_STATE_T tvstate; + + if (vchi_initialise(&vchi_instance) == 0) { + if (vchi_connect(NULL, 0, vchi_instance) == 0) { + vc_vchi_tv_init(vchi_instance, &vchi_connection, 1); + if (vc_tv_get_display_state(&tvstate) == 0) { + HDMI_PROPERTY_PARAM_T property; + property.property = HDMI_PROPERTY_PIXEL_CLOCK_TYPE; + vc_tv_hdmi_get_property(&property); + float frame_rate = property.param1 == HDMI_PIXEL_CLOCK_TYPE_NTSC ? tvstate.display.hdmi.frame_rate * (1000.0f / 1001.0f) : tvstate.display.hdmi.frame_rate; + host_hz = int(frame_rate); + } + vc_vchi_tv_stop(); + vchi_disconnect(vchi_instance); + } + } + + bcm_host_init(); + dispmanxdisplay = vc_dispmanx_display_open(0); + vc_dispmanx_vsync_callback(dispmanxdisplay, vsync_callback, NULL); #endif return 1; } @@ -55,15 +123,38 @@ int graphics_setup(void) void InitAmigaVidMode(struct uae_prefs* p) { /* Initialize structure for Amiga video modes */ - gfxvidinfo.pixbytes = screen->format->BytesPerPixel; - gfxvidinfo.bufmem = static_cast(screen->pixels); - gfxvidinfo.outwidth = screen->w ? screen->w : AMIGA_WIDTH_MAX << currprefs.gfx_resolution; - gfxvidinfo.outheight = screen->h ? screen->h : AMIGA_HEIGHT_MAX << currprefs.gfx_vresolution; - gfxvidinfo.rowbytes = screen->pitch; + gfxvidinfo.drawbuffer.pixbytes = screen->format->BytesPerPixel; + gfxvidinfo.drawbuffer.bufmem = static_cast(screen->pixels); + gfxvidinfo.drawbuffer.outwidth = p->gfx_size.width; + gfxvidinfo.drawbuffer.outheight = p->gfx_size.height << p->gfx_vresolution; + gfxvidinfo.drawbuffer.rowbytes = screen->pitch; } void graphics_subshutdown() { +#ifdef USE_SDL1 + if (DispManXElementpresent == 1) + { + DispManXElementpresent = 0; + dispmanxupdate = vc_dispmanx_update_start(0); + vc_dispmanx_element_remove(dispmanxupdate, dispmanxelement); + vc_dispmanx_update_submit_sync(dispmanxupdate); + } + + if (dispmanxresource_amigafb_1 != 0) { + vc_dispmanx_resource_delete(dispmanxresource_amigafb_1); + dispmanxresource_amigafb_1 = 0; + } + if (dispmanxresource_amigafb_2 != 0) { + vc_dispmanx_resource_delete(dispmanxresource_amigafb_2); + dispmanxresource_amigafb_2 = 0; + } + + if (screen != nullptr) { + SDL_FreeSurface(screen); + screen = nullptr; + } +#elif USE_SDL2 if (screen != nullptr) { SDL_FreeSurface(screen); @@ -73,15 +164,17 @@ void graphics_subshutdown() { SDL_DestroyTexture(texture); } +#endif } -void Create_SDL_Surface(int width, int height, int depth) +#ifdef USE_SDL2 +void Create_SDL_Surface(const int width, const int height, const int depth) { screen = SDL_CreateRGBSurface(0, width, height, depth, 0, 0, 0, 0); check_error_sdl(screen == nullptr, "Unable to create a surface"); } -void Create_SDL_Texture(int width, int height, int depth) +void Create_SDL_Texture(const int width, const int height, const int depth) { if (depth == 16) { // Initialize SDL Texture for the renderer @@ -104,15 +197,41 @@ void Create_SDL_Texture(int width, int height, int depth) // Check if the requested Amiga resolution can be displayed with the current Screen mode as a direct multiple // Based on this we make the decision to use Linear (smooth) or Nearest Neighbor (pixelated) scaling -bool isModeAspectRatioExact(SDL_DisplayMode* mode, int width, int height) +bool isModeAspectRatioExact(SDL_DisplayMode* mode, const int width, const int height) { if (mode->w % width == 0 && mode->h % height == 0) return true; return false; } +#endif void updatedisplayarea() { +#ifdef USE_SDL1 + if (current_resource_amigafb == 1) + { + current_resource_amigafb = 0; + vc_dispmanx_resource_write_data(dispmanxresource_amigafb_1, + VC_IMAGE_RGB565, + gfxvidinfo.drawbuffer.rowbytes, + gfxvidinfo.drawbuffer.bufmem, + &blit_rect); + dispmanxupdate = vc_dispmanx_update_start(0); + vc_dispmanx_element_change_source(dispmanxupdate, dispmanxelement, dispmanxresource_amigafb_1); + } + else + { + current_resource_amigafb = 1; + vc_dispmanx_resource_write_data(dispmanxresource_amigafb_2, + VC_IMAGE_RGB565, + gfxvidinfo.drawbuffer.rowbytes, + gfxvidinfo.drawbuffer.bufmem, + &blit_rect); + dispmanxupdate = vc_dispmanx_update_start(0); + vc_dispmanx_element_change_source(dispmanxupdate, dispmanxelement, dispmanxresource_amigafb_2); + } + vc_dispmanx_update_submit(dispmanxupdate, NULL, NULL); +#elif USE_SDL2 // Update the texture from the surface SDL_UpdateTexture(texture, nullptr, screen->pixels, screen->pitch); SDL_RenderClear(renderer); @@ -120,27 +239,106 @@ void updatedisplayarea() SDL_RenderCopy(renderer, texture, nullptr, nullptr); // Update the window surface (show the renderer) SDL_RenderPresent(renderer); +#endif } +#ifdef USE_SDL1 +void open_sdl1_screen(int width, int height) +{ + if (Dummy_prSDLScreen != NULL) + { + // y.f. 2016-10-13 : free the previous screen surface every time, + // so we can have fullscreen while running and windowed while in config window. + // Apparently, something somewhere is resetting the screen. + SDL_FreeSurface(Dummy_prSDLScreen); + Dummy_prSDLScreen = NULL; + } + + if (Dummy_prSDLScreen == NULL) + Dummy_prSDLScreen = SDL_SetVideoMode(width, height, 16, SDL_SWSURFACE | SDL_FULLSCREEN); + + currprefs.gfx_correct_aspect = changed_prefs.gfx_correct_aspect; + currprefs.gfx_fullscreen_ratio = changed_prefs.gfx_fullscreen_ratio; + + screen = SDL_CreateRGBSurface(SDL_HWSURFACE, width, height, 16, + Dummy_prSDLScreen->format->Rmask, Dummy_prSDLScreen->format->Gmask, Dummy_prSDLScreen->format->Bmask, Dummy_prSDLScreen->format->Amask); + + vc_dispmanx_display_get_info(dispmanxdisplay, &dispmanxdinfo); + + dispmanxresource_amigafb_1 = vc_dispmanx_resource_create(VC_IMAGE_RGB565, width, height, &vc_image_ptr); + dispmanxresource_amigafb_2 = vc_dispmanx_resource_create(VC_IMAGE_RGB565, width, height, &vc_image_ptr); + + vc_dispmanx_rect_set(&blit_rect, 0, 0, width, height); + vc_dispmanx_resource_write_data(dispmanxresource_amigafb_1, VC_IMAGE_RGB565, prSDLScreen->pitch, prSDLScreen->pixels, &blit_rect); + vc_dispmanx_rect_set(&src_rect, 0, 0, width << 16, height << 16); + + // 16/9 to 4/3 ratio adaptation. + if (currprefs.gfx_correct_aspect == 0) + { + // Fullscreen. + int scaled_width = dispmanxdinfo.width * currprefs.gfx_fullscreen_ratio / 100; + int scaled_height = dispmanxdinfo.height * currprefs.gfx_fullscreen_ratio / 100; + vc_dispmanx_rect_set( &dst_rect, (dispmanxdinfo.width - scaled_width)/2, (dispmanxdinfo.height - scaled_height)/2, + scaled_width, scaled_height); + } + else + { + // 4/3 shrink. + int scaled_width = dispmanxdinfo.width * currprefs.gfx_fullscreen_ratio / 100; + int scaled_height = dispmanxdinfo.height * currprefs.gfx_fullscreen_ratio / 100; + vc_dispmanx_rect_set( &dst_rect, (dispmanxdinfo.width - scaled_width / 16 * 12)/2, (dispmanxdinfo.height - scaled_height)/2, + scaled_width/16*12, scaled_height); + } + + if (DispManXElementpresent == 0) + { + DispManXElementpresent = 1; + dispmanxupdate = vc_dispmanx_update_start(0); + dispmanxelement = vc_dispmanx_element_add(dispmanxupdate, dispmanxdisplay, 2, // layer + &dst_rect, dispmanxresource_amigafb_1, &src_rect, DISPMANX_PROTECTION_NONE, &alpha, + NULL, // clamp + DISPMANX_NO_ROTATE); + + vc_dispmanx_update_submit(dispmanxupdate, NULL, NULL); + } +} +#endif + static void open_screen(struct uae_prefs* p) { int width; int height; - int depth = 32; + int depth = 16; + +#ifdef USE_SDL1 + VC_DISPMANX_ALPHA_T alpha = { + DISPMANX_FLAGS_ALPHA_T(DISPMANX_FLAGS_ALPHA_FROM_SOURCE | DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS), + 255, /*alpha 0->255*/ + 0 + }; + + uint32_t vc_image_ptr; + current_resource_amigafb = 0; + next_synctime = 0; +#endif + #ifdef PICASSO96 if (screen_is_picasso) { - width = picasso_vidinfo.width; - height = picasso_vidinfo.height; + width = picasso_vidinfo.width ? picasso_vidinfo.width : 640; + height = picasso_vidinfo.height ? picasso_vidinfo.height : 256; +#ifdef USE_SDL2 SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); // we always use linear for Picasso96 modes +#endif //USE_SDL2 } else -#endif +#endif //PICASSO96 { p->gfx_resolution = p->gfx_size.width ? (p->gfx_size.width > 600 ? 1 : 0) : 1; - width = p->gfx_size.width ? p->gfx_size.width : AMIGA_WIDTH_MAX << currprefs.gfx_resolution; - height = p->gfx_size.height ? p->gfx_size.height : AMIGA_HEIGHT_MAX << currprefs.gfx_vresolution; - + width = p->gfx_size.width ? p->gfx_size.width : 640; + height = p->gfx_size.height ? p->gfx_size.height << p->gfx_vresolution : 256; + +#ifdef USE_SDL2 if (p->scaling_method == -1) { if (isModeAspectRatioExact(&sdlMode, width, height)) @@ -152,20 +350,30 @@ static void open_screen(struct uae_prefs* p) SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest"); else if (p->scaling_method == 1) SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); +#endif } graphics_subshutdown(); +#ifdef USE_SDL1 + open_sdl1_screen(width, height); + vsync_counter = 0; + current_vsync_frame = 2; +#elif USE_SDL2 Create_SDL_Surface(width, height, depth); if (screen_is_picasso) SDL_RenderSetLogicalSize(renderer, width, height); else - SDL_RenderSetLogicalSize(renderer, width, height*2); - + { + if (p->gfx_vresolution) + SDL_RenderSetLogicalSize(renderer, width, height); + else + SDL_RenderSetLogicalSize(renderer, width, height*2); + } Create_SDL_Texture(width, height, depth); - updatedisplayarea(); +#endif if (screen != nullptr) { @@ -187,14 +395,14 @@ int check_prefs_changed_gfx() if (currprefs.gfx_size.height != changed_prefs.gfx_size.height || currprefs.gfx_size.width != changed_prefs.gfx_size.width || - currprefs.gfx_size_fs.width != changed_prefs.gfx_size_fs.width || - currprefs.gfx_resolution != changed_prefs.gfx_resolution) + currprefs.gfx_resolution != changed_prefs.gfx_resolution || + currprefs.gfx_vresolution != changed_prefs.gfx_vresolution) { cfgfile_configuration_change(1); currprefs.gfx_size.height = changed_prefs.gfx_size.height; currprefs.gfx_size.width = changed_prefs.gfx_size.width; - currprefs.gfx_size_fs.width = changed_prefs.gfx_size_fs.width; currprefs.gfx_resolution = changed_prefs.gfx_resolution; + currprefs.gfx_vresolution = changed_prefs.gfx_vresolution; update_display(&currprefs); changed = 1; } @@ -203,6 +411,15 @@ int check_prefs_changed_gfx() currprefs.leds_on_screen = changed_prefs.leds_on_screen; changed = 1; } +#ifdef PANDORA + if (currprefs.pandora_hide_idle_led != changed_prefs.pandora_hide_idle_led || + currprefs.pandora_vertical_offset != changed_prefs.pandora_vertical_offset) + { + currprefs.pandora_hide_idle_led = changed_prefs.pandora_hide_idle_led; + currprefs.pandora_vertical_offset = changed_prefs.pandora_vertical_offset; + changed = 1; + } +#endif //PANDORA if (currprefs.chipset_refreshrate != changed_prefs.chipset_refreshrate) { currprefs.chipset_refreshrate = changed_prefs.chipset_refreshrate; @@ -211,6 +428,10 @@ int check_prefs_changed_gfx() } currprefs.filesys_limit = changed_prefs.filesys_limit; + currprefs.harddrive_read_only = changed_prefs.harddrive_read_only; + + if (changed) + init_custom(); return changed; } @@ -218,14 +439,16 @@ int check_prefs_changed_gfx() int lockscr() { - //SDL_LockSurface(screen); + if(SDL_LockSurface(screen)== -1) + return 0; + init_row_map(); return 1; } void unlockscr() { - //SDL_UnlockSurface(screen); + SDL_UnlockSurface(screen); } @@ -233,40 +456,110 @@ void wait_for_vsync() { } -void DX_Fill(int dstx, int dsty, int width, int height, uae_u32 color) + +bool render_screen(bool immediate) { - SDL_Rect dstrect; - if (width < 0) - width = picasso_vidinfo.width; - if (height < 0) - height = picasso_vidinfo.height; + if (savestate_state == STATE_DOSAVE) + { + if (delay_savestate_frame > 0) + --delay_savestate_frame; + else + { + CreateScreenshot(); + save_thumb(screenshot_filename); + savestate_state = 0; + } + } - dstrect.x = dstx; - dstrect.y = dsty; - dstrect.w = width; - dstrect.h = height; - - SDL_FillRect(screen, &dstrect, color); + return true; } -void flush_screen() +void show_screen(int mode) { - //if (savestate_state == STATE_DOSAVE) - //{ - // if (delay_savestate_frame > 0) - // --delay_savestate_frame; - // else - // { - // CreateScreenshot(); - // save_thumb(screenshot_filename); - // savestate_state = 0; - // } - //} +#ifdef USE_SDL1 + unsigned long start = read_processor_time(); + + int wait_till = current_vsync_frame; + if (vsync_modulo == 1) { + // Amiga framerate is equal to host framerate + do + { + usleep(10); + current_vsync_frame = vsync_counter; + } while (wait_till >= current_vsync_frame && read_processor_time() - start < 40000); + + if (wait_till + 1 != current_vsync_frame) { + // We missed a vsync... + next_synctime = 0; + } + } + else { + // Amiga framerate differs from host framerate + unsigned long wait_till_time = (next_synctime != 0) ? next_synctime : last_synctime + time_per_frame; + if (current_vsync_frame % vsync_modulo == 0) { + // Real vsync + if (start < wait_till_time) { + // We are in time, wait for vsync + atomic_set(&vsync_counter, current_vsync_frame); + do + { + usleep(10); + current_vsync_frame = vsync_counter; + } while (wait_till >= current_vsync_frame && read_processor_time() - start < 40000); + } + else { + // Too late for vsync + } + } + else { + // Estimate vsync by time + while (wait_till_time > read_processor_time()) { + usleep(10); + } + ++current_vsync_frame; + } + } + + current_vsync_frame += currprefs.gfx_framerate; +#endif + + last_synctime = read_processor_time(); updatedisplayarea(); - //init_row_map(); + +#ifdef USE_SDL1 + idletime += last_synctime - start; +#endif + + if (last_synctime - next_synctime > time_per_frame - 5000) + next_synctime = last_synctime + time_per_frame * (1 + currprefs.gfx_framerate); + else + next_synctime = next_synctime + time_per_frame * (1 + currprefs.gfx_framerate); } +unsigned long target_lastsynctime(void) +{ + return last_synctime; +} + +bool show_screen_maybe(bool show) +{ + if (show) + show_screen(0); + return false; +} + +#ifdef USE_SDL1 +void black_screen_now(void) +{ + if (screen != NULL) { + SDL_FillRect(screen, NULL, 0); + render_screen(true); + show_screen(0); + } +} +#endif + static void graphics_subinit() { if (screen == nullptr) @@ -282,69 +575,66 @@ static void graphics_subinit() } } -/* Color management */ +STATIC_INLINE int bitsInMask(unsigned long mask) +{ + /* count bits in mask */ + int n = 0; + while (mask) + { + n += mask & 1; + mask >>= 1; + } + return n; +} -static xcolnr xcol8[4096]; - -static int red_bits, green_bits, blue_bits, alpha_bits; -static int red_shift, green_shift, blue_shift, alpha_shift; -static int alpha; +STATIC_INLINE int maskShift(unsigned long mask) +{ + /* determine how far mask is shifted */ + int n = 0; + while (!(mask & 1)) + { + n++; + mask >>= 1; + } + return n; +} static int init_colors() { - alpha = 0; - /* Truecolor: */ - red_bits = bits_in_mask(screen->format->Rmask); - green_bits = bits_in_mask(screen->format->Gmask); - blue_bits = bits_in_mask(screen->format->Bmask); - red_shift = mask_shift(screen->format->Rmask); - green_shift = mask_shift(screen->format->Gmask); - blue_shift = mask_shift(screen->format->Bmask); - alpha_bits = 0; - alpha_shift = 0; - - alloc_colors64k(red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift, alpha_bits, alpha_shift, alpha, 0); + int red_bits = bitsInMask(screen->format->Rmask); + int green_bits = bitsInMask(screen->format->Gmask); + int blue_bits = bitsInMask(screen->format->Bmask); + int red_shift = maskShift(screen->format->Rmask); + int green_shift = maskShift(screen->format->Gmask); + int blue_shift = maskShift(screen->format->Bmask); + alloc_colors64k(red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift, 0); notice_new_xcolors(); return 1; } -int target_get_display(const TCHAR *name) -{ - return 0; -} - -const TCHAR *target_get_display_name(int num, bool friendlyname) -{ - if (num <= 0) - return NULL; - if (friendlyname) - return "Raspberry Pi display"; - return "0"; -} - /* * Find the colour depth of the display */ static int get_display_depth() { - // const SDL_VideoInfo *vid_info; +#ifdef USE_SDL1 + const SDL_VideoInfo *vid_info; + int depth = 0; - // int depth = 0; - int depth = 32; - - // if ((vid_info = SDL_GetVideoInfo())) - // { - // depth = vid_info->vfmt->BitsPerPixel; - - /* Don't trust the answer if it's 16 bits; the display - * could actually be 15 bits deep. We'll count the bits - * ourselves */ - // if (depth == 16) - // depth = bitsInMask (vid_info->vfmt->Rmask) + bitsInMask (vid_info->vfmt->Gmask) + bitsInMask (vid_info->vfmt->Bmask); - // } + if ((vid_info = SDL_GetVideoInfo())) { + depth = vid_info->vfmt->BitsPerPixel; + /* Don't trust the answer if it's 16 bits; the display + * could actually be 15 bits deep. We'll count the bits + * ourselves */ + if (depth == 16) + depth = bitsInMask(vid_info->vfmt->Rmask) + bitsInMask(vid_info->vfmt->Gmask) + bitsInMask(vid_info->vfmt->Bmask); + } +#elif USE_SDL2 + int depth = screen->format->BytesPerPixel == 4 ? 32 : 16; +#endif return depth; } @@ -375,9 +665,18 @@ void graphics_leave() { graphics_subshutdown(); +#ifdef USE_SDL1 + if (Dummy_prSDLScreen != NULL) { + SDL_FreeSurface(Dummy_prSDLScreen); + Dummy_prSDLScreen = NULL; + } + vc_dispmanx_vsync_callback(dispmanxdisplay, NULL, NULL); + vc_dispmanx_display_close(dispmanxdisplay); + bcm_host_deinit(); +#elif USE_SDL2 SDL_DestroyRenderer(renderer); SDL_DestroyWindow(sdlWindow); - +#endif SDL_VideoQuit(); } @@ -462,16 +761,14 @@ static int save_png(SDL_Surface* surface, char* path) static void CreateScreenshot() { - int w, h; - if (current_screenshot != nullptr) { SDL_FreeSurface(current_screenshot); current_screenshot = nullptr; } - w = screen->w; - h = screen->h; + int w = screen->w; + int h = screen->h; current_screenshot = SDL_CreateRGBSurfaceFrom(screen->pixels, w, h, @@ -497,41 +794,77 @@ static int save_thumb(char* path) bool vsync_switchmode(int hz) { + int changed_height = changed_prefs.gfx_size.height; + + if (hz >= 55) + hz = 60; + else + hz = 50; + + if (hz == 50 && currVSyncRate == 60) + { + // Switch from NTSC -> PAL + switch (changed_height) { + case 200: changed_height = 240; break; + case 216: changed_height = 262; break; + case 240: changed_height = 270; break; + case 256: changed_height = 270; break; + case 262: changed_height = 270; break; + case 270: changed_height = 270; break; + } + } + else if (hz == 60 && currVSyncRate == 50) + { + // Switch from PAL -> NTSC + switch (changed_height) { + case 200: changed_height = 200; break; + case 216: changed_height = 200; break; + case 240: changed_height = 200; break; + case 256: changed_height = 216; break; + case 262: changed_height = 216; break; + case 270: changed_height = 240; break; + } + } + + if (hz != currVSyncRate) + { + SetVSyncRate(hz); +#ifdef USE_SDL1 + black_screen_now(); +#endif + fpscounter_reset(); + time_per_frame = 1000 * 1000 / (hz); + if (hz == host_hz) + vsync_modulo = 1; + else if (hz > host_hz) + vsync_modulo = 6; // Amiga draws 6 frames while host has 5 vsyncs -> sync every 6th Amiga frame + else + vsync_modulo = 5; // Amiga draws 5 frames while host has 6 vsyncs -> sync every 5th Amiga frame + } + + if (!picasso_on && !picasso_requested_on) + changed_prefs.gfx_size.height = changed_height; + return true; } bool target_graphics_buffer_update() { - int w, h; - if (screen_is_picasso) - { - w = picasso96_state.Width > picasso_vidinfo.width ? picasso96_state.Width : picasso_vidinfo.width; - h = picasso96_state.Height > picasso_vidinfo.height ? picasso96_state.Height : picasso_vidinfo.height; - } - else - { - w = gfxvidinfo.outwidth; - h = gfxvidinfo.outheight; - } + bool rate_changed = false; - if (oldtex_w == w && oldtex_h == h && oldtex_rtg == screen_is_picasso) - return false; - - if (!w || !h) { - oldtex_w = w; - oldtex_h = h; - oldtex_rtg = screen_is_picasso; - return false; - } - - oldtex_w = w; - oldtex_h = h; - oldtex_rtg = screen_is_picasso; - - if (currprefs.gfx_size.height != h || - currprefs.gfx_size.width != w) + if (currprefs.gfx_size.height != changed_prefs.gfx_size.height) { update_display(&changed_prefs); + rate_changed = true; + } + + if (rate_changed) + { +#ifdef USE_SDL1 + black_screen_now(); +#endif + fpscounter_reset(); + time_per_frame = 1000 * 1000 / currprefs.chipset_refreshrate; } return true; @@ -539,24 +872,15 @@ bool target_graphics_buffer_update() #ifdef PICASSO96 -int picasso_palette() +int picasso_palette(struct MyCLUTEntry *CLUT) { - int i, changed; - - changed = 0; - for (i = 0; i < 256; i++) - { - int r = picasso96_state.CLUT[i].Red; - int g = picasso96_state.CLUT[i].Green; - int b = picasso96_state.CLUT[i].Blue; - //int value = (r << 16 | g << 8 | b); - //uae_u32 v = CONVERT_RGB(value); - uae_u32 v = (doMask256(r, red_bits, red_shift) - | doMask256(g, green_bits, green_shift) - | doMask256(b, blue_bits, blue_shift)) - | doMask256(0xff, alpha_bits, alpha_shift); - if (v != picasso_vidinfo.clut[i]) - { + int changed = 0; + for (int i = 0; i < 256; i++) { + int r = CLUT[i].Red; + int g = CLUT[i].Green; + int b = CLUT[i].Blue; + uae_u32 v = CONVERT_RGB(r << 16 | g << 8 | b); + if (v != picasso_vidinfo.clut[i]) { picasso_vidinfo.clut[i] = v; changed = 1; } @@ -621,10 +945,8 @@ static void modesList() void picasso_InitResolutions() { - struct MultiDisplay* md1; - int i, count = 0; + int count = 0; char tmp[200]; - int bit_idx; int bits[] = {8, 16, 32}; Displays[0].primary = 1; @@ -637,11 +959,11 @@ void picasso_InitResolutions() Displays[0].name = my_strdup(tmp); Displays[0].name2 = my_strdup("Display"); - md1 = Displays; + struct MultiDisplay * md1 = Displays; DisplayModes = md1->DisplayModes = xmalloc (struct PicassoResolution, MAX_PICASSO_MODES); - for (i = 0; i < MAX_SCREEN_MODES && count < MAX_PICASSO_MODES; i++) + for (int i = 0; i < MAX_SCREEN_MODES && count < MAX_PICASSO_MODES; i++) { - for (bit_idx = 0; bit_idx < 3; ++bit_idx) + for (int bit_idx = 0; bit_idx < 3; ++bit_idx) { int bitdepth = bits[bit_idx]; int bit_unit = (bitdepth + 1) & 0xF8; @@ -683,42 +1005,44 @@ void gfx_set_picasso_state(int on) void gfx_set_picasso_modeinfo(uae_u32 w, uae_u32 h, uae_u32 depth, RGBFTYPE rgbfmt) { depth >>= 3; - if ((unsigned(picasso_vidinfo.width) == w) && - (unsigned(picasso_vidinfo.height) == h) && - (unsigned(picasso_vidinfo.depth) == depth) && - (picasso_vidinfo.selected_rgbformat == rgbfmt)) + if (unsigned(picasso_vidinfo.width) == w && + unsigned(picasso_vidinfo.height) == h && + unsigned(picasso_vidinfo.depth) == depth && + picasso_vidinfo.selected_rgbformat == rgbfmt) return; picasso_vidinfo.selected_rgbformat = rgbfmt; picasso_vidinfo.width = w; picasso_vidinfo.height = h; - picasso_vidinfo.depth = 4; // Native depth + picasso_vidinfo.depth = screen->format->BytesPerPixel; // Native depth picasso_vidinfo.extra_mem = 1; - picasso_vidinfo.pixbytes = 4; // Native bytes - gfx_set_picasso_colors(rgbfmt); + + picasso_vidinfo.pixbytes = screen->format->BytesPerPixel; // Native bytes if (screen_is_picasso) { open_screen(&currprefs); picasso_vidinfo.rowbytes = screen->pitch; - picasso_vidinfo.rgbformat = RGBFB_R8G8B8A8; + picasso_vidinfo.rgbformat = screen->format->BytesPerPixel == 4 ? RGBFB_R8G8B8A8 : RGBFB_R5G6B5; } } -void gfx_set_picasso_colors(RGBFTYPE rgbfmt) -{ - alloc_colors_picasso(red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift, rgbfmt); -} - uae_u8* gfx_lock_picasso() { + if (screen == nullptr || screen_is_picasso == 0) + return nullptr; SDL_LockSurface(screen); picasso_vidinfo.rowbytes = screen->pitch; return static_cast(screen->pixels); } -void gfx_unlock_picasso() +void gfx_unlock_picasso(bool dorender) { SDL_UnlockSurface(screen); + if (dorender) + { + render_screen(true); + show_screen(0); + } } #endif // PICASSO96 diff --git a/src/osdep/amiberry_gfx.h b/src/osdep/amiberry_gfx.h index e68ea83f..79415bd7 100644 --- a/src/osdep/amiberry_gfx.h +++ b/src/osdep/amiberry_gfx.h @@ -1,5 +1,5 @@ #pragma once -#include "SDL.h" +#include extern SDL_Window* sdlWindow; extern SDL_Renderer* renderer; extern SDL_Texture* texture; @@ -12,5 +12,4 @@ extern SDL_Texture* gui_texture; extern SDL_DisplayMode sdlMode; extern void check_error_sdl(bool check, const char* message); -extern void updatedisplayarea(); -void DX_Fill(int dstx, int dsty, int width, int height, uae_u32 color); +extern void updatedisplayarea(); \ No newline at end of file diff --git a/src/osdep/amiberry_gui.cpp b/src/osdep/amiberry_gui.cpp index 14cd65e9..6e7a8c54 100644 --- a/src/osdep/amiberry_gui.cpp +++ b/src/osdep/amiberry_gui.cpp @@ -2,8 +2,14 @@ #include #include #include +#ifdef USE_SDL1 +#include +#include +#endif +#ifdef USE_SDL2 #include #include +#endif #include "sysconfig.h" #include "sysdeps.h" #include "uae.h" @@ -136,9 +142,9 @@ static void addrom(struct romdata* rd, const char* path) char tmpName[MAX_DPATH]; AvailableROM* tmp = new AvailableROM(); getromname(rd, tmpName); - strcpy(tmp->Name, tmpName); + strncpy(tmp->Name, tmpName, MAX_PATH); if (path != nullptr) - strcpy(tmp->Path, path); + strncpy(tmp->Path, path, MAX_PATH); tmp->ROMType = rd->type; lstAvailableROMs.push_back(tmp); romlist_add(path, rd); @@ -208,7 +214,7 @@ static struct romdata* scan_single_rom(char* path) { char tmp[MAX_DPATH]; - strcpy(tmp, path); + strncpy (tmp, path, MAX_PATH); struct romdata* rd = getromdatabypath(path); if (rd && rd->crc32 == 0xffffffff) return rd; @@ -266,20 +272,20 @@ static void scan_rom(char *path) void RescanROMs() { vector files; - char path[MAX_DPATH]; + char path[MAX_PATH]; romlist_clear(); ClearAvailableROMList(); - fetch_rompath(path, sizeof path); + fetch_rompath(path, MAX_PATH); load_keyring(&changed_prefs, path); ReadDirectory(path, nullptr, &files); for (int i = 0; i < files.size(); ++i) { - char tmppath[MAX_DPATH]; - strcpy(tmppath, path); - strncat(tmppath, files[i].c_str(), sizeof tmppath); + char tmppath[MAX_PATH]; + strncpy(tmppath, path, sizeof tmppath - 1); + strncat(tmppath, files[i].c_str(), sizeof tmppath - 1); scan_rom(tmppath); } @@ -413,6 +419,7 @@ int gui_init() quit_program = -quit_program; if (quit_program == UAE_QUIT) ret = -2; // Quit without start of emulator + setCpuSpeed(); update_display(&changed_prefs); @@ -423,9 +430,7 @@ int gui_init() void gui_exit() { -#ifdef PANDORA resetCpuSpeed(); -#endif sync(); amiberry_stop_sound(); saveAdfDir(); @@ -436,6 +441,18 @@ void gui_exit() void gui_purge_events() { +#ifdef USE_SDL1 + int counter = 0; + + SDL_Event event; + SDL_Delay(150); + // Strangely PS3 controller always send events, so we need a maximum number of event to purge. + while (SDL_PollEvent(&event) && counter < 50) + { + counter++; + SDL_Delay(10); + } +#endif keybuf_init(); } @@ -444,38 +461,38 @@ int gui_update() { char tmp[MAX_DPATH]; - fetch_savestatepath(savestate_fname, sizeof savestate_fname); + fetch_savestatepath(savestate_fname, MAX_DPATH); fetch_screenshotpath(screenshot_filename, MAX_DPATH); if (strlen(currprefs.floppyslots[0].df) > 0) extractFileName(currprefs.floppyslots[0].df, tmp); else - strcpy(tmp, last_loaded_config); + strncpy(tmp, last_loaded_config, sizeof tmp); - strncat(savestate_fname, tmp, sizeof savestate_fname); - strncat(screenshot_filename, tmp, sizeof screenshot_filename); + strncat(savestate_fname, tmp, MAX_DPATH - 1); + strncat(screenshot_filename, tmp, MAX_DPATH - 1); removeFileExtension(savestate_fname); removeFileExtension(screenshot_filename); - switch (currentStateNum) - { - case 1: - strcat(savestate_fname, "-1.uss"); - strcat(screenshot_filename, "-1.png"); - break; - case 2: - strcat(savestate_fname, "-2.uss"); - strcat(screenshot_filename, "-2.png"); - break; - case 3: - strcat(savestate_fname, "-3.uss"); - strcat(screenshot_filename, "-3.png"); - break; - default: - strcat(savestate_fname, ".uss"); - strcat(screenshot_filename, ".png"); - } - return 0; + switch(currentStateNum) + { + case 1: + strncat(savestate_fname,"-1.uss", MAX_PATH - 1); + strncat(screenshot_filename,"-1.png", MAX_PATH - 1); + break; + case 2: + strncat(savestate_fname,"-2.uss", MAX_PATH - 1); + strncat(screenshot_filename,"-2.png", MAX_PATH - 1); + break; + case 3: + strncat(savestate_fname,"-3.uss", MAX_PATH - 1); + strncat(screenshot_filename,"-3.png", MAX_PATH - 1); + break; + default: + strncat(savestate_fname,".uss", MAX_PATH - 1); + strncat(screenshot_filename,".png", MAX_PATH - 1); + } + return 0; } @@ -490,6 +507,9 @@ void gui_display(int shortcut) if (lstAvailableROMs.size() == 0) RescanROMs(); +#ifdef USE_SDL1 + graphics_subshutdown(); +#endif prefs_to_gui(); run_gui(); @@ -499,6 +519,10 @@ void gui_display(int shortcut) screen_is_picasso = 0; update_display(&changed_prefs); +#ifdef USE_SDL1 + /* Clear menu garbage at the bottom of the screen */ + black_screen_now(); +#endif reset_sound(); resume_sound(); @@ -563,11 +587,33 @@ void gui_led(int led, int on) else kbd_led_status &= ~LED_SCR; } } + ioctl(0, KDSETLED, kbd_led_status); } void gui_flicker_led(int led, int unitnum, int status) { + static int hd_resetcounter; + + switch(led) + { + case -1: // Reset HD and CD + gui_data.hd = 0; + break; + + case LED_POWER: + break; + + case LED_HD: + if (status == 0) { + hd_resetcounter--; + if (hd_resetcounter > 0) + return; + } + gui_data.hd = status; + hd_resetcounter = 2; + break; + } gui_led(led, status); } @@ -631,7 +677,7 @@ int translate_message(int msg, TCHAR* out) { if (gui_msglist[i].num == msg) { - strcpy(out, gui_msglist[i].msg); + strncpy(out, gui_msglist[i].msg, MAX_DPATH); return 1; } ++i; diff --git a/src/osdep/amiberry_input.cpp b/src/osdep/amiberry_input.cpp index 4f9a4996..f1050714 100644 --- a/src/osdep/amiberry_input.cpp +++ b/src/osdep/amiberry_input.cpp @@ -2,6 +2,7 @@ #include "sysdeps.h" #include "config.h" #include "options.h" +#include "keyboard.h" #include "inputdevice.h" #include @@ -134,28 +135,31 @@ static void fill_blank_controller(void) default_controller_map.is_retroarch = false; } +//TODO: Check if we can use SCANCODES for both SDL versions +#ifdef USE_SDL1 +static void fill_default_keyboard() +{ + // test using iPac layout + default_keyboard_map.north_button = SDLK_LSHIFT; + default_keyboard_map.east_button = SDLK_LCTRL; + default_keyboard_map.south_button = SDLK_LALT; + default_keyboard_map.west_button = SDLK_SPACE; + default_keyboard_map.dpad_left = SDLK_LEFT; + default_keyboard_map.dpad_right = SDLK_RIGHT; + default_keyboard_map.dpad_up = SDLK_UP; + default_keyboard_map.dpad_down = SDLK_DOWN; + default_keyboard_map.left_shoulder = SDLK_z; + default_keyboard_map.right_shoulder = SDLK_x; + default_keyboard_map.select_button = SDLK_1; + default_keyboard_map.start_button = SDLK_2; + default_keyboard_map.lstick_button = SDLK_F1; + default_keyboard_map.rstick_button = SDLK_F2; -//static void fill_default_keyboard() -//{ -// // test using iPac layout -// default_keyboard_map.north_button = SDLK_LSHIFT; -// default_keyboard_map.east_button = SDLK_LCTRL; -// default_keyboard_map.south_button = SDLK_LALT; -// default_keyboard_map.west_button = SDLK_SPACE; -// default_keyboard_map.dpad_left = SDLK_LEFT; -// default_keyboard_map.dpad_right = SDLK_RIGHT; -// default_keyboard_map.dpad_up = SDLK_UP; -// default_keyboard_map.dpad_down = SDLK_DOWN; -// default_keyboard_map.left_shoulder = SDLK_z; -// default_keyboard_map.right_shoulder = SDLK_x; -// default_keyboard_map.select_button = SDLK_1; -// default_keyboard_map.start_button = SDLK_2; -// default_keyboard_map.lstick_button = SDLK_F1; -// default_keyboard_map.rstick_button = SDLK_F2; -// -// default_keyboard_map.is_retroarch = false; -//} + default_keyboard_map.is_retroarch = false; +} +#endif +#ifdef USE_SDL2 static void fill_default_keyboard() { // test using iPac layout @@ -176,6 +180,7 @@ static void fill_default_keyboard() default_keyboard_map.is_retroarch = false; } +#endif //# Keyboard input. Will recognize letters (a to z) and the following special keys (where kp_ //# is for keypad keys): @@ -189,33 +194,36 @@ static void fill_default_keyboard() //# tilde, backquote, pause, quote, comma, minus, slash, semicolon, equals, leftbracket, //# backslash, rightbracket, kp_period, kp_equals, rctrl, ralt -//const int RemapKeyMapList[] = { -// -1, -// SDLK_a, SDLK_b, SDLK_c, SDLK_d, SDLK_e, -// SDLK_f, SDLK_g, SDLK_h, SDLK_i, SDLK_j, -// SDLK_k, SDLK_l, SDLK_m, SDLK_n, SDLK_o, -// SDLK_p, SDLK_q, SDLK_r, SDLK_s, SDLK_t, -// SDLK_u, SDLK_v, SDLK_w, SDLK_x, SDLK_y, SDLK_z, -// SDLK_LEFT, SDLK_RIGHT, SDLK_UP, SDLK_DOWN, SDLK_RETURN, -// SDLK_KP_ENTER, SDLK_TAB, SDLK_INSERT, SDLK_DELETE, SDLK_END, SDLK_HOME, -// SDLK_RSHIFT, SDLK_LSHIFT, SDLK_LCTRL, SDLK_LALT, SDLK_SPACE, -// SDLK_ESCAPE, SDLK_PLUS, SDLK_MINUS, SDLK_KP_PLUS, SDLK_KP_MINUS, -// SDLK_F1, SDLK_F2, SDLK_F3, SDLK_F4, SDLK_F5, SDLK_F6, -// SDLK_F7, SDLK_F8, SDLK_F9, SDLK_F10, SDLK_F11, SDLK_F12, -// SDLK_0, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, -// SDLK_6, SDLK_7, SDLK_8, SDLK_9, SDLK_PAGEUP, SDLK_PAGEDOWN, -// SDLK_KP_0, SDLK_KP_1, SDLK_KP_2, SDLK_KP_3, SDLK_KP_4, -// SDLK_KP_5, SDLK_KP_6, SDLK_KP_7, SDLK_KP_8, SDLK_KP_9, -// SDLK_PERIOD, SDLK_CAPSLOCK, SDLK_NUMLOCKCLEAR, SDLK_BACKSPACE, -// // divide -// SDLK_ASTERISK, -1, SDLK_PRINTSCREEN, SDLK_SCROLLLOCK, -// // tilde -// -1, SDLK_BACKQUOTE,SDLK_PAUSE, SDLK_QUOTE, SDLK_COMMA, -// SDLK_MINUS, SDLK_SLASH, SDLK_SEMICOLON,SDLK_EQUALS, SDLK_LEFTPAREN, -// SDLK_BACKSLASH, SDLK_RIGHTPAREN, -// SDLK_KP_PERIOD, SDLK_KP_EQUALS,SDLK_RCTRL, SDLK_RALT -//}; +#ifdef USE_SDL1 +const int RemapKeyMapList[] = { + -1, + SDLK_a, SDLK_b, SDLK_c, SDLK_d, SDLK_e, + SDLK_f, SDLK_g, SDLK_h, SDLK_i, SDLK_j, + SDLK_k, SDLK_l, SDLK_m, SDLK_n, SDLK_o, + SDLK_p, SDLK_q, SDLK_r, SDLK_s, SDLK_t, + SDLK_u, SDLK_v, SDLK_w, SDLK_x, SDLK_y, SDLK_z, + SDLK_LEFT, SDLK_RIGHT, SDLK_UP, SDLK_DOWN, SDLK_RETURN, + SDLK_KP_ENTER, SDLK_TAB, SDLK_INSERT, SDLK_DELETE, SDLK_END, SDLK_HOME, + SDLK_RSHIFT, SDLK_LSHIFT, SDLK_LCTRL, SDLK_LALT, SDLK_SPACE, + SDLK_ESCAPE, SDLK_PLUS, SDLK_MINUS, SDLK_KP_PLUS, SDLK_KP_MINUS, + SDLK_F1, SDLK_F2, SDLK_F3, SDLK_F4, SDLK_F5, SDLK_F6, + SDLK_F7, SDLK_F8, SDLK_F9, SDLK_F10, SDLK_F11, SDLK_F12, + SDLK_0, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, + SDLK_6, SDLK_7, SDLK_8, SDLK_9, SDLK_PAGEUP, SDLK_PAGEDOWN, + SDLK_KP0, SDLK_KP1, SDLK_KP2, SDLK_KP3, SDLK_KP4, + SDLK_KP5, SDLK_KP6, SDLK_KP7, SDLK_KP8, SDLK_KP9, + SDLK_PERIOD, SDLK_CAPSLOCK, SDLK_NUMLOCK, SDLK_BACKSPACE, + // divide + SDLK_ASTERISK, -1, SDLK_PRINT, SDLK_SCROLLOCK, + // tilde + -1, SDLK_BACKQUOTE,SDLK_PAUSE, SDLK_QUOTE, SDLK_COMMA, + SDLK_MINUS, SDLK_SLASH, SDLK_SEMICOLON,SDLK_EQUALS, SDLK_LEFTPAREN, + SDLK_BACKSLASH, SDLK_RIGHTPAREN, + SDLK_KP_PERIOD, SDLK_KP_EQUALS,SDLK_RCTRL, SDLK_RALT +}; +#endif +#ifdef USE_SDL2 const int RemapKeyMapList[] = { -1, SDL_SCANCODE_A, SDL_SCANCODE_B, SDL_SCANCODE_C, SDL_SCANCODE_D, SDL_SCANCODE_E, @@ -240,6 +248,7 @@ const int RemapKeyMapList[] = { SDL_SCANCODE_BACKSLASH, SDL_SCANCODE_RIGHTBRACKET, SDL_SCANCODE_KP_PERIOD, SDL_SCANCODE_KP_EQUALS, SDL_SCANCODE_RCTRL, SDL_SCANCODE_RALT }; +#endif const char* RemapKeyMapListStrings[] = { "nul", @@ -740,8 +749,14 @@ static int init_joystick(void) if (Joysticktable[cpt] != nullptr) { +#ifdef USE_SDL1 + if (SDL_JoystickName(cpt) != nullptr) + strncpy(JoystickName[cpt], SDL_JoystickName(cpt), sizeof JoystickName[cpt] - 1); +#endif +#ifdef USE_SDL2 if (SDL_JoystickNameForIndex(cpt) != nullptr) strncpy(JoystickName[cpt], SDL_JoystickNameForIndex(cpt), sizeof JoystickName[cpt] - 1); +#endif else sprintf(JoystickName[cpt], "Joystick%d", cpt); @@ -910,6 +925,8 @@ static int get_joystick_widget_first(const int joy, const int type) return FIRST_JOY_AXIS; case IDEV_WIDGET_BUTTONAXIS: return MAX_JOY_AXES + MAX_JOY_BUTTONS; + default: + return -1; } } return -1; @@ -982,10 +999,14 @@ static void read_joystick(void) // First handle retroarch (or default) keys as Joystick... if (currprefs.jports[joyid].id >= JSEM_JOYS && currprefs.jports[joyid].id < JSEM_JOYS + numKeysAsJoys) { - const int hostkeyid = 0;//currprefs.jports[joyid].id - JSEM_JOYS; + const int hostkeyid = currprefs.jports[joyid].id - JSEM_JOYS; +#ifdef USE_SDL1 + Uint8* keystate = SDL_GetKeyState(nullptr); +#endif +#ifdef USE_SDL2 const Uint8* keystate = SDL_GetKeyboardState(nullptr); - +#endif // cd32 red, blue, green, yellow setjoybuttonstate(0, 0, keystate[host_keyboard_buttons[hostkeyid].south_button]); // b setjoybuttonstate(0, 1, keystate[host_keyboard_buttons[hostkeyid].east_button]); // a @@ -1201,7 +1222,7 @@ struct inputdevice_functions inputdevicefunc_joystick = { get_joystick_flags }; -int input_get_default_joystick(struct uae_input_device* uid, int num, int port, int af, int mode, bool gp, +int input_get_default_joystick(struct uae_input_device* uid, const int num, int port, const int af, const int mode, const bool gp, bool joymouseswap) { // DEAL WITH AXIS INPUT EVENTS @@ -1456,7 +1477,7 @@ int input_get_default_joystick_analog(struct uae_input_device* uid, int num, int } -void SimulateMouseOrJoy(int code, int keypressed) +void SimulateMouseOrJoy(const int code, const int keypressed) { switch (code) { @@ -1530,8 +1551,3 @@ void SimulateMouseOrJoy(int code, int keypressed) break; } } - -int is_tablet() -{ - return 0; -} \ No newline at end of file diff --git a/src/osdep/amiberry_mem.cpp b/src/osdep/amiberry_mem.cpp index bdfe15b7..dc870ba1 100644 --- a/src/osdep/amiberry_mem.cpp +++ b/src/osdep/amiberry_mem.cpp @@ -1,202 +1,451 @@ #include "sysconfig.h" #include "sysdeps.h" #include "config.h" -#include "autoconf.h" #include "uae.h" #include "options.h" #include "gui.h" -#include "memory.h" +#include "include/memory.h" #include "newcpu.h" #include "custom.h" +#include "autoconf.h" #include "akiko.h" +#include "ar.h" +#include "uae/mman.h" #include -#include "SDL.h" +#include -extern addrbank gfxmem_bank; -uae_u8* natmem_offset = nullptr; -uae_u32 natmem_size; -static uae_u64 totalAmigaMemSize; -#define MAXAMIGAMEM 0x6000000 // 64 MB (16 MB for standard Amiga stuff, 16 MG RTG, 64 MB Z3 fast) + +uae_u8* natmem_offset = 0; +static uae_u32 natmem_size; uae_u32 max_z3fastmem; /* JIT can access few bytes outside of memory block of it executes code at the very end of memory block */ #define BARRIER 32 -static uae_u8* additional_mem = static_cast(MAP_FAILED); +static uae_u8* additional_mem = (uae_u8*) MAP_FAILED; #define ADDITIONAL_MEMSIZE (128 + 16) * 1024 * 1024 -int z3_start_adr = 0; -int rtg_start_adr = 0; +static uae_u8* a3000_mem = (uae_u8*) MAP_FAILED; +static int a3000_totalsize = 0; +#define A3000MEM_START 0x08000000 + +static int lastLowSize = 0; +static int lastHighSize = 0; -void free_AmigaMem() +int z3base_adr = 0; + + +void free_AmigaMem(void) { - if (natmem_offset != nullptr) - { - free(natmem_offset); - natmem_offset = nullptr; - } - if (additional_mem != MAP_FAILED) - { - munmap(additional_mem, ADDITIONAL_MEMSIZE); - additional_mem = static_cast(MAP_FAILED); - } + if(natmem_offset != 0) + { +#ifdef AMIBERRY + munmap(natmem_offset, natmem_size + BARRIER); +#else + free(natmem_offset); +#endif + natmem_offset = 0; + } + if(additional_mem != MAP_FAILED) + { + munmap(additional_mem, ADDITIONAL_MEMSIZE + BARRIER); + additional_mem = (uae_u8*) MAP_FAILED; + } + if(a3000_mem != MAP_FAILED) + { + munmap(a3000_mem, a3000_totalsize); + a3000_mem = (uae_u8*) MAP_FAILED; + a3000_totalsize = 0; + } } -void alloc_AmigaMem() +void alloc_AmigaMem(void) { int i; uae_u64 total; int max_allowed_mman; free_AmigaMem(); + set_expamem_z3_hack_mode(Z3MAPPING_AUTO); - // First attempt: allocate 16 MB for all memory in 24-bit area - // and additional mem for Z3 and RTG at correct offset - natmem_size = 16 * 1024 * 1024; - natmem_offset = static_cast(valloc(natmem_size)); - max_z3fastmem = ADDITIONAL_MEMSIZE - 16 * 1024 * 1024; - if (!natmem_offset) - { + // First attempt: allocate 16 MB for all memory in 24-bit area + // and additional mem for Z3 and RTG at correct offset + natmem_size = 16 * 1024 * 1024; +#ifdef AMIBERRY + // address returned by valloc() too high for later mmap() calls. Use mmap() also for first area. + natmem_offset = (uae_u8*) mmap((void *)0x20000000, natmem_size + BARRIER, + PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); +#else + natmem_offset = (uae_u8*)valloc (natmem_size + BARRIER); +#endif + max_z3fastmem = ADDITIONAL_MEMSIZE - (16 * 1024 * 1024); + if (!natmem_offset) { write_log("Can't allocate 16M of virtual address space!?\n"); abort(); } - additional_mem = static_cast(mmap(natmem_offset + 0x10000000, ADDITIONAL_MEMSIZE + BARRIER, - PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0)); - if (additional_mem != MAP_FAILED) - { - // Allocation successful -> we can use natmem_offset for entire memory access - z3_start_adr = 0x10000000; - rtg_start_adr = 0x18000000; - write_log("Allocated 16 MB for 24-bit area and %d MB for Z3 and RTG\n", ADDITIONAL_MEMSIZE / (1024 * 1024)); - return; - } - free(natmem_offset); +// FIXME This part of code caused crash on Android devices +#ifndef ANDROID + additional_mem = (uae_u8*) mmap(natmem_offset + Z3BASE_REAL, ADDITIONAL_MEMSIZE + BARRIER, + PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); + if(additional_mem != MAP_FAILED) + { + // Allocation successful -> we can use natmem_offset for entire memory access at real address + changed_prefs.z3autoconfig_start = currprefs.z3autoconfig_start = Z3BASE_REAL; + z3base_adr = Z3BASE_REAL; + write_log("Allocated 16 MB for 24-bit area (0x%08x) and %d MB for Z3 and RTG at real address (0x%08x - 0x%08x)\n", + natmem_offset, ADDITIONAL_MEMSIZE / (1024 * 1024), additional_mem, additional_mem + ADDITIONAL_MEMSIZE + BARRIER); + set_expamem_z3_hack_mode(Z3MAPPING_REAL); + return; + } - // Second attempt: allocate huge memory block for entire area - natmem_size = ADDITIONAL_MEMSIZE + 256 * 1024 * 1024; - natmem_offset = static_cast(valloc(natmem_size + BARRIER)); - if (natmem_offset) - { - // Allocation successful - z3_start_adr = 0x10000000; - rtg_start_adr = 0x18000000; - write_log("Allocated %d MB for entire memory\n", natmem_size / (1024 * 1024)); - return; + additional_mem = (uae_u8*) mmap(natmem_offset + Z3BASE_UAE, ADDITIONAL_MEMSIZE + BARRIER, + PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); + if(additional_mem != MAP_FAILED) + { + // Allocation successful -> we can use natmem_offset for entire memory access at fake address + changed_prefs.z3autoconfig_start = currprefs.z3autoconfig_start = Z3BASE_UAE; + z3base_adr = Z3BASE_UAE; + write_log("Allocated 16 MB for 24-bit area (0x%08x) and %d MB for Z3 and RTG at fake address (0x%08x - 0x%08x)\n", + natmem_offset, ADDITIONAL_MEMSIZE / (1024 * 1024), additional_mem, additional_mem + ADDITIONAL_MEMSIZE + BARRIER); + set_expamem_z3_hack_mode(Z3MAPPING_UAE); + return; + } +#endif +#ifdef AMIBERRY + munmap(natmem_offset, natmem_size + BARRIER); +#else + free(natmem_offset); +#endif + + // Next attempt: allocate huge memory block for entire area + natmem_size = ADDITIONAL_MEMSIZE + 256 * 1024 * 1024; + natmem_offset = (uae_u8*)valloc (natmem_size + BARRIER); + if(natmem_offset) + { + // Allocation successful + changed_prefs.z3autoconfig_start = currprefs.z3autoconfig_start = Z3BASE_UAE; + z3base_adr = Z3BASE_UAE; + write_log("Allocated %d MB for entire memory\n", natmem_size / (1024 * 1024)); + return; + } + + // No mem for Z3 or RTG at all + natmem_size = 16 * 1024 * 1024; + natmem_offset = (uae_u8*)valloc(natmem_size + BARRIER); + + if (!natmem_offset) { + write_log("Can't allocate 16M of virtual address space!?\n"); + abort(); } - // Third attempt: old style: 64 MB allocated and Z3 and RTG at wrong address + changed_prefs.z3autoconfig_start = currprefs.z3autoconfig_start = 0x00000000; // No mem for Z3 + z3base_adr = 0x00000000; + max_z3fastmem = 0; - // Get max. available size - total = static_cast(sysconf(_SC_PHYS_PAGES)) * static_cast(getpagesize()); - - // Limit to max. 64 MB - natmem_size = total; - if (natmem_size > MAXAMIGAMEM) - natmem_size = MAXAMIGAMEM; - - // We need at least 16 MB - if (natmem_size < 16 * 1024 * 1024) - natmem_size = 16 * 1024 * 1024; - - write_log("Total physical RAM %lluM. Attempting to reserve: %uM.\n", total >> 20, natmem_size >> 20); - natmem_offset = static_cast(valloc(natmem_size + BARRIER)); - - if (!natmem_offset) - { - for (;;) - { - natmem_offset = static_cast(valloc(natmem_size + BARRIER)); - if (natmem_offset) - break; - natmem_size -= 16 * 1024 * 1024; - if (!natmem_size) - { - write_log("Can't allocate 16M of virtual address space!?\n"); - abort(); - } - } - } - - z3_start_adr = 0x01000000; - rtg_start_adr = 0x03000000; - max_z3fastmem = natmem_size - 32 * 1024 * 1024; - if (max_z3fastmem <= 0) - { - z3_start_adr = 0x00000000; // No mem for Z3 - if (max_z3fastmem == 0) - rtg_start_adr = 0x01000000; // We have mem for RTG - else - rtg_start_adr = 0x00000000; // No mem for expansion at all - max_z3fastmem = 0; - } write_log("Reserved: %p-%p (0x%08x %dM)\n", natmem_offset, (uae_u8*)natmem_offset + natmem_size, natmem_size, natmem_size >> 20); } -static uae_u32 getz2rtgaddr() +static bool HandleA3000Mem(int lowsize, int highsize) { - uae_u32 start; - start = currprefs.fastmem[0].size; - while (start & (currprefs.rtgboards[0].rtgmem_size - 1) && start < 4 * 1024 * 1024) - start += 1024 * 1024; - return start + 2 * 1024 * 1024; -} + bool result = true; + if (lowsize == lastLowSize && highsize == lastHighSize) + return result; -uae_u8* mapped_malloc(size_t s, const char* file) -{ - if (!strcmp(file, "chip")) - return natmem_offset + chipmem_start_addr; - - if (!strcmp(file, "fast")) - return natmem_offset + 0x200000; - - if (!strcmp(file, "bogo")) - return natmem_offset + bogomem_start_addr; - - if (!strcmp(file, "rom_f0")) - return natmem_offset + 0xf00000; - - if (!strcmp(file, "rom_e0")) - return natmem_offset + 0xe00000; - - if (!strcmp(file, "rom_a8")) - return natmem_offset + 0xa80000; - - if (!strcmp(file, "kick")) - return natmem_offset + kickmem_start_addr; - - if (!strcmp(file, "z3")) - return natmem_offset + z3_start_adr; //z3fastmem_start; - -#ifdef PICASSO96 - if (!strcmp(file, "z3_gfx")) + if (a3000_mem != MAP_FAILED) { - gfxmem_bank.start = rtg_start_adr; - return natmem_offset + rtg_start_adr; + write_log("HandleA3000Mem(): Free A3000 memory (0x%08x). %d MB.\n", a3000_mem, a3000_totalsize / (1024 * 1024)); + munmap(a3000_mem, a3000_totalsize); + a3000_mem = (uae_u8*)MAP_FAILED; + a3000_totalsize = 0; + lastLowSize = 0; + lastHighSize = 0; + } + if (lowsize + highsize > 0) + { + // Try to get memory for A3000 motherboard + write_log("Try to get A3000 memory at correct place (0x%08x). %d MB and %d MB.\n", A3000MEM_START, + lowsize / (1024 * 1024), highsize / (1024 * 1024)); + a3000_totalsize = lowsize + highsize; + a3000_mem = (uae_u8*)mmap(natmem_offset + (A3000MEM_START - lowsize), a3000_totalsize, + PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); + if (a3000_mem != MAP_FAILED) + { + lastLowSize = lowsize; + lastHighSize = highsize; + write_log(_T("Succeeded: location at 0x%08x (Amiga: 0x%08x)\n"), a3000_mem, (A3000MEM_START - lowsize)); + } + else + { + write_log("Failed.\n"); + a3000_totalsize = 0; + result = false; + } } - if (!strcmp(file, "z2_gfx")) - { - gfxmem_bank.start = getz2rtgaddr(); - return natmem_offset + gfxmem_bank.start; - } -#endif - if (!strcmp(file, "rtarea")) - return natmem_offset + rtarea_base; - - return nullptr; + return result; } -void mapped_free(uae_u8* p) +static bool A3000MemAvailable(void) { + return (a3000_mem != MAP_FAILED); } +bool uae_mman_info(addrbank *ab, struct uae_mman_data *md) +{ + bool got = false; + bool readonly = false; + uaecptr start; + uae_u32 size = ab->reserved_size; + uae_u32 readonlysize = size; + bool barrier = false; + + if (!_tcscmp(ab->label, _T("*"))) { + start = ab->start; + got = true; + if (expansion_get_autoconfig_by_address(&currprefs, ab->start) && !expansion_get_autoconfig_by_address(&currprefs, ab->start + size)) + barrier = true; + } + else if (!_tcscmp(ab->label, _T("*B"))) { + start = ab->start; + got = true; + barrier = true; + } + else if (!_tcscmp(ab->label, _T("chip"))) { + start = 0; + got = true; + if (!expansion_get_autoconfig_by_address(&currprefs, 0x00200000) && currprefs.chipmem_size == 2 * 1024 * 1024) + barrier = true; + if (currprefs.chipmem_size > 2 * 1024 * 1024) + barrier = true; + } + else if (!_tcscmp(ab->label, _T("kick"))) { + start = 0xf80000; + got = true; + barrier = true; + readonly = true; + } + else if (!_tcscmp(ab->label, _T("rom_a8"))) { + start = 0xa80000; + got = true; + readonly = true; + } + else if (!_tcscmp(ab->label, _T("rom_e0"))) { + start = 0xe00000; + got = true; + readonly = true; + } + else if (!_tcscmp(ab->label, _T("rom_f0"))) { + start = 0xf00000; + got = true; + readonly = true; + } + else if (!_tcscmp(ab->label, _T("rom_f0_ppc"))) { + // this is flash and also contains IO + start = 0xf00000; + got = true; + readonly = false; + } + else if (!_tcscmp(ab->label, _T("rtarea"))) { + start = rtarea_base; + got = true; + readonly = true; + readonlysize = RTAREA_TRAPS; + } + else if (!_tcscmp(ab->label, _T("ramsey_low"))) { + if (ab->reserved_size != lastLowSize) + HandleA3000Mem(ab->reserved_size, lastHighSize); + if (A3000MemAvailable()) { + start = a3000lmem_bank.start; + got = true; + } + } + else if (!_tcscmp(ab->label, _T("csmk1_maprom"))) { + start = 0x07f80000; + got = true; + } + else if (!_tcscmp(ab->label, _T("25bitram"))) { + start = 0x01000000; + got = true; + } + else if (!_tcscmp(ab->label, _T("ramsey_high"))) { + if (ab->reserved_size != lastHighSize) + HandleA3000Mem(lastLowSize, ab->reserved_size); + if (A3000MemAvailable()) { + start = 0x08000000; + got = true; + } + } + else if (!_tcscmp(ab->label, _T("dkb"))) { + start = 0x10000000; + got = true; + } + else if (!_tcscmp(ab->label, _T("fusionforty"))) { + start = 0x11000000; + got = true; + } + else if (!_tcscmp(ab->label, _T("blizzard_40"))) { + start = 0x40000000; + got = true; + } + else if (!_tcscmp(ab->label, _T("blizzard_48"))) { + start = 0x48000000; + got = true; + } + else if (!_tcscmp(ab->label, _T("blizzard_68"))) { + start = 0x68000000; + got = true; + } + else if (!_tcscmp(ab->label, _T("blizzard_70"))) { + start = 0x70000000; + got = true; + } + else if (!_tcscmp(ab->label, _T("cyberstorm"))) { + start = 0x0c000000; + got = true; + } + else if (!_tcscmp(ab->label, _T("cyberstormmaprom"))) { + start = 0xfff00000; + got = true; + } + else if (!_tcscmp(ab->label, _T("bogo"))) { + start = 0x00C00000; + got = true; + if (currprefs.bogomem_size <= 0x100000) + barrier = true; + } + else if (!_tcscmp(ab->label, _T("custmem1"))) { + start = currprefs.custom_memory_addrs[0]; + got = true; + } + else if (!_tcscmp(ab->label, _T("custmem2"))) { + start = currprefs.custom_memory_addrs[1]; + got = true; + } + else if (!_tcscmp(ab->label, _T("hrtmem"))) { + start = 0x00a10000; + got = true; + } + else if (!_tcscmp(ab->label, _T("arhrtmon"))) { + start = 0x00800000; + barrier = true; + got = true; + } + else if (!_tcscmp(ab->label, _T("xpower_e2"))) { + start = 0x00e20000; + barrier = true; + got = true; + } + else if (!_tcscmp(ab->label, _T("xpower_f2"))) { + start = 0x00f20000; + barrier = true; + got = true; + } + else if (!_tcscmp(ab->label, _T("nordic_f0"))) { + start = 0x00f00000; + barrier = true; + got = true; + } + else if (!_tcscmp(ab->label, _T("nordic_f4"))) { + start = 0x00f40000; + barrier = true; + got = true; + } + else if (!_tcscmp(ab->label, _T("nordic_f6"))) { + start = 0x00f60000; + barrier = true; + got = true; + } + else if (!_tcscmp(ab->label, _T("superiv_b0"))) { + start = 0x00b00000; + barrier = true; + got = true; + } + else if (!_tcscmp(ab->label, _T("superiv_d0"))) { + start = 0x00d00000; + barrier = true; + got = true; + } + else if (!_tcscmp(ab->label, _T("superiv_e0"))) { + start = 0x00e00000; + barrier = true; + got = true; + } + else if (!_tcscmp(ab->label, _T("ram_a8"))) { + start = 0x00a80000; + barrier = true; + got = true; + } + if (got) { + md->start = start; + md->size = size; + md->readonly = readonly; + md->readonlysize = readonlysize; + md->hasbarrier = barrier; + + if (md->hasbarrier) { + md->size += BARRIER; + } + } + return got; +} + + +bool mapped_malloc(addrbank *ab) +{ + if (ab->allocated_size) { + write_log(_T("mapped_malloc with memory bank '%s' already allocated!?\n"), ab->name); + } + ab->allocated_size = 0; + + if (ab->label && ab->label[0] == '*') { + if (ab->start == 0 || ab->start == 0xffffffff) { + write_log(_T("mapped_malloc(*) without start address!\n")); + return false; + } + } + + struct uae_mman_data md = { 0 }; + uaecptr start = ab->start; + if (uae_mman_info(ab, &md)) { + start = md.start; + ab->baseaddr = natmem_offset + start; + } + + if (ab->baseaddr) { + if (md.hasbarrier) { + // fill end of ram with ILLEGAL to catch direct PC falling out of RAM. + put_long_host(ab->baseaddr + ab->reserved_size, 0x4afc4afc); + } + ab->allocated_size = ab->reserved_size; + write_log("mapped_malloc(): 0x%08x - 0x%08x (0x%08x - 0x%08x) -> %s (%s)\n", + ab->baseaddr - natmem_offset, ab->baseaddr - natmem_offset + ab->allocated_size, + ab->baseaddr, ab->baseaddr + ab->allocated_size, ab->name, ab->label); + } + ab->flags |= ABFLAG_DIRECTMAP; + + return (ab->baseaddr != NULL); +} + + +void mapped_free(addrbank *ab) +{ + if (ab->label != NULL && !strcmp(ab->label, "filesys") && ab->baseaddr != NULL) { + free(ab->baseaddr); + write_log("mapped_free(): 0x%08x - 0x%08x (0x%08x - 0x%08x) -> %s (%s)\n", + ab->baseaddr - natmem_offset, ab->baseaddr - natmem_offset + ab->allocated_size, + ab->baseaddr, ab->baseaddr + ab->allocated_size, ab->name, ab->label); + } + ab->baseaddr = NULL; + ab->allocated_size = 0; +} + void protect_roms(bool protect) { /* @@ -221,3 +470,51 @@ void protect_roms(bool protect) mprotect(filesysory, 0x10000, protect ? PROT_READ : PROT_READ | PROT_WRITE); */ } + +static int doinit_shm(void) +{ + expansion_scan_autoconfig(&currprefs, true); + + return 1; +} + + +static uae_u32 oz3fastmem_size[MAX_RAM_BOARDS]; +static uae_u32 ofastmem_size[MAX_RAM_BOARDS]; +static uae_u32 ortgmem_size[MAX_RTG_BOARDS]; +static int ortgmem_type[MAX_RTG_BOARDS]; + +bool init_shm(void) +{ + bool changed = false; + + for (int i = 0; i < MAX_RAM_BOARDS; i++) { + if (oz3fastmem_size[i] != changed_prefs.z3fastmem[i].size) + changed = true; + if (ofastmem_size[i] != changed_prefs.fastmem[i].size) + changed = true; + } + for (int i = 0; i < MAX_RTG_BOARDS; i++) { + if (ortgmem_size[i] != changed_prefs.rtgboards[i].rtgmem_size) + changed = true; + if (ortgmem_type[i] != changed_prefs.rtgboards[i].rtgmem_type) + changed = true; + } + if (!changed) + return true; + + for (int i = 0; i < MAX_RAM_BOARDS; i++) { + oz3fastmem_size[i] = changed_prefs.z3fastmem[i].size; + ofastmem_size[i] = changed_prefs.fastmem[i].size; + } + for (int i = 0; i < MAX_RTG_BOARDS; i++) { + ortgmem_size[i] = changed_prefs.rtgboards[i].rtgmem_size; + ortgmem_type[i] = changed_prefs.rtgboards[i].rtgmem_type; + } + + if (doinit_shm() < 0) + return false; + + memory_hardreset(2); + return true; +} diff --git a/src/osdep/amiberry_rp9.cpp b/src/osdep/amiberry_rp9.cpp index 13edf4ba..fe9fbffd 100644 --- a/src/osdep/amiberry_rp9.cpp +++ b/src/osdep/amiberry_rp9.cpp @@ -1,7 +1,6 @@ #include "sysconfig.h" #include "sysdeps.h" #include "config.h" -#include "autoconf.h" #include "uae.h" #include "options.h" #include "gui.h" @@ -11,6 +10,7 @@ #include "newcpu.h" #include "custom.h" #include "filesys.h" +#include "autoconf.h" #include "zfile.h" #include "archivers/zip/unzip.h" #include @@ -22,572 +22,587 @@ #define MAX_MANIFEST_ENTRY 256 static char rp9tmp_path[MAX_DPATH]; -static vector lstTmpRP9Files; +static std::vector lstTmpRP9Files; static int add_HDF_DHnum = 0; static bool clip_no_hires = false; void rp9_init(void) { - fetch_rp9path(rp9tmp_path, MAX_DPATH); - strncat(rp9tmp_path, _T("tmp/"), MAX_DPATH); - lstTmpRP9Files.clear(); - LIBXML_TEST_VERSION + fetch_rp9path(rp9tmp_path, MAX_DPATH); + strncat(rp9tmp_path, _T("tmp/"), MAX_DPATH); + lstTmpRP9Files.clear(); + LIBXML_TEST_VERSION } static void del_tmpFiles(void) { - int i; - - for(i=0; inext) { - if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, name) == 0) - return curr_node->children; - } - return NULL; + for (xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) { + if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, name) == 0) + return curr_node->children; + } + return NULL; } static bool get_value(xmlNode *node, const char *key, char *value, int max_size) { - bool bResult = false; + bool bResult = false; - for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) { - if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, key) == 0) { - xmlChar *content = xmlNodeGetContent(curr_node); - if(content != NULL) { - strncpy(value, (char *)content, max_size); - xmlFree(content); - bResult = true; - } - break; - } - } + for (xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) { + if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, key) == 0) { + xmlChar *content = xmlNodeGetContent(curr_node); + if (content != NULL) { + strncpy(value, (char *)content, max_size); + xmlFree(content); + bResult = true; + } + break; + } + } - return bResult; + return bResult; } static void set_default_system(struct uae_prefs *p, const char *system, int rom) { - default_prefs(p, true, 0); - del_tmpFiles(); - - if (strcmp(system, "a-500") == 0) - built_in_prefs(p, 0, 1, 0, rom); - else if (strcmp(system, "a-1200") == 0) - built_in_prefs(p, 0, 1, 0, rom); + default_prefs(p, true, 0); + del_tmpFiles(); + + if (strcmp(system, "a-500") == 0) + bip_a500(p, rom); + else if (strcmp(system, "a-500plus") == 0) + bip_a500plus(p, rom); + else if (strcmp(system, "a-1200") == 0) + bip_a1200(p, rom); + else if (strcmp(system, "a-2000") == 0) + bip_a2000(p, rom); + else if (strcmp(system, "a-4000") == 0) { + bip_a4000(p, rom); + } } static void parse_compatibility(struct uae_prefs *p, xmlNode *node) { - for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) { - if (curr_node->type == XML_ELEMENT_NODE && strcmp(reinterpret_cast(curr_node->name), _T("compatibility")) == 0) { - xmlChar *content = xmlNodeGetContent(curr_node); - if(content != NULL) { - if(strcmp(reinterpret_cast(content), "flexible-blitter-immediate") == 0) - p->immediate_blits = 1; - else if(strcmp(reinterpret_cast(content), "turbo-floppy") == 0) - p->floppy_speed = 400; - else if(strcmp(reinterpret_cast(content), "flexible-sprite-collisions-spritesplayfield") == 0) - p->collision_level = 2; - else if(strcmp(reinterpret_cast(content), "flexible-sprite-collisions-spritesonly") == 0) - p->collision_level = 1; - else if(strcmp(reinterpret_cast(content), "flexible-sound") == 0) - p->produce_sound = 2; - else if(strcmp(reinterpret_cast(content), "flexible-maxhorizontal-nohires") == 0) - clip_no_hires = true; - else if(strcmp(reinterpret_cast(content), "jit") == 0) - { - p->cachesize = 8192; - p->address_space_24 = false; - } - else if(strcmp(reinterpret_cast(content), "flexible-cpu-cycles") == 0) - p->cpu_compatible = false; - else if(strcmp(reinterpret_cast(content), "flexible-maxhorizontal-nosuperhires") == 0) - ; /* nothing to change */ - else if(strcmp(reinterpret_cast(content), "flexible-maxvertical-nointerlace") == 0) - ; /* nothing to change */ - else - printf("rp9: unknown compatibility: %p\n", content); - xmlFree(content); - } - } - } + for (xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) { + if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("compatibility")) == 0) { + xmlChar *content = xmlNodeGetContent(curr_node); + if (content != NULL) { + if (strcmp((const char *)content, "flexible-blitter-immediate") == 0) + p->immediate_blits = 1; + else if (strcmp((const char *)content, "turbo-floppy") == 0) + p->floppy_speed = 400; + else if (strcmp((const char *)content, "flexible-sprite-collisions-spritesplayfield") == 0) + p->collision_level = 2; + else if (strcmp((const char *)content, "flexible-sprite-collisions-spritesonly") == 0) + p->collision_level = 1; + else if (strcmp((const char *)content, "flexible-sound") == 0) + p->produce_sound = 2; + else if (strcmp((const char *)content, "flexible-maxhorizontal-nohires") == 0) + clip_no_hires = true; + else if (strcmp((const char *)content, "jit") == 0) + { + p->cachesize = 8192; + p->address_space_24 = 0; + } + else if (strcmp((const char *)content, "flexible-cpu-cycles") == 0) + p->cpu_compatible = 0; + else if (strcmp((const char *)content, "flexible-maxhorizontal-nosuperhires") == 0) + ; /* nothing to change */ + else if (strcmp((const char *)content, "flexible-maxvertical-nointerlace") == 0) + ; /* nothing to change */ + else + printf("rp9: unknown compatibility: %s\n", content); + xmlFree(content); + } + } + } } static void parse_ram(struct uae_prefs *p, xmlNode *node) { - for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) { - if (curr_node->type == XML_ELEMENT_NODE && strcmp(reinterpret_cast(curr_node->name), _T("ram")) == 0) { - xmlChar *content = xmlNodeGetContent(curr_node); - if(content != NULL) { - xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast("type")); - if(attr != NULL) - { - int size = atoi(reinterpret_cast(content)); - if(strcmp(reinterpret_cast(attr), "fast") == 0) - p->fastmem[0].size = size; - else if(strcmp(reinterpret_cast(attr), "z3") == 0) - p->z3fastmem[0].size = size; - else if(strcmp(reinterpret_cast(attr), "chip") == 0) - p->chipmem_size = size; - xmlFree(attr); - } + for (xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) { + if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("ram")) == 0) { + xmlChar *content = xmlNodeGetContent(curr_node); + if (content != NULL) { + xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *)_T("type")); + if (attr != NULL) + { + int size = atoi((const char *)content); + if (strcmp((const char *)attr, "fast") == 0) + p->fastmem[0].size = size; + else if (strcmp((const char *)attr, "z3") == 0) + p->z3fastmem[0].size = size; + else if (strcmp((const char *)attr, "chip") == 0) + p->chipmem_size = size; + xmlFree(attr); + } - xmlFree(content); - } - } - } + xmlFree(content); + } + } + } } static void parse_clip(struct uae_prefs *p, xmlNode *node) { - int left = 0, top = 0, width = 320, height = 240; - - for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) - { - if (curr_node->type == XML_ELEMENT_NODE && strcmp(reinterpret_cast(curr_node->name), _T("clip")) == 0) - { - xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast("left")); - if(attr != NULL) - { - left = atoi(reinterpret_cast(attr)); - xmlFree(attr); - } - attr = xmlGetProp(curr_node, reinterpret_cast("top")); - if(attr != NULL) - { - top = atoi(reinterpret_cast(attr)) / 2; - xmlFree(attr); - } - attr = xmlGetProp(curr_node, reinterpret_cast("width")); - if(attr != NULL) - { - width = atoi(reinterpret_cast(attr)); - if(p->chipset_mask & CSMASK_AGA && clip_no_hires == false) - width = width / 2; // Use Hires in AGA mode - else - width = width / 4; // Use Lores in OCS/ECS - if(width <= 320) - p->gfx_size.width = 320; - else if(width <= 352) - p->gfx_size.width = 352; - else if(width <= 384) - p->gfx_size.width = 384; - else if(width <= 640) - p->gfx_size.width = 640; - else if(width <= 704) - p->gfx_size.width = 704; - else - p->gfx_size.width = 768; - xmlFree(attr); - } - attr = xmlGetProp(curr_node, reinterpret_cast("height")); - if(attr != NULL) - { - height = atoi(reinterpret_cast(attr)) / 2; - if(height <= 200) - p->gfx_size.height = 200; - else if(height <= 216) - p->gfx_size.height = 216; - else if(height <= 240) - p->gfx_size.height = 240; - else if(height <= 256) - p->gfx_size.height = 256; - else if(height <= 262) - p->gfx_size.height = 262; - else - p->gfx_size.height = 270; - xmlFree(attr); - } - break; - } - } + int left = 0, top = 0, width = 320, height = 240; + + for (xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) + { + if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("clip")) == 0) + { + xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *)_T("left")); + if (attr != NULL) + { + left = atoi((const char *)attr); + xmlFree(attr); + } + attr = xmlGetProp(curr_node, (const xmlChar *)_T("top")); + if (attr != NULL) + { + top = atoi((const char *)attr) / 2; +#ifdef PANDORA + p->pandora_vertical_offset = top - 41 + OFFSET_Y_ADJUST; +#endif //PANDORA + xmlFree(attr); + } + attr = xmlGetProp(curr_node, (const xmlChar *)_T("width")); + if (attr != NULL) + { + width = atoi((const char *)attr); + if (p->chipset_mask & CSMASK_AGA && clip_no_hires == false) + width = width / 2; // Use Hires in AGA mode + else + width = width / 4; // Use Lores in OCS/ECS + if (width <= 320) + p->gfx_size.width = 320; + else if (width <= 352) + p->gfx_size.width = 352; + else if (width <= 384) + p->gfx_size.width = 384; + else if (width <= 640) + p->gfx_size.width = 640; + else if (width <= 704) + p->gfx_size.width = 704; + else + p->gfx_size.width = 768; + xmlFree(attr); + } + attr = xmlGetProp(curr_node, (const xmlChar *)_T("height")); + if (attr != NULL) + { + height = atoi((const char *)attr) / 2; + if (height <= 200) + p->gfx_size.height = 200; + else if (height <= 216) + p->gfx_size.height = 216; + else if (height <= 240) + p->gfx_size.height = 240; + else if (height <= 256) + p->gfx_size.height = 256; + else if (height <= 262) + p->gfx_size.height = 262; + else + p->gfx_size.height = 270; + xmlFree(attr); + } + break; + } + } } static void parse_peripheral(struct uae_prefs *p, xmlNode *node) { - for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) - { - if (curr_node->type == XML_ELEMENT_NODE && strcmp(reinterpret_cast(curr_node->name), _T("peripheral")) == 0) - { - xmlChar *content = xmlNodeGetContent(curr_node); - if(content != NULL) - { - if(strcmp(reinterpret_cast(content), "floppy") == 0) - { - int type = DRV_35_DD; - int unit = -1; - - xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast("type")); - if(attr != NULL) - { - if(strcmp(reinterpret_cast(attr), "dd") == 0) - type = DRV_35_DD; - else - type = DRV_35_HD; - xmlFree(attr); - } - - attr = xmlGetProp(curr_node, reinterpret_cast("unit")); - if(attr != NULL) - { - unit = atoi(reinterpret_cast(attr)); - xmlFree(attr); - } - - if(unit >= 0) - { - if(unit + 1 > p->nr_floppies) - p->nr_floppies = unit + 1; - p->floppyslots[unit].dfxtype = type; - } - } - else if(strcmp(reinterpret_cast(content), "a-501") == 0) - p->bogomem_size = 0x00080000; - else if(strcmp(reinterpret_cast(content), "cpu") == 0) - { - xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast("type")); - if(attr != NULL) - { - p->cpu_model = atoi(reinterpret_cast(attr)); - if(p->cpu_model > 68020) - p->address_space_24 = 0; - if(p->cpu_model == 68040) - p->fpu_model = 68040; - xmlFree(attr); - } - attr = xmlGetProp(curr_node, reinterpret_cast("speed")); - if(attr != NULL) - { - if(strcmp(reinterpret_cast(attr), "max") == 0) - p->m68k_speed = -1; - xmlFree(attr); - } - } - else if(strcmp(reinterpret_cast(content), "fpu") == 0) - { - xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast("type")); - if(attr != NULL) - { - if(strcmp(reinterpret_cast(attr), "68881") == 0) - p->fpu_model = 68881; - else if(strcmp(reinterpret_cast(attr), "68882") == 0) - p->fpu_model = 68882; - xmlFree(attr); - } - } - else if(strcmp(reinterpret_cast(content), "jit") == 0) - { - xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast("memory")); - if(attr != NULL) - { - p->cachesize = atoi(reinterpret_cast(attr)) / 1024; - xmlFree(attr); - } - } - xmlFree(content); - } - } - } + for (xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) + { + if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("peripheral")) == 0) + { + xmlChar *content = xmlNodeGetContent(curr_node); + if (content != NULL) + { + if (strcmp((const char *)content, "floppy") == 0) + { + int type = DRV_35_DD; + int unit = -1; + + xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *)_T("type")); + if (attr != NULL) + { + if (strcmp((const char *)attr, "dd") == 0) + type = DRV_35_DD; + else + type = DRV_35_HD; + xmlFree(attr); + } + + attr = xmlGetProp(curr_node, (const xmlChar *)_T("unit")); + if (attr != NULL) + { + unit = atoi((const char *)attr); + xmlFree(attr); + } + + if (unit >= 0) + { + if (unit + 1 > p->nr_floppies) + p->nr_floppies = unit + 1; + p->floppyslots[unit].dfxtype = type; + } + } + else if (strcmp((const char *)content, "a-501") == 0) + p->bogomem_size = 0x00080000; + else if (strcmp((const char *)content, "cpu") == 0) + { + xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *)_T("type")); + if (attr != NULL) + { + p->cpu_model = atoi((const char *)attr); + if (p->cpu_model > 68020) + p->address_space_24 = 0; + if (p->cpu_model == 68040) + p->fpu_model = 68040; + xmlFree(attr); + } + attr = xmlGetProp(curr_node, (const xmlChar *)_T("speed")); + if (attr != NULL) + { + if (strcmp((const char *)attr, "max") == 0) + p->m68k_speed = -1; + xmlFree(attr); + } + } + else if (strcmp((const char *)content, "fpu") == 0) + { + xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *)_T("type")); + if (attr != NULL) + { + if (strcmp((const char *)attr, "68881") == 0) + p->fpu_model = 68881; + else if (strcmp((const char *)attr, "68882") == 0) + p->fpu_model = 68882; + xmlFree(attr); + } + } + else if (strcmp((const char *)content, "jit") == 0) + { + xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *)_T("memory")); + if (attr != NULL) + { + p->cachesize = atoi((const char *)attr) / 1024; + xmlFree(attr); + } + } + xmlFree(content); + } + } + } } static void parse_boot(struct uae_prefs *p, xmlNode *node) { - for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) - { - if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("boot")) == 0) - { - xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("type")); - if(attr != NULL) - { - if(strcmp((const char *) attr, "hdf") == 0) - { - // Built-in hdf required - xmlChar *content = xmlNodeGetContent(curr_node); - if(content != NULL) - { - char target_file[MAX_DPATH]; - fetch_rp9path(target_file, MAX_DPATH); - strncat(target_file, "workbench-", MAX_DPATH); - strncat(target_file, (const char *)content, MAX_DPATH); - strncat(target_file, ".hdf", MAX_DPATH); - FILE *f = fopen(target_file, "rb"); - if(f != NULL) - { - struct uaedev_config_data *uci; - struct uaedev_config_info ci; - - fclose(f); + for (xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) + { + if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("boot")) == 0) + { + xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *)_T("type")); + if (attr != NULL) + { + if (strcmp((const char *)attr, "hdf") == 0) + { + // Built-in hdf required + xmlChar *content = xmlNodeGetContent(curr_node); + if (content != NULL) + { + char target_file[MAX_DPATH]; + fetch_rp9path(target_file, MAX_DPATH); + strncat(target_file, "workbench-", MAX_DPATH - 1); + strncat(target_file, (const char *)content, MAX_DPATH - 1); + strncat(target_file, ".hdf", MAX_DPATH - 1); + FILE *f = fopen(target_file, "rb"); + if (f != NULL) + { + struct uaedev_config_data *uci; + struct uaedev_config_info ci; - if(hardfile_testrdb (target_file)) - uci_set_defaults(&ci, true); - else - uci_set_defaults(&ci, false); - - ci.type = UAEDEV_HDF; - sprintf(ci.devname, "DH%d", add_HDF_DHnum); - ++add_HDF_DHnum; - strcpy(ci.rootdir, target_file); - - xmlChar *ro = xmlGetProp(curr_node, (const xmlChar *) _T("readonly")); - if(ro != NULL) - { - if(strcmp((const char *) ro, "true") == 0) - ci.readonly = 1; - xmlFree(ro); - } - ci.bootpri = 127; - - uci = add_filesys_config(p, -1, &ci); - if (uci) { - struct hardfiledata *hfd = get_hardfile_data (uci->configoffset); - hardfile_media_change (hfd, &ci, true, false); - } - gui_force_rtarea_hdchange(); - } - xmlFree(content); - } - } - xmlFree(attr); - } - } - } + fclose(f); + + if (hardfile_testrdb(target_file)) { + ci.physical_geometry = true; + uci_set_defaults(&ci, true); + } + else { + ci.physical_geometry = false; + uci_set_defaults(&ci, false); + } + + ci.type = UAEDEV_HDF; + sprintf(ci.devname, "DH%d", add_HDF_DHnum); + ++add_HDF_DHnum; + strncpy(ci.rootdir, target_file, MAX_DPATH); + + xmlChar *ro = xmlGetProp(curr_node, (const xmlChar *)_T("readonly")); + if (ro != NULL) + { + if (strcmp((const char *)ro, "true") == 0) + ci.readonly = 1; + xmlFree(ro); + } + ci.bootpri = 127; + + uci = add_filesys_config(p, -1, &ci); + if (uci) { + struct hardfiledata *hfd = get_hardfile_data(uci->configoffset); + hardfile_media_change(hfd, &ci, true, false); + } + } + xmlFree(content); + } + } + xmlFree(attr); + } + } + } } static void extract_media(struct uae_prefs *p, unzFile uz, xmlNode *node) { - xmlNode *tmp = get_node(node, "media"); - if(tmp != NULL) - { - for(xmlNode *curr_node = tmp; curr_node; curr_node = curr_node->next) - { - int mediatype = -1; - if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("floppy")) == 0) - mediatype = 0; - else if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("harddrive")) == 0) - mediatype = 1; - if(mediatype >= 0) - { - xmlChar *content = xmlNodeGetContent(curr_node); - if(content != NULL) - { - int priority = 0; - xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("priority")); - if(attr != NULL) - { - priority = atoi((const char *)attr); - xmlFree(attr); - } - - if (unzLocateFile (uz, (char *)content, 1) == UNZ_OK) - { - unz_file_info file_info; - if (unzGetCurrentFileInfo (uz, &file_info, NULL, 0, NULL, 0, NULL, 0) == UNZ_OK) - { - void *buffer = malloc(file_info.uncompressed_size); - if(buffer != NULL) - { - if (unzOpenCurrentFile (uz) == UNZ_OK) - { - int readsize = unzReadCurrentFile(uz, buffer, file_info.uncompressed_size); - unzCloseCurrentFile(uz); - if(readsize == file_info.uncompressed_size) - { - char target_file[MAX_DPATH]; - if(!my_existsdir(rp9tmp_path)) - my_mkdir(rp9tmp_path); - snprintf(target_file, MAX_DPATH, "%s%s", rp9tmp_path, content); - FILE *f = fopen(target_file, "wb"); - if(f != NULL) - { - fwrite(buffer, 1, readsize, f); - fclose(f); - if(mediatype == 0) - { - // Add floppy - if(priority < 2) - { - strncpy(p->floppyslots[0].df, target_file, sizeof(p->floppyslots[0].df)); - disk_insert(0, p->floppyslots[0].df); - } - else if(priority == 2 && p->nr_floppies > 1) - { - strncpy(p->floppyslots[1].df, target_file, sizeof(p->floppyslots[1].df)); - disk_insert(1, p->floppyslots[1].df); - } - else if(priority == 3 && p->nr_floppies > 2) - { - strncpy(p->floppyslots[2].df, target_file, sizeof(p->floppyslots[2].df)); - disk_insert(2, p->floppyslots[2].df); - } - else if(priority == 4 && p->nr_floppies > 3) - { - strncpy(p->floppyslots[3].df, target_file, sizeof(p->floppyslots[3].df)); - disk_insert(3, p->floppyslots[3].df); - } - AddFileToDiskList(target_file, 1); - } - else - { - // Add hardfile - struct uaedev_config_data *uci; - struct uaedev_config_info ci; - - if(hardfile_testrdb (target_file)) - uci_set_defaults(&ci, true); - else - uci_set_defaults(&ci, false); - - ci.type = UAEDEV_HDF; - sprintf(ci.devname, "DH%d", add_HDF_DHnum); - ++add_HDF_DHnum; - strcpy(ci.rootdir, target_file); - - ci.bootpri = 0; - - uci = add_filesys_config(p, -1, &ci); - if (uci) { - struct hardfiledata *hfd = get_hardfile_data (uci->configoffset); - hardfile_media_change (hfd, &ci, true, false); - } + xmlNode *tmp = get_node(node, "media"); + if (tmp != NULL) + { + for (xmlNode *curr_node = tmp; curr_node; curr_node = curr_node->next) + { + int mediatype = -1; + if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("floppy")) == 0) + mediatype = 0; + else if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("harddrive")) == 0) + mediatype = 1; + if (mediatype >= 0) + { + xmlChar *content = xmlNodeGetContent(curr_node); + if (content != NULL) + { + int priority = 0; + xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *)_T("priority")); + if (attr != NULL) + { + priority = atoi((const char *)attr); + xmlFree(attr); + } - gui_force_rtarea_hdchange(); - } - lstTmpRP9Files.push_back(target_file); - } - } - } - free(buffer); - } - } - } - - xmlFree(content); - } - } - } - } + if (unzLocateFile(uz, (char *)content, 1) == UNZ_OK) + { + unz_file_info file_info; + if (unzGetCurrentFileInfo(uz, &file_info, NULL, 0, NULL, 0, NULL, 0) == UNZ_OK) + { + void *buffer = malloc(file_info.uncompressed_size); + if (buffer != NULL) + { + if (unzOpenCurrentFile(uz) == UNZ_OK) + { + int readsize = unzReadCurrentFile(uz, buffer, file_info.uncompressed_size); + unzCloseCurrentFile(uz); + if (readsize == file_info.uncompressed_size) + { + char target_file[MAX_DPATH]; + if (!my_existsdir(rp9tmp_path)) + my_mkdir(rp9tmp_path); + snprintf(target_file, MAX_DPATH, "%s%s", rp9tmp_path, content); + FILE *f = fopen(target_file, "wb"); + if (f != NULL) + { + fwrite(buffer, 1, readsize, f); + fclose(f); + if (mediatype == 0) + { + // Add floppy + if (priority < 2) + { + strncpy(p->floppyslots[0].df, target_file, sizeof(p->floppyslots[0].df)); + disk_insert(0, p->floppyslots[0].df); + } + else if (priority == 2 && p->nr_floppies > 1) + { + strncpy(p->floppyslots[1].df, target_file, sizeof(p->floppyslots[1].df)); + disk_insert(1, p->floppyslots[1].df); + } + else if (priority == 3 && p->nr_floppies > 2) + { + strncpy(p->floppyslots[2].df, target_file, sizeof(p->floppyslots[2].df)); + disk_insert(2, p->floppyslots[2].df); + } + else if (priority == 4 && p->nr_floppies > 3) + { + strncpy(p->floppyslots[3].df, target_file, sizeof(p->floppyslots[3].df)); + disk_insert(3, p->floppyslots[3].df); + } + AddFileToDiskList(target_file, 1); + } + else + { + // Add hardfile + struct uaedev_config_data *uci; + struct uaedev_config_info ci; + + if (hardfile_testrdb(target_file)) { + ci.physical_geometry = true; + uci_set_defaults(&ci, true); + } + else { + ci.physical_geometry = false; + uci_set_defaults(&ci, false); + } + + ci.type = UAEDEV_HDF; + sprintf(ci.devname, "DH%d", add_HDF_DHnum); + ++add_HDF_DHnum; + strncpy(ci.rootdir, target_file, MAX_DPATH); + + ci.bootpri = 0; + + uci = add_filesys_config(p, -1, &ci); + if (uci) { + struct hardfiledata *hfd = get_hardfile_data(uci->configoffset); + hardfile_media_change(hfd, &ci, true, false); + } + } + lstTmpRP9Files.push_back(target_file); + } + } + } + free(buffer); + } + } + } + + xmlFree(content); + } + } + } + } } static bool parse_manifest(struct uae_prefs *p, unzFile uz, const char *manifest) { - bool bResult = false; - char buffer[MAX_MANIFEST_ENTRY]; - - xmlDocPtr doc = xmlReadMemory(manifest, strlen(manifest), NULL, NULL, 0);; - if(doc != NULL) - { - xmlNode *root_element = xmlDocGetRootElement(doc); - xmlNode *rp9 = get_node(root_element, "rp9"); - if(rp9 != NULL) - { - xmlNode *app = get_node(rp9, "application"); - if(app != NULL) - { - int rom = -1; - xmlNode *tmp = get_node(app, "description"); - if(tmp != NULL && get_value(tmp, "systemrom", buffer, MAX_MANIFEST_ENTRY)) - rom = atoi(buffer); - - tmp = get_node(app, "configuration"); - if(tmp != NULL && get_value(tmp, "system", buffer, MAX_MANIFEST_ENTRY)) - { - set_default_system(p, buffer, rom); - - parse_compatibility(p, tmp); - parse_ram(p, tmp); - parse_clip(p, tmp); - parse_peripheral(p, tmp); - parse_boot(p, tmp); - extract_media(p, uz, app); - bResult = true; - } - } - } - xmlFreeDoc(doc); - } - - return bResult; + bool bResult = false; + char buffer[MAX_MANIFEST_ENTRY]; + + xmlDocPtr doc = xmlReadMemory(manifest, strlen(manifest), NULL, NULL, 0);; + if (doc != NULL) + { + xmlNode *root_element = xmlDocGetRootElement(doc); + xmlNode *rp9 = get_node(root_element, "rp9"); + if (rp9 != NULL) + { + xmlNode *app = get_node(rp9, "application"); + if (app != NULL) + { + int rom = -1; + xmlNode *tmp = get_node(app, "description"); + if (tmp != NULL && get_value(tmp, "systemrom", buffer, MAX_MANIFEST_ENTRY)) + rom = atoi(buffer); + + tmp = get_node(app, "configuration"); + if (tmp != NULL && get_value(tmp, "system", buffer, MAX_MANIFEST_ENTRY)) + { + set_default_system(p, buffer, rom); + + parse_compatibility(p, tmp); + parse_ram(p, tmp); + parse_clip(p, tmp); + parse_peripheral(p, tmp); + parse_boot(p, tmp); + extract_media(p, uz, app); + bResult = true; + } + } + } + xmlFreeDoc(doc); + } + + return bResult; } bool rp9_parse_file(struct uae_prefs *p, const char *filename) { - bool bResult = false; + bool bResult = false; struct zfile *zf; unzFile uz; - unz_file_info file_info; - char *manifest; - - add_HDF_DHnum = 0; - clip_no_hires = false; - - zf = zfile_fopen(filename, _T("rb")); - if(zf != NULL) - { - uz = unzOpen(zf); - if (uz != NULL) - { - if (unzLocateFile (uz, RP9_MANIFEST, 1) == UNZ_OK) - { - if (unzGetCurrentFileInfo (uz, &file_info, NULL, 0, NULL, 0, NULL, 0) == UNZ_OK) - { - manifest = (char *)malloc(file_info.uncompressed_size + 1); - if(manifest != NULL) - { - if (unzOpenCurrentFile (uz) == UNZ_OK) - { - int readsize = unzReadCurrentFile(uz, manifest, file_info.uncompressed_size); - unzCloseCurrentFile(uz); + unz_file_info file_info; + char *manifest; - if(readsize == file_info.uncompressed_size) - { - manifest[readsize] = '\0'; - bResult = parse_manifest(p, uz, manifest); - - if(bResult) - { - // Fixup some prefs... - if(p->m68k_speed >= 0) - p->cachesize = 0; // Use JIT only if max. speed selected - p->input_joymouse_multiplier = 5; // Most games need slower mouse movement... - } - } - } - free(manifest); - } - } - } - - unzClose (uz); - } - zfile_fclose(zf); - } - - return bResult; + add_HDF_DHnum = 0; + clip_no_hires = false; + + zf = zfile_fopen(filename, _T("rb")); + if (zf != NULL) + { + uz = unzOpen(zf); + if (uz != NULL) + { + if (unzLocateFile(uz, RP9_MANIFEST, 1) == UNZ_OK) + { + if (unzGetCurrentFileInfo(uz, &file_info, NULL, 0, NULL, 0, NULL, 0) == UNZ_OK) + { + manifest = (char *)malloc(file_info.uncompressed_size + 1); + if (manifest != NULL) + { + if (unzOpenCurrentFile(uz) == UNZ_OK) + { + int readsize = unzReadCurrentFile(uz, manifest, file_info.uncompressed_size); + unzCloseCurrentFile(uz); + + if (readsize == file_info.uncompressed_size) + { + manifest[readsize] = '\0'; + bResult = parse_manifest(p, uz, manifest); + + if (bResult) + { + // Fixup some prefs... + if (p->m68k_speed >= 0) + p->cachesize = 0; // Use JIT only if max. speed selected + p->input_joymouse_multiplier = 5; // Most games need slower mouse movement... + } + } + } + free(manifest); + } + } + } + + unzClose(uz); + } + zfile_fclose(zf); + } + + return bResult; } diff --git a/src/osdep/charset.cpp b/src/osdep/charset.cpp index 5e8a81b6..664c006a 100644 --- a/src/osdep/charset.cpp +++ b/src/osdep/charset.cpp @@ -3,7 +3,7 @@ #include -// UAE4ARM and fs-uae uses only chars / UTF-8 internally, so TCHAR is typedefed to +// Amiberry and fs-uae uses only chars / UTF-8 internally, so TCHAR is typedefed to // char (WinUAE uses wchar_t internally). char *ua(const TCHAR *s) diff --git a/src/osdep/gui/CreateFilesysHardfile.cpp b/src/osdep/gui/CreateFilesysHardfile.cpp index 42a13b48..a31b8858 100644 --- a/src/osdep/gui/CreateFilesysHardfile.cpp +++ b/src/osdep/gui/CreateFilesysHardfile.cpp @@ -1,6 +1,15 @@ +#ifdef USE_SDL1 +#include +#include +#include "sdltruetypefont.hpp" +#include +#elif USE_SDL2 #include -#include #include +#include +#endif +#include + #include #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" @@ -327,7 +336,6 @@ static void CreateFilesysHardfileLoop() // Now we let the Gui object draw itself. uae_gui->draw(); // Finally we update the screen. - UpdateGuiScreen(); } } diff --git a/src/osdep/gui/EditFilesysHardfile.cpp b/src/osdep/gui/EditFilesysHardfile.cpp index f91dd584..f6120a74 100644 --- a/src/osdep/gui/EditFilesysHardfile.cpp +++ b/src/osdep/gui/EditFilesysHardfile.cpp @@ -1,7 +1,14 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -505,7 +512,6 @@ static void EditFilesysHardfileLoop() // Now we let the Gui object draw itself. uae_gui->draw(); // Finally we update the screen. - UpdateGuiScreen(); } } diff --git a/src/osdep/gui/EditFilesysVirtual.cpp b/src/osdep/gui/EditFilesysVirtual.cpp index 13a5c28b..e7d41bfd 100644 --- a/src/osdep/gui/EditFilesysVirtual.cpp +++ b/src/osdep/gui/EditFilesysVirtual.cpp @@ -1,7 +1,14 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" diff --git a/src/osdep/gui/InGameMessage.cpp b/src/osdep/gui/InGameMessage.cpp index c9e05a31..a15a0872 100644 --- a/src/osdep/gui/InGameMessage.cpp +++ b/src/osdep/gui/InGameMessage.cpp @@ -1,7 +1,14 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "sysconfig.h" @@ -180,11 +187,15 @@ void InGameMessage(const char* msg) // Now we let the Gui object draw itself. msg_gui->draw(); // Finally we update the screen. +#ifdef USE_SDL1 + SDL_Flip(prSDLScreen); +#elif USE_SDL2 if (!drawn && cursor != nullptr) { SDL_ShowCursor(SDL_ENABLE); updatedisplayarea(); } +#endif drawn = true; } diff --git a/src/osdep/gui/Navigation.cpp b/src/osdep/gui/Navigation.cpp index 46eab81d..7468a69e 100644 --- a/src/osdep/gui/Navigation.cpp +++ b/src/osdep/gui/Navigation.cpp @@ -1,5 +1,12 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include +#endif #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -26,13 +33,17 @@ static NavigationMap navMap[] = { "Paths", "SystemROMs", "SystemROMs", "Reset", "Quickstart" }, { "Quickstart", "qsNTSC", "AModel", "Paths", "Configurations" }, { "Configurations", "ConfigList", "ConfigList", "Quickstart", "CPU and FPU" }, - {"CPU and FPU", "7 Mhz", "68000", "Configurations", "Chipset"}, + { "CPU and FPU", "7 Mhz", "68000", "Configurations", "Chipset" }, { "Chipset", "Fast copper", "OCS", "CPU and FPU", "ROM" }, - {"ROM", "MainROM", "cboMainROM", "Chipset", "RAM"}, - {"RAM", "Chipmem", "Chipmem", "ROM", "Floppy drives"}, - {"Floppy drives", "cmdSel0", "DF0:", "RAM", "Hard drives/CD"}, - {"Hard drives/CD", "cmdCreateHDF", "cmdAddDir", "Floppy drives", "Display"}, - {"Display", "Frameskip", "Frameskip", "Hard drives/CD", "Sound"}, + { "ROM", "MainROM", "cboMainROM", "Chipset", "RAM" }, + { "RAM", "Chipmem", "Chipmem", "ROM", "Floppy drives" }, + { "Floppy drives", "cmdSel0", "DF0:", "RAM", "Hard drives/CD" }, + { "Hard drives/CD", "cmdCreateHDF", "cmdAddDir", "Floppy drives", "Display"}, +#ifdef USE_SDL1 + { "Display", "sldWidth", "sldWidth", "Hard drives/CD", "Sound" }, +#elif USE_SDL2 + { "Display", "Frameskip", "Frameskip", "Hard drives/CD", "Sound" }, +#endif { "Sound", "sndDisable", "sndDisable", "Display", "Input" }, { "Input", "cboPort0mode", "cboPort0", "Sound", "Custom controls" }, { "Custom controls", "Right Trigger", "0: Mouse", "Input", "Miscellaneous" }, @@ -202,10 +213,20 @@ static NavigationMap navMap[] = {"CDVol", "", "", "cboCD", "cmdProp0"}, // PanelDisplay +#ifdef USE_SDL1 + { "sldWidth", "", "", "Frameskip", "sldHeight" }, + { "sldHeight", "", "", "sldWidth", "sldVertPos" }, + { "sldVertPos", "", "", "sldHeight", "FSRatio" }, + { "FSRatio", "", "", "sldVertPos", "4by3Ratio" }, + { "4by3Ratio", "Display", "Display", "FSRatio", "Line doubling" }, + { "Line doubling", "Display", "Display", "4by3Ratio", "Frameskip" }, + { "Frameskip", "Display", "Display", "Line doubling", "sldWidth" }, +#elif USE_SDL2 {"Frameskip", "Display", "Display", "Linear (smooth)", "Auto"}, {"Auto", "Display", "Display", "Frameskip", "Nearest Neighbor (pixelated)"}, { "Nearest Neighbor (pixelated)", "Display", "Display", "Auto", "Linear (smooth)"}, {"Linear (smooth)", "Display", "Display", "Nearest Neighbor (pixelated)", "Frameskip"}, +#endif //PanelSound { "sndDisable", "Sound", "Mono", "sldStereoDelay", "sndDisEmu" }, diff --git a/src/osdep/gui/PanelCPU.cpp b/src/osdep/gui/PanelCPU.cpp index 7db24f2f..ef799a78 100644 --- a/src/osdep/gui/PanelCPU.cpp +++ b/src/osdep/gui/PanelCPU.cpp @@ -1,7 +1,14 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeCheckBox.hpp" diff --git a/src/osdep/gui/PanelChipset.cpp b/src/osdep/gui/PanelChipset.cpp index 9a90caa4..ca553acd 100644 --- a/src/osdep/gui/PanelChipset.cpp +++ b/src/osdep/gui/PanelChipset.cpp @@ -1,7 +1,14 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeCheckBox.hpp" diff --git a/src/osdep/gui/PanelConfig.cpp b/src/osdep/gui/PanelConfig.cpp index 27c7c715..5646c2d8 100644 --- a/src/osdep/gui/PanelConfig.cpp +++ b/src/osdep/gui/PanelConfig.cpp @@ -1,13 +1,23 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#endif #include "SelectorEntry.hpp" #include "UaeListBox.hpp" #include "sysconfig.h" #include "sysdeps.h" +#include "config.h" #include "options.h" +#include "uae.h" +#include "blkdev.h" #include "gui.h" #include "gui_handling.h" @@ -27,352 +37,346 @@ static gcn::UaeListBox* lstConfigs; static gcn::ScrollArea* scrAreaConfigs; -bool LoadConfigByName(const char* name) +bool LoadConfigByName(const char *name) { ConfigFileInfo* config = SearchConfigInList(name); if (config != nullptr) { - txtName->setText(config->Name); - txtDesc->setText(config->Description); - target_cfgfile_load(&changed_prefs, config->FullPath, 0, 0); - strncpy(last_active_config, config->Name, MAX_PATH); - DisableResume(); - RefreshAllPanels(); + if (emulating) + { + uae_restart(-1, config->FullPath); + } + else + { + txtName->setText(config->Name); + txtDesc->setText(config->Description); + target_cfgfile_load(&changed_prefs, config->FullPath, 0, 0); + strncpy(last_active_config, config->Name, MAX_PATH); + DisableResume(); + RefreshAllPanels(); + } } return false; -} - -void load_buildin_config(int id) -{ - if (changed_prefs.cdslots[0].inuse) - gui_force_rtarea_hdchange(); - discard_prefs(&changed_prefs, 0); - default_prefs(&changed_prefs, true, 0); - switch (id) - { - case BUILDINID_A500: - built_in_prefs(&changed_prefs, 0, 1, 0, 0); - break; - - case BUILDINID_A1200: - built_in_prefs(&changed_prefs, 4, 0, 0, 0); - break; - - case BUILDINID_CD32: - built_in_prefs(&changed_prefs, 8, 0, 0, 0); - break; - } -} - -void SetLastActiveConfig(const char* filename) -{ - extractFileName(filename, last_active_config); - removeFileExtension(last_active_config); -} - - -class ConfigsListModel : public gcn::ListModel -{ - vector configs; - -public: - ConfigsListModel() - { } - int getNumberOfElements() override + void SetLastActiveConfig(const char* filename) { - return configs.size(); + extractFileName(filename, last_active_config); + removeFileExtension(last_active_config); } - string getElementAt(int i) override - { - if (i >= configs.size() || i < 0) - return "---"; - return configs[i]; - } - void InitConfigsList() + class ConfigsListModel : public gcn::ListModel { - configs.clear(); - for (int i = 0; i < ConfigFilesList.size(); ++i) + vector configs; + + public: + ConfigsListModel() { - char tmp[MAX_DPATH]; - strncpy(tmp, ConfigFilesList[i]->Name, MAX_DPATH); - if (strlen(ConfigFilesList[i]->Description) > 0) - { - strncat(tmp, " (", MAX_DPATH); - strncat(tmp, ConfigFilesList[i]->Description, MAX_DPATH); - strncat(tmp, ")", MAX_DPATH); - } - configs.push_back(tmp); } - } -}; -static ConfigsListModel* configsList; - - -class ConfigButtonActionListener : public gcn::ActionListener -{ -public: - void action(const gcn::ActionEvent& actionEvent) override - { - int i; - if (actionEvent.getSource() == cmdLoad) + int getNumberOfElements() override { - //----------------------------------------------- - // Load selected configuration - //----------------------------------------------- - i = lstConfigs->getSelected(); - if (i != -1) + return configs.size(); + } + + string getElementAt(int i) override + { + if (i >= configs.size() || i < 0) + return "---"; + return configs[i]; + } + + void InitConfigsList(void) + { + configs.clear(); + for (int i = 0; iBuildInID != BUILDINID_NONE) + char tmp[MAX_DPATH]; + strncpy(tmp, ConfigFilesList[i]->Name, MAX_DPATH); + if (strlen(ConfigFilesList[i]->Description) > 0) { - load_buildin_config(ConfigFilesList[i]->BuildInID); - strcpy(changed_prefs.description, ConfigFilesList[i]->Description); + strncat(tmp, " (", MAX_DPATH - 1); + strncat(tmp, ConfigFilesList[i]->Description, MAX_DPATH - 1); + strncat(tmp, ")", MAX_DPATH - 1); + } + configs.push_back(tmp); + } + } + }; + + static ConfigsListModel* configsList; + + + class ConfigButtonActionListener : public gcn::ActionListener + { + public: + void action(const gcn::ActionEvent& actionEvent) override + { + int i; + if (actionEvent.getSource() == cmdLoad) + { + //----------------------------------------------- + // Load selected configuration + //----------------------------------------------- + i = lstConfigs->getSelected(); + if (emulating) + { + uae_restart(-1, ConfigFilesList[i]->FullPath); } else { target_cfgfile_load(&changed_prefs, ConfigFilesList[i]->FullPath, 0, 0); + strncpy(last_active_config, ConfigFilesList[i]->Name, MAX_PATH); + DisableResume(); + RefreshAllPanels(); } - strncpy(last_active_config, ConfigFilesList[i]->Name, MAX_PATH); - DisableResume(); - RefreshAllPanels(); } - } - else if (actionEvent.getSource() == cmdSave) - { - //----------------------------------------------- - // Save current configuration - //----------------------------------------------- - char filename[MAX_DPATH]; - if (!txtName->getText().empty()) + else if (actionEvent.getSource() == cmdSave) { - fetch_configurationpath(filename, MAX_DPATH); - strncat(filename, txtName->getText().c_str(), MAX_DPATH); - strncat(filename, ".uae", MAX_DPATH); - strncpy(changed_prefs.description, txtDesc->getText().c_str(), 256); - if (cfgfile_save(&changed_prefs, filename, 0)) - RefreshPanelConfig(); - } - } - else if (actionEvent.getSource() == cmdLoadFrom) - { - } - else if (actionEvent.getSource() == cmdSaveAs) - { - } - else if (actionEvent.getSource() == cmdDelete) - { - //----------------------------------------------- - // Delete selected config - //----------------------------------------------- - char msg[256]; - i = lstConfigs->getSelected(); - if (i >= 0 && ConfigFilesList[i]->BuildInID == BUILDINID_NONE && strcmp(ConfigFilesList[i]->Name, OPTIONSFILENAME)) - { - snprintf(msg, 256, "Do you want to delete '%s' ?", ConfigFilesList[i]->Name); - if (ShowMessage("Delete Configuration", msg, "", "Yes", "No")) + //----------------------------------------------- + // Save current configuration + //----------------------------------------------- + char filename[MAX_DPATH]; + if (!txtName->getText().empty()) { - remove(ConfigFilesList[i]->FullPath); - if (!strcmp(last_active_config, ConfigFilesList[i]->Name)) - { - txtName->setText(""); - txtDesc->setText(""); - last_active_config[0] = '\0'; - } - ConfigFilesList.erase(ConfigFilesList.begin() + i); - RefreshPanelConfig(); + fetch_configurationpath(filename, MAX_DPATH); + strncat(filename, txtName->getText().c_str(), MAX_DPATH - 1); + strncat(filename, ".uae", MAX_DPATH); + strncpy(changed_prefs.description, txtDesc->getText().c_str(), 256); + if (cfgfile_save(&changed_prefs, filename, 0)) + RefreshPanelConfig(); + } + } + else if (actionEvent.getSource() == cmdLoadFrom) + { + } + else if (actionEvent.getSource() == cmdSaveAs) + { + } + else if (actionEvent.getSource() == cmdDelete) + { + //----------------------------------------------- + // Delete selected config + //----------------------------------------------- + char msg[256]; + i = lstConfigs->getSelected(); + if (i >= 0 && strcmp(ConfigFilesList[i]->Name, OPTIONSFILENAME)) + { + snprintf(msg, 256, "Do you want to delete '%s' ?", ConfigFilesList[i]->Name); + if (ShowMessage("Delete Configuration", msg, "", "Yes", "No")) + { + remove(ConfigFilesList[i]->FullPath); + if (!strcmp(last_active_config, ConfigFilesList[i]->Name)) + { + txtName->setText(""); + txtDesc->setText(""); + last_active_config[0] = '\0'; + } + ConfigFilesList.erase(ConfigFilesList.begin() + i); + RefreshPanelConfig(); + } + cmdDelete->requestFocus(); } - cmdDelete->requestFocus(); } } - } -}; + }; -static ConfigButtonActionListener* configButtonActionListener; + static ConfigButtonActionListener* configButtonActionListener; -class ConfigsListActionListener : public gcn::ActionListener -{ -public: - void action(const gcn::ActionEvent& actionEvent) override + class ConfigsListActionListener : public gcn::ActionListener { - int selected_item; - selected_item = lstConfigs->getSelected(); - if (!txtName->getText().compare(ConfigFilesList[selected_item]->Name)) + public: + void action(const gcn::ActionEvent& actionEvent) override { - //----------------------------------------------- - // Selected same config again -> load and start it - //----------------------------------------------- - if (ConfigFilesList[selected_item]->BuildInID != BUILDINID_NONE) + const int selected_item = lstConfigs->getSelected(); + if (!txtName->getText().compare(ConfigFilesList[selected_item]->Name)) { - load_buildin_config(ConfigFilesList[selected_item]->BuildInID); - strcpy(changed_prefs.description, ConfigFilesList[selected_item]->Description); + //----------------------------------------------- + // Selected same config again -> load and start it + //----------------------------------------------- + if (emulating) + { + uae_restart(0, ConfigFilesList[selected_item]->FullPath); + } + else + { + target_cfgfile_load(&changed_prefs, ConfigFilesList[selected_item]->FullPath, 0, 0); + strncpy(last_active_config, ConfigFilesList[selected_item]->Name, MAX_PATH); + DisableResume(); + RefreshAllPanels(); + uae_reset(0, 1); + } + gui_running = false; } else { - target_cfgfile_load(&changed_prefs, ConfigFilesList[selected_item]->FullPath, 0, 0); + txtName->setText(ConfigFilesList[selected_item]->Name); + txtDesc->setText(ConfigFilesList[selected_item]->Description); } - strncpy(last_active_config, ConfigFilesList[selected_item]->Name, MAX_PATH); - DisableResume(); - RefreshAllPanels(); } - else - { - txtName->setText(ConfigFilesList[selected_item]->Name); - txtDesc->setText(ConfigFilesList[selected_item]->Description); - } - } -}; + }; -static ConfigsListActionListener* configsListActionListener; + static ConfigsListActionListener* configsListActionListener; -void InitPanelConfig(const struct _ConfigCategory& category) -{ - configButtonActionListener = new ConfigButtonActionListener(); - - cmdLoad = new gcn::Button("Load"); - cmdLoad->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdLoad->setBaseColor(gui_baseCol); - cmdLoad->setId("ConfigLoad"); - cmdLoad->addActionListener(configButtonActionListener); - - cmdSave = new gcn::Button("Save"); - cmdSave->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdSave->setBaseColor(gui_baseCol); - cmdSave->setId("ConfigSave"); - cmdSave->addActionListener(configButtonActionListener); - - cmdLoadFrom = new gcn::Button("Load From..."); - cmdLoadFrom->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdLoadFrom->setBaseColor(gui_baseCol); - cmdLoadFrom->setId("CfgLoadFrom"); - cmdLoadFrom->addActionListener(configButtonActionListener); - cmdLoadFrom->setEnabled(false); - - cmdSaveAs = new gcn::Button("Save As..."); - cmdSaveAs->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdSaveAs->setBaseColor(gui_baseCol); - cmdSaveAs->setId("CfgSaveAs"); - cmdSaveAs->addActionListener(configButtonActionListener); - cmdSaveAs->setEnabled(false); - - cmdDelete = new gcn::Button("Delete"); - cmdDelete->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdDelete->setBaseColor(gui_baseCol); - cmdDelete->setId("CfgDelete"); - cmdDelete->addActionListener(configButtonActionListener); - - int buttonX = DISTANCE_BORDER; - int buttonY = category.panel->getHeight() - DISTANCE_BORDER - BUTTON_HEIGHT; - category.panel->add(cmdLoad, buttonX, buttonY); - buttonX += BUTTON_WIDTH + DISTANCE_NEXT_X; - category.panel->add(cmdSave, buttonX, buttonY); - buttonX += BUTTON_WIDTH + 3 * DISTANCE_NEXT_X; - // category.panel->add(cmdLoadFrom, buttonX, buttonY); - buttonX += BUTTON_WIDTH + DISTANCE_NEXT_X; - // category.panel->add(cmdSaveAs, buttonX, buttonY); - buttonX = category.panel->getWidth() - DISTANCE_BORDER - BUTTON_WIDTH; - category.panel->add(cmdDelete, buttonX, buttonY); - - lblName = new gcn::Label("Name:"); - lblName->setSize(90, LABEL_HEIGHT); - lblName->setAlignment(gcn::Graphics::RIGHT); - txtName = new gcn::TextField(); - txtName->setSize(300, TEXTFIELD_HEIGHT); - txtName->setId("ConfigName"); - - lblDesc = new gcn::Label("Description:"); - lblDesc->setSize(90, LABEL_HEIGHT); - lblDesc->setAlignment(gcn::Graphics::RIGHT); - txtDesc = new gcn::TextField(); - txtDesc->setSize(300, TEXTFIELD_HEIGHT); - txtDesc->setId("ConfigDesc"); - - category.panel->add(lblName, DISTANCE_BORDER, 2 + buttonY - DISTANCE_NEXT_Y - 2 * TEXTFIELD_HEIGHT - 10); - category.panel->add(txtName, DISTANCE_BORDER + lblName->getWidth() + 8, buttonY - DISTANCE_NEXT_Y - 2 * TEXTFIELD_HEIGHT - 10); - category.panel->add(lblDesc, DISTANCE_BORDER, 2 + buttonY - DISTANCE_NEXT_Y - TEXTFIELD_HEIGHT); - category.panel->add(txtDesc, DISTANCE_BORDER + lblName->getWidth() + 8, buttonY - DISTANCE_NEXT_Y - TEXTFIELD_HEIGHT); - - ReadConfigFileList(); - configsList = new ConfigsListModel(); - configsList->InitConfigsList(); - configsListActionListener = new ConfigsListActionListener(); - - lstConfigs = new gcn::UaeListBox(configsList); - lstConfigs->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER - 22, 232); - lstConfigs->setBaseColor(gui_baseCol); - lstConfigs->setWrappingEnabled(true); - lstConfigs->setId("ConfigList"); - lstConfigs->addActionListener(configsListActionListener); - - scrAreaConfigs = new gcn::ScrollArea(lstConfigs); - scrAreaConfigs->setBorderSize(1); - scrAreaConfigs->setPosition(DISTANCE_BORDER, DISTANCE_BORDER); - scrAreaConfigs->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER - 2, 252); - scrAreaConfigs->setScrollbarWidth(20); - scrAreaConfigs->setBaseColor(gui_baseCol); - category.panel->add(scrAreaConfigs); - - if (strlen(last_active_config) == 0) - strncpy(last_active_config, OPTIONSFILENAME, MAX_PATH); - txtName->setText(last_active_config); - txtDesc->setText(changed_prefs.description); - ensureVisible = -1; - RefreshPanelConfig(); -} - -void ExitPanelConfig() -{ - delete lstConfigs; - delete scrAreaConfigs; - delete configsListActionListener; - delete configsList; - - delete cmdLoad; - delete cmdSave; - delete cmdLoadFrom; - delete cmdSaveAs; - delete cmdDelete; - - delete configButtonActionListener; - - delete lblName; - delete txtName; - delete lblDesc; - delete txtDesc; -} - -static void MakeCurrentVisible() -{ - if (ensureVisible >= 0) + void InitPanelConfig(const struct _ConfigCategory& category) { - scrAreaConfigs->setVerticalScrollAmount(ensureVisible * 19); + configButtonActionListener = new ConfigButtonActionListener(); + + cmdLoad = new gcn::Button("Load"); + cmdLoad->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); + cmdLoad->setBaseColor(gui_baseCol); + cmdLoad->setId("ConfigLoad"); + cmdLoad->addActionListener(configButtonActionListener); + + cmdSave = new gcn::Button("Save"); + cmdSave->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); + cmdSave->setBaseColor(gui_baseCol); + cmdSave->setId("ConfigSave"); + cmdSave->addActionListener(configButtonActionListener); + + cmdLoadFrom = new gcn::Button("Load From..."); + cmdLoadFrom->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); + cmdLoadFrom->setBaseColor(gui_baseCol); + cmdLoadFrom->setId("CfgLoadFrom"); + cmdLoadFrom->addActionListener(configButtonActionListener); + cmdLoadFrom->setEnabled(false); + + cmdSaveAs = new gcn::Button("Save As..."); + cmdSaveAs->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); + cmdSaveAs->setBaseColor(gui_baseCol); + cmdSaveAs->setId("CfgSaveAs"); + cmdSaveAs->addActionListener(configButtonActionListener); + cmdSaveAs->setEnabled(false); + + cmdDelete = new gcn::Button("Delete"); + cmdDelete->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); + cmdDelete->setBaseColor(gui_baseCol); + cmdDelete->setId("CfgDelete"); + cmdDelete->addActionListener(configButtonActionListener); + + int buttonX = DISTANCE_BORDER; + int buttonY = category.panel->getHeight() - DISTANCE_BORDER - BUTTON_HEIGHT; + category.panel->add(cmdLoad, buttonX, buttonY); + buttonX += BUTTON_WIDTH + DISTANCE_NEXT_X; + category.panel->add(cmdSave, buttonX, buttonY); + buttonX += BUTTON_WIDTH + 3 * DISTANCE_NEXT_X; + buttonX += BUTTON_WIDTH + DISTANCE_NEXT_X; + buttonX = category.panel->getWidth() - DISTANCE_BORDER - BUTTON_WIDTH; + category.panel->add(cmdDelete, buttonX, buttonY); + + lblName = new gcn::Label("Name:"); + lblName->setSize(lblName->getWidth(), lblName->getHeight()); + lblName->setAlignment(gcn::Graphics::RIGHT); + txtName = new gcn::TextField(); + txtName->setSize(300, txtName->getHeight()); + txtName->setId("ConfigName"); + txtName->setBackgroundColor(colTextboxBackground); + + lblDesc = new gcn::Label("Description:"); + lblDesc->setSize(lblDesc->getWidth(), lblDesc->getHeight()); + lblDesc->setAlignment(gcn::Graphics::RIGHT); + txtDesc = new gcn::TextField(); + txtDesc->setSize(300, txtDesc->getHeight()); + txtDesc->setId("ConfigDesc"); + txtDesc->setBackgroundColor(colTextboxBackground); + + ReadConfigFileList(); + configsList = new ConfigsListModel(); + configsList->InitConfigsList(); + configsListActionListener = new ConfigsListActionListener(); + + lstConfigs = new gcn::UaeListBox(configsList); + lstConfigs->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER - 22, 232); + lstConfigs->setBackgroundColor(colTextboxBackground); + lstConfigs->setWrappingEnabled(true); + lstConfigs->setId("ConfigList"); + lstConfigs->addActionListener(configsListActionListener); + + scrAreaConfigs = new gcn::ScrollArea(lstConfigs); + scrAreaConfigs->setBorderSize(1); + scrAreaConfigs->setPosition(DISTANCE_BORDER, DISTANCE_BORDER); + scrAreaConfigs->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER - 2, 252); + scrAreaConfigs->setScrollbarWidth(20); + scrAreaConfigs->setBackgroundColor(colTextboxBackground); + category.panel->add(scrAreaConfigs); + + category.panel->add(lblName, DISTANCE_BORDER, scrAreaConfigs->getY() + scrAreaConfigs->getHeight() + DISTANCE_NEXT_Y); + category.panel->add(txtName, DISTANCE_BORDER + lblDesc->getWidth() + 8, scrAreaConfigs->getY() + scrAreaConfigs->getHeight() + DISTANCE_NEXT_Y); + category.panel->add(lblDesc, DISTANCE_BORDER, lblName->getY() + lblName->getHeight() + DISTANCE_NEXT_Y); + category.panel->add(txtDesc, DISTANCE_BORDER + lblDesc->getWidth() + 8, txtName->getY() + txtName->getHeight() + DISTANCE_NEXT_Y); + + if (strlen(last_active_config) == 0) + strncpy(last_active_config, OPTIONSFILENAME, MAX_PATH); + txtName->setText(last_active_config); + txtDesc->setText(changed_prefs.description); ensureVisible = -1; + RefreshPanelConfig(); } -} -void RefreshPanelConfig() -{ - ReadConfigFileList(); - configsList->InitConfigsList(); - - // Search current entry - if (!txtName->getText().empty()) + void ExitPanelConfig() { - for (int i = 0; i < ConfigFilesList.size(); ++i) + delete lstConfigs; + delete scrAreaConfigs; + delete configsListActionListener; + delete configsList; + + delete cmdLoad; + delete cmdSave; + delete cmdLoadFrom; + delete cmdSaveAs; + delete cmdDelete; + + delete configButtonActionListener; + + delete lblName; + delete txtName; + delete lblDesc; + delete txtDesc; + } + + static void MakeCurrentVisible() + { + if (ensureVisible >= 0) { - if (!strcmp(ConfigFilesList[i]->Name, txtName->getText().c_str())) + scrAreaConfigs->setVerticalScrollAmount(ensureVisible * 19); + ensureVisible = -1; + } + } + + void RefreshPanelConfig() + { + ReadConfigFileList(); + configsList->InitConfigsList(); + + // Search current entry + if (!txtName->getText().empty()) + { + for (int i = 0; i < ConfigFilesList.size(); ++i) { - // Select current entry - lstConfigs->setSelected(i); - ensureVisible = i; - RegisterRefreshFunc(MakeCurrentVisible); - break; + if (!_tcscmp(ConfigFilesList[i]->Name, txtName->getText().c_str())) + { + // Select current entry + lstConfigs->setSelected(i); + ensureVisible = i; + RegisterRefreshFunc(MakeCurrentVisible); + break; + } } } } -} + + bool HelpPanelConfig(std::vector &helptext) + { + helptext.clear(); + helptext.push_back("To load a configuration, select the entry in the list and then click on \"Load\". If you doubleclick on an entry"); + helptext.push_back("in the list, the emulation starts with this configuration."); + helptext.push_back(""); + helptext.push_back("If you want to create a new configuration, setup all options, enter a new name in \"Name\", provide a short"); + helptext.push_back("description and then click on \"Save\"."); + helptext.push_back(""); + helptext.push_back("\"Delete\" will delete the selected configuration."); + return true; + } diff --git a/src/osdep/gui/PanelCustom.cpp b/src/osdep/gui/PanelCustom.cpp index fdf7bab3..32118ad7 100644 --- a/src/osdep/gui/PanelCustom.cpp +++ b/src/osdep/gui/PanelCustom.cpp @@ -1,7 +1,14 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -570,7 +577,11 @@ void RefreshPanelCustom(void) if (changed_prefs.jports[SelectedPort].id > JSEM_JOYS && changed_prefs.jports[SelectedPort].id < JSEM_MICE - 1) { const int hostjoyid = changed_prefs.jports[SelectedPort].id - JSEM_JOYS - 1; +#ifdef USE_SDL1 + strncpy(tmp, SDL_JoystickName(hostjoyid), 255); +#elif USE_SDL2 strncpy(tmp, SDL_JoystickNameForIndex(hostjoyid), 255); +#endif for (int n = 0; n < 14; ++n) { diff --git a/src/osdep/gui/PanelDisplay.cpp b/src/osdep/gui/PanelDisplay.cpp index 7a4f92a5..d72a02fd 100644 --- a/src/osdep/gui/PanelDisplay.cpp +++ b/src/osdep/gui/PanelDisplay.cpp @@ -1,7 +1,14 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -13,40 +20,100 @@ #include "options.h" #include "include/memory.h" #include "uae.h" +#include "custom.h" #include "gui.h" #include "gui_handling.h" -static gcn::UaeCheckBox* chkFrameskip; +#ifdef USE_SDL1 +const int amigawidth_values[] = { 320, 352, 384, 640, 704, 768 }; +const int amigaheight_values[] = { 200, 216, 240, 256, 262, 270 }; +const int FullscreenRatio[] = { 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97,98, 99,100 }; +#endif + +#ifdef USE_SDL2 static gcn::Window* grpScalingMethod; static gcn::UaeRadioButton* optAuto; static gcn::UaeRadioButton* optNearest; static gcn::UaeRadioButton* optLinear; -#ifdef PANDORA +#endif + +#ifdef USE_SDL1 static gcn::Window *grpAmigaScreen; +static gcn::Label* lblAmigaWidth; +static gcn::Label* lblAmigaWidthInfo; +static gcn::Slider* sldAmigaWidth; +static gcn::Label* lblAmigaHeight; +static gcn::Label* lblAmigaHeightInfo; +static gcn::Slider* sldAmigaHeight; static gcn::Label* lblVertPos; static gcn::Label* lblVertPosInfo; static gcn::Slider* sldVertPos; -#endif // PANDORA +#endif // USE_SDL1 + +static gcn::UaeCheckBox* chkLineDbl; +static gcn::UaeCheckBox* chkFrameskip; + +#ifdef USE_SDL1 +static gcn::Label* lblFSRatio; +static gcn::Label* lblFSRatioInfo; +static gcn::Slider* sldFSRatio; +static gcn::UaeCheckBox* chkAspect; +#endif + class AmigaScreenActionListener : public gcn::ActionListener { public: void action(const gcn::ActionEvent& actionEvent) override { - if (actionEvent.getSource() == chkFrameskip) +#ifdef USE_SDL1 + if (actionEvent.getSource() == sldAmigaWidth) + { + if (changed_prefs.gfx_size.width != amigawidth_values[(int)(sldAmigaWidth->getValue())]) + { + changed_prefs.gfx_size.width = amigawidth_values[(int)(sldAmigaWidth->getValue())]; + RefreshPanelDisplay(); + } + } + else if (actionEvent.getSource() == sldAmigaHeight) + { + if (changed_prefs.gfx_size.height != amigaheight_values[(int)(sldAmigaHeight->getValue())]) + { + changed_prefs.gfx_size.height = amigaheight_values[(int)(sldAmigaHeight->getValue())]; + RefreshPanelDisplay(); + } + } + else if (actionEvent.getSource() == sldVertPos) + { + if (changed_prefs.pandora_vertical_offset != (int)(sldVertPos->getValue()) + OFFSET_Y_ADJUST) + { + changed_prefs.pandora_vertical_offset = (int)(sldVertPos->getValue()) + OFFSET_Y_ADJUST; + RefreshPanelDisplay(); + } + } + else +#endif + if (actionEvent.getSource() == chkFrameskip) { changed_prefs.gfx_framerate = chkFrameskip->isSelected() ? 1 : 0; } -#ifdef PANDORA - else if (actionEvent.getSource() == sldVertPos) - { - if(changed_prefs.pandora_vertical_offset != (int)(sldVertPos->getValue()) + OFFSET_Y_ADJUST) - { - changed_prefs.pandora_vertical_offset = (int)(sldVertPos->getValue()) + OFFSET_Y_ADJUST; - RefreshPanelDisplay(); - } - } -#endif // PANDORA + else if (actionEvent.getSource() == chkLineDbl) + { + changed_prefs.gfx_vresolution = chkLineDbl->isSelected() ? VRES_DOUBLE : VRES_NONDOUBLE; + } +#ifdef USE_SDL1 + else if (actionEvent.getSource() == sldFSRatio) + { + if (changed_prefs.gfx_fullscreen_ratio != FullscreenRatio[(int)(sldFSRatio->getValue())]) + { + changed_prefs.gfx_fullscreen_ratio = FullscreenRatio[(int)(sldFSRatio->getValue())]; + RefreshPanelDisplay(); + } + } + else if (actionEvent.getSource() == chkAspect) + changed_prefs.gfx_correct_aspect = chkAspect->isSelected(); +#endif } }; @@ -71,9 +138,35 @@ static ScalingMethodActionListener* scalingMethodActionListener; void InitPanelDisplay(const struct _ConfigCategory& category) { amigaScreenActionListener = new AmigaScreenActionListener(); - int posY = DISTANCE_BORDER; +#ifdef USE_SDL1 + lblAmigaWidth = new gcn::Label("Width:"); + lblAmigaWidth->setSize(150, LABEL_HEIGHT); + lblAmigaWidth->setAlignment(gcn::Graphics::RIGHT); + sldAmigaWidth = new gcn::Slider(0, 5); + sldAmigaWidth->setSize(160, SLIDER_HEIGHT); + sldAmigaWidth->setBaseColor(gui_baseCol); + sldAmigaWidth->setMarkerLength(20); + sldAmigaWidth->setStepLength(1); + sldAmigaWidth->setId("sldWidth"); + sldAmigaWidth->addActionListener(amigaScreenActionListener); + lblAmigaWidthInfo = new gcn::Label("320"); + + lblAmigaHeight = new gcn::Label("Height:"); + lblAmigaHeight->setSize(150, LABEL_HEIGHT); + lblAmigaHeight->setAlignment(gcn::Graphics::RIGHT); + sldAmigaHeight = new gcn::Slider(0, 5); + sldAmigaHeight->setSize(160, SLIDER_HEIGHT); + sldAmigaHeight->setBaseColor(gui_baseCol); + sldAmigaHeight->setMarkerLength(20); + sldAmigaHeight->setStepLength(1); + sldAmigaHeight->setId("sldHeight"); + sldAmigaHeight->addActionListener(amigaScreenActionListener); + lblAmigaHeightInfo = new gcn::Label("200"); +#endif + +#ifdef USE_SDL2 scalingMethodActionListener = new ScalingMethodActionListener(); optAuto = new gcn::UaeRadioButton("Auto", "radioscalingmethodgroup"); @@ -97,6 +190,7 @@ void InitPanelDisplay(const struct _ConfigCategory& category) category.panel->add(grpScalingMethod); posY += DISTANCE_BORDER + grpScalingMethod->getHeight() + DISTANCE_NEXT_Y; +#endif #ifdef PANDORA lblVertPos = new gcn::Label("Vert. offset:"); @@ -111,24 +205,59 @@ void InitPanelDisplay(const struct _ConfigCategory& category) sldVertPos->addActionListener(amigaScreenActionListener); lblVertPosInfo = new gcn::Label("000"); #endif //PANDORA +#ifdef USE_SDL1 + lblFSRatio = new gcn::Label("Fullscreen Ratio:"); + lblFSRatio->setSize(150, LABEL_HEIGHT); + lblFSRatio->setAlignment(gcn::Graphics::RIGHT); + sldFSRatio = new gcn::Slider(0, 20); + sldFSRatio->setSize(160, SLIDER_HEIGHT); + sldFSRatio->setBaseColor(gui_baseCol); + sldFSRatio->setMarkerLength(20); + sldFSRatio->setStepLength(1); + sldFSRatio->setId("FSRatio"); + sldFSRatio->addActionListener(amigaScreenActionListener); + lblFSRatioInfo = new gcn::Label("100%%"); + chkAspect = new gcn::UaeCheckBox("4/3 ratio shrink"); + chkAspect->setId("4by3Ratio"); + chkAspect->addActionListener(amigaScreenActionListener); +#endif + chkLineDbl = new gcn::UaeCheckBox("Line doubling"); + chkLineDbl->addActionListener(amigaScreenActionListener); chkFrameskip = new gcn::UaeCheckBox("Frameskip"); chkFrameskip->addActionListener(amigaScreenActionListener); -#ifdef PANDORA +#ifdef USE_SDL1 grpAmigaScreen = new gcn::Window("Amiga Screen"); grpAmigaScreen->setPosition(DISTANCE_BORDER, DISTANCE_BORDER); + int posY = 10; + grpAmigaScreen->add(lblAmigaWidth, 0, posY); + grpAmigaScreen->add(sldAmigaWidth, 160, posY); + grpAmigaScreen->add(lblAmigaWidthInfo, 160 + sldAmigaWidth->getWidth() + 12, posY); + posY += sldAmigaWidth->getHeight() + DISTANCE_NEXT_Y; + grpAmigaScreen->add(lblAmigaHeight, 0, posY); + grpAmigaScreen->add(sldAmigaHeight, 160, posY); + grpAmigaScreen->add(lblAmigaHeightInfo, 160 + sldAmigaHeight->getWidth() + 12, posY); + posY += sldAmigaHeight->getHeight() + DISTANCE_NEXT_Y; grpAmigaScreen->add(lblVertPos, 0, posY); grpAmigaScreen->add(sldVertPos, 160, posY); grpAmigaScreen->add(lblVertPosInfo, 160 + sldVertPos->getWidth() + 12, posY); posY += sldVertPos->getHeight() + DISTANCE_NEXT_Y; + grpAmigaScreen->add(lblFSRatio, 0, posY); + grpAmigaScreen->add(sldFSRatio, 160, posY); + grpAmigaScreen->add(lblFSRatioInfo, 160 + sldFSRatio->getWidth() + 12, posY); + posY += sldFSRatio->getHeight() + DISTANCE_NEXT_Y; grpAmigaScreen->setMovable(false); grpAmigaScreen->setSize(460, posY + DISTANCE_BORDER); grpAmigaScreen->setBaseColor(gui_baseCol); category.panel->add(grpAmigaScreen); -#endif //PANDORA - + posY = DISTANCE_BORDER + grpAmigaScreen->getHeight() + DISTANCE_NEXT_Y; + category.panel->add(chkAspect, DISTANCE_BORDER, posY); + posY += chkAspect->getHeight() + DISTANCE_NEXT_Y; +#endif + category.panel->add(chkLineDbl, DISTANCE_BORDER, posY); + posY += chkLineDbl->getHeight() + DISTANCE_NEXT_Y; category.panel->add(chkFrameskip, DISTANCE_BORDER, posY); RefreshPanelDisplay(); @@ -139,30 +268,84 @@ void ExitPanelDisplay() { delete chkFrameskip; delete amigaScreenActionListener; -#ifdef PANDORA +#ifdef USE_SDL1 + delete lblAmigaWidth; + delete sldAmigaWidth; + delete lblAmigaWidthInfo; + delete lblAmigaHeight; + delete sldAmigaHeight; + delete lblAmigaHeightInfo; delete lblVertPos; delete sldVertPos; delete lblVertPosInfo; delete grpAmigaScreen; -#endif //PANDORA + delete lblFSRatio; + delete sldFSRatio; + delete lblFSRatioInfo; + delete chkAspect; +#endif +#ifdef USE_SDL2 delete optAuto; delete optNearest; delete optLinear; delete grpScalingMethod; delete scalingMethodActionListener; +#endif } void RefreshPanelDisplay() { + chkLineDbl->setSelected(changed_prefs.gfx_vresolution != VRES_NONDOUBLE); chkFrameskip->setSelected(changed_prefs.gfx_framerate); +#ifdef USE_SDL1 + int i; + char tmp[32]; + + for (i = 0; i<6; ++i) + { + if (changed_prefs.gfx_size.width == amigawidth_values[i]) + { + sldAmigaWidth->setValue(i); + snprintf(tmp, 32, "%d", changed_prefs.gfx_size.width); + lblAmigaWidthInfo->setCaption(tmp); + break; + } + } + + for (i = 0; i<6; ++i) + { + if (changed_prefs.gfx_size.height == amigaheight_values[i]) + { + sldAmigaHeight->setValue(i); + snprintf(tmp, 32, "%d", changed_prefs.gfx_size.height); + lblAmigaHeightInfo->setCaption(tmp); + break; + } + } + + for (i = 0; i<21; ++i) + { + if (changed_prefs.gfx_fullscreen_ratio == FullscreenRatio[i]) + { + sldFSRatio->setValue(i); + snprintf(tmp, 32, "%d%%", changed_prefs.gfx_fullscreen_ratio); + lblFSRatioInfo->setCaption(tmp); + break; + } + } +#endif + +#ifdef USE_SDL2 if (changed_prefs.scaling_method == -1) optAuto->setSelected(true); else if (changed_prefs.scaling_method == 0) optNearest->setSelected(true); else if (changed_prefs.scaling_method == 1) optLinear->setSelected(true); +#endif + #ifdef PANDORA sldVertPos->setValue(changed_prefs.pandora_vertical_offset - OFFSET_Y_ADJUST); snprintf(tmp, 32, "%d", changed_prefs.pandora_vertical_offset - OFFSET_Y_ADJUST); @@ -173,16 +356,25 @@ void RefreshPanelDisplay() bool HelpPanelDisplay(std::vector &helptext) { helptext.clear(); +#ifdef USE_SDL1 + helptext.push_back("Select the required width and height of the Amiga screen. If you select \"NTSC\" in chipset, a value greater than"); + helptext.push_back("240 for \"Height\" makes no sense. When the game, demo or workbench uses Hires mode and you selected a"); + helptext.push_back("value for \"Width\" lower than 640, you will only see half of the pixels."); + helptext.push_back(""); +#elif USE_SDL2 helptext.push_back("Select the scaling method for the Amiga screen. The default option \"Auto\", will try to find the best looking"); helptext.push_back("scaling method depending on your monitor's resolution. \"Nearest Neighbor\" will give you a more pixelated"); helptext.push_back("and crisp image, but it may come with some distortion if your resolution is not an exact multiple."); helptext.push_back("\"Linear\" will give you a smoother scaling but some people might find it a bit blurry."); helptext.push_back(""); +#endif #ifdef PANDORA helptext.push_back("With \"Vert. offset\" you can adjust the position of the first drawn line of the Amiga screen. You can also change"); helptext.push_back("this during emulation with left and right shoulder button and dpad up/down."); helptext.push_back(""); #endif //PANDORA + helptext.push_back("Activate line doubling to remove flicker in interlace modes."); + helptext.push_back(""); helptext.push_back("When you activate \"Frameskip\", only every second frame is drawn. This will improve performance and some"); helptext.push_back("more games are playable."); return true; diff --git a/src/osdep/gui/PanelFloppy.cpp b/src/osdep/gui/PanelFloppy.cpp index effa2de4..9ab9a173 100644 --- a/src/osdep/gui/PanelFloppy.cpp +++ b/src/osdep/gui/PanelFloppy.cpp @@ -1,7 +1,14 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -170,7 +177,7 @@ public: //--------------------------------------- // Show info about current disk-image //--------------------------------------- - //if (changed_prefs.floppyslots[i].dfxtype != DRV_NONE && strlen(changed_prefs.floppyslots[i].df) > 0); // ToDo: Show info dialog + //if (changed_prefs.floppyslots[i].dfxtype != DRV_NONE && strlen(changed_prefs.floppyslots[i].df) > 0) //ToDo: Show info dialog } else if (actionEvent.getSource() == cmdDFxEject[i]) @@ -179,7 +186,7 @@ public: // Eject disk from drive //--------------------------------------- disk_eject(i); - strcpy(changed_prefs.floppyslots[i].df, ""); + strncpy(changed_prefs.floppyslots[i].df, "", MAX_DPATH); AdjustDropDownControls(); } else if (actionEvent.getSource() == cmdDFxSelect[i]) @@ -190,14 +197,14 @@ public: char tmp[MAX_DPATH]; if (strlen(changed_prefs.floppyslots[i].df) > 0) - strcpy(tmp, changed_prefs.floppyslots[i].df); + strncpy(tmp, changed_prefs.floppyslots[i].df, MAX_PATH); else - strcpy(tmp, currentDir); + strncpy(tmp, currentDir, MAX_PATH); if (SelectFile("Select disk image file", tmp, diskfile_filter)) { - if (strncmp(changed_prefs.floppyslots[i].df, tmp, sizeof changed_prefs.floppyslots[i].df)) + if(strncmp(changed_prefs.floppyslots[i].df, tmp, MAX_PATH)) { - strcpy(changed_prefs.floppyslots[i].df, tmp); + strncpy(changed_prefs.floppyslots[i].df, tmp, sizeof(changed_prefs.floppyslots[i].df)); disk_insert(i, tmp); AddFileToDiskList(tmp, 1); extractPath(tmp, currentDir); @@ -308,7 +315,7 @@ public: extractFileName(changed_prefs.floppyslots[0].df, diskname); removeFileExtension(diskname); - fetch_configurationpath(filename, sizeof filename); + fetch_configurationpath(filename, MAX_DPATH); strncat(filename, diskname, MAX_DPATH - 1); strncat(filename, ".uae", MAX_DPATH) - 1; @@ -476,11 +483,11 @@ void InitPanelFloppy(const struct _ConfigCategory& category) //category.panel->add(cmdDFxInfo[i], posX, posY); //TODO disabled? posX += cmdDFxInfo[i]->getWidth() + DISTANCE_NEXT_X; category.panel->add(cmdDFxEject[i], posX, posY); - posX = DISTANCE_BORDER + textFieldWidth + DISTANCE_NEXT_X; - posY += cboDFxType[i]->getHeight() + 8; + posX += cmdDFxEject[i]->getWidth() + DISTANCE_NEXT_X; + category.panel->add(cmdDFxSelect[i], posX, posY); + posY += chkDFx[i]->getHeight() + 8; - category.panel->add(cboDFxFile[i], DISTANCE_BORDER, posY); - category.panel->add(cmdDFxSelect[i], posX, posY); + category.panel->add(cboDFxFile[i], DISTANCE_BORDER, posY); if (i == 0) { posY += cboDFxFile[i]->getHeight() + 8; diff --git a/src/osdep/gui/PanelHD.cpp b/src/osdep/gui/PanelHD.cpp index 65223be8..3e61aa79 100644 --- a/src/osdep/gui/PanelHD.cpp +++ b/src/osdep/gui/PanelHD.cpp @@ -1,7 +1,14 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -215,6 +222,7 @@ public: changed_prefs.cdslots[0].type = SCSI_UNIT_IMAGE; } RefreshPanelHD(); + RefreshPanelQuickstart(); } }; @@ -231,7 +239,7 @@ public: //--------------------------------------- // Eject CD from drive //--------------------------------------- - strcpy(changed_prefs.cdslots[0].name, ""); + strncpy(changed_prefs.cdslots[0].name, "", MAX_DPATH); AdjustDropDownControls(); } else if (actionEvent.getSource() == cmdCDSelect) @@ -239,15 +247,15 @@ public: char tmp[MAX_DPATH]; if (strlen(changed_prefs.cdslots[0].name) > 0) - strcpy(tmp, changed_prefs.cdslots[0].name); + strncpy(tmp, changed_prefs.cdslots[0].name, MAX_DPATH); else strcpy(tmp, currentDir); if (SelectFile("Select CD image file", tmp, cdfile_filter)) { - if (strncmp(changed_prefs.cdslots[0].name, tmp, sizeof changed_prefs.cdslots[0].name)) + if(strncmp(changed_prefs.cdslots[0].name, tmp, MAX_DPATH)) { - strcpy(changed_prefs.cdslots[0].name, tmp); + strncpy(changed_prefs.cdslots[0].name, tmp, sizeof(changed_prefs.cdslots[0].name)); changed_prefs.cdslots[0].inuse = true; changed_prefs.cdslots[0].type = SCSI_UNIT_IMAGE; AddFileToCDList(tmp, 1); @@ -312,7 +320,7 @@ public: { if (cdfileList.getElementAt(idx).compare(changed_prefs.cdslots[0].name)) { - strcpy(changed_prefs.cdslots[0].name, cdfileList.getElementAt(idx).c_str()); + strncpy(changed_prefs.cdslots[0].name, cdfileList.getElementAt(idx).c_str(), sizeof(changed_prefs.cdslots[0].name)); changed_prefs.cdslots[0].inuse = true; changed_prefs.cdslots[0].type = SCSI_UNIT_IMAGE; lstMRUCDList.erase(lstMRUCDList.begin() + idx); @@ -352,7 +360,11 @@ void InitPanelHD(const struct _ConfigCategory& category) listEntry[row] = new gcn::Container(); listEntry[row]->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER, TEXTFIELD_HEIGHT + 4); listEntry[row]->setBaseColor(gui_baseCol); +#ifdef USE_SDL1 + listEntry[row]->setFrameSize(0); +#elif USE_SDL2 listEntry[row]->setBorderSize(0); +#endif listCmdProps[row] = new gcn::Button("..."); listCmdProps[row]->setBaseColor(gui_baseCol); @@ -437,6 +449,7 @@ void InitPanelHD(const struct _ConfigCategory& category) sldCDVol->setId("CDVol"); sldCDVol->addActionListener(genericActionListener); lblCDVolInfo = new gcn::Label("80 %"); + lblCDVolInfo->setSize(100, LABEL_HEIGHT); int posX = DISTANCE_BORDER + 2 + SMALL_BUTTON_WIDTH + 34; for (col = 0; col < COL_COUNT; ++col) diff --git a/src/osdep/gui/PanelInput.cpp b/src/osdep/gui/PanelInput.cpp index ee2875a0..06f26f10 100644 --- a/src/osdep/gui/PanelInput.cpp +++ b/src/osdep/gui/PanelInput.cpp @@ -1,7 +1,14 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -195,6 +202,9 @@ static int amigaKey[] = AK_F2, AK_F3, AK_F4, AK_F5, AK_F6, AK_F7, AK_F8, AK_F9, /* 101 - 108 */ AK_F10, 0 }; /* 109 - 110 */ +#ifdef USE_SDL1 +extern int customControlMap[SDLK_LAST]; +#endif static int GetAmigaKeyIndex(int key) { @@ -629,6 +639,7 @@ void InitPanelInput(const struct _ConfigCategory& category) lblAutofire->setSize(100, LABEL_HEIGHT); lblAutofire->setAlignment(gcn::Graphics::RIGHT); cboAutofire = new gcn::UaeDropDown(&autofireList); + cboAutofire->setSize(80, DROPDOWN_HEIGHT); cboAutofire->setBaseColor(gui_baseCol); cboAutofire->setBackgroundColor(colTextboxBackground); cboAutofire->setId("cboAutofire"); diff --git a/src/osdep/gui/PanelMisc.cpp b/src/osdep/gui/PanelMisc.cpp index 2e5edd8f..b3b22dd4 100644 --- a/src/osdep/gui/PanelMisc.cpp +++ b/src/osdep/gui/PanelMisc.cpp @@ -1,7 +1,14 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -70,8 +77,8 @@ public: } }; -const char* listValues[] = {"none", "POWER", "DF0", "DF1", "DF2", "DF3", "DF*", "HD", "CD"}; -StringListModel KBDLedList(listValues, 9); +static const char* listValues[] = {"none", "POWER", "DF0", "DF1", "DF2", "DF3", "DF*", "HD", "CD"}; +static StringListModel KBDLedList(listValues, 9); class MiscActionListener : public gcn::ActionListener { @@ -81,12 +88,24 @@ public: if (actionEvent.getSource() == chkStatusLine) changed_prefs.leds_on_screen = chkStatusLine->isSelected(); #ifdef PANDORA - else if (actionEvent.getSource() == chkHideIdleLed) - changed_prefs.pandora_hide_idle_led = chkHideIdleLed->isSelected(); + else if (actionEvent.getSource() == chkHideIdleLed) + changed_prefs.pandora_hide_idle_led = chkHideIdleLed->isSelected(); #endif else if (actionEvent.getSource() == chkShowGUI) changed_prefs.start_gui = chkShowGUI->isSelected(); + else if (actionEvent.getSource() == chkRetroArchQuit) + changed_prefs.amiberry_use_retroarch_quit = chkRetroArchQuit->isSelected(); + + else if (actionEvent.getSource() == chkRetroArchMenu) + changed_prefs.amiberry_use_retroarch_menu = chkRetroArchMenu->isSelected(); + + else if (actionEvent.getSource() == chkRetroArchReset) + changed_prefs.amiberry_use_retroarch_reset = chkRetroArchReset->isSelected(); + + // else if (actionEvent.getSource() == chkRetroArchSavestate) + // changed_prefs.amiberry_use_retroarch_savestatebuttons = chkRetroArchSavestate->isSelected(); + else if (actionEvent.getSource() == chkBSDSocket) changed_prefs.socket_emu = chkBSDSocket->isSelected(); @@ -116,16 +135,16 @@ public: } } #ifdef PANDORA - else if (actionEvent.getSource() == sldPandoraSpeed) - { - int newspeed = (int) sldPandoraSpeed->getValue(); - newspeed = newspeed - (newspeed % 20); - if(changed_prefs.pandora_cpu_speed != newspeed) - { - changed_prefs.pandora_cpu_speed = newspeed; - RefreshPanelMisc(); - } - } + else if (actionEvent.getSource() == sldPandoraSpeed) + { + int newspeed = (int)sldPandoraSpeed->getValue(); + newspeed = newspeed - (newspeed % 20); + if (changed_prefs.pandora_cpu_speed != newspeed) + { + changed_prefs.pandora_cpu_speed = newspeed; + RefreshPanelMisc(); + } + } #endif else if (actionEvent.getSource() == cboKBDLed_num) @@ -155,6 +174,24 @@ void InitPanelMisc(const struct _ConfigCategory& category) chkShowGUI->setId("ShowGUI"); chkShowGUI->addActionListener(miscActionListener); + chkRetroArchQuit = new gcn::UaeCheckBox("Use RetroArch Quit Button"); + chkRetroArchQuit->setId("RetroArchQuit"); + chkRetroArchQuit->addActionListener(miscActionListener); + + chkRetroArchMenu = new gcn::UaeCheckBox("Use RetroArch Menu Button"); + chkRetroArchMenu->setId("RetroArchMenu"); + chkRetroArchMenu->addActionListener(miscActionListener); + + chkRetroArchReset = new gcn::UaeCheckBox("Use RetroArch Reset Button"); + chkRetroArchReset->setId("RetroArchReset"); + chkRetroArchReset->addActionListener(miscActionListener); + + //chkRetroArchSavestate = new gcn::UaeCheckBox("Use RetroArch State Controls"); + //chkRetroArchSavestate->setId("RetroArchState"); + //chkRetroArchSavestate->addActionListener(miscActionListener); + + + #ifdef PANDORA lblPandoraSpeed = new gcn::Label("Pandora Speed:"); lblPandoraSpeed->setSize(110, LABEL_HEIGHT); @@ -227,14 +264,28 @@ void InitPanelMisc(const struct _ConfigCategory& category) posY += chkHideIdleLed->getHeight() + DISTANCE_NEXT_Y; category.panel->add(chkShowGUI, DISTANCE_BORDER, posY); posY += chkShowGUI->getHeight() + DISTANCE_NEXT_Y; + + posY = DISTANCE_BORDER; + int posX = 300; + category.panel->add(chkRetroArchQuit, posX + DISTANCE_BORDER, posY); + posY += chkRetroArchQuit->getHeight() + DISTANCE_NEXT_Y; + category.panel->add(chkRetroArchMenu, posX + DISTANCE_BORDER, posY); + posY += chkRetroArchMenu->getHeight() + DISTANCE_NEXT_Y; + category.panel->add(chkRetroArchReset, posX + DISTANCE_BORDER, posY); + posY += chkRetroArchReset->getHeight() + DISTANCE_NEXT_Y; + //category.panel->add(chkRetroArchSavestate, posX + DISTANCE_BORDER, posY); + #ifdef PANDORA - category.panel->add(lblPandoraSpeed, DISTANCE_BORDER, posY); - category.panel->add(sldPandoraSpeed, DISTANCE_BORDER + lblPandoraSpeed->getWidth() + 8, posY); - category.panel->add(lblPandoraSpeedInfo, sldPandoraSpeed->getX() + sldPandoraSpeed->getWidth() + 12, posY); - posY += sldPandoraSpeed->getHeight() + DISTANCE_NEXT_Y; + category.panel->add(lblPandoraSpeed, DISTANCE_BORDER, posY); + category.panel->add(sldPandoraSpeed, DISTANCE_BORDER + lblPandoraSpeed->getWidth() + 8, posY); + category.panel->add(lblPandoraSpeedInfo, sldPandoraSpeed->getX() + sldPandoraSpeed->getWidth() + 12, posY); + posY += sldPandoraSpeed->getHeight() + DISTANCE_NEXT_Y; #endif category.panel->add(chkBSDSocket, DISTANCE_BORDER, posY); posY += chkBSDSocket->getHeight() + DISTANCE_NEXT_Y * 2; + category.panel->add(chkMasterWP, DISTANCE_BORDER, posY); + posY += chkMasterWP->getHeight() + DISTANCE_NEXT_Y; + category.panel->add(lblNumLock, DISTANCE_BORDER, posY); category.panel->add(cboKBDLed_num, DISTANCE_BORDER + lblNumLock->getWidth() + 8, posY); @@ -260,10 +311,15 @@ void ExitPanelMisc() delete chkStatusLine; delete chkHideIdleLed; delete chkShowGUI; + + delete chkRetroArchQuit; + delete chkRetroArchMenu; + delete chkRetroArchReset; + //delete chkRetroArchSaveState; #ifdef PANDORA - delete lblPandoraSpeed; - delete sldPandoraSpeed; - delete lblPandoraSpeedInfo; + delete lblPandoraSpeed; + delete sldPandoraSpeed; + delete lblPandoraSpeedInfo; #endif delete chkBSDSocket; delete chkMasterWP; @@ -286,13 +342,18 @@ void RefreshPanelMisc() { chkStatusLine->setSelected(changed_prefs.leds_on_screen); #ifdef PANDORA - chkHideIdleLed->setSelected(changed_prefs.pandora_hide_idle_led); + chkHideIdleLed->setSelected(changed_prefs.pandora_hide_idle_led); #endif chkShowGUI->setSelected(changed_prefs.start_gui); + + chkRetroArchQuit->setSelected(changed_prefs.amiberry_use_retroarch_quit); + chkRetroArchMenu->setSelected(changed_prefs.amiberry_use_retroarch_menu); + chkRetroArchReset->setSelected(changed_prefs.amiberry_use_retroarch_reset); + //chkRetroArchSavestate->setSelected(changed_prefs.amiberry_use_retroarch_statebuttons); #ifdef PANDORA - sldPandoraSpeed->setValue(changed_prefs.pandora_cpu_speed); - snprintf(tmp, 20, "%d MHz", changed_prefs.pandora_cpu_speed); - lblPandoraSpeedInfo->setCaption(tmp); + sldPandoraSpeed->setValue(changed_prefs.pandora_cpu_speed); + snprintf(tmp, 20, "%d MHz", changed_prefs.pandora_cpu_speed); + lblPandoraSpeedInfo->setCaption(tmp); #endif chkBSDSocket->setSelected(changed_prefs.socket_emu); chkMasterWP->setSelected(changed_prefs.floppy_read_only); @@ -307,19 +368,19 @@ void RefreshPanelMisc() bool HelpPanelMisc(std::vector &helptext) { helptext.clear(); - helptext.push_back("\"Status Line\" shows/hides the status line indicator. The first value in the status line"); - helptext.push_back("shows the idle time of the CPU in %, the second value is the current frame rate."); - helptext.push_back("When you have a HDD in your Amiga emulation, the HD indicator shows read (blue) and"); - helptext.push_back("write (red) access to the HDD. The next values are showing the track number for each disk"); - helptext.push_back("drive and indicates disk access."); + helptext.push_back("\"Status Line\" shows/hides the status line indicator. During emulation, you can show/hide this by pressing left"); + helptext.push_back("shoulder and 'd'. The first value in the status line shows the idle time of the Pandora CPU in %, the second value"); + helptext.push_back("is the current frame rate. When you have a HDD in your Amiga emulation, the HD indicator shows read (blue) and"); + helptext.push_back("write (red) access to the HDD. The next values are showing the track number for each disk drive and indicates"); + helptext.push_back("disk access."); helptext.push_back(""); helptext.push_back("When you deactivate the option \"Show GUI on startup\" and use this configuration by specifying it with the"); helptext.push_back("command line parameter \"-config=\", the emulation starts directly without showing the GUI."); helptext.push_back(""); #ifdef PANDORA helptext.push_back("Set the speed for the Pandora CPU to overclock it for games which need more power. Be careful with this"); - helptext.push_back("parameter."); - helptext.push_back(""); + helptext.push_back("parameter."); + helptext.push_back(""); #endif helptext.push_back("\"bsdsocket.library\" enables network functions (i.e. for web browsers in OS3.9)."); helptext.push_back(""); diff --git a/src/osdep/gui/PanelPaths.cpp b/src/osdep/gui/PanelPaths.cpp index 08155e67..18687bff 100644 --- a/src/osdep/gui/PanelPaths.cpp +++ b/src/osdep/gui/PanelPaths.cpp @@ -1,7 +1,14 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "sysconfig.h" @@ -39,7 +46,7 @@ public: if (actionEvent.getSource() == cmdSystemROMs) { - fetch_rompath(tmp, sizeof tmp); + fetch_rompath(tmp, MAX_PATH); if (SelectFolder("Folder for System ROMs", tmp)) { set_rompath(tmp); @@ -50,7 +57,7 @@ public: } else if (actionEvent.getSource() == cmdConfigPath) { - fetch_configurationpath(tmp, sizeof tmp); + fetch_configurationpath(tmp, MAX_PATH); if (SelectFolder("Folder for configuration files", tmp)) { set_configurationpath(tmp); @@ -219,10 +226,10 @@ void RefreshPanelPaths() { char tmp[MAX_PATH]; - fetch_rompath(tmp, sizeof tmp); + fetch_rompath(tmp, MAX_PATH); txtSystemROMs->setText(tmp); - fetch_configurationpath(tmp, sizeof tmp); + fetch_configurationpath(tmp, MAX_PATH); txtConfigPath->setText(tmp); fetch_controllerspath(tmp, MAX_PATH); @@ -235,8 +242,8 @@ void RefreshPanelPaths() bool HelpPanelPaths(std::vector &helptext) { helptext.clear(); - helptext.push_back("Specify the location of your kickstart roms and the folder where the configurations and controller files should be stored."); - helptext.push_back("Use the \"...\" button to open a dialog to choose the folder."); + helptext.push_back("Specify the location of your kickstart roms and the folders where the configurations and controller files should be stored."); + helptext.push_back("With the button \"...\" you can open a dialog to choose the folder."); helptext.push_back(""); helptext.push_back("After changing the location of the kickstart roms, click on \"Rescan\" to refresh the list of the available"); helptext.push_back("ROMs."); diff --git a/src/osdep/gui/PanelQuickstart.cpp b/src/osdep/gui/PanelQuickstart.cpp index 1278ef3d..40abe755 100644 --- a/src/osdep/gui/PanelQuickstart.cpp +++ b/src/osdep/gui/PanelQuickstart.cpp @@ -1,7 +1,14 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" diff --git a/src/osdep/gui/PanelRAM.cpp b/src/osdep/gui/PanelRAM.cpp index 73041ba1..0023f428 100644 --- a/src/osdep/gui/PanelRAM.cpp +++ b/src/osdep/gui/PanelRAM.cpp @@ -1,7 +1,14 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#endif #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -9,20 +16,27 @@ #include "sysconfig.h" #include "sysdeps.h" +#include "config.h" #include "options.h" #include "include/memory.h" +#include "uae.h" +#include "gfxboard.h" #include "gui.h" #include "gui_handling.h" -static const char* ChipMem_list[] = {"512 K", "1 MB", "2 MB", "4 MB", "8 MB"}; -static const int ChipMem_values[] = {0x080000, 0x100000, 0x200000, 0x400000, 0x800000}; -static const char* SlowMem_list[] = {"None", "512 K", "1 MB", "1.5 MB", "1.8 MB"}; -static const int SlowMem_values[] = {0x000000, 0x080000, 0x100000, 0x180000, 0x1c0000}; -static const char* FastMem_list[] = {"None", "1 MB", "2 MB", "4 MB", "8 MB", "16 MB", "32 MB", "64 MB", "128 MB"}; -static const int FastMem_values[] = {0x000000, 0x100000, 0x200000, 0x400000, 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000}; +static const char *ChipMem_list[] = { "512 K", "1 MB", "2 MB", "4 MB", "8 MB" }; +static const int ChipMem_values[] = { 0x080000, 0x100000, 0x200000, 0x400000, 0x800000 }; +static const char *SlowMem_list[] = { "None", "512 K", "1 MB", "1.5 MB", "1.8 MB" }; +static const int SlowMem_values[] = { 0x000000, 0x080000, 0x100000, 0x180000, 0x1c0000 }; +static const char *FastMem_list[] = { "None", "1 MB", "2 MB", "4 MB", "8 MB", "16 MB", "32 MB", "64 MB", "128 MB" }; +static const int FastMem_values[] = { 0x000000, 0x100000, 0x200000, 0x400000, 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000 }; +static const char *A3000LowMem_list[] = { "None", "8 MB", "16 MB" }; +static const int A3000LowMem_values[] = { 0x080000, 0x800000, 0x1000000 }; +static const char *A3000HighMem_list[] = { "None", "8 MB", "16 MB", "32 MB" }; +static const int A3000HighMem_values[] = { 0x080000, 0x800000, 0x1000000, 0x2000000 }; -static gcn::Window* grpRAM; +static gcn::Window *grpRAM; static gcn::Label* lblChipmem; static gcn::Label* lblChipsize; static gcn::Slider* sldChipmem; @@ -38,6 +52,12 @@ static gcn::Slider* sldZ3mem; static gcn::Label* lblGfxmem; static gcn::Label* lblGfxsize; static gcn::Slider* sldGfxmem; +static gcn::Label* lblA3000Lowmem; +static gcn::Label* lblA3000Lowsize; +static gcn::Slider* sldA3000Lowmem; +static gcn::Label* lblA3000Highmem; +static gcn::Label* lblA3000Highsize; +static gcn::Slider* sldA3000Highmem; class MemorySliderActionListener : public gcn::ActionListener @@ -74,7 +94,19 @@ public: if (actionEvent.getSource() == sldGfxmem) { changed_prefs.rtgboards[0].rtgmem_size = FastMem_values[int(sldGfxmem->getValue())]; - changed_prefs.rtgboards[0].rtgmem_type = 1; + changed_prefs.rtgboards[0].rtgmem_type = GFXBOARD_UAE_Z3; + } + + if (actionEvent.getSource() == sldA3000Lowmem) { + changed_prefs.mbresmem_low_size = A3000LowMem_values[(int)(sldA3000Lowmem->getValue())]; + if (currprefs.mbresmem_low_size != changed_prefs.mbresmem_low_size) + DisableResume(); + } + + if (actionEvent.getSource() == sldA3000Highmem) { + changed_prefs.mbresmem_high_size = A3000HighMem_values[(int)(sldA3000Highmem->getValue())]; + if (currprefs.mbresmem_high_size != changed_prefs.mbresmem_high_size) + DisableResume(); } RefreshPanelRAM(); @@ -86,89 +118,128 @@ static MemorySliderActionListener* memorySliderActionListener; void InitPanelRAM(const struct _ConfigCategory& category) { - memorySliderActionListener = new MemorySliderActionListener(); - + memorySliderActionListener = new MemorySliderActionListener(); + int sldWidth; + int markerLength; +#ifdef ANDROID + sldWidth = 150; + markerLength = 30; +#else + sldWidth = 110; + markerLength = 20; +#endif + lblChipmem = new gcn::Label("Chip:"); - sldChipmem = new gcn::Slider(0, 4); - sldChipmem->setSize(110, SLIDER_HEIGHT); - sldChipmem->setBaseColor(gui_baseCol); - sldChipmem->setMarkerLength(20); + sldChipmem = new gcn::Slider(0, 4); + sldChipmem->setSize(sldWidth, SLIDER_HEIGHT); + sldChipmem->setBaseColor(gui_baseCol); + sldChipmem->setMarkerLength(markerLength); sldChipmem->setStepLength(1); sldChipmem->setId("Chipmem"); - sldChipmem->addActionListener(memorySliderActionListener); - lblChipsize = new gcn::Label("None "); + sldChipmem->addActionListener(memorySliderActionListener); + lblChipsize = new gcn::Label("None "); lblSlowmem = new gcn::Label("Slow:"); - sldSlowmem = new gcn::Slider(0, 4); - sldSlowmem->setSize(110, SLIDER_HEIGHT); - sldSlowmem->setBaseColor(gui_baseCol); - sldSlowmem->setMarkerLength(20); + sldSlowmem = new gcn::Slider(0, 4); + sldSlowmem->setSize(sldWidth, SLIDER_HEIGHT); + sldSlowmem->setBaseColor(gui_baseCol); + sldSlowmem->setMarkerLength(markerLength); sldSlowmem->setStepLength(1); sldSlowmem->setId("Slowmem"); - sldSlowmem->addActionListener(memorySliderActionListener); - lblSlowsize = new gcn::Label("None "); + sldSlowmem->addActionListener(memorySliderActionListener); + lblSlowsize = new gcn::Label("None "); - lblFastmem = new gcn::Label("Fast:"); - sldFastmem = new gcn::Slider(0, 4); - sldFastmem->setSize(110, SLIDER_HEIGHT); - sldFastmem->setBaseColor(gui_baseCol); - sldFastmem->setMarkerLength(20); + lblFastmem = new gcn::Label("Z2 Fast:"); + sldFastmem = new gcn::Slider(0, 4); + sldFastmem->setSize(sldWidth, SLIDER_HEIGHT); + sldFastmem->setBaseColor(gui_baseCol); + sldFastmem->setMarkerLength(markerLength); sldFastmem->setStepLength(1); sldFastmem->setId("Fastmem"); - sldFastmem->addActionListener(memorySliderActionListener); - lblFastsize = new gcn::Label("None "); + sldFastmem->addActionListener(memorySliderActionListener); + lblFastsize = new gcn::Label("None "); lblZ3mem = new gcn::Label("Z3 fast:"); - sldZ3mem = new gcn::Slider(0, 8); - sldZ3mem->setSize(110, SLIDER_HEIGHT); - sldZ3mem->setBaseColor(gui_baseCol); - sldZ3mem->setMarkerLength(20); + sldZ3mem = new gcn::Slider(0, 8); + sldZ3mem->setSize(sldWidth, SLIDER_HEIGHT); + sldZ3mem->setBaseColor(gui_baseCol); + sldZ3mem->setMarkerLength(markerLength); sldZ3mem->setStepLength(1); sldZ3mem->setId("Z3mem"); - sldZ3mem->addActionListener(memorySliderActionListener); - lblZ3size = new gcn::Label("None "); - - lblGfxmem = new gcn::Label("RTG:"); - sldGfxmem = new gcn::Slider(0, 5); - sldGfxmem->setSize(110, SLIDER_HEIGHT); - sldGfxmem->setBaseColor(gui_baseCol); - sldGfxmem->setMarkerLength(20); + sldZ3mem->addActionListener(memorySliderActionListener); + lblZ3size = new gcn::Label("None "); + + lblGfxmem = new gcn::Label("RTG board:"); + sldGfxmem = new gcn::Slider(0, 5); + sldGfxmem->setSize(sldWidth, SLIDER_HEIGHT); + sldGfxmem->setBaseColor(gui_baseCol); + sldGfxmem->setMarkerLength(markerLength); sldGfxmem->setStepLength(1); sldGfxmem->setId("Gfxmem"); - sldGfxmem->addActionListener(memorySliderActionListener); - lblGfxsize = new gcn::Label("None "); + sldGfxmem->addActionListener(memorySliderActionListener); + lblGfxsize = new gcn::Label("None "); + + lblA3000Lowmem = new gcn::Label("A4000 Motherb. slot:"); + sldA3000Lowmem = new gcn::Slider(0, 2); + sldA3000Lowmem->setSize(sldWidth, SLIDER_HEIGHT); + sldA3000Lowmem->setBaseColor(gui_baseCol); + sldA3000Lowmem->setMarkerLength(markerLength); + sldA3000Lowmem->setStepLength(1); + sldA3000Lowmem->setId("A3000Low"); + sldA3000Lowmem->addActionListener(memorySliderActionListener); + lblA3000Lowsize = new gcn::Label("None "); + + lblA3000Highmem = new gcn::Label("A4000 Proc. board:"); + sldA3000Highmem = new gcn::Slider(0, 3); + sldA3000Highmem->setSize(sldWidth, SLIDER_HEIGHT); + sldA3000Highmem->setBaseColor(gui_baseCol); + sldA3000Highmem->setMarkerLength(markerLength); + sldA3000Highmem->setStepLength(1); + sldA3000Highmem->setId("A3000High"); + sldA3000Highmem->addActionListener(memorySliderActionListener); + lblA3000Highsize = new gcn::Label("None "); grpRAM = new gcn::Window("Memory Settings"); grpRAM->setPosition(DISTANCE_BORDER, DISTANCE_BORDER); int posY = 10; grpRAM->add(lblChipmem, 8, posY); - grpRAM->add(sldChipmem, 70, posY); - grpRAM->add(lblChipsize, 70 + sldChipmem->getWidth() + 12, posY); + grpRAM->add(sldChipmem, 160, posY); + grpRAM->add(lblChipsize, 160 + sldChipmem->getWidth() + 12, posY); posY += sldChipmem->getHeight() + DISTANCE_NEXT_Y; grpRAM->add(lblSlowmem, 8, posY); - grpRAM->add(sldSlowmem, 70, posY); - grpRAM->add(lblSlowsize, 70 + sldSlowmem->getWidth() + 12, posY); + grpRAM->add(sldSlowmem, 160, posY); + grpRAM->add(lblSlowsize, 160 + sldSlowmem->getWidth() + 12, posY); posY += sldSlowmem->getHeight() + DISTANCE_NEXT_Y; - + grpRAM->add(lblFastmem, 8, posY); - grpRAM->add(sldFastmem, 70, posY); - grpRAM->add(lblFastsize, 70 + sldFastmem->getWidth() + 12, posY); + grpRAM->add(sldFastmem, 160, posY); + grpRAM->add(lblFastsize, 160 + sldFastmem->getWidth() + 12, posY); posY += sldFastmem->getHeight() + DISTANCE_NEXT_Y; grpRAM->add(lblZ3mem, 8, posY); - grpRAM->add(sldZ3mem, 70, posY); - grpRAM->add(lblZ3size, 70 + sldZ3mem->getWidth() + 12, posY); + grpRAM->add(sldZ3mem, 160, posY); + grpRAM->add(lblZ3size, 160 + sldZ3mem->getWidth() + 12, posY); posY += sldZ3mem->getHeight() + DISTANCE_NEXT_Y; -#ifdef PICASSO96 + grpRAM->add(lblGfxmem, 8, posY); - grpRAM->add(sldGfxmem, 70, posY); - grpRAM->add(lblGfxsize, 70 + sldGfxmem->getWidth() + 12, posY); + grpRAM->add(sldGfxmem, 160, posY); + grpRAM->add(lblGfxsize, 160 + sldGfxmem->getWidth() + 12, posY); posY += sldGfxmem->getHeight() + DISTANCE_NEXT_Y; -#endif + + grpRAM->add(lblA3000Lowmem, 8, posY); + grpRAM->add(sldA3000Lowmem, 160, posY); + grpRAM->add(lblA3000Lowsize, 160 + sldA3000Lowmem->getWidth() + 12, posY); + posY += sldA3000Lowmem->getHeight() + DISTANCE_NEXT_Y; + + grpRAM->add(lblA3000Highmem, 8, posY); + grpRAM->add(sldA3000Highmem, 160, posY); + grpRAM->add(lblA3000Highsize, 160 + sldA3000Highmem->getWidth() + 12, posY); + posY += sldA3000Highmem->getHeight() + DISTANCE_NEXT_Y; + grpRAM->setMovable(false); - grpRAM->setSize(250, posY + DISTANCE_BORDER); + grpRAM->setSize(350, posY + DISTANCE_BORDER); grpRAM->setBaseColor(gui_baseCol); category.panel->add(grpRAM); @@ -194,6 +265,12 @@ void ExitPanelRAM() delete lblGfxmem; delete sldGfxmem; delete lblGfxsize; + delete lblA3000Lowmem; + delete sldA3000Lowmem; + delete lblA3000Lowsize; + delete lblA3000Highmem; + delete sldA3000Highmem; + delete lblA3000Highsize; delete grpRAM; delete memorySliderActionListener; } @@ -223,7 +300,7 @@ void RefreshPanelRAM() } } - for (i = 0; i < 5; ++i) + for (i = 0; i<5; ++i) { if (changed_prefs.fastmem[0].size == FastMem_values[i]) { @@ -233,7 +310,7 @@ void RefreshPanelRAM() } } - for (i = 0; i < 9; ++i) + for (i = 0; i<9; ++i) { if (changed_prefs.z3fastmem[0].size == FastMem_values[i]) { @@ -244,7 +321,7 @@ void RefreshPanelRAM() } sldZ3mem->setEnabled(!changed_prefs.address_space_24); - for (i = 0; i < 6; ++i) + for (i = 0; i<6; ++i) { if (changed_prefs.rtgboards[0].rtgmem_size == FastMem_values[i]) { @@ -254,4 +331,39 @@ void RefreshPanelRAM() } } sldGfxmem->setEnabled(!changed_prefs.address_space_24); + + for (i = 0; i<3; ++i) + { + if (changed_prefs.mbresmem_low_size == A3000LowMem_values[i]) + { + sldA3000Lowmem->setValue(i); + lblA3000Lowsize->setCaption(A3000LowMem_list[i]); + break; + } + } + + for (i = 0; i<4; ++i) + { + if (changed_prefs.mbresmem_high_size == A3000HighMem_values[i]) + { + sldA3000Highmem->setValue(i); + lblA3000Highsize->setCaption(A3000HighMem_list[i]); + break; + } + } +} + + +bool HelpPanelRAM(std::vector &helptext) +{ + helptext.clear(); + helptext.push_back("Select the amount of RAM for each type you want to emulate in your Amiga."); + helptext.push_back("\"Slow\" is the simple memory extension of an Amiga 500."); + helptext.push_back("\"Z2 Fast\" is real fast memory in 24 bit address space."); + helptext.push_back("\"Z3 Fast\" is real fast memory in 32 bit address space and only available if a 32 bit CPU is selected."); + helptext.push_back("\"RTG board\" is the graphics memory used by Picasso96 and only available if a 32 bit CPU is selected. If you"); + helptext.push_back("select some memory for this type, the Z3 RTG board will be activated."); + helptext.push_back("A4000 motherboard and processor board memory is only detected by the Amiga if you choose the correct"); + helptext.push_back("Kickstart ROM (A4000)."); + return true; } diff --git a/src/osdep/gui/PanelROM.cpp b/src/osdep/gui/PanelROM.cpp index 71acdccf..d3b3a487 100644 --- a/src/osdep/gui/PanelROM.cpp +++ b/src/osdep/gui/PanelROM.cpp @@ -1,7 +1,14 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" diff --git a/src/osdep/gui/PanelSavestate.cpp b/src/osdep/gui/PanelSavestate.cpp index 8fe4d481..4c5a0b7d 100644 --- a/src/osdep/gui/PanelSavestate.cpp +++ b/src/osdep/gui/PanelSavestate.cpp @@ -1,8 +1,16 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeCheckBox.hpp" @@ -254,9 +262,12 @@ void RefreshPanelSavestate() bool HelpPanelSavestate(std::vector &helptext) { - helptext.clear(); - helptext.push_back("Savestates are stored with the name of the disk in drive DF0 attached with the selected number."); - helptext.push_back(""); - helptext.push_back("Note: Savestates will not work with HDDs."); - return true; + helptext.clear(); + helptext.push_back("Savestates are stored with the name of the disk in drive DF0 attached with the selected number."); + helptext.push_back(""); + helptext.push_back("When you hold left shoulder button and press 'l' during emulation, the state of the last active number will be"); + helptext.push_back("loaded. Hold left shoulder button and press 's' to save the current state in the last active slot."); + helptext.push_back(""); + helptext.push_back("Note: Savestates will not work with HDDs."); + return true; } diff --git a/src/osdep/gui/PanelSound.cpp b/src/osdep/gui/PanelSound.cpp index 42134783..af055676 100644 --- a/src/osdep/gui/PanelSound.cpp +++ b/src/osdep/gui/PanelSound.cpp @@ -1,7 +1,14 @@ +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeCheckBox.hpp" @@ -287,8 +294,15 @@ void InitPanelSound(const struct _ConfigCategory& category) grpMode->setSize(90, 90); grpMode->setBaseColor(gui_baseCol); + int labelWidth; +#ifdef ANDROID + labelWidth = 135; +#else + labelWidth = 130; +#endif + lblInterpolation = new gcn::Label("Interpolation:"); - lblInterpolation->setSize(130, LABEL_HEIGHT); + lblInterpolation->setSize(labelWidth, LABEL_HEIGHT); lblInterpolation->setAlignment(gcn::Graphics::RIGHT); cboInterpolation = new gcn::UaeDropDown(&interpolationTypeList); cboInterpolation->setSize(160, DROPDOWN_HEIGHT); @@ -298,7 +312,7 @@ void InitPanelSound(const struct _ConfigCategory& category) cboInterpolation->addActionListener(soundActionListener); lblFilter = new gcn::Label("Filter:"); - lblFilter->setSize(130, LABEL_HEIGHT); + lblFilter->setSize(labelWidth, LABEL_HEIGHT); lblFilter->setAlignment(gcn::Graphics::RIGHT); cboFilter = new gcn::UaeDropDown(&filterTypeList); cboFilter->setSize(160, DROPDOWN_HEIGHT); @@ -308,7 +322,7 @@ void InitPanelSound(const struct _ConfigCategory& category) cboFilter->addActionListener(soundActionListener); lblSeparation = new gcn::Label("Stereo separation:"); - lblSeparation->setSize(130, LABEL_HEIGHT); + lblSeparation->setSize(labelWidth, LABEL_HEIGHT); lblSeparation->setAlignment(gcn::Graphics::RIGHT); sldSeparation = new gcn::Slider(0, 10); sldSeparation->setSize(160, SLIDER_HEIGHT); @@ -320,7 +334,7 @@ void InitPanelSound(const struct _ConfigCategory& category) lblSeparationInfo = new gcn::Label("100%"); lblStereoDelay = new gcn::Label("Stereo delay:"); - lblStereoDelay->setSize(130, LABEL_HEIGHT); + lblStereoDelay->setSize(labelWidth, LABEL_HEIGHT); lblStereoDelay->setAlignment(gcn::Graphics::RIGHT); sldStereoDelay = new gcn::Slider(0, 10); sldStereoDelay->setSize(160, SLIDER_HEIGHT); diff --git a/src/osdep/gui/SelectFile.cpp b/src/osdep/gui/SelectFile.cpp index eb095bea..4115b8f6 100644 --- a/src/osdep/gui/SelectFile.cpp +++ b/src/osdep/gui/SelectFile.cpp @@ -1,10 +1,17 @@ #include -#include #include #include +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 +#include #include #include #include +#endif #include "SelectorEntry.hpp" #include "sysconfig.h" @@ -24,7 +31,7 @@ #define DIALOG_WIDTH 520 #define DIALOG_HEIGHT 400 -#if defined(AMIBERRY) || defined(ANDROID) +#if defined(ANDROID) #define FILE_SELECT_KEEP_POSITION #endif @@ -228,7 +235,11 @@ static void InitSelectFile(const char* title) lstFiles->addActionListener(selectFileActionListener); scrAreaFiles = new gcn::ScrollArea(lstFiles); +#ifdef USE_SDL1 + scrAreaFiles->setFrameSize(1); +#elif USE_SDL2 scrAreaFiles->setBorderSize(1); +#endif scrAreaFiles->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10); scrAreaFiles->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272); scrAreaFiles->setScrollbarWidth(20); diff --git a/src/osdep/gui/SelectFolder.cpp b/src/osdep/gui/SelectFolder.cpp index 8bf07cdb..ca57f7d9 100644 --- a/src/osdep/gui/SelectFolder.cpp +++ b/src/osdep/gui/SelectFolder.cpp @@ -1,10 +1,18 @@ #include -#include + #include #include +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 +#include #include #include #include +#endif #include "SelectorEntry.hpp" #include "sysconfig.h" @@ -89,7 +97,7 @@ static DirListModel dirList("."); static void checkfoldername(char* current) { - char actualpath[PATH_MAX]; + char actualpath [MAX_PATH]; DIR* dir; if ((dir = opendir(current))) diff --git a/src/osdep/gui/SelectorEntry.cpp b/src/osdep/gui/SelectorEntry.cpp index 1f4db9cd..7bcbabca 100644 --- a/src/osdep/gui/SelectorEntry.cpp +++ b/src/osdep/gui/SelectorEntry.cpp @@ -1,9 +1,15 @@ #include "osdep/gui/SelectorEntry.hpp" +#ifdef USE_SDL1 +#include "guichan/widgets/container.hpp" +#include "guichan/widgets/icon.hpp" +#include "guichan/widgets/label.hpp" + +#elif USE_SDL2 #include "guisan/widgets/container.hpp" #include "guisan/widgets/icon.hpp" #include "guisan/widgets/label.hpp" - +#endif namespace gcn { diff --git a/src/osdep/gui/SelectorEntry.hpp b/src/osdep/gui/SelectorEntry.hpp index 3f19e4f7..693622a0 100644 --- a/src/osdep/gui/SelectorEntry.hpp +++ b/src/osdep/gui/SelectorEntry.hpp @@ -1,9 +1,16 @@ #ifndef GCN_SELECTORENTRY_HPP #define GCN_SELECTORENTRY_HPP +#ifdef USE_SDL1 +#include "guichan/basiccontainer.hpp" +#include "guichan/graphics.hpp" +#include "guichan/platform.hpp" +#include "guichan/widgetlistener.hpp" +#elif USE_SDL2 #include #include #include +#endif #include namespace gcn diff --git a/src/osdep/gui/ShowHelp.cpp b/src/osdep/gui/ShowHelp.cpp index 8d34538a..03a3b680 100644 --- a/src/osdep/gui/ShowHelp.cpp +++ b/src/osdep/gui/ShowHelp.cpp @@ -1,10 +1,16 @@ #include -#include #include #include +#ifdef USE_SDL1 +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 +#include #include #include #include +#endif #include "SelectorEntry.hpp" #include "sysconfig.h" @@ -94,7 +100,11 @@ static void InitShowHelp(const vector& helptext) lstHelp->setWrappingEnabled(true); scrAreaHelp = new gcn::ScrollArea(lstHelp); +#ifdef USE_SDL1 + scrAreaHelp->setFrameSize(1); +#elif USE_SDL2 scrAreaHelp->setBorderSize(1); +#endif scrAreaHelp->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10); scrAreaHelp->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, DIALOG_HEIGHT - 3 * DISTANCE_BORDER - BUTTON_HEIGHT - DISTANCE_NEXT_Y - 10); diff --git a/src/osdep/gui/ShowMessage.cpp b/src/osdep/gui/ShowMessage.cpp index b6d4378f..a2c76cf6 100644 --- a/src/osdep/gui/ShowMessage.cpp +++ b/src/osdep/gui/ShowMessage.cpp @@ -1,10 +1,18 @@ #include -#include + #include #include +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 +#include #include #include #include +#endif #include "SelectorEntry.hpp" #include "sysconfig.h" diff --git a/src/osdep/gui/UaeCheckBox.cpp b/src/osdep/gui/UaeCheckBox.cpp index 3650197b..702b86d0 100644 --- a/src/osdep/gui/UaeCheckBox.cpp +++ b/src/osdep/gui/UaeCheckBox.cpp @@ -1,7 +1,15 @@ #include "UaeCheckBox.hpp" +#ifdef USE_SDL1 +#include "guichan/widgets/checkbox.hpp" + +#include "guichan/font.hpp" +#include "guichan/graphics.hpp" +#include "guichan/key.hpp" +#include "guichan/mouseinput.hpp" +#elif USE_SDL2 #include #include - +#endif namespace gcn { diff --git a/src/osdep/gui/UaeCheckBox.hpp b/src/osdep/gui/UaeCheckBox.hpp index d31a53af..cc12f89d 100644 --- a/src/osdep/gui/UaeCheckBox.hpp +++ b/src/osdep/gui/UaeCheckBox.hpp @@ -4,10 +4,17 @@ #include #include +#ifdef USE_SDL1 +#include "guichan/keylistener.hpp" +#include "guichan/mouselistener.hpp" +#include "guichan/platform.hpp" +#include "guichan/widget.hpp" +#include "guichan/widgets/checkbox.hpp" +#elif USE_SDL2 #include #include #include - +#endif namespace gcn { diff --git a/src/osdep/gui/UaeDropDown.cpp b/src/osdep/gui/UaeDropDown.cpp index 623fd192..1446043b 100644 --- a/src/osdep/gui/UaeDropDown.cpp +++ b/src/osdep/gui/UaeDropDown.cpp @@ -1,6 +1,15 @@ #include "UaeDropDown.hpp" +#ifdef USE_SDL1 +#include "guichan/widgets/dropdown.hpp" + +#include "guichan/font.hpp" +#include "guichan/graphics.hpp" +#include "guichan/key.hpp" +#include "guichan/mouseinput.hpp" +#elif USE_SDL2 #include #include +#endif namespace gcn { @@ -35,13 +44,21 @@ namespace gcn { setSelected(getSelected() - 1); keyEvent.consume(); +#ifdef USE_SDL1 + distributeActionEvent(); +#elif USE_SDL2 distributeValueChangedEvent(); +#endif } else if (key.getValue() == Key::DOWN) { setSelected(getSelected() + 1); keyEvent.consume(); +#ifdef USE_SDL1 + distributeActionEvent(); +#elif USE_SDL2 distributeValueChangedEvent(); +#endif } } diff --git a/src/osdep/gui/UaeDropDown.hpp b/src/osdep/gui/UaeDropDown.hpp index ac89b101..f8e9ae0f 100644 --- a/src/osdep/gui/UaeDropDown.hpp +++ b/src/osdep/gui/UaeDropDown.hpp @@ -1,12 +1,21 @@ #ifndef GCN_UAEDROPDOWN_HPP #define GCN_UAEDROPDOWN_HPP -#include - +#ifdef USE_SDL1 +#include +#include "guichan/keylistener.hpp" +#include "guichan/mouselistener.hpp" +#include "guichan/platform.hpp" +#include "guichan/widget.hpp" +#include "guichan/widgets/dropdown.hpp" +#elif USE_SDL2 #include #include #include #include +#endif + +#include namespace gcn diff --git a/src/osdep/gui/UaeListBox.cpp b/src/osdep/gui/UaeListBox.cpp index 9cbbc150..44c832ea 100644 --- a/src/osdep/gui/UaeListBox.cpp +++ b/src/osdep/gui/UaeListBox.cpp @@ -1,9 +1,21 @@ #include "UaeListBox.hpp" +#ifdef USE_SDL1 +#include "guichan/widgets/listbox.hpp" + +#include "guichan/basiccontainer.hpp" +#include "guichan/font.hpp" +#include "guichan/graphics.hpp" +#include "guichan/key.hpp" +#include "guichan/listmodel.hpp" +#include "guichan/mouseinput.hpp" +#include "guichan/selectionlistener.hpp" +#elif USE_SDL2 #include #include #include #include #include +#endif namespace gcn { @@ -40,7 +52,11 @@ namespace gcn // Check the current clip area so we don't draw unnecessary items // that are not visible. const ClipRectangle currentClipArea = graphics->getCurrentClipArea(); +#ifdef USE_SDL1 + int rowHeight = getRowHeight(); +#elif USE_SDL2 const int rowHeight = getFont()->getHeight(); +#endif // Calculate the number of rows to draw by checking the clip area. // The addition of two makes covers a partial visible row at the top diff --git a/src/osdep/gui/UaeListBox.hpp b/src/osdep/gui/UaeListBox.hpp index 2b97418b..0c5fee0b 100644 --- a/src/osdep/gui/UaeListBox.hpp +++ b/src/osdep/gui/UaeListBox.hpp @@ -3,11 +3,19 @@ #include +#ifdef USE_SDL1 +#include "guichan/keylistener.hpp" +#include "guichan/listmodel.hpp" +#include "guichan/mouselistener.hpp" +#include "guichan/platform.hpp" +#include "guichan/widget.hpp" +#include "guichan/widgets/listbox.hpp" +#elif USE_SDL2 #include #include #include #include - +#endif namespace gcn { diff --git a/src/osdep/gui/UaeRadioButton.cpp b/src/osdep/gui/UaeRadioButton.cpp index bfcef6c5..4973e91a 100644 --- a/src/osdep/gui/UaeRadioButton.cpp +++ b/src/osdep/gui/UaeRadioButton.cpp @@ -1,6 +1,15 @@ #include "UaeRadioButton.hpp" +#ifdef USE_SDL1 +#include "guichan/widgets/radiobutton.hpp" + +#include "guichan/font.hpp" +#include "guichan/graphics.hpp" +#include "guichan/key.hpp" +#include "guichan/mouseinput.hpp" +#elif USE_SDL2 #include #include +#endif namespace gcn { diff --git a/src/osdep/gui/UaeRadioButton.hpp b/src/osdep/gui/UaeRadioButton.hpp index 88bbe4a3..f1b47318 100644 --- a/src/osdep/gui/UaeRadioButton.hpp +++ b/src/osdep/gui/UaeRadioButton.hpp @@ -4,9 +4,17 @@ #include #include +#ifdef USE_SDL1 +#include "guichan/keylistener.hpp" +#include "guichan/mouselistener.hpp" +#include "guichan/platform.hpp" +#include "guichan/widget.hpp" +#include "guichan/widgets/radiobutton.hpp" +#elif USE_SDL2 #include #include #include +#endif namespace gcn diff --git a/src/osdep/gui/gui_handling.h b/src/osdep/gui/gui_handling.h index 0660c3f0..4e1cb9d7 100644 --- a/src/osdep/gui/gui_handling.h +++ b/src/osdep/gui/gui_handling.h @@ -17,7 +17,9 @@ #define DROPDOWN_HEIGHT 15 #define SLIDER_HEIGHT 18 #define TITLEBAR_HEIGHT 24 +#ifdef USE_SDL2 #include +#endif typedef struct _ConfigCategory { diff --git a/src/osdep/gui/main_window.cpp b/src/osdep/gui/main_window.cpp index cd3e93b2..65b145a6 100644 --- a/src/osdep/gui/main_window.cpp +++ b/src/osdep/gui/main_window.cpp @@ -1,8 +1,15 @@ #include +#ifdef USE_SDL1 +#include +#include +#include +#include "sdltruetypefont.hpp" +#elif USE_SDL2 #include #include #include #include +#endif #include "SelectorEntry.hpp" #include "sysconfig.h" @@ -96,10 +103,12 @@ enum * SDL Stuff we need */ SDL_Surface* gui_screen; -SDL_Texture* gui_texture; SDL_Event gui_event; +#ifdef USE_SDL2 +SDL_Texture* gui_texture; SDL_Cursor* cursor; SDL_Surface* cursorSurface; +#endif /* * Guisan SDL stuff we need @@ -214,16 +223,22 @@ static void ShowHelpRequested() void UpdateGuiScreen() { +#ifdef USE_SDL1 + wait_for_vsync(); + SDL_Flip(gui_screen); +#elif USE_SDL2 // Update the texture from the surface SDL_UpdateTexture(gui_texture, nullptr, gui_screen->pixels, gui_screen->pitch); // Copy the texture on the renderer SDL_RenderCopy(renderer, gui_texture, nullptr, nullptr); // Update the window surface (show the renderer) SDL_RenderPresent(renderer); +#endif } namespace sdl { +#ifdef USE_SDL2 // Sets the cursor image up void setup_cursor() { @@ -257,12 +272,30 @@ namespace sdl SDL_SetCursor(cursor); } +#endif void gui_init() { +#ifdef USE_SDL1 + //------------------------------------------------- + // Set layer for GUI screen + //------------------------------------------------- + char tmp[20]; + snprintf(tmp, 20, "%dx%d", GUI_WIDTH, GUI_HEIGHT); + setenv("SDL_OMAP_LAYER_SIZE", tmp, 1); + snprintf(tmp, 20, "0,0,0,0"); + setenv("SDL_OMAP_BORDER_CUT", tmp, 1); +#endif //------------------------------------------------- // Create new screen for GUI //------------------------------------------------- +#ifdef USE_SDL1 + const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo(); + gui_screen = SDL_SetVideoMode(GUI_WIDTH, GUI_HEIGHT, 16, SDL_SWSURFACE | SDL_FULLSCREEN); + SDL_EnableUNICODE(1); + SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); +#endif +#ifdef USE_SDL2 setup_cursor(); // make the scaled rendering look smoother (linear scaling). @@ -275,20 +308,21 @@ namespace sdl gui_texture = SDL_CreateTextureFromSurface(renderer, gui_screen); check_error_sdl(gui_texture == nullptr, "Unable to create texture"); - +#endif #ifdef ANDROIDSDL // Enable Android multitouch SDL_InitSubSystem(SDL_INIT_JOYSTICK); SDL_JoystickOpen(0); #endif - +#ifdef USE_SDL2 if (cursor) { SDL_ShowCursor(SDL_ENABLE); } +#endif //------------------------------------------------- - // Create helpers for guisan + // Create helpers for GUI framework //------------------------------------------------- gui_imageLoader = new gcn::SDLImageLoader(); // The ImageLoader in use is static and must be set to be @@ -312,6 +346,10 @@ namespace sdl delete gui_input; delete gui_graphics; +#ifdef USE_SDL1 + if (gui_screen != nullptr) + SDL_FreeSurface(gui_screen); +#elif USE_SDL2 SDL_FreeSurface(gui_screen); SDL_DestroyTexture(gui_texture); @@ -327,6 +365,7 @@ namespace sdl SDL_FreeSurface(cursorSurface); cursorSurface = nullptr; } +#endif gui_screen = nullptr; } @@ -737,7 +776,11 @@ namespace widgets selectors = new gcn::Container(); selectors->setSize(150, workAreaHeight - 2); selectors->setBaseColor(colSelectorInactive); +#ifdef USE_SDL1 + selectors->setFrameSize(1); +#elif USE_SDL2 selectors->setBorderSize(1); +#endif int panelStartX = DISTANCE_BORDER + selectors->getWidth() + 2 + 11; panelFocusListener = new PanelFocusListener(); @@ -753,7 +796,11 @@ namespace widgets categories[i].panel->setId(categories[i].category); categories[i].panel->setSize(GUI_WIDTH - panelStartX - DISTANCE_BORDER - 1, workAreaHeight - 2); categories[i].panel->setBaseColor(gui_baseCol); +#ifdef USE_SDL1 + categories[i].panel->setFrameSize(1); +#elif USE_SDLL2 categories[i].panel->setBorderSize(1); +#endif categories[i].panel->setVisible(false); } @@ -879,7 +926,7 @@ void run_gui() #endif } - // Catch all guisan exceptions. + // Catch all GUI framework exceptions. catch (gcn::Exception e) { cout << e.getMessage() << endl; diff --git a/src/osdep/keyboard.cpp b/src/osdep/keyboard.cpp index 15a9fa10..ee3c8f81 100644 --- a/src/osdep/keyboard.cpp +++ b/src/osdep/keyboard.cpp @@ -395,7 +395,7 @@ void translate_amiberry_keys(int scancode, int newstate) inputdevice_translatekeycode(0, translatedScancode, newstate); } -int target_checkcapslock(int scancode, int *state) +int target_checkcapslock(const int scancode, int *state) { if (scancode != SDLK_CAPSLOCK && scancode != SDLK_NUMLOCKCLEAR && scancode != SDLK_SCROLLLOCK) return 0; diff --git a/src/osdep/picasso96.cpp b/src/osdep/picasso96.cpp index dacbb2cc..345c9de8 100644 --- a/src/osdep/picasso96.cpp +++ b/src/osdep/picasso96.cpp @@ -30,63 +30,70 @@ * programs started from a Picasso workbench. */ +/* + * Note: This is the Pandora specific version of Picasso96: + * - only 16 bit color mode is available (R5G6B5) in hardware + * - we simulate R8G8B8A8 on Amiga side and use Neon-code to convert to R5G6B5 + * - we have no hardware sprite for mouse pointer + * I removed some code which handled unsupported modes and formats to make code + * easier to read. + */ + #include "sysconfig.h" #include "sysdeps.h" #if defined(PICASSO96) -#define MULTIDISPLAY 0 -#define WINCURSOR 1 #define NEWTRAP 1 -#define USE_HARDWARESPRITE 1 #define P96TRACING_ENABLED 0 #define P96TRACING_SETUP_ENABLED 0 -#define P96SPRTRACING_ENABLED 0 +#include "config.h" #include "options.h" #include "threaddep/thread.h" #include "include/memory.h" #include "custom.h" -#include "events.h" #include "newcpu.h" #include "xwin.h" #include "savestate.h" #include "autoconf.h" #include "traps.h" #include "native2amiga.h" -#include "drawing.h" -#include "inputdevice.h" - -#include "amiberry_gfx.h" #include "picasso96.h" -#include "SDL.h" +#include #define NOBLITTER 0 #define NOBLITTER_BLIT 0 #define NOBLITTER_ALL 0 -static int hwsprite = 0; +#ifdef AMIBERRY +static const int defaultHz = 50; +#else +static const int defaultHz = 60; +#endif + static int picasso96_BT = BT_uaegfx; static int picasso96_GCT = GCT_Unknown; static int picasso96_PCT = PCT_Unknown; -int p96refresh_active; bool have_done_picasso = true; /* For the JIT compiler */ static int p96syncrate; -int p96hsync_counter, full_refresh; +int p96hsync_counter; #define PICASSO_STATE_SETDISPLAY 1 #define PICASSO_STATE_SETPANNING 2 #define PICASSO_STATE_SETGC 4 #define PICASSO_STATE_SETDAC 8 #define PICASSO_STATE_SETSWITCH 16 +static uae_atomic picasso_state_change; #ifdef PICASSO96 #ifdef DEBUG // Change this to _DEBUG for debugging #define P96TRACING_ENABLED 1 #define P96TRACING_LEVEL 1 #endif +static void flushpixels(); #if P96TRACING_ENABLED #define P96TRACE(x) do { write_log x; } while(0) #else @@ -97,45 +104,28 @@ int p96hsync_counter, full_refresh; #else #define P96TRACE_SETUP(x) #endif -#if P96SPRTRACING_ENABLED -#define P96TRACE_SPR(x) do { write_log x; } while(0) -#else -#define P96TRACE_SPR(x) -#endif -#define P96TRACE2(x) do { write_log x; } while(0) static uae_u8 all_ones_bitmap, all_zeros_bitmap; /* yuk */ struct picasso96_state_struct picasso96_state; -static struct picasso96_state_struct picasso96_state_uaegfx; +#define picasso96_state_uaegfx picasso96_state struct picasso_vidbuf_description picasso_vidinfo; -static struct PicassoResolution *newmodes; +static struct PicassoResolution* newmodes = nullptr; static int picasso_convert, host_mode; -/* These are the maximum resolutions... They are filled in by GetSupportedResolutions() - have to fill this in, otherwise problems occur on the Amiga side P96 s/w which expects - data here. */ +/* These are the maximum resolutions... They are filled in by GetSupportedResolutions() */ +/* have to fill this in, otherwise problems occur on the Amiga side P96 s/w which expects +/* data here. */ static struct ScreenResolution planar = { 320, 240 }; static struct ScreenResolution chunky = { 640, 480 }; static struct ScreenResolution hicolour = { 640, 480 }; static struct ScreenResolution truecolour = { 640, 480 }; static struct ScreenResolution alphacolour = { 640, 480 }; -uae_u32 p96_rgbx16[65536]; -uae_u32 p96rc[256], p96gc[256], p96bc[256]; - -static int cursorwidth, cursorheight, cursorok; -static uae_u8 *cursordata; -static uae_u32 cursorrgb[4], cursorrgbn[4]; -static int cursordeactivate, setupcursor_needed; -static bool cursorvisible; -//static HCURSOR wincursor; -static int wincursor_shown; static uaecptr boardinfo, ABI_interrupt; static int interrupt_enabled; -double p96vblank; -static int rtg_clear_flag; +float p96vblank; static bool picasso_active; static bool picasso_changed; @@ -175,48 +165,8 @@ static uaecptr oldscr = 0; extern addrbank gfxmem_bank; extern addrbank *gfxmem_banks[MAX_RTG_BOARDS]; -extern int rtg_index; -#define UAE_RTG_LIBRARY_VERSION 40 -#define UAE_RTG_LIBRARY_REVISION 3994 - -//static void checkrtglibrary() -//{ -// uae_u32 v; -// static int checked = FALSE; -// -// if (checked) -// return; -// v = get_long(4); // execbase -// v += 378; // liblist -// while ((v = get_long(v))) -// { -// uae_u32 v2 = get_long(v + 10); // name -// uae_u8* p; -// addrbank* b = &get_mem_bank(v2); -// if (!b || !b->check(v2, 12)) -// continue; -// p = b->xlateaddr(v2); -// if (!memcmp(p, "rtg.library\0", 12)) -// { -// uae_u16 ver = get_word(v + 20); -// uae_u16 rev = get_word(v + 22); -// if (ver * 10000 + rev < UAE_RTG_LIBRARY_VERSION * 10000 + UAE_RTG_LIBRARY_REVISION) -// { -// TCHAR msg[2000]; -// sprintf(msg, _T("installed rtg.library: %d.%d, required: %d.%d\n"), ver, rev, UAE_RTG_LIBRARY_VERSION, UAE_RTG_LIBRARY_REVISION); -// gui_message(msg); -// } -// else -// { -// write_log(_T("P96: rtg.library %d.%d detected\n"), ver, rev); -// } -// checked = TRUE; -// } -// } -//} - -STATIC_INLINE void endianswap(uae_u32* vp, int bpp) +STATIC_INLINE void endianswap(uae_u32 *vp, int bpp) { uae_u32 v = *vp; switch (bpp) @@ -234,113 +184,110 @@ STATIC_INLINE void endianswap(uae_u32* vp, int bpp) /* * Debugging dumps */ -static void DumpModeInfoStructure(uaecptr amigamodeinfoptr) +static void DumpModeInfoStructure(TrapContext *ctx, uaecptr amigamodeinfoptr) { write_log (_T("ModeInfo Structure Dump:\n")); - write_log (_T(" Node.ln_Succ = 0x%x\n"), get_long (amigamodeinfoptr)); - write_log (_T(" Node.ln_Pred = 0x%x\n"), get_long (amigamodeinfoptr + 4)); - write_log (_T(" Node.ln_Type = 0x%x\n"), get_byte (amigamodeinfoptr + 8)); - write_log (_T(" Node.ln_Pri = %d\n"), get_byte (amigamodeinfoptr + 9)); -/*write_log (_T(" Node.ln_Name = %s\n"), uaememptr->Node.ln_Name); */ - write_log (_T(" OpenCount = %d\n"), get_word (amigamodeinfoptr + PSSO_ModeInfo_OpenCount)); - write_log (_T(" Active = %d\n"), get_byte (amigamodeinfoptr + PSSO_ModeInfo_Active)); - write_log (_T(" Width = %d\n"), get_word (amigamodeinfoptr + PSSO_ModeInfo_Width)); - write_log (_T(" Height = %d\n"), get_word (amigamodeinfoptr + PSSO_ModeInfo_Height)); - write_log (_T(" Depth = %d\n"), get_byte (amigamodeinfoptr + PSSO_ModeInfo_Depth)); - write_log (_T(" Flags = %d\n"), get_byte (amigamodeinfoptr + PSSO_ModeInfo_Flags)); - write_log (_T(" HorTotal = %d\n"), get_word (amigamodeinfoptr + PSSO_ModeInfo_HorTotal)); - write_log (_T(" HorBlankSize = %d\n"), get_word (amigamodeinfoptr + PSSO_ModeInfo_HorBlankSize)); - write_log (_T(" HorSyncStart = %d\n"), get_word (amigamodeinfoptr + PSSO_ModeInfo_HorSyncStart)); - write_log (_T(" HorSyncSize = %d\n"), get_word (amigamodeinfoptr + PSSO_ModeInfo_HorSyncSize)); - write_log (_T(" HorSyncSkew = %d\n"), get_byte (amigamodeinfoptr + PSSO_ModeInfo_HorSyncSkew)); - write_log (_T(" HorEnableSkew = %d\n"), get_byte (amigamodeinfoptr + PSSO_ModeInfo_HorEnableSkew)); - write_log (_T(" VerTotal = %d\n"), get_word (amigamodeinfoptr + PSSO_ModeInfo_VerTotal)); - write_log (_T(" VerBlankSize = %d\n"), get_word (amigamodeinfoptr + PSSO_ModeInfo_VerBlankSize)); - write_log (_T(" VerSyncStart = %d\n"), get_word (amigamodeinfoptr + PSSO_ModeInfo_VerSyncStart)); - write_log (_T(" VerSyncSize = %d\n"), get_word (amigamodeinfoptr + PSSO_ModeInfo_VerSyncSize)); - write_log (_T(" Clock = %d\n"), get_byte (amigamodeinfoptr + PSSO_ModeInfo_first_union)); - write_log (_T(" ClockDivide = %d\n"), get_byte (amigamodeinfoptr + PSSO_ModeInfo_second_union)); - write_log (_T(" PixelClock = %d\n"), get_long (amigamodeinfoptr + PSSO_ModeInfo_PixelClock)); + write_log (_T(" Node.ln_Succ = 0x%x\n"), trap_get_long(ctx, amigamodeinfoptr)); + write_log (_T(" Node.ln_Pred = 0x%x\n"), trap_get_long(ctx, amigamodeinfoptr + 4)); + write_log (_T(" Node.ln_Type = 0x%x\n"), trap_get_byte(ctx, amigamodeinfoptr + 8)); + write_log (_T(" Node.ln_Pri = %d\n"), trap_get_byte(ctx, amigamodeinfoptr + 9)); + /*write_log (_T(" Node.ln_Name = %s\n"), uaememptr->Node.ln_Name); */ + write_log (_T(" OpenCount = %d\n"), trap_get_word(ctx, amigamodeinfoptr + PSSO_ModeInfo_OpenCount)); + write_log (_T(" Active = %d\n"), trap_get_byte(ctx, amigamodeinfoptr + PSSO_ModeInfo_Active)); + write_log (_T(" Width = %d\n"), trap_get_word(ctx, amigamodeinfoptr + PSSO_ModeInfo_Width)); + write_log (_T(" Height = %d\n"), trap_get_word(ctx, amigamodeinfoptr + PSSO_ModeInfo_Height)); + write_log (_T(" Depth = %d\n"), trap_get_byte(ctx, amigamodeinfoptr + PSSO_ModeInfo_Depth)); + write_log (_T(" Flags = %d\n"), trap_get_byte(ctx, amigamodeinfoptr + PSSO_ModeInfo_Flags)); + write_log (_T(" HorTotal = %d\n"), trap_get_word(ctx, amigamodeinfoptr + PSSO_ModeInfo_HorTotal)); + write_log (_T(" HorBlankSize = %d\n"), trap_get_word(ctx, amigamodeinfoptr + PSSO_ModeInfo_HorBlankSize)); + write_log (_T(" HorSyncStart = %d\n"), trap_get_word(ctx, amigamodeinfoptr + PSSO_ModeInfo_HorSyncStart)); + write_log (_T(" HorSyncSize = %d\n"), trap_get_word(ctx, amigamodeinfoptr + PSSO_ModeInfo_HorSyncSize)); + write_log (_T(" HorSyncSkew = %d\n"), trap_get_byte(ctx, amigamodeinfoptr + PSSO_ModeInfo_HorSyncSkew)); + write_log (_T(" HorEnableSkew = %d\n"), trap_get_byte(ctx, amigamodeinfoptr + PSSO_ModeInfo_HorEnableSkew)); + write_log (_T(" VerTotal = %d\n"), trap_get_word(ctx, amigamodeinfoptr + PSSO_ModeInfo_VerTotal)); + write_log (_T(" VerBlankSize = %d\n"), trap_get_word(ctx, amigamodeinfoptr + PSSO_ModeInfo_VerBlankSize)); + write_log (_T(" VerSyncStart = %d\n"), trap_get_word(ctx, amigamodeinfoptr + PSSO_ModeInfo_VerSyncStart)); + write_log (_T(" VerSyncSize = %d\n"), trap_get_word(ctx, amigamodeinfoptr + PSSO_ModeInfo_VerSyncSize)); + write_log (_T(" Clock = %d\n"), trap_get_byte(ctx, amigamodeinfoptr + PSSO_ModeInfo_first_union)); + write_log (_T(" ClockDivide = %d\n"), trap_get_byte(ctx, amigamodeinfoptr + PSSO_ModeInfo_second_union)); + write_log (_T(" PixelClock = %d\n"), trap_get_long(ctx, amigamodeinfoptr + PSSO_ModeInfo_PixelClock)); } -static void DumpLibResolutionStructure(uaecptr amigalibresptr) +static void DumpLibResolutionStructure(TrapContext *ctx, uaecptr amigalibresptr) { - int i; - uaecptr amigamodeinfoptr; - struct LibResolution* uaememptr = (struct LibResolution *)get_mem_bank(amigalibresptr).xlateaddr(amigalibresptr); + int i; + uaecptr amigamodeinfoptr; + struct LibResolution *uaememptr = (struct LibResolution *)get_mem_bank(amigalibresptr).xlateaddr(amigalibresptr); write_log (_T("LibResolution Structure Dump:\n")); - if (get_long(amigalibresptr + PSSO_LibResolution_DisplayID) == 0xFFFFFFFF) - { + if (trap_get_long(ctx, amigalibresptr + PSSO_LibResolution_DisplayID) == 0xFFFFFFFF) { write_log (_T(" Finished With LibResolutions...\n")); - } - else - { + } else { write_log (_T(" Name = %s\n"), uaememptr->P96ID); - write_log (_T(" DisplayID = 0x%x\n"), get_long (amigalibresptr + PSSO_LibResolution_DisplayID)); - write_log (_T(" Width = %d\n"), get_word (amigalibresptr + PSSO_LibResolution_Width)); - write_log (_T(" Height = %d\n"), get_word (amigalibresptr + PSSO_LibResolution_Height)); - write_log (_T(" Flags = %d\n"), get_word (amigalibresptr + PSSO_LibResolution_Flags)); - for (i = 0; i < MAXMODES; i++) - { - amigamodeinfoptr = get_long(amigalibresptr + PSSO_LibResolution_Modes + i * 4); + write_log (_T(" DisplayID = 0x%x\n"), trap_get_long(ctx, amigalibresptr + PSSO_LibResolution_DisplayID)); + write_log (_T(" Width = %d\n"), trap_get_word(ctx, amigalibresptr + PSSO_LibResolution_Width)); + write_log (_T(" Height = %d\n"), trap_get_word(ctx, amigalibresptr + PSSO_LibResolution_Height)); + write_log (_T(" Flags = %d\n"), trap_get_word(ctx, amigalibresptr + PSSO_LibResolution_Flags)); + for (i = 0; i < MAXMODES; i++) { + amigamodeinfoptr = trap_get_long(ctx, amigalibresptr + PSSO_LibResolution_Modes + i*4); write_log (_T(" ModeInfo[%d] = 0x%x\n"), i, amigamodeinfoptr); - if (amigamodeinfoptr) - DumpModeInfoStructure(amigamodeinfoptr); - } - write_log (_T(" BoardInfo = 0x%x\n"), get_long (amigalibresptr + PSSO_LibResolution_BoardInfo)); - } + if (amigamodeinfoptr) + DumpModeInfoStructure(ctx, amigamodeinfoptr); + } + write_log (_T(" BoardInfo = 0x%x\n"), trap_get_long(ctx, amigalibresptr + PSSO_LibResolution_BoardInfo)); + } } -static TCHAR binary_byte[9] = {0,0,0,0,0,0,0,0,0}; +static TCHAR binary_byte[9] = { 0,0,0,0,0,0,0,0,0 }; -static TCHAR* BuildBinaryString(uae_u8 value) +static TCHAR *BuildBinaryString (uae_u8 value) { - int i; - for (i = 0; i < 8; i++) - { - binary_byte[i] = (value & (1 << (7 - i))) ? '#' : '.'; - } - return binary_byte; + int i; + for (i = 0; i < 8; i++) { + binary_byte[i] = (value & (1 << (7 - i))) ? '#' : '.'; + } + return binary_byte; } -static void DumpPattern(struct Pattern* patt) +static void DumpPattern (struct Pattern *patt) { - uae_u8* mem; - int row, col; - for (row = 0; row < (1 << patt->Size); row++) - { - mem = patt->Memory + row * 2; - for (col = 0; col < 2; col++) - { + uae_u8 *mem; + int row, col; + + if (!patt->Memory) + return; + + for (row = 0; row < (1 << patt->Size); row++) { + mem = patt->Memory + row * 2; + for (col = 0; col < 2; col++) { write_log (_T("%s "), BuildBinaryString (*mem++)); - } + } write_log (_T("\n")); - } + } } -static void DumpTemplate(struct Template* tmp, unsigned long w, unsigned long h) +static void DumpTemplate (struct Template *tmp, unsigned long w, unsigned long h) { - uae_u8* mem = tmp->Memory; - unsigned int row, col, width; - width = (w + 7) >> 3; + uae_u8 *mem = tmp->Memory; + unsigned int row, col, width; + + if (!mem) + return; + width = (w + 7) >> 3; write_log (_T("xoffset = %d, bpr = %d\n"), tmp->XOffset, tmp->BytesPerRow); - for (row = 0; row < h; row++) - { + for (row = 0; row < h; row++) { mem = tmp->Memory + row * tmp->BytesPerRow; - for (col = 0; col < width; col++) - { + for (col = 0; col < width; col++) { write_log (_T("%s "), BuildBinaryString (*mem++)); - } + } write_log (_T("\n")); - } + } } -static void DumpLine(struct Line* line) +static void DumpLine(struct Line *line) { - if (line) - { + if (line) { write_log (_T("Line->X = %d\n"), line->X); write_log (_T("Line->Y = %d\n"), line->Y); write_log (_T("Line->Length = %d\n"), line->Length); @@ -357,401 +304,462 @@ static void DumpLine(struct Line* line) write_log (_T("Line->DrawMode = %d\n"), line->DrawMode); write_log (_T("Line->Xorigin = %d\n"), line->Xorigin); write_log (_T("Line->Yorigin = %d\n"), line->Yorigin); - } + } } -static void ShowSupportedResolutions(void) +static void ShowSupportedResolutions (void) { - int i = 0; + int i = 0; write_log (_T("-----------------\n")); - while (newmodes[i].depth >= 0) - { + while (newmodes[i].depth >= 0) { write_log (_T("%s\n"), newmodes[i].name); - i++; - } + i++; + } write_log (_T("-----------------\n")); } #endif -static void **gwwbuf[MAX_RTG_BOARDS]; -static int gwwbufsize[MAX_RTG_BOARDS], gwwpagesize[MAX_RTG_BOARDS], gwwpagemask[MAX_RTG_BOARDS]; -extern uae_u8* natmem_offset; +extern uae_u8 *natmem_offset; -static uae_u8 GetBytesPerPixel(uae_u32 RGBfmt) +static uae_u8 GetBytesPerPixel (uae_u32 RGBfmt) { - switch (RGBfmt) - { - case RGBFB_CLUT: - return 1; + switch (RGBfmt) + { + case RGBFB_CLUT: + return 1; - case RGBFB_A8R8G8B8: - case RGBFB_A8B8G8R8: - case RGBFB_R8G8B8A8: - case RGBFB_B8G8R8A8: - return 4; + case RGBFB_A8R8G8B8: + case RGBFB_A8B8G8R8: + case RGBFB_R8G8B8A8: + case RGBFB_B8G8R8A8: + return 4; - case RGBFB_B8G8R8: - case RGBFB_R8G8B8: - return 3; + case RGBFB_B8G8R8: + case RGBFB_R8G8B8: + return 3; - case RGBFB_R5G5B5: - case RGBFB_R5G6B5: - case RGBFB_R5G6B5PC: - case RGBFB_R5G5B5PC: - case RGBFB_B5G6R5PC: - case RGBFB_B5G5R5PC: - return 2; - } + case RGBFB_R5G5B5: + case RGBFB_R5G6B5: + case RGBFB_R5G6B5PC: + case RGBFB_R5G5B5PC: + case RGBFB_B5G6R5PC: + case RGBFB_B5G5R5PC: + return 2; + } return 0; } +STATIC_INLINE bool validatecoords2(TrapContext *ctx, struct RenderInfo *ri, uae_u32 *Xp, uae_u32 *Yp, uae_u32 *Widthp, uae_u32 *Heightp) +{ + uae_u32 Width = *Widthp; + uae_u32 Height = *Heightp; + uae_u32 X = *Xp; + uae_u32 Y = *Yp; + if (!Width || !Height) + return true; + if (ri) { + int bpp = GetBytesPerPixel (ri->RGBFormat); + if (X * bpp >= ri->BytesPerRow) + return false; + uae_u32 X2 = X + Width; + if (X2 * bpp > ri->BytesPerRow) { + X2 = ri->BytesPerRow / bpp; + Width = X2 - X; + *Widthp = Width; + } + if (!valid_address(ri->AMemory, (Y + Height - 1) * ri->BytesPerRow + (X + Width - 1) * bpp)) + return false; + } + return true; +} +static bool validatecoords(TrapContext *ctx, struct RenderInfo *ri, uae_u32 *X, uae_u32 *Y, uae_u32 *Width, uae_u32 *Height) +{ + if (validatecoords2(ctx, ri, X, Y, Width, Height)) + return true; + write_log (_T("RTG invalid region: %08X:%d:%d (%dx%d)-(%dx%d)\n"), ri->AMemory, ri->BytesPerRow, ri->RGBFormat, *X, *Y, *Width, *Height); + return false; +} + /* * Amiga <-> native structure conversion functions */ -static int CopyRenderInfoStructureA2U(uaecptr amigamemptr, struct RenderInfo* ri) +static int CopyRenderInfoStructureA2U(TrapContext *ctx, uaecptr amigamemptr, struct RenderInfo *ri) { - if (valid_address(amigamemptr, PSSO_RenderInfo_sizeof)) - { - uaecptr memp = get_long(amigamemptr + PSSO_RenderInfo_Memory); - ri->AMemory = memp; - ri->Memory = get_real_address(memp); - ri->BytesPerRow = get_word(amigamemptr + PSSO_RenderInfo_BytesPerRow); - ri->RGBFormat = RGBFTYPE(get_long(amigamemptr + PSSO_RenderInfo_RGBFormat)); - // Can't really validate this better at this point, no height. - if (valid_address(memp, ri->BytesPerRow)) - return 1; - } - write_log (_T("ERROR - Invalid RenderInfo memory area...\n")); - return 0; -} - -static int CopyPatternStructureA2U(uaecptr amigamemptr, struct Pattern* pattern) -{ - if (valid_address(amigamemptr, PSSO_Pattern_sizeof)) - { - uaecptr memp = get_long(amigamemptr + PSSO_Pattern_Memory); - pattern->Memory = get_real_address(memp); - pattern->XOffset = get_word(amigamemptr + PSSO_Pattern_XOffset); - pattern->YOffset = get_word(amigamemptr + PSSO_Pattern_YOffset); - pattern->FgPen = get_long(amigamemptr + PSSO_Pattern_FgPen); - pattern->BgPen = get_long(amigamemptr + PSSO_Pattern_BgPen); - pattern->Size = get_byte(amigamemptr + PSSO_Pattern_Size); - pattern->DrawMode = get_byte(amigamemptr + PSSO_Pattern_DrawMode); - if (valid_address(memp, 2)) - return 1; - } - write_log (_T("ERROR - Invalid Pattern memory area...\n")); - return 0; -} - -static void CopyColorIndexMappingA2U(uaecptr amigamemptr, struct ColorIndexMapping* cim, int Bpp) -{ - int i; - cim->ColorMask = get_long(amigamemptr); - for (i = 0; i < 256; i++ , amigamemptr += 4) - { - uae_u32 v = get_long(amigamemptr + 4); - endianswap(&v, Bpp); - cim->Colors[i] = v; - } -} - -static int CopyBitMapStructureA2U(uaecptr amigamemptr, struct BitMap* bm) -{ - int i; - - bm->BytesPerRow = get_word(amigamemptr + PSSO_BitMap_BytesPerRow); - bm->Rows = get_word(amigamemptr + PSSO_BitMap_Rows); - bm->Flags = get_byte(amigamemptr + PSSO_BitMap_Flags); - bm->Depth = get_byte(amigamemptr + PSSO_BitMap_Depth); - - /* ARGH - why is THIS happening? */ - if (bm->Depth > 8) - bm->Depth = 8; - - for (i = 0; i < bm->Depth; i++) - { - uaecptr plane = get_long(amigamemptr + PSSO_BitMap_Planes + i * 4); - switch (plane) + if (trap_valid_address(ctx, amigamemptr, PSSO_RenderInfo_sizeof)) { + struct trapmd md[] = { - case 0: - bm->Planes[i] = &all_zeros_bitmap; - break; - case 0xFFFFFFFF: - bm->Planes[i] = &all_ones_bitmap; - break; - default: - if (valid_address(plane, bm->BytesPerRow * bm->Rows)) - bm->Planes[i] = get_real_address(plane); - else - bm->Planes[i] = &all_zeros_bitmap; - break; - } - } - return 1; + { TRAPCMD_GET_LONG, { amigamemptr + PSSO_RenderInfo_Memory } }, + { TRAPCMD_GET_WORD, { amigamemptr + PSSO_RenderInfo_BytesPerRow } }, + { TRAPCMD_GET_LONG, { amigamemptr + PSSO_RenderInfo_RGBFormat } } + }; + trap_multi(ctx, md, sizeof md / sizeof(struct trapmd)); + uaecptr memp = md[0].params[0]; + ri->AMemory = memp; + ri->Memory = get_real_address (memp); + ri->BytesPerRow = md[1].params[0]; + ri->RGBFormat = (RGBFTYPE)md[2].params[0]; + // Can't really validate this better at this point, no height. + if (trap_valid_address(ctx, memp, ri->BytesPerRow)) + return 1; + } + write_log (_T("ERROR - Invalid RenderInfo memory area...\n")); + return 0; } -static int CopyTemplateStructureA2U(uaecptr amigamemptr, struct Template* tmpl) +static int CopyPatternStructureA2U(TrapContext *ctx, uaecptr amigamemptr, struct Pattern *pattern) { - uaecptr memp = get_long(amigamemptr + PSSO_Template_Memory); + if (trap_valid_address(ctx, amigamemptr, PSSO_Pattern_sizeof)) { + struct trapmd md[] = + { + { TRAPCMD_GET_LONG, { amigamemptr + PSSO_Pattern_Memory } }, + { TRAPCMD_GET_WORD, { amigamemptr + PSSO_Pattern_XOffset } }, + { TRAPCMD_GET_WORD, { amigamemptr + PSSO_Pattern_YOffset } }, + { TRAPCMD_GET_LONG, { amigamemptr + PSSO_Pattern_FgPen } }, + { TRAPCMD_GET_LONG, { amigamemptr + PSSO_Pattern_BgPen } }, + { TRAPCMD_GET_BYTE, { amigamemptr + PSSO_Pattern_Size } }, + { TRAPCMD_GET_BYTE, { amigamemptr + PSSO_Pattern_DrawMode } } + }; + trap_multi(ctx, md, sizeof md / sizeof(struct trapmd)); + uaecptr memp = md[0].params[0]; + pattern->Memory = get_real_address (memp); + pattern->AMemory = memp; + pattern->XOffset = md[1].params[0]; + pattern->YOffset = md[2].params[0]; + pattern->FgPen = md[3].params[0]; + pattern->BgPen = md[4].params[0]; + pattern->Size = md[5].params[0]; + pattern->DrawMode = md[6].params[0]; + if (trap_valid_address(ctx, memp, 2)) + return 1; + } + write_log (_T("ERROR - Invalid Pattern memory area...\n")); + return 0; +} - if (valid_address(memp, sizeof(struct Template))) +static int CopyBitMapStructureA2U(TrapContext *ctx, uaecptr amigamemptr, struct BitMap *bm) +{ + int i; + + struct trapmd md[] = { - tmpl->Memory = get_real_address(memp); - tmpl->BytesPerRow = get_word(amigamemptr + PSSO_Template_BytesPerRow); - tmpl->XOffset = get_byte(amigamemptr + PSSO_Template_XOffset); - tmpl->DrawMode = get_byte(amigamemptr + PSSO_Template_DrawMode); - tmpl->FgPen = get_long(amigamemptr + PSSO_Template_FgPen); - tmpl->BgPen = get_long(amigamemptr + PSSO_Template_BgPen); - return 1; - } - write_log (_T("ERROR - Invalid Template memory area...\n")); - return 0; + { TRAPCMD_GET_WORD, { amigamemptr + PSSO_BitMap_BytesPerRow } }, + { TRAPCMD_GET_WORD, { amigamemptr + PSSO_BitMap_Rows } }, + { TRAPCMD_GET_BYTE, { amigamemptr + PSSO_BitMap_Flags } }, + { TRAPCMD_GET_BYTE, { amigamemptr + PSSO_BitMap_Depth } }, + { TRAPCMD_GET_LONG, { amigamemptr + PSSO_BitMap_Planes + 0 } }, + { TRAPCMD_GET_LONG, { amigamemptr + PSSO_BitMap_Planes + 4 } }, + { TRAPCMD_GET_LONG, { amigamemptr + PSSO_BitMap_Planes + 8 } }, + { TRAPCMD_GET_LONG, { amigamemptr + PSSO_BitMap_Planes + 12 } }, + { TRAPCMD_GET_LONG, { amigamemptr + PSSO_BitMap_Planes + 16 } }, + { TRAPCMD_GET_LONG, { amigamemptr + PSSO_BitMap_Planes + 20 } }, + { TRAPCMD_GET_LONG, { amigamemptr + PSSO_BitMap_Planes + 24 } }, + { TRAPCMD_GET_LONG, { amigamemptr + PSSO_BitMap_Planes + 28} } + }; + trap_multi(ctx, md, sizeof md / sizeof(struct trapmd)); + bm->BytesPerRow = md[0].params[0]; + bm->Rows = md[1].params[0]; + bm->Flags = md[2].params[0]; + bm->Depth = md[3].params[0]; + + /* ARGH - why is THIS happening? */ + if( bm->Depth > 8 ) + bm->Depth = 8; + + for (i = 0; i < bm->Depth; i++) { + uaecptr plane = md[4 + i].params[0]; + switch (plane) { + case 0: + bm->Planes[i] = &all_zeros_bitmap; + break; + case 0xFFFFFFFF: + bm->Planes[i] = &all_ones_bitmap; + break; + default: + if (trap_valid_address(ctx, plane, bm->BytesPerRow * bm->Rows)) + bm->Planes[i] = get_real_address (plane); + else + bm->Planes[i] = &all_zeros_bitmap; + break; + } + } + return 1; +} + +static int CopyTemplateStructureA2U(TrapContext *ctx, uaecptr amigamemptr, struct Template *tmpl) +{ + if (trap_valid_address(ctx, amigamemptr, PSSO_Template_sizeof)) { + struct trapmd md[] = + { + { TRAPCMD_GET_LONG, { amigamemptr + PSSO_Template_Memory } }, + { TRAPCMD_GET_WORD, { amigamemptr + PSSO_Template_BytesPerRow } }, + { TRAPCMD_GET_BYTE, { amigamemptr + PSSO_Template_XOffset } }, + { TRAPCMD_GET_BYTE, { amigamemptr + PSSO_Template_DrawMode } }, + { TRAPCMD_GET_LONG, { amigamemptr + PSSO_Template_FgPen } }, + { TRAPCMD_GET_LONG, { amigamemptr + PSSO_Template_BgPen } } + }; + trap_multi(ctx, md, sizeof md / sizeof(struct trapmd)); + + uaecptr memp = md[0].params[0]; + tmpl->Memory = get_real_address (memp); + tmpl->AMemory = memp; + tmpl->BytesPerRow = md[1].params[0]; + tmpl->XOffset = md[2].params[0]; + tmpl->DrawMode = md[3].params[0]; + tmpl->FgPen = md[4].params[0]; + tmpl->BgPen = md[5].params[0]; + return 1; + } + write_log (_T("ERROR - Invalid Template memory area...\n")); + return 0; } /* list is Amiga address of list, in correct endian format for UAE * node is Amiga address of node, in correct endian format for UAE */ -static void AmigaListAddTail(uaecptr l, uaecptr n) +static void AmigaListAddTail(TrapContext *ctx, uaecptr l, uaecptr n) { - put_long(n + 0, l + 4); // n->ln_Succ = (struct Node *)&l->lh_Tail; - put_long(n + 4, get_long(l + 8)); // n->ln_Pred = l->lh_TailPred; - put_long(get_long(l + 8) + 0, n); // l->lh_TailPred->ln_Succ = n; - put_long(l + 8, n); // l->lh_TailPred = n; + trap_put_long(ctx, n + 0, l + 4); // n->ln_Succ = (struct Node *)&l->lh_Tail; + trap_put_long(ctx, n + 4, trap_get_long(ctx, l + 8)); // n->ln_Pred = l->lh_TailPred; + trap_put_long(ctx, trap_get_long(ctx, l + 8) + 0, n); // l->lh_TailPred->ln_Succ = n; + trap_put_long(ctx, l + 8, n); // l->lh_TailPred = n; } /* * Fill a rectangle in the screen. */ -static void do_fillrect_frame_buffer(struct RenderInfo* ri, int X, int Y, - int Width, int Height, uae_u32 Pen, int Bpp) +static void do_fillrect_frame_buffer (struct RenderInfo *ri, int X, int Y, int Width, int Height, uae_u32 Pen, int Bpp) { - int cols; - uae_u8* dst; - int lines; - int bpr = ri->BytesPerRow; + int cols; + uae_u8 *dst; + int lines; + int bpr = ri->BytesPerRow; - dst = ri->Memory + X * Bpp + Y * ri->BytesPerRow; - endianswap(&Pen, Bpp); - switch (Bpp) - { + dst = ri->Memory + X * Bpp + Y * ri->BytesPerRow; + endianswap (&Pen, Bpp); + switch (Bpp) + { case 1: - for (lines = 0; lines < Height; lines++ , dst += bpr) - { - memset(dst, Pen, Width); - } - break; + for (lines = 0; lines < Height; lines++, dst += bpr) { + memset (dst, Pen, Width); + } + break; case 2: - Pen |= Pen << 16; - for (lines = 0; lines < Height; lines++ , dst += bpr) - { - uae_u32* p = reinterpret_cast(dst); - for (cols = 0; cols < Width / 2; cols++) - *p++ = Pen; - if (Width & 1) - reinterpret_cast(p)[0] = Pen; - } - break; + Pen |= Pen << 16; + for (lines = 0; lines < Height; lines++, dst += bpr) { + uae_u16 *dst16 = (uae_u16 *)dst; + int tmpwidth = Width; + if((uintptr_t)dst16 & 3) { + *dst16++ = (uae_u16)Pen; + tmpwidth--; + } + uae_u32 *p = (uae_u32*)dst16; + for (cols = 0; cols < tmpwidth >> 1; cols++) + *p++ = Pen; + if (tmpwidth & 1) + ((uae_u16*)p)[0] = (uae_u16)Pen; + } + break; case 3: - for (lines = 0; lines < Height; lines++ , dst += bpr) - { - uae_u8* p = static_cast(dst); - for (cols = 0; cols < Width; cols++) - { - *p++ = Pen >> 0; - *p++ = Pen >> 8; - *p++ = Pen >> 16; - } - } - break; + for (lines = 0; lines < Height; lines++, dst += bpr) { + uae_u8 *p = (uae_u8*)dst; + for (cols = 0; cols < Width; cols++) { + *p++ = Pen >> 0; + *p++ = Pen >> 8; + *p++ = Pen >> 16; + } + } + break; case 4: - for (lines = 0; lines < Height; lines++ , dst += bpr) - { - uae_u32* p = reinterpret_cast(dst); - for (cols = 0; cols < Width; cols++) - *p++ = Pen; - } - break; - } + for (lines = 0; lines < Height; lines++, dst += bpr) { + uae_u32 *p = (uae_u32*)dst; + for (cols = 0; cols < Width; cols++) + *p++ = Pen; + } + break; + } } -static int pframecnt; -int p96skipmode = -1; - -static int doskip() +static int p96_framecnt; +static int doskip (void) { - if (pframecnt >= currprefs.gfx_framerate) - pframecnt = 0; - return pframecnt > 0; + if (p96_framecnt > currprefs.gfx_framerate) + p96_framecnt = 0; + return p96_framecnt > 0; } -void picasso_trigger_vblank() +void picasso_trigger_vblank (void) { - if (!ABI_interrupt || !uaegfx_base || !interrupt_enabled) - return; - put_long(uaegfx_base + CARD_IRQPTR, ABI_interrupt + PSSO_BoardInfo_SoftInterrupt); - put_byte(uaegfx_base + CARD_IRQFLAG, 1); + TrapContext *ctx = NULL; + if (!ABI_interrupt || !uaegfx_base || !interrupt_enabled) + return; + trap_put_long(ctx, uaegfx_base + CARD_IRQPTR, ABI_interrupt + PSSO_BoardInfo_SoftInterrupt); + trap_put_byte(ctx, uaegfx_base + CARD_IRQFLAG, 1); } +static bool rtg_render (void) +{ + bool flushed = false; + if (!doskip ()) + flushed = picasso_flushpixels (gfxmem_banks[0]->start + natmem_offset, picasso96_state.XYOffset - gfxmem_banks[0]->start); + + return flushed; +} +static void rtg_clear (void) +{ +} static int set_panning_called = 0; -enum -{ - /* DEST = RGBFB_B8G8R8A8,32 */ - RGBFB_A8R8G8B8_32 = 1, - RGBFB_A8B8G8R8_32, - RGBFB_R8G8B8A8_32, - RGBFB_B8G8R8A8_32, - RGBFB_R8G8B8_32, - RGBFB_B8G8R8_32, - RGBFB_R5G6B5PC_32, - RGBFB_R5G5B5PC_32, - RGBFB_R5G6B5_32, - RGBFB_R5G5B5_32, - RGBFB_B5G6R5PC_32, - RGBFB_B5G5R5PC_32, - RGBFB_CLUT_RGBFB_32, +enum { - /* DEST = RGBFB_R5G6B5PC,16 */ - RGBFB_A8R8G8B8_16, - RGBFB_A8B8G8R8_16, - RGBFB_R8G8B8A8_16, - RGBFB_B8G8R8A8_16, - RGBFB_R8G8B8_16, - RGBFB_B8G8R8_16, - RGBFB_R5G6B5PC_16, - RGBFB_R5G5B5PC_16, - RGBFB_R5G6B5_16, - RGBFB_R5G5B5_16, - RGBFB_B5G6R5PC_16, - RGBFB_B5G5R5PC_16, - RGBFB_CLUT_RGBFB_16, + /* DEST = RGBFB_B8G8R8A8,32 */ + RGBFB_A8R8G8B8_32 = 1, + RGBFB_A8B8G8R8_32, + RGBFB_R8G8B8A8_32, + RGBFB_B8G8R8A8_32, + RGBFB_R8G8B8_32, + RGBFB_B8G8R8_32, + RGBFB_R5G6B5PC_32, + RGBFB_R5G5B5PC_32, + RGBFB_R5G6B5_32, + RGBFB_R5G5B5_32, + RGBFB_B5G6R5PC_32, + RGBFB_B5G5R5PC_32, + RGBFB_CLUT_RGBFB_32, - /* DEST = RGBFB_CLUT,8 */ - RGBFB_CLUT_8 + /* DEST = RGBFB_R5G6B5PC,16 */ + RGBFB_A8R8G8B8_16, + RGBFB_A8B8G8R8_16, + RGBFB_R8G8B8A8_16, + RGBFB_B8G8R8A8_16, + RGBFB_R8G8B8_16, + RGBFB_B8G8R8_16, + RGBFB_R5G6B5PC_16, + RGBFB_R5G5B5PC_16, + RGBFB_R5G6B5_16, + RGBFB_R5G5B5_16, + RGBFB_B5G6R5PC_16, + RGBFB_B5G5R5PC_16, + RGBFB_CLUT_RGBFB_16, + + /* DEST = RGBFB_CLUT,8 */ + RGBFB_CLUT_8 }; -static int getconvert(int rgbformat, int pixbytes) +static int getconvert (int rgbformat, int pixbytes) { int v = 0; int d = pixbytes; switch (rgbformat) - { + { case RGBFB_CLUT: - if (d == 1) - v = RGBFB_CLUT_8; - else if (d == 2) - v = RGBFB_CLUT_RGBFB_16; - else if (d == 4) - v = RGBFB_CLUT_RGBFB_32; - break; + if (d == 1) + v = RGBFB_CLUT_8; + else if (d == 2) + v = RGBFB_CLUT_RGBFB_16; + else if (d == 4) + v = RGBFB_CLUT_RGBFB_32; + break; case RGBFB_B5G6R5PC: - if (d == 2) - v = RGBFB_B5G6R5PC_16; - else if (d == 4) - v = RGBFB_B5G6R5PC_32; - break; + if (d == 2) + v = RGBFB_B5G6R5PC_16; + else if (d == 4) + v = RGBFB_B5G6R5PC_32; + break; case RGBFB_R5G6B5PC: - if (d == 2) - v = RGBFB_R5G6B5PC_16; - else if (d == 4) - v = RGBFB_R5G6B5PC_32; - break; + if (d == 2) + v = RGBFB_R5G6B5PC_16; + else if (d == 4) + v = RGBFB_R5G6B5PC_32; + break; case RGBFB_R5G5B5PC: - if (d == 4) - v = RGBFB_R5G5B5PC_32; - else if (d == 2) - v = RGBFB_R5G5B5PC_16; - break; + if (d == 4) + v = RGBFB_R5G5B5PC_32; + else if (d == 2) + v = RGBFB_R5G5B5PC_16; + break; case RGBFB_R5G6B5: - if (d == 4) - v = RGBFB_R5G6B5_32; - else - v = RGBFB_R5G6B5_16; - break; + if (d == 4) + v = RGBFB_R5G6B5_32; + else + v = RGBFB_R5G6B5_16; + break; case RGBFB_R5G5B5: - if (d == 4) - v = RGBFB_R5G5B5_32; - else - v = RGBFB_R5G5B5_16; - break; + if (d == 4) + v = RGBFB_R5G5B5_32; + else + v = RGBFB_R5G5B5_16; + break; case RGBFB_B5G5R5PC: - if (d == 4) - v = RGBFB_B5G5R5PC_32; - else - v = RGBFB_B5G5R5PC_16; - break; + if (d == 4) + v = RGBFB_B5G5R5PC_32; + else + v = RGBFB_B5G5R5PC_16; + break; case RGBFB_A8R8G8B8: - if (d == 2) - v = RGBFB_A8R8G8B8_16; - else if (d == 4) - v = RGBFB_A8R8G8B8_32; - break; + if (d == 2) + v = RGBFB_A8R8G8B8_16; + else if (d == 4) + v = RGBFB_A8R8G8B8_32; + break; case RGBFB_R8G8B8: - if (d == 2) - v = RGBFB_R8G8B8_16; - else if (d == 4) - v = RGBFB_R8G8B8_32; - break; + if (d == 2) + v = RGBFB_R8G8B8_16; + else if (d == 4) + v = RGBFB_R8G8B8_32; + break; case RGBFB_B8G8R8: - if (d == 2) - v = RGBFB_B8G8R8_16; - else if (d == 4) - v = RGBFB_B8G8R8_32; - break; + if (d == 2) + v = RGBFB_B8G8R8_16; + else if (d == 4) + v = RGBFB_B8G8R8_32; + break; case RGBFB_A8B8G8R8: - if (d == 2) - v = RGBFB_A8B8G8R8_16; - else if (d == 4) - v = RGBFB_A8B8G8R8_32; - break; + if (d == 2) + v = RGBFB_A8B8G8R8_16; + else if (d == 4) + v = RGBFB_A8B8G8R8_32; + break; case RGBFB_B8G8R8A8: - if (d == 2) - v = RGBFB_B8G8R8A8_16; - else if (d == 4) - v = RGBFB_B8G8R8A8_32; - break; + if (d == 2) + v = RGBFB_B8G8R8A8_16; + else if (d == 4) + v = RGBFB_B8G8R8A8_32; + break; case RGBFB_R8G8B8A8: - if (d == 2) - v = RGBFB_R8G8B8A8_16; - else if (d == 4) - v = RGBFB_R8G8B8A8_32; - break; - } - return v; + if (d == 2) + v = RGBFB_R8G8B8A8_16; + else if (d == 4) + v = RGBFB_R8G8B8A8_32; + break; + } + return v; } -static void setconvert() +static void setconvert(void) { static int ohost_mode, orgbformat; - picasso_convert = getconvert(picasso96_state.RGBFormat, picasso_vidinfo.pixbytes); - host_mode = GetSurfacePixelFormat(); - if (picasso_vidinfo.pixbytes == 4) - alloc_colors_rgb(8, 8, 8, 16, 8, 0, 0, 0, 0, 0, p96rc, p96gc, p96bc); - else - alloc_colors_rgb(5, 6, 5, 11, 5, 0, 0, 0, 0, 0, p96rc, p96gc, p96bc); - gfx_set_picasso_colors(picasso96_state.RGBFormat); - picasso_palette(); + picasso_convert = getconvert (picasso96_state.RGBFormat, picasso_vidinfo.pixbytes); + host_mode = GetSurfacePixelFormat(); + picasso_palette (picasso96_state.CLUT); if (host_mode != ohost_mode || picasso96_state.RGBFormat != orgbformat) { - write_log(_T("RTG conversion: Depth=%d HostRGBF=%d P96RGBF=%d Mode=%d\n"), - picasso_vidinfo.pixbytes, host_mode, picasso96_state.RGBFormat, picasso_convert); + write_log (_T("RTG conversion: Depth=%d HostRGBF=%d P96RGBF=%d Mode=%d\n"), + picasso_vidinfo.pixbytes, host_mode, picasso96_state.RGBFormat, picasso_convert); ohost_mode = host_mode; orgbformat = picasso96_state.RGBFormat; } - full_refresh = 1; } -bool picasso_is_active(void) +bool picasso_is_active (void) { return picasso_active; } @@ -762,77 +770,77 @@ bool picasso_is_active(void) * 2. Picasso-->Picasso transition, via SetPanning(). * 3. whenever the graphics code notifies us that the screen contents have been lost. */ -void picasso_refresh() +void picasso_refresh (void) { - struct RenderInfo ri; + struct RenderInfo ri; - if (!picasso_on) - return; - full_refresh = 1; - setconvert(); + if (!picasso_on) + return; + setconvert (); + rtg_clear(); - /* Make sure that the first time we show a Picasso video mode, we don't blit any crap. - * We can do this by checking if we have an Address yet. - */ - if (picasso96_state.Address) - { - unsigned int width, height; - /* blit the stuff from our static frame-buffer to the gfx-card */ - ri.Memory = gfxmem_bank.baseaddr + (picasso96_state.Address - gfxmem_bank.start); - ri.BytesPerRow = picasso96_state.BytesPerRow; - ri.RGBFormat = picasso96_state.RGBFormat; - - if (set_panning_called) { - width = (picasso96_state.VirtualWidth < picasso96_state.Width) ? - picasso96_state.VirtualWidth : picasso96_state.Width; - height = (picasso96_state.VirtualHeight < picasso96_state.Height) ? - picasso96_state.VirtualHeight : picasso96_state.Height; - // Let's put a black-border around the case where we've got a sub-screen... - if (!picasso96_state.BigAssBitmap) { - if (picasso96_state.XOffset || picasso96_state.YOffset) - DX_Fill(0, 0, picasso96_state.Width, picasso96_state.Height, 0); - } - } - else { - width = picasso96_state.Width; - height = picasso96_state.Height; - } - } - else - { - write_log (_T("ERROR - picasso_refresh() can't refresh!\n")); - } + /* Make sure that the first time we show a Picasso video mode, we don't blit any crap. + * We can do this by checking if we have an Address yet. + */ + if (picasso96_state.Address) { + /* blit the stuff from our static frame-buffer to the gfx-card */ + ri.Memory = gfxmem_bank.baseaddr + (picasso96_state.Address - gfxmem_bank.start); + ri.BytesPerRow = picasso96_state.BytesPerRow; + ri.RGBFormat = (RGBFTYPE)picasso96_state.RGBFormat; + } else { + write_log (_T("ERROR - picasso_refresh() can't refresh!\n")); + } } -static void selectuaegfx(void) +bool picasso_rendered = false; +void picasso_handle_vsync(void) { - memcpy(&picasso96_state, &picasso96_state_uaegfx, sizeof picasso96_state); -} + static int vsynccnt; -static int p96hsync; - -void picasso_handle_vsync() -{ if (currprefs.rtgboards[0].rtgmem_size == 0) return; - if (!picasso_on) - { - picasso_trigger_vblank(); + if (!picasso_on) { + picasso_trigger_vblank (); return; } - pframecnt++; + int state = picasso_state_change; + if (state & PICASSO_STATE_SETDAC) { + atomic_and(&picasso_state_change, ~PICASSO_STATE_SETDAC); + rtg_clear(); + } + if (state & PICASSO_STATE_SETGC) { + atomic_and(&picasso_state_change, ~PICASSO_STATE_SETGC); + set_gc_called = 1; + picasso_changed = true; + init_picasso_screen(); + init_hz_p96(); + } + if (state & PICASSO_STATE_SETSWITCH) { + atomic_and(&picasso_state_change, ~PICASSO_STATE_SETSWITCH); + /* Do not switch immediately. Tell the custom chip emulation about the + * desired state, and wait for custom.c to call picasso_enablescreen + * whenever it is ready to change the screen state. */ + if (picasso_on == picasso_requested_on && picasso_requested_on && picasso_changed) { + picasso_requested_forced_on = true; + } + picasso_changed = false; + picasso_active = picasso_requested_on; + } + if (state & PICASSO_STATE_SETPANNING) { + atomic_and(&picasso_state_change, ~PICASSO_STATE_SETPANNING); + set_panning_called = 1; + init_picasso_screen(); + set_panning_called = 0; + } - if (doskip() && p96skipmode == 0) - { - ; - } - else - { - picasso_flushpixels(0); - flush_screen(); - } + p96_framecnt++; + + if (!picasso_on) + return; + + picasso_rendered = rtg_render(); picasso_trigger_vblank(); } @@ -850,7 +858,7 @@ void picasso_handle_vsync() #include "p96_blit.cpp" #define BLT_NAME BLIT_NOTSRC_32 #define BLT_FUNC(s,d) *d = ~(*s) -#include "p96_blit.cpp" +#include "p96_blit.cpp" #define BLT_NAME BLIT_ONLYSRC_32 #define BLT_FUNC(s,d) *d = (*s) & ~(*d) #include "p96_blit.cpp" @@ -905,7 +913,7 @@ void picasso_handle_vsync() #include "p96_blit.cpp" #define BLT_NAME BLIT_NOTSRC_24 #define BLT_FUNC(s,d) *d = ~(*s) -#include "p96_blit.cpp" +#include "p96_blit.cpp" #define BLT_NAME BLIT_ONLYSRC_24 #define BLT_FUNC(s,d) *d = (*s) & ~(*d) #include "p96_blit.cpp" @@ -960,7 +968,7 @@ void picasso_handle_vsync() #include "p96_blit.cpp" #define BLT_NAME BLIT_NOTSRC_16 #define BLT_FUNC(s,d) *d = ~(*s) -#include "p96_blit.cpp" +#include "p96_blit.cpp" #define BLT_NAME BLIT_ONLYSRC_16 #define BLT_FUNC(s,d) *d = (*s) & ~(*d) #include "p96_blit.cpp" @@ -1015,7 +1023,7 @@ void picasso_handle_vsync() #include "p96_blit.cpp" #define BLT_NAME BLIT_NOTSRC_8 #define BLT_FUNC(s,d) *d = ~(*s) -#include "p96_blit.cpp" +#include "p96_blit.cpp" #define BLT_NAME BLIT_ONLYSRC_8 #define BLT_FUNC(s,d) *d = (*s) & ~(*d) #include "p96_blit.cpp" @@ -1062,142 +1070,137 @@ void picasso_handle_vsync() /* * Functions to perform an action on the frame-buffer */ -static int do_blitrect_frame_buffer(struct RenderInfo *ri, struct - RenderInfo *dstri, unsigned long srcx, unsigned long srcy, - unsigned long dstx, unsigned long dsty, unsigned long width, unsigned - long height, uae_u8 mask, BLIT_OPCODE opcode) +static int do_blitrect_frame_buffer (struct RenderInfo *ri, struct + RenderInfo *dstri, unsigned long srcx, unsigned long srcy, + unsigned long dstx, unsigned long dsty, unsigned long width, unsigned + long height, uae_u8 mask, BLIT_OPCODE opcode) { - uae_u8 *src, *dst; - uae_u8 Bpp = GetBytesPerPixel(ri->RGBFormat); - unsigned long total_width = width * Bpp; + uae_u8 *src, *dst; + uae_u8 Bpp = GetBytesPerPixel (ri->RGBFormat); + unsigned long total_width = width * Bpp; - src = ri->Memory + srcx * Bpp + srcy * ri->BytesPerRow; - dst = dstri->Memory + dstx * Bpp + dsty * dstri->BytesPerRow; - if (mask != 0xFF && Bpp > 1) { - write_log(_T("WARNING - BlitRect() has mask 0x%x with Bpp %d.\n"), mask, Bpp); - } + src = ri->Memory + srcx*Bpp + srcy*ri->BytesPerRow; + dst = dstri->Memory + dstx*Bpp + dsty*dstri->BytesPerRow; - P96TRACE((_T("(%dx%d)=(%dx%d)=(%dx%d)=%d\n"), srcx, srcy, dstx, dsty, width, height, opcode)); - if (mask == 0xFF || Bpp > 1) { + if (mask != 0xFF && Bpp > 1) { + write_log (_T("WARNING - BlitRect() has mask 0x%x with Bpp %d.\n"), mask, Bpp); + } - if (opcode == BLIT_SRC) { - /* handle normal case efficiently */ - if (ri->Memory == dstri->Memory && dsty == srcy) { - unsigned long i; - for (i = 0; i < height; i++, src += ri->BytesPerRow, dst += dstri->BytesPerRow) - memmove(dst, src, total_width); - } - else if (dsty < srcy) { - unsigned long i; - for (i = 0; i < height; i++, src += ri->BytesPerRow, dst += dstri->BytesPerRow) - memcpy(dst, src, total_width); - } - else { - unsigned long i; - src += (height - 1) * ri->BytesPerRow; - dst += (height - 1) * dstri->BytesPerRow; - for (i = 0; i < height; i++, src -= ri->BytesPerRow, dst -= dstri->BytesPerRow) - memcpy(dst, src, total_width); - } - return 1; + P96TRACE ((_T("(%dx%d)=(%dx%d)=(%dx%d)=%d\n"), srcx, srcy, dstx, dsty, width, height, opcode)); + if (mask == 0xFF || Bpp > 1) { - } - else { + if(opcode == BLIT_SRC) { + /* handle normal case efficiently */ + if (ri->Memory == dstri->Memory && dsty == srcy) { + unsigned long i; + for (i = 0; i < height; i++, src += ri->BytesPerRow, dst += dstri->BytesPerRow) + memmove (dst, src, total_width); + } else if (dsty < srcy) { + unsigned long i; + for (i = 0; i < height; i++, src += ri->BytesPerRow, dst += dstri->BytesPerRow) + memcpy (dst, src, total_width); + } else { + unsigned long i; + src += (height-1) * ri->BytesPerRow; + dst += (height-1) * dstri->BytesPerRow; + for (i = 0; i < height; i++, src -= ri->BytesPerRow, dst -= dstri->BytesPerRow) + memcpy (dst, src, total_width); + } + return 1; + + } else { if (Bpp == 4) { - /* 32-bit optimized */ - switch (opcode) - { - case BLIT_FALSE: BLIT_FALSE_32(PARMS); break; - case BLIT_NOR: BLIT_NOR_32(PARMS); break; - case BLIT_ONLYDST: BLIT_ONLYDST_32(PARMS); break; - case BLIT_NOTSRC: BLIT_NOTSRC_32(PARMS); break; - case BLIT_ONLYSRC: BLIT_ONLYSRC_32(PARMS); break; - case BLIT_NOTDST: BLIT_NOTDST_32(PARMS); break; - case BLIT_EOR: BLIT_EOR_32(PARMS); break; - case BLIT_NAND: BLIT_NAND_32(PARMS); break; - case BLIT_AND: BLIT_AND_32(PARMS); break; - case BLIT_NEOR: BLIT_NEOR_32(PARMS); break; - case BLIT_NOTONLYSRC: BLIT_NOTONLYSRC_32(PARMS); break; - case BLIT_NOTONLYDST: BLIT_NOTONLYDST_32(PARMS); break; - case BLIT_OR: BLIT_OR_32(PARMS); break; - case BLIT_TRUE: BLIT_TRUE_32(PARMS); break; - case BLIT_SWAP: BLIT_SWAP_32(PARMS); break; - } + /* 32-bit optimized */ + switch (opcode) + { + case BLIT_FALSE: BLIT_FALSE_32 (PARMS); break; + case BLIT_NOR: BLIT_NOR_32 (PARMS); break; + case BLIT_ONLYDST: BLIT_ONLYDST_32 (PARMS); break; + case BLIT_NOTSRC: BLIT_NOTSRC_32 (PARMS); break; + case BLIT_ONLYSRC: BLIT_ONLYSRC_32 (PARMS); break; + case BLIT_NOTDST: BLIT_NOTDST_32 (PARMS); break; + case BLIT_EOR: BLIT_EOR_32 (PARMS); break; + case BLIT_NAND: BLIT_NAND_32 (PARMS); break; + case BLIT_AND: BLIT_AND_32 (PARMS); break; + case BLIT_NEOR: BLIT_NEOR_32 (PARMS); break; + case BLIT_NOTONLYSRC: BLIT_NOTONLYSRC_32 (PARMS); break; + case BLIT_NOTONLYDST: BLIT_NOTONLYDST_32 (PARMS); break; + case BLIT_OR: BLIT_OR_32 (PARMS); break; + case BLIT_TRUE: BLIT_TRUE_32 (PARMS); break; + case BLIT_SWAP: BLIT_SWAP_32 (PARMS); break; + } + } else if (Bpp == 3) { + + /* 24-bit (not very) optimized */ + switch (opcode) + { + case BLIT_FALSE: BLIT_FALSE_24 (PARMS); break; + case BLIT_NOR: BLIT_NOR_24 (PARMS); break; + case BLIT_ONLYDST: BLIT_ONLYDST_24 (PARMS); break; + case BLIT_NOTSRC: BLIT_NOTSRC_24 (PARMS); break; + case BLIT_ONLYSRC: BLIT_ONLYSRC_24 (PARMS); break; + case BLIT_NOTDST: BLIT_NOTDST_24 (PARMS); break; + case BLIT_EOR: BLIT_EOR_24 (PARMS); break; + case BLIT_NAND: BLIT_NAND_24 (PARMS); break; + case BLIT_AND: BLIT_AND_24 (PARMS); break; + case BLIT_NEOR: BLIT_NEOR_24 (PARMS); break; + case BLIT_NOTONLYSRC: BLIT_NOTONLYSRC_24 (PARMS); break; + case BLIT_NOTONLYDST: BLIT_NOTONLYDST_24 (PARMS); break; + case BLIT_OR: BLIT_OR_24 (PARMS); break; + case BLIT_TRUE: BLIT_TRUE_24 (PARMS); break; + case BLIT_SWAP: BLIT_SWAP_24 (PARMS); break; + } + + } else if (Bpp == 2) { + + /* 16-bit optimized */ + switch (opcode) + { + case BLIT_FALSE: BLIT_FALSE_16 (PARMS); break; + case BLIT_NOR: BLIT_NOR_16 (PARMS); break; + case BLIT_ONLYDST: BLIT_ONLYDST_16 (PARMS); break; + case BLIT_NOTSRC: BLIT_NOTSRC_16 (PARMS); break; + case BLIT_ONLYSRC: BLIT_ONLYSRC_16 (PARMS); break; + case BLIT_NOTDST: BLIT_NOTDST_16 (PARMS); break; + case BLIT_EOR: BLIT_EOR_16 (PARMS); break; + case BLIT_NAND: BLIT_NAND_16 (PARMS); break; + case BLIT_AND: BLIT_AND_16 (PARMS); break; + case BLIT_NEOR: BLIT_NEOR_16 (PARMS); break; + case BLIT_NOTONLYSRC: BLIT_NOTONLYSRC_16 (PARMS); break; + case BLIT_NOTONLYDST: BLIT_NOTONLYDST_16 (PARMS); break; + case BLIT_OR: BLIT_OR_16 (PARMS); break; + case BLIT_TRUE: BLIT_TRUE_16 (PARMS); break; + case BLIT_SWAP: BLIT_SWAP_16 (PARMS); break; + } + + } else if (Bpp == 1) { + + /* 8-bit optimized */ + switch (opcode) + { + case BLIT_FALSE: BLIT_FALSE_8 (PARMS); break; + case BLIT_NOR: BLIT_NOR_8 (PARMS); break; + case BLIT_ONLYDST: BLIT_ONLYDST_8 (PARMS); break; + case BLIT_NOTSRC: BLIT_NOTSRC_8 (PARMS); break; + case BLIT_ONLYSRC: BLIT_ONLYSRC_8 (PARMS); break; + case BLIT_NOTDST: BLIT_NOTDST_8 (PARMS); break; + case BLIT_EOR: BLIT_EOR_8 (PARMS); break; + case BLIT_NAND: BLIT_NAND_8 (PARMS); break; + case BLIT_AND: BLIT_AND_8 (PARMS); break; + case BLIT_NEOR: BLIT_NEOR_8 (PARMS); break; + case BLIT_NOTONLYSRC: BLIT_NOTONLYSRC_8 (PARMS); break; + case BLIT_NOTONLYDST: BLIT_NOTONLYDST_8 (PARMS); break; + case BLIT_OR: BLIT_OR_8 (PARMS); break; + case BLIT_TRUE: BLIT_TRUE_8 (PARMS); break; + case BLIT_SWAP: BLIT_SWAP_8 (PARMS); break; + } } - else if (Bpp == 3) { - - /* 24-bit (not very) optimized */ - switch (opcode) - { - case BLIT_FALSE: BLIT_FALSE_24(PARMS); break; - case BLIT_NOR: BLIT_NOR_24(PARMS); break; - case BLIT_ONLYDST: BLIT_ONLYDST_24(PARMS); break; - case BLIT_NOTSRC: BLIT_NOTSRC_24(PARMS); break; - case BLIT_ONLYSRC: BLIT_ONLYSRC_24(PARMS); break; - case BLIT_NOTDST: BLIT_NOTDST_24(PARMS); break; - case BLIT_EOR: BLIT_EOR_24(PARMS); break; - case BLIT_NAND: BLIT_NAND_24(PARMS); break; - case BLIT_AND: BLIT_AND_24(PARMS); break; - case BLIT_NEOR: BLIT_NEOR_24(PARMS); break; - case BLIT_NOTONLYSRC: BLIT_NOTONLYSRC_24(PARMS); break; - case BLIT_NOTONLYDST: BLIT_NOTONLYDST_24(PARMS); break; - case BLIT_OR: BLIT_OR_24(PARMS); break; - case BLIT_TRUE: BLIT_TRUE_24(PARMS); break; - case BLIT_SWAP: BLIT_SWAP_24(PARMS); break; - } - - } - else if (Bpp == 2) { - - /* 16-bit optimized */ - switch (opcode) - { - case BLIT_FALSE: BLIT_FALSE_16(PARMS); break; - case BLIT_NOR: BLIT_NOR_16(PARMS); break; - case BLIT_ONLYDST: BLIT_ONLYDST_16(PARMS); break; - case BLIT_NOTSRC: BLIT_NOTSRC_16(PARMS); break; - case BLIT_ONLYSRC: BLIT_ONLYSRC_16(PARMS); break; - case BLIT_NOTDST: BLIT_NOTDST_16(PARMS); break; - case BLIT_EOR: BLIT_EOR_16(PARMS); break; - case BLIT_NAND: BLIT_NAND_16(PARMS); break; - case BLIT_AND: BLIT_AND_16(PARMS); break; - case BLIT_NEOR: BLIT_NEOR_16(PARMS); break; - case BLIT_NOTONLYSRC: BLIT_NOTONLYSRC_16(PARMS); break; - case BLIT_NOTONLYDST: BLIT_NOTONLYDST_16(PARMS); break; - case BLIT_OR: BLIT_OR_16(PARMS); break; - case BLIT_TRUE: BLIT_TRUE_16(PARMS); break; - case BLIT_SWAP: BLIT_SWAP_16(PARMS); break; - } - - } - else if (Bpp == 1) { - - /* 8-bit optimized */ - switch (opcode) - { - case BLIT_FALSE: BLIT_FALSE_8(PARMS); break; - case BLIT_NOR: BLIT_NOR_8(PARMS); break; - case BLIT_ONLYDST: BLIT_ONLYDST_8(PARMS); break; - case BLIT_NOTSRC: BLIT_NOTSRC_8(PARMS); break; - case BLIT_ONLYSRC: BLIT_ONLYSRC_8(PARMS); break; - case BLIT_NOTDST: BLIT_NOTDST_8(PARMS); break; - case BLIT_EOR: BLIT_EOR_8(PARMS); break; - case BLIT_NAND: BLIT_NAND_8(PARMS); break; - case BLIT_AND: BLIT_AND_8(PARMS); break; - case BLIT_NEOR: BLIT_NEOR_8(PARMS); break; - case BLIT_NOTONLYSRC: BLIT_NOTONLYSRC_8(PARMS); break; - case BLIT_NOTONLYDST: BLIT_NOTONLYDST_8(PARMS); break; - case BLIT_OR: BLIT_OR_8(PARMS); break; - case BLIT_TRUE: BLIT_TRUE_8(PARMS); break; - case BLIT_SWAP: BLIT_SWAP_8(PARMS); break; - } - } - } - return 1; - } - return 0; + } + return 1; + } + return 0; } /* @@ -1207,9 +1210,9 @@ Inputs: a0: struct BoardInfo *bi d7: RGBFTYPE RGBFormat */ -static uae_u32 REGPARAM2 picasso_SetSpritePosition(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_SetSpritePosition (TrapContext *ctx) { - uaecptr bi = m68k_areg (regs, 0); + uaecptr bi = trap_get_areg(ctx, 0); boardinfo = bi; return 0; } @@ -1227,9 +1230,9 @@ d7: RGBFTYPE RGBFormat This function changes one of the possible three colors of the hardware sprite. */ -static uae_u32 REGPARAM2 picasso_SetSpriteColor(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_SetSpriteColor (TrapContext *ctx) { - uaecptr bi = m68k_areg (regs, 0); + uaecptr bi = trap_get_areg(ctx, 0); boardinfo = bi; return 0; } @@ -1260,11 +1263,11 @@ planes for one image line respectively. You have to double each pixel horizontal used in this case already assume a zoomed sprite, only the sprite data is not zoomed yet. You will have to compensate for this when accounting for hotspot offsets and sprite dimensions. */ -static uae_u32 REGPARAM2 picasso_SetSpriteImage(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_SetSpriteImage (TrapContext *ctx) { - uaecptr bi = m68k_areg (regs, 0); + uaecptr bi = trap_get_areg(ctx, 0); boardinfo = bi; - return 0; + return 0; } /* @@ -1276,7 +1279,7 @@ d7: RGBFTYPE RGBFormat This function activates or deactivates the hardware sprite. */ -static uae_u32 REGPARAM2 picasso_SetSprite(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_SetSprite (TrapContext *ctx) { return 0; } @@ -1296,105 +1299,94 @@ static uae_u32 REGPARAM2 picasso_SetSprite(TrapContext* ctx) * BoardInfo struct supplied by the caller, the rtg.library, for example * the MemoryBase, MemorySize and RegisterBase fields. */ -static void picasso96_alloc2(TrapContext* ctx); - -static uae_u32 REGPARAM2 picasso_FindCard(TrapContext* ctx) +static void picasso96_alloc2 (TrapContext *ctx); +static uae_u32 REGPARAM2 picasso_FindCard (TrapContext *ctx) { - uaecptr AmigaBoardInfo = m68k_areg (regs, 0); - /* NOTES: See BoardInfo struct definition in Picasso96 dev info */ + uaecptr AmigaBoardInfo = trap_get_areg(ctx, 0); + /* NOTES: See BoardInfo struct definition in Picasso96 dev info */ if (!uaegfx_active || !gfxmem_bank.start) - return 0; - if (uaegfx_base) - { - put_long(uaegfx_base + CARD_BOARDINFO, AmigaBoardInfo); + return 0; + if (uaegfx_base) { + trap_put_long(ctx, uaegfx_base + CARD_BOARDINFO, AmigaBoardInfo); + } else if (uaegfx_old) { + picasso96_alloc2 (ctx); } - else if (uaegfx_old) - { - picasso96_alloc2(ctx); - } - boardinfo = AmigaBoardInfo; + boardinfo = AmigaBoardInfo; - if (gfxmem_bank.allocated_size && !picasso96_state.CardFound) - { - /* Fill in MemoryBase, MemorySize */ - put_long(AmigaBoardInfo + PSSO_BoardInfo_MemoryBase, gfxmem_bank.start); - put_long(AmigaBoardInfo + PSSO_BoardInfo_MemorySize, gfxmem_bank.allocated_size - reserved_gfxmem); - picasso96_state.CardFound = 1; /* mark our "card" as being found */ - return -1; - } - else - return 0; + if (gfxmem_bank.allocated_size && !picasso96_state_uaegfx.CardFound) { + /* Fill in MemoryBase, MemorySize */ + trap_put_long(ctx, AmigaBoardInfo + PSSO_BoardInfo_MemoryBase, gfxmem_bank.start); + trap_put_long(ctx, AmigaBoardInfo + PSSO_BoardInfo_MemorySize, gfxmem_bank.allocated_size - reserved_gfxmem); + picasso96_state_uaegfx.CardFound = 1; /* mark our "card" as being found */ + return -1; + } else + return 0; } -static void FillBoardInfo(uaecptr amigamemptr, struct LibResolution* res, int width, int height, int depth) +static void FillBoardInfo(TrapContext *ctx, uaecptr amigamemptr, struct LibResolution *res, int width, int height, int depth) { - int i; - - switch (depth) - { - case 8: - res->Modes[CHUNKY] = amigamemptr; - break; + switch (depth) + { + case 8: + res->Modes[CHUNKY] = amigamemptr; + break; case 15: case 16: - res->Modes[HICOLOR] = amigamemptr; - break; + res->Modes[HICOLOR] = amigamemptr; + break; case 24: - res->Modes[TRUECOLOR] = amigamemptr; - break; - default: - res->Modes[TRUEALPHA] = amigamemptr; - break; - } - for (i = 0; i < PSSO_ModeInfo_sizeof; i++) - put_byte(amigamemptr + i, 0); + res->Modes[TRUECOLOR] = amigamemptr; + break; + default: + res->Modes[TRUEALPHA] = amigamemptr; + break; + } + trap_set_bytes(ctx, amigamemptr, 0, PSSO_ModeInfo_sizeof); - put_word(amigamemptr + PSSO_ModeInfo_Width, width); - put_word(amigamemptr + PSSO_ModeInfo_Height, height); - put_byte(amigamemptr + PSSO_ModeInfo_Depth, depth); - put_byte(amigamemptr + PSSO_ModeInfo_Flags, 0); - put_word(amigamemptr + PSSO_ModeInfo_HorTotal, width); - put_word(amigamemptr + PSSO_ModeInfo_HorBlankSize, 1); - put_word(amigamemptr + PSSO_ModeInfo_HorSyncStart, 0); - put_word(amigamemptr + PSSO_ModeInfo_HorSyncSize, 1); - put_byte(amigamemptr + PSSO_ModeInfo_HorSyncSkew, 0); - put_byte(amigamemptr + PSSO_ModeInfo_HorEnableSkew, 0); + trap_put_word(ctx, amigamemptr + PSSO_ModeInfo_Width, width); + trap_put_word(ctx, amigamemptr + PSSO_ModeInfo_Height, height); + trap_put_byte(ctx, amigamemptr + PSSO_ModeInfo_Depth, depth); + trap_put_byte(ctx, amigamemptr + PSSO_ModeInfo_Flags, 0); + trap_put_word(ctx, amigamemptr + PSSO_ModeInfo_HorTotal, width); + trap_put_word(ctx, amigamemptr + PSSO_ModeInfo_HorBlankSize, 1); + trap_put_word(ctx, amigamemptr + PSSO_ModeInfo_HorSyncStart, 0); + trap_put_word(ctx, amigamemptr + PSSO_ModeInfo_HorSyncSize, 1); + trap_put_byte(ctx, amigamemptr + PSSO_ModeInfo_HorSyncSkew, 0); + trap_put_byte(ctx, amigamemptr + PSSO_ModeInfo_HorEnableSkew, 0); - put_word(amigamemptr + PSSO_ModeInfo_VerTotal, height); - put_word(amigamemptr + PSSO_ModeInfo_VerBlankSize, 1); - put_word(amigamemptr + PSSO_ModeInfo_VerSyncStart, 0); - put_word(amigamemptr + PSSO_ModeInfo_VerSyncSize, 1); + trap_put_word(ctx, amigamemptr + PSSO_ModeInfo_VerTotal, height); + trap_put_word(ctx, amigamemptr + PSSO_ModeInfo_VerBlankSize, 1); + trap_put_word(ctx, amigamemptr + PSSO_ModeInfo_VerSyncStart, 0); + trap_put_word(ctx, amigamemptr + PSSO_ModeInfo_VerSyncSize, 1); - put_byte(amigamemptr + PSSO_ModeInfo_first_union, 98); - put_byte(amigamemptr + PSSO_ModeInfo_second_union, 14); + trap_put_byte(ctx, amigamemptr + PSSO_ModeInfo_first_union, 98); + trap_put_byte(ctx, amigamemptr + PSSO_ModeInfo_second_union, 14); - put_long(amigamemptr + PSSO_ModeInfo_PixelClock, - width * height * (currprefs.ntscmode ? 60 : 50)); + trap_put_long(ctx, amigamemptr + PSSO_ModeInfo_PixelClock, + width * height * defaultHz); } -struct modeids -{ - int width, height; - int id; +struct modeids { + int width, height; + int id; }; - static struct modeids mi[] = { - /* "original" modes */ + /* "original" modes */ - 320, 200, 0, - 320, 240, 1, - 640, 400, 2, - 640, 480, 3, - 800, 600, 4, - 1024, 768, 5, - 1152, 864, 6, - 1280,1024, 7, - 1600,1280, 8, - 320, 256, 9, - 640, 512,10, + 320, 200, 0, + 320, 240, 1, + 640, 400, 2, + 640, 480, 3, + 800, 600, 4, + 1024, 768, 5, + 1152, 864, 6, + 1280,1024, 7, + 1600,1280, 8, + 320, 256, 9, + 640, 512,10, - /* new modes */ + /* new modes */ 704, 480, 129, 704, 576, 130, @@ -1450,9 +1442,6 @@ static int AssignModeID(int w, int h, int *unkcnt) { int i; -#ifdef NEWMODES2 - return 0x40000000 | (w << 14) | h; -#endif for (i = 0; mi[i].width > 0; i++) { if (w == mi[i].width && h == mi[i].height) return 0x50001000 | (mi[i].id * 0x10000); @@ -1474,34 +1463,31 @@ static int AssignModeID(int w, int h, int *unkcnt) static uaecptr picasso96_amem, picasso96_amemend; -static void CopyLibResolutionStructureU2A(struct LibResolution* libres, uaecptr amigamemptr) +static void CopyLibResolutionStructureU2A(TrapContext *ctx, struct LibResolution *libres, uaecptr amigamemptr) { int i; - for (i = 0; i < PSSO_LibResolution_sizeof; i++) - put_byte(amigamemptr + i, 0); + trap_set_bytes(ctx, amigamemptr, 0, PSSO_LibResolution_sizeof); for (i = 0; i < strlen(libres->P96ID); i++) - put_byte(amigamemptr + PSSO_LibResolution_P96ID + i, libres->P96ID[i]); - put_long(amigamemptr + PSSO_LibResolution_DisplayID, libres->DisplayID); - put_word(amigamemptr + PSSO_LibResolution_Width, libres->Width); - put_word(amigamemptr + PSSO_LibResolution_Height, libres->Height); - put_word(amigamemptr + PSSO_LibResolution_Flags, libres->Flags); + trap_put_byte(ctx, amigamemptr + PSSO_LibResolution_P96ID + i, libres->P96ID[i]); + trap_put_long(ctx, amigamemptr + PSSO_LibResolution_DisplayID, libres->DisplayID); + trap_put_word(ctx, amigamemptr + PSSO_LibResolution_Width, libres->Width); + trap_put_word(ctx, amigamemptr + PSSO_LibResolution_Height, libres->Height); + trap_put_word(ctx, amigamemptr + PSSO_LibResolution_Flags, libres->Flags); for (i = 0; i < MAXMODES; i++) - put_long(amigamemptr + PSSO_LibResolution_Modes + i * 4, libres->Modes[i]); - put_long(amigamemptr + 10, amigamemptr + PSSO_LibResolution_P96ID); - put_long(amigamemptr + PSSO_LibResolution_BoardInfo, libres->BoardInfo); + trap_put_long(ctx, amigamemptr + PSSO_LibResolution_Modes + i * 4, libres->Modes[i]); + trap_put_long(ctx, amigamemptr + 10, amigamemptr + PSSO_LibResolution_P96ID); + trap_put_long(ctx, amigamemptr + PSSO_LibResolution_BoardInfo, libres->BoardInfo); } -static void init_alloc(TrapContext* ctx, int size) +static void init_alloc(TrapContext *ctx, int size) { picasso96_amem = picasso96_amemend = 0; - if (uaegfx_base) - { - int size = get_long(uaegfx_base + CARD_RESLISTSIZE); - picasso96_amem = get_long(uaegfx_base + CARD_RESLIST); + if (uaegfx_base) { + int size = trap_get_long(ctx, uaegfx_base + CARD_RESLISTSIZE); + picasso96_amem = trap_get_long(ctx, uaegfx_base + CARD_RESLIST); } - else if (uaegfx_active) - { + else if (uaegfx_active) { reserved_gfxmem = size; picasso96_amem = gfxmem_bank.start + gfxmem_bank.allocated_size - size; } @@ -1527,22 +1513,37 @@ static int p96depth(int depth) return ok; } -static int missmodes[] = { 320, 200, 320, 240, 320, 256, 640, 400, 640, 480, 640, 512, 800, 600, 1024, 768, 1280, 1024, -1 }; +static int resolution_compare(const void *a, const void *b) +{ + struct PicassoResolution *ma = (struct PicassoResolution *)a; + struct PicassoResolution *mb = (struct PicassoResolution *)b; + if (ma->res.width < mb->res.width) + return -1; + if (ma->res.width > mb->res.width) + return 1; + if (ma->res.height < mb->res.height) + return -1; + if (ma->res.height > mb->res.height) + return 1; + return ma->depth - mb->depth; +} -static uaecptr uaegfx_card_install(TrapContext* ctx, uae_u32 size); +static int missmodes[] = { 640, 400, 640, 480, 800, 480, -1 }; -static void picasso96_alloc2(TrapContext* ctx) +static uaecptr uaegfx_card_install(TrapContext *ctx, uae_u32 size); + +static void picasso96_alloc2(TrapContext *ctx) { int i, j, size, cnt; int misscnt, depths; - xfree (newmodes); - newmodes = nullptr; + xfree(newmodes); + newmodes = NULL; picasso96_amem = picasso96_amemend = 0; if (gfxmem_bank.allocated_size == 0) return; misscnt = 0; - newmodes = xmalloc (struct PicassoResolution, MAX_PICASSO_MODES); + newmodes = xmalloc(struct PicassoResolution, MAX_PICASSO_MODES); size = 0; depths = 0; @@ -1558,12 +1559,9 @@ static void picasso96_alloc2(TrapContext* ctx) depths++; i = 0; - while (DisplayModes[i].depth >= 0) - { - for (j = 0; missmodes[j * 2] >= 0; j++) - { - if (DisplayModes[i].res.width == missmodes[j * 2 + 0] && DisplayModes[i].res.height == missmodes[j * 2 + 1]) - { + while (DisplayModes[i].depth >= 0) { + for (j = 0; missmodes[j * 2] >= 0; j++) { + if (DisplayModes[i].res.width == missmodes[j * 2 + 0] && DisplayModes[i].res.height == missmodes[j * 2 + 1]) { missmodes[j * 2 + 0] = 0; missmodes[j * 2 + 1] = 0; } @@ -1573,20 +1571,17 @@ static void picasso96_alloc2(TrapContext* ctx) cnt = 0; i = 0; - while (DisplayModes[i].depth >= 0) - { + while (DisplayModes[i].depth >= 0) { j = i; size += PSSO_LibResolution_sizeof; while (missmodes[misscnt * 2] == 0) misscnt++; - if (missmodes[misscnt * 2] >= 0) - { + if (missmodes[misscnt * 2] >= 0) { int w = DisplayModes[i].res.width; int h = DisplayModes[i].res.height; - if (w > missmodes[misscnt * 2 + 0] || (w == missmodes[misscnt * 2 + 0] && h > missmodes[misscnt * 2 + 1])) - { - struct PicassoResolution* pr = &newmodes[cnt]; - memcpy(pr, &DisplayModes[i], sizeof (struct PicassoResolution)); + if (w > missmodes[misscnt * 2 + 0] || (w == missmodes[misscnt * 2 + 0] && h > missmodes[misscnt * 2 + 1])) { + struct PicassoResolution *pr = &newmodes[cnt]; + memcpy(pr, &DisplayModes[i], sizeof(struct PicassoResolution)); pr->res.width = missmodes[misscnt * 2 + 0]; pr->res.height = missmodes[misscnt * 2 + 1]; _stprintf(pr->name, _T("%dx%d FAKE"), pr->res.width, pr->res.height); @@ -1596,31 +1591,24 @@ static void picasso96_alloc2(TrapContext* ctx) continue; } } - memcpy(&newmodes[cnt], &DisplayModes[i], sizeof (struct PicassoResolution)); + memcpy(&newmodes[cnt], &DisplayModes[i], sizeof(struct PicassoResolution)); size += PSSO_ModeInfo_sizeof * depths; - i++; cnt++; - while (DisplayModes[i].depth >= 0 - && DisplayModes[i].res.width == DisplayModes[j].res.width - && DisplayModes[i].res.height == DisplayModes[j].res.height) - i++; + i++; } + qsort(newmodes, cnt, sizeof(struct PicassoResolution), resolution_compare); - for (i = 0; Displays[i].name; i++) - { + for (i = 0; Displays[i].name; i++) { size += PSSO_ModeInfo_sizeof * depths; } newmodes[cnt].depth = -1; - for (i = 0; i < cnt; i++) - { + for (i = 0; i < cnt; i++) { int depth; - for (depth = 8; depth <= 32; depth++) - { + for (depth = 8; depth <= 32; depth++) { if (!p96depth(depth)) continue; - switch (depth) - { + switch (depth) { case 1: if (newmodes[i].res.width > chunky.width) chunky.width = newmodes[i].res.width; @@ -1653,7 +1641,7 @@ static void picasso96_alloc2(TrapContext* ctx) init_alloc(ctx, size); } -void picasso96_alloc(TrapContext* ctx) +void picasso96_alloc(TrapContext *ctx) { if (uaegfx_old) return; @@ -1661,80 +1649,84 @@ void picasso96_alloc(TrapContext* ctx) picasso96_alloc2(ctx); } -static void inituaegfxfuncs(uaecptr start, uaecptr ABI); - -static void inituaegfx(uaecptr ABI) +static void inituaegfxfuncs(TrapContext *ctx, uaecptr start, uaecptr ABI); +static void inituaegfx(TrapContext *ctx, uaecptr ABI) { uae_u32 flags; - write_log (_T("RTG mode mask: %x\n"), currprefs.picasso96_modeflags); - put_word(ABI + PSSO_BoardInfo_BitsPerCannon, 8); - put_word(ABI + PSSO_BoardInfo_RGBFormats, currprefs.picasso96_modeflags); - put_long(ABI + PSSO_BoardInfo_BoardType, picasso96_BT); - put_long(ABI + PSSO_BoardInfo_GraphicsControllerType, picasso96_GCT); - put_long(ABI + PSSO_BoardInfo_PaletteChipType, picasso96_PCT); - put_long(ABI + PSSO_BoardInfo_BoardName, uaegfx_resname); - put_long(ABI + PSSO_BoardInfo_BoardType, 1); + write_log(_T("RTG mode mask: %x\n"), currprefs.picasso96_modeflags); + trap_put_word(ctx, ABI + PSSO_BoardInfo_BitsPerCannon, 8); + trap_put_word(ctx, ABI + PSSO_BoardInfo_RGBFormats, currprefs.picasso96_modeflags); + trap_put_long(ctx, ABI + PSSO_BoardInfo_BoardType, picasso96_BT); + trap_put_long(ctx, ABI + PSSO_BoardInfo_GraphicsControllerType, picasso96_GCT); + trap_put_long(ctx, ABI + PSSO_BoardInfo_PaletteChipType, picasso96_PCT); + trap_put_long(ctx, ABI + PSSO_BoardInfo_BoardName, uaegfx_resname); + trap_put_long(ctx, ABI + PSSO_BoardInfo_BoardType, 1); + + trap_put_long(ctx, ABI + PSSO_BoardInfo_MemoryClock, 100000000); /* only 1 clock */ - put_long(ABI + PSSO_BoardInfo_PixelClockCount + PLANAR * 4, 1); - put_long(ABI + PSSO_BoardInfo_PixelClockCount + CHUNKY * 4, 1); - put_long(ABI + PSSO_BoardInfo_PixelClockCount + HICOLOR * 4, 1); - put_long(ABI + PSSO_BoardInfo_PixelClockCount + TRUECOLOR * 4, 1); - put_long(ABI + PSSO_BoardInfo_PixelClockCount + TRUEALPHA * 4, 1); + trap_put_long(ctx, ABI + PSSO_BoardInfo_PixelClockCount + PLANAR * 4, 1); + trap_put_long(ctx, ABI + PSSO_BoardInfo_PixelClockCount + CHUNKY * 4, 1); + trap_put_long(ctx, ABI + PSSO_BoardInfo_PixelClockCount + HICOLOR * 4, 1); + trap_put_long(ctx, ABI + PSSO_BoardInfo_PixelClockCount + TRUECOLOR * 4, 1); + trap_put_long(ctx, ABI + PSSO_BoardInfo_PixelClockCount + TRUEALPHA * 4, 1); /* we have 16 bits for horizontal and vertical timings - hack */ - put_word(ABI + PSSO_BoardInfo_MaxHorValue + PLANAR * 2, 0xffff); - put_word(ABI + PSSO_BoardInfo_MaxHorValue + CHUNKY * 2, 0xffff); - put_word(ABI + PSSO_BoardInfo_MaxHorValue + HICOLOR * 2, 0xffff); - put_word(ABI + PSSO_BoardInfo_MaxHorValue + TRUECOLOR * 2, 0xffff); - put_word(ABI + PSSO_BoardInfo_MaxHorValue + TRUEALPHA * 2, 0xffff); - put_word(ABI + PSSO_BoardInfo_MaxVerValue + PLANAR * 2, 0xffff); - put_word(ABI + PSSO_BoardInfo_MaxVerValue + CHUNKY * 2, 0xffff); - put_word(ABI + PSSO_BoardInfo_MaxVerValue + HICOLOR * 2, 0xffff); - put_word(ABI + PSSO_BoardInfo_MaxVerValue + TRUECOLOR * 2, 0xffff); - put_word(ABI + PSSO_BoardInfo_MaxVerValue + TRUEALPHA * 2, 0xffff); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxHorValue + PLANAR * 2, 0x4000); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxHorValue + CHUNKY * 2, 0x4000); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxHorValue + HICOLOR * 2, 0x4000); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxHorValue + TRUECOLOR * 2, 0x4000); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxHorValue + TRUEALPHA * 2, 0x4000); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxVerValue + PLANAR * 2, 0x4000); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxVerValue + CHUNKY * 2, 0x4000); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxVerValue + HICOLOR * 2, 0x4000); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxVerValue + TRUECOLOR * 2, 0x4000); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxVerValue + TRUEALPHA * 2, 0x4000); - flags = get_long(ABI + PSSO_BoardInfo_Flags); + flags = trap_get_long(ctx, ABI + PSSO_BoardInfo_Flags); flags &= 0xffff0000; if (flags & BIF_NOBLITTER) write_log(_T("P96: Blitter disabled in devs:monitors/uaegfx!\n")); - flags |= BIF_BLITTER | BIF_NOMEMORYMODEMIX; + if (NOBLITTER_ALL) { + flags |= BIF_NOBLITTER; + flags &= ~BIF_BLITTER; + } + else { + flags |= BIF_BLITTER; + } + flags |= BIF_NOMEMORYMODEMIX; flags &= ~BIF_HARDWARESPRITE; if (!uaegfx_old) flags |= BIF_VBLANKINTERRUPT; - if (!(flags & BIF_INDISPLAYCHAIN)) - { - write_log (_T("P96: BIF_INDISPLAYCHAIN force-enabled!\n")); + if (!(flags & BIF_INDISPLAYCHAIN)) { + write_log(_T("P96: BIF_INDISPLAYCHAIN force-enabled!\n")); flags |= BIF_INDISPLAYCHAIN; } + trap_put_long(ctx, ABI + PSSO_BoardInfo_Flags, flags); - put_long(ABI + PSSO_BoardInfo_Flags, flags); - - put_word(ABI + PSSO_BoardInfo_MaxHorResolution + 0, planar.width); - put_word(ABI + PSSO_BoardInfo_MaxHorResolution + 2, chunky.width); - put_word(ABI + PSSO_BoardInfo_MaxHorResolution + 4, hicolour.width); - put_word(ABI + PSSO_BoardInfo_MaxHorResolution + 6, truecolour.width); - put_word(ABI + PSSO_BoardInfo_MaxHorResolution + 8, alphacolour.width); - put_word(ABI + PSSO_BoardInfo_MaxVerResolution + 0, planar.height); - put_word(ABI + PSSO_BoardInfo_MaxVerResolution + 2, chunky.height); - put_word(ABI + PSSO_BoardInfo_MaxVerResolution + 4, hicolour.height); - put_word(ABI + PSSO_BoardInfo_MaxVerResolution + 6, truecolour.height); - put_word(ABI + PSSO_BoardInfo_MaxVerResolution + 8, alphacolour.height); - inituaegfxfuncs(uaegfx_rom, ABI); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxHorResolution + 0, planar.width); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxHorResolution + 2, chunky.width); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxHorResolution + 4, hicolour.width); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxHorResolution + 6, truecolour.width); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxHorResolution + 8, alphacolour.width); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxVerResolution + 0, planar.height); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxVerResolution + 2, chunky.height); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxVerResolution + 4, hicolour.height); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxVerResolution + 6, truecolour.height); + trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxVerResolution + 8, alphacolour.height); + inituaegfxfuncs(ctx, uaegfx_rom, ABI); } -static void addmode(uaecptr AmigaBoardInfo, uaecptr* amem, struct LibResolution* res, int w, int h, const TCHAR* name, int display, int* unkcnt) +static void addmode(TrapContext *ctx, uaecptr AmigaBoardInfo, uaecptr *amem, struct LibResolution *res, int w, int h, const TCHAR *name, int display, int *unkcnt) { int depth; - if (display > 0) - { + if (display > 0) { res->DisplayID = 0x51000000 + display * 0x100000; } - else - { + else { res->DisplayID = AssignModeID(w, h, unkcnt); } res->BoardInfo = AmigaBoardInfo; @@ -1742,24 +1734,20 @@ static void addmode(uaecptr AmigaBoardInfo, uaecptr* amem, struct LibResolution* res->Height = h; res->Flags = P96F_PUBLIC; memcpy(res->P96ID, "P96-0:", 6); - if (name) - { - char* n2 = ua(name); - strcpy(res->Name, n2); - xfree (n2); + if (name) { + char *n2 = ua(name); + strncpy(res->Name, n2, MAXRESOLUTIONNAMELENGTH); + xfree(n2); } - else - { + else { sprintf(res->Name, "UAE:%4dx%4d", w, h); } - for (depth = 8; depth <= 32; depth++) - { + for (depth = 8; depth <= 32; depth++) { if (!p96depth(depth)) continue; - if (gfxmem_bank.allocated_size >= w * h * (depth + 7) / 8) - { - FillBoardInfo(*amem, res, w, h, depth); + if (gfxmem_bank.allocated_size >= w * h * (depth + 7) / 8) { + FillBoardInfo(ctx, *amem, res, w, h, depth); *amem += PSSO_ModeInfo_sizeof; } } @@ -1771,45 +1759,43 @@ static void addmode(uaecptr AmigaBoardInfo, uaecptr* amem, struct LibResolution* * a2: BoardInfo structure ptr - Amiga-based address in Intel endian-format * */ -static uae_u32 REGPARAM2 picasso_InitCard(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_InitCard(TrapContext *ctx) { int LibResolutionStructureCount = 0; int i, j, unkcnt, cnt; uaecptr amem; - uaecptr AmigaBoardInfo = m68k_areg (regs, 0); + uaecptr AmigaBoardInfo = trap_get_areg(ctx, 0); - if (!picasso96_amem) - { - write_log (_T("P96: InitCard() but no resolution memory!\n")); + if (!picasso96_amem) { + write_log(_T("P96: InitCard() but no resolution memory!\n")); return 0; } amem = picasso96_amem; - inituaegfx(AmigaBoardInfo); + inituaegfx(ctx, AmigaBoardInfo); i = 0; unkcnt = cnt = 0; - while (newmodes[i].depth >= 0) - { - struct LibResolution res = {0}; - TCHAR* s; + while (newmodes[i].depth >= 0) { + struct LibResolution res = { 0 }; + TCHAR *s; j = i; - addmode(AmigaBoardInfo, &amem, &res, newmodes[i].res.width, newmodes[i].res.height, nullptr, 0, &unkcnt); + addmode(ctx, AmigaBoardInfo, &amem, &res, newmodes[i].res.width, newmodes[i].res.height, NULL, 0, &unkcnt); s = au(res.Name); - write_log (_T("%2d: %08X %4dx%4d %s\n"), ++cnt, res.DisplayID, res.Width, res.Height, s); - xfree (s); + write_log(_T("%2d: %08X %4dx%4d %s\n"), ++cnt, res.DisplayID, res.Width, res.Height, s); + xfree(s); while (newmodes[i].depth >= 0 && newmodes[i].res.width == newmodes[j].res.width && newmodes[i].res.height == newmodes[j].res.height) i++; LibResolutionStructureCount++; - CopyLibResolutionStructureU2A(&res, amem); + CopyLibResolutionStructureU2A(ctx, &res, amem); #if P96TRACING_ENABLED && P96TRACING_LEVEL > 1 - DumpLibResolutionStructure(amem); + DumpLibResolutionStructure(ctx, amem); #endif - AmigaListAddTail(AmigaBoardInfo + PSSO_BoardInfo_ResolutionsList, amem); + AmigaListAddTail(ctx, AmigaBoardInfo + PSSO_BoardInfo_ResolutionsList, amem); amem += PSSO_LibResolution_sizeof; } @@ -1831,28 +1817,25 @@ static uae_u32 REGPARAM2 picasso_InitCard(TrapContext* ctx) * * NOTE: Return the opposite of the switch-state. BDK */ -static uae_u32 REGPARAM2 picasso_SetSwitch(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_SetSwitch(TrapContext *ctx) { - uae_u16 flag = m68k_dreg (regs, 0) & 0xFFFF; - TCHAR p96text[100]; + uae_u16 flag = trap_get_dreg(ctx, 0) & 0xFFFF; - /* Do not switch immediately. Tell the custom chip emulation about the - * desired state, and wait for custom.c to call picasso_enablescreen - * whenever it is ready to change the screen state. */ + atomic_or(&picasso_state_change, PICASSO_STATE_SETSWITCH); picasso_requested_on = flag != 0; + + TCHAR p96text[100]; p96text[0] = 0; if (flag) - _stprintf(p96text, _T("Picasso96 %dx%dx%d (%dx%dx%d)"), - picasso96_state.Width, picasso96_state.Height, picasso96_state.BytesPerPixel * 8, - picasso_vidinfo.width, picasso_vidinfo.height, picasso_vidinfo.pixbytes * 8); - write_log (_T("SetSwitch() - %s\n"), flag ? p96text : _T("amiga")); + _stprintf(p96text, _T("Picasso96 %dx%dx%d (%dx%dx%d)"), + picasso96_state_uaegfx.Width, picasso96_state_uaegfx.Height, picasso96_state_uaegfx.BytesPerPixel * 8, + picasso_vidinfo.width, picasso_vidinfo.height, picasso_vidinfo.pixbytes * 8); + write_log(_T("SetSwitch() - %s\n"), flag ? p96text : _T("amiga")); /* Put old switch-state in D0 */ return !flag; } -static void init_picasso_screen(); - void picasso_enablescreen(int on) { if (!init_picasso_screen_called) @@ -1862,10 +1845,10 @@ void picasso_enablescreen(int on) picasso_refresh(); } -static void resetpalette() +static void resetpalette(void) { for (int i = 0; i < 256; i++) - picasso96_state.CLUT[i].Pad = 0xff; + picasso96_state_uaegfx.CLUT[i].Pad = 0xff; } /* @@ -1880,45 +1863,43 @@ static void resetpalette() * per cannon your board has. So you might have to shift the colors * before writing them to the hardware. */ -static int updateclut(uaecptr clut, int start, int count) +static int updateclut(TrapContext *ctx, uaecptr clut, int start, int count) { + uae_u8 clutbuf[256 * 3]; int i, changed = 0; clut += start * 3; - for (i = start; i < start + count; i++) - { - int r = get_byte(clut); - int g = get_byte(clut + 1); - int b = get_byte(clut + 2); + trap_get_bytes(ctx, clutbuf + start * 3, clut, count * 3); + for (i = start; i < start + count; i++) { + int r = clutbuf[i * 3 + 0]; + int g = clutbuf[i * 3 + 1]; + int b = clutbuf[i * 3 + 2]; - changed |= picasso96_state.CLUT[i].Red != r - || picasso96_state.CLUT[i].Green != g - || picasso96_state.CLUT[i].Blue != b; - if (picasso96_state.CLUT[i].Pad) - { + changed |= picasso96_state_uaegfx.CLUT[i].Red != r + || picasso96_state_uaegfx.CLUT[i].Green != g + || picasso96_state_uaegfx.CLUT[i].Blue != b; + if (picasso96_state_uaegfx.CLUT[i].Pad) { changed = 1; - picasso96_state.CLUT[i].Pad = 0; + picasso96_state_uaegfx.CLUT[i].Pad = 0; } - picasso96_state.CLUT[i].Red = r; - picasso96_state.CLUT[i].Green = g; - picasso96_state.CLUT[i].Blue = b; - clut += 3; + picasso96_state_uaegfx.CLUT[i].Red = r; + picasso96_state_uaegfx.CLUT[i].Green = g; + picasso96_state_uaegfx.CLUT[i].Blue = b; } - changed |= picasso_palette(); + changed |= picasso_palette(picasso96_state.CLUT); return changed; } - -static uae_u32 REGPARAM2 picasso_SetColorArray(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_SetColorArray(TrapContext *ctx) { /* Fill in some static UAE related structure about this new CLUT setting - * We need this for CLUT-based displays, and for mapping CLUT to hi/true colour */ - uae_u16 start = m68k_dreg (regs, 0); - uae_u16 count = m68k_dreg (regs, 1); - uaecptr boardinfo = m68k_areg (regs, 0); + * We need this for CLUT-based displays, and for mapping CLUT to hi/true colour */ + uae_u16 start = trap_get_dreg(ctx, 0); + uae_u16 count = trap_get_dreg(ctx, 1); + uaecptr boardinfo = trap_get_areg(ctx, 0); uaecptr clut = boardinfo + PSSO_BoardInfo_CLUT; - if (start > 256 || start + count > 256) + if (start > 256 || count > 256 || start + count > 256) return 0; - updateclut(clut, start, count); - P96TRACE((_T("SetColorArray(%d,%d)\n"), start, count)); + updateclut(ctx, clut, start, count); + P96TRACE_SETUP((_T("SetColorArray(%d,%d)\n"), start, count)); return 1; } @@ -1930,35 +1911,35 @@ static uae_u32 REGPARAM2 picasso_SetColorArray(TrapContext* ctx) * e.g. from chunky to TrueColor. Usually, all you have to do is to set * the RAMDAC of your board accordingly. */ -static uae_u32 REGPARAM2 picasso_SetDAC(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_SetDAC(TrapContext *ctx) { /* Fill in some static UAE related structure about this new DAC setting * Lets us keep track of what pixel format the Amiga is thinking about in our frame-buffer */ - P96TRACE((_T("SetDAC()\n"))); + atomic_or(&picasso_state_change, PICASSO_STATE_SETDAC); + P96TRACE_SETUP((_T("SetDAC()\n"))); return 1; } -static void init_picasso_screen() +static void init_picasso_screen(void) { - if (set_panning_called) - { - picasso96_state.Extent = picasso96_state.Address + picasso96_state.BytesPerRow * picasso96_state.VirtualHeight; + if (set_panning_called) { + picasso96_state_uaegfx.Extent = picasso96_state_uaegfx.Address + picasso96_state_uaegfx.BytesPerRow * picasso96_state_uaegfx.VirtualHeight; } - if (set_gc_called) - { - gfx_set_picasso_modeinfo(picasso96_state.Width, picasso96_state.Height, - picasso96_state.GC_Depth, RGBFTYPE(picasso96_state.RGBFormat)); + if (set_gc_called) { + gfx_set_picasso_modeinfo(picasso96_state_uaegfx.Width, picasso96_state_uaegfx.Height, + picasso96_state_uaegfx.GC_Depth, (RGBFTYPE)picasso96_state_uaegfx.RGBFormat); set_gc_called = 0; } - if ((picasso_vidinfo.width == picasso96_state.Width) && - (picasso_vidinfo.height == picasso96_state.Height) && - (picasso_vidinfo.depth == (picasso96_state.GC_Depth >> 3)) && - (picasso_vidinfo.selected_rgbformat == picasso96_state.RGBFormat)) + if ((picasso_vidinfo.width == picasso96_state_uaegfx.Width) && + (picasso_vidinfo.height == picasso96_state_uaegfx.Height) && + (picasso_vidinfo.depth == (picasso96_state_uaegfx.GC_Depth >> 3)) && + (picasso_vidinfo.selected_rgbformat == picasso96_state_uaegfx.RGBFormat)) { picasso_refresh(); } init_picasso_screen_called = 1; + } /* @@ -1972,31 +1953,31 @@ static void init_picasso_screen() * or linear start adress. They will be set when appropriate by their * own functions. */ -static uae_u32 REGPARAM2 picasso_SetGC(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_SetGC(TrapContext *ctx) { /* Fill in some static UAE related structure about this new ModeInfo setting */ - uaecptr AmigaBoardInfo = m68k_areg (regs, 0); - uae_u32 border = m68k_dreg (regs, 0); - uaecptr modeinfo = m68k_areg (regs, 1); + uaecptr AmigaBoardInfo = trap_get_areg(ctx, 0); + uae_u32 border = trap_get_dreg(ctx, 0); + uaecptr modeinfo = trap_get_areg(ctx, 1); - put_long(AmigaBoardInfo + PSSO_BoardInfo_ModeInfo, modeinfo); - put_word(AmigaBoardInfo + PSSO_BoardInfo_Border, border); + trap_put_long(ctx, AmigaBoardInfo + PSSO_BoardInfo_ModeInfo, modeinfo); + trap_put_word(ctx, AmigaBoardInfo + PSSO_BoardInfo_Border, border); - picasso96_state.Width = get_word(modeinfo + PSSO_ModeInfo_Width); - picasso96_state.VirtualWidth = picasso96_state.Width; /* in case SetPanning doesn't get called */ + picasso96_state_uaegfx.Width = trap_get_word(ctx, modeinfo + PSSO_ModeInfo_Width); + picasso96_state_uaegfx.VirtualWidth = picasso96_state_uaegfx.Width; /* in case SetPanning doesn't get called */ - picasso96_state.Height = get_word(modeinfo + PSSO_ModeInfo_Height); - picasso96_state.VirtualHeight = picasso96_state.Height; /* in case SetPanning doesn't get called */ + picasso96_state_uaegfx.Height = trap_get_word(ctx, modeinfo + PSSO_ModeInfo_Height); + picasso96_state_uaegfx.VirtualHeight = picasso96_state_uaegfx.Height; /* in case SetPanning doesn't get called */ - picasso96_state.GC_Depth = get_byte(modeinfo + PSSO_ModeInfo_Depth); - picasso96_state.GC_Flags = get_byte(modeinfo + PSSO_ModeInfo_Flags); + picasso96_state_uaegfx.GC_Depth = trap_get_byte(ctx, modeinfo + PSSO_ModeInfo_Depth); + picasso96_state_uaegfx.GC_Flags = trap_get_byte(ctx, modeinfo + PSSO_ModeInfo_Flags); - P96TRACE((_T("SetGC(%d,%d,%d,%d)\n"), picasso96_state.Width, picasso96_state.Height, picasso96_state.GC_Depth, border)); - set_gc_called = 1; - picasso96_state.HostAddress = nullptr; + P96TRACE_SETUP((_T("SetGC(%d,%d,%d,%d)\n"), picasso96_state_uaegfx.Width, picasso96_state_uaegfx.Height, picasso96_state_uaegfx.GC_Depth, border)); + + picasso96_state_uaegfx.HostAddress = NULL; + + atomic_or(&picasso_state_change, PICASSO_STATE_SETGC); - init_picasso_screen(); - init_hz_p96(); return 1; } @@ -2023,82 +2004,73 @@ static uae_u32 REGPARAM2 picasso_SetGC(TrapContext* ctx) * because SetSwitch() is not called for subsequent Picasso screens. */ -static void picasso_SetPanningInit() +static void picasso_SetPanningInit(void) { - picasso96_state.XYOffset = picasso96_state.Address + picasso96_state.XOffset * picasso96_state.BytesPerPixel - + picasso96_state.YOffset * picasso96_state.BytesPerRow; - if (picasso96_state_uaegfx.VirtualWidth > picasso96_state_uaegfx.Width || picasso96_state_uaegfx.VirtualHeight > picasso96_state_uaegfx.Height) - picasso96_state_uaegfx.BigAssBitmap = 1; - else - picasso96_state_uaegfx.BigAssBitmap = 0; + picasso96_state_uaegfx.XYOffset = picasso96_state_uaegfx.Address + (picasso96_state_uaegfx.XOffset * picasso96_state_uaegfx.BytesPerPixel) + + (picasso96_state_uaegfx.YOffset * picasso96_state_uaegfx.BytesPerRow); } -static uae_u32 REGPARAM2 picasso_SetPanning(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_SetPanning(TrapContext *ctx) { - uae_u16 Width = m68k_dreg (regs, 0); - uaecptr start_of_screen = m68k_areg (regs, 1); - uaecptr bi = m68k_areg (regs, 0); - uaecptr bmeptr = get_long(bi + PSSO_BoardInfo_BitMapExtra); /* Get our BoardInfo ptr's BitMapExtra ptr */ + uae_u16 Width = trap_get_dreg(ctx, 0); + uaecptr start_of_screen = trap_get_areg(ctx, 1); + uaecptr bi = trap_get_areg(ctx, 0); + uaecptr bmeptr = trap_get_long(ctx, bi + PSSO_BoardInfo_BitMapExtra); /* Get our BoardInfo ptr's BitMapExtra ptr */ uae_u16 bme_width, bme_height; RGBFTYPE rgbf; - if (oldscr == 0) - { + if (oldscr == 0) { oldscr = start_of_screen; } - if (oldscr != start_of_screen) - { + if (oldscr != start_of_screen) { oldscr = start_of_screen; } - bme_width = get_word(bmeptr + PSSO_BitMapExtra_Width); - bme_height = get_word(bmeptr + PSSO_BitMapExtra_Height); - rgbf = picasso96_state.RGBFormat; + bme_width = trap_get_word(ctx, bmeptr + PSSO_BitMapExtra_Width); + bme_height = trap_get_word(ctx, bmeptr + PSSO_BitMapExtra_Height); + rgbf = (RGBFTYPE)picasso96_state_uaegfx.RGBFormat; - picasso96_state.Address = start_of_screen; /* Amiga-side address */ - picasso96_state.XOffset = uae_s16(m68k_dreg (regs, 1) & 0xFFFF); - picasso96_state.YOffset = uae_s16(m68k_dreg (regs, 2) & 0xFFFF); - put_word(bi + PSSO_BoardInfo_XOffset, picasso96_state.XOffset); - put_word(bi + PSSO_BoardInfo_YOffset, picasso96_state.YOffset); - picasso96_state.VirtualWidth = bme_width; - picasso96_state.VirtualHeight = bme_height; - picasso96_state.RGBFormat = (RGBFTYPE)m68k_dreg (regs, 7); - picasso96_state.BytesPerPixel = GetBytesPerPixel(picasso96_state.RGBFormat); - picasso96_state.BytesPerRow = picasso96_state.VirtualWidth * picasso96_state.BytesPerPixel; + picasso96_state_uaegfx.Address = start_of_screen; /* Amiga-side address */ + picasso96_state_uaegfx.XOffset = (uae_s16)(trap_get_dreg(ctx, 1) & 0xFFFF); + picasso96_state_uaegfx.YOffset = (uae_s16)(trap_get_dreg(ctx, 2) & 0xFFFF); + trap_put_word(ctx, bi + PSSO_BoardInfo_XOffset, picasso96_state_uaegfx.XOffset); + trap_put_word(ctx, bi + PSSO_BoardInfo_YOffset, picasso96_state_uaegfx.YOffset); + picasso96_state_uaegfx.VirtualWidth = bme_width; + picasso96_state_uaegfx.VirtualHeight = bme_height; + picasso96_state_uaegfx.RGBFormat = (RGBFTYPE)trap_get_dreg(ctx, 7); + picasso96_state_uaegfx.BytesPerPixel = GetBytesPerPixel(picasso96_state_uaegfx.RGBFormat); + picasso96_state_uaegfx.BytesPerRow = picasso96_state_uaegfx.VirtualWidth * picasso96_state_uaegfx.BytesPerPixel; picasso_SetPanningInit(); - if (rgbf != picasso96_state.RGBFormat) + if (rgbf != picasso96_state_uaegfx.RGBFormat) { setconvert(); + } - set_panning_called = 1; - P96TRACE((_T("SetPanning(%d, %d, %d) (%dx%d) Start 0x%x, BPR %d Bpp %d RGBF %d\n"), - Width, picasso96_state.XOffset, picasso96_state.YOffset, + P96TRACE_SETUP((_T("SetPanning(%d, %d, %d) (%dx%d) Start 0x%x, BPR %d Bpp %d RGBF %d\n"), + Width, picasso96_state_uaegfx.XOffset, picasso96_state_uaegfx.YOffset, bme_width, bme_height, - start_of_screen, picasso96_state.BytesPerRow, picasso96_state.BytesPerPixel, picasso96_state.RGBFormat)); - init_picasso_screen(); - set_panning_called = 0; + start_of_screen, picasso96_state_uaegfx.BytesPerRow, picasso96_state_uaegfx.BytesPerPixel, picasso96_state_uaegfx.RGBFormat)); + + atomic_or(&picasso_state_change, PICASSO_STATE_SETPANNING); return 1; } -static void do_xor8(uae_u8* p, int w, uae_u32 v) +static void do_xor8(uae_u8 *p, int w, uae_u32 v) { - while (ALIGN_POINTER_TO32 (p) != 3 && w) - { + while (ALIGN_POINTER_TO32(p) != 3 && w) { *p ^= v; p++; w--; } - while (w >= 2 * 4) - { - *reinterpret_cast(p) ^= v; + while (w >= 2 * 4) { + *((uae_u32*)p) ^= v; p += 4; - *reinterpret_cast(p) ^= v; + *((uae_u32*)p) ^= v; p += 4; w -= 2 * 4; } - while (w) - { + while (w) { *p ^= v; p++; w--; @@ -2121,15 +2093,15 @@ static void do_xor8(uae_u8* p, int w, uae_u32 v) * This function is used to invert a rectangular area on the board. It is called by BltBitMap, * BltPattern and BltTemplate. */ -static uae_u32 REGPARAM2 picasso_InvertRect(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_InvertRect(TrapContext *ctx) { - uaecptr renderinfo = m68k_areg (regs, 1); - unsigned long X = uae_u16(m68k_dreg (regs, 0)); - unsigned long Y = uae_u16(m68k_dreg (regs, 1)); - unsigned long Width = uae_u16(m68k_dreg (regs, 2)); - unsigned long Height = uae_u16(m68k_dreg (regs, 3)); - uae_u8 mask = uae_u8(m68k_dreg (regs, 4)); - int Bpp = GetBytesPerPixel(m68k_dreg (regs, 7)); + uaecptr renderinfo = trap_get_areg(ctx, 1); + uae_u32 X = (uae_u16)trap_get_dreg(ctx, 0); + uae_u32 Y = (uae_u16)trap_get_dreg(ctx, 1); + uae_u32 Width = (uae_u16)trap_get_dreg(ctx, 2); + uae_u32 Height = (uae_u16)trap_get_dreg(ctx, 3); + uae_u8 mask = (uae_u8)trap_get_dreg(ctx, 4); + int Bpp = GetBytesPerPixel(trap_get_dreg(ctx, 7)); uae_u32 xorval; unsigned int lines; struct RenderInfo ri; @@ -2139,18 +2111,20 @@ static uae_u32 REGPARAM2 picasso_InvertRect(TrapContext* ctx) if (NOBLITTER) return 0; - if (CopyRenderInfoStructureA2U(renderinfo, &ri)) - { + if (CopyRenderInfoStructureA2U(ctx, renderinfo, &ri)) { P96TRACE((_T("InvertRect %dbpp 0x%lx\n"), Bpp, (long)mask)); + if (!validatecoords(ctx, &ri, &X, &Y, &Width, &Height)) + return 1; + if (mask != 0xFF && Bpp > 1) mask = 0xFF; xorval = 0x01010101 * (mask & 0xFF); width_in_bytes = Bpp * Width; - rectstart = uae_mem = ri.Memory + Y * ri.BytesPerRow + X * Bpp; + rectstart = uae_mem = ri.Memory + Y*ri.BytesPerRow + X*Bpp; - for (lines = 0; lines < Height; lines++ , uae_mem += ri.BytesPerRow) + for (lines = 0; lines < Height; lines++, uae_mem += ri.BytesPerRow) do_xor8(uae_mem, width_in_bytes, xorval); result = 1; } @@ -2171,26 +2145,27 @@ FillRect: * d5: UBYTE Mask * d7: uae_u32 RGBFormat ***********************************************************/ -//__attribute__((optimize("O2"))) is needed otherwise this crashes with O3! -__attribute__((optimize("O2"))) static uae_u32 REGPARAM2 picasso_FillRect(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_FillRect(TrapContext *ctx) { - uaecptr renderinfo = m68k_areg(regs, 1); - uae_u32 X = uae_u16(m68k_dreg(regs, 0)); - uae_u32 Y = uae_u16(m68k_dreg(regs, 1)); - uae_u32 Width = uae_u16(m68k_dreg(regs, 2)); - uae_u32 Height = uae_u16(m68k_dreg(regs, 3)); - uae_u32 Pen = m68k_dreg(regs, 4); - uae_u8 Mask = uae_u8(m68k_dreg(regs, 5)); - RGBFTYPE RGBFormat = RGBFTYPE(m68k_dreg(regs, 7)); - uae_u8* oldstart; + uaecptr renderinfo = trap_get_areg(ctx, 1); + uae_u32 X = (uae_u16)trap_get_dreg(ctx, 0); + uae_u32 Y = (uae_u16)trap_get_dreg(ctx, 1); + uae_u32 Width = (uae_u16)trap_get_dreg(ctx, 2); + uae_u32 Height = (uae_u16)trap_get_dreg(ctx, 3); + uae_u32 Pen = trap_get_dreg(ctx, 4); + uae_u8 Mask = (uae_u8)trap_get_dreg(ctx, 5); + RGBFTYPE RGBFormat = (RGBFTYPE)trap_get_dreg(ctx, 7); + uae_u8 *oldstart; int Bpp; struct RenderInfo ri; uae_u32 result = 0; if (NOBLITTER) return 0; - if (CopyRenderInfoStructureA2U(renderinfo, &ri) && Y != 0xFFFF) - { + if (CopyRenderInfoStructureA2U(ctx, renderinfo, &ri) && Y != 0xFFFF) { + if (!validatecoords(ctx, &ri, &X, &Y, &Width, &Height)) + return 1; + Bpp = GetBytesPerPixel(RGBFormat); P96TRACE((_T("FillRect(%d, %d, %d, %d) Pen 0x%x BPP %d BPR %d Mask 0x%x\n"), @@ -2199,35 +2174,32 @@ __attribute__((optimize("O2"))) static uae_u32 REGPARAM2 picasso_FillRect(TrapCo if (Bpp > 1) Mask = 0xFF; - if (Mask == 0xFF) - { + if (Mask == 0xFF) { + /* Do the fill-rect in the frame-buffer */ do_fillrect_frame_buffer(&ri, X, Y, Width, Height, Pen, Bpp); result = 1; + } - else - { + else { + /* We get here only if Mask != 0xFF */ - if (Bpp != 1) - { + if (Bpp != 1) { write_log(_T("WARNING - FillRect() has unhandled mask 0x%x with Bpp %d. Using fall-back routine.\n"), Mask, Bpp); } - else - { + else { Pen &= Mask; Mask = ~Mask; oldstart = ri.Memory + Y * ri.BytesPerRow + X * Bpp; { - uae_u8* start = oldstart; - uae_u8* end = start + Height * ri.BytesPerRow; - for (; start != end; start += ri.BytesPerRow) - { - uae_u8* p = start; + uae_u8 *start = oldstart; + uae_u8 *end = start + Height * ri.BytesPerRow; + for (; start != end; start += ri.BytesPerRow) { + uae_u8 *p = start; unsigned long cols; - for (cols = 0; cols < Width; cols++) - { + for (cols = 0; cols < Width; cols++) { uae_u32 tmpval = do_get_mem_byte(p + cols) & Mask; - do_put_mem_byte(p + cols, uae_u8(Pen | tmpval)); + do_put_mem_byte(p + cols, (uae_u8)(Pen | tmpval)); } } } @@ -2264,8 +2236,8 @@ struct blitdata { struct RenderInfo ri_struct; struct RenderInfo dstri_struct; - struct RenderInfo* ri; /* Self-referencing pointers */ - struct RenderInfo* dstri; + struct RenderInfo *ri; /* Self-referencing pointers */ + struct RenderInfo *dstri; unsigned long srcx; unsigned long srcy; unsigned long dstx; @@ -2276,24 +2248,28 @@ struct blitdata BLIT_OPCODE opcode; } blitrectdata; -STATIC_INLINE int BlitRectHelper() +STATIC_INLINE int BlitRectHelper(TrapContext *ctx) { - struct RenderInfo* ri = blitrectdata.ri; - struct RenderInfo* dstri = blitrectdata.dstri; - unsigned long srcx = blitrectdata.srcx; - unsigned long srcy = blitrectdata.srcy; - unsigned long dstx = blitrectdata.dstx; - unsigned long dsty = blitrectdata.dsty; - unsigned long width = blitrectdata.width; - unsigned long height = blitrectdata.height; + struct RenderInfo *ri = blitrectdata.ri; + struct RenderInfo *dstri = blitrectdata.dstri; + uae_u32 srcx = blitrectdata.srcx; + uae_u32 srcy = blitrectdata.srcy; + uae_u32 dstx = blitrectdata.dstx; + uae_u32 dsty = blitrectdata.dsty; + uae_u32 width = blitrectdata.width; + uae_u32 height = blitrectdata.height; uae_u8 mask = blitrectdata.mask; BLIT_OPCODE opcode = blitrectdata.opcode; + if (!validatecoords(ctx, ri, &srcx, &srcy, &width, &height)) + return 1; + if (!validatecoords(ctx, dstri, &dstx, &dsty, &width, &height)) + return 1; + uae_u8 Bpp = GetBytesPerPixel(ri->RGBFormat); - if (opcode == BLIT_DST) - { - write_log ( _T("WARNING: BlitRect() being called with opcode of BLIT_DST\n") ); + if (opcode == BLIT_DST) { + write_log(_T("WARNING: BlitRect() being called with opcode of BLIT_DST\n")); return 1; } @@ -2305,8 +2281,7 @@ STATIC_INLINE int BlitRectHelper() * If we have a destination RenderInfo, then we've been called from picasso_BlitRectNoMaskComplete() * and we need to put the results on the screen from the frame-buffer. */ - if (dstri == nullptr || dstri->Memory == ri->Memory) - { + if (dstri == NULL || dstri->Memory == ri->Memory) { if (mask != 0xFF && Bpp > 1) mask = 0xFF; dstri = ri; @@ -2315,22 +2290,20 @@ STATIC_INLINE int BlitRectHelper() return do_blitrect_frame_buffer(ri, dstri, srcx, srcy, dstx, dsty, width, height, mask, opcode); } -static int BlitRect(uaecptr ri, uaecptr dstri, - unsigned long srcx, unsigned long srcy, unsigned long dstx, unsigned long dsty, - unsigned long width, unsigned long height, uae_u8 mask, BLIT_OPCODE opcode) +STATIC_INLINE int BlitRect(TrapContext *ctx, uaecptr ri, uaecptr dstri, + unsigned long srcx, unsigned long srcy, unsigned long dstx, unsigned long dsty, + unsigned long width, unsigned long height, uae_u8 mask, BLIT_OPCODE opcode) { /* Set up the params */ - CopyRenderInfoStructureA2U(ri, &blitrectdata.ri_struct); + CopyRenderInfoStructureA2U(ctx, ri, &blitrectdata.ri_struct); blitrectdata.ri = &blitrectdata.ri_struct; - if (dstri) - { - CopyRenderInfoStructureA2U(dstri, &blitrectdata.dstri_struct); + if (dstri) { + CopyRenderInfoStructureA2U(ctx, dstri, &blitrectdata.dstri_struct); blitrectdata.dstri = &blitrectdata.dstri_struct; } - else - { - blitrectdata.dstri = nullptr; + else { + blitrectdata.dstri = NULL; } blitrectdata.srcx = srcx; blitrectdata.srcy = srcy; @@ -2341,7 +2314,7 @@ static int BlitRect(uaecptr ri, uaecptr dstri, blitrectdata.mask = mask; blitrectdata.opcode = opcode; - return BlitRectHelper(); + return BlitRectHelper(ctx); } /*********************************************************** @@ -2358,22 +2331,22 @@ BlitRect: * d6: UBYTE Mask * d7: uae_u32 RGBFormat ***********************************************************/ -static uae_u32 REGPARAM2 picasso_BlitRect(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_BlitRect(TrapContext *ctx) { - uaecptr renderinfo = m68k_areg (regs, 1); - unsigned long srcx = uae_u16(m68k_dreg (regs, 0)); - unsigned long srcy = uae_u16(m68k_dreg (regs, 1)); - unsigned long dstx = uae_u16(m68k_dreg (regs, 2)); - unsigned long dsty = uae_u16(m68k_dreg (regs, 3)); - unsigned long width = uae_u16(m68k_dreg (regs, 4)); - unsigned long height = uae_u16(m68k_dreg (regs, 5)); - uae_u8 Mask = uae_u8(m68k_dreg (regs, 6)); + uaecptr renderinfo = trap_get_areg(ctx, 1); + unsigned long srcx = (uae_u16)trap_get_dreg(ctx, 0); + unsigned long srcy = (uae_u16)trap_get_dreg(ctx, 1); + unsigned long dstx = (uae_u16)trap_get_dreg(ctx, 2); + unsigned long dsty = (uae_u16)trap_get_dreg(ctx, 3); + unsigned long width = (uae_u16)trap_get_dreg(ctx, 4); + unsigned long height = (uae_u16)trap_get_dreg(ctx, 5); + uae_u8 Mask = (uae_u8)trap_get_dreg(ctx, 6); uae_u32 result = 0; if (NOBLITTER_BLIT) return 0; P96TRACE((_T("BlitRect(%d, %d, %d, %d, %d, %d, 0x%x)\n"), srcx, srcy, dstx, dsty, width, height, Mask)); - result = BlitRect(renderinfo, uaecptr(NULL), srcx, srcy, dstx, dsty, width, height, Mask, BLIT_SRC); + result = BlitRect(ctx, renderinfo, (uaecptr)NULL, srcx, srcy, dstx, dsty, width, height, Mask, BLIT_SRC); return result; } @@ -2395,41 +2368,41 @@ BlitRectNoMaskComplete: * because the RGBFormat or opcode aren't supported. * OTHERWISE return 1 ***********************************************************/ -static uae_u32 REGPARAM2 picasso_BlitRectNoMaskComplete(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_BlitRectNoMaskComplete(TrapContext *ctx) { - uaecptr srcri = m68k_areg (regs, 1); - uaecptr dstri = m68k_areg (regs, 2); - unsigned long srcx = uae_u16(m68k_dreg (regs, 0)); - unsigned long srcy = uae_u16(m68k_dreg (regs, 1)); - unsigned long dstx = uae_u16(m68k_dreg (regs, 2)); - unsigned long dsty = uae_u16(m68k_dreg (regs, 3)); - unsigned long width = uae_u16(m68k_dreg (regs, 4)); - unsigned long height = uae_u16(m68k_dreg (regs, 5)); - BLIT_OPCODE OpCode = BLIT_OPCODE(m68k_dreg (regs, 6) & 0xff); - uae_u32 RGBFmt = m68k_dreg (regs, 7); + uaecptr srcri = trap_get_areg(ctx, 1); + uaecptr dstri = trap_get_areg(ctx, 2); + unsigned long srcx = (uae_u16)trap_get_dreg(ctx, 0); + unsigned long srcy = (uae_u16)trap_get_dreg(ctx, 1); + unsigned long dstx = (uae_u16)trap_get_dreg(ctx, 2); + unsigned long dsty = (uae_u16)trap_get_dreg(ctx, 3); + unsigned long width = (uae_u16)trap_get_dreg(ctx, 4); + unsigned long height = (uae_u16)trap_get_dreg(ctx, 5); + BLIT_OPCODE OpCode = (BLIT_OPCODE)(trap_get_dreg(ctx, 6) & 0xff); + uae_u32 RGBFmt = trap_get_dreg(ctx, 7); uae_u32 result = 0; if (NOBLITTER_BLIT) return 0; P96TRACE((_T("BlitRectNoMaskComplete() op 0x%02x, %08x:(%4d,%4d) --> %08x:(%4d,%4d), wh(%4d,%4d)\n"), - OpCode, get_long (srcri + PSSO_RenderInfo_Memory), srcx, srcy, get_long (dstri + PSSO_RenderInfo_Memory), dstx, dsty, width, height)); - result = BlitRect(srcri, dstri, srcx, srcy, dstx, dsty, width, height, 0xFF, OpCode); + OpCode, trap_get_long(ctx, srcri + PSSO_RenderInfo_Memory), srcx, srcy, trap_get_long(ctx, dstri + PSSO_RenderInfo_Memory), dstx, dsty, width, height)); + result = BlitRect(ctx, srcri, dstri, srcx, srcy, dstx, dsty, width, height, 0xFF, OpCode); return result; } /* NOTE: fgpen MUST be in host byte order */ -STATIC_INLINE void PixelWrite(uae_u8* mem, int bits, uae_u32 fgpen, int Bpp, uae_u32 mask) +STATIC_INLINE void PixelWrite(uae_u8 *mem, int bits, uae_u32 fgpen, int Bpp, uae_u32 mask) { switch (Bpp) { case 1: if (mask != 0xFF) fgpen = (fgpen & mask) | (mem[bits] & ~mask); - mem[bits] = uae_u8(fgpen); + mem[bits] = (uae_u8)fgpen; break; case 2: - reinterpret_cast(mem)[bits] = uae_u16(fgpen); + ((uae_u16 *)mem)[bits] = (uae_u16)fgpen; break; case 3: mem[bits * 3 + 0] = fgpen >> 0; @@ -2437,7 +2410,7 @@ STATIC_INLINE void PixelWrite(uae_u8* mem, int bits, uae_u32 fgpen, int Bpp, uae mem[bits * 3 + 2] = fgpen >> 16; break; case 4: - reinterpret_cast(mem)[bits] = fgpen; + ((uae_u32 *)mem)[bits] = fgpen; break; } } @@ -2464,53 +2437,52 @@ STATIC_INLINE void PixelWrite(uae_u8* mem, int bits, uae_u32 fgpen, int Bpp, uae * always 16 pixels (one word) and the height is calculated as 2^Size. The data must be shifted up * and to the left by XOffset and YOffset pixels at the beginning. */ -static uae_u32 REGPARAM2 picasso_BlitPattern(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_BlitPattern(TrapContext *ctx) { - uaecptr rinf = m68k_areg (regs, 1); - uaecptr pinf = m68k_areg (regs, 2); - unsigned long X = uae_u16(m68k_dreg (regs, 0)); - unsigned long Y = uae_u16(m68k_dreg (regs, 1)); - unsigned long W = uae_u16(m68k_dreg (regs, 2)); - unsigned long H = uae_u16(m68k_dreg (regs, 3)); - uae_u8 Mask = uae_u8(m68k_dreg (regs, 4)); - uae_u32 RGBFmt = m68k_dreg (regs, 7); + uaecptr rinf = trap_get_areg(ctx, 1); + uaecptr pinf = trap_get_areg(ctx, 2); + uae_u32 X = (uae_u16)trap_get_dreg(ctx, 0); + uae_u32 Y = (uae_u16)trap_get_dreg(ctx, 1); + uae_u32 W = (uae_u16)trap_get_dreg(ctx, 2); + uae_u32 H = (uae_u16)trap_get_dreg(ctx, 3); + uae_u8 Mask = (uae_u8)trap_get_dreg(ctx, 4); + uae_u32 RGBFmt = trap_get_dreg(ctx, 7); uae_u8 Bpp = GetBytesPerPixel(RGBFmt); int inversion = 0; struct RenderInfo ri; struct Pattern pattern; unsigned long rows; - uae_u8* uae_mem; + uae_u8 *uae_mem; int xshift; unsigned long ysize_mask; uae_u32 result = 0; if (NOBLITTER) return 0; - if (CopyRenderInfoStructureA2U(rinf, &ri) && CopyPatternStructureA2U(pinf, &pattern)) - { + if (CopyRenderInfoStructureA2U(ctx, rinf, &ri) && CopyPatternStructureA2U(ctx, pinf, &pattern)) { + if (!validatecoords(ctx, &ri, &X, &Y, &W, &H)) + return 0; + Bpp = GetBytesPerPixel(ri.RGBFormat); - uae_mem = ri.Memory + Y * ri.BytesPerRow + X * Bpp; /* offset with address */ + uae_mem = ri.Memory + Y*ri.BytesPerRow + X*Bpp; /* offset with address */ if (pattern.DrawMode & INVERS) inversion = 1; pattern.DrawMode &= 0x03; - if (Mask != 0xFF) - { + if (Mask != 0xFF) { if (Bpp > 1) Mask = 0xFF; result = 1; } - else - { + else { result = 1; } if (pattern.Size >= 16) result = 0; - if (result) - { + if (result) { uae_u32 fgpen, bgpen; P96TRACE((_T("BlitPattern() xy(%d,%d), wh(%d,%d) draw 0x%x, off(%d,%d), ph %d fg 0x%x bg 0x%x\n"), X, Y, W, H, pattern.DrawMode, pattern.XOffset, pattern.YOffset, 1 << pattern.Size, pattern.FgPen, pattern.BgPen)); @@ -2526,18 +2498,17 @@ static uae_u32 REGPARAM2 picasso_BlitPattern(TrapContext* ctx) bgpen = pattern.BgPen; endianswap(&bgpen, Bpp); - for (rows = 0; rows < H; rows++ , uae_mem += ri.BytesPerRow) - { + for (rows = 0; rows < H; rows++, uae_mem += ri.BytesPerRow) { unsigned long prow = (rows + pattern.YOffset) & ysize_mask; - unsigned int d = do_get_mem_word(reinterpret_cast(pattern.Memory) + prow); - uae_u8* uae_mem2 = uae_mem; + unsigned int d; + uae_u8 *uae_mem2 = uae_mem; unsigned long cols; + d = do_get_mem_word(((uae_u16 *)pattern.Memory) + prow); if (xshift != 0) d = (d << xshift) | (d >> (16 - xshift)); - for (cols = 0; cols < W; cols += 16 , uae_mem2 += Bpp * 16) - { + for (cols = 0; cols < W; cols += 16, uae_mem2 += Bpp * 16) { long bits; long max = W - cols; unsigned int data = d; @@ -2548,68 +2519,64 @@ static uae_u32 REGPARAM2 picasso_BlitPattern(TrapContext* ctx) switch (pattern.DrawMode) { case JAM1: - { - for (bits = 0; bits < max; bits++) - { - int bit_set = data & 0x8000; - data <<= 1; - if (inversion) - bit_set = !bit_set; - if (bit_set) - PixelWrite(uae_mem2, bits, fgpen, Bpp, Mask); - } - break; + { + for (bits = 0; bits < max; bits++) { + int bit_set = data & 0x8000; + data <<= 1; + if (inversion) + bit_set = !bit_set; + if (bit_set) + PixelWrite(uae_mem2, bits, fgpen, Bpp, Mask); } + break; + } case JAM2: - { - for (bits = 0; bits < max; bits++) - { - int bit_set = data & 0x8000; - data <<= 1; - if (inversion) - bit_set = !bit_set; - PixelWrite(uae_mem2, bits, bit_set ? fgpen : bgpen, Bpp, Mask); - } - break; + { + for (bits = 0; bits < max; bits++) { + int bit_set = data & 0x8000; + data <<= 1; + if (inversion) + bit_set = !bit_set; + PixelWrite(uae_mem2, bits, bit_set ? fgpen : bgpen, Bpp, Mask); } + break; + } case COMP: - { - for (bits = 0; bits < max; bits++) - { - int bit_set = data & 0x8000; - data <<= 1; - if (bit_set) + { + for (bits = 0; bits < max; bits++) { + int bit_set = data & 0x8000; + data <<= 1; + if (bit_set) { + switch (Bpp) { - switch (Bpp) - { - case 1: - { - uae_mem2[bits] ^= 0xff & Mask; - } - break; - case 2: - { - uae_u16* addr = reinterpret_cast(uae_mem2); - addr[bits] ^= 0xffff; - } - break; - case 3: - { - uae_u32* addr = reinterpret_cast(uae_mem2 + bits * 3); - do_put_mem_long(addr, do_get_mem_long(addr) ^ 0x00ffffff); - } - break; - case 4: - { - uae_u32* addr = reinterpret_cast(uae_mem2); - addr[bits] ^= 0xffffffff; - } - break; - } + case 1: + { + uae_mem2[bits] ^= 0xff & Mask; + } + break; + case 2: + { + uae_u16 *addr = (uae_u16 *)uae_mem2; + addr[bits] ^= 0xffff; + } + break; + case 3: + { + uae_u32 *addr = (uae_u32 *)(uae_mem2 + bits * 3); + do_put_mem_long(addr, do_get_mem_long(addr) ^ 0x00ffffff); + } + break; + case 4: + { + uae_u32 *addr = (uae_u32 *)uae_mem2; + addr[bits] ^= 0xffffffff; + } + break; } } - break; } + break; + } } } } @@ -2639,55 +2606,55 @@ BlitTemplate: * using a single plane of image data which will be expanded to the destination RGBFormat * using ForeGround and BackGround pens as well as draw modes. ***********************************************************************************/ -static uae_u32 REGPARAM2 picasso_BlitTemplate(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_BlitTemplate(TrapContext *ctx) { uae_u8 inversion = 0; - uaecptr rinf = m68k_areg (regs, 1); - uaecptr tmpl = m68k_areg (regs, 2); - unsigned long X = uae_u16(m68k_dreg (regs, 0)); - unsigned long Y = uae_u16(m68k_dreg (regs, 1)); - unsigned long W = uae_u16(m68k_dreg (regs, 2)); - unsigned long H = uae_u16(m68k_dreg (regs, 3)); - uae_u16 Mask = uae_u16(m68k_dreg (regs, 4)); + uaecptr rinf = trap_get_areg(ctx, 1); + uaecptr tmpl = trap_get_areg(ctx, 2); + uae_u32 X = (uae_u16)trap_get_dreg(ctx, 0); + uae_u32 Y = (uae_u16)trap_get_dreg(ctx, 1); + uae_u32 W = (uae_u16)trap_get_dreg(ctx, 2); + uae_u32 H = (uae_u16)trap_get_dreg(ctx, 3); + uae_u16 Mask = (uae_u16)trap_get_dreg(ctx, 4); struct Template tmp; struct RenderInfo ri; unsigned long rows; int bitoffset; uae_u8 *uae_mem, Bpp; - uae_u8* tmpl_base; + uae_u8 *tmpl_base; uae_u32 result = 0; if (NOBLITTER) return 0; - if (CopyRenderInfoStructureA2U(rinf, &ri) && CopyTemplateStructureA2U(tmpl, &tmp)) - { + if (CopyRenderInfoStructureA2U(ctx, rinf, &ri) && CopyTemplateStructureA2U(ctx, tmpl, &tmp)) { + if (!validatecoords(ctx, &ri, &X, &Y, &W, &H)) + return 1; + Bpp = GetBytesPerPixel(ri.RGBFormat); - uae_mem = ri.Memory + Y * ri.BytesPerRow + X * Bpp; /* offset into address */ + uae_mem = ri.Memory + Y*ri.BytesPerRow + X*Bpp; /* offset into address */ if (tmp.DrawMode & INVERS) inversion = 1; tmp.DrawMode &= 0x03; - if (Mask != 0xFF) - { + if (Mask != 0xFF) { if (Bpp > 1) Mask = 0xFF; - if (tmp.DrawMode == COMP) - { - write_log (_T("WARNING - BlitTemplate() has unhandled mask 0x%x with COMP DrawMode. Using fall-back routine.\n"), Mask); + if (tmp.DrawMode == COMP) { + write_log(_T("WARNING - BlitTemplate() has unhandled mask 0x%x with COMP DrawMode. Using fall-back routine.\n"), Mask); return 0; } - result = 1; + else { + result = 1; + } } - else - { + else { result = 1; } - if (result) - { + if (result) { uae_u32 fgpen, bgpen; P96TRACE((_T("BlitTemplate() xy(%d,%d), wh(%d,%d) draw 0x%x fg 0x%x bg 0x%x \n"), @@ -2699,22 +2666,22 @@ static uae_u32 REGPARAM2 picasso_BlitTemplate(TrapContext* ctx) DumpTemplate(&tmp, W, H); #endif - tmpl_base = tmp.Memory + tmp.XOffset / 8; - fgpen = tmp.FgPen; endianswap(&fgpen, Bpp); bgpen = tmp.BgPen; endianswap(&bgpen, Bpp); - for (rows = 0; rows < H; rows++ , uae_mem += ri.BytesPerRow , tmpl_base += tmp.BytesPerRow) - { - unsigned long cols; - uae_u8* tmpl_mem = tmpl_base; - uae_u8* uae_mem2 = uae_mem; - unsigned int data = *tmpl_mem; + tmpl_base = tmp.Memory + tmp.XOffset / 8; - for (cols = 0; cols < W; cols += 8 , uae_mem2 += Bpp * 8) - { + for (rows = 0; rows < H; rows++, uae_mem += ri.BytesPerRow, tmpl_base += tmp.BytesPerRow) { + unsigned long cols; + uae_u8 *uae_mem2 = uae_mem; + uae_u8 *tmpl_mem = tmpl_base; + unsigned int data; + + data = *tmpl_mem; + + for (cols = 0; cols < W; cols += 8, uae_mem2 += Bpp * 8) { unsigned int byte; long bits; long max = W - cols; @@ -2730,69 +2697,65 @@ static uae_u32 REGPARAM2 picasso_BlitTemplate(TrapContext* ctx) switch (tmp.DrawMode) { case JAM1: - { - for (bits = 0; bits < max; bits++) - { - int bit_set = (byte & 0x80); - byte <<= 1; - if (inversion) - bit_set = !bit_set; - if (bit_set) - PixelWrite(uae_mem2, bits, fgpen, Bpp, Mask); - } - break; + { + for (bits = 0; bits < max; bits++) { + int bit_set = (byte & 0x80); + byte <<= 1; + if (inversion) + bit_set = !bit_set; + if (bit_set) + PixelWrite(uae_mem2, bits, fgpen, Bpp, Mask); } + break; + } case JAM2: - { - for (bits = 0; bits < max; bits++) - { - int bit_set = (byte & 0x80); - byte <<= 1; - if (inversion) - bit_set = !bit_set; - PixelWrite(uae_mem2, bits, bit_set ? fgpen : bgpen, Bpp, Mask); - } - break; + { + for (bits = 0; bits < max; bits++) { + int bit_set = (byte & 0x80); + byte <<= 1; + if (inversion) + bit_set = !bit_set; + PixelWrite(uae_mem2, bits, bit_set ? fgpen : bgpen, Bpp, Mask); } + break; + } case COMP: - { - for (bits = 0; bits < max; bits++) - { - int bit_set = (byte & 0x80); - byte <<= 1; - if (bit_set) + { + for (bits = 0; bits < max; bits++) { + int bit_set = (byte & 0x80); + byte <<= 1; + if (bit_set) { + switch (Bpp) { - switch (Bpp) - { - case 1: - { - uae_u8* addr = uae_mem2; - addr[bits] ^= 0xff; - } - break; - case 2: - { - uae_u16* addr = reinterpret_cast(uae_mem2); - addr[bits] ^= 0xffff; - } - break; - case 3: - { - uae_u32* addr = reinterpret_cast(uae_mem2 + bits * 3); - do_put_mem_long(addr, do_get_mem_long(addr) ^ 0x00FFFFFF); - } - break; - case 4: - { - uae_u32* addr = reinterpret_cast(uae_mem2); - addr[bits] ^= 0xffffffff; - } - break; - } + case 1: + { + uae_u8 *addr = uae_mem2; + addr[bits] ^= 0xff; + } + break; + case 2: + { + uae_u16 *addr = (uae_u16 *)uae_mem2; + addr[bits] ^= 0xffff; + } + break; + case 3: + { + uae_u32 *addr = (uae_u32 *)(uae_mem2 + bits * 3); + do_put_mem_long(addr, do_get_mem_long(addr) ^ 0x00FFFFFF); + } + break; + case 4: + { + uae_u32 *addr = (uae_u32 *)uae_mem2; + addr[bits] ^= 0xffffffff; + } + break; } } - break; } + break; + } } } } @@ -2811,11 +2774,12 @@ static uae_u32 REGPARAM2 picasso_BlitTemplate(TrapContext* ctx) * This function calculates the amount of bytes needed for a line of * "Width" pixels in the given RGBFormat. */ -static uae_u32 REGPARAM2 picasso_CalculateBytesPerRow(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_CalculateBytesPerRow(TrapContext *ctx) { - uae_u16 width = m68k_dreg (regs, 0); - uae_u32 type = m68k_dreg (regs, 7); - width = GetBytesPerPixel(type) * width; + uae_u16 width = trap_get_dreg(ctx, 0); + uae_u32 type = trap_get_dreg(ctx, 7); + int bpp = GetBytesPerPixel(type); + width = bpp * width; return width; } @@ -2827,94 +2791,83 @@ static uae_u32 REGPARAM2 picasso_CalculateBytesPerRow(TrapContext* ctx) * * NOTE: return the opposite of the state */ -static uae_u32 REGPARAM2 picasso_SetDisplay(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_SetDisplay(TrapContext *ctx) { - uae_u32 state = m68k_dreg (regs, 0); - P96TRACE ((_T("SetDisplay(%d)\n"), state)); + uae_u32 state = trap_get_dreg(ctx, 0); + P96TRACE_SETUP((_T("SetDisplay(%d)\n"), state)); resetpalette(); + atomic_or(&picasso_state_change, PICASSO_STATE_SETDISPLAY); return !state; } -void init_hz_p96() +void init_hz_p96(void) { p96vblank = vblank_hz; - if (p96vblank <= 0) - p96vblank = 60; - if (p96vblank >= 300) - p96vblank = 300; p96syncrate = maxvpos_nom * vblank_hz / p96vblank; } /* NOTE: Watch for those planeptrs of 0x00000000 and 0xFFFFFFFF for all zero / all one bitmaps !!!! */ -static void PlanarToChunky(struct RenderInfo* ri, struct BitMap* bm, - unsigned long srcx, unsigned long srcy, - unsigned long dstx, unsigned long dsty, - unsigned long width, unsigned long height, - uae_u8 mask) +static void PlanarToChunky(TrapContext *ctx, struct RenderInfo *ri, struct BitMap *bm, + unsigned long srcx, unsigned long srcy, + unsigned long dstx, unsigned long dsty, + unsigned long width, unsigned long height, + uae_u8 mask) { int j; - uae_u8 *PLANAR[8], *image = ri->Memory + dstx * GetBytesPerPixel(ri->RGBFormat) + dsty * ri->BytesPerRow; + uae_u8 *PLANAR[8]; + uae_u8 *image = ri->Memory + dstx * GetBytesPerPixel(ri->RGBFormat) + dsty * ri->BytesPerRow; int Depth = bm->Depth; unsigned long rows, bitoffset = srcx & 7; long eol_offset; /* Set up our bm->Planes[] pointers to the right horizontal offset */ - for (j = 0; j < Depth; j++) - { - uae_u8* p = bm->Planes[j]; + for (j = 0; j < Depth; j++) { + uae_u8 *p = bm->Planes[j]; if (p != &all_zeros_bitmap && p != &all_ones_bitmap) p += srcx / 8 + srcy * bm->BytesPerRow; PLANAR[j] = p; if ((mask & (1 << j)) == 0) PLANAR[j] = &all_zeros_bitmap; } - eol_offset = long(bm->BytesPerRow) - long((width + 7) >> 3); - for (rows = 0; rows < height; rows++ , image += ri->BytesPerRow) - { + eol_offset = (long)bm->BytesPerRow - (long)((width + 7) >> 3); + for (rows = 0; rows < height; rows++, image += ri->BytesPerRow) { unsigned long cols; - for (cols = 0; cols < width; cols += 8) - { + for (cols = 0; cols < width; cols += 8) { int k; uae_u32 a = 0, b = 0; unsigned int msk = 0xFF; long tmp = cols + 8 - width; - if (tmp > 0) - { + if (tmp > 0) { msk <<= tmp; - b = do_get_mem_long(reinterpret_cast(image + cols + 4)); + b = do_get_mem_long((uae_u32 *)(image + cols + 4)); if (tmp < 4) b &= 0xFFFFFFFF >> (32 - tmp * 8); - else if (tmp > 4) - { - a = do_get_mem_long(reinterpret_cast(image + cols)); + else if (tmp > 4) { + a = do_get_mem_long((uae_u32 *)(image + cols)); a &= 0xFFFFFFFF >> (64 - tmp * 8); } } - for (k = 0; k < Depth; k++) - { + for (k = 0; k < Depth; k++) { unsigned int data; if (PLANAR[k] == &all_zeros_bitmap) data = 0; else if (PLANAR[k] == &all_ones_bitmap) data = 0xFF; - else - { - data = uae_u8(do_get_mem_word(reinterpret_cast(PLANAR[k])) >> (8 - bitoffset)); + else { + data = (uae_u8)(do_get_mem_word((uae_u16 *)PLANAR[k]) >> (8 - bitoffset)); PLANAR[k]++; } data &= msk; a |= p2ctab[data][0] << k; b |= p2ctab[data][1] << k; } - do_put_mem_long(reinterpret_cast(image + cols), a); - do_put_mem_long(reinterpret_cast(image + cols + 4), b); + do_put_mem_long((uae_u32 *)(image + cols), a); + do_put_mem_long((uae_u32 *)(image + cols + 4), b); } - for (j = 0; j < Depth; j++) - { - if (PLANAR[j] != &all_zeros_bitmap && PLANAR[j] != &all_ones_bitmap) - { + for (j = 0; j < Depth; j++) { + if (PLANAR[j] != &all_zeros_bitmap && PLANAR[j] != &all_ones_bitmap) { PLANAR[j] += eol_offset; } } @@ -2939,18 +2892,18 @@ static void PlanarToChunky(struct RenderInfo* ri, struct BitMap* bm, * on the board. Watch out for plane pointers that are 0x00000000 (represents a plane with all bits "0") * or 0xffffffff (represents a plane with all bits "1"). */ -static uae_u32 REGPARAM2 picasso_BlitPlanar2Chunky(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_BlitPlanar2Chunky(TrapContext *ctx) { - uaecptr bm = m68k_areg (regs, 1); - uaecptr ri = m68k_areg (regs, 2); - unsigned long srcx = uae_u16(m68k_dreg (regs, 0)); - unsigned long srcy = uae_u16(m68k_dreg (regs, 1)); - unsigned long dstx = uae_u16(m68k_dreg (regs, 2)); - unsigned long dsty = uae_u16(m68k_dreg (regs, 3)); - unsigned long width = uae_u16(m68k_dreg (regs, 4)); - unsigned long height = uae_u16(m68k_dreg (regs, 5)); - uae_u8 minterm = m68k_dreg (regs, 6) & 0xFF; - uae_u8 mask = m68k_dreg (regs, 7) & 0xFF; + uaecptr bm = trap_get_areg(ctx, 1); + uaecptr ri = trap_get_areg(ctx, 2); + unsigned long srcx = (uae_u16)trap_get_dreg(ctx, 0); + unsigned long srcy = (uae_u16)trap_get_dreg(ctx, 1); + unsigned long dstx = (uae_u16)trap_get_dreg(ctx, 2); + unsigned long dsty = (uae_u16)trap_get_dreg(ctx, 3); + unsigned long width = (uae_u16)trap_get_dreg(ctx, 4); + unsigned long height = (uae_u16)trap_get_dreg(ctx, 5); + uae_u8 minterm = trap_get_dreg(ctx, 6) & 0xFF; + uae_u8 mask = trap_get_dreg(ctx, 7) & 0xFF; struct RenderInfo local_ri; struct BitMap local_bm; uae_u32 result = 0; @@ -2958,32 +2911,30 @@ static uae_u32 REGPARAM2 picasso_BlitPlanar2Chunky(TrapContext* ctx) if (NOBLITTER) return 0; - if (minterm != 0x0C) - { - write_log (_T("ERROR - BlitPlanar2Chunky() has minterm 0x%x, which I don't handle. Using fall-back routine.\n"), + if (minterm != 0x0C) { + write_log(_T("ERROR - BlitPlanar2Chunky() has minterm 0x%x, which I don't handle. Using fall-back routine.\n"), minterm); } - else if (CopyRenderInfoStructureA2U(ri, &local_ri) && CopyBitMapStructureA2U(bm, &local_bm)) - { + else if (CopyRenderInfoStructureA2U(ctx, ri, &local_ri) && CopyBitMapStructureA2U(ctx, bm, &local_bm)) { P96TRACE((_T("BlitPlanar2Chunky(%d, %d, %d, %d, %d, %d) Minterm 0x%x, Mask 0x%x, Depth %d\n"), srcx, srcy, dstx, dsty, width, height, minterm, mask, local_bm.Depth)); P96TRACE((_T("P2C - BitMap has %d BPR, %d rows\n"), local_bm.BytesPerRow, local_bm.Rows)); - PlanarToChunky(&local_ri, &local_bm, srcx, srcy, dstx, dsty, width, height, mask); + PlanarToChunky(ctx, &local_ri, &local_bm, srcx, srcy, dstx, dsty, width, height, mask); result = 1; } return result; } /* NOTE: Watch for those planeptrs of 0x00000000 and 0xFFFFFFFF for all zero / all one bitmaps !!!! */ -static void PlanarToDirect(struct RenderInfo *ri, struct BitMap *bm, +static void PlanarToDirect(TrapContext *ctx, struct RenderInfo *ri, struct BitMap *bm, unsigned long srcx, unsigned long srcy, unsigned long dstx, unsigned long dsty, unsigned long width, unsigned long height, uae_u8 mask, uaecptr acim) { int j; int bpp = GetBytesPerPixel(ri->RGBFormat); - uae_u8* PLANAR[8]; - uae_u8* image = ri->Memory + dstx * bpp + dsty * ri->BytesPerRow; + uae_u8 *PLANAR[8]; + uae_u8 *image = ri->Memory + dstx * bpp + dsty * ri->BytesPerRow; int Depth = bm->Depth; unsigned long rows; long eol_offset; @@ -2994,9 +2945,8 @@ static void PlanarToDirect(struct RenderInfo *ri, struct BitMap *bm, return; /* Set up our bm->Planes[] pointers to the right horizontal offset */ - for (j = 0; j < Depth; j++) - { - uae_u8* p = bm->Planes[j]; + for (j = 0; j < Depth; j++) { + uae_u8 *p = bm->Planes[j]; if (p != &all_zeros_bitmap && p != &all_ones_bitmap) p += srcx / 8 + srcy * bm->BytesPerRow; PLANAR[j] = p; @@ -3004,23 +2954,19 @@ static void PlanarToDirect(struct RenderInfo *ri, struct BitMap *bm, PLANAR[j] = &all_zeros_bitmap; } - eol_offset = long(bm->BytesPerRow) - long((width + (srcx & 7)) >> 3); - for (rows = 0; rows < height; rows++ , image += ri->BytesPerRow) - { + eol_offset = (long)bm->BytesPerRow - (long)((width + (srcx & 7)) >> 3); + for (rows = 0; rows < height; rows++, image += ri->BytesPerRow) { unsigned long cols; - uae_u8* image2 = image; + uae_u8 *image2 = image; unsigned int bitoffs = 7 - (srcx & 7); int i; - for (cols = 0; cols < width; cols++) - { + for (cols = 0; cols < width; cols++) { int v = 0, k; - for (k = 0; k < Depth; k++) - { + for (k = 0; k < Depth; k++) { if (PLANAR[k] == &all_ones_bitmap) v |= 1 << k; - else if (PLANAR[k] != &all_zeros_bitmap) - { + else if (PLANAR[k] != &all_zeros_bitmap) { v |= ((*PLANAR[k] >> bitoffs) & 1) << k; } } @@ -3041,17 +2987,7 @@ static void PlanarToDirect(struct RenderInfo *ri, struct BitMap *bm, vc = 63; else vc = 255; - //get_longs(&cim[maxc + 1], acim + 4 + (maxc + 1) * 4, vc - maxc); - int cnt = vc - maxc; - if (cnt > 0) { - uaecptr addr = acim + 4 + (maxc + 1) * 4; - uae_u32 *p = (uae_u32*)&cim[maxc + 1]; - for (int i = 0; i < vc - maxc; i++) - { - *p++ = get_long(addr); - addr += 4; - } - } + trap_get_longs(ctx, &cim[maxc + 1], acim + 4 + (maxc + 1) * 4, vc - maxc); for (int i = maxc + 1; i <= vc; i++) { endianswap(&cim[i], bpp); } @@ -3123,36 +3059,34 @@ static void PlanarToDirect(struct RenderInfo *ri, struct BitMap *bm, * BlitTemplate(). */ -static uae_u32 REGPARAM2 picasso_BlitPlanar2Direct(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_BlitPlanar2Direct(TrapContext *ctx) { - uaecptr bm = m68k_areg (regs, 1); - uaecptr ri = m68k_areg (regs, 2); - uaecptr cim = m68k_areg (regs, 3); - unsigned long srcx = uae_u16(m68k_dreg (regs, 0)); - unsigned long srcy = uae_u16(m68k_dreg (regs, 1)); - unsigned long dstx = uae_u16(m68k_dreg (regs, 2)); - unsigned long dsty = uae_u16(m68k_dreg (regs, 3)); - unsigned long width = uae_u16(m68k_dreg (regs, 4)); - unsigned long height = uae_u16(m68k_dreg (regs, 5)); - uae_u8 minterm = m68k_dreg (regs, 6); - uae_u8 Mask = m68k_dreg (regs, 7); + uaecptr bm = trap_get_areg(ctx, 1); + uaecptr ri = trap_get_areg(ctx, 2); + uaecptr cim = trap_get_areg(ctx, 3); + unsigned long srcx = (uae_u16)trap_get_dreg(ctx, 0); + unsigned long srcy = (uae_u16)trap_get_dreg(ctx, 1); + unsigned long dstx = (uae_u16)trap_get_dreg(ctx, 2); + unsigned long dsty = (uae_u16)trap_get_dreg(ctx, 3); + unsigned long width = (uae_u16)trap_get_dreg(ctx, 4); + unsigned long height = (uae_u16)trap_get_dreg(ctx, 5); + uae_u8 minterm = trap_get_dreg(ctx, 6); + uae_u8 Mask = trap_get_dreg(ctx, 7); struct RenderInfo local_ri; struct BitMap local_bm; uae_u32 result = 0; if (NOBLITTER) return 0; - if (minterm != 0x0C) - { - write_log (_T("WARNING - BlitPlanar2Direct() has unhandled op-code 0x%x. Using fall-back routine.\n"), minterm); + if (minterm != 0x0C) { + write_log(_T("WARNING - BlitPlanar2Direct() has unhandled op-code 0x%x. Using fall-back routine.\n"), minterm); return 0; } - if (CopyRenderInfoStructureA2U(ri, &local_ri) && CopyBitMapStructureA2U(bm, &local_bm)) - { + if (CopyRenderInfoStructureA2U(ctx, ri, &local_ri) && CopyBitMapStructureA2U(ctx, bm, &local_bm)) { Mask = 0xFF; P96TRACE((_T("BlitPlanar2Direct(%d, %d, %d, %d, %d, %d) Minterm 0x%x, Mask 0x%x, Depth %d\n"), srcx, srcy, dstx, dsty, width, height, minterm, Mask, local_bm.Depth)); - PlanarToDirect(&local_ri, &local_bm, srcx, srcy, dstx, dsty, width, height, Mask, cim); + PlanarToDirect(ctx, &local_ri, &local_bm, srcx, srcy, dstx, dsty, width, height, Mask, cim); result = 1; } return result; @@ -3160,7 +3094,7 @@ static uae_u32 REGPARAM2 picasso_BlitPlanar2Direct(TrapContext* ctx) #include "statusline.h" -static void statusline(uae_u8* dst) +static void picasso_statusline(uae_u8 *dst) { int y; int dst_height, dst_width, pitch; @@ -3168,450 +3102,61 @@ static void statusline(uae_u8* dst) dst_height = picasso96_state.Height; dst_width = picasso96_state.Width; pitch = picasso_vidinfo.rowbytes; - for (y = 0; y < TD_TOTAL_HEIGHT; y++) - { + for (y = 0; y < TD_TOTAL_HEIGHT; y++) { int line = dst_height - TD_TOTAL_HEIGHT + y; - uae_u8* buf = dst + line * pitch; + uae_u8 *buf = dst + line * pitch; draw_status_line_single(buf, y, dst_width); } } -static void copyrow(uae_u8 *src, uae_u8 *dst, int x, int y, int width, int srcbytesperrow, int srcpixbytes, int dy, int dstbytesperrow, int dstpixbytes, bool direct, int convert_mode) -{ - uae_u8 *src2 = src + y * srcbytesperrow; - uae_u8 *dst2 = dst + dy * dstbytesperrow; - int endx = x + width, endx4; - int dstpix = dstpixbytes; - int srcpix = srcpixbytes; - - if (direct) { - memcpy(dst2 + x * dstpix, src2 + x * srcpix, width * dstpix); - return; - } - // native match? - if (currprefs.gfx_api) { - switch (convert_mode) - { -#ifdef WORDS_BIGENDIAN - case RGBFB_A8R8G8B8_32: - case RGBFB_R5G6B5_16: -#else - case RGBFB_B8G8R8A8_32: - case RGBFB_R5G6B5PC_16: -#endif - memcpy(dst2 + x * dstpix, src2 + x * srcpix, width * dstpix); - return; - } - } - else { - switch (convert_mode) - { -#ifdef WORDS_BIGENDIAN - case RGBFB_A8R8G8B8_32: - case RGBFB_R5G6B5_16: -#else - case RGBFB_B8G8R8A8_32: - case RGBFB_R5G6B5PC_16: -#endif - memcpy(dst2 + x * dstpix, src2 + x * srcpix, width * dstpix); - return; - } - } - - endx4 = endx & ~3; - - switch (convert_mode) - { - /* 24bit->32bit */ - case RGBFB_R8G8B8_32: - while (x < endx) { - ((uae_u32*)dst2)[x] = (src2[x * 3 + 0] << 16) | (src2[x * 3 + 1] << 8) | (src2[x * 3 + 2] << 0); - x++; - } - break; - case RGBFB_B8G8R8_32: - while (x < endx) { - ((uae_u32*)dst2)[x] = ((uae_u32*)(src2 + x * 3))[0] & 0x00ffffff; - x++; - } - break; - - /* 32bit->32bit */ - case RGBFB_R8G8B8A8_32: - while (x < endx) { - ((uae_u32*)dst2)[x] = (src2[x * 4 + 0] << 16) | (src2[x * 4 + 1] << 8) | (src2[x * 4 + 2] << 0); - x++; - } - break; - case RGBFB_A8R8G8B8_32: - while (x < endx) { - ((uae_u32*)dst2)[x] = (src2[x * 4 + 1] << 16) | (src2[x * 4 + 2] << 8) | (src2[x * 4 + 3] << 0); - x++; - } - break; - case RGBFB_A8B8G8R8_32: - while (x < endx) { - ((uae_u32*)dst2)[x] = ((uae_u32*)src2)[x] >> 8; - x++; - } - break; - - /* 15/16bit->32bit */ - case RGBFB_R5G6B5PC_32: - case RGBFB_R5G5B5PC_32: - case RGBFB_R5G6B5_32: - case RGBFB_R5G5B5_32: - case RGBFB_B5G6R5PC_32: - case RGBFB_B5G5R5PC_32: - { - while ((x & 3) && x < endx) { - ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]]; - x++; - } - while (x < endx4) { - ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]]; - x++; - ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]]; - x++; - ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]]; - x++; - ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]]; - x++; - } - while (x < endx) { - ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]]; - x++; - } - } - break; - - /* 16/15bit->16bit */ - case RGBFB_R5G5B5PC_16: - case RGBFB_R5G6B5_16: - case RGBFB_R5G5B5_16: - case RGBFB_B5G5R5PC_16: - case RGBFB_B5G6R5PC_16: - case RGBFB_R5G6B5PC_16: - { - while ((x & 3) && x < endx) { - ((uae_u16*)dst2)[x] = (uae_u16)p96_rgbx16[((uae_u16*)src2)[x]]; - x++; - } - while (x < endx4) { - ((uae_u16*)dst2)[x] = (uae_u16)p96_rgbx16[((uae_u16*)src2)[x]]; - x++; - ((uae_u16*)dst2)[x] = (uae_u16)p96_rgbx16[((uae_u16*)src2)[x]]; - x++; - ((uae_u16*)dst2)[x] = (uae_u16)p96_rgbx16[((uae_u16*)src2)[x]]; - x++; - ((uae_u16*)dst2)[x] = (uae_u16)p96_rgbx16[((uae_u16*)src2)[x]]; - x++; - } - while (x < endx) { - ((uae_u16*)dst2)[x] = (uae_u16)p96_rgbx16[((uae_u16*)src2)[x]]; - x++; - } - } - break; - - /* 24bit->16bit */ - case RGBFB_R8G8B8_16: - while (x < endx) { - uae_u8 r, g, b; - r = src2[x * 3 + 0]; - g = src2[x * 3 + 1]; - b = src2[x * 3 + 2]; - ((uae_u16*)dst2)[x] = p96_rgbx16[(((r >> 3) & 0x1f) << 11) | (((g >> 2) & 0x3f) << 5) | (((b >> 3) & 0x1f) << 0)]; - x++; - } - break; - case RGBFB_B8G8R8_16: - while (x < endx) { - uae_u32 v; - v = ((uae_u32*)(&src2[x * 3]))[0] >> 8; - ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (8 + 3)) & 0x1f) << 11) | (((v >> (0 + 2)) & 0x3f) << 5) | (((v >> (16 + 3)) & 0x1f) << 0)]; - x++; - } - break; - - /* 32bit->16bit */ - case RGBFB_R8G8B8A8_16: - while (x < endx) { - uae_u32 v; - v = ((uae_u32*)src2)[x]; - ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (0 + 3)) & 0x1f) << 11) | (((v >> (8 + 2)) & 0x3f) << 5) | (((v >> (16 + 3)) & 0x1f) << 0)]; - x++; - } - break; - case RGBFB_A8R8G8B8_16: - while (x < endx) { - uae_u32 v; - v = ((uae_u32*)src2)[x]; - ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (8 + 3)) & 0x1f) << 11) | (((v >> (16 + 2)) & 0x3f) << 5) | (((v >> (24 + 3)) & 0x1f) << 0)]; - x++; - } - break; - case RGBFB_A8B8G8R8_16: - while (x < endx) { - uae_u32 v; - v = ((uae_u32*)src2)[x]; - ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (24 + 3)) & 0x1f) << 11) | (((v >> (16 + 2)) & 0x3f) << 5) | (((v >> (8 + 3)) & 0x1f) << 0)]; - x++; - } - break; - case RGBFB_B8G8R8A8_16: - while (x < endx) { - uae_u32 v; - v = ((uae_u32*)src2)[x]; - ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (16 + 3)) & 0x1f) << 11) | (((v >> (8 + 2)) & 0x3f) << 5) | (((v >> (0 + 3)) & 0x1f) << 0)]; - x++; - } - break; - - /* 8bit->32bit */ - case RGBFB_CLUT_RGBFB_32: - { - while ((x & 3) && x < endx) { - ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - } - while (x < endx4) { - ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - } - while (x < endx) { - ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - } - } - break; - - /* 8bit->16bit */ - case RGBFB_CLUT_RGBFB_16: - { - while ((x & 3) && x < endx) { - ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - } - while (x < endx4) { - ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - } - while (x < endx) { - ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - } - } - break; - } -} - -void fb_copyrow(uae_u8 *src, uae_u8 *dst, int x, int y, int width, int srcpixbytes, int dy) -{ - copyrow(src, dst, x, y, width, 0, srcpixbytes, dy, picasso_vidinfo.rowbytes, picasso_vidinfo.pixbytes, picasso96_state.RGBFormat == host_mode, picasso_convert); -} - -static void copyallinvert(uae_u8 *src, uae_u8 *dst, int pwidth, int pheight, int srcbytesperrow, int srcpixbytes, int dstbytesperrow, int dstpixbytes, bool direct, int mode_convert) -{ - int x, y, w; - - w = pwidth * dstpixbytes; - if (direct) { - for (y = 0; y < pheight; y++) { - for (x = 0; x < w; x++) - dst[x] = src[x] ^ 0xff; - dst += dstbytesperrow; - src += srcbytesperrow; - } - } - else { - uae_u8 *src2 = src; - for (y = 0; y < pheight; y++) { - for (x = 0; x < w; x++) - src2[x] ^= 0xff; - copyrow(src, dst, 0, y, pwidth, srcbytesperrow, srcpixbytes, y, dstbytesperrow, dstpixbytes, direct, mode_convert); - for (x = 0; x < w; x++) - src2[x] ^= 0xff; - src2 += srcbytesperrow; - } - } -} - // TODO: Change this to use SDL2 native conversions -static void copyall(uae_u8 *src, uae_u8 *dst, int pwidth, int pheight, int srcbytesperrow, int srcpixbytes, int dstbytesperrow, int dstpixbytes, bool direct, int mode_convert) +static void copyall(uae_u8 *src, uae_u8 *dst) { - //if (picasso96_state.RGBFormat == RGBFB_R5G6B5) - // copy_screen_16bit_swap(dst, src, picasso96_state.Width * picasso96_state.Height * 2); - //else if (picasso96_state.RGBFormat == RGBFB_CLUT) - //{ - // int pixels = picasso96_state.Width * picasso96_state.Height; - // copy_screen_8bit(dst, src, pixels, picasso_vidinfo.clut); - //} - //else - // copy_screen_32bit_to_16bit(dst, src, picasso96_state.Width * picasso96_state.Height * 4); - - int y; - - int w = pwidth * picasso_vidinfo.pixbytes; - for (y = 0; y < pheight; y++) { - memcpy(dst, src, w); - dst += dstbytesperrow; - src += srcbytesperrow; + if (picasso96_state.RGBFormat == RGBFB_R5G6B5) +#ifdef USE_ARMNEON + copy_screen_16bit_swap(dst, src, picasso96_state.Width * picasso96_state.Height * 2); +#else + copy_screen_16bit_swap_arm(dst, src, picasso96_state.Width * picasso96_state.Height * 2); +#endif + else if (picasso96_state.RGBFormat == RGBFB_CLUT) + { + int pixels = picasso96_state.Width * picasso96_state.Height; + copy_screen_8bit(dst, src, pixels, picasso_vidinfo.clut); } + else +#ifdef USE_ARMNEON + copy_screen_32bit_to_16bit_neon(dst, src, picasso96_state.Width * picasso96_state.Height * 4); +#else + copy_screen_32bit_to_16bit_arm(dst, src, picasso96_state.Width * picasso96_state.Height * 4); +#endif } -bool picasso_flushpixels(int index) +bool picasso_flushpixels(uae_u8 *src, int off) { - uae_u8 *src_start; - uae_u8 *src_end; - int lock = 0; - uae_u8* dst = nullptr; - unsigned long gwwcnt; - int pwidth = picasso96_state.Width > picasso96_state.VirtualWidth ? picasso96_state.VirtualWidth : picasso96_state.Width; - int pheight = picasso96_state.Height > picasso96_state.VirtualHeight ? picasso96_state.VirtualHeight : picasso96_state.Height; - int maxy = -1; - int miny = pheight - 1; - int flushlines = 0, matchcount = 0; - uae_u8* src = gfxmem_bank.start + natmem_offset; - int off = picasso96_state.XYOffset - gfxmem_bank.start; + uae_u8 *src_start = src + off; + uae_u8 *src_end = src + off + picasso96_state.BytesPerRow * picasso96_state.Height; + uae_u8 *dst = NULL; - src_start = src + off; - src_end = src + off + picasso96_state.BytesPerRow * picasso96_state.Height; - + if (!picasso_vidinfo.extra_mem || src_start >= src_end) { + return false; + } - if (!picasso_vidinfo.extra_mem || src_start >= src_end) + dst = gfx_lock_picasso(); + if (dst == NULL) return false; - if (full_refresh || rtg_clear_flag) - full_refresh = -1; - - for (;;) { - bool dofull; - - gwwcnt = 0; - - if (doskip() && p96skipmode == 1) { - break; - } - - if (full_refresh < 0) { - gwwcnt = (src_end - src_start) / gwwpagesize[index] + 1; - full_refresh = 1; - for (int i = 0; i < gwwcnt; i++) - gwwbuf[index][i] = src_start + i * gwwpagesize[index]; - } - else { - unsigned long ps; - gwwcnt = gwwbufsize[index]; - //if (mman_GetWriteWatch(src_start, src_end - src_start, gwwbuf[index], &gwwcnt, &ps)) - // break; - } - - matchcount += gwwcnt; - - if (gwwcnt == 0) - break; - - dofull = gwwcnt >= ((src_end - src_start) / gwwpagesize[index]) * 80 / 100; - - dst = gfx_lock_picasso(); - if (rtg_clear_flag) - rtg_clear_flag--; - if (dst == NULL) - break; - lock = 1; - - if (doskip() && p96skipmode == 2) { - break; - } - - if (dofull) { - copyall(src + off, dst, pwidth, pheight, - picasso96_state.BytesPerRow, picasso96_state.BytesPerPixel, - picasso_vidinfo.rowbytes, picasso_vidinfo.pixbytes, - picasso96_state.RGBFormat == host_mode, picasso_convert); - - miny = 0; - maxy = pheight; - flushlines = -1; - break; - } - - for (int i = 0; i < gwwcnt; i++) { - uae_u8 *p = (uae_u8*)gwwbuf[index][i]; - - if (p >= src_start && p < src_end) { - int y, x, realoffset; - - if (p >= src + off) { - realoffset = p - (src + off); - } - else { - realoffset = 0; - } - - y = realoffset / picasso96_state.BytesPerRow; - if (y < pheight) { - int w = gwwpagesize[index] / picasso96_state.BytesPerPixel; - x = (realoffset % picasso96_state.BytesPerRow) / picasso96_state.BytesPerPixel; - if (x < pwidth) { - copyrow(src + off, dst, x, y, pwidth - x, - picasso96_state.BytesPerRow, picasso96_state.BytesPerPixel, - y, picasso_vidinfo.rowbytes, picasso_vidinfo.pixbytes, - picasso96_state.RGBFormat == host_mode, picasso_convert); - flushlines++; - } - w = (gwwpagesize[index] - (picasso96_state.BytesPerRow - x * picasso96_state.BytesPerPixel)) / picasso96_state.BytesPerPixel; - if (y < miny) - miny = y; - y++; - while (y < pheight && w > 0) { - int maxw = w > pwidth ? pwidth : w; - copyrow(src + off, dst, 0, y, maxw, - picasso96_state.BytesPerRow, picasso96_state.BytesPerPixel, - y, picasso_vidinfo.rowbytes, picasso_vidinfo.pixbytes, - picasso96_state.RGBFormat == host_mode, picasso_convert); - w -= maxw; - y++; - flushlines++; - } - if (y > maxy) - maxy = y; - } - - } - - } - break; - } - - //copyall(src + off, dst); + copyall(src + off, dst); if (currprefs.leds_on_screen) - statusline(dst); + picasso_statusline(dst); - if (lock) - gfx_unlock_picasso(); - if (dst && gwwcnt) { - full_refresh = 0; - } - return lock != 0; + gfx_unlock_picasso(true); + return true; } extern addrbank gfxmem_bank; MEMORY_FUNCTIONS(gfxmem); + addrbank gfxmem_bank = { gfxmem_lget, gfxmem_wget, gfxmem_bget, gfxmem_lput, gfxmem_wput, gfxmem_bput, @@ -3619,143 +3164,112 @@ addrbank gfxmem_bank = { dummy_lgeti, dummy_wgeti, ABFLAG_RAM | ABFLAG_RTG, 0, 0 }; -extern addrbank gfxmem2_bank; -MEMORY_FUNCTIONS(gfxmem2); -addrbank gfxmem2_bank = { - gfxmem2_lget, gfxmem2_wget, gfxmem2_bget, - gfxmem2_lput, gfxmem2_wput, gfxmem2_bput, - gfxmem2_xlate, gfxmem2_check, NULL, NULL, _T("RTG RAM #2"), - dummy_lgeti, dummy_wgeti, - ABFLAG_RAM | ABFLAG_RTG, 0, 0 -}; -extern addrbank gfxmem3_bank; -MEMORY_FUNCTIONS(gfxmem3); -addrbank gfxmem3_bank = { - gfxmem3_lget, gfxmem3_wget, gfxmem3_bget, - gfxmem3_lput, gfxmem3_wput, gfxmem3_bput, - gfxmem3_xlate, gfxmem3_check, NULL, NULL, _T("RTG RAM #3"), - dummy_lgeti, dummy_wgeti, - ABFLAG_RAM | ABFLAG_RTG, 0, 0 -}; -extern addrbank gfxmem4_bank; -MEMORY_FUNCTIONS(gfxmem4); -addrbank gfxmem4_bank = { - gfxmem4_lget, gfxmem4_wget, gfxmem4_bget, - gfxmem4_lput, gfxmem4_wput, gfxmem4_bput, - gfxmem4_xlate, gfxmem4_check, NULL, NULL, _T("RTG RAM #4"), - dummy_lgeti, dummy_wgeti, - ABFLAG_RAM | ABFLAG_RTG, 0, 0 -}; addrbank *gfxmem_banks[MAX_RTG_BOARDS]; /* Call this function first, near the beginning of code flow * Place in InitGraphics() which seems reasonable... * Also put it in reset_drawing() for safe-keeping. */ -void InitPicasso96() +void InitPicasso96(void) { - int i; - gfxmem_banks[0] = &gfxmem_bank; - gfxmem_banks[1] = &gfxmem2_bank; - gfxmem_banks[2] = &gfxmem3_bank; - gfxmem_banks[3] = &gfxmem4_bank; //fastscreen oldscr = 0; //fastscreen - memset(&picasso96_state, 0, sizeof (struct picasso96_state_struct)); + memset(&picasso96_state_uaegfx, 0, sizeof(struct picasso96_state_struct)); - for (i = 0; i < 256; i++) - { - p2ctab[i][0] = (i & 128 ? 0x01000000 : 0) - | (i & 64 ? 0x010000 : 0) - | (i & 32 ? 0x0100 : 0) - | (i & 16 ? 0x01 : 0); - p2ctab[i][1] = (i & 8 ? 0x01000000 : 0) - | (i & 4 ? 0x010000 : 0) - | (i & 2 ? 0x0100 : 0) - | (i & 1 ? 0x01 : 0); + for (int i = 0; i < 256; i++) { + p2ctab[i][0] = (((i & 128) ? 0x01000000 : 0) + | ((i & 64) ? 0x010000 : 0) + | ((i & 32) ? 0x0100 : 0) + | ((i & 16) ? 0x01 : 0)); + p2ctab[i][1] = (((i & 8) ? 0x01000000 : 0) + | ((i & 4) ? 0x010000 : 0) + | ((i & 2) ? 0x0100 : 0) + | ((i & 1) ? 0x01 : 0)); } } #endif -static uae_u32 REGPARAM2 picasso_SetInterrupt(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_SetInterrupt(TrapContext *ctx) { - uaecptr bi = m68k_areg (regs, 0); - uae_u32 onoff = m68k_dreg (regs, 0); + uaecptr bi = trap_get_areg(ctx, 0); + uae_u32 onoff = trap_get_dreg(ctx, 0); interrupt_enabled = onoff; //write_log (_T("Picasso_SetInterrupt(%08x,%d)\n"), bi, onoff); return onoff; } static uaecptr uaegfx_vblankname, uaegfx_portsname; - -static void initvblankABI(uaecptr base, uaecptr ABI) +static void initvblankABI(TrapContext *ctx, uaecptr base, uaecptr ABI) { for (int i = 0; i < 22; i++) - put_byte(ABI + PSSO_BoardInfo_HardInterrupt + i, get_byte(base + CARD_PORTSIRQ + i)); + trap_put_byte(ctx, ABI + PSSO_BoardInfo_HardInterrupt + i, trap_get_byte(ctx, base + CARD_PORTSIRQ + i)); ABI_interrupt = ABI; } -static void initvblankirq(TrapContext* ctx, uaecptr base) +static void initvblankirq(TrapContext *ctx, uaecptr base) { uaecptr p1 = base + CARD_VBLANKIRQ; uaecptr p2 = base + CARD_PORTSIRQ; uaecptr c = base + CARD_IRQCODE; - put_word(p1 + 8, 0x0205); - put_long(p1 + 10, uaegfx_vblankname); - put_long(p1 + 14, base + CARD_IRQFLAG); - put_long(p1 + 18, c); + trap_put_word(ctx, p1 + 8, 0x0205); + trap_put_long(ctx, p1 + 10, uaegfx_vblankname); + trap_put_long(ctx, p1 + 14, base + CARD_IRQFLAG); + trap_put_long(ctx, p1 + 18, c); - put_word(p2 + 8, 0x0205); - put_long(p2 + 10, uaegfx_portsname); - put_long(p2 + 14, base + CARD_IRQFLAG); - put_long(p2 + 18, c); + trap_put_word(ctx, p2 + 8, 0x0205); + trap_put_long(ctx, p2 + 10, uaegfx_portsname); + trap_put_long(ctx, p2 + 14, base + CARD_IRQFLAG); + trap_put_long(ctx, p2 + 18, c); - put_word(c, 0x4a11); - c += 2; // tst.b (a1) CARD_IRQFLAG - put_word(c, 0x670e); - c += 2; // beq.s label - put_word(c, 0x4211); - c += 2; // clr.b (a1) - put_long(c, 0x2c690008); - c += 4; // move.l 8(a1),a6 CARD_IRQEXECBASE - put_long(c, 0x22690004); - c += 4; // move.l 4(a1),a1 CARD_IRQPTR - put_long(c, 0x4eaeff4c); - c += 4; // jsr Cause(a6) - put_word(c, 0x7000); - c += 2; // label: moveq #0,d0 - put_word(c, RTS); // rts + trap_put_word(ctx, c, 0x4a11); c += 2; // tst.b (a1) CARD_IRQFLAG + trap_put_word(ctx, c, 0x670e); c += 2; // beq.s label + trap_put_word(ctx, c, 0x4211); c += 2; // clr.b (a1) + trap_put_long(ctx, c, 0x2c690008); c += 4; // move.l 8(a1),a6 CARD_IRQEXECBASE + trap_put_long(ctx, c, 0x22690004); c += 4; // move.l 4(a1),a1 CARD_IRQPTR + trap_put_long(ctx, c, 0x4eaeff4c); c += 4; // jsr Cause(a6) + trap_put_word(ctx, c, 0x7000); c += 2; // label: moveq #0,d0 + trap_put_word(ctx, c, RTS); // rts - m68k_areg (regs, 1) = p1; - m68k_dreg (regs, 0) = 5; /* VERTB */ - CallLib(ctx, get_long(4), -168); /* AddIntServer */ - m68k_areg (regs, 1) = p2; - m68k_dreg (regs, 0) = 3; /* PORTS */ - CallLib(ctx, get_long(4), -168); /* AddIntServer */ +#if NEWTRAP + trap_call_add_areg(ctx, 1, p1); + trap_call_add_dreg(ctx, 0, 5); + trap_call_lib(ctx, trap_get_long(ctx, 4), -168); /* AddIntServer */ + + trap_call_add_areg(ctx, 1, p2); + trap_call_add_dreg(ctx, 0, 3); + trap_call_lib(ctx, trap_get_long(ctx, 4), -168); /* AddIntServer */ +#else + trap_set_areg(ctx, 1, p1); + trap_set_dreg(ctx, 0, 5); /* VERTB */ + CallLib(ctx, trap_get_long(ctx, 4), -168); /* AddIntServer */ + trap_set_areg(ctx, 1, p2); + trap_set_dreg(ctx, 0, 3); /* PORTS */ + CallLib(ctx, trap_get_long(ctx, 4), -168); /* AddIntServer */ +#endif } -static uae_u32 REGPARAM2 picasso_SetClock(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_SetClock(TrapContext *ctx) { - uaecptr bi = m68k_areg (regs, 0); - P96TRACE((_T("SetClock\n"))); + uaecptr bi = trap_get_areg(ctx, 0); + P96TRACE_SETUP((_T("SetClock\n"))); return 0; } -static uae_u32 REGPARAM2 picasso_SetMemoryMode(TrapContext* ctx) +static uae_u32 REGPARAM2 picasso_SetMemoryMode(TrapContext *ctx) { - uaecptr bi = m68k_areg (regs, 0); - uae_u32 rgbformat = m68k_dreg (regs, 7); - P96TRACE((_T("SetMemoryMode\n"))); + uaecptr bi = trap_get_areg(ctx, 0); + uae_u32 rgbformat = trap_get_dreg(ctx, 7); + P96TRACE_SETUP((_T("SetMemoryMode\n"))); return 0; } #define PUTABI(func) \ if (ABI) \ - put_long (ABI + func, here ()); + trap_put_long(ctx, ABI + func, here ()); #define RTGCALL(func,funcdef,call) \ PUTABI (func); \ @@ -3781,67 +3295,69 @@ static uae_u32 REGPARAM2 picasso_SetMemoryMode(TrapContext* ctx) #define RTGNONE(func) \ if (ABI) \ - put_long (ABI + func, start); + trap_put_long(ctx, ABI + func, start); -static void inituaegfxfuncs(uaecptr start, uaecptr ABI) +static void inituaegfxfuncs(TrapContext *ctx, uaecptr start, uaecptr ABI) { - if (uaegfx_old) + if (uaegfx_old || !ABI) return; org(start); dw(RTS); /* ResolvePixelClock - move.l D0,gmi_PixelClock(a1) ; pass the pixelclock through - moveq #0,D0 ; index is 0 - move.b #98,gmi_Numerator(a1) ; whatever - move.b #14,gmi_Denominator(a1) ; whatever - rts + move.l D0,gmi_PixelClock(a1) ; pass the pixelclock through + moveq #0,D0 ; index is 0 + move.b #98,gmi_Numerator(a1) ; whatever + move.b #14,gmi_Denominator(a1) ; whatever + rts */ - PUTABI (PSSO_BoardInfo_ResolvePixelClock); + PUTABI(PSSO_BoardInfo_ResolvePixelClock); dl(0x2340002c); dw(0x7000); - dl(0x137c0062); - dw(0x002a); - dl(0x137c000e); - dw(0x002b); + dl(0x137c0062); dw(0x002a); + dl(0x137c000e); dw(0x002b); dw(RTS); /* GetPixelClock - move.l #CLOCK,D0 ; fill in D0 with our one true pixel clock - rts + move.l #CLOCK,D0 ; fill in D0 with our one true pixel clock + rts */ - PUTABI (PSSO_BoardInfo_GetPixelClock); + PUTABI(PSSO_BoardInfo_GetPixelClock); dw(0x203c); dl(100227260); dw(RTS); /* CalculateMemory - ; this is simple, because we're not supporting planar modes in UAE - move.l a1,d0 - rts + ; this is simple, because we're not supporting planar modes in UAE + move.l a1,d0 + rts */ - PUTABI (PSSO_BoardInfo_CalculateMemory); + PUTABI(PSSO_BoardInfo_CalculateMemory); dw(0x2009); dw(RTS); /* GetCompatibleFormats - ; all formats can coexist without any problems, since we don't support planar stuff in UAE - move.l #RGBMASK_8BIT | RGBMASK_15BIT | RGBMASK_16BIT | RGBMASK_24BIT | RGBMASK_32BIT,d0 - rts + ; all formats can coexist without any problems, since we don't support planar stuff in UAE + move.l #RGBMASK_8BIT | RGBMASK_15BIT | RGBMASK_16BIT | RGBMASK_24BIT | RGBMASK_32BIT,d0 + rts */ - PUTABI (PSSO_BoardInfo_GetCompatibleFormats); + PUTABI(PSSO_BoardInfo_GetCompatibleFormats); dw(0x203c); dl(RGBMASK_8BIT | RGBMASK_15BIT | RGBMASK_16BIT | RGBMASK_24BIT | RGBMASK_32BIT); dw(RTS); /* CalculateBytesPerRow (optimized) */ - PUTABI (PSSO_BoardInfo_CalculateBytesPerRow); + PUTABI(PSSO_BoardInfo_CalculateBytesPerRow); dl(0x0c400140); // cmp.w #320,d0 - dw(0x6504); // bcs.s .l1 - calltrap(deftrap (picasso_CalculateBytesPerRow)); + uaecptr addr = here(); + dw(0); + calltrap(deftrap(picasso_CalculateBytesPerRow)); + uaecptr addr2 = here(); + org(addr); + dw(0x6500 | (addr2 - addr)); // bcs.s .l1 + org(addr2); dw(RTS); - dw(0x0c87); - dl(0x00000010); // l1: cmp.l #$10,d7 + dw(0x0c87); dl(0x00000010); // l1: cmp.l #$10,d7 dw(0x640a); // bcc.s .l2 dw(0x7200); // moveq #0,d1 dl(0x123b7010); // move.b table(pc,d7.w),d1 @@ -3849,7 +3365,7 @@ static void inituaegfxfuncs(uaecptr start, uaecptr ABI) dw(0xe368); // lsl.w d1,d0 dw(RTS); // .l2 dw(0x3200); // .l3 move.w d0,d1 - dw(0xd041); // add.w d1,d0 + dw(0xd041); // add.w d1,d0 dw(0xd041); // add.w d1,d0 dw(RTS); dl(0x0000ffff); // table @@ -3868,52 +3384,46 @@ static void inituaegfxfuncs(uaecptr start, uaecptr ABI) #if 1 RTGNONE(PSSO_BoardInfo_WaitVerticalSync); #else - PUTABI (PSSO_BoardInfo_WaitVerticalSync); - dl (0x48e7203e); // movem.l d2/a5/a6,-(sp) - dl (0x2c68003c); - dw (0x93c9); - dl (0x4eaefeda); - dw (0x2440); - dw (0x70ff); - dl (0x4eaefeb6); - dw (0x7400); - dw (0x1400); - dw (0x6b40); - dw (0x49f9); - dl (uaegfx_base + CARD_VSYNCLIST); - dw (0x47f9); - dl (uaegfx_base + CARD_VSYNCLIST + CARD_VSYNCMAX * 8); - dl (0x4eaeff88); - dw (0xb9cb); - dw (0x6606); - dl (0x4eaeff82); - dw (0x601c); - dw (0x4a94); - dw (0x6704); - dw (0x508c); - dw (0x60ee); - dw (0x288a); - dl (0x29420004); - dl (0x4eaeff82); - dw (0x7000); - dw (0x05c0); - dl (0x4eaefec2); - dw (0x4294); - dw (0x7000); - dw (0x1002); - dw (0x6b04); - dl (0x4eaefeb0); - dl (0x4cdf7c04); - dw (RTS); + PUTABI(PSSO_BoardInfo_WaitVerticalSync); + dl(0x48e7203e); // movem.l d2/a5/a6,-(sp) + dl(0x2c68003c); + dw(0x93c9); + dl(0x4eaefeda); + dw(0x2440); + dw(0x70ff); + dl(0x4eaefeb6); + dw(0x7400); + dw(0x1400); + dw(0x6b40); + dw(0x49f9); + dl(uaegfx_base + CARD_VSYNCLIST); + dw(0x47f9); + dl(uaegfx_base + CARD_VSYNCLIST + CARD_VSYNCMAX * 8); + dl(0x4eaeff88); + dw(0xb9cb); + dw(0x6606); + dl(0x4eaeff82); + dw(0x601c); + dw(0x4a94); + dw(0x6704); + dw(0x508c); + dw(0x60ee); + dw(0x288a); + dl(0x29420004); + dl(0x4eaeff82); + dw(0x7000); + dw(0x05c0); + dl(0x4eaefec2); + dw(0x4294); + dw(0x7000); + dw(0x1002); + dw(0x6b04); + dl(0x4eaefeb0); + dl(0x4cdf7c04); + dw(RTS); #endif RTGNONE(PSSO_BoardInfo_WaitBlitter); -#if 0 - RTGCALL2(PSSO_BoardInfo_, picasso_); - RTGCALL(PSSO_BoardInfo_, PSSO_BoardInfo_Default, picasso_); - RTGCALLDEFAULT(PSSO_BoardInfo_, PSSO_BoardInfo_Default); -#endif - RTGCALL(PSSO_BoardInfo_BlitPlanar2Direct, PSSO_BoardInfo_BlitPlanar2DirectDefault, picasso_BlitPlanar2Direct); RTGCALL(PSSO_BoardInfo_FillRect, PSSO_BoardInfo_FillRectDefault, picasso_FillRect); RTGCALL(PSSO_BoardInfo_BlitRect, PSSO_BoardInfo_BlitRectDefault, picasso_BlitRect); @@ -3941,16 +3451,15 @@ static void inituaegfxfuncs(uaecptr start, uaecptr ABI) RTGCALL2(PSSO_BoardInfo_SetInterrupt, picasso_SetInterrupt); - write_log (_T("uaegfx.card magic code: %08X-%08X ABI=%08X\n"), start, here (), ABI); + write_log(_T("uaegfx.card magic code: %08X-%08X ABI=%08X\n"), start, here(), ABI); if (ABI) - initvblankABI(uaegfx_base, ABI); + initvblankABI(ctx, uaegfx_base, ABI); } -void picasso_reset() +void picasso_reset(void) { - if (savestate_state != STATE_RESTORE) - { + if (savestate_state != STATE_RESTORE) { uaegfx_base = 0; uaegfx_old = 0; uaegfx_active = 0; @@ -3958,6 +3467,7 @@ void picasso_reset() reserved_gfxmem = 0; resetpalette(); InitPicasso96(); + picasso_rendered = false; } } @@ -3965,35 +3475,33 @@ void uaegfx_install_code(uaecptr start) { uaegfx_rom = start; org(start); - inituaegfxfuncs(start, 0); + inituaegfxfuncs(NULL, start, 0); } #define UAEGFX_VERSION 3 #define UAEGFX_REVISION 3 -static uae_u32 REGPARAM2 gfx_open(TrapContext* context) +static uae_u32 REGPARAM2 gfx_open(TrapContext *ctx) { - put_word(uaegfx_base + 32, get_word(uaegfx_base + 32) + 1); + trap_put_word(ctx, uaegfx_base + 32, trap_get_word(ctx, uaegfx_base + 32) + 1); return uaegfx_base; } - -static uae_u32 REGPARAM2 gfx_close(TrapContext* context) +static uae_u32 REGPARAM2 gfx_close(TrapContext *ctx) { - put_word(uaegfx_base + 32, get_word(uaegfx_base + 32) - 1); + trap_put_word(ctx, uaegfx_base + 32, trap_get_word(ctx, uaegfx_base + 32) - 1); return 0; } - -static uae_u32 REGPARAM2 gfx_expunge(TrapContext* context) +static uae_u32 REGPARAM2 gfx_expunge(TrapContext *ctx) { return 0; } -static uaecptr uaegfx_card_install(TrapContext* ctx, uae_u32 extrasize) +static uaecptr uaegfx_card_install(TrapContext *ctx, uae_u32 extrasize) { uae_u32 functable, datatable, a2; uaecptr openfunc, closefunc, expungefunc; uaecptr findcardfunc, initcardfunc; - uaecptr exec = get_long(4); + uaecptr exec = trap_get_long(ctx, 4); if (uaegfx_old || !gfxmem_bank.start) return 0; @@ -4004,28 +3512,23 @@ static uaecptr uaegfx_card_install(TrapContext* ctx, uae_u32 extrasize) /* Open */ openfunc = here(); - calltrap(deftrap (gfx_open)); - dw(RTS); + calltrap(deftrap(gfx_open)); dw(RTS); /* Close */ closefunc = here(); - calltrap(deftrap (gfx_close)); - dw(RTS); + calltrap(deftrap(gfx_close)); dw(RTS); /* Expunge */ expungefunc = here(); - calltrap(deftrap (gfx_expunge)); - dw(RTS); + calltrap(deftrap(gfx_expunge)); dw(RTS); /* FindCard */ findcardfunc = here(); - calltrap(deftrap (picasso_FindCard)); - dw(RTS); + calltrap(deftrap(picasso_FindCard)); dw(RTS); /* InitCard */ initcardfunc = here(); - calltrap(deftrap (picasso_InitCard)); - dw(RTS); + calltrap(deftrap(picasso_InitCard)); dw(RTS); functable = here(); dl(openfunc); @@ -4038,49 +3541,72 @@ static uaecptr uaegfx_card_install(TrapContext* ctx, uae_u32 extrasize) datatable = makedatatable(uaegfx_resid, uaegfx_resname, 0x09, -50, UAEGFX_VERSION, UAEGFX_REVISION); - a2 = m68k_areg (regs, 2); - m68k_areg (regs, 0) = functable; - m68k_areg (regs, 1) = datatable; - m68k_areg (regs, 2) = 0; - m68k_dreg (regs, 0) = CARD_SIZEOF + extrasize; - m68k_dreg (regs, 1) = 0; + a2 = trap_get_areg(ctx, 2); + +#if NEWTRAP + trap_call_add_areg(ctx, 0, functable); + trap_call_add_areg(ctx, 1, datatable); + trap_call_add_areg(ctx, 2, 0); + trap_call_add_dreg(ctx, 0, CARD_SIZEOF + extrasize); + trap_call_add_dreg(ctx, 1, 0); + uaegfx_base = trap_call_lib(ctx, exec, -0x54); /* MakeLibrary */ +#else + trap_set_areg(ctx, 0, functable); + trap_set_areg(ctx, 1, datatable); + trap_set_areg(ctx, 2, 0); + trap_set_dreg(ctx, 0, CARD_SIZEOF + extrasize); + trap_set_dreg(ctx, 1, 0); uaegfx_base = CallLib(ctx, exec, -0x54); /* MakeLibrary */ - m68k_areg (regs, 2) = a2; +#endif + + trap_set_areg(ctx, 2, a2); if (!uaegfx_base) return 0; - m68k_areg (regs, 1) = uaegfx_base; + +#if NEWTRAP + trap_call_add_areg(ctx, 1, uaegfx_base); + trap_call_lib(ctx, exec, -0x18c); /* AddLibrary */ +#else + trap_set_areg(ctx, 1, uaegfx_base); CallLib(ctx, exec, -0x18c); /* AddLibrary */ - m68k_areg (regs, 1) = EXPANSION_explibname; - m68k_dreg (regs, 0) = 0; - put_long(uaegfx_base + CARD_EXPANSIONBASE, CallLib(ctx, exec, -0x228)); /* OpenLibrary */ - put_long(uaegfx_base + CARD_EXECBASE, exec); - put_long(uaegfx_base + CARD_IRQEXECBASE, exec); - put_long(uaegfx_base + CARD_NAME, uaegfx_resname); - put_long(uaegfx_base + CARD_RESLIST, uaegfx_base + CARD_SIZEOF); - put_long(uaegfx_base + CARD_RESLISTSIZE, extrasize); +#endif + +#if NEWTRAP + trap_call_add_areg(ctx, 1, EXPANSION_explibname); + trap_call_add_dreg(ctx, 0, 0); + uae_u32 lib = trap_call_lib(ctx, exec, -0x228); /* OpenLibrary */ +#else + trap_set_areg(ctx, 1, EXPANSION_explibname); + trap_set_dreg(ctx, 0, 0); + uae_u32 lib = CallLib(ctx, exec, -0x228); /* OpenLibrary */ +#endif + + trap_put_long(ctx, uaegfx_base + CARD_EXPANSIONBASE, lib); /* OpenLibrary */ + trap_put_long(ctx, uaegfx_base + CARD_EXECBASE, exec); + trap_put_long(ctx, uaegfx_base + CARD_IRQEXECBASE, exec); + trap_put_long(ctx, uaegfx_base + CARD_NAME, uaegfx_resname); + trap_put_long(ctx, uaegfx_base + CARD_RESLIST, uaegfx_base + CARD_SIZEOF); + trap_put_long(ctx, uaegfx_base + CARD_RESLISTSIZE, extrasize); initvblankirq(ctx, uaegfx_base); - write_log (_T("uaegfx.card %d.%d init @%08X\n"), UAEGFX_VERSION, UAEGFX_REVISION, uaegfx_base); + write_log(_T("uaegfx.card %d.%d init @%08X\n"), UAEGFX_VERSION, UAEGFX_REVISION, uaegfx_base); uaegfx_active = 1; return uaegfx_base; } -uae_u32 picasso_demux(uae_u32 arg, TrapContext* ctx) +uae_u32 picasso_demux(uae_u32 arg, TrapContext *ctx) { - uae_u32 num = get_long(m68k_areg (regs, 7) + 4); + uae_u32 num = trap_get_long(ctx, trap_get_areg(ctx, 7) + 4); - if (uaegfx_base) - { - if (num >= 16 && num <= 39) - { - write_log (_T("uaelib: obsolete Picasso96 uaelib hook called, call ignored\n")); + if (uaegfx_base) { + if (num >= 16 && num <= 39) { + write_log(_T("uaelib: obsolete Picasso96 uaelib hook called, call ignored\n")); return 0; } } - if (!uaegfx_old) - { - write_log (_T("uaelib: uaelib hook in use\n")); + if (!uaegfx_old) { + write_log(_T("uaelib: uaelib hook in use\n")); uaegfx_old = 1; uaegfx_active = 1; } @@ -4114,104 +3640,91 @@ uae_u32 picasso_demux(uae_u32 arg, TrapContext* ctx) return 0; } -void restore_p96_finish() +void restore_p96_finish(void) { - init_alloc(nullptr, 0); + init_alloc(NULL, 0); if (uaegfx_rom && boardinfo) - inituaegfxfuncs(uaegfx_rom, boardinfo); -#if 0 - if (picasso_requested_on) { - picasso_on = true; - set_gc_called = 1; - init_picasso_screen (); - init_hz_p96 (); - picasso_refresh (); - } -#endif + inituaegfxfuncs(NULL, uaegfx_rom, boardinfo); } - -uae_u8* restore_p96(uae_u8* src) +uae_u8 *restore_p96(uae_u8 *src) { uae_u32 flags; int i; - if (restore_u32 () != 2) + if (restore_u32() != 2) return src; InitPicasso96(); flags = restore_u32(); picasso_requested_on = !!(flags & 1); - picasso96_state.SwitchState = picasso_requested_on; - picasso_on = false; + picasso96_state_uaegfx.SwitchState = picasso_requested_on; + picasso_on = 0; init_picasso_screen_called = 0; set_gc_called = !!(flags & 2); set_panning_called = !!(flags & 4); interrupt_enabled = !!(flags & 32); changed_prefs.rtgboards[0].rtgmem_size = restore_u32(); - picasso96_state.Address = restore_u32(); - picasso96_state.RGBFormat = (RGBFTYPE)restore_u32(); - picasso96_state.Width = restore_u16(); - picasso96_state.Height = restore_u16(); - picasso96_state.VirtualWidth = restore_u16(); - picasso96_state.VirtualHeight = restore_u16(); - picasso96_state.XOffset = restore_u16(); - picasso96_state.YOffset = restore_u16(); - picasso96_state.GC_Depth = restore_u8(); - picasso96_state.GC_Flags = restore_u8(); - picasso96_state.BytesPerRow = restore_u16(); - picasso96_state.BytesPerPixel = restore_u8(); - uaegfx_base = restore_u32 (); - uaegfx_rom = restore_u32 (); - boardinfo = restore_u32 (); - if (flags & 64) - { - for (i = 0; i < 256; i++) - { - picasso96_state.CLUT[i].Red = restore_u8 (); - picasso96_state.CLUT[i].Green = restore_u8 (); - picasso96_state.CLUT[i].Blue = restore_u8 (); + picasso96_state_uaegfx.Address = restore_u32(); + picasso96_state_uaegfx.RGBFormat = restore_u32(); + picasso96_state_uaegfx.Width = restore_u16(); + picasso96_state_uaegfx.Height = restore_u16(); + picasso96_state_uaegfx.VirtualWidth = restore_u16(); + picasso96_state_uaegfx.VirtualHeight = restore_u16(); + picasso96_state_uaegfx.XOffset = restore_u16(); + picasso96_state_uaegfx.YOffset = restore_u16(); + picasso96_state_uaegfx.GC_Depth = restore_u8(); + picasso96_state_uaegfx.GC_Flags = restore_u8(); + picasso96_state_uaegfx.BytesPerRow = restore_u16(); + picasso96_state_uaegfx.BytesPerPixel = restore_u8(); + uaegfx_base = restore_u32(); + uaegfx_rom = restore_u32(); + boardinfo = restore_u32(); + if (flags & 64) { + for (i = 0; i < 256; i++) { + picasso96_state_uaegfx.CLUT[i].Red = restore_u8(); + picasso96_state_uaegfx.CLUT[i].Green = restore_u8(); + picasso96_state_uaegfx.CLUT[i].Blue = restore_u8(); } } - picasso96_state.HostAddress = nullptr; + picasso96_state_uaegfx.HostAddress = NULL; picasso_SetPanningInit(); - picasso96_state.Extent = picasso96_state.Address + picasso96_state.BytesPerRow * picasso96_state.VirtualHeight; + picasso96_state_uaegfx.Extent = picasso96_state_uaegfx.Address + picasso96_state_uaegfx.BytesPerRow * picasso96_state_uaegfx.VirtualHeight; return src; } -uae_u8* save_p96(int* len, uae_u8* dstptr) +uae_u8 *save_p96(int *len, uae_u8 *dstptr) { uae_u8 *dstbak, *dst; int i; if (currprefs.rtgboards[0].rtgmem_size == 0) - return nullptr; + return NULL; if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = xmalloc (uae_u8, 1000); - save_u32 (2); - save_u32 ((picasso_on ? 1 : 0) | (set_gc_called ? 2 : 0) | (set_panning_called ? 4 : 0) | + dstbak = dst = xmalloc(uae_u8, 1000); + save_u32(2); + save_u32((picasso_on ? 1 : 0) | (set_gc_called ? 2 : 0) | (set_panning_called ? 4 : 0) | (interrupt_enabled ? 32 : 0) | 64); - save_u32 (currprefs.rtgboards[0].rtgmem_size); - save_u32 (picasso96_state.Address); - save_u32 (picasso96_state.RGBFormat); - save_u16 (picasso96_state.Width); - save_u16 (picasso96_state.Height); - save_u16 (picasso96_state.VirtualWidth); - save_u16 (picasso96_state.VirtualHeight); - save_u16 (picasso96_state.XOffset); - save_u16 (picasso96_state.YOffset); - save_u8 (picasso96_state.GC_Depth); - save_u8 (picasso96_state.GC_Flags); - save_u16 (picasso96_state.BytesPerRow); - save_u8 (picasso96_state.BytesPerPixel); - save_u32 (uaegfx_base); - save_u32 (uaegfx_rom); - save_u32 (boardinfo); - for (i = 0; i < 256; i++) - { - save_u8 (picasso96_state.CLUT[i].Red); - save_u8 (picasso96_state.CLUT[i].Green); - save_u8 (picasso96_state.CLUT[i].Blue); + save_u32(currprefs.rtgboards[0].rtgmem_size); + save_u32(picasso96_state_uaegfx.Address); + save_u32(picasso96_state_uaegfx.RGBFormat); + save_u16(picasso96_state_uaegfx.Width); + save_u16(picasso96_state_uaegfx.Height); + save_u16(picasso96_state_uaegfx.VirtualWidth); + save_u16(picasso96_state_uaegfx.VirtualHeight); + save_u16(picasso96_state_uaegfx.XOffset); + save_u16(picasso96_state_uaegfx.YOffset); + save_u8(picasso96_state_uaegfx.GC_Depth); + save_u8(picasso96_state_uaegfx.GC_Flags); + save_u16(picasso96_state_uaegfx.BytesPerRow); + save_u8(picasso96_state_uaegfx.BytesPerPixel); + save_u32(uaegfx_base); + save_u32(uaegfx_rom); + save_u32(boardinfo); + for (i = 0; i < 256; i++) { + save_u8(picasso96_state_uaegfx.CLUT[i].Red); + save_u8(picasso96_state_uaegfx.CLUT[i].Green); + save_u8(picasso96_state_uaegfx.CLUT[i].Blue); } *len = dst - dstbak; return dstbak; diff --git a/src/osdep/picasso96.h b/src/osdep/picasso96.h index d4e74d15..a28441e2 100644 --- a/src/osdep/picasso96.h +++ b/src/osdep/picasso96.h @@ -8,8 +8,13 @@ #ifndef __PICASSO96_H__ #define __PICASSO96_H__ +#include "uae/types.h" +#include "traps.h" #include "rtgmodes.h" +void picasso96_alloc (TrapContext* ctx); +uae_u32 picasso_demux (uae_u32 arg, TrapContext *ctx); + struct ScreenResolution { uae_u32 width; /* in pixels */ @@ -253,11 +258,11 @@ struct LibResolution { #define PSSO_RenderInfo_sizeof 12 struct RenderInfo { - uae_u8 *Memory; - uae_s16 BytesPerRow; - uae_s16 pad; - RGBFTYPE RGBFormat; - uaecptr AMemory; + uae_u8 *Memory; + uae_s16 BytesPerRow; + uae_s16 pad; + RGBFTYPE RGBFormat; + uaecptr AMemory; }; #define PSSO_Pattern_Memory 0 @@ -269,11 +274,12 @@ struct RenderInfo { #define PSSO_Pattern_DrawMode 17 #define PSSO_Pattern_sizeof 18 struct Pattern { - uae_u8 *Memory; - uae_u16 XOffset, YOffset; - uae_u32 FgPen, BgPen; - uae_u8 Size; /* Width: 16, Height: (1< #include #include +#ifndef ANDROID #include -#include "SDL.h" +#else +int backtrace(void**,int){ return 0; } +char** backtrace_symbols(void* const*,int){return NULL; } +void backtrace_symbols_fd(void* const*,int,int){} +#endif +#include -#define DEBUG 0 -#include "debug.h" +extern uae_u8* current_compile_p; +extern uae_u8* compiled_code; +extern uae_u8 *popallspace; +#define POPALLSPACE_SIZE 2048 +extern blockinfo* active; +extern blockinfo* dormant; +extern void invalidate_block(blockinfo* bi); +extern void raise_in_cl_list(blockinfo* bi); + -enum transfer_type_t -{ - TYPE_UNKNOWN, - TYPE_LOAD, - TYPE_STORE +#define SHOW_DETAILS 2 + +#ifdef WITH_LOGGING +#define output_log write_log +#else +#define output_log +#endif + + +enum transfer_type_t { + TYPE_UNKNOWN, + TYPE_LOAD, + TYPE_STORE }; -enum type_size_t -{ - SIZE_UNKNOWN, - SIZE_BYTE, - SIZE_WORD, - SIZE_INT +enum type_size_t { + SIZE_UNKNOWN, + SIZE_BYTE, + SIZE_WORD, + SIZE_INT }; -static int in_handler=0; - -enum -{ - ARM_REG_PC = 15, - ARM_REG_CPSR = 16 +enum style_type_t { + STYLE_SIGNED, + STYLE_UNSIGNED }; -STATIC_INLINE void unknown_instruction(uae_u32 instr) +static int in_handler = 0; +static int max_signals = 200; + +void init_max_signals(void) { - panicbug("Unknown instruction %08x!\n", instr); - SDL_Quit(); - abort(); +#ifdef WITH_LOGGING + max_signals = 20; +#else + max_signals = 200; +#endif } -static bool handle_arm_instruction(unsigned long *pregs, uintptr addr) +enum { + ARM_REG_PC = 15, + ARM_REG_CPSR = 16 +}; + +static const char * reg_names[] = { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10/sl", "r11/fp", "r12/ip", "r13/sp", "r14/lr", "r15/pc" +}; + + +static int delete_trigger(blockinfo *bi, void *pc) { - unsigned int *pc = (unsigned int *)pregs[ARM_REG_PC]; - - panicbug("IP: %p [%08x] %u\n", pc, pc[0], addr); - if (pc == nullptr) - return false; - - if (in_handler > 0) - { - panicbug("Segmentation fault in handler :-(\n"); - return false; - } - - in_handler += 1; - - transfer_type_t transfer_type = TYPE_UNKNOWN; - int transfer_size = SIZE_UNKNOWN; - enum { SIGNED, UNSIGNED }; - int style = UNSIGNED; - - // Handle load/store instructions only - const unsigned int opcode = pc[0]; - switch ((opcode >> 25) & 7) - { - case 0: // Halfword and Signed Data Transfer (LDRH, STRH, LDRSB, LDRSH) - // Determine transfer size (S/H bits) - switch ((opcode >> 5) & 3) - { - case 0: // SWP instruction - panicbug("FIXME: SWP Instruction\n"); - break; - case 1: // Unsigned halfwords - transfer_size = SIZE_WORD; - break; - case 3: // Signed halfwords - style = SIGNED; - transfer_size = SIZE_WORD; - break; - case 2: // Signed byte - style = SIGNED; - transfer_size = SIZE_BYTE; - break; - } - break; - case 2: - case 3: // Single Data Transfer (LDR, STR) - style = UNSIGNED; - // Determine transfer size (B bit) - if (((opcode >> 22) & 1) == 1) - transfer_size = SIZE_BYTE; - else - transfer_size = SIZE_INT; - break; - default: - panicbug("FIXME: support load/store mutliple?\n"); - in_handler--; - return false; - } - - // Check for invalid transfer size (SWP instruction?) - if (transfer_size == SIZE_UNKNOWN) - { - panicbug("Invalid transfer size\n"); - in_handler--; - return false; - } - - // Determine transfer type (L bit) - if (((opcode >> 20) & 1) == 1) - transfer_type = TYPE_LOAD; - else - transfer_type = TYPE_STORE; - - int rd = (opcode >> 12) & 0xf; - - if (transfer_type == TYPE_LOAD) - { - switch(transfer_size) - { - case SIZE_BYTE: - { - pregs[rd] = style == SIGNED ? uae_s8(get_byte(addr)) : uae_u8(get_byte(addr)); - break; - } - case SIZE_WORD: - { - pregs[rd] = do_byteswap_16(style == SIGNED ? uae_s16(get_word(addr)) : uae_u16(get_word(addr))); - break; - } - case SIZE_INT: - { - pregs[rd] = do_byteswap_32(get_long(addr)); - break; - } - } - } - else - { - switch(transfer_size) - { - case SIZE_BYTE: - { - put_byte(addr, pregs[rd]); - break; - } - case SIZE_WORD: - { - put_word(addr, do_byteswap_16(pregs[rd])); - break; - } - case SIZE_INT: - { - put_long(addr, do_byteswap_32(pregs[rd])); - break; - } - } - } - - pregs[ARM_REG_PC] += 4; - panicbug("processed: %lu \n", pregs[ARM_REG_PC]); - - in_handler--; - - return true; + while (bi) { + if (bi->handler && (uae_u8*)bi->direct_handler <= pc && (uae_u8*)bi->nexthandler > pc) { + output_log(_T("JIT: Deleted trigger (0x%08x < 0x%08x < 0x%08x) 0x%08x\n"), + bi->handler, pc, bi->nexthandler, bi->pc_p); + invalidate_block(bi); + raise_in_cl_list(bi); + countdown = 0; + set_special(0); + return 1; + } + bi = bi->next; + } + return 0; } -#define SIG_READ 1 -#define SIG_WRITE 2 +#define HANDLE_EXCEPTION_NONE 0 +#define HANDLE_EXCEPTION_OK 1 +#define HANDLE_EXCEPTION_A4000RAM 2 -extern void dump_compiler(uae_u32 *sp); +static int handle_exception(unsigned long *pregs, uintptr fault_addr) +{ + int handled = HANDLE_EXCEPTION_NONE; + unsigned int *fault_pc = (unsigned int *)pregs[ARM_REG_PC]; + + if (fault_pc == 0) { + output_log(_T("PC is NULL.\n")); + return HANDLE_EXCEPTION_NONE; + } + + // Check for exception in handler + if (in_handler > 0) { + output_log(_T("Segmentation fault in handler.\n")); + return HANDLE_EXCEPTION_NONE; + } + ++in_handler; + + for (;;) { + // We analyse only exceptions from JIT + if (currprefs.cachesize == 0) { + output_log(_T("JIT not in use.\n")); + break; + } + + // Did the error happens in compiled code? + if ((uae_u8*)fault_pc >= compiled_code && (uae_u8*)fault_pc < current_compile_p) + output_log(_T("Error in compiled code.\n")); + else if ((uae_u8*)fault_pc >= popallspace && (uae_u8*)fault_pc < popallspace + POPALLSPACE_SIZE) + output_log(_T("Error in popallspace code.\n")); + else { + output_log(_T("Error not in JIT code.\n")); + break; + } + + // Get Amiga address of illegal memory address + uintptr amiga_addr = (uae_u32)fault_addr - (uae_u32)natmem_offset; + + // Check for stupid RAM detection of kickstart + if (a3000lmem_bank.allocated_size > 0 && amiga_addr >= a3000lmem_bank.start - 0x00100000 && amiga_addr < a3000lmem_bank.start - 0x00100000 + 8) { + output_log(_T(" Stupid kickstart detection for size of ramsey_low at 0x%08x.\n"), amiga_addr); + pregs[ARM_REG_PC] += 4; + handled = HANDLE_EXCEPTION_A4000RAM; + break; + } + + // Check for stupid RAM detection of kickstart + if (a3000hmem_bank.allocated_size > 0 && amiga_addr >= a3000hmem_bank.start + a3000hmem_bank.allocated_size && amiga_addr < a3000hmem_bank.start + a3000hmem_bank.allocated_size + 8) { + output_log(_T(" Stupid kickstart detection for size of ramsey_high at 0x%08x.\n"), amiga_addr); + pregs[ARM_REG_PC] += 4; + handled = HANDLE_EXCEPTION_A4000RAM; + break; + } + + // Get memory bank of address + addrbank *ab = &get_mem_bank(amiga_addr); + if (ab) + output_log(_T("JIT: Address bank: %s, address %08x\n"), ab->name ? ab->name : _T("NONE"), amiga_addr); + + // Analyse ARM instruction + const unsigned int opcode = fault_pc[0]; + transfer_type_t transfer_type = TYPE_UNKNOWN; + int transfer_size = SIZE_UNKNOWN; + int style = STYLE_UNSIGNED; + output_log(_T("JIT: ARM opcode = 0x%08x\n"), opcode); + + // Handle load/store instructions only + switch ((opcode >> 25) & 7) { + case 0: // Halfword and Signed Data Transfer (LDRH, STRH, LDRSB, LDRSH) + // Determine transfer size (S/H bits) + switch ((opcode >> 5) & 3) { + case 0: // SWP instruction + output_log(_T("ARM: SWP Instruction, not supported (0x%08x)\n"), opcode); + break; + case 1: // Unsigned halfwords + transfer_size = SIZE_WORD; + break; + case 3: // Signed halfwords + style = STYLE_SIGNED; + transfer_size = SIZE_WORD; + break; + case 2: // Signed byte + style = STYLE_SIGNED; + transfer_size = SIZE_BYTE; + break; + } + break; + + case 2: + case 3: // Single Data Transfer (LDR, STR) + style = STYLE_UNSIGNED; + // Determine transfer size (B bit) + if (((opcode >> 22) & 1) == 1) + transfer_size = SIZE_BYTE; + else + transfer_size = SIZE_INT; + break; + + default: + output_log(_T("ARM: Handling of instruction 0x%08x not supported.\n"), opcode); + } + + // Determine transfer type (L bit) + if (((opcode >> 20) & 1) == 1) + transfer_type = TYPE_LOAD; + else + transfer_type = TYPE_STORE; + + // Get ARM register + int rd = (opcode >> 12) & 0xf; + + output_log(_T("%s %s register %s\n"), + transfer_size == SIZE_BYTE ? _T("byte") : transfer_size == SIZE_WORD ? _T("word") : transfer_size == SIZE_INT ? _T("long") : _T("unknown"), + transfer_type == TYPE_LOAD ? _T("load to") : _T("store from"), + reg_names[rd]); + + if (transfer_size != SIZE_UNKNOWN) { + if (transfer_type == TYPE_LOAD) { + // Perform load via indirect memory call + uae_u32 oldval = pregs[rd]; + switch (transfer_size) { + case SIZE_BYTE: + pregs[rd] = style == STYLE_SIGNED ? (uae_s8)get_byte(amiga_addr) : (uae_u8)get_byte(amiga_addr); + break; + + case SIZE_WORD: + pregs[rd] = do_byteswap_16(style == STYLE_SIGNED ? (uae_s16)get_word(amiga_addr) : (uae_u16)get_word(amiga_addr)); + break; + + case SIZE_INT: + pregs[rd] = do_byteswap_32(get_long(amiga_addr)); + break; + } + output_log(_T("New value in %s: 0x%08x (old: 0x%08x)\n"), reg_names[rd], pregs[rd], oldval); + } + else { + // Perform store via indirect memory call + switch (transfer_size) { + case SIZE_BYTE: { + put_byte(amiga_addr, pregs[rd]); + break; + } + case SIZE_WORD: { + put_word(amiga_addr, do_byteswap_16(pregs[rd])); + break; + } + case SIZE_INT: { + put_long(amiga_addr, do_byteswap_32(pregs[rd])); + break; + } + } + output_log(_T("Stored value from %s to 0x%08x\n"), reg_names[rd], amiga_addr); + } + + // Go to next instruction + pregs[ARM_REG_PC] += 4; + handled = HANDLE_EXCEPTION_OK; + + if (!delete_trigger(active, fault_pc)) { + /* Not found in the active list. Might be a rom routine that + * is in the dormant list */ + delete_trigger(dormant, fault_pc); + } + } + + break; + } + + in_handler--; + return handled; +} void signal_segv(int signum, siginfo_t* info, void*ptr) { - int i, f = 0; - ucontext_t *ucontext = (ucontext_t*)ptr; - Dl_info dlinfo; + ucontext_t *ucontext = (ucontext_t*)ptr; + Dl_info dlinfo; + + output_log(_T("--- New exception ---\n")); #ifdef TRACER - trace_end(); + trace_end(); #endif - void **bp = 0; - void *ip = 0; + mcontext_t *context = &(ucontext->uc_mcontext); + unsigned long *regs = &context->arm_r0; + uintptr addr = (uintptr)info->si_addr; - mcontext_t *context = &(ucontext->uc_mcontext); - unsigned long *regs = &context->arm_r0; - uintptr addr = uintptr(info->si_addr); - addr = uae_u32(addr) - uae_u32(natmem_offset); - if (handle_arm_instruction(regs, addr)) - return; + int handled = handle_exception(regs, addr); - if(signum == 4) - printf("Illegal Instruction!\n"); - else - printf("Segmentation Fault!\n"); +#if SHOW_DETAILS + if (handled != HANDLE_EXCEPTION_A4000RAM) { + if (signum == 4) + output_log(_T("Illegal Instruction\n")); + else + output_log(_T("Segmentation Fault\n")); - printf("info.si_signo = %d\n", signum); - printf("info.si_errno = %d\n", info->si_errno); -// printf("info.si_code = %d (%s)\n", info->si_code, si_codes[info->si_code]); - printf("info.si_code = %d\n", info->si_code); - printf("info.si_addr = %p\n", info->si_addr); - if(signum == 4) - printf(" value = 0x%08x\n", *((uae_u32*)(info->si_addr))); - printf("reg[%02d] = 0x%08x\n",0, ucontext->uc_mcontext.arm_r0); - printf("reg[%02d] = 0x%08x\n",1, ucontext->uc_mcontext.arm_r1); - printf("reg[%02d] = 0x%08x\n",2, ucontext->uc_mcontext.arm_r2); - printf("reg[%02d] = 0x%08x\n",3, ucontext->uc_mcontext.arm_r3); - printf("reg[%02d] = 0x%08x\n",4, ucontext->uc_mcontext.arm_r4); - printf("reg[%02d] = 0x%08x\n",5, ucontext->uc_mcontext.arm_r5); - printf("reg[%02d] = 0x%08x\n",6, ucontext->uc_mcontext.arm_r6); - printf("reg[%02d] = 0x%08x\n",7, ucontext->uc_mcontext.arm_r7); - printf("reg[%02d] = 0x%08x\n",8, ucontext->uc_mcontext.arm_r8); - printf("reg[%02d] = 0x%08x\n",9, ucontext->uc_mcontext.arm_r9); - printf("reg[%02d] = 0x%08x\n",10, ucontext->uc_mcontext.arm_r10); - printf("FP = 0x%08x\n", ucontext->uc_mcontext.arm_fp); - printf("IP = 0x%08x\n", ucontext->uc_mcontext.arm_ip); - printf("SP = 0x%08x\n", ucontext->uc_mcontext.arm_sp); - printf("LR = 0x%08x\n", ucontext->uc_mcontext.arm_lr); - printf("PC = 0x%08x\n", ucontext->uc_mcontext.arm_pc); - printf("CPSR = 0x%08x\n", ucontext->uc_mcontext.arm_cpsr); - printf("Fault Address = 0x%08x\n", ucontext->uc_mcontext.fault_address); - printf("Trap no = 0x%08x\n", ucontext->uc_mcontext.trap_no); - printf("Err Code = 0x%08x\n", ucontext->uc_mcontext.error_code); - printf("Old Mask = 0x%08x\n", ucontext->uc_mcontext.oldmask); + output_log(_T("info.si_signo = %d\n"), signum); + output_log(_T("info.si_errno = %d\n"), info->si_errno); + output_log(_T("info.si_code = %d\n"), info->si_code); + output_log(_T("info.si_addr = %08x\n"), info->si_addr); + if (signum == 4) + output_log(_T(" value = 0x%08x\n"), *((uae_u32*)(info->si_addr))); + output_log(_T("r0 = 0x%08x\n"), ucontext->uc_mcontext.arm_r0); + output_log(_T("r1 = 0x%08x\n"), ucontext->uc_mcontext.arm_r1); + output_log(_T("r2 = 0x%08x\n"), ucontext->uc_mcontext.arm_r2); + output_log(_T("r3 = 0x%08x\n"), ucontext->uc_mcontext.arm_r3); + output_log(_T("r4 = 0x%08x\n"), ucontext->uc_mcontext.arm_r4); + output_log(_T("r5 = 0x%08x\n"), ucontext->uc_mcontext.arm_r5); + output_log(_T("r6 = 0x%08x\n"), ucontext->uc_mcontext.arm_r6); + output_log(_T("r7 = 0x%08x\n"), ucontext->uc_mcontext.arm_r7); + output_log(_T("r8 = 0x%08x\n"), ucontext->uc_mcontext.arm_r8); + output_log(_T("r9 = 0x%08x\n"), ucontext->uc_mcontext.arm_r9); + output_log(_T("r10 = 0x%08x\n"), ucontext->uc_mcontext.arm_r10); + output_log(_T("FP = 0x%08x\n"), ucontext->uc_mcontext.arm_fp); + output_log(_T("IP = 0x%08x\n"), ucontext->uc_mcontext.arm_ip); + output_log(_T("SP = 0x%08x\n"), ucontext->uc_mcontext.arm_sp); + output_log(_T("LR = 0x%08x\n"), ucontext->uc_mcontext.arm_lr); + output_log(_T("PC = 0x%08x\n"), ucontext->uc_mcontext.arm_pc); + output_log(_T("CPSR = 0x%08x\n"), ucontext->uc_mcontext.arm_cpsr); + output_log(_T("Fault Address = 0x%08x\n"), ucontext->uc_mcontext.fault_address); + output_log(_T("Trap no = 0x%08x\n"), ucontext->uc_mcontext.trap_no); + output_log(_T("Err Code = 0x%08x\n"), ucontext->uc_mcontext.error_code); + output_log(_T("Old Mask = 0x%08x\n"), ucontext->uc_mcontext.oldmask); - void *getaddr = (void *)ucontext->uc_mcontext.arm_lr; - if(dladdr(getaddr, &dlinfo)) - printf("LR - 0x%08p: <%s> (%s)\n", getaddr, dlinfo.dli_sname, dlinfo.dli_fname); - else - printf("LR - 0x%08p: symbol not found\n", getaddr); + void *getaddr = (void *)ucontext->uc_mcontext.arm_lr; + if (dladdr(getaddr, &dlinfo)) + output_log(_T("LR - 0x%08X: <%s> (%s)\n"), getaddr, dlinfo.dli_sname, dlinfo.dli_fname); + else + output_log(_T("LR - 0x%08X: symbol not found\n"), getaddr); + } +#endif - SDL_Quit(); - exit(1); +#if SHOW_DETAILS > 1 + if (handled != HANDLE_EXCEPTION_A4000RAM) { + output_log(_T("Stack trace:\n")); + +#define MAX_BACKTRACE 20 + + void *array[MAX_BACKTRACE]; + int size = backtrace(array, MAX_BACKTRACE); + for (int i = 0; i (%s)\n"), array[i], symname, + (unsigned long)array[i] - (unsigned long)dlinfo.dli_saddr, dlinfo.dli_fname); + } + } + + void *ip = (void*)ucontext->uc_mcontext.arm_r10; + void **bp = (void**)ucontext->uc_mcontext.arm_r10; + int f = 0; + while (bp && ip) { + if (!dladdr(ip, &dlinfo)) { + output_log(_T("IP out of range\n")); + break; + } + const char *symname = dlinfo.dli_sname; + output_log(_T("%02d: 0x%08x <%s + 0x%08x> (%s)\n"), ++f, ip, symname, + (unsigned long)ip - (unsigned long)dlinfo.dli_saddr, dlinfo.dli_fname); + if (dlinfo.dli_sname && !strcmp(dlinfo.dli_sname, "main")) + break; + ip = bp[1]; + bp = (void**)bp[0]; + } + + output_log(_T("Stack trace (non-dedicated):\n")); + char **strings; + void *bt[100]; + int sz = backtrace(bt, 100); + strings = backtrace_symbols(bt, sz); + for (int i = 0; i < sz; ++i) + output_log(_T("%s\n"), strings[i]); + output_log(_T("End of stack trace.\n")); + } +#endif + + output_log(_T("--- end exception ---\n")); + + if (handled != HANDLE_EXCEPTION_A4000RAM) { + --max_signals; + if (max_signals <= 0) { + target_startup_msg(_T("Exception"), _T("Too many access violations. Please turn off JIT.")); + uae_restart(1, NULL); + return; + } + } + + if (handled != HANDLE_EXCEPTION_NONE) + return; + + SDL_Quit(); + exit(1); +} + + +void signal_buserror(int signum, siginfo_t* info, void*ptr) +{ + ucontext_t *ucontext = (ucontext_t*)ptr; + Dl_info dlinfo; + + output_log(_T("--- New exception ---\n")); + +#ifdef TRACER + trace_end(); +#endif + + mcontext_t *context = &(ucontext->uc_mcontext); + unsigned long *regs = &context->arm_r0; + uintptr addr = (uintptr)info->si_addr; + + output_log(_T("info.si_signo = %d\n"), signum); + output_log(_T("info.si_errno = %d\n"), info->si_errno); + output_log(_T("info.si_code = %d\n"), info->si_code); + output_log(_T("info.si_addr = %08x\n"), info->si_addr); + if (signum == 4) + output_log(_T(" value = 0x%08x\n"), *((uae_u32*)(info->si_addr))); + output_log(_T("r0 = 0x%08x\n"), ucontext->uc_mcontext.arm_r0); + output_log(_T("r1 = 0x%08x\n"), ucontext->uc_mcontext.arm_r1); + output_log(_T("r2 = 0x%08x\n"), ucontext->uc_mcontext.arm_r2); + output_log(_T("r3 = 0x%08x\n"), ucontext->uc_mcontext.arm_r3); + output_log(_T("r4 = 0x%08x\n"), ucontext->uc_mcontext.arm_r4); + output_log(_T("r5 = 0x%08x\n"), ucontext->uc_mcontext.arm_r5); + output_log(_T("r6 = 0x%08x\n"), ucontext->uc_mcontext.arm_r6); + output_log(_T("r7 = 0x%08x\n"), ucontext->uc_mcontext.arm_r7); + output_log(_T("r8 = 0x%08x\n"), ucontext->uc_mcontext.arm_r8); + output_log(_T("r9 = 0x%08x\n"), ucontext->uc_mcontext.arm_r9); + output_log(_T("r10 = 0x%08x\n"), ucontext->uc_mcontext.arm_r10); + output_log(_T("FP = 0x%08x\n"), ucontext->uc_mcontext.arm_fp); + output_log(_T("IP = 0x%08x\n"), ucontext->uc_mcontext.arm_ip); + output_log(_T("SP = 0x%08x\n"), ucontext->uc_mcontext.arm_sp); + output_log(_T("LR = 0x%08x\n"), ucontext->uc_mcontext.arm_lr); + output_log(_T("PC = 0x%08x\n"), ucontext->uc_mcontext.arm_pc); + output_log(_T("CPSR = 0x%08x\n"), ucontext->uc_mcontext.arm_cpsr); + output_log(_T("Fault Address = 0x%08x\n"), ucontext->uc_mcontext.fault_address); + output_log(_T("Trap no = 0x%08x\n"), ucontext->uc_mcontext.trap_no); + output_log(_T("Err Code = 0x%08x\n"), ucontext->uc_mcontext.error_code); + output_log(_T("Old Mask = 0x%08x\n"), ucontext->uc_mcontext.oldmask); + + void *getaddr = (void *)ucontext->uc_mcontext.arm_lr; + if (dladdr(getaddr, &dlinfo)) + output_log(_T("LR - 0x%08X: <%s> (%s)\n"), getaddr, dlinfo.dli_sname, dlinfo.dli_fname); + else + output_log(_T("LR - 0x%08X: symbol not found\n"), getaddr); + + output_log(_T("Stack trace:\n")); + +#define MAX_BACKTRACE 20 + + void *array[MAX_BACKTRACE]; + int size = backtrace(array, MAX_BACKTRACE); + for (int i = 0; i (%s)\n"), array[i], symname, + (unsigned long)array[i] - (unsigned long)dlinfo.dli_saddr, dlinfo.dli_fname); + } + } + + void *ip = (void*)ucontext->uc_mcontext.arm_r10; + void **bp = (void**)ucontext->uc_mcontext.arm_r10; + int f = 0; + while (bp && ip) { + if (!dladdr(ip, &dlinfo)) { + output_log(_T("IP out of range\n")); + break; + } + const char *symname = dlinfo.dli_sname; + output_log(_T("%02d: 0x%08x <%s + 0x%08x> (%s)\n"), ++f, ip, symname, + (unsigned long)ip - (unsigned long)dlinfo.dli_saddr, dlinfo.dli_fname); + if (dlinfo.dli_sname && !strcmp(dlinfo.dli_sname, "main")) + break; + ip = bp[1]; + bp = (void**)bp[0]; + } + + output_log(_T("Stack trace (non-dedicated):\n")); + char **strings; + void *bt[100]; + int sz = backtrace(bt, 100); + strings = backtrace_symbols(bt, sz); + for (int i = 0; i < sz; ++i) + output_log(_T("%s\n"), strings[i]); + output_log(_T("End of stack trace.\n")); + + output_log(_T("--- end exception ---\n")); + + SDL_Quit(); + exit(1); +} + + +void signal_term(int signum, siginfo_t* info, void*ptr) +{ + output_log(_T("--- SIGTERM ---\n")); + +#ifdef TRACER + trace_end(); +#endif + + SDL_Quit(); + exit(1); } diff --git a/src/osdep/sysconfig.h b/src/osdep/sysconfig.h index ece93d65..84e7e9a6 100644 --- a/src/osdep/sysconfig.h +++ b/src/osdep/sysconfig.h @@ -1,21 +1,26 @@ #pragma once -#pragma warning (disable : 4761) -#pragma warning (disable : 4996) -#pragma warning (disable : 4018) - #define SUPPORT_THREADS -#define MAX_DPATH 256 + +#define MAX_DPATH 1000 + +#include + +#ifndef MAX_PATH +#define MAX_PATH PATH_MAX +#endif /* #define DRIVESOUND */ /* #define GFXFILTER */ //#define USE_SOFT_LONG_DOUBLE +#define PACKAGE_STRING "AMIBERRY" /* #define DEBUGGER */ #define FILESYS /* filesys emulation */ #define UAE_FILESYS_THREADS #define AUTOCONFIG /* autoconfig support, fast ram, harddrives etc.. */ #define JIT /* JIT compiler support */ +/* #define USE_JIT_FPU */ /* #define NATMEM_OFFSET natmem_offset */ /* #define CATWEASEL */ /* Catweasel MK2/3 support */ /* #define AHI */ /* AHI sound emulation */ @@ -25,22 +30,37 @@ #define CD32 /* CD32 emulation */ /* #define CDTV */ /* CDTV emulation */ /* #define PARALLEL_PORT */ /* parallel port emulation */ +/* #define PARALLEL_DIRECT */ /* direct parallel port emulation */ /* #define SERIAL_PORT */ /* serial port emulation */ +/* #define SERIAL_ENET */ /* serial port UDP transport */ /* #define SCSIEMU */ /* uaescsi.device emulation */ /* #define UAESERIAL */ /* uaeserial.device emulation */ #define FPUEMU /* FPU emulation */ /* #define FPU_UAE */ -/* #define MMUEMU Aranym 68040 MMU */ -/* #define FULLMMU Aranym 68040 MMU */ +/* #define WITH_SOFTFLOAT */ +/* #define MMUEMU */ /* Aranym 68040 MMU */ +/* #define FULLMMU */ /* Aranym 68040 MMU */ #define CPUEMU_0 /* generic 680x0 emulation */ -#define CPUEMU_11 /* 68000+prefetch emulation */ -/* #define CPUEMU_12 */ /* cycle-exact cpu&blitter */ -/* #define ACTION_REPLAY */ /* Action Replay 1/2/3 support */ -#define PICASSO96 /* Picasso96 display card emulation */ -/* #define UAEGFX_INTERNAL */ /* built-in libs:picasso96/uaegfx.card */ +#define CPUEMU_11 /* 68000/68010 prefetch emulation */ +/* #define CPUEMU_13 */ /* 68000/68010 cycle-exact cpu&blitter */ +/* #define CPUEMU_20 */ /* 68020 prefetch */ +/* #define CPUEMU_21 */ /* 68020 "cycle-exact" + blitter */ +/* #define CPUEMU_22 */ /* 68030 prefetch */ +/* #define CPUEMU_23 */ /* 68030 "cycle-exact" + blitter */ +/* #define CPUEMU_24 */ /* 68060 "cycle-exact" + blitter */ +/* #define CPUEMU_25 */ /* 68040 "cycle-exact" + blitter */ +/* #define CPUEMU_31 */ /* Aranym 68040 MMU */ +/* #define CPUEMU_32 */ /* Previous 68030 MMU */ +/* #define CPUEMU_33 */ /* 68060 MMU */ +#define CPUEMU_40 /* generic 680x0 with JIT direct memory access */ +/* #define CPUEMU_50 */ /* generic 680x0 with indirect memory access */ +#define ACTION_REPLAY /* Action Replay 1/2/3 support */ +#define PICASSO96 /* Picasso96 display card emulation */ +#define UAEGFX_INTERNAL /* built-in libs:picasso96/uaegfx.card */ #define BSDSOCKET /* bsdsocket.library emulation */ /* #define CAPS */ /* CAPS-image support */ -/* #define FDI2RAW */ /* FDI 1.0 and 2.x image support */ +/* #define SCP */ /* SuperCardPro */ +#define FDI2RAW /* FDI 1.0 and 2.x image support */ /* #define AVIOUTPUT */ /* Avioutput support */ /* #define PROWIZARD */ /* Pro-Wizard module ripper */ /* #define ARCADIA */ /* Arcadia arcade system */ @@ -48,18 +68,51 @@ /* #define LOGITECHLCD */ /* Logitech G15 LCD */ #define SAVESTATE /* State file support */ /* #define A2091 */ /* A590/A2091 SCSI */ -/* #define NCR */ /* A4000T/A4091 SCSI */ +/* #define A2065 */ /* A2065 Ethernet card */ +/* #define GFXBOARD */ /* Hardware graphics board */ +/* #define NCR */ /* A4000T/A4091, 53C710/53C770 SCSI */ +/* #define NCR9X */ /* 53C9X SCSI */ /* #define SANA2 */ /* SANA2 network driver */ /* #define AMAX */ /* A-Max ROM adapater emulation */ /* #define RETROPLATFORM */ /* Cloanto RetroPlayer support */ - -/* #define INPUT_RECORDER */ /* Use input recoder */ +/* #define WITH_CHD */ +/* #define WITH_LUA */ /* lua scripting */ +/* #define WITH_UAENATIVE */ +/* #define WITH_SLIRP */ +/* #define WITH_BUILTIN_SLIRP */ +/* #define WITH_TABLETLIBRARY */ +/* #define WITH_UAENET_PCAP */ +/* #define WITH_PPC */ +/* #define WITH_QEMU_CPU */ +/* #define WITH_TOCCATA */ +/* #define WITH_PCI */ +/* #define WITH_X86 */ /* #define CUSTOM_SIMPLE */ /* simplified custom chipset emulation */ /* #define CPUEMU_68000_ONLY */ /* drop 68010+ commands from CPUEMU_0 */ /* #define ADDRESS_SPACE_24BIT */ #define INPUTDEVICE_SIMPLE /* simplified inputdevice for faster emulation */ +/* #define WITH_SCSI_IOCTL */ +/* #define WITH_SCSI_SPTI */ + +#define A_ZIP +/* #define A_RAR */ +#define A_7Z +#define A_LHA +#define A_LZX +#define A_DMS +#define A_WRP + +#define UAE_RAND_MAX RAND_MAX + +#ifndef GFXFILTER +#undef OPENGL +#undef D3D +#endif + +#include + #define SIZEOF_VOID_P 4 #if !defined(AHI) @@ -171,7 +224,7 @@ typedef long uae_atomic; /* Define if statfs takes 2 args and struct statfs has a field named f_bsize. [4.3BSD, SunOS 4, HP-UX, AIX PS/2] */ -#define STAT_STATFS2_BSIZE 1 +/* #define STAT_STATFS2_BSIZE 1 */ /* Define if statfs takes 2 args and struct statfs has a field named f_fsize. [4.4BSD, NetBSD] */ @@ -185,7 +238,7 @@ typedef long uae_atomic; /* #undef STAT_STATFS4 */ /* Define if there is a function named statvfs. [SVR4] */ -/* #undef STAT_STATVFS */ +#define STAT_STATVFS /* Define if the block counts reported by statfs may be truncated to 2GB and the correct values may be stored in the f_spare array. @@ -277,9 +330,6 @@ typedef long uae_atomic; /* Define if you have the select function. */ #define HAVE_SELECT 1 -/* Define if you have the setitimer function. */ -#define HAVE_SETITIMER 1 - /* Define if you have the sigaction function. */ #define HAVE_SIGACTION 1 @@ -310,9 +360,6 @@ typedef long uae_atomic; /* Define if you have the vsprintf function. */ #define HAVE_VSPRINTF 1 -/* Define if you have the header file. */ -/* #undef HAVE_SDL_SDL_H */ - /* Define if you have the header file. */ #define HAVE_CURSES_H 1 @@ -451,22 +498,23 @@ typedef long uae_atomic; #define FSDB_DIR_SEPARATOR '/' #define FSDB_DIR_SEPARATOR_S "/" -#define strcmpi(x,y) strcasecmp(x,y) -#define stricmp(x,y) strcasecmp(x,y) +/* Define to 1 if `S_un' is a member of `struct in_addr'. */ +/* #un#def HAVE_STRUCT_IN_ADDR_S_UN */ -#define A_ZIP -//#define A_RAR -#define A_7Z -#define A_LHA -#define A_LZX -#define A_DMS -#define A_WRP - -#ifndef MAX_PATH -#define MAX_PATH 256 +#ifdef _GCCRES_ +#undef _GCCRES_ #endif -#define WORDS_BIGENDIAN 1 +#ifdef UAE4ALL_NO_USE_RESTRICT +#define _GCCRES_ +#else +#define _GCCRES_ __restrict__ +#endif + +#define __cdecl + +#define strcmpi(x,y) strcasecmp(x,y) +#define stricmp(x,y) strcasecmp(x,y) #define M68K_SPEED_7MHZ_CYCLES 0 #define M68K_SPEED_14MHZ_CYCLES 1024 @@ -477,7 +525,6 @@ typedef long LPARAM; typedef int SOCKET; #define INVALID_SOCKET -1 -typedef int BOOL; typedef unsigned char boolean; #define FALSE 0 #define TRUE 1 @@ -487,45 +534,47 @@ typedef unsigned short USHORT; #define Sleep(x) usleep(x*1000) /* Some defines to make it easier to compare files with WinUAE */ +#include "uae/string.h" + +#ifndef UAE_TYPES_H #define _T(x) x -#define TCHAR char +typedef char TCHAR; +#endif #define _tzset() tzset() -#define _tcsftime(w,x,y,z) strftime(w,x,y,z) #define _timezone timezone #define _daylight daylight #define _ftime(x) ftime(x) -#define _tfopen(x,y) fopen(x,y) +#ifdef ANDROID +#define _ftelli64(x) ftello(x) +#define _fseeki64(x,y,z) fseeko(x,y,z) +#else #define _ftelli64(x) ftello64(x) #define _fseeki64(x,y,z) fseeko64(x,y,z) -#define _stat64 stat64 +#endif #define _wunlink(x) unlink(x) -#define _tcslen(x) strlen(x) -#define _tcscpy(x,y) strcpy(x,y) -#define _tcsncpy(x,y,z) strncpy(x,y,z) -#define _tcscat(x,y) strcat(x,y) -#define _tcsncat(x,y,z) strncat(x,y,z) -#define _tcscmp(x,y) strcmp(x,y) -#define _tcsicmp(x,y) strcmpi(x,y) -#define _tcsncmp(x,y,z) strncmp(x,y,z) -#define _tcsnicmp(x,y,z) strncasecmp(x,y,z) -#define _tcschr(x,y) strchr(x,y) -#define _tcsrchr(x,y) strrchr(x,y) -#define _tcsstr(x,y) strstr(x,y) -#define _tcscspn(x,y) strcspn(x,y) -#define _totupper(x) toupper(x) -#define _totlower(x) tolower(x) -#define _istupper(x) isupper(x) -#define _istspace(x) isspace(x) -#define _istdigit(x) isdigit(x) -#define _tstoi(x) atoi(x) -#define _tstol(x) atol(x) -#define _tstoi64(x) atoll(x) -#define _tstof(x) atof(x) -#define _tcstol(x,y,z) strtol(x,y,z) -#define _tcstod(x,y) strtod(x,y) -#define _stprintf sprintf -#define _vstprintf(x,y,z) vsprintf(x,y,z) -#define _vsntprintf(w,x,y,z) vsnprintf(w,x,y,z) -#define _strtoui64(x,y,z) strtoll(x,y,z) #define _istalnum(x) isalnum(x) -#define _tcsspn(x,y) strspn(x,y) \ No newline at end of file + +#ifdef ANDROID +#define fmodl(x,y) fmod(x,y) +#define remainderl(x,y) remainder(x,y) +#define sinhl(x) sinh(x) +#define sqrtl(x) sqrt(x) +#define log1pl(x) log1p(x) +#define expm1l(x) expm1(x) +#define tanhl(x) tanh(x) +#define atanl(x) atan(x) +#define atanhl(x) atanh(x) +#define sinl(x) sin(x) +#define asinl(x) asin(x) +#define tanl(x) tan(x) +#define expl(x) exp(x) +#define powl(x,y) pow(x,y) +#define logl(x) log(x) +#define log10l(x) log10(x) +#define log2l(x) (log(x)/log(2)) +#define lrintl(x) lrint(x) +#define rintl(x) rint(x) +#define coshl(x) cosh(x) +#define acosl(x) acos(x) +#define cosl(x) cos(x) +#endif diff --git a/src/osdep/target.h b/src/osdep/target.h index b38e500b..a12892d9 100644 --- a/src/osdep/target.h +++ b/src/osdep/target.h @@ -2,37 +2,56 @@ * UAE - The Un*x Amiga Emulator * * Target specific stuff, Amiberry version - * - * Copyright 1997 Bernd Schmidt */ #pragma once +#include -#define TARGET_NAME _T("Amiberry") -#define TARGET_PROVIDES_DEFAULT_PREFS -#define TARGET_NO_DITHER +#define TARGET_NAME "amiberry" #define NO_MAIN_IN_MAIN_C #define OPTIONSFILENAME "uaeconfig" +STATIC_INLINE FILE *uae_tfopen(const char *path, const char *mode) +{ + return fopen(path, mode); +} + +#define OFFSET_Y_ADJUST 15 + extern int emulating; -extern int z3_start_adr; -extern int rtg_start_adr; +extern uae_u8* natmem_offset; +extern int z3base_adr; -void run_gui(); +extern int currVSyncRate; +extern unsigned long time_per_frame; + +void run_gui(void); void InGameMessage(const char *msg); -void wait_for_vsync(); +void init_max_signals(void); +void wait_for_vsync(void); +unsigned long target_lastsynctime(void); +extern int screen_is_picasso; -void saveAdfDir(); +void saveAdfDir(void); +bool SetVSyncRate(int hz); +void setCpuSpeed(void); +void resetCpuSpeed(void); void update_display(struct uae_prefs *); -void graphics_subshutdown(); +void black_screen_now(void); +void graphics_subshutdown (void); +void moveVertical(int value); void amiberry_stop_sound(); void keyboard_settrans(); -void translate_amiberry_keys(int, int); +void translate_amiberry_keys(int symbol, int newstate); +#ifdef PANDORA +int translate_pandora_keys(int symbol, int *modifier); +#endif + void SimulateMouseOrJoy(int code, int keypressed); #define REMAP_MOUSEBUTTON_LEFT -1 @@ -51,44 +70,98 @@ void SimulateMouseOrJoy(int code, int keypressed); extern void free_AmigaMem(); extern void alloc_AmigaMem(); +#ifdef WITH_LOGGING +extern void ShowLiveInfo(char *msg); +#endif + +extern void fetch_configurationpath(char *out, int size); +extern void set_configurationpath(char *newpath); + +extern void fetch_controllerspath (char *out, int size); +extern void set_controllerspath(char *newpath); + +extern void fetch_retroarchfile (char *out, int size); +extern void set_retroarchfile(char *newpath); + + +extern void set_rompath(char *newpath); +extern void fetch_rp9path(char *out, int size); +extern void fetch_savestatepath(char *out, int size); +extern void fetch_screenshotpath(char *out, int size); + +extern void extractFileName(const char * str, char *buffer); +extern void extractPath(char *str, char *buffer); +extern void removeFileExtension(char *filename); +extern void ReadConfigFileList(void); +extern void RescanROMs(void); +extern void ClearAvailableROMList(void); + +#include +#include +typedef struct { + char Name[MAX_PATH]; + char Path[MAX_PATH]; + int ROMType; +} AvailableROM; +extern std::vector lstAvailableROMs; + +#define MAX_MRU_DISKLIST 40 +extern std::vector lstMRUDiskList; +extern void AddFileToDiskList(const char *file, int moveToTop); + +#define MAX_MRU_CDLIST 10 +extern std::vector lstMRUCDList; +extern void AddFileToCDList(const char *file, int moveToTop); + +#define AMIGAWIDTH_COUNT 6 +#define AMIGAHEIGHT_COUNT 6 +extern const int amigawidth_values[AMIGAWIDTH_COUNT]; +extern const int amigaheight_values[AMIGAHEIGHT_COUNT]; -void reinit_amiga(); int count_HDs(struct uae_prefs *p); -extern void gui_force_rtarea_hdchange(); -extern bool hardfile_testrdb(const TCHAR *filename); +extern void gui_force_rtarea_hdchange(void); +extern void gui_restart(void); +extern bool hardfile_testrdb(const char *filename); +extern bool host_poweroff; -static size_t uae_tcslcpy(TCHAR *dst, const TCHAR *src, size_t size) -{ - if (size == 0) { - return 0; - } - size_t src_len = _tcslen(src); - size_t cpy_len = src_len; - if (cpy_len >= size) { - cpy_len = size - 1; - } - memcpy(dst, src, cpy_len * sizeof(TCHAR)); - dst[cpy_len] = _T('\0'); - return src_len; +#ifdef __cplusplus +extern "C" { +#endif + void trace_begin(void); + void trace_end(void); +#ifdef __cplusplus } +#endif -static size_t uae_strlcpy(char *dst, const char *src, size_t size) -{ - if (size == 0) { - return 0; - } - size_t src_len = strlen(src); - size_t cpy_len = src_len; - if (cpy_len >= size) { - cpy_len = size - 1; - } - memcpy(dst, src, cpy_len); - dst[cpy_len] = '\0'; - return src_len; -} - -static int max(int x, int y) +STATIC_INLINE int max(int x, int y) { return x > y ? x : y; -} \ No newline at end of file +} + +STATIC_INLINE void atomic_and(volatile uae_atomic *p, uae_u32 v) +{ + __sync_and_and_fetch(p, v); +} +STATIC_INLINE void atomic_or(volatile uae_atomic *p, uae_u32 v) +{ + __sync_or_and_fetch(p, v); +} +STATIC_INLINE uae_atomic atomic_inc(volatile uae_atomic *p) +{ + return __sync_add_and_fetch(p, 1); +} +STATIC_INLINE uae_atomic atomic_dec(volatile uae_atomic *p) +{ + return __sync_sub_and_fetch(p, 1); +} +STATIC_INLINE uae_u32 atomic_bit_test_and_reset(volatile uae_atomic *p, uae_u32 v) +{ + long mask = (1 << v); + uae_u32 res = __sync_fetch_and_and(p, ~mask); + return (res && mask); +} +STATIC_INLINE void atomic_set(volatile uae_atomic *p, uae_u32 v) +{ + __sync_lock_test_and_set(p, v); +} diff --git a/src/osdep/writelog.cpp b/src/osdep/writelog.cpp index e513e5f3..22c06266 100644 --- a/src/osdep/writelog.cpp +++ b/src/osdep/writelog.cpp @@ -15,13 +15,13 @@ FILE *debugfile = NULL; void console_out (const TCHAR *format,...) { - //va_list parms; - //TCHAR buffer[WRITE_LOG_BUF_SIZE]; + va_list parms; + TCHAR buffer[WRITE_LOG_BUF_SIZE]; - //va_start (parms, format); - //vsnprintf (buffer, WRITE_LOG_BUF_SIZE-1, format, parms); - //va_end (parms); - //printf(buffer); + va_start (parms, format); + vsnprintf (buffer, WRITE_LOG_BUF_SIZE-1, format, parms); + va_end (parms); + printf(buffer); } void writeconsole(const TCHAR *buffer) @@ -31,19 +31,19 @@ void writeconsole(const TCHAR *buffer) void write_log (const char *format,...) { - //int count; - //int numwritten; - //TCHAR buffer[WRITE_LOG_BUF_SIZE]; + int count; + int numwritten; + TCHAR buffer[WRITE_LOG_BUF_SIZE]; - //va_list parms; - //va_start (parms, format); - //count = vsnprintf( buffer, WRITE_LOG_BUF_SIZE-1, format, parms ); - //if( debugfile ) - //{ - // fprintf( debugfile, buffer ); - // fflush (debugfile); - //} - //va_end (parms); + va_list parms; + va_start (parms, format); + count = vsnprintf( buffer, WRITE_LOG_BUF_SIZE-1, format, parms ); + if( debugfile ) + { + fprintf( debugfile, buffer ); + fflush (debugfile); + } + va_end (parms); } void jit_abort (const TCHAR *format,...) diff --git a/src/rommgr.cpp b/src/rommgr.cpp index 71007333..b8ed29dd 100644 --- a/src/rommgr.cpp +++ b/src/rommgr.cpp @@ -11,14 +11,16 @@ #include "options.h" #include "uae.h" #include "gui.h" -#include "rommgr.h" #include "memory.h" +#include "rommgr.h" #include "zfile.h" #include "crc32.h" - +#include "fsdb.h" #include "autoconf.h" #include "filesys.h" +#define SAVE_ROM 0 + static struct romlist *rl; static int romlist_cnt; @@ -87,19 +89,13 @@ struct romdata *getromdatabypath (const TCHAR *path) if (!_tcscmp(path + 1, rd->configname)) return rd; } - if (!_tcscmp(rl[i].path, path)) + if (my_issamepath(rl[i].path, path)) return rl[i].rd; } return NULL; } -#define NEXT_ROM_ID 89 - -static struct romheader romheaders[] = { - { _T("Freezer Cartridges"), 1 }, - { _T("Arcadia Games"), 2 }, - { NULL, 0 } -}; +#define NEXT_ROM_ID 208 #define ALTROM(id,grp,num,size,flags,crc32,a,b,c,d,e) \ { _T("X"), 0, 0, 0, 0, 0, size, id, 0, 0, flags, (grp << 16) | num, 0, NULL, crc32, a, b, c, d, e }, @@ -169,8 +165,8 @@ static struct romdata roms[] = { ALTROMPN(12, 1, 2, 262144, ROMTYPE_ODD , _T("391514-02"), 0x17266a55,0x42fbed34,0x53d1f11c,0xcbde89a9,0x826f2d11,0x75cca5cc) { _T("KS ROM v3.1 (A4000)"), 3, 1, 40, 70, _T("A4000\0"), 524288, 13, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL, 0x2b4566f1, 0x81c631dd,0x096bbb31,0xd2af9029,0x9c76b774,0xdb74076c }, - ALTROM(13, 1, 1, 262144, ROMTYPE_EVEN, 0xf9cbecc9,0x138d8cb4,0x3b8312fe,0x16d69070,0xde607469,0xb3d4078e) - ALTROM(13, 1, 2, 262144, ROMTYPE_ODD , 0xf8248355,0xc2379547,0x9fae3910,0xc185512c,0xa268b82f,0x1ae4fe05) + ALTROM(13, 1, 1, 262144, ROMTYPE_EVEN, 0xf9cbecc9,0x138d8cb4,0x3b8312fe,0x16d69070,0xde607469,0xb3d4078e) + ALTROM(13, 1, 2, 262144, ROMTYPE_ODD , 0xf8248355,0xc2379547,0x9fae3910,0xc185512c,0xa268b82f,0x1ae4fe05) { _T("KS ROM v3.1 (A500,A600,A2000)"), 3, 1, 40, 63, _T("A500\0A600\0A2000\0"), 524288, 14, 0, 0, ROMTYPE_KICK, 0, 0, NULL, 0xfc24ae0d, 0x3B7F1493,0xB27E2128,0x30F989F2,0x6CA76C02,0x049F09CA }, { _T("KS ROM v3.1 (A1200)"), 3, 1, 40, 68, _T("A1200\0"), 524288, 15, 1, 0, ROMTYPE_KICK, 0, 0, NULL, @@ -179,14 +175,14 @@ static struct romdata roms[] = { ALTROMPN(15, 1, 2, 262144, ROMTYPE_ODD , _T("391774-01"), 0x16c07bf8,0x90e331be,0x1970b0e5,0x3f53a9b0,0x390b51b5,0x9b3869c2) { _T("KS ROM v3.1 (A3000)"), 3, 1, 40, 68, _T("A3000\0"), 524288, 61, 2, 0, ROMTYPE_KICK, 0, 0, NULL, 0xefb239cc, 0xF8E210D7,0x2B4C4853,0xE0C9B85D,0x223BA20E,0x3D1B36EE }, - ALTROM(61, 1, 1, 262144, ROMTYPE_EVEN, 0x286b9a0d,0x6763a225,0x8ec493f7,0x408cf663,0x110dae9a,0x17803ad1) - ALTROM(61, 1, 2, 262144, ROMTYPE_ODD , 0x0b8cde6a,0x5f02e97b,0x48ebbba8,0x7d516a56,0xb0400c6f,0xc3434d8d) + ALTROM(61, 1, 1, 262144, ROMTYPE_EVEN, 0x286b9a0d,0x6763a225,0x8ec493f7,0x408cf663,0x110dae9a,0x17803ad1) + ALTROM(61, 1, 2, 262144, ROMTYPE_ODD , 0x0b8cde6a,0x5f02e97b,0x48ebbba8,0x7d516a56,0xb0400c6f,0xc3434d8d) { _T("KS ROM v3.1 (A4000)(Cloanto)"), 3, 1, 40, 68, _T("A4000\0"), 524288, 31, 2 | 4, 1, ROMTYPE_KICK, 0, 0, NULL, 0x43b6dd22, 0xC3C48116,0x0866E60D,0x085E436A,0x24DB3617,0xFF60B5F9 }, { _T("KS ROM v3.1 (A4000)"), 3, 1, 40, 68, _T("A4000\0"), 524288, 16, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL, 0xd6bae334, 0x5FE04842,0xD04A4897,0x20F0F4BB,0x0E469481,0x99406F49 }, - ALTROM(16, 1, 1, 262144, ROMTYPE_EVEN, 0xb2af34f8,0x24e52b5e,0xfc020495,0x17387ab7,0xb1a1475f,0xc540350e) - ALTROM(16, 1, 2, 262144, ROMTYPE_ODD , 0xe65636a3,0x313c7cbd,0xa5779e56,0xf19a41d3,0x4e760f51,0x7626d882) + ALTROM(16, 1, 1, 262144, ROMTYPE_EVEN, 0xb2af34f8,0x24e52b5e,0xfc020495,0x17387ab7,0xb1a1475f,0xc540350e) + ALTROM(16, 1, 2, 262144, ROMTYPE_ODD , 0xe65636a3,0x313c7cbd,0xa5779e56,0xf19a41d3,0x4e760f51,0x7626d882) { _T("KS ROM v3.1 (A4000T)"), 3, 1, 40, 70, _T("A4000T\0"), 524288, 17, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL, 0x75932c3a, 0xB0EC8B84,0xD6768321,0xE01209F1,0x1E6248F2,0xF5281A21 }, ALTROMPN(17, 1, 1, 262144, ROMTYPE_EVEN, _T("391657-01"), 0x0ca94f70,0xb3806eda,0xcb3362fc,0x16a154ce,0x1eeec5bf,0x5bc24789) @@ -199,12 +195,12 @@ static struct romdata roms[] = { { _T("CD32 extended ROM"), 3, 1, 40, 60, _T("CD32\0"), 524288, 19, 1, 0, ROMTYPE_EXTCD32, 0, 0, NULL, 0x87746be2, 0x5BEF3D62,0x8CE59CC0,0x2A66E6E4,0xAE0DA48F,0x60E78F7F }, - /* plain CD32 rom */ + /* plain CD32 rom */ { _T("CD32 ROM (KS + extended)"), 3, 1, 40, 60, _T("CD32\0"), 2 * 524288, 64, 1, 0, ROMTYPE_KICKCD32 | ROMTYPE_EXTCD32 | ROMTYPE_CD32, 0, 0, NULL, 0xf5d4f3c8, 0x9fa14825,0xc40a2475,0xa2eba5cf,0x325bd483,0xc447e7c1 }, - /* real CD32 rom dump 391640-03 */ + /* real CD32 rom dump 391640-03 */ ALTROMPN(64, 1, 1, 2 * 524288, ROMTYPE_CD32, _T("391640-03"), 0xa4fbc94a, 0x816ce6c5,0x07787585,0x0c7d4345,0x2230a9ba,0x3a2902db ) - + { _T("CD32 Full Motion Video Cartridge ROM"), 3, 1, 40, 30, _T("CD32FMV\0"), 262144, 23, 1, 0, ROMTYPE_CD32CART, 0, 0, NULL, 0xc35c37bf, 0x03ca81c7,0xa7b259cf,0x64bc9582,0x863eca0f,0x6529f435 }, { _T("CD32 Full Motion Video Cartridge ROM"), 3, 1, 40, 22, _T("CD32FMV\0"), 262144, 74, 1, 0, ROMTYPE_CD32CART, 0, 0, _T("391777-01"), @@ -216,12 +212,12 @@ static struct romdata roms[] = { ALTROMPN(20, 1, 2, 131072, ROMTYPE_ODD | ROMTYPE_8BIT, _T("252607-01"), 0xaccbbc2e,0x41b06d16,0x79c6e693,0x3c3378b7,0x626025f7,0x641ebc5c) { _T("CDTV extended ROM v2.07"), 2, 7, 2, 7, _T("CDTV\0"), 262144, 22, 0, 0, ROMTYPE_EXTCDTV, 0, 0, NULL, 0xceae68d2, 0x5BC114BB,0xA29F60A6,0x14A31174,0x5B3E2464,0xBFA06846 }, - ALTROM(22, 1, 1, 131072, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x36d73cb8,0x9574e546,0x4b390697,0xf28f9a43,0x4e604e5e,0xf5e5490a) - ALTROM(22, 1, 2, 131072, ROMTYPE_ODD | ROMTYPE_8BIT, 0x6e84dce7,0x01a0679e,0x895a1a0f,0x559c7253,0xf539606b,0xd447b54f) + ALTROM(22, 1, 1, 131072, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x36d73cb8,0x9574e546,0x4b390697,0xf28f9a43,0x4e604e5e,0xf5e5490a) + ALTROM(22, 1, 2, 131072, ROMTYPE_ODD | ROMTYPE_8BIT, 0x6e84dce7,0x01a0679e,0x895a1a0f,0x559c7253,0xf539606b,0xd447b54f) { _T("CDTV/A570 extended ROM v2.30"), 2, 30, 2, 30, _T("CDTV\0"), 262144, 21, 0, 0, ROMTYPE_EXTCDTV, 0, 0, _T("391298-01"), 0x30b54232, 0xED7E461D,0x1FFF3CDA,0x321631AE,0x42B80E3C,0xD4FA5EBB }, - ALTROM(21, 1, 1, 131072, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x48e4d74f,0x54946054,0x2269e410,0x36018402,0xe1f6b855,0xfd89092b) - ALTROM(21, 1, 2, 131072, ROMTYPE_ODD | ROMTYPE_8BIT, 0x8a54f362,0x03df800f,0x032046fd,0x892f6e7e,0xec08b76d,0x33981e8c) + ALTROM(21, 1, 1, 131072, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x48e4d74f,0x54946054,0x2269e410,0x36018402,0xe1f6b855,0xfd89092b) + ALTROM(21, 1, 2, 131072, ROMTYPE_ODD | ROMTYPE_8BIT, 0x8a54f362,0x03df800f,0x032046fd,0x892f6e7e,0xec08b76d,0x33981e8c) { _T("CDTV-CR extended ROM v3.32"), 3, 32, 3, 32, _T("CDTVCR\0"), 262144, 107, 0, 0, ROMTYPE_EXTCDTV, 0, 0, NULL, 0x581a85cf, 0xd6b8d3f2,0x854eba9b,0x2d514579,0x9529e8b3,0x3b85e0b4 }, { _T("CDTV-CR extended ROM v3.44"), 3, 44, 3, 44, _T("CDTVCR\0"), 262144, 108, 0, 0, ROMTYPE_EXTCDTV, 0, 0, NULL, @@ -229,7 +225,7 @@ static struct romdata roms[] = { { _T("A1000 bootstrap ROM"), 0, 0, 0, 0, _T("A1000\0"), 65536, 24, 0, 0, ROMTYPE_KICK, 0, 0, NULL, 0x0b1ad2d0, 0xBA93B8B8,0x5CA0D83A,0x68225CC3,0x3B95050D,0x72D2FDD7 }, - ALTROM(24, 1, 1, 8192, 0, 0x62f11c04, 0xC87F9FAD,0xA4EE4E69,0xF3CCA0C3,0x6193BE82,0x2B9F5FE6) + ALTROM(24, 1, 1, 8192, 0, 0x62f11c04, 0xC87F9FAD,0xA4EE4E69,0xF3CCA0C3,0x6193BE82,0x2B9F5FE6) ALTROMPN(24, 2, 1, 4096, ROMTYPE_EVEN | ROMTYPE_8BIT, _T("252179-01"), 0x42553bc4,0x8855a97f,0x7a44e3f6,0x2d1c88d9,0x38fee1f4,0xc606af5b) ALTROMPN(24, 2, 2, 4096, ROMTYPE_ODD | ROMTYPE_8BIT, _T("252180-01"), 0x8e5b9a37,0xd10f1564,0xb99f5ffe,0x108fa042,0x362e877f,0x569de2c3) @@ -238,12 +234,12 @@ static struct romdata roms[] = { { _T("Freezer: Action Replay Mk I v1.00"), 1, 0, 1, 0, _T("AR\0"), 65536, 52, 0, 0, ROMTYPE_AR, 0, 1, NULL, 0x2d921771, 0x1EAD9DDA,0x2DAD2914,0x6441F5EF,0x72183750,0x22E01248 }, - ALTROM(52, 1, 1, 32768, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x82d6eb87, 0x7c9bac11,0x28666017,0xeee6f019,0x63fb3890,0x7fbea355) - ALTROM(52, 1, 2, 32768, ROMTYPE_ODD | ROMTYPE_8BIT, 0x40ae490c, 0x81d8e432,0x01b73fd9,0x2e204ebd,0x68af8602,0xb62ce397) + ALTROM(52, 1, 1, 32768, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x82d6eb87, 0x7c9bac11,0x28666017,0xeee6f019,0x63fb3890,0x7fbea355) + ALTROM(52, 1, 2, 32768, ROMTYPE_ODD | ROMTYPE_8BIT, 0x40ae490c, 0x81d8e432,0x01b73fd9,0x2e204ebd,0x68af8602,0xb62ce397) { _T("Freezer: Action Replay Mk I v1.50"), 1, 50, 1, 50, _T("AR\0"), 65536, 25, 0, 0, ROMTYPE_AR, 0, 1, NULL, 0xf82c4258, 0x843B433B,0x2C56640E,0x045D5FDC,0x854DC6B1,0xA4964E7C }, - ALTROM(25, 1, 1, 32768, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x7fbd6de2, 0xb5f71a5c,0x09d65ecc,0xa8a3bc93,0x93558461,0xca190228) - ALTROM(25, 1, 2, 32768, ROMTYPE_ODD | ROMTYPE_8BIT, 0x43018069, 0xad8ff242,0xb2cbf125,0x1fc53a73,0x581cf57a,0xb69cee00) + ALTROM(25, 1, 1, 32768, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x7fbd6de2, 0xb5f71a5c,0x09d65ecc,0xa8a3bc93,0x93558461,0xca190228) + ALTROM(25, 1, 2, 32768, ROMTYPE_ODD | ROMTYPE_8BIT, 0x43018069, 0xad8ff242,0xb2cbf125,0x1fc53a73,0x581cf57a,0xb69cee00) { _T("Freezer: Action Replay Mk II v2.05"), 2, 5, 2, 5, _T("AR\0"), 131072, 26, 0, 0, ROMTYPE_AR2, 0, 1, NULL, 0x1287301f, 0xF6601DE8,0x888F0050,0x72BF562B,0x9F533BBC,0xAF1B0074 }, { _T("Freezer: Action Replay Mk II v2.12"), 2, 12, 2, 12, _T("AR\0"), 131072, 27, 0, 0, ROMTYPE_AR2, 0, 1, NULL, @@ -252,8 +248,8 @@ static struct romdata roms[] = { 0x49650e4f, 0x255D6DF6,0x3A4EAB0A,0x838EB1A1,0x6A267B09,0x59DFF634 }, { _T("Freezer: Action Replay Mk III v3.09"), 3, 9, 3, 9, _T("AR\0"), 262144, 29, 0, 0, ROMTYPE_AR2, 0, 1, NULL, 0x0ed9b5aa, 0x0FF3170A,0xBBF0CA64,0xC9DD93D6,0xEC0C7A01,0xB5436824 }, - ALTROM(29, 1, 1, 131072, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x2b84519f, 0x7841873b,0xf009d834,0x1dfa2794,0xb3751bac,0xf86adcc8) - ALTROM(29, 1, 2, 131072, ROMTYPE_ODD | ROMTYPE_8BIT, 0x1d35bd56, 0x6464be16,0x26b51949,0x9e76e4e3,0x409e8016,0x515d48b6) + ALTROM(29, 1, 1, 131072, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x2b84519f, 0x7841873b,0xf009d834,0x1dfa2794,0xb3751bac,0xf86adcc8) + ALTROM(29, 1, 2, 131072, ROMTYPE_ODD | ROMTYPE_8BIT, 0x1d35bd56, 0x6464be16,0x26b51949,0x9e76e4e3,0x409e8016,0x515d48b6) { _T("Freezer: Action Replay Mk III v3.17"), 3, 17, 3, 17, _T("AR\0"), 262144, 30, 0, 0, ROMTYPE_AR2, 0, 1, NULL, 0xc8a16406, 0x5D4987C2,0xE3FFEA8B,0x1B02E314,0x30EF190F,0x2DB76542 }, { _T("Freezer: Action Replay 1200"), 0, 0, 0, 0, _T("AR\0"), 262144, 47, 0, 0, ROMTYPE_AR, 0, 1, NULL, @@ -265,23 +261,23 @@ static struct romdata roms[] = { 0xe668a0be, 0x633A6E65,0xA93580B8,0xDDB0BE9C,0x9A64D4A1,0x7D4B4801 }, { _T("Freezer: X-Power Professional 500 v1.2"), 1, 2, 1, 2, _T("XPOWER\0"), 131072, 65, 0, 0, ROMTYPE_XPOWER, 0, 1, NULL, 0x9e70c231, 0xa2977a1c,0x41a8ca7d,0x4af4a168,0x726da542,0x179d5963 }, - ALTROM(65, 1, 1, 65536, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xf98742e4,0xe8e683ba,0xd8b38d1f,0x79f3ad83,0xa9e67c6f,0xa91dc96c) - ALTROM(65, 1, 2, 65536, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xdfb9984b,0x8d6bdd49,0x469ec8e2,0x0143fbb3,0x72e92500,0x99f07910) + ALTROM(65, 1, 1, 65536, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xf98742e4,0xe8e683ba,0xd8b38d1f,0x79f3ad83,0xa9e67c6f,0xa91dc96c) + ALTROM(65, 1, 2, 65536, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xdfb9984b,0x8d6bdd49,0x469ec8e2,0x0143fbb3,0x72e92500,0x99f07910) { _T("Freezer: X-Power Professional 500 v1.3"), 1, 3, 1, 3, _T("XPOWER\0"), 131072, 68, 0, 0, ROMTYPE_XPOWER, 0, 1, NULL, 0x31e057f0, 0x84650266,0x465d1859,0x7fd71dee,0x00775930,0xb7e450ee }, - ALTROM(68, 1, 1, 65536, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0x0b2ce0c7,0x45ad5456,0x89192404,0x956f47ce,0xf66a5274,0x57ace33b) - ALTROM(68, 1, 2, 65536, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0x34580c35,0x8ad42566,0x7364f238,0x978f4381,0x08f8d5ec,0x470e72ea) + ALTROM(68, 1, 1, 65536, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0x0b2ce0c7,0x45ad5456,0x89192404,0x956f47ce,0xf66a5274,0x57ace33b) + ALTROM(68, 1, 2, 65536, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0x34580c35,0x8ad42566,0x7364f238,0x978f4381,0x08f8d5ec,0x470e72ea) { _T("Freezer: Nordic Power v1.5"), 1, 5, 1, 5, _T("NPOWER\0"), 65536, 69, 0, 0, ROMTYPE_NORDIC, 0, 1, NULL, 0x83b4b21c, 0xc56ced25,0x506a5aab,0x3fa13813,0x4fc9e5ae,0x0f9d3709 }, - ALTROM(69, 1, 1, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xdd207174,0xae67652d,0x64f5db20,0x0f4b2110,0xee59567f,0xfbd90a1b) - ALTROM(69, 1, 2, 32768, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0x8f93d85d,0x73c62d21,0x40c0c092,0x6315b702,0xdd5d0f05,0x3dad7fab) + ALTROM(69, 1, 1, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xdd207174,0xae67652d,0x64f5db20,0x0f4b2110,0xee59567f,0xfbd90a1b) + ALTROM(69, 1, 2, 32768, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0x8f93d85d,0x73c62d21,0x40c0c092,0x6315b702,0xdd5d0f05,0x3dad7fab) { _T("Freezer: Nordic Power v2.0"), 2, 0, 2, 0, _T("NPOWER\0"), 65536, 67, 0, 0, ROMTYPE_NORDIC, 0, 1, NULL, 0xa4db2906, 0x0aec68f7,0x25470c89,0x6b699ff4,0x6623dec5,0xc777466e }, - ALTROM(67, 1, 1, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xb21be46c,0x50dc607c,0xce976bbd,0x3841eaf0,0x591ddc7e,0xa1939ad2) - ALTROM(67, 1, 2, 32768, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0x96057aed,0xdd9209e2,0x1d5edfc1,0xcdb52abe,0x93de0f35,0xc43da696) + ALTROM(67, 1, 1, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xb21be46c,0x50dc607c,0xce976bbd,0x3841eaf0,0x591ddc7e,0xa1939ad2) + ALTROM(67, 1, 2, 32768, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0x96057aed,0xdd9209e2,0x1d5edfc1,0xcdb52abe,0x93de0f35,0xc43da696) { _T("Freezer: Nordic Power v3.0"), 3, 0, 3, 0, _T("NPOWER\0"), 65536, 70, 0, 0, ROMTYPE_NORDIC, 0, 1, NULL, 0x72850aef, 0x59c91d1f,0xa8f118f9,0x0bdba05a,0x9ae788d7,0x7a6cc7c9 }, - ALTROM(70, 1, 1, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xf3330e1f,0x3a597db2,0xb7d11b6c,0xb8e13496,0xc215f223,0x88c4ca3c) + ALTROM(70, 1, 1, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xf3330e1f,0x3a597db2,0xb7d11b6c,0xb8e13496,0xc215f223,0x88c4ca3c) ALTROM(70, 1, 2, 32768, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xee58e0f9,0x4148f4cb,0xb42cec33,0x8ca144de,0xd4f54118,0xe0f185dd) { _T("Freezer: Nordic Power v3.2"), 3, 2, 3, 2, _T("NPOWER\0"), 65536, 115, 0, 0, ROMTYPE_NORDIC, 0, 1, NULL, 0x46158b6e, 0xd8c3f5af,0x5f109c61,0x5f6acb38,0x68fe6c06,0x580041b5 }, @@ -292,30 +288,38 @@ static struct romdata roms[] = { ALTROM(116, 1, 1, 32768, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x1909f7e9, 0x5abe9b9d,0xaae328c8,0x134e2b62,0x7b33b698,0xe342afc2) ALTROM(116, 1, 2, 32768, ROMTYPE_ODD | ROMTYPE_8BIT, 0xa3927c72, 0x7adc9352,0x2d112ae9,0x23b9a70d,0x951b1e7a,0xba800ea6) - { _T("Freezer: HRTMon v2.36 (built-in)"), 0, 0, 0, 0, _T("HRTMON\0"), 0, 63, 0, 0, ROMTYPE_HRTMON, 0, 1, NULL, + { _T("Freezer: HRTMon v2.37 (built-in)"), 0, 0, 0, 0, _T("HRTMON\0"), 0, 63, 0, 0, ROMTYPE_HRTMON, 0, 1, NULL, 0xffffffff, 0, 0, 0, 0, 0, _T("HRTMon") }, { _T("A2090a"), 0, 0, 0, 0, _T("A2090A\0"), 16384, 122, 0, 0, ROMTYPE_A2090, 0, 0, NULL, 0x73fe45a7, 0x77ce9091,0x4be5a3bf,0x6f26b343,0x062b5bd8,0xc63c3754 }, ALTROMPN(122, 1, 1, 8192, ROMTYPE_ODD | ROMTYPE_8BIT, _T("315097-01"), 0x150b116c,0x8011d873,0x3be53db0,0x79dfe319,0x7ffb8634,0x1baa6dbd) ALTROMPN(122, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, _T("315098-01"), 0xbe422e3b,0x64ad1646,0x030db10f,0x54f13f64,0x7d449e4d,0x17f9ab5c) - { _T("A590/A2091 6.0"), 6, 0, 6, 0, _T("A590\0A2091\0"), 16384, 53, 0, 0, ROMTYPE_A2091, 0, 0, NULL, + { _T("A590/A2091 v4.6"), 4, 6, 4, 6, _T("A590\0A2091\0"), 16384, 202, 0, 0, ROMTYPE_A2091, 0, 0, NULL, + 0x00a38212, 0xa029a4de,0x56e5539d,0x0ee00588,0xc2634f13,0x29f06269 }, + ALTROMPN(202, 1, 1, 8192, ROMTYPE_ODD | ROMTYPE_8BIT, _T("390389-02"), 0x26013266,0x60dedda8,0xd406b276,0x2ad1504a,0x88a4d6e2,0x9c0fb10d) + ALTROMPN(202, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, _T("390388-02"), 0x6c9cb089,0xbd8c6bb7,0x9ae91a4d,0x1b9ee76f,0xdd11aaf9,0x7ca4358b) + { _T("A590/A2091 v6.0"), 6, 0, 6, 0, _T("A590\0A2091\0"), 16384, 53, 0, 0, ROMTYPE_A2091, 0, 0, NULL, 0x8396cf4e, 0x5E03BC61,0x8C862ABE,0x7BF79723,0xB4EEF4D2,0x1859A0F2 }, ALTROMPN(53, 1, 1, 8192, ROMTYPE_ODD | ROMTYPE_8BIT, _T("390389-03"), 0xb0b8cf24,0xfcf40175,0x05f4d441,0x814b45d5,0x59c19eab,0x43816b30) ALTROMPN(53, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, _T("390388-03"), 0x2e77bbff,0x8a098845,0x068f32cf,0xa4d34a27,0x8cd290f6,0x1d35a52c) - { _T("A590/A2091 6.6"), 6, 6, 6, 6, _T("A590\0A2091\0"), 16384, 54, 0, 0, ROMTYPE_A2091, 0, 0, NULL, + { _T("A590/A2091 v6.1"), 6, 1, 6, 1, _T("A590\0A2091\0"), 16384, 206, 0, 0, ROMTYPE_A2091, 0, 0, NULL, + 0xaccf6452, 0xf56061ab,0x37768281,0x94d89729,0x802ee7ae,0x1de9df90 }, + ALTROMPN(206, 1, 1, 8192, ROMTYPE_ODD | ROMTYPE_8BIT, _T("390722-01"), 0xc460cfdb,0x0de457da,0xec3b84f7,0x5e8fb344,0xdefe24ce,0x56cda3e0) + ALTROMPN(206, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, _T("390721-01"), 0x00dbf615,0x503940d0,0x4fb3b49e,0xaa61100f,0xd3a48701,0x8b35e25a) + { _T("A590/A2091 v6.6"), 6, 6, 6, 6, _T("A590\0A2091\0"), 16384, 54, 0, 0, ROMTYPE_A2091, 0, 0, NULL, 0x33e00a7a, 0x739BB828,0xE874F064,0x9360F59D,0x26B5ED3F,0xBC99BB66 }, ALTROMPN(54, 1, 1, 8192, ROMTYPE_ODD | ROMTYPE_8BIT, _T("390722-02"), 0xe536bbb2,0xfd7f8a6d,0xa18c1b02,0xd07eb990,0xc2467a24,0x183ede12) ALTROMPN(54, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, _T("390721-02"), 0xc0871d25,0xe155f18a,0xbb90cf82,0x0589c15e,0x70559d3b,0x6b391af8) - { _T("A590/A2091 7.0"), 7, 0, 7, 0, _T("A590\0A2091\0"), 16384, 55, 0, 0, ROMTYPE_A2091, 0, 0, NULL, + { _T("A590/A2091 v7.0"), 7, 0, 7, 0, _T("A590\0A2091\0"), 16384, 55, 0, 0, ROMTYPE_A2091, 0, 0, NULL, 0x714a97a2, 0xE50F01BA,0xF2899892,0x85547863,0x72A82C33,0x3C91276E }, ALTROMPN(55, 1, 1, 8192, ROMTYPE_ODD | ROMTYPE_8BIT, _T("390722-03"), 0xa9ccffed,0x149f5bd5,0x2e2d2990,0x4e3de483,0xb9ad7724,0x48e9278e) ALTROMPN(55, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, _T("390721-03"), 0x2942747a,0xdbd7648e,0x79c75333,0x7ff3e4f4,0x91de224b,0xf05e6bb6) - { _T("A590/A2091 Guru ROM 6.14"), 6, 14, 6, 14, _T("A590\0A2091\0"), 32768, 56, 0, 0, ROMTYPE_A2091, 0, 0, NULL, + { _T("A590/A2091 Guru ROM v6.14"), 6, 14, 6, 14, _T("A590\0A2091\0"), 32768, 56, 0, 0, ROMTYPE_A2091, 0, 0, NULL, 0x04e52f93, 0x6DA21B6F,0x5E8F8837,0xD64507CD,0x8A4D5CDC,0xAC4F426B }, - { _T("A4091 40.9"), 40, 9, 40, 9, _T("A4091\0"), 32768, 57, 0, 0, ROMTYPE_A4091, 0, 0, NULL, + { _T("A4091 v40.9"), 40, 9, 40, 9, _T("A4091\0"), 32768, 57, 0, 0, ROMTYPE_A4091, 0, 0, NULL, 0x00000000, 0, 0, 0, 0, 0 }, - { _T("A4091 40.13"), 40, 13, 40, 13, _T("A4091\0"), 32768, 58, 0, 0, ROMTYPE_A4091, 0, 0, _T("391592-02"), + { _T("A4091 v40.13"), 40, 13, 40, 13, _T("A4091\0"), 32768, 58, 0, 0, ROMTYPE_A4091, 0, 0, _T("391592-02"), 0x54cb9e85, 0x3CE66919,0xF6FD6797,0x4923A12D,0x91B730F1,0xFFB4A7BA }, { _T("SupraDrive AMAB6"), 3, 8, 3, 8, _T("SUPRA\0"), 16384, 121, 0, 0, ROMTYPE_SUPRA, 0, 0, _T("AMAB6"), 0xf40bd349, 0x82168556,0x07525067,0xe9263431,0x1fb9c347,0xe737f247 }, @@ -331,7 +335,7 @@ static struct romdata roms[] = { { _T("Blizzard 1230-III"), 0, 0, 0, 0, _T("B1230MKIII\0"), 32768, 162, 0, 0, ROMTYPE_CB_B1230MK3, 0, 0, NULL, 0x8412a22c, 0x3a4c55f3, 0xdaf62084, 0xd947e418, 0x137db019, 0xf13efc7d }, { _T("Blizzard 1230-IV"), 0, 0, 0, 0, _T("B1230MKIV\0"), 32768, 89, 0, 0, ROMTYPE_CB_BLIZ1230, 0, 0, NULL, - 0x3078dbdc, 0x4d3e7fd0, 0xa1a4c3ae, 0xe17c5de3, 0xcbe1af03, 0x447aff92 }, + 0x3078dbdc, 0x4d3e7fd0,0xa1a4c3ae,0xe17c5de3,0xcbe1af03,0x447aff92 }, { _T("Blizzard 1240/1260"), 0, 0, 0, 0, _T("B1240\0B1260\0"), 32768, 90, 0, 0, ROMTYPE_CB_BLIZ1260, 0, 0, NULL, 0xf88ae0f1, 0xf69aca4b,0xb13e3389,0x04676f0c,0x8616f8db,0x074c313d }, @@ -340,13 +344,13 @@ static struct romdata roms[] = { ALTROMPN(168, 1, 1, 32768, ROMTYPE_ODD | ROMTYPE_8BIT, NULL, 0xb5892212, 0x7282a8ca, 0xf7ab194d, 0x16e1d05a, 0x582f0ebf, 0x1046b3d0) ALTROMPN(168, 1, 2, 32768, ROMTYPE_EVEN | ROMTYPE_8BIT, NULL, 0x821a01c0, 0x6fd29f69, 0x28c5980e, 0x313b3b15, 0xb5d683ac, 0x209dd1bf) { _T("Blizzard 2060 v8.5"), 8, 5, 8, 5, _T("B2060\0"), 65536, 92, 0, 0, ROMTYPE_CB_BLIZ2060, 0, 0, NULL, - 0xce270bc0, 0xe043c1aa, 0x3bb06e06, 0xd4dabff3, 0x0a8c6317, 0xabfef2bb }, + 0xce270bc0, 0xe043c1aa,0x3bb06e06,0xd4dabff3,0x0a8c6317,0xabfef2bb }, ALTROMPN(92, 1, 1, 32768, ROMTYPE_ODD | ROMTYPE_8BIT, NULL, 0xa6023f20, 0xdfb048d6, 0xbdc03587, 0x241e8121, 0x26aba603, 0xd69b0238) ALTROMPN(92, 1, 2, 32768, ROMTYPE_EVEN | ROMTYPE_8BIT, NULL, 0x9635a9cd, 0x47578b27, 0xc4ba6e54, 0x891930dd, 0xcb4b6a45, 0x5d6b31b2) - + { _T("Blizzard SCSI Kit III"), 1, 139, 1, 139, _T("BSCSIIII\0"), 65536, 167, 0, 0, ROMTYPE_BLIZKIT3, 0, 0, NULL, 0xfd2c772f, 0x1411c248, 0x72f7cb8d, 0xecbe4744, 0xf0b8d12a, 0x1aaaad44, NULL, _T("blizzard_scsi_kit_iv.rom") }, - { _T("Blizzard SCSI Kit IV"), 8, 5, 8, 5, _T("BSCSIIV\0"), 32768, 94, 0, 0, ROMTYPE_BLIZKIT4, 0, 0, NULL, +{ _T("Blizzard SCSI Kit IV"), 8, 5, 8, 5, _T("BSCSIIV\0"), 32768, 94, 0, 0, ROMTYPE_BLIZKIT4, 0, 0, NULL, 0xf53a0fca, 0xefe17ca5,0x88c44a7f,0x0f8c62be,0x20f23278,0xcfe06727, NULL, _T("blizzard_scsi_kit_iv.rom") }, { _T("Fastlane"), 8, 5, 8, 5, _T("FASTLANE\0"), 20788, 102, 0, 0, ROMTYPE_FASTLANE, 0, 0, NULL, 0xe4f485a5, 0x20bf7de5,0x05e45d0a,0xc411cfd2,0x806d0fd8,0xe46276de, NULL, _T("fastlanez3.rom") }, @@ -375,9 +379,11 @@ static struct romdata roms[] = { 0x6ee2ecdd, 0x4c82e3ba, 0x2d2dd1d3, 0x82f01098, 0xc26681b8, 0xff62f36d, NULL, NULL }, ALTROMPN(164, 1, 1, 32768, ROMTYPE_ODD | ROMTYPE_8BIT, _T("390282-01"), 0xdf76493b, 0x331ede0a, 0x8ca995cc, 0x1917f592, 0x18718e5b, 0x3c7fac39) ALTROMPN(164, 1, 2, 32768, ROMTYPE_EVEN | ROMTYPE_8BIT, _T("390283-01"), 0xd74187de, 0x681e4985, 0x4da64bf1, 0x6f2f99f7, 0x4b195f54, 0x0b8bd614) - - { _T("DKB 12x0"), 1, 23, 1, 23, _T("DKB\0"), 32768, 112, 0, 0, ROMTYPE_CB_DKB12x0, 0, 0, NULL, + + { _T("DKB 12x0"), 1, 23, 1, 23, _T("DKB\0"), 32768, 112, 0, 0, ROMTYPE_CB_DKB12x0, 0, 0, NULL, 0xf3b2b0b3, 0x1d539593,0xb1d7514e,0xeb214ab3,0x433a97fc,0x8a010366, NULL, NULL }, + { _T("DKB Rapidfire v1.31"), 1, 31, 1, 31, _T("RAPIDFIRE\0"), 11284, 207, 0, 0, ROMTYPE_RAPIDFIRE, 0, 0, NULL, + 0x68725e50, 0xa66f8ef6,0x901e0e41,0xf8b72bba,0x12165788,0xa452cf01, NULL, NULL }, { _T("Fusion Forty"), 0, 0, 0, 0, _T("FUSIONFORTY\0"), 131072, 113, 0, 0, ROMTYPE_CB_FUSION, 0, 0, NULL, 0x48fcb5fd, 0x15674dac,0x90b6d8db,0xdda3a175,0x997184c2,0xa423d733, NULL, NULL }, ALTROMPN(113, 1, 1, 32768, ROMTYPE_QUAD | ROMTYPE_EVEN | ROMTYPE_8BIT, _T("U28"), 0x434a21a8, 0x472c1623, 0x02babd00, 0x7c1a77ff, 0x40dd12ab, 0x39c97f82) @@ -389,7 +395,7 @@ static struct romdata roms[] = { { _T("GVP A3001 Series I"), 3, 3, 3, 3, _T("A3001SI\0"), 8192, 114, 0, 0, ROMTYPE_CB_A3001S1, 0, 0, NULL, 0xaaff7c65, 0x424cf3da,0xcc9da794,0x0ba74446,0x69dd1691,0x44ae87ee, NULL, NULL }, { _T("Kupke Golem 030"), 0, 0, 0, 0, _T("GOLEM030\0"), 8192, 126, 0, 0, ROMTYPE_CB_GOLEM030, 0, 0, NULL, - 0x05d473f4, 0x574ec567, 0xcc67e06f, 0x91dcecb9, 0x8c204399, 0x5fe2a09f, NULL, NULL }, + 0x05d473f4, 0x574ec567,0xcc67e06f,0x91dcecb9,0x8c204399,0x5fe2a09f, NULL, NULL }, { _T("DKB WildFire"), 1, 1, 1, 1, _T("WILDFIRE\0"), 18352, 143, 0, 0, ROMTYPE_CB_DBK_WF, 0, 0, NULL, 0xb2dae8c4, 0xcdfe2d96, 0xe44d4f8d, 0x3833a5e8, 0xb6c832fd, 0xc7b341a9, NULL, NULL }, { _T("M-Tec E-Matrix 530"), 0, 0, 0, 0, _T("EMATRIX530\0"), 65536, 144, 0, 0, ROMTYPE_CB_EMATRIX, 0, 0, NULL, @@ -409,14 +415,14 @@ static struct romdata roms[] = { 0x3f4e4a74, 0x9ed96fc0,0xd6381dc3,0x3192b0af,0xdfae4b74,0x576c3a69, NULL, NULL }, { _T("Protar A500HD"), 1, 193, 1, 193, _T("PROTAR\0"), 32768, 131, 0, 0, ROMTYPE_PROTAR, 0, 0, NULL, 0x10c1b22c, 0x2b800cde,0x79fd559e,0xebd5e432,0xd711af3d,0x0b8ea7e9, NULL, NULL }, - { _T("M-Tec AT500"), 1, 33, 1, 33, _T("MTECAT\0"), 32768, 130, 0, 0, ROMTYPE_MTEC, 0, 0, NULL, + { _T("M-Tec AT500 v1.33w"), 1, 33, 1, 33, _T("MTECAT\0"), 32768, 130, 0, 0, ROMTYPE_MTEC, 0, 0, NULL, 0x38b6b6b0, 0x8bb1093a,0xd592e7df,0x99c48f83,0xb9f842b2,0xb1a6e618, NULL, NULL }, { _T("AdIDE 40/44 v33"), 33, 0, 33, 0, _T("ADIDE\0"), 16384, 141, 0, 0, ROMTYPE_ADIDE, 0, 0, NULL, 0x330254ce, 0xc91dd3b5,0x3f1986bd,0x94fba150,0xe753c2da,0x4dee78e7, NULL, NULL }, { _T("AdIDE 40/44 v34"), 34, 0, 34, 0, _T("ADIDE\0"), 16384, 129, 0, 0, ROMTYPE_ADIDE, 0, 0, NULL, 0xedf84cbe, 0xabdbc01d,0xaa0b3aae,0xe4401ad7,0xe65525a9,0x6bfa2b27, NULL, NULL }, { _T("Vector Falcon 8000 v7.1"), 7, 1, 7, 1, _T("VECTOR\0"), 32768, 128, 0, 0, ROMTYPE_VECTOR, 0, 0, NULL, - 0xa8120c55, 0x248935ab, 0xf4d74036, 0xefdafdbb, 0x7817e232, 0xfc13e0fa, NULL, NULL }, + 0xa8120c55, 0x248935ab,0xf4d74036,0xefdafdbb,0x7817e232,0xfc13e0fa, NULL, NULL }, ALTROMPN(128, 1, 1, 16384, ROMTYPE_ODD | ROMTYPE_8BIT, NULL, 0x798b1152, 0x603ba087,0xecee69ac,0x7ccf6e88,0x3e374fc8,0x808bcbb4) ALTROMPN(128, 1, 2, 16384, ROMTYPE_EVEN | ROMTYPE_8BIT, NULL, 0xd8b2f469, 0xbc600f99,0xa0ff7384,0xdabc7a04,0xb7bb0e71,0xad615db5) { _T("Vector Falcon 8000 v7.6"), 7, 6, 7, 6, _T("VECTOR\0"), 32768, 172, 0, 0, ROMTYPE_VECTOR, 0, 0, NULL, @@ -449,7 +455,7 @@ static struct romdata roms[] = { 0x1cfb0a0b, 0xc7275eda,0x547d6664,0x5c4eb7a0,0x3b5cef37,0xa498365a, NULL, NULL }, { _T("AlfaPower v8.3"), 8, 3, 8, 3, _T("ALFAPOWERPLUS\0"), 32768, 118, 0, 0, ROMTYPE_ALFAPLUS, 0, 0, NULL, 0xe8201bad, 0xdefea015,0x596fce32,0x11e84397,0x23046a31,0x5a7726dc, NULL, NULL }, - { _T("Masoboshi MC-702"), 2, 201, 2, 201, _T("MASOBOSHI\0"), 32768, 120, 0, 0, ROMTYPE_MASOBOSHI, 0, 0, NULL, + { _T("Masoboshi MC-702 v2.201"), 2, 201, 2, 201, _T("MASOBOSHI\0"), 32768, 120, 0, 0, ROMTYPE_MASOBOSHI, 0, 0, NULL, 0xcd99b98a, 0x3897e46a,0x66d5833f,0x849b8e81,0x30acb3cb,0x319a2fa0, NULL, NULL }, { _T("Roctec RocHard RH800C v1"), 1, 0, 1, 0, _T("ROCHARD\0"), 16384, 138, 0, 0, ROMTYPE_ROCHARD, 0, 0, NULL, 0x0e980aec, 0xbcafa14d,0xe80576cb,0xe3e0c638,0x1ca90379,0xe078a8bd, NULL, NULL }, @@ -461,7 +467,7 @@ static struct romdata roms[] = { ALTROMPN(146, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, NULL, 0xc88843cb, 0x3d7eb1b6, 0x8139b81b, 0x0665684c, 0x536ab3d0, 0x52a5dd9d) { _T("Apollo 500/2000"), 0, 0, 0, 0, _T("APOLLOHD\0"), 16384, 145, 0, 0, ROMTYPE_APOLLOHD, 0, 0, NULL, 0x931bad25, 0x24b4ee4c,0x129c7a93,0xf83ad570,0x66afd80c,0x4179f39c, NULL, NULL }, - { _T("Multi Evolution 500/2000"), 3, 0, 3, 0, _T("MULTIEVOLUTION\0"), 65536, 156, 0, 0, ROMTYPE_MEVOLUTION, 0, 0, NULL, + { _T("Multi Evolution 500/2000 v3.0"), 3, 0, 3, 0, _T("MULTIEVOLUTION\0"), 65536, 156, 0, 0, ROMTYPE_MEVOLUTION, 0, 0, NULL, 0xd13a2c89, 0xf9e38c4b,0xf5c6499d,0x486946ba,0x7b7636b8,0x0845265b, NULL, NULL }, ALTROMPN(156, 1, 1, 32768, ROMTYPE_ODD | ROMTYPE_8BIT, NULL, 0x339b3549, 0x74de857b, 0x42f9a8e0, 0xc1f3c29e, 0x06982622, 0x853d08fe) ALTROMPN(156, 1, 2, 32768, ROMTYPE_EVEN | ROMTYPE_8BIT, NULL, 0x3aca5d1f, 0x786f2197, 0xc614be91, 0xae7e87da, 0xb42c3290, 0xd7997763) @@ -483,6 +489,14 @@ static struct romdata roms[] = { 0x8d144212, 0xc5a4f497, 0x5216c1b1, 0xe08760d0, 0x0bd579ef, 0xea226354, NULL, NULL }, { _T("Mainhattan Data A-Team v1.8"), 1, 8, 1, 8, _T("ATEAM\0"), 65536, 174, 0, 0, ROMTYPE_ATEAM, 0, 0, NULL, 0x4fe08a5d, 0x007e5c61, 0x4048f598, 0x6d14011d, 0x23a41435, 0x5e0a2259, NULL, NULL }, + { _T("M-Tec AT500 Megabody v1.33"), 1, 33, 1, 33, _T("MTECAT\0"), 32768, 199, 0, 0, ROMTYPE_MTEC, 0, 0, NULL, + 0x19715a2f, 0x124f9d10, 0x19f1b285, 0x16f33f4e, 0x2bf03ca0, 0x2f9ad772, NULL, NULL }, + { _T("Comspec SA-1000 v34.805"), 34, 805, 34, 805, _T("COMSPEC\0"), 16384, 200, 0, 0, ROMTYPE_COMSPEC, 0, 0, NULL, + 0x44458e28, 0x048b8232, 0xfe54252b, 0xb81e0d06, 0x83c9e92d, 0x880f3cbf, NULL, NULL }, + ALTROMPN(200, 1, 1, 8192, ROMTYPE_ODD | ROMTYPE_8BIT, NULL, 0xd5838a35, 0xb3d83657, 0x661a9fe1, 0xd54e6e69, 0xc8b13878, 0x0960a107) + ALTROMPN(200, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, NULL, 0x098c5529, 0x6f51827d, 0x40a79438, 0x69e2d0fb, 0x6e2e46e9, 0xb65c1244) + { _T("California Access Malibu v1.0"), 1, 0, 1, 0, _T("MALIBU\0"), 8192, 201, 0, 0, ROMTYPE_MALIBU, 0, 0, NULL, + 0xe60b1ce6, 0xa7c4b709, 0x494f4034, 0x42b8ec11, 0x090dc1d0, 0x18098ebc, NULL, NULL }, { _T("CyberStorm MK I 68040"), 0, 0, 0, 0, _T("CSMKI\0"), 32768, 95, 0, 0, ROMTYPE_CB_CSMK1, 0, 0, NULL, 0, 0, 0, 0, 0, 0, NULL, _T("cyberstormmk1_040.rom") }, @@ -512,6 +526,10 @@ static struct romdata roms[] = { 0xf8e1ad83, 0x45a2b7db,0x6e86fe80,0x5cfef63c,0x65c331a7,0x16a6e9e8, NULL, NULL }, { _T("A2088 BIOS 3.6.1"), 3, 61, 3, 61, _T("A2088\0"), 16384, 149, 0, 0, ROMTYPE_A2088, 0, 0, _T("380788-06"), 0x5fd93e56, 0xc1b707a8,0xa62907d7,0x5299f10a,0xa60efd1f,0x44514b26, NULL, NULL }, + { _T("A2088T BIOS 4.0 (09/11/89)"), 4, 10, 4, 10, _T("A2088T\0"), 32768, 203, 0, 0, ROMTYPE_A2088T, 0, 0, _T("390657-01"), + 0x12545545, 0x54f7a99e,0x2e5dbc30,0x43f52001,0xa4abb3b6,0x8e4832fd, NULL, NULL }, + { _T("A2088T BIOS 4.0 (14/11/89)"), 4, 10, 4, 10, _T("A2088T\0"), 32768, 204, 0, 0, ROMTYPE_A2088T, 0, 0, _T("390657-01"), + 0xb6b3b6f7, 0x7929a92f,0x25203cea,0xad302ddd,0x31db55cd,0x49b3020a, NULL, NULL }, { _T("A2088T BIOS 4.10"), 4, 10, 4, 11, _T("A2088T\0"), 32768, 150, 0, 0, ROMTYPE_A2088T, 0, 0, _T("390657-02"), 0x20c5d1a9, 0x08e3fbb7,0x28dfc514,0x24083313,0x373ea7a5,0xa2c3e965, NULL, NULL }, { _T("A2088T BIOS 4.11"), 4, 11, 4, 11, _T("A2088T\0"), 32768, 151, 0, 0, ROMTYPE_A2088T, 0, 0, _T("390547-02"), @@ -526,8 +544,10 @@ static struct romdata roms[] = { 0xd572e205, 0x74fdf0f8,0x325fbc41,0x2b98c72d,0xf5095804,0x831c46b5, NULL, NULL }, ALTROMPN(154, 1, 1, 16384, ROMTYPE_ODD | ROMTYPE_8BIT, _T("380682-04"), 0xc23dcd55, 0x38dc24b7, 0x14427b15, 0xd5214cc9, 0xb9be0de7, 0x20bd6a34) ALTROMPN(154, 1, 2, 16384, ROMTYPE_EVEN | ROMTYPE_8BIT, _T("380683-04"), 0xdad80c0b, 0x12fe2916, 0x64f8c412, 0x3877a24e, 0x05837091, 0x44d8acd0) - { _T("A2386SX BIOS 1.0"), 1, 0, 1, 0, _T("A2386SX\0"), 65536, 155, 0, 0, ROMTYPE_A2386, 0, 0, NULL, + { _T("A2386SX BIOS 1.00"), 1, 0, 1, 0, _T("A2386SX\0"), 65536, 155, 0, 0, ROMTYPE_A2386, 0, 0, _T("391168-01"), 0x37003e0c, 0x2e127e9c,0x8581d30c,0x2e46404b,0x21608e3c,0xe935fa27, NULL, NULL }, + { _T("A2386SX BIOS 1.00.03"), 1, 0, 1, 0, _T("A2386SX\0"), 65536, 205, 0, 0, ROMTYPE_A2386, 0, 0, _T("391168-01"), + 0x41041761, 0x78659be4,0x5755f8bd,0x004a101b,0x658ae75d,0xf142ddc9, NULL, NULL }, { _T("Arcadia OnePlay 2.11"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 49, 0, 0, ROMTYPE_ARCADIABIOS, 0, 0 }, { _T("Arcadia TenPlay 2.11"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 50, 0, 0, ROMTYPE_ARCADIABIOS, 0, 0 }, @@ -681,7 +701,7 @@ static struct romdata roms[] = { ALTROMPN(198, 1, 1, 65536, ROMTYPE_EVEN | ROMTYPE_8BIT, NULL, 0xf59cfc4a, 0x9fadf7f1,0xe23d6b4e,0x828bf2b3,0xde919d08,0x7c690a3f) ALTROMPN(198, 1, 2, 65536, ROMTYPE_ODD | ROMTYPE_8BIT, NULL, 0x938b25cb, 0xd0114bbc,0x588dcfce,0x6a469013,0xd0e35afb,0x93e38af5) - { NULL } + { NULL } }; @@ -690,7 +710,7 @@ void romlist_clear (void) int i; int mask = 0; struct romdata *parent; - const char *pn; + const TCHAR *pn; xfree (rl); rl = 0; @@ -716,7 +736,7 @@ void romlist_clear (void) _tcscat (newpn, _T("/")); } _tcscat (newpn, rd->partnumber); - xfree ((char*)parent->partnumber); + xfree ((char *) parent->partnumber); parent->partnumber = newpn; } } @@ -756,136 +776,6 @@ static void romlist_cleanup (void) } i++; } -#if 0 - for (i = 0; i < romlist_cnt; i++) { - struct romlist *rll = &rl[i]; - write_log (_T("%d: %08x %s (%s)\n"), rll->rd->id, rll->rd->group, rll->rd->name, rll->path); - } -#endif -} - -struct romlist **getromlistbyident (int ver, int rev, int subver, int subrev, const TCHAR *model, int romflags, bool all) -{ - int i, j, ok, out, max; - struct romdata *rd; - struct romlist **rdout, *rltmp; - void *buf; - static struct romlist rlstatic; - - for (i = 0; roms[i].name; i++); - if (all) - max = i; - else - max = romlist_cnt; - buf = xmalloc (uae_u8, (sizeof (struct romlist*) + sizeof (struct romlist)) * (i + 1)); - rdout = (struct romlist **) buf; - rltmp = (struct romlist*)((uae_u8*)buf + (i + 1) * sizeof (struct romlist*)); - out = 0; - for (i = 0; i < max; i++) { - ok = 0; - if (!all) - rd = rl[i].rd; - else - rd = &roms[i]; - if (rd->group) - continue; - if (model && !_tcsicmp (model, rd->name)) - ok = 2; - if ((ver < 0 || rd->ver == ver) && (rev < 0 || rd->rev == rev)) { - if (subver >= 0) { - if (rd->subver == subver && (subrev < 0 || rd->subrev == subrev) && rd->subver > 0) - ok = 1; - } else { - ok = 1; - } - } - if (!ok) - continue; - if (model && ok < 2) { - const char *p = rd->model; - ok = 0; - while (p && *p) { - if (!_tcscmp(rd->model, model)) { - ok = 1; - break; - } - p = p + _tcslen(p) + 1; - } - } - if (romflags && (rd->type & romflags) == 0) - ok = 0; - if (ok) { - if (all) { - rdout[out++] = rltmp; - rltmp->path = NULL; - rltmp->rd = rd; - rltmp++; - } else { - rdout[out++] = &rl[i]; - } - } - } - if (out == 0) { - xfree (rdout); - return NULL; - } - for (i = 0; i < out; i++) { - int v1 = rdout[i]->rd->subver * 1000 + rdout[i]->rd->subrev; - for (j = i + 1; j < out; j++) { - int v2 = rdout[j]->rd->subver * 1000 + rdout[j]->rd->subrev; - if (v1 < v2) { - struct romlist *rltmp = rdout[j]; - rdout[j] = rdout[i]; - rdout[i] = rltmp; - } - } - } - rdout[out] = NULL; - return rdout; -} - -struct romdata *getarcadiarombyname (const TCHAR *name) -{ - int i; - for (i = 0; roms[i].name; i++) { - if (roms[i].group == 0 && (roms[i].type == ROMTYPE_ARCADIAGAME || roms[i].type == ROMTYPE_ARCADIAGAME)) { - const char *p = roms[i].name; - p = p + _tcslen (p) + 1; - if (_tcslen (name) >= _tcslen (p) + 4) { - const TCHAR *p2 = name + _tcslen (name) - _tcslen (p) - 4; - if (!memcmp (p, p2, _tcslen (p)) && !memcmp (p2 + _tcslen (p2) - 4, ".zip", 4)) - return &roms[i]; - } - } - } - return NULL; -} - -struct romlist **getarcadiaroms(void) -{ - int i, out, max; - void *buf; - struct romlist **rdout, *rltmp; - - max = 0; - for (i = 0; roms[i].name; i++) { - if (roms[i].group == 0 && (roms[i].type == ROMTYPE_ARCADIABIOS || roms[i].type == ROMTYPE_ARCADIAGAME)) - max++; - } - buf = xmalloc (uae_u8, (sizeof (struct romlist*) + sizeof (struct romlist)) * (max + 1)); - rdout = (struct romlist **)buf; - rltmp = (struct romlist*)((uae_u8*)buf + (max + 1) * sizeof (struct romlist*)); - out = 0; - for (i = 0; roms[i].name; i++) { - if (roms[i].group == 0 && (roms[i].type == ROMTYPE_ARCADIABIOS || roms[i].type == ROMTYPE_ARCADIAGAME)) { - rdout[out++] = rltmp; - rltmp->path = NULL; - rltmp->rd = &roms[i]; - rltmp++; - } - } - rdout[out] = NULL; - return rdout; } static int kickstart_checksum_do (uae_u8 *mem, int size) @@ -902,6 +792,24 @@ static int kickstart_checksum_do (uae_u8 *mem, int size) return cksum == 0xffffffff; } +static int kickstart_checksum_more_do (uae_u8 *mem, int size) +{ + uae_u8 *p = mem + size - 20; + if (p[0] != ((size >> 24) & 0xff) || p[1] != ((size >> 16) & 0xff) + || p[2] != ((size >> 8) & 0xff) || p[3] != ((size >> 0) & 0xff)) + return 0; + if (size == 524288) { + if (mem[0] != 0x11 || mem[1] != 0x14) + return 0; + } else if (size == 262144) { + if (mem[0] != 0x11 || mem[1] != 0x11) + return 0; + } else { + return 0; + } + return kickstart_checksum_do(mem, size); +} + #define ROM_KEY_NUM 4 struct rom_key { uae_u8 *key; @@ -937,7 +845,6 @@ static void addkey (uae_u8 *key, int size, const TCHAR *name) } keyring[i].key = key; keyring[i].size = size; - write_log (_T("ROM KEY '%s' %d bytes loaded\n"), name, size); } void addkeyfile (const TCHAR *path) @@ -992,7 +899,7 @@ int load_keyring (struct uae_prefs *p, const TCHAR *path) { uae_u8 *keybuf; int keysize; - TCHAR tmp[MAX_PATH], *d; + TCHAR tmp[MAX_DPATH], *d; int keyids[] = { 0, 48, 73, -1 }; int cnt, i; @@ -1025,7 +932,7 @@ int load_keyring (struct uae_prefs *p, const TCHAR *path) break; case 1: if (p) { - _tcscpy(tmp, p->path_rom.path[0]); + _tcscpy (tmp, p->path_rom); _tcscat (tmp, _T("rom.key")); } break; @@ -1074,7 +981,7 @@ void free_keyring (void) struct romdata *getromdatabyname (const TCHAR *name) { - TCHAR tmp[MAX_PATH]; + TCHAR tmp[MAX_DPATH]; int i = 0; while (roms[i].name) { if (!roms[i].group) { @@ -1154,6 +1061,18 @@ static int cmpsha1 (const uae_u8 *s1, const struct romdata *rd) return 0; } +struct romdata *getfrombydefaultname(const TCHAR *name, int size) +{ + int i = 0; + while (roms[i].name) { + if (notcrc32(roms[i].crc32) && size >= roms[i].size && roms[i].defaultfilename && !_tcsicmp(roms[i].defaultfilename, name)) { + return &roms[i]; + } + i++; + } + return NULL; +} + static struct romdata *checkromdata (const uae_u8 *sha1, int size, uae_u32 mask) { int i = 0; @@ -1233,9 +1152,7 @@ int decode_rom (uae_u8 *mem, int size, int mode, int real_size) { if (mode == 1) { if (!decode_cloanto_rom_do (mem, size, real_size)) { -#ifndef SINGLEFILE notify_user (NUMSG_NOROMKEY); -#endif return 0; } return 1; @@ -1261,30 +1178,20 @@ struct romdata *getromdatabydata (uae_u8 *rom, int size) rom = tmpbuf; size = tmpsize; } -#if 0 - if (size > 0x6c + 524288 && !memcmp (rom, "AMIG", 4)) { - uae_u8 *tmpbuf = (uae_u8*)xmalloc (uae_u8, size); - int tmpsize = size - 0x6c; - memcpy (tmpbuf, rom + 0x6c, tmpsize); - decode_rom (tmpbuf, tmpsize, 2, tmpsize); - rom = tmpbuf; - size = tmpsize; - } -#endif get_sha1 (rom, size, sha1); ret = checkromdata(sha1, size, -1); if (!ret) { get_sha1 (rom, size / 2, sha1); ret = checkromdata (sha1, size / 2, -1); if (!ret) { - /* ignore AR IO-port range until we have full dump */ + /* ignore AR2/3 IO-port range until we have full dump */ memcpy (tmp, rom, 4); memset (rom, 0, 4); get_sha1 (rom, size, sha1); - ret = checkromdata (sha1, size, ROMTYPE_AR); + ret = checkromdata (sha1, size, ROMTYPE_AR2); memcpy (rom, tmp, 4); } - } + }//9 xfree (tmpbuf); return ret; } @@ -1328,11 +1235,11 @@ void getromname (const struct romdata *rd, TCHAR *name) _stprintf (name + _tcslen (name), _T(" [%s]"), rd->partnumber); } -struct romlist *getromlistbyromdata(const struct romdata *rd) +struct romlist *getromlistbyromdata (const struct romdata *rd) { - int ids[2]; - - ids[0] = rd->id; + int ids[2]; + + ids[0] = rd->id; ids[1] = -1; return getromlistbyids(ids, NULL); } @@ -1353,11 +1260,26 @@ struct romlist *getromlistbyromtype(uae_u32 romtype) return NULL; } -struct romlist *getromlistbyids(const int *ids, const TCHAR *romname) +struct romlist *getromlistbyids (const int *ids, const TCHAR *romname) { struct romdata *rd; int i, j; + i = 0; + if (romname) { + while (ids[i] >= 0) { + rd = getromdatabyid (ids[i]); + if (rd) { + for (j = 0; j < romlist_cnt; j++) { + if (rl[j].rd->id == rd->id) { + if (my_issamepath(rl[j].path, romname)) + return &rl[j]; + } + } + } + i++; + } + } i = 0; while (ids[i] >= 0) { rd = getromdatabyid (ids[i]); @@ -1372,7 +1294,22 @@ struct romlist *getromlistbyids(const int *ids, const TCHAR *romname) return NULL; } -void romwarning(const int *ids) +struct romdata *getromdatabyids (const int *ids) +{ + struct romdata *rd; + int i; + + i = 0; + while (ids[i] >= 0) { + rd = getromdatabyid (ids[i]); + if (rd) + return rd; + i++; + } + return NULL; +} + +void romwarning (const int *ids) { int i, exp; TCHAR tmp1[MAX_DPATH], tmp2[MAX_DPATH]; @@ -1384,19 +1321,19 @@ void romwarning(const int *ids) tmp2[0] = 0; i = 0; while (ids[i] >= 0) { - struct romdata *rd = getromdatabyid(ids[i]); + struct romdata *rd = getromdatabyid (ids[i]); if (!(rd->type & ROMTYPE_NONE)) { - getromname(rd, tmp1); - _tcscat(tmp2, _T("- ")); - _tcscat(tmp2, tmp1); - _tcscat(tmp2, _T("\n")); - if (rd->type & (ROMTYPE_SCSI | ROMTYPE_CPUBOARD | ROMTYPE_CD32CART)) - exp++; + getromname (rd, tmp1); + _tcscat (tmp2, _T("- ")); + _tcscat (tmp2, tmp1); + _tcscat (tmp2, _T("\n")); + if (rd->type & (ROMTYPE_SCSI | ROMTYPE_CD32CART)) + exp++; } i++; - } - translate_message(exp ? NUMSG_EXPROMNEED : NUMSG_ROMNEED, tmp3); - gui_message(tmp3, tmp2); + } + translate_message (exp ? NUMSG_EXPROMNEED : NUMSG_ROMNEED, tmp3); + gui_message (tmp3, tmp2); } static void byteswap (uae_u8 *buf, int size) @@ -1434,18 +1371,14 @@ static void mergecd32 (uae_u8 *dst, uae_u8 *src, int size) dst[k + 2] = src[j + 1]; k += 4; } -#if 0 - { - struct zfile *f; - f = zfile_fopen ("c:\\d\\1.rom","wb", ZFD_NORMAL); - zfile_fwrite (dst, 1, size, f); - zfile_fclose(f); - } -#endif } static void descramble (const struct romdata *rd, uae_u8 *data, int size, int odd) { + int flags = rd->type; + + if (flags & (ROMTYPE_NORDIC | ROMTYPE_XPOWER)) + descramble_nordicpro (data, size, odd); } static int read_rom_file (uae_u8 *buf, const struct romdata *rd) @@ -1472,11 +1405,22 @@ static int read_rom_file (uae_u8 *buf, const struct romdata *rd) return 1; } +#if SAVE_ROM +static void save_rom(uae_u8 *rom, int size) +{ + struct zfile *f; + f = zfile_fopen (_T("c:\\temp\\1.rom"), _T("wb")); + zfile_fwrite (rom, 1, size, f); + zfile_fclose(f); +} +#endif + struct zfile *read_rom (struct romdata *prd) { struct romdata *rd2 = prd; struct romdata *rd = prd; - const char *name; + struct romdata *rdpair = NULL; + const TCHAR *name; int id = rd->id; uae_u32 crc32; int size; @@ -1490,6 +1434,7 @@ struct zfile *read_rom (struct romdata *prd) break; rd2--; } + size = rd2->size; crc32 = rd2->crc32; name = rd->name; @@ -1515,10 +1460,34 @@ struct zfile *read_rom (struct romdata *prd) } add = 1; i++; + } else if (flags & ROMTYPE_QUAD) { + if (i == 0) { + for (int k = 0; k < 4; k++) { + read_rom_file (buf2, rd2 + k + 1); + for (j = 0; j < size; j += 4) + buf[j + k] = buf2[j / 4]; + } + } else { + for (int kk = 0; kk < 2; kk++) { + for (int k = 0; k < 2; k++) { + read_rom_file (buf2, rd2 + k + kk * 2 + 1); + for (j = 0; j < size / 2; j += 2) { + buf[j + k + kk * (rd2->size / 2)] = buf2[j / 2]; + } + } + } + } + add = 4; } else { int romsize = size / 2; if (i) odd = !odd; + if (rd->id == rd[1].id) + rdpair = &rd[1]; + else if (rd != roms) + rdpair = &rd[-1]; + else + rdpair = rd; if (flags & ROMTYPE_8BIT) { read_rom_file (buf2, rd); if (flags & ROMTYPE_BYTESWAP) @@ -1527,7 +1496,7 @@ struct zfile *read_rom (struct romdata *prd) descramble (rd, buf2, romsize, odd); for (j = 0; j < size; j += 2) buf[j + odd] = buf2[j / 2]; - read_rom_file (buf2, rd + 1); + read_rom_file (buf2, rdpair); if (flags & ROMTYPE_BYTESWAP) byteswap (buf2, romsize); if (flags & ROMTYPE_SCRAMBLED) @@ -1544,7 +1513,7 @@ struct zfile *read_rom (struct romdata *prd) buf[j + 2 * odd + 0] = buf2[j / 2 + 0]; buf[j + 2 * odd + 1] = buf2[j / 2 + 1]; } - read_rom_file (buf2, rd + 1); + read_rom_file (buf2, rdpair); if (flags & ROMTYPE_BYTESWAP) byteswap (buf2, romsize); if (flags & ROMTYPE_SCRAMBLED) @@ -1556,7 +1525,12 @@ struct zfile *read_rom (struct romdata *prd) } add = 2; } - if (get_crc32 (buf, size) == crc32) { + +#if SAVE_ROM + save_rom(buf, size); +#endif + + if (notcrc32(crc32) || get_crc32(buf, size) == crc32) { ok = 1; } if (!ok && (rd->type & ROMTYPE_AR)) { @@ -1574,6 +1548,8 @@ struct zfile *read_rom (struct romdata *prd) byteswap (buf, size); if (get_crc32 (buf, size) == crc32) ok = 1; + if (!ok) + byteswap(buf, size); } if (ok) { struct zfile *zf = zfile_fopen_empty (NULL, name, size); @@ -1594,29 +1570,91 @@ struct zfile *read_rom (struct romdata *prd) struct zfile *rom_fopen (const TCHAR *name, const TCHAR *mode, int mask) { - struct zfile *f; - //write_log (_T("attempting to load '%s'\n"), name); - f = zfile_fopen (name, mode, mask); - //write_log (_T("=%p\n"), f); - return f; + return zfile_fopen (name, mode, mask); +} + +static struct zfile *rom_fopen2(const TCHAR *name, const TCHAR *mode, int mask) +{ + struct zfile *f2 = NULL; + struct zfile *f = rom_fopen(name, mode, mask); + if (f) { + int size = zfile_size(f); + if (size == 524288 * 2 || size == 524288 || size == 262144) { + uae_u8 *newrom = NULL; + uae_u8 *tmp1 = xcalloc(uae_u8, 524288 * 2); + uae_u8 *tmp2 = xcalloc(uae_u8, 524288 * 2); + for (;;) { + if (zfile_fread(tmp1, 1, size, f) != size) + break; + if (size == 524288 * 2) { + // Perhaps it is 1M interleaved ROM image? + mergecd32(tmp2, tmp1, 524288 * 2); + if (kickstart_checksum_more_do(tmp2, 524288) && kickstart_checksum_more_do(tmp2 + 524288, 524288)) { + newrom = tmp2; + break; + } + // byteswapped KS ROM? + byteswap(tmp1, 524288 * 2); + if (kickstart_checksum_more_do(tmp1, 524288) && kickstart_checksum_more_do(tmp1 + 524288, 524288)) { + newrom = tmp1; + break; + } else { + byteswap(tmp1, 524288 * 2); + wordbyteswap(tmp1, 524288 * 2); + if (kickstart_checksum_more_do(tmp1, 524288) && kickstart_checksum_more_do(tmp1 + 524288, 524288)) { + newrom = tmp1; + break; + } + } + } else { + // byteswapped KS ROM? + byteswap(tmp1, size); + if (kickstart_checksum_more_do(tmp1, size)) { + newrom = tmp1; + break; + } else { + byteswap(tmp1, size); + wordbyteswap(tmp1, size); + if (kickstart_checksum_more_do(tmp1, size)) { + newrom = tmp1; + break; + } + } + } + break; + } + if (newrom) { + f2 = zfile_fopen_data(zfile_getname(f), size, newrom); + } + xfree(tmp2); + xfree(tmp1); + } + } + if (f2) { + zfile_fclose(f); + f = f2; + } + if (f) { + zfile_fseek(f, 0, SEEK_SET); + } + return f; } struct zfile *read_rom_name (const TCHAR *filename) { - int i; struct zfile *f; - for (i = 0; i < romlist_cnt; i++) { - if (!_tcsicmp (filename, rl[i].path)) { + for (int i = 0; i < romlist_cnt; i++) { + if (my_issamepath(filename, rl[i].path)) { struct romdata *rd = rl[i].rd; f = read_rom (rd); if (f) return f; } } - f = rom_fopen (filename, _T("rb"), ZFD_NORMAL); + f = rom_fopen2(filename, _T("rb"), ZFD_NORMAL); if (f) { - uae_u8 tmp[11]; + uae_u8 tmp[11] = { 0 }; zfile_fread (tmp, sizeof tmp, 1, f); if (!memcmp (tmp, "AMIROMTYPE1", sizeof tmp)) { struct zfile *df; @@ -1702,9 +1740,7 @@ void kickstart_fix_checksum (uae_u8 *mem, int size) int kickstart_checksum (uae_u8 *mem, int size) { if (!kickstart_checksum_do (mem, size)) { -#ifndef SINGLEFILE notify_user (NUMSG_KSROMCRCERROR); -#endif return 0; } return 1; @@ -1716,6 +1752,8 @@ int configure_rom (struct uae_prefs *p, const int *rom, int msg) TCHAR *path = 0; int i; + if (rom[0] < 0) + return 1; i = 0; while (rom[i] >= 0) { rd = getromdatabyid (rom[i]); @@ -1734,49 +1772,20 @@ int configure_rom (struct uae_prefs *p, const int *rom, int msg) return 0; } if (rd->type & (ROMTYPE_KICK | ROMTYPE_KICKCD32)) - _tcscpy(p->romfile, path); - if (rd->type & (ROMTYPE_EXTCD32 | ROMTYPE_EXTCDTV | ROMTYPE_ARCADIABIOS | ROMTYPE_ALG)) - _tcscpy(p->romextfile, path); + _tcscpy (p->romfile, path); + if (rd->type & (ROMTYPE_EXTCD32)) + _tcscpy (p->romextfile, path); if (rd->type & ROMTYPE_CD32CART) { _tcscpy(p->cartfile, path); struct boardromconfig *brc = get_device_rom_new(p, ROMTYPE_CD32CART, 0, NULL); if (brc) _tcscpy(brc->roms[0].romfile, p->cartfile); } - if ((rd->type & ROMTYPE_ARCADIAGAME) || - rd->type == ROMTYPE_HRTMON || rd->type == ROMTYPE_XPOWER || rd->type == ROMTYPE_NORDIC || rd->type == ROMTYPE_AR || rd->type == ROMTYPE_SUPERIV) - _tcscpy(p->cartfile, path); - if (rd->type & ROMTYPE_CPUBOARD) - set_device_rom(p, path, ROMTYPE_CPUBOARD, 0); + if (rd->type == ROMTYPE_HRTMON || rd->type == ROMTYPE_XPOWER || rd->type == ROMTYPE_NORDIC || rd->type == ROMTYPE_AR || rd->type == ROMTYPE_SUPERIV) + _tcscpy (p->cartfile, path); return 1; } -void set_device_rom(struct uae_prefs *p, const TCHAR *path, int romtype, int devnum) -{ - int idx; - const struct expansionromtype *ert = get_device_expansion_rom(romtype); - if (path == NULL) { - struct boardromconfig *brc = get_device_rom(p, romtype, devnum, &idx); - if (brc) { - brc->roms[idx].romfile[0] = 0; - brc->roms[idx].romident[0] = 0; - } - } - else { - struct boardromconfig *brc = get_device_rom_new(p, romtype, devnum, &idx); - _tcscpy(brc->roms[idx].romfile, path); - } -} - -const struct expansionromtype *get_unit_expansion_rom(int hdunit) -{ - if (hdunit >= HD_CONTROLLER_TYPE_SCSI_EXPANSION_FIRST && hdunit <= HD_CONTROLLER_TYPE_SCSI_LAST) - return &expansionroms[hdunit - HD_CONTROLLER_TYPE_SCSI_EXPANSION_FIRST]; - if (hdunit >= HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST && hdunit <= HD_CONTROLLER_TYPE_IDE_LAST) - return &expansionroms[hdunit - HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST]; - return NULL; -} - const struct expansionromtype *get_device_expansion_rom(int romtype) { for (int i = 0; expansionroms[i].name; i++) { @@ -1793,7 +1802,7 @@ static void device_rom_defaults(struct uae_prefs *p, struct boardromconfig *brc, brc->device_type = romtype; brc->device_num = devnum; for (int i = 0; i < MAX_BOARD_ROMS; i++) { - brc->roms[i].device_id = 7; + brc->roms[i].device_id = 7; brc->roms[i].back = brc; } int order = 0; @@ -1860,8 +1869,7 @@ void clear_device_rom(struct uae_prefs *p, int romtype, int devnum, bool deleteD return; if (deleteDevice) { memset(brc, 0, sizeof(struct boardromconfig)); - } - else { + } else { memset(&brc->roms[index], 0, sizeof(struct romconfig)); } } @@ -1870,7 +1878,8 @@ struct boardromconfig *get_device_rom(struct uae_prefs *p, int romtype, int devn { const struct expansionromtype *ert = get_device_expansion_rom(romtype); if (!ert) { - *index = 0; + if (index) + *index = 0; return NULL; } int parentrom = ert->parentromtype ? ert->parentromtype : romtype; @@ -1895,30 +1904,9 @@ struct romconfig *get_device_romconfig(struct uae_prefs *p, int romtype, int dev return NULL; } -void board_prefs_changed(int romtype, int devnum) -{ - int idx1, idx2; - struct boardromconfig *brc1 = get_device_rom(&currprefs, romtype, devnum, &idx1); - struct boardromconfig *brc2 = get_device_rom(&changed_prefs, romtype, devnum, &idx2); - if (brc1 && brc2) { - memcpy(brc1, brc2, sizeof(struct boardromconfig)); - } - else if (brc1 && !brc2) { - clear_device_rom(&currprefs, romtype, devnum, true); - } - else if (!brc1 && brc2) { - brc1 = get_device_rom_new(&currprefs, romtype, devnum, &idx1); - if (brc1) - memcpy(brc1, brc2, sizeof(struct boardromconfig)); - } -} - bool is_board_enabled(struct uae_prefs *p, int romtype, int devnum) { int idx; - if (romtype == ROMTYPE_CPUBOARD && p->cpuboard_type) { - return devnum == 0; - } struct boardromconfig *brc = get_device_rom(p, romtype, devnum, &idx); if (!brc) return false; @@ -1939,7 +1927,7 @@ struct zfile *read_device_from_romconfig(struct romconfig *rc, uae_u32 romtype) struct zfile *z = NULL; if (isspecialrom(rc->romfile)) return z; - z = read_rom_name(rc->romfile); + z = read_rom_name (rc->romfile); if (z) return z; if (romtype) { @@ -1952,27 +1940,6 @@ struct zfile *read_device_from_romconfig(struct romconfig *rc, uae_u32 romtype) return z; } -struct zfile *read_device_rom(struct uae_prefs *p, int romtype, int devnum, int *roms) -{ - int idx; - struct boardromconfig *brc = get_device_rom(p, romtype, devnum, &idx); - if (brc) { - const TCHAR *romname = brc->roms[idx].romfile; - if (isspecialrom(romname)) - return NULL; - struct zfile *z = read_rom_name(romname); - if (!z && roms) { - struct romlist *rl = getromlistbyids(roms, romname); - if (rl) { - struct romdata *rd = rl->rd; - z = read_rom(rd); - } - } - return z; - } - return NULL; -} - int is_device_rom(struct uae_prefs *p, int romtype, int devnum) { int idx; @@ -2043,8 +2010,7 @@ bool load_rom_rc(struct romconfig *rc, uae_u32 romtype, int maxfilesize, int fil if (flags & LOADROM_EVENONLY) { rom[pos + 1] = (flags >> 16) & 0xff; pos += 2; - } - else { + } else { pos += 1; } cnt++; @@ -2064,4 +2030,4 @@ bool load_rom_rc(struct romconfig *rc, uae_u32 romtype, int maxfilesize, int fil oldpos = 0; } return true; -} \ No newline at end of file +} diff --git a/src/savestate.cpp b/src/savestate.cpp index 7c906cc4..edd3e354 100644 --- a/src/savestate.cpp +++ b/src/savestate.cpp @@ -1,4 +1,4 @@ -/* + /* * UAE - The Un*x Amiga Emulator * * Save/restore emulator state @@ -8,920 +8,879 @@ * see below for ASF-structure */ -/* Features: - * - * - full CPU state (68000/68010/68020/68030/68040/68060) - * - FPU (68881/68882/68040/68060) - * - full CIA-A and CIA-B state (with all internal registers) - * - saves all custom registers and audio internal state. - * - Chip, Bogo, Fast, Z3 and Picasso96 RAM supported - * - disk drive type, imagefile, track and motor state - * - Kickstart ROM version, address and size is saved. This data is not used during restore yet. - * - Action Replay state is saved - */ + /* Features: + * + * - full CPU state (68000/68010/68020/68030/68040/68060) + * - FPU (68881/68882/68040/68060) + * - full CIA-A and CIA-B state (with all internal registers) + * - saves all custom registers and audio internal state. + * - Chip, Bogo, Fast, Z3 and Picasso96 RAM supported + * - disk drive type, imagefile, track and motor state + * - Kickstart ROM version, address and size is saved. This data is not used during restore yet. + * - Action Replay state is saved + */ -/* Notes: - * - * - blitter state is not saved, blitter is forced to finish immediately if it - * was active - * - disk DMA state is completely saved - * - does not ask for statefile name and description. Currently uses DF0's disk - * image name (".adf" is replaced with ".asf") - * - only Amiga state is restored, harddisk support, autoconfig, expansion boards etc.. - * are not saved/restored (and probably never will). - * - use this for saving games that can't be saved to disk - */ + /* Notes: + * + * - blitter state is not saved, blitter is forced to finish immediately if it + * was active + * - disk DMA state is completely saved + * - does not ask for statefile name and description. Currently uses DF0's disk + * image name (".adf" is replaced with ".asf") + * - only Amiga state is restored, harddisk support, autoconfig, expansion boards etc.. + * are not saved/restored (and probably never will). + * - use this for saving games that can't be saved to disk + */ -/* Usage : - * - * save: - * - * set savestate_state = STATE_DOSAVE, savestate_filename = "..." - * - * restore: - * - * set savestate_state = STATE_DORESTORE, savestate_filename = "..." - * - */ + /* Usage : + * + * save: + * + * set savestate_state = STATE_DOSAVE, savestate_filename = "..." + * + * restore: + * + * set savestate_state = STATE_DORESTORE, savestate_filename = "..." + * + */ #include "sysconfig.h" #include "sysdeps.h" #include "options.h" +#include "memory.h" #include "zfile.h" #include "autoconf.h" #include "custom.h" +#include "newcpu.h" #include "savestate.h" #include "uae.h" #include "gui.h" #include "audio.h" #include "filesys.h" +#include "disk.h" +#include "threaddep/thread.h" +#include "devices.h" int savestate_state = 0; static bool new_blitter = false; -struct zfile* savestate_file; -static int savestate_docompress, savestate_specialdump, savestate_nodialogs; +struct zfile *savestate_file; +static int savestate_docompress, savestate_nodialogs; TCHAR savestate_fname[MAX_DPATH]; -static void state_incompatible_warn() +static void state_incompatible_warn(void) { - static int warned; - int dowarn = 0; - int i; + static int warned; + int dowarn = 0; + int i; #ifdef BSDSOCKET if (currprefs.socket_emu) dowarn = 1; #endif -#ifdef SCSIEMU - if (currprefs.scsi) - dowarn = 1; -#endif -#ifdef CATWEASEL - if (currprefs.catweasel) - dowarn = 1; -#endif #ifdef FILESYS - for (i = 0; i < currprefs.mountitems; i++) - { - struct mountedinfo mi; - int type = get_filesys_unitconfig(&currprefs, i, &mi); - if (mi.ismounted && type != FILESYS_VIRTUAL && type != FILESYS_HARDFILE && type != FILESYS_HARDFILE_RDB) - dowarn = 1; - } + for(i = 0; i < currprefs.mountitems; i++) { + struct mountedinfo mi; + int type = get_filesys_unitconfig (&currprefs, i, &mi); + if (mi.ismounted && type != FILESYS_VIRTUAL && type != FILESYS_HARDFILE && type != FILESYS_HARDFILE_RDB) + dowarn = 1; + } #endif - if (!warned && dowarn) - { - warned = 1; - notify_user(NUMSG_STATEHD); - } + if (!warned && dowarn) { + warned = 1; + notify_user (NUMSG_STATEHD); + } } -/* functions for reading/writing bytes, shorts and longs in big-endian - * format independent of host machine's endianess */ - -void save_u32_func(uae_u8** dstp, uae_u32 v) +void save_u32_func (uae_u8 **dstp, uae_u32 v) { - uae_u8* dst = *dstp; - *dst++ = uae_u8(v >> 24); - *dst++ = uae_u8(v >> 16); - *dst++ = uae_u8(v >> 8); - *dst++ = uae_u8(v >> 0); - *dstp = dst; + uae_u8 *dst = *dstp; + *dst++ = (uae_u8)(v >> 24); + *dst++ = (uae_u8)(v >> 16); + *dst++ = (uae_u8)(v >> 8); + *dst++ = (uae_u8)(v >> 0); + *dstp = dst; } - -void save_u64_func(uae_u8** dstp, uae_u64 v) +void save_u64_func (uae_u8 **dstp, uae_u64 v) { - save_u32_func(dstp, uae_u32(v >> 32)); - save_u32_func(dstp, uae_u32(v)); + save_u32_func (dstp, (uae_u32)(v >> 32)); + save_u32_func (dstp, (uae_u32)v); } - -void save_u16_func(uae_u8** dstp, uae_u16 v) +void save_u16_func (uae_u8 **dstp, uae_u16 v) { - uae_u8* dst = *dstp; - *dst++ = uae_u8(v >> 8); - *dst++ = uae_u8(v >> 0); - *dstp = dst; + uae_u8 *dst = *dstp; + *dst++ = (uae_u8)(v >> 8); + *dst++ = (uae_u8)(v >> 0); + *dstp = dst; } - -void save_u8_func(uae_u8** dstp, uae_u8 v) +void save_u8_func (uae_u8 **dstp, uae_u8 v) { - uae_u8* dst = *dstp; - *dst++ = v; - *dstp = dst; + uae_u8 *dst = *dstp; + *dst++ = v; + *dstp = dst; } - -void save_string_func(uae_u8** dstp, const TCHAR* from) +void save_string_func (uae_u8 **dstp, const TCHAR *from) { - uae_u8* dst = *dstp; + uae_u8 *dst = *dstp; char *s, *s2; - s2 = s = uutf8(from); + s2 = s = uutf8 (from); while (s && *s) *dst++ = *s++; - *dst++ = 0; - *dstp = dst; + *dst++ = 0; + *dstp = dst; xfree (s2); } - -void save_path_func(uae_u8** dstp, const TCHAR* from, int type) +void save_path_func (uae_u8 **dstp, const TCHAR *from, int type) { - save_string_func(dstp, from); + save_string_func (dstp, from); } -uae_u32 restore_u32_func(uae_u8** dstp) +uae_u32 restore_u32_func (uae_u8 **dstp) { - uae_u32 v; - uae_u8* dst = *dstp; - v = (dst[0] << 24) | (dst[1] << 16) | (dst[2] << 8) | (dst[3]); - *dstp = dst + 4; - return v; + uae_u32 v; + uae_u8 *dst = *dstp; + v = (dst[0] << 24) | (dst[1] << 16) | (dst[2] << 8) | (dst[3]); + *dstp = dst + 4; + return v; } - -uae_u64 restore_u64_func(uae_u8** dstp) +uae_u64 restore_u64_func (uae_u8 **dstp) { - uae_u64 v; - - v = restore_u32_func(dstp); - v <<= 32; - v |= restore_u32_func(dstp); - return v; + uae_u64 v; + + v = restore_u32_func (dstp); + v <<= 32; + v |= restore_u32_func (dstp); + return v; } - -uae_u16 restore_u16_func(uae_u8** dstp) +uae_u16 restore_u16_func (uae_u8 **dstp) { - uae_u16 v; - uae_u8* dst = *dstp; - v = (dst[0] << 8) | (dst[1]); - *dstp = dst + 2; - return v; + uae_u16 v; + uae_u8 *dst = *dstp; + v=(dst[0] << 8) | (dst[1]); + *dstp = dst + 2; + return v; } - -uae_u8 restore_u8_func(uae_u8** dstp) +uae_u8 restore_u8_func (uae_u8 **dstp) { - uae_u8 v; - uae_u8* dst = *dstp; - v = dst[0]; - *dstp = dst + 1; - return v; + uae_u8 v; + uae_u8 *dst = *dstp; + v = dst[0]; + *dstp = dst + 1; + return v; } - -TCHAR* restore_string_func(uae_u8** dstp) +TCHAR *restore_string_func (uae_u8 **dstp) { - int len; - uae_u8 v; - uae_u8* dst = *dstp; - char *top, *to; - TCHAR* s; - len = strlen(reinterpret_cast(dst)) + 1; - top = to = xmalloc (char, len); - do - { - v = *dst++; - *top++ = v; - } - while (v); - *dstp = dst; - s = utf8u(to); + int len; + uae_u8 v; + uae_u8 *dst = *dstp; + char *top, *to; + TCHAR *s; + + len = strlen((char *)dst) + 1; + top = to = xmalloc (char, len); + do { + v = *dst++; + *top++ = v; + } while(v); + *dstp = dst; + s = utf8u (to); xfree (to); return s; } - -TCHAR* restore_path_func(uae_u8** dstp, int type) +TCHAR *restore_path_func (uae_u8 **dstp, int type) { TCHAR *newpath; TCHAR *s; - TCHAR *out = NULL; - TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH]; + TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH]; s = restore_string_func(dstp); if (s[0] == 0) return s; - if (zfile_exists(s)) + if (zfile_exists (s)) return s; if (type == SAVESTATE_PATH_HD) return s; - getfilepart(tmp, sizeof tmp / sizeof(TCHAR), s); - if (zfile_exists(tmp)) { - xfree(s); - return my_strdup(tmp); + getfilepart (tmp, sizeof tmp / sizeof (TCHAR), s); + if (zfile_exists (tmp)) { + xfree (s); + return my_strdup (tmp); } - for (int i = 0; i < MAX_PATHS; i++) { - newpath = NULL; - if (type == SAVESTATE_PATH_FLOPPY) - newpath = currprefs.path_floppy.path[i]; - else if (type == SAVESTATE_PATH_VDIR || type == SAVESTATE_PATH_HDF) - newpath = currprefs.path_hardfile.path[i]; - else if (type == SAVESTATE_PATH_CD) - newpath = currprefs.path_cd.path[i]; - if (newpath == NULL || newpath[0] == 0) - break; - _tcscpy(tmp2, newpath); - fixtrailing(tmp2); - _tcscat(tmp2, tmp); - if (zfile_exists(tmp2)) { - xfree(s); - return my_strdup(tmp2); + newpath = NULL; + if (type == SAVESTATE_PATH_FLOPPY) + newpath = currprefs.path_floppy; + else if (type == SAVESTATE_PATH_VDIR || type == SAVESTATE_PATH_HDF) + newpath = currprefs.path_hardfile; + else if (type == SAVESTATE_PATH_CD) + newpath = currprefs.path_cd; + if (newpath != NULL && newpath[0] != 0) { + _tcscpy (tmp2, newpath); + fixtrailing (tmp2); + _tcscat (tmp2, tmp); + if (zfile_exists (tmp2)) { + xfree (s); + return my_strdup (tmp2); } - } - getpathpart(tmp2, sizeof tmp2 / sizeof (TCHAR), savestate_fname); + } + getpathpart (tmp2, sizeof tmp2 / sizeof (TCHAR), savestate_fname); _tcscat (tmp2, tmp); - if (zfile_exists(tmp2)) - { + if (zfile_exists (tmp2)) { xfree (s); - return my_strdup(tmp2); + return my_strdup (tmp2); } return s; } /* read and write IFF-style hunks */ -static void save_chunk(struct zfile* f, uae_u8* chunk, size_t len, const char* name, int compress) +static void save_chunk (struct zfile *f, uae_u8 *chunk, unsigned int len, const TCHAR *name, int compress) { - uae_u8 tmp[8], *dst; - uae_u8 zero[4] = {0, 0, 0, 0}; - uae_u32 flags; - size_t pos; - size_t chunklen, len2; - char* s; + uae_u8 tmp[8], *dst; + uae_u8 zero[4]= { 0, 0, 0, 0 }; + uae_u32 flags; + unsigned int pos; + unsigned int chunklen, len2; + char *s; - if (!chunk) - return; + if (!chunk) + return; - if (compress < 0) - { - zfile_fwrite(chunk, 1, len, f); - return; - } - /* chunk name */ - s = ua(name); - zfile_fwrite(s, 1, 4, f); + if (compress < 0) { + zfile_fwrite (chunk, 1, len, f); + return; + } + + /* chunk name */ + s = ua (name); + zfile_fwrite (s, 1, 4, f); xfree (s); - pos = zfile_ftell(f); - /* chunk size */ - dst = &tmp[0]; - chunklen = len + 4 + 4 + 4; - save_u32 (chunklen); - zfile_fwrite(&tmp[0], 1, 4, f); - /* chunk flags */ - flags = 0; - dst = &tmp[0]; - save_u32 (flags | compress); - zfile_fwrite(&tmp[0], 1, 4, f); - /* chunk data */ - if (compress) - { - int tmplen = len; - size_t opos; - dst = &tmp[0]; - save_u32 (len); - opos = zfile_ftell(f); - zfile_fwrite(&tmp[0], 1, 4, f); - len = zfile_zcompress(f, chunk, len); - if (len > 0) - { - zfile_fseek(f, pos, SEEK_SET); - dst = &tmp[0]; - save_u32 (len + 4 + 4 + 4 + 4); - zfile_fwrite(&tmp[0], 1, 4, f); - zfile_fseek(f, 0, SEEK_END); - } - else - { - len = tmplen; - compress = 0; - zfile_fseek(f, opos, SEEK_SET); - dst = &tmp[0]; - save_u32 (flags); - zfile_fwrite(&tmp[0], 1, 4, f); - } - } - if (!compress) - zfile_fwrite(chunk, 1, len, f); - /* alignment */ - len2 = 4 - (len & 3); - if (len2) - zfile_fwrite(zero, 1, len2, f); + pos = zfile_ftell (f); + /* chunk size */ + dst = &tmp[0]; + chunklen = len + 4 + 4 + 4; + save_u32 (chunklen); + zfile_fwrite (&tmp[0], 1, 4, f); + /* chunk flags */ + flags = 0; + dst = &tmp[0]; + save_u32 (flags | compress); + zfile_fwrite (&tmp[0], 1, 4, f); + /* chunk data */ + if (compress) { + int tmplen = len; + size_t opos; + dst = &tmp[0]; + save_u32 (len); + opos = zfile_ftell (f); + zfile_fwrite (&tmp[0], 1, 4, f); + len = zfile_zcompress (f, chunk, len); + if (len > 0) { + zfile_fseek (f, pos, SEEK_SET); + dst = &tmp[0]; + save_u32 (len + 4 + 4 + 4 + 4); + zfile_fwrite (&tmp[0], 1, 4, f); + zfile_fseek (f, 0, SEEK_END); + } else { + len = tmplen; + compress = 0; + zfile_fseek (f, opos, SEEK_SET); + dst = &tmp[0]; + save_u32 (flags); + zfile_fwrite (&tmp[0], 1, 4, f); + } + } + if (!compress) + zfile_fwrite (chunk, 1, len, f); + /* alignment */ + len2 = 4 - (len & 3); + if (len2) + zfile_fwrite (zero, 1, len2, f); - write_log (_T("Chunk '%s' chunk size %d (%d)\n"), name, chunklen, len); + write_log (_T("Chunk '%s' chunk size %u (%u)\n"), name, chunklen, len); } -static uae_u8* restore_chunk(struct zfile* f, TCHAR* name, size_t* len, size_t* totallen, size_t* filepos) +static uae_u8 *restore_chunk (struct zfile *f, TCHAR *name, unsigned int *len, unsigned int *totallen, size_t *filepos) { - uae_u8 tmp[6], dummy[4], *mem, *src; - uae_u32 flags; - int len2; + uae_u8 tmp[6], dummy[4], *mem, *src; + uae_u32 flags; + int len2; - *totallen = 0; - /* chunk name */ - zfile_fread(tmp, 1, 4, f); + *totallen = 0; + /* chunk name */ + zfile_fread (tmp, 1, 4, f); tmp[4] = 0; - au_copy(name, 5, reinterpret_cast(tmp)); - /* chunk size */ - zfile_fread(tmp, 1, 4, f); - src = tmp; - len2 = restore_u32 () - 4 - 4 - 4; - if (len2 < 0) - len2 = 0; - *len = len2; - if (len2 == 0) - { - *filepos = zfile_ftell(f); - return 0; - } + au_copy (name, 5, (char*)tmp); + /* chunk size */ + zfile_fread (tmp, 1, 4, f); + src = tmp; + len2 = restore_u32 () - 4 - 4 - 4; + if (len2 < 0) + len2 = 0; + *len = len2; + if (len2 == 0) { + *filepos = zfile_ftell (f); + return 0; + } - /* chunk flags */ - zfile_fread(tmp, 1, 4, f); - src = tmp; - flags = restore_u32 (); - *totallen = *len; - if (flags & 1) - { - zfile_fread(tmp, 1, 4, f); - src = tmp; - *totallen = restore_u32(); - *filepos = zfile_ftell(f) - 4 - 4 - 4; - len2 -= 4; - } - else - { - *filepos = zfile_ftell(f) - 4 - 4; - } - /* chunk data. RAM contents will be loaded during the reset phase, - no need to malloc multiple megabytes here. */ - if (_tcscmp (name, _T("CRAM")) != 0 - && _tcscmp (name, _T("BRAM")) != 0 - && _tcscmp (name, _T("FRAM")) != 0 - && _tcscmp (name, _T("ZRAM")) != 0 - && _tcscmp (name, _T("ZCRM")) != 0 - && _tcscmp (name, _T("PRAM")) != 0 - && _tcscmp (name, _T("A3K1")) != 0 + /* chunk flags */ + zfile_fread (tmp, 1, 4, f); + src = tmp; + flags = restore_u32 (); + *totallen = *len; + if (flags & 1) { + zfile_fread (tmp, 1, 4, f); + src = tmp; + *totallen = restore_u32(); + *filepos = zfile_ftell (f) - 4 - 4 - 4; + len2 -= 4; + } else { + *filepos = zfile_ftell (f) - 4 - 4; + } + /* chunk data. RAM contents will be loaded during the reset phase, + no need to malloc multiple megabytes here. */ + if (_tcscmp (name, _T("CRAM")) != 0 + && _tcscmp (name, _T("BRAM")) != 0 + && _tcscmp (name, _T("FRAM")) != 0 + && _tcscmp (name, _T("ZRAM")) != 0 + && _tcscmp (name, _T("PRAM")) != 0 + && _tcscmp (name, _T("A3K1")) != 0 && _tcscmp (name, _T("A3K2")) != 0 && _tcscmp (name, _T("BORO")) != 0 ) - { - /* extra bytes at the end needed to handle old statefiles that now have new fields */ - mem = xcalloc (uae_u8, *totallen + 100); - if (!mem) - return nullptr; - if (flags & 1) - { - zfile_zuncompress(mem, *totallen, f, len2); - } - else - { - zfile_fread(mem, 1, len2, f); - } - } - else - { - mem = nullptr; - zfile_fseek(f, len2, SEEK_CUR); - } + { + /* extra bytes at the end needed to handle old statefiles that now have new fields */ + mem = xcalloc (uae_u8, *totallen + 100); + if (!mem) + return NULL; + if (flags & 1) { + zfile_zuncompress (mem, *totallen, f, len2); + } else { + zfile_fread (mem, 1, len2, f); + } + } else { + mem = 0; + zfile_fseek (f, len2, SEEK_CUR); + } - /* alignment */ - len2 = 4 - (len2 & 3); - if (len2) - zfile_fread(dummy, 1, len2, f); - return mem; + /* alignment */ + len2 = 4 - (len2 & 3); + if (len2) + zfile_fread (dummy, 1, len2, f); + return mem; } -void restore_ram(size_t filepos, uae_u8* memory) +void restore_ram (size_t filepos, uae_u8 *memory) { - uae_u8 tmp[8]; - uae_u8* src = tmp; - int size, fullsize; - uae_u32 flags; - - if (filepos == 0 || memory == nullptr) - return; - zfile_fseek(savestate_file, filepos, SEEK_SET); - zfile_fread(tmp, 1, sizeof tmp, savestate_file); - size = restore_u32(); - flags = restore_u32(); - size -= 4 + 4 + 4; - if (flags & 1) - { - zfile_fread(tmp, 1, 4, savestate_file); - src = tmp; - fullsize = restore_u32(); - size -= 4; - zfile_zuncompress(memory, fullsize, savestate_file, size); - } - else - { - zfile_fread(memory, 1, size, savestate_file); - } + uae_u8 tmp[8]; + uae_u8 *src = tmp; + int size, fullsize; + uae_u32 flags; + + if (filepos == 0 || memory == NULL) + return; + zfile_fseek (savestate_file, filepos, SEEK_SET); + zfile_fread (tmp, 1, sizeof tmp, savestate_file); + size = restore_u32(); + flags = restore_u32(); + size -= 4 + 4 + 4; + if (flags & 1) { + zfile_fread (tmp, 1, 4, savestate_file); + src = tmp; + fullsize = restore_u32(); + size -= 4; + zfile_zuncompress (memory, fullsize, savestate_file, size); + } else { + zfile_fread (memory, 1, size, savestate_file); + } } -static void restore_header(uae_u8* src) +static void restore_header (uae_u8 *src) { - TCHAR *emuname, *emuversion, *description; + TCHAR *emuname, *emuversion, *description; - restore_u32(); - emuname = restore_string (); - emuversion = restore_string (); - description = restore_string (); + restore_u32(); + emuname = restore_string (); + emuversion = restore_string (); + description = restore_string (); write_log (_T("Saved with: '%s %s', description: '%s'\n"), - emuname,emuversion,description); - xfree (description); - xfree (emuversion); - xfree (emuname); + emuname,emuversion,description); + xfree (description); + xfree (emuversion); + xfree (emuname); } /* restore all subsystems */ -void restore_state(const TCHAR* filename) +void restore_state (const TCHAR *filename) { - struct zfile* f; - uae_u8 *chunk, *end; - TCHAR name[5]; - size_t len, totallen; - size_t filepos, filesize; + struct zfile *f; + uae_u8 *chunk,*end; + TCHAR name[5]; + unsigned int len, totallen; + size_t filepos, filesize; int z3num, z2num; - chunk = 0; - f = zfile_fopen(filename, _T("rb"), ZFD_NORMAL); - if (!f) - goto error; - zfile_fseek(f, 0, SEEK_END); - filesize = zfile_ftell(f); - zfile_fseek(f, 0, SEEK_SET); - savestate_state = STATE_RESTORE; + chunk = 0; + f = zfile_fopen (filename, _T("rb"), ZFD_NORMAL); + if (!f) + goto error; + zfile_fseek (f, 0, SEEK_END); + filesize = zfile_ftell (f); + zfile_fseek (f, 0, SEEK_SET); + savestate_state = STATE_RESTORE; - chunk = restore_chunk(f, name, &len, &totallen, &filepos); - if (!chunk || _tcsncmp (name, _T("ASF "), 4)) - { + chunk = restore_chunk (f, name, &len, &totallen, &filepos); + if (!chunk || _tcsncmp (name, _T("ASF "), 4)) { write_log (_T("%s is not an AmigaStateFile\n"), filename); - goto error; - } + goto error; + } write_log (_T("STATERESTORE: '%s'\n"), filename); - savestate_file = f; - restore_header(chunk); - xfree (chunk); - restore_cia_start(); - changed_prefs.bogomem_size = 0; - changed_prefs.chipmem_size = 0; - changed_prefs.fastmem[0].size = 0; - changed_prefs.z3fastmem[0].size = 0; + set_config_changed (); + savestate_file = f; + restore_header (chunk); + xfree (chunk); + devices_restore_start(); z2num = z3num = 0; - for (;;) - { - name[0] = 0; - chunk = end = restore_chunk(f, name, &len, &totallen, &filepos); - write_log (_T("Chunk '%s' size %d (%d)\n"), name, len, totallen); - if (!_tcscmp (name, _T("END "))) - { - break; - } - if (!_tcscmp (name, _T("CRAM"))) - { - restore_cram(totallen, filepos); + for (;;) { + name[0] = 0; + chunk = end = restore_chunk (f, name, &len, &totallen, &filepos); + write_log (_T("Chunk '%s' size %u (%u)\n"), name, len, totallen); + if (!_tcscmp (name, _T("END "))) { + break; + } + if (!_tcscmp (name, _T("CRAM"))) { + restore_cram (totallen, filepos); + continue; + } else if (!_tcscmp (name, _T("BRAM"))) { + restore_bram (totallen, filepos); + continue; + } else if (!_tcscmp (name, _T("A3K1"))) { + restore_a3000lram (totallen, filepos); continue; - } - else if (!_tcscmp (name, _T("BRAM"))) - { - restore_bram(totallen, filepos); + } else if (!_tcscmp (name, _T("A3K2"))) { + restore_a3000hram (totallen, filepos); continue; #ifdef AUTOCONFIG - } - else if (!_tcscmp (name, _T("FRAM"))) - { - restore_fram(totallen, filepos, z2num++); - continue; - } - else if (!_tcscmp (name, _T("ZRAM"))) - { - restore_zram(totallen, filepos, z3num++); - continue; - } - else if (!_tcscmp (name, _T("BORO"))) - { - restore_bootrom(totallen, filepos); - continue; + } else if (!_tcscmp (name, _T("FRAM"))) { + restore_fram (totallen, filepos, z2num++); + continue; + } else if (!_tcscmp (name, _T("ZRAM"))) { + restore_zram (totallen, filepos, z3num++); + continue; + } else if (!_tcscmp (name, _T("BORO"))) { + restore_bootrom (totallen, filepos); + continue; #endif #ifdef PICASSO96 - } - else if (!_tcscmp (name, _T("PRAM"))) - { - restore_pram(totallen, filepos); - continue; + } else if (!_tcscmp (name, _T("PRAM"))) { + restore_pram (totallen, filepos); + continue; #endif - } - else if (!_tcscmp (name, _T("CPU "))) - { - end = restore_cpu(chunk); - } - else if (!_tcscmp (name, _T("CPUX"))) - end = restore_cpu_extra(chunk); + } else if (!_tcscmp (name, _T("CPU "))) { + end = restore_cpu (chunk); + } else if (!_tcscmp (name, _T("CPUX"))) + end = restore_cpu_extra (chunk); #ifdef FPUEMU - else if (!_tcscmp (name, _T("FPU "))) - end = restore_fpu(chunk); + else if (!_tcscmp (name, _T("FPU "))) + end = restore_fpu (chunk); #endif - else if (!_tcscmp (name, _T("AGAC"))) - end = restore_custom_agacolors(chunk); + else if (!_tcscmp (name, _T("AGAC"))) + end = restore_custom_agacolors (chunk); else if (!_tcscmp (name, _T("SPR0"))) - end = restore_custom_sprite(0, chunk); + end = restore_custom_sprite (0, chunk); else if (!_tcscmp (name, _T("SPR1"))) - end = restore_custom_sprite(1, chunk); + end = restore_custom_sprite (1, chunk); else if (!_tcscmp (name, _T("SPR2"))) - end = restore_custom_sprite(2, chunk); + end = restore_custom_sprite (2, chunk); else if (!_tcscmp (name, _T("SPR3"))) - end = restore_custom_sprite(3, chunk); + end = restore_custom_sprite (3, chunk); else if (!_tcscmp (name, _T("SPR4"))) - end = restore_custom_sprite(4, chunk); + end = restore_custom_sprite (4, chunk); else if (!_tcscmp (name, _T("SPR5"))) - end = restore_custom_sprite(5, chunk); + end = restore_custom_sprite (5, chunk); else if (!_tcscmp (name, _T("SPR6"))) - end = restore_custom_sprite(6, chunk); + end = restore_custom_sprite (6, chunk); else if (!_tcscmp (name, _T("SPR7"))) - end = restore_custom_sprite(7, chunk); + end = restore_custom_sprite (7, chunk); else if (!_tcscmp (name, _T("CIAA"))) - end = restore_cia(0, chunk); + end = restore_cia (0, chunk); else if (!_tcscmp (name, _T("CIAB"))) - end = restore_cia(1, chunk); + end = restore_cia (1, chunk); else if (!_tcscmp (name, _T("CHIP"))) - end = restore_custom(chunk); + end = restore_custom (chunk); else if (!_tcscmp (name, _T("CINP"))) - end = restore_input(chunk); + end = restore_input (chunk); else if (!_tcscmp (name, _T("CHPX"))) - end = restore_custom_extra(chunk); - else if (!_tcscmp (name, _T("AUD0"))) - end = restore_audio(0, chunk); + end = restore_custom_extra (chunk); + else if (!_tcscmp (name, _T("AUD0"))) + end = restore_audio (0, chunk); else if (!_tcscmp (name, _T("AUD1"))) - end = restore_audio(1, chunk); + end = restore_audio (1, chunk); else if (!_tcscmp (name, _T("AUD2"))) - end = restore_audio(2, chunk); + end = restore_audio (2, chunk); else if (!_tcscmp (name, _T("AUD3"))) - end = restore_audio(3, chunk); + end = restore_audio (3, chunk); else if (!_tcscmp (name, _T("BLIT"))) - end = restore_blitter(chunk); + end = restore_blitter (chunk); else if (!_tcscmp (name, _T("BLTX"))) - end = restore_blitter_new(chunk); + end = restore_blitter_new (chunk); else if (!_tcscmp (name, _T("DISK"))) - end = restore_floppy(chunk); + end = restore_floppy (chunk); else if (!_tcscmp (name, _T("DSK0"))) - end = restore_disk(0, chunk); + end = restore_disk (0, chunk); else if (!_tcscmp (name, _T("DSK1"))) - end = restore_disk(1, chunk); + end = restore_disk (1, chunk); else if (!_tcscmp (name, _T("DSK2"))) - end = restore_disk(2, chunk); + end = restore_disk (2, chunk); else if (!_tcscmp (name, _T("DSK3"))) - end = restore_disk(3, chunk); + end = restore_disk (3, chunk); else if (!_tcscmp (name, _T("DSD0"))) - end = restore_disk2(0, chunk); + end = restore_disk2 (0, chunk); else if (!_tcscmp (name, _T("DSD1"))) - end = restore_disk2(1, chunk); + end = restore_disk2 (1, chunk); else if (!_tcscmp (name, _T("DSD2"))) - end = restore_disk2(2, chunk); + end = restore_disk2 (2, chunk); else if (!_tcscmp (name, _T("DSD3"))) - end = restore_disk2(3, chunk); + end = restore_disk2 (3, chunk); else if (!_tcscmp (name, _T("KEYB"))) - end = restore_keyboard(chunk); + end = restore_keyboard (chunk); #ifdef AUTOCONFIG else if (!_tcscmp (name, _T("EXPA"))) - end = restore_expansion(chunk); + end = restore_expansion (chunk); #endif else if (!_tcscmp (name, _T("ROM "))) - end = restore_rom(chunk); + end = restore_rom (chunk); #ifdef PICASSO96 else if (!_tcscmp (name, _T("P96 "))) - end = restore_p96(chunk); + end = restore_p96 (chunk); +#endif +#ifdef ACTION_REPLAY + else if (!_tcscmp (name, _T("ACTR"))) + end = restore_action_replay (chunk); + else if (!_tcscmp (name, _T("HRTM"))) + end = restore_hrtmon (chunk); #endif #ifdef FILESYS else if (!_tcscmp (name, _T("FSYS"))) - end = restore_filesys(chunk); + end = restore_filesys (chunk); else if (!_tcscmp (name, _T("FSYC"))) - end = restore_filesys_common(chunk); + end = restore_filesys_common (chunk); #endif #ifdef CD32 else if (!_tcscmp (name, _T("CD32"))) - end = restore_akiko(chunk); + end = restore_akiko (chunk); #endif - + else if (!_tcscmp (name, _T("GAYL"))) + end = restore_gayle (chunk); + else if (!_tcscmp (name, _T("IDE "))) + end = restore_gayle_ide (chunk); else if (!_tcsncmp (name, _T("CDU"), 3)) - end = restore_cd(name[3] - '0', chunk); - else - { - end = chunk + len; + end = restore_cd (name[3] - '0', chunk); + else if (!_tcsncmp (name, _T("EXPI"), 4)) + end = restore_expansion_info(chunk); + + else { + end = chunk + len; write_log (_T("unknown chunk '%s' size %d bytes\n"), name, len); - } - if (end == nullptr) - write_log (_T("Chunk '%s', size %d bytes was not accepted!\n"), - name, len); - else if (totallen != end - chunk) - write_log (_T("Chunk '%s' total size %d bytes but read %d bytes!\n"), - name, totallen, end - chunk); - xfree (chunk); - } - return; + } + if (end == NULL) + write_log (_T("Chunk '%s', size %d bytes was not accepted!\n"), + name, len); + else if (totallen != end - chunk) + write_log (_T("Chunk '%s' total size %d bytes but read %ld bytes!\n"), + name, totallen, end - chunk); + xfree (chunk); + } + target_addtorecent (filename, 0); + return; error: - savestate_state = 0; - savestate_file = nullptr; - if (chunk) - xfree (chunk); - if (f) - zfile_fclose(f); + savestate_state = 0; + savestate_file = 0; + if (chunk) + xfree (chunk); + if (f) + zfile_fclose (f); } -void savestate_restore_finish() +void savestate_restore_finish (void) { - if (!isrestore()) - return; - zfile_fclose(savestate_file); - savestate_file = 0; - restore_cpu_finish(); - restore_audio_finish(); - restore_disk_finish(); - restore_akiko_finish(); + if (!isrestore ()) + return; + zfile_fclose (savestate_file); + savestate_file = 0; + restore_cpu_finish(); + restore_audio_finish (); + restore_disk_finish (); + restore_akiko_finish (); #ifdef PICASSO96 - restore_p96_finish(); + restore_p96_finish (); #endif - restore_cia_finish(); + restore_cia_finish (); savestate_state = 0; init_hz_normal(); - audio_activate(); + audio_activate (); } /* 1=compressed,2=not compressed,3=ram dump,4=audio dump */ -void savestate_initsave(const TCHAR* filename, int mode, int nodialogs, bool save) +void savestate_initsave (const TCHAR *filename, int mode, int nodialogs, bool save) { - if (filename == nullptr) - { - savestate_fname[0] = 0; - savestate_docompress = 0; - savestate_specialdump = 0; - savestate_nodialogs = 0; - return; - } - _tcscpy (savestate_fname, filename); - savestate_docompress = (mode == 1) ? 1 : 0; - savestate_specialdump = (mode == 3) ? 1 : (mode == 4) ? 2 : 0; - savestate_nodialogs = nodialogs; + if (filename == NULL) { + savestate_fname[0] = 0; + savestate_docompress = 0; + savestate_nodialogs = 0; + return; + } + _tcscpy (savestate_fname, filename); + savestate_docompress = (mode == 1) ? 1 : 0; + savestate_nodialogs = nodialogs; new_blitter = false; } -static void save_rams(struct zfile* f, int comp) +static void save_rams (struct zfile *f, int comp) { - uae_u8* dst; - int len; + uae_u8 *dst; + int len; - dst = save_cram(&len); - save_chunk(f, dst, len, _T("CRAM"), comp); - dst = save_bram(&len); - save_chunk(f, dst, len, _T("BRAM"), comp); + dst = save_cram (&len); + save_chunk (f, dst, len, _T("CRAM"), comp); + dst = save_bram (&len); + save_chunk (f, dst, len, _T("BRAM"), comp); + dst = save_a3000lram (&len); + save_chunk (f, dst, len, _T("A3K1"), comp); + dst = save_a3000hram (&len); + save_chunk (f, dst, len, _T("A3K2"), comp); #ifdef AUTOCONFIG for (int i = 0; i < MAX_RAM_BOARDS; i++) { - dst = save_fram(&len, i); - save_chunk(f, dst, len, _T("FRAM"), comp); + dst = save_fram (&len, i); + save_chunk (f, dst, len, _T("FRAM"), comp); } for (int i = 0; i < MAX_RAM_BOARDS; i++) { - dst = save_zram(&len, i); - save_chunk(f, dst, len, _T("ZRAM"), comp); + dst = save_zram (&len, i); + save_chunk (f, dst, len, _T("ZRAM"), comp); } - dst = save_zram(&len, -1); - save_chunk(f, dst, len, _T("ZRAM"), comp); - dst = save_bootrom(&len); - save_chunk(f, dst, len, _T("BORO"), comp); + dst = save_bootrom (&len); + save_chunk (f, dst, len, _T("BORO"), comp); #endif #ifdef PICASSO96 - dst = save_pram(&len); - save_chunk(f, dst, len, _T("PRAM"), comp); + dst = save_pram (&len); + save_chunk (f, dst, len, _T("PRAM"), comp); #endif } /* Save all subsystems */ -static int save_state_internal(struct zfile* f, const TCHAR* description, int comp, bool savepath) +static int save_state_internal (struct zfile *f, const TCHAR *description, int comp, bool savepath) { - uae_u8 endhunk[] = {'E', 'N', 'D', ' ', 0, 0, 0, 8}; - uae_u8 header[1000]; - TCHAR tmp[100]; - uae_u8* dst; - TCHAR name[5]; + uae_u8 endhunk[] = { 'E', 'N', 'D', ' ', 0, 0, 0, 8 }; + uae_u8 header[1000]; + TCHAR tmp[100]; + uae_u8 *dst; + TCHAR name[5]; int i, len; write_log (_T("STATESAVE (%s):\n"), f ? zfile_getname (f) : _T("")); - dst = header; - save_u32 (0); - save_string(_T("UAE")); - _stprintf(tmp, _T("%d.%d.%d"), UAEMAJOR, UAEMINOR, UAESUBREV); - save_string (tmp); - save_string (description); - save_chunk(f, header, dst - header, _T("ASF "), 0); + dst = header; + save_u32 (0); + save_string(_T("UAE")); + _stprintf (tmp, _T("%d.%d.%d"), UAEMAJOR, UAEMINOR, UAESUBREV); + save_string (tmp); + save_string (description); + save_chunk (f, header, dst-header, _T("ASF "), 0); - dst = save_cpu(&len, 0); - save_chunk(f, dst, len, _T("CPU "), 0); - xfree (dst); + dst = save_cpu (&len, 0); + save_chunk (f, dst, len, _T("CPU "), 0); + xfree (dst); - dst = save_cpu_extra(&len, 0); - save_chunk(f, dst, len, _T("CPUX"), 0); - xfree (dst); + dst = save_cpu_extra (&len, 0); + save_chunk (f, dst, len, _T("CPUX"), 0); + xfree (dst); #ifdef FPUEMU - dst = save_fpu(&len, 0); - save_chunk(f, dst, len, _T("FPU "), 0); - xfree (dst); + dst = save_fpu (&len, 0); + save_chunk (f, dst, len, _T("FPU "), 0); + xfree (dst); #endif - _tcscpy(name, _T("DSKx")); - for (i = 0; i < 4; i++) - { - dst = save_disk(i, &len, 0, savepath); - if (dst) - { - name[3] = i + '0'; - save_chunk(f, dst, len, name, 0); - xfree (dst); - } - } + _tcscpy(name, _T("DSKx")); + for (i = 0; i < 4; i++) { + dst = save_disk (i, &len, 0, savepath); + if (dst) { + name[3] = i + '0'; + save_chunk (f, dst, len, name, 0); + xfree (dst); + } + } _tcscpy(name, _T("DSDx")); - for (i = 0; i < 4; i++) - { - dst = save_disk2(i, &len, 0); - if (dst) - { + for (i = 0; i < 4; i++) { + dst = save_disk2 (i, &len, 0); + if (dst) { name[3] = i + '0'; - save_chunk(f, dst, len, name, comp); + save_chunk (f, dst, len, name, comp); xfree (dst); } } - dst = save_floppy(&len, 0); - save_chunk(f, dst, len, _T("DISK"), 0); + dst = save_floppy (&len, 0); + save_chunk (f, dst, len, _T("DISK"), 0); + xfree (dst); + + dst = save_custom (&len, 0, 0); + save_chunk (f, dst, len, _T("CHIP"), 0); + xfree (dst); + + dst = save_custom_extra (&len, 0); + save_chunk (f, dst, len, _T("CHPX"), 0); xfree (dst); - dst = save_custom(&len, 0, 0); - save_chunk(f, dst, len, _T("CHIP"), 0); + dst = save_blitter_new (&len, 0); + save_chunk (f, dst, len, _T("BLTX"), 0); + xfree (dst); + if (new_blitter == false) { + dst = save_blitter (&len, 0); + save_chunk (f, dst, len, _T("BLIT"), 0); + xfree (dst); + } + + dst = save_input (&len, 0); + save_chunk (f, dst, len, _T("CINP"), 0); xfree (dst); - dst = save_custom_extra(&len, 0); - save_chunk(f, dst, len, _T("CHPX"), 0); - xfree (dst); - - dst = save_blitter_new(&len, 0); - save_chunk(f, dst, len, _T("BLTX"), 0); - xfree (dst); - if (new_blitter == false) - { - dst = save_blitter(&len, 0); - save_chunk(f, dst, len, _T("BLIT"), 0); - xfree (dst); - } - - dst = save_input(&len, 0); - save_chunk(f, dst, len, _T("CINP"), 0); - xfree (dst); - - dst = save_custom_agacolors(&len, 0); - save_chunk(f, dst, len, _T("AGAC"), 0); - xfree (dst); + dst = save_custom_agacolors (&len, 0); + save_chunk (f, dst, len, _T("AGAC"), 0); + xfree (dst); _tcscpy (name, _T("SPRx")); - for (i = 0; i < 8; i++) - { - dst = save_custom_sprite(i, &len, 0); - name[3] = i + '0'; - save_chunk(f, dst, len, name, 0); - xfree (dst); - } + for (i = 0; i < 8; i++) { + dst = save_custom_sprite (i, &len, 0); + name[3] = i + '0'; + save_chunk (f, dst, len, name, 0); + xfree (dst); + } _tcscpy (name, _T("AUDx")); - for (i = 0; i < 4; i++) - { - dst = save_audio(i, &len, 0); - name[3] = i + '0'; - save_chunk(f, dst, len, name, 0); - xfree (dst); - } + for (i = 0; i < 4; i++) { + dst = save_audio (i, &len, 0); + name[3] = i + '0'; + save_chunk (f, dst, len, name, 0); + xfree (dst); + } - dst = save_cia(0, &len, 0); - save_chunk(f, dst, len, _T("CIAA"), 0); - xfree (dst); + dst = save_cia (0, &len, 0); + save_chunk (f, dst, len, _T("CIAA"), 0); + xfree (dst); - dst = save_cia(1, &len, 0); - save_chunk(f, dst, len, _T("CIAB"), 0); - xfree (dst); + dst = save_cia (1, &len, 0); + save_chunk (f, dst, len, _T("CIAB"), 0); + xfree (dst); - dst = save_keyboard(&len, nullptr); - save_chunk(f, dst, len, _T("KEYB"), 0); - xfree (dst); + dst = save_keyboard (&len, NULL); + save_chunk (f, dst, len, _T("KEYB"), 0); + xfree (dst); #ifdef AUTOCONFIG - dst = save_expansion(&len, 0); - save_chunk(f, dst, len, _T("EXPA"), 0); - xfree (dst); + dst = save_expansion_info(&len, 0); + save_chunk(f, dst, len, _T("EXPI"), 0); + dst = save_expansion (&len, 0); + save_chunk (f, dst, len, _T("EXPA"), 0); + xfree (dst); #endif #ifdef PICASSO96 - dst = save_p96(&len, 0); - save_chunk(f, dst, len, _T("P96 "), 0); + dst = save_p96 (&len, 0); + save_chunk (f, dst, len, _T("P96 "), 0); #endif - save_rams(f, comp); + save_rams (f, comp); - dst = save_rom(1, &len, 0); - do - { - if (!dst) - break; - save_chunk(f, dst, len, _T("ROM "), 0); - xfree (dst); - } - while ((dst = save_rom(0, &len, 0))); + dst = save_rom (1, &len, 0); + do { + if (!dst) + break; + save_chunk (f, dst, len, _T("ROM "), 0); + xfree (dst); + } while ((dst = save_rom (0, &len, 0))); #ifdef CD32 - dst = save_akiko(&len, nullptr); - save_chunk(f, dst, len, _T("CD32"), 0); + dst = save_akiko (&len, NULL); + save_chunk (f, dst, len, _T("CD32"), 0); xfree (dst); #endif - -#ifdef FILESYS - dst = save_filesys_common(&len); - if (dst) - { - save_chunk(f, dst, len, _T("FSYC"), 0); - for (i = 0; i < nr_units(); i++) - { - dst = save_filesys(i, &len); - if (dst) - { - save_chunk(f, dst, len, _T("FSYS"), 0); - xfree (dst); - } - } - } +#ifdef ACTION_REPLAY + dst = save_action_replay (&len, NULL); + save_chunk (f, dst, len, _T("ACTR"), comp); + dst = save_hrtmon (&len, NULL); + save_chunk (f, dst, len, _T("HRTM"), comp); #endif - - for (i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) - { - dst = save_cd(i, &len); - if (dst) - { - _stprintf(name, _T("CDU%d"), i); - save_chunk(f, dst, len, name, 0); +#ifdef FILESYS + dst = save_filesys_common (&len); + if (dst) { + save_chunk (f, dst, len, _T("FSYC"), 0); + for (i = 0; i < nr_units (); i++) { + dst = save_filesys (i, &len); + if (dst) { + save_chunk (f, dst, len, _T("FSYS"), 0); + xfree (dst); + } + } + } +#endif + dst = save_gayle (&len, NULL); + if (dst) { + save_chunk (f, dst, len, _T("GAYL"), 0); + xfree(dst); + } + for (i = 0; i < 4; i++) { + dst = save_gayle_ide (i, &len, NULL); + if (dst) { + save_chunk (f, dst, len, _T("IDE "), 0); + xfree (dst); } } - zfile_fwrite(endhunk, 1, 8, f); + for (i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { + dst = save_cd (i, &len); + if (dst) { + _stprintf (name, _T("CDU%d"), i); + save_chunk (f, dst, len, name, 0); + } + } - return 1; + zfile_fwrite (endhunk, 1, 8, f); + + return 1; } -int save_state(const TCHAR* filename, const TCHAR* description) +int save_state (const TCHAR *filename, const TCHAR *description) { - struct zfile* f; - int comp = savestate_docompress; + struct zfile *f; + int comp = savestate_docompress; - if (!savestate_specialdump && !savestate_nodialogs) - { - state_incompatible_warn(); - if (!save_filesys_cando()) - { - gui_message(_T("Filesystem active. Try again later.")); - return -1; - } - } + if (!savestate_nodialogs) { + state_incompatible_warn(); + if (!save_filesys_cando()) { + gui_message (_T("Filesystem active. Try again later.")); + return -1; + } + } new_blitter = false; - savestate_nodialogs = 0; - custom_prepare_savestate(); - f = zfile_fopen(filename, _T("w+b"), 0); - if (!f) - return 0; - int v = save_state_internal(f, description, comp, true); + savestate_nodialogs = 0; + custom_prepare_savestate (); + f = zfile_fopen (filename, _T("w+b"), 0); + if (!f) + return 0; + int v = save_state_internal (f, description, comp, true); if (v) - write_log (_T("Save of '%s' complete\n"), filename); - zfile_fclose(f); - savestate_state = 0; + write_log (_T("Save of '%s' complete\n"), filename); + zfile_fclose (f); + savestate_state = 0; return v; } -bool savestate_check() +bool savestate_check (void) { - if (savestate_state == STATE_DORESTORE) - { + if (savestate_state == STATE_DORESTORE) { savestate_state = STATE_RESTORE; return true; } diff --git a/src/threaddep/thread.h b/src/threaddep/thread.h index 2b7b33a9..3280885d 100644 --- a/src/threaddep/thread.h +++ b/src/threaddep/thread.h @@ -39,6 +39,23 @@ STATIC_INLINE void uae_end_thread (uae_thread_id *tid) { } +#ifdef USE_SDL1 +STATIC_INLINE int uae_start_thread (const TCHAR *name, void *(*f) (void *), void *arg, uae_thread_id *foo) +{ + uae_thread_id id = SDL_CreateThread ((int (*)(void *))f, arg); + if(foo != NULL) + *foo = id; + return (int)id; +} + +STATIC_INLINE int uae_start_thread_fast (void *(*f) (void *), void *arg, uae_thread_id *foo) +{ + uae_thread_id id = SDL_CreateThread ((int (*)(void *))f, arg); + if(foo != NULL) + *foo = id; + return (int)id; +} +#elif USE_SDL2 STATIC_INLINE uae_thread_id uae_start_thread(const TCHAR* name, void*(*f)(void*), void* arg, uae_thread_id* foo) { uae_thread_id id = SDL_CreateThread ((int (*)(void *))f, "StartThread", arg); @@ -54,6 +71,7 @@ STATIC_INLINE uae_thread_id uae_start_thread_fast(void*(*f)(void*), void* arg, u *foo = id; return id; } +#endif STATIC_INLINE void uae_wait_thread (uae_thread_id thread) { diff --git a/src/traps.cpp b/src/traps.cpp index dede43e6..df400311 100644 --- a/src/traps.cpp +++ b/src/traps.cpp @@ -1,17 +1,18 @@ -/* - * E-UAE - The portable Amiga Emulator - * - * Support for traps - * - * Copyright Richard Drummond 2005 - * - * Inspired by code from UAE: - * Copyright 1995, 1996 Bernd Schmidt - * Copyright 1996 Ed Hanway - */ + /* + * E-UAE - The portable Amiga Emulator + * + * Support for traps + * + * Copyright Richard Drummond 2005 + * + * Inspired by code from UAE: + * Copyright 1995, 1996 Bernd Schmidt + * Copyright 1996 Ed Hanway + */ #include "sysconfig.h" #include "sysdeps.h" + #include "options.h" #include "include/memory.h" #include "custom.h" @@ -19,6 +20,7 @@ #include "threaddep/thread.h" #include "autoconf.h" #include "traps.h" +#include "uae.h" /* * Traps are the mechanism via which 68k code can call emulator code @@ -62,35 +64,30 @@ */ struct Trap { - TrapHandler handler; /* Handler function to be invoked for this trap. */ - int flags; /* Trap attributes. */ - const TCHAR* name; /* For debugging purposes. */ - uaecptr addr; + TrapHandler handler; /* Handler function to be invoked for this trap. */ + int flags; /* Trap attributes. */ + const TCHAR *name; /* For debugging purposes. */ + uaecptr addr; }; #define MAX_TRAPS 4096 /* Defined traps */ -static struct Trap traps[MAX_TRAPS]; +static struct Trap traps[MAX_TRAPS]; static unsigned int trap_count = 1; -volatile uae_atomic hwtrap_waiting; +static void trap_HandleExtendedTrap (TrapHandler, int has_retval); -static const int trace_traps = 0; - -static void trap_HandleExtendedTrap(TrapHandler, int has_retval); - -uaecptr find_trap(const TCHAR* name) +uaecptr find_trap (const TCHAR *name) { - int i; + int i; - for (i = 0; i < trap_count; i++) - { - struct Trap* trap = &traps[i]; - if ((trap->flags & TRAPFLAG_UAERES) && trap->name && !_tcscmp (trap->name, name)) - return trap->addr; - } - return 0; + for (i = 0; i < trap_count; i++) { + struct Trap *trap = &traps[i]; + if ((trap->flags & TRAPFLAG_UAERES) && trap->name && !_tcscmp (trap->name, name)) + return trap->addr; + } + return 0; } @@ -103,37 +100,34 @@ uaecptr find_trap(const TCHAR* name) * * returns trap number of defined trap */ -unsigned int define_trap(TrapHandler handler_func, int flags, const TCHAR* name) +unsigned int define_trap (TrapHandler handler_func, int flags, const TCHAR *name) { - if (trap_count == MAX_TRAPS) - { + if (trap_count == MAX_TRAPS) { write_log (_T("Ran out of emulator traps\n")); - abort (); - return -1; - } - else - { - int i; - unsigned int trap_num; - struct Trap* trap; - uaecptr addr = here(); + target_startup_msg(_T("Internal error"), _T("Ran out of emulator traps.")); + uae_restart(1, NULL); + return -1; + } else { + int i; + unsigned int trap_num; + struct Trap *trap; + uaecptr addr = here (); - for (i = 0; i < trap_count; i++) - { - if (addr == traps[i].addr) - return i; - } + for (i = 0; i < trap_count; i++) { + if (addr == traps[i].addr) + return i; + } - trap_num = trap_count++; - trap = &traps[trap_num]; + trap_num = trap_count++; + trap = &traps[trap_num]; - trap->handler = handler_func; - trap->flags = flags; - trap->name = name; - trap->addr = addr; + trap->handler = handler_func; + trap->flags = flags; + trap->name = name; + trap->addr = addr; - return trap_num; - } + return trap_num; + } } @@ -143,48 +137,40 @@ unsigned int define_trap(TrapHandler handler_func, int flags, const TCHAR* name) * trap_num = number of trap to invoke * regs = current 68k state */ -void REGPARAM2 m68k_handle_trap(unsigned int trap_num) +void REGPARAM2 m68k_handle_trap (unsigned int trap_num) { - struct Trap* trap = &traps[trap_num]; - uae_u32 retval; + struct Trap *trap = &traps[trap_num]; + uae_u32 retval = 0; - int has_retval = (trap->flags & TRAPFLAG_NO_RETVAL) == 0; - int implicit_rts = (trap->flags & TRAPFLAG_DORET) != 0; + int has_retval = (trap->flags & TRAPFLAG_NO_RETVAL) == 0; + int implicit_rts = (trap->flags & TRAPFLAG_DORET) != 0; - if (trap->name && trap->name[0] != 0 && trace_traps) - write_log (_T("TRAP: %s\n"), trap->name); + if (trap_num < trap_count) { + if (trap->flags & TRAPFLAG_EXTRA_STACK) { + /* Handle an extended trap. + * Note: the return value of this trap is passed back to 68k + * space via a separate, dedicated simple trap which the trap + * handler causes to be invoked when it is done. + */ + trap_HandleExtendedTrap (trap->handler, has_retval); + } else { + /* Handle simple trap */ + retval = (trap->handler) (NULL); - if (trap_num < trap_count) - { - if (trap->flags & TRAPFLAG_EXTRA_STACK) - { - /* Handle an extended trap. - * Note: the return value of this trap is passed back to 68k - * space via a separate, dedicated simple trap which the trap - * handler causes to be invoked when it is done. - */ - trap_HandleExtendedTrap(trap->handler, has_retval); - } - else - { - /* Handle simple trap */ - retval = (trap->handler)(nullptr); + if (has_retval) + m68k_dreg (regs, 0) = retval; - if (has_retval) - m68k_dreg (regs, 0) = retval; - - if (implicit_rts) - { - m68k_do_rts(); - fill_prefetch(); - } - } - } - else - write_log (_T("Illegal emulator trap\n")); + if (implicit_rts) { + m68k_do_rts (); + fill_prefetch (); + } + } + } else + write_log (_T("Illegal emulator trap\n")); } + /* * Implementation of extended traps */ @@ -198,47 +184,47 @@ struct TrapCPUContext struct TrapContext { - /* Trap's working copy of 68k state. This is what the trap handler should - * access to get arguments from 68k space. */ - //struct regstruct regs; + /* Trap's working copy of 68k state. This is what the trap handler should + * access to get arguments from 68k space. */ - /* Trap handler function that gets called on the trap context */ - TrapHandler trap_handler; - /* Should the handler return a value to 68k space in D0? */ - int trap_has_retval; - /* Return value from trap handler */ - uae_u32 trap_retval; + /* Trap handler function that gets called on the trap context */ + TrapHandler trap_handler; + /* Should the handler return a value to 68k space in D0? */ + int trap_has_retval; + /* Return value from trap handler */ + uae_u32 trap_retval; - /* Copy of 68k state at trap entry. */ - //struct regstruct saved_regs; + /* Copy of 68k state at trap entry. */ struct TrapCPUContext saved_regs; - /* Thread which effects the trap context. */ - uae_thread_id thread; - /* For IPC between the main emulator. */ - uae_sem_t switch_to_emu_sem; - /* context and the trap context. */ - uae_sem_t switch_to_trap_sem; + /* Thread which effects the trap context. */ + uae_thread_id thread; + /* For IPC between the main emulator. */ + uae_sem_t switch_to_emu_sem; + /* context and the trap context. */ + uae_sem_t switch_to_trap_sem; - /* When calling a 68k function from a trap handler, this is set to the - * address of the function to call. */ - uaecptr call68k_func_addr; - /* And this gets set to the return value of the 68k call. */ - uae_u32 call68k_retval; + /* When calling a 68k function from a trap handler, this is set to the + * address of the function to call. */ + uaecptr call68k_func_addr; + /* And this gets set to the return value of the 68k call. */ + uae_u32 call68k_retval; + + uae_u32 calllib_regs[16]; + uae_u8 calllib_reg_inuse[16]; }; -static void copytocpucontext(struct TrapCPUContext* cpu) +static void copytocpucontext(struct TrapCPUContext *cpu) { - memcpy(cpu->regs, regs.regs, sizeof (regs.regs)); + memcpy (cpu->regs, regs.regs, sizeof (regs.regs)); cpu->intmask = regs.intmask; - cpu->pc = m68k_getpc(); + cpu->pc = m68k_getpc (); } - -static void copyfromcpucontext(struct TrapCPUContext* cpu, uae_u32 pc) +static void copyfromcpucontext(struct TrapCPUContext *cpu, uae_u32 pc) { - memcpy(regs.regs, cpu->regs, sizeof (regs.regs)); + memcpy (regs.regs, cpu->regs, sizeof (regs.regs)); regs.intmask = cpu->intmask; - m68k_setpc(pc); + m68k_setpc (pc); } @@ -248,88 +234,86 @@ static uaecptr m68k_return_trapaddr; static uaecptr exit_trap_trapaddr; /* For IPC between main thread and trap context */ -static uae_sem_t trap_mutex = nullptr; -static TrapContext* current_context; +static uae_sem_t trap_mutex = 0; +static TrapContext *current_context; /* * Thread body for trap context */ -static void* trap_thread(void* arg) +static void *trap_thread (void *arg) { - TrapContext* context = static_cast(arg); + TrapContext *context = (TrapContext *) arg; - /* Wait until main thread is ready to switch to the - * this trap context. */ - uae_sem_wait (&context->switch_to_trap_sem); + /* Wait until main thread is ready to switch to the + * this trap context. */ + uae_sem_wait (&context->switch_to_trap_sem); - /* Execute trap handler function. */ - context->trap_retval = context->trap_handler(context); + /* Execute trap handler function. */ + context->trap_retval = context->trap_handler (context); - /* Trap handler is done - we still need to tidy up - * and make sure the handler's return value is propagated - * to the calling 68k thread. - * - * We do this by causing our exit handler to be executed on the 68k context. - */ + /* Trap handler is done - we still need to tidy up + * and make sure the handler's return value is propagated + * to the calling 68k thread. + * + * We do this by causing our exit handler to be executed on the 68k context. + */ - /* Enter critical section - only one trap at a time, please! */ - uae_sem_wait (&trap_mutex); + /* Enter critical section - only one trap at a time, please! */ + uae_sem_wait (&trap_mutex); //regs = context->saved_regs; /* Set PC to address of the exit handler, so that it will be called * when the 68k context resumes. */ - copyfromcpucontext(&context->saved_regs, exit_trap_trapaddr); - /* Don't allow an interrupt and thus potentially another - * trap to be invoked while we hold the above mutex. - * This is probably just being paranoid. */ - regs.intmask = 7; + copyfromcpucontext (&context->saved_regs, exit_trap_trapaddr); + /* Don't allow an interrupt and thus potentially another + * trap to be invoked while we hold the above mutex. + * This is probably just being paranoid. */ + regs.intmask = 7; //m68k_setpc (exit_trap_trapaddr); - current_context = context; + current_context = context; - /* Switch back to 68k context */ - uae_sem_post (&context->switch_to_emu_sem); + /* Switch back to 68k context */ + uae_sem_post (&context->switch_to_emu_sem); - /* Good bye, cruel world... */ + /* Good bye, cruel world... */ - /* dummy return value */ - write_log("trap_thread: exit (arg=0x%08X)\n", arg); - return nullptr; + /* dummy return value */ + return 0; } /* * Set up extended trap context and call handler function */ -static void trap_HandleExtendedTrap(TrapHandler handler_func, int has_retval) +static void trap_HandleExtendedTrap (TrapHandler handler_func, int has_retval) { - struct TrapContext* context = xcalloc (TrapContext, 1); + struct TrapContext *context = xcalloc (TrapContext, 1); - if (context) - { - uae_sem_init(&context->switch_to_trap_sem, 0, 0); - uae_sem_init(&context->switch_to_emu_sem, 0, 0); + if (context) { + uae_sem_init (&context->switch_to_trap_sem, 0, 0); + uae_sem_init (&context->switch_to_emu_sem, 0, 0); - context->trap_handler = handler_func; - context->trap_has_retval = has_retval; + context->trap_handler = handler_func; + context->trap_has_retval = has_retval; //context->saved_regs = regs; - copytocpucontext(&context->saved_regs); + copytocpucontext (&context->saved_regs); - /* Start thread to handle new trap context. */ - uae_start_thread_fast(trap_thread, static_cast(context), &context->thread); + /* Start thread to handle new trap context. */ + uae_start_thread_fast (trap_thread, (void *)context, &context->thread); - /* Switch to trap context to begin execution of - * trap handler function. - */ - uae_sem_post (&context->switch_to_trap_sem); + /* Switch to trap context to begin execution of + * trap handler function. + */ + uae_sem_post (&context->switch_to_trap_sem); - /* Wait for trap context to switch back to us. - * - * It'll do this when the trap handler is done - or when - * the handler wants to call 68k code. */ - uae_sem_wait (&context->switch_to_emu_sem); - } + /* Wait for trap context to switch back to us. + * + * It'll do this when the trap handler is done - or when + * the handler wants to call 68k code. */ + uae_sem_wait (&context->switch_to_emu_sem); + } } /* @@ -337,191 +321,536 @@ static void trap_HandleExtendedTrap(TrapHandler handler_func, int has_retval) * * This function is to be called from the trap context. */ -static uae_u32 trap_Call68k(TrapContext* context, uaecptr func_addr) + +static uae_u32 trap_Call68k (TrapContext *ctx, uaecptr func_addr) { - /* Enter critical section - only one trap at a time, please! */ - uae_sem_wait (&trap_mutex); - current_context = context; + /* Enter critical section - only one trap at a time, please! */ + uae_sem_wait (&trap_mutex); + current_context = ctx; - /* Don't allow an interrupt and thus potentially another - * trap to be invoked while we hold the above mutex. - * This is probably just being paranoid. */ - regs.intmask = 7; + /* Don't allow an interrupt and thus potentially another + * trap to be invoked while we hold the above mutex. + * This is probably just being paranoid. */ + regs.intmask = 7; - /* Set up function call address. */ - context->call68k_func_addr = func_addr; + /* Set up function call address. */ + ctx->call68k_func_addr = func_addr; - /* Set PC to address of 68k call trap, so that it will be - * executed when emulator context resumes. */ - m68k_setpc(m68k_call_trapaddr); - fill_prefetch(); + /* Set PC to address of 68k call trap, so that it will be + * executed when emulator context resumes. */ + m68k_setpc (m68k_call_trapaddr); + fill_prefetch (); - /* Switch to emulator context. */ - uae_sem_post (&context->switch_to_emu_sem); + /* Switch to emulator context. */ + uae_sem_post (&ctx->switch_to_emu_sem); - /* Wait for 68k call return handler to switch back to us. */ - uae_sem_wait (&context->switch_to_trap_sem); + /* Wait for 68k call return handler to switch back to us. */ + uae_sem_wait (&ctx->switch_to_trap_sem); - /* End critical section. */ - uae_sem_post (&trap_mutex); + /* End critical section. */ + uae_sem_post (&trap_mutex); - /* Get return value from 68k function called. */ - return context->call68k_retval; + /* Get return value from 68k function called. */ + return ctx->call68k_retval; } /* * Handles the emulator's side of a 68k call (from an extended trap) */ -static uae_u32 REGPARAM2 m68k_call_handler(TrapContext* dummy_ctx) +static uae_u32 REGPARAM2 m68k_call_handler (TrapContext *dummy_ctx) { - TrapContext* context = current_context; + TrapContext *context = current_context; - uae_u32 sp; + uae_u32 sp; - sp = m68k_areg (regs, 7); + sp = m68k_areg (regs, 7); - /* Push address of trap context on 68k stack. This is - * so the return trap can find this context. */ - sp -= sizeof (void *); - put_pointer (sp, context); + /* Push address of trap context on 68k stack. This is + * so the return trap can find this context. */ + sp -= sizeof (void *); + put_pointer (sp, context); - /* Push addr to return handler trap on 68k stack. - * When the called m68k function does an RTS, the CPU will pull this - * address off the stack and so call the return handler. */ - sp -= 4; - put_long(sp, m68k_return_trapaddr); + /* Push addr to return handler trap on 68k stack. + * When the called m68k function does an RTS, the CPU will pull this + * address off the stack and so call the return handler. */ + sp -= 4; + put_long (sp, m68k_return_trapaddr); - m68k_areg (regs, 7) = sp; + m68k_areg (regs, 7) = sp; - /* Set PC to address of 68k function to call. */ - m68k_setpc(context->call68k_func_addr); - fill_prefetch(); + /* Set PC to address of 68k function to call. */ + m68k_setpc (context->call68k_func_addr); + fill_prefetch (); - /* End critical section: allow other traps run. */ - uae_sem_post (&trap_mutex); + /* End critical section: allow other traps run. */ + uae_sem_post (&trap_mutex); - /* Restore interrupts. */ - regs.intmask = context->saved_regs.intmask; + /* Restore interrupts. */ + regs.intmask = context->saved_regs.intmask; - /* Dummy return value. */ - return 0; + /* Dummy return value. */ + return 0; } /* * Handles the return from a 68k call at the emulator's side. */ -static uae_u32 REGPARAM2 m68k_return_handler(TrapContext* dummy_ctx) +static uae_u32 REGPARAM2 m68k_return_handler (TrapContext *dummy_ctx) { - TrapContext* context; - uae_u32 sp; + TrapContext *context; + uae_u32 sp; - /* One trap returning at a time, please! */ - uae_sem_wait (&trap_mutex); + /* One trap returning at a time, please! */ + uae_sem_wait (&trap_mutex); - /* Get trap context from 68k stack. */ - sp = m68k_areg (regs, 7); - context = static_cast(get_pointer(sp)); - sp += sizeof (void *); - m68k_areg (regs, 7) = sp; + /* Get trap context from 68k stack. */ + sp = m68k_areg (regs, 7); + context = (TrapContext *) get_pointer(sp); + sp += sizeof (void *); + m68k_areg (regs, 7) = sp; - /* Get return value from the 68k call. */ - context->call68k_retval = m68k_dreg (regs, 0); + /* Get return value from the 68k call. */ + context->call68k_retval = m68k_dreg (regs, 0); - /* Switch back to trap context. */ - uae_sem_post (&context->switch_to_trap_sem); + /* Switch back to trap context. */ + uae_sem_post (&context->switch_to_trap_sem); - /* Wait for trap context to switch back to us. - * - * It'll do this when the trap handler is done - or when - * the handler wants to call another 68k function. */ - uae_sem_wait (&context->switch_to_emu_sem); + /* Wait for trap context to switch back to us. + * + * It'll do this when the trap handler is done - or when + * the handler wants to call another 68k function. */ + uae_sem_wait (&context->switch_to_emu_sem); - /* Dummy return value. */ - return 0; + /* Dummy return value. */ + return 0; } /* * Handles completion of an extended trap and passes * return value from trap function to 68k space. */ -static uae_u32 REGPARAM2 exit_trap_handler(TrapContext* dummy_ctx) +static uae_u32 REGPARAM2 exit_trap_handler (TrapContext *dummy_ctx) { - TrapContext* context = current_context; + TrapContext *context = current_context; - /* Wait for trap context thread to exit. */ - uae_wait_thread(context->thread); + /* Wait for trap context thread to exit. */ + uae_wait_thread (context->thread); - /* Restore 68k state saved at trap entry. */ + /* Restore 68k state saved at trap entry. */ //regs = context->saved_regs; - copyfromcpucontext(&context->saved_regs, context->saved_regs.pc); + copyfromcpucontext (&context->saved_regs, context->saved_regs.pc); + + /* If trap is supposed to return a value, then store + * return value in D0. */ + if (context->trap_has_retval) + m68k_dreg (regs, 0) = context->trap_retval; - /* If trap is supposed to return a value, then store - * return value in D0. */ - if (context->trap_has_retval) - m68k_dreg (regs, 0) = context->trap_retval; + uae_sem_destroy (&context->switch_to_trap_sem); + uae_sem_destroy (&context->switch_to_emu_sem); - uae_sem_destroy (&context->switch_to_trap_sem); - uae_sem_destroy (&context->switch_to_emu_sem); + xfree (context); - xfree (context); + /* End critical section */ + uae_sem_post (&trap_mutex); - /* End critical section */ - uae_sem_post (&trap_mutex); - - /* Dummy return value. */ - return 0; + /* Dummy return value. */ + return 0; } + /* * Call a 68k library function from extended trap. */ -uae_u32 CallLib(TrapContext* context, uaecptr base, uae_s16 offset) +uae_u32 CallLib (TrapContext *ctx, uaecptr base, uae_s16 offset) { - uae_u32 retval; - uaecptr olda6 = m68k_areg (regs, 6); + uae_u32 retval; + uaecptr olda6 = trap_get_areg(ctx, 6); - m68k_areg (regs, 6) = base; - retval = trap_Call68k(context, base + offset); - m68k_areg (regs, 6) = olda6; + trap_set_areg(ctx, 6, base); + retval = trap_Call68k (ctx, base + offset); + trap_set_areg(ctx, 6, olda6); - return retval; + return retval; } /* * Call 68k function from extended trap. */ -uae_u32 CallFunc(TrapContext* context, uaecptr func) +uae_u32 CallFunc(TrapContext *ctx, uaecptr func) { - return trap_Call68k(context, func); + return trap_Call68k(ctx, func); } /* * Initialize trap mechanism. */ -void init_traps() +void init_traps (void) { - trap_count = 0; + trap_count = 0; } /* * Initialize the extended trap mechanism. */ -void init_extended_traps() +void init_extended_traps (void) { - m68k_call_trapaddr = here(); - calltrap(deftrap2 (m68k_call_handler, TRAPFLAG_NO_RETVAL, _T("m68k_call"))); + m68k_call_trapaddr = here (); + calltrap (deftrap2 (m68k_call_handler, TRAPFLAG_NO_RETVAL, _T("m68k_call"))); - m68k_return_trapaddr = here(); - calltrap(deftrap2 (m68k_return_handler, TRAPFLAG_NO_RETVAL, _T("m68k_return"))); + m68k_return_trapaddr = here(); + calltrap (deftrap2 (m68k_return_handler, TRAPFLAG_NO_RETVAL, _T("m68k_return"))); - exit_trap_trapaddr = here(); - calltrap(deftrap2 (exit_trap_handler, TRAPFLAG_NO_RETVAL, _T("exit_trap"))); + exit_trap_trapaddr = here(); + calltrap (deftrap2 (exit_trap_handler, TRAPFLAG_NO_RETVAL, _T("exit_trap"))); - if (trap_mutex != nullptr) - uae_sem_destroy(&trap_mutex); - trap_mutex = nullptr; - uae_sem_init(&trap_mutex, 0, 1); + if(trap_mutex != 0) + uae_sem_destroy(&trap_mutex); + trap_mutex = 0; + uae_sem_init (&trap_mutex, 0, 1); } +void trap_call_add_dreg(TrapContext *ctx, int reg, uae_u32 v) +{ + ctx->calllib_reg_inuse[reg] = 1; + ctx->calllib_regs[reg] = v; +} +void trap_call_add_areg(TrapContext *ctx, int reg, uae_u32 v) +{ + ctx->calllib_reg_inuse[reg + 8] = 1; + ctx->calllib_regs[reg + 8] = v; +} +uae_u32 trap_call_lib(TrapContext *ctx, uaecptr base, uae_s16 offset) +{ + uae_u32 v; + uae_u32 storedregs[16]; + bool storedregsused[16]; + for (int i = 0; i < 16; i++) { + storedregsused[i] = false; + if (ctx->calllib_reg_inuse[i]) { + if ((i & 7) >= 2) { + storedregsused[i] = true; + storedregs[i] = regs.regs[i]; + } + regs.regs[i] = ctx->calllib_regs[i]; + } + ctx->calllib_reg_inuse[i] = 0; + } + v = CallLib(ctx, base, offset); + for (int i = 0; i < 16; i++) { + if (storedregsused[i]) { + regs.regs[i] = storedregs[i]; + } + } + return v; +} +uae_u32 trap_call_func(TrapContext *ctx, uaecptr func) +{ + uae_u32 v; + uae_u32 storedregs[16]; + bool storedregsused[16]; + for (int i = 0; i < 16; i++) { + storedregsused[i] = false; + if (ctx->calllib_reg_inuse[i]) { + if ((i & 7) >= 2) { + storedregsused[i] = true; + storedregs[i] = regs.regs[i]; + } + regs.regs[i] = ctx->calllib_regs[i]; + } + ctx->calllib_reg_inuse[i] = 0; + } + v = CallFunc(ctx, func); + for (int i = 0; i < 16; i++) { + if (storedregsused[i]) { + regs.regs[i] = storedregs[i]; + } + } + return v; +} + + +bool trap_valid_address(TrapContext *ctx, uaecptr addr, uae_u32 size) +{ + return valid_address(addr, size) != 0; +} + +uae_u32 trap_get_dreg(TrapContext *ctx, int reg) +{ + return m68k_dreg(regs, reg); +} +uae_u32 trap_get_areg(TrapContext *ctx, int reg) +{ + return m68k_areg(regs, reg); +} +void trap_set_dreg(TrapContext *ctx, int reg, uae_u32 v) +{ + m68k_dreg(regs, reg) = v; +} +void trap_set_areg(TrapContext *ctx, int reg, uae_u32 v) +{ + m68k_areg(regs, reg) = v; +} +void trap_put_quad(TrapContext *ctx, uaecptr addr, uae_u64 v) +{ + uae_u8 out[8]; + put_long_host(out + 0, v >> 32); + put_long_host(out + 4, (uae_u32)(v >> 0)); + trap_put_bytes(ctx, out, addr, 8); +} +void trap_put_long(TrapContext *ctx, uaecptr addr, uae_u32 v) +{ + put_long(addr, v); +} +void trap_put_word(TrapContext *ctx, uaecptr addr, uae_u16 v) +{ + put_word(addr, v); +} +void trap_put_byte(TrapContext *ctx, uaecptr addr, uae_u8 v) +{ + put_byte(addr, v); +} + +uae_u64 trap_get_quad(TrapContext *ctx, uaecptr addr) +{ + uae_u8 in[8]; + trap_get_bytes(ctx, in, addr, 8); + return ((uae_u64)get_long_host(in + 0) << 32) | get_long_host(in + 4); +} +uae_u32 trap_get_long(TrapContext *ctx, uaecptr addr) +{ + return get_long(addr); +} +uae_u16 trap_get_word(TrapContext *ctx, uaecptr addr) +{ + return get_word(addr); +} +uae_u8 trap_get_byte(TrapContext *ctx, uaecptr addr) +{ + return get_byte(addr); +} + +void trap_put_bytes(TrapContext *ctx, const void *haddrp, uaecptr addr, int cnt) +{ + if (cnt <= 0) + return; + uae_u8 *haddr = (uae_u8*)haddrp; + if (valid_address(addr, cnt)) { + memcpy(get_real_address(addr), haddr, cnt); + } else { + for (int i = 0; i < cnt; i++) { + put_byte(addr, *haddr++); + addr++; + } + } +} +void trap_get_bytes(TrapContext *ctx, void *haddrp, uaecptr addr, int cnt) +{ + if (cnt <= 0) + return; + uae_u8 *haddr = (uae_u8*)haddrp; + if (valid_address(addr, cnt)) { + memcpy(haddr, get_real_address(addr), cnt); + } else { + for (int i = 0; i < cnt; i++) { + *haddr++ = get_byte(addr); + addr++; + } + } +} +void trap_put_longs(TrapContext *ctx, uae_u32 *haddr, uaecptr addr, int cnt) +{ + if (cnt <= 0) + return; + uae_u32 *p = (uae_u32*)haddr; + for (int i = 0; i < cnt; i++) { + put_long(addr, *p++); + addr += 4; + } +} +void trap_get_longs(TrapContext *ctx, uae_u32 *haddr, uaecptr addr, int cnt) +{ + if (cnt <= 0) + return; + uae_u32 *p = (uae_u32*)haddr; + for (int i = 0; i < cnt; i++) { + *p++ = get_long(addr); + addr += 4; + } +} +void trap_put_words(TrapContext *ctx, uae_u16 *haddr, uaecptr addr, int cnt) +{ + if (cnt <= 0) + return; + uae_u16 *p = (uae_u16*)haddr; + for (int i = 0; i < cnt; i++) { + put_word(addr, *p++); + addr += sizeof(uae_u16); + } +} +void trap_get_words(TrapContext *ctx, uae_u16 *haddr, uaecptr addr, int cnt) +{ + if (cnt <= 0) + return; + uae_u16 *p = (uae_u16*)haddr; + for (int i = 0; i < cnt; i++) { + *p++ = get_word(addr); + addr += sizeof(uae_u16); + } +} + +int trap_put_string(TrapContext *ctx, const void *haddrp, uaecptr addr, int maxlen) +{ + int len = 0; + uae_u8 *haddr = (uae_u8*)haddrp; + for (;;) { + uae_u8 v = *haddr++; + put_byte(addr, v); + addr++; + if (!v) + break; + len++; + } + return len; +} +int trap_get_string(TrapContext *ctx, void *haddrp, uaecptr addr, int maxlen) +{ + int len = 0; + uae_u8 *haddr = (uae_u8*)haddrp; + for (;;) { + uae_u8 v = get_byte(addr); + *haddr++ = v; + addr++; + if (!v) + break; + } + len++; + return len; +} +uae_char *trap_get_alloc_string(TrapContext *ctx, uaecptr addr, int maxlen) +{ + uae_char *buf = xmalloc(uae_char, maxlen); + trap_get_string(ctx, buf, addr, maxlen); + return buf; +} + +int trap_get_bstr(TrapContext *ctx, uae_u8 *haddr, uaecptr addr, int maxlen) +{ + int len = 0; + uae_u8 cnt = get_byte(addr); + while (cnt-- != 0 && maxlen-- > 0) { + addr++; + *haddr++ = get_byte(addr); + } + *haddr = 0; + return len; +} + +void trap_set_longs(TrapContext *ctx, uaecptr addr, uae_u32 v, int cnt) +{ + if (cnt <= 0) + return; + for (int i = 0; i < cnt; i++) { + put_long(addr, v); + addr += 4; + } +} +void trap_set_words(TrapContext *ctx, uaecptr addr, uae_u16 v, int cnt) +{ + if (cnt <= 0) + return; + for (int i = 0; i < cnt; i++) { + put_word(addr, v); + addr += 2; + } +} +void trap_set_bytes(TrapContext *ctx, uaecptr addr, uae_u8 v, int cnt) +{ + if (cnt <= 0) + return; + for (int i = 0; i < cnt; i++) { + put_byte(addr, v); + addr += 1; + } +} + +void trap_multi(TrapContext *ctx, struct trapmd *data, int items) +{ + uae_u32 v = 0; + for (int i = 0; i < items; i++) { + struct trapmd *md = &data[i]; + switch (md->cmd) + { + case TRAPCMD_PUT_LONG: + trap_put_long(ctx, md->params[0], md->params[1]); + break; + case TRAPCMD_PUT_WORD: + trap_put_word(ctx, md->params[0], md->params[1]); + break; + case TRAPCMD_PUT_BYTE: + trap_put_byte(ctx, md->params[0], md->params[1]); + break; + case TRAPCMD_GET_LONG: + v = md->params[0] = trap_get_long(ctx, md->params[0]); + break; + case TRAPCMD_GET_WORD: + v = md->params[0] = trap_get_word(ctx, md->params[0]); + break; + case TRAPCMD_GET_BYTE: + v = md->params[0] = trap_get_byte(ctx, md->params[0]); + break; + case TRAPCMD_PUT_BYTES: + trap_put_bytes(ctx, md->haddr, md->params[0], md->params[1]); + break; + case TRAPCMD_GET_BYTES: + trap_get_bytes(ctx, md->haddr, md->params[0], md->params[1]); + break; + case TRAPCMD_PUT_WORDS: + trap_put_words(ctx, (uae_u16*)md->haddr, md->params[0], md->params[1]); + break; + case TRAPCMD_GET_WORDS: + trap_get_words(ctx, (uae_u16*)md->haddr, md->params[0], md->params[1]); + break; + case TRAPCMD_PUT_LONGS: + trap_put_longs(ctx, (uae_u32*)md->haddr, md->params[0], md->params[1]); + break; + case TRAPCMD_GET_LONGS: + trap_get_longs(ctx, (uae_u32*)md->haddr, md->params[0], md->params[1]); + break; + case TRAPCMD_PUT_STRING: + trap_put_string(ctx, md->haddr, md->params[0], md->params[1]); + break; + case TRAPCMD_GET_STRING: + trap_get_string(ctx, md->haddr, md->params[0], md->params[1]); + break; + case TRAPCMD_SET_LONGS: + trap_set_longs(ctx, md->params[0], md->params[1], md->params[2]); + break; + case TRAPCMD_SET_WORDS: + trap_set_words(ctx, md->params[0], md->params[1], md->params[2]); + break; + case TRAPCMD_SET_BYTES: + trap_set_bytes(ctx, md->params[0], md->params[1], md->params[2]); + break; + case TRAPCMD_NOP: + break; + } + if (md->trapmd_index) { + data[md->trapmd_index].params[md->parm_num] = v; + } + } +} + +void trap_memcpyha_safe(TrapContext *ctx, uaecptr dst, const uae_u8 *src, int size) +{ + if (size <= 0) + return; + memcpyha_safe(dst, src, size); +} +void trap_memcpyah_safe(TrapContext *ctx, uae_u8 *dst, uaecptr src, int size) +{ + if (size <= 0) + return; + memcpyah_safe(dst, src, size); +} diff --git a/src/uaelib.cpp b/src/uaelib.cpp index 08eecff4..49eb4a26 100755 --- a/src/uaelib.cpp +++ b/src/uaelib.cpp @@ -23,50 +23,49 @@ #include "autoconf.h" #include "traps.h" #include "disk.h" -#include "debug.h" #include "gensound.h" #include "picasso96.h" #include "filesys.h" - /* +/* * Returns UAE Version */ -static uae_u32 emulib_GetVersion(void) +static uae_u32 emulib_GetVersion (void) { - return version; + return version; } /* -* Resets your amiga -*/ -static uae_u32 emulib_HardReset(void) + * Resets your amiga + */ +static uae_u32 emulib_HardReset (void) { uae_reset(1, 1); - return 0; + return 0; } -static uae_u32 emulib_Reset(void) +static uae_u32 emulib_Reset (void) { uae_reset(0, 0); - return 0; + return 0; } /* -* Enables SOUND -*/ -static uae_u32 emulib_EnableSound(uae_u32 val) + * Enables SOUND + */ +static uae_u32 emulib_EnableSound (uae_u32 val) { - if (!sound_available || currprefs.produce_sound == 2) - return 0; + if (!sound_available || currprefs.produce_sound == 2) + return 0; - currprefs.produce_sound = val; - return 1; + currprefs.produce_sound = val; + return 1; } /* -* Enables FAKE JOYSTICK -*/ -static uae_u32 emulib_EnableJoystick(uae_u32 val) + * Enables FAKE JOYSTICK + */ +static uae_u32 emulib_EnableJoystick (uae_u32 val) { currprefs.jports[0].id = val & 255; currprefs.jports[1].id = (val >> 8) & 255; @@ -74,18 +73,18 @@ static uae_u32 emulib_EnableJoystick(uae_u32 val) } /* -* Sets the framerate -*/ -static uae_u32 emulib_SetFrameRate(uae_u32 val) + * Sets the framerate + */ +static uae_u32 emulib_SetFrameRate (uae_u32 val) { - if (val == 0) - return 0; - else if (val > 20) - return 0; - else { - currprefs.gfx_framerate = val; - return 1; - } + if (val == 0) + return 0; + else if (val > 20) + return 0; + else { + currprefs.gfx_framerate = val; + return 1; + } } /* @@ -93,9 +92,36 @@ static uae_u32 emulib_SetFrameRate(uae_u32 val) */ static uae_u32 emulib_ChangeLanguage (uae_u32 which) { - if(which > 0) + if (which > 6) return 0; - return 1; + else { + switch (which) { + case 0: + currprefs.keyboard_lang = KBD_LANG_US; + break; + case 1: + currprefs.keyboard_lang = KBD_LANG_DK; + break; + case 2: + currprefs.keyboard_lang = KBD_LANG_DE; + break; + case 3: + currprefs.keyboard_lang = KBD_LANG_SE; + break; + case 4: + currprefs.keyboard_lang = KBD_LANG_FR; + break; + case 5: + currprefs.keyboard_lang = KBD_LANG_IT; + break; + case 6: + currprefs.keyboard_lang = KBD_LANG_ES; + break; + default: + break; + } + return 1; + } } /* The following ones don't work as we never realloc the arrays... */ @@ -105,16 +131,16 @@ static uae_u32 emulib_ChangeLanguage (uae_u32 which) */ static uae_u32 REGPARAM2 emulib_ChgCMemSize(TrapContext *ctx, uae_u32 memsize) { - if (memsize != 0x80000 && memsize != 0x100000 && - memsize != 0x200000) { - memsize = 0x200000; - write_log(_T("Unsupported chipmem size!\n")); - } - m68k_dreg(regs, 0) = 0; + if (memsize != 0x80000 && memsize != 0x100000 && + memsize != 0x200000) { + memsize = 0x200000; + write_log (_T("Unsupported chipmem size!\n")); + } + trap_set_dreg(ctx, 0, 0); - changed_prefs.chipmem_size = memsize; + changed_prefs.chipmem_size = memsize; uae_reset(1, 1); - return 1; + return 1; } /* @@ -123,16 +149,16 @@ static uae_u32 REGPARAM2 emulib_ChgCMemSize(TrapContext *ctx, uae_u32 memsize) */ static uae_u32 REGPARAM2 emulib_ChgSMemSize(TrapContext *ctx, uae_u32 memsize) { - if (memsize != 0x80000 && memsize != 0x100000 && - memsize != 0x180000 && memsize != 0x1C0000) { - memsize = 0; - write_log(_T("Unsupported bogomem size!\n")); - } + if (memsize != 0x80000 && memsize != 0x100000 && + memsize != 0x180000 && memsize != 0x1C0000) { + memsize = 0; + write_log (_T("Unsupported bogomem size!\n")); + } - m68k_dreg(regs, 0) = 0; - changed_prefs.bogomem_size = memsize; - uae_reset(1, 1); - return 1; + trap_set_dreg(ctx, 0, 0); + changed_prefs.bogomem_size = memsize; + uae_reset (1, 1); + return 1; } /* @@ -141,15 +167,15 @@ static uae_u32 REGPARAM2 emulib_ChgSMemSize(TrapContext *ctx, uae_u32 memsize) */ static uae_u32 REGPARAM2 emulib_ChgFMemSize(TrapContext *ctx, uae_u32 memsize) { - if (memsize != 0x100000 && memsize != 0x200000 && - memsize != 0x400000 && memsize != 0x800000) { - memsize = 0; - write_log(_T("Unsupported fastmem size!\n")); - } - m68k_dreg(regs, 0) = 0; - changed_prefs.fastmem[0].size = memsize; - uae_reset(1, 1); - return 0; + if (memsize != 0x100000 && memsize != 0x200000 && + memsize != 0x400000 && memsize != 0x800000) { + memsize = 0; + write_log (_T("Unsupported fastmem size!\n")); + } + trap_set_dreg(ctx, 0, 0); + changed_prefs.fastmem[0].size = memsize; + uae_reset (1, 1); + return 0; } /* @@ -157,24 +183,20 @@ static uae_u32 REGPARAM2 emulib_ChgFMemSize(TrapContext *ctx, uae_u32 memsize) */ static uae_u32 emulib_InsertDisk(TrapContext *ctx, uaecptr name, uae_u32 drive) { - int i = 0; - char real_name[256]; + char real_name[256]; TCHAR *s; - if (drive > 3) - return 0; + if (drive > 3) + return 0; - while ((real_name[i] = get_byte(name + i)) != 0 && i++ != 254) - ; + if (trap_get_string(ctx, real_name, name, sizeof real_name) >= sizeof real_name) + return 0; /* ENAMETOOLONG */ - if (i == 255) - return 0; /* ENAMETOOLONG */ + s = au (real_name); + _tcscpy (changed_prefs.floppyslots[drive].df, s); + xfree (s); - s = au(real_name); - _tcscpy(changed_prefs.floppyslots[drive].df, s); - xfree(s); - - return 1; + return 1; } /* @@ -182,8 +204,8 @@ static uae_u32 emulib_InsertDisk(TrapContext *ctx, uaecptr name, uae_u32 drive) */ static uae_u32 emulib_ExitEmu (void) { - gui_message("Amiga sent signal to quit emulator."); - uae_quit (); + gui_message(_T("Amiga sent signal to quit emulator.")); + uae_restart(1, NULL); return 1; } @@ -192,40 +214,37 @@ static uae_u32 emulib_ExitEmu (void) */ static uae_u32 emulib_GetUaeConfig(TrapContext *ctx, uaecptr place) { - int j; - - put_long(place, version); - put_long(place + 4, chipmem_bank.allocated_size); - put_long(place + 8, bogomem_bank.allocated_size); - put_long(place + 12, fastmem_bank[0].allocated_size); - put_long(place + 16, currprefs.gfx_framerate); - put_long(place + 20, currprefs.produce_sound); - put_long(place + 24, currprefs.jports[0].id | (currprefs.jports[1].id << 8)); - //put_long(ctx, place + 28, currprefs.keyboard_lang); - if (disk_empty(0)) - put_byte(place + 32, 0); - else - put_byte(place + 32, 1); - if (disk_empty(1)) - put_byte(place + 33, 0); - else - put_byte(place + 33, 1); - if (disk_empty(2)) - put_byte(place + 34, 0); - else - put_byte(place + 34, 1); - if (disk_empty(3)) - put_byte(place + 35, 0); - else - put_byte(place + 35, 1); + trap_put_long(ctx, place, version); + trap_put_long(ctx, place + 4, chipmem_bank.allocated_size); + trap_put_long(ctx, place + 8, bogomem_bank.allocated_size); + trap_put_long(ctx, place + 12, fastmem_bank[0].allocated_size); + trap_put_long(ctx, place + 16, currprefs.gfx_framerate + 1); + trap_put_long(ctx, place + 20, currprefs.produce_sound); + trap_put_long(ctx, place + 24, currprefs.jports[0].id | (currprefs.jports[1].id << 8)); + trap_put_long(ctx, place + 28, currprefs.keyboard_lang); + if (disk_empty (0)) + trap_put_byte(ctx, place + 32, 0); + else + trap_put_byte(ctx, place + 32, 1); + if (disk_empty (1)) + trap_put_byte(ctx, place + 33, 0); + else + trap_put_byte(ctx, place + 33, 1); + if (disk_empty(2)) + trap_put_byte(ctx, place + 34, 0); + else + trap_put_byte(ctx, place + 34, 1); + if (disk_empty(3)) + trap_put_byte(ctx, place + 35, 0); + else + trap_put_byte(ctx, place + 35, 1); for (int i = 0; i < 4; i++) { - char *s = ua(currprefs.floppyslots[i].df); - for (i = 0; i < 256; i++) - put_byte(place + 36 + i + j * 256, s[i]); - xfree(s); - } - return 1; + char *s = ua (currprefs.floppyslots[i].df); + trap_put_string(ctx, s, place + 36 + i * 256, 256); + xfree (s); + } + return 1; } /* @@ -243,179 +262,103 @@ static uae_u32 emulib_SetUaeConfig (uaecptr place) */ static uae_u32 emulib_GetDisk(TrapContext *ctx, uae_u32 drive, uaecptr name) { - int i; - if (drive > 3) - return 0; + if (drive > 3) + return 0; - for (i = 0; i < 256; i++) { - put_byte(name + i, currprefs.floppyslots[drive].df[i]); - } - return 1; -} - -/* - * Enter debugging state - */ -static uae_u32 emulib_Debug (void) -{ -#ifdef DEBUGGER - activate_debugger (); + char *n = ua(currprefs.floppyslots[drive].df); + trap_put_string(ctx, (uae_u8*)n, name, 256); + xfree(n); return 1; -#else - return 0; -#endif } - #define CREATE_NATIVE_FUNC_PTR uae_u32 (* native_func)( uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, \ uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32) #define SET_NATIVE_FUNC(x) native_func = (uae_u32 (*)(uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32))(x) #define CALL_NATIVE_FUNC( d1,d2,d3,d4,d5,d6,d7,a1,a2,a3,a4,a5,a6 ) if(native_func) native_func( d1,d2,d3,d4,d5,d6,d7,a1,a2,a3,a4,a5,a6 ) /* A0 - Contains a ptr to the native .obj data. This ptr is Amiga-based. */ /* We simply find the first function in this .obj data, and execute it. */ -static uae_u32 REGPARAM2 emulib_ExecuteNativeCode (void) -{ -#if 0 - uaecptr object_AAM = m68k_areg (regs, 0); - uae_u32 d1 = m68k_dreg (regs, 1); - uae_u32 d2 = m68k_dreg (regs, 2); - uae_u32 d3 = m68k_dreg (regs, 3); - uae_u32 d4 = m68k_dreg (regs, 4); - uae_u32 d5 = m68k_dreg (regs, 5); - uae_u32 d6 = m68k_dreg (regs, 6); - uae_u32 d7 = m68k_dreg (regs, 7); - uae_u32 a1 = m68k_areg (regs, 1); - uae_u32 a2 = m68k_areg (regs, 2); - uae_u32 a3 = m68k_areg (regs, 3); - uae_u32 a4 = m68k_areg (regs, 4); - uae_u32 a5 = m68k_areg (regs, 5); - uae_u32 a6 = m68k_areg (regs, 6); - - uae_u8* object_UAM = NULL; - CREATE_NATIVE_FUNC_PTR; - - if( get_mem_bank( object_AAM ).check( object_AAM, 1 ) ) - object_UAM = get_mem_bank( object_AAM).xlateaddr( object_AAM ); - - if(object_UAM) { - SET_NATIVE_FUNC( FindFunctionInObject( object_UAM ) ); - CALL_NATIVE_FUNC( d1, d2, d3, d4, d5, d6, d7, a1, a2, a3, a4, a5, a6); - } - return 1; -#endif - return 0; -} - -static uae_u32 emulib_Minimize (void) -{ - return 0; // OSDEP_minimize_uae(); -} static int native_dos_op(TrapContext *ctx, uae_u32 mode, uae_u32 p1, uae_u32 p2, uae_u32 p3) { - TCHAR tmp[MAX_DPATH]; + TCHAR tmp[MAX_DPATH]; char *s; - int v, i; + int v; - if (mode) - return -1; - /* receive native path from lock - * p1 = dos.library:Lock, p2 = buffer, p3 = max buffer size - */ - v = get_native_path(p1, tmp); - if (v) - return v; - s = ua(tmp); - for (i = 0; i <= strlen(s) && i < p3 - 1; i++) { - put_byte(p2 + i, s[i]); - put_byte(p2 + i + 1, 0); - } - xfree(s); - return 0; + if (mode) + return -1; + /* receive native path from lock + * p1 = dos.library:Lock, p2 = buffer, p3 = max buffer size + */ + v = get_native_path(ctx, p1, tmp); + if (v) + return v; + s = ua (tmp); + trap_put_string(ctx, (uae_u8*)s, p2, p3); + xfree (s); + return 0; } -extern uae_u32 picasso_demux (uae_u32 arg, TrapContext *context); - static uae_u32 uaelib_demux_common(TrapContext *ctx, uae_u32 ARG0, uae_u32 ARG1, uae_u32 ARG2, uae_u32 ARG3, uae_u32 ARG4, uae_u32 ARG5) { switch (ARG0) { - case 0: return emulib_GetVersion(); - case 1: return emulib_GetUaeConfig(ctx, ARG1); - case 2: return emulib_SetUaeConfig(ARG1); - case 3: return emulib_HardReset(); - case 4: return emulib_Reset(); - case 5: return emulib_InsertDisk(ctx, ARG1, ARG2); - case 6: return emulib_EnableSound(ARG1); - case 7: return emulib_EnableJoystick(ARG1); - case 8: return emulib_SetFrameRate(ARG1); - case 9: return emulib_ChgCMemSize(ctx, ARG1); - case 10: return emulib_ChgSMemSize(ctx, ARG1); - case 11: return emulib_ChgFMemSize(ctx, ARG1); - case 12: return emulib_ChangeLanguage(ARG1); - /* The next call brings bad luck */ - case 13: return emulib_ExitEmu(); - case 14: return emulib_GetDisk(ctx, ARG1, ARG2); - case 15: return emulib_Debug(); + case 0: return emulib_GetVersion (); + case 1: return emulib_GetUaeConfig(ctx, ARG1); + case 2: return emulib_SetUaeConfig (ARG1); + case 3: return emulib_HardReset (); + case 4: return emulib_Reset (); + case 5: return emulib_InsertDisk(ctx, ARG1, ARG2); + case 6: return emulib_EnableSound (ARG1); + case 7: return emulib_EnableJoystick (ARG1); + case 8: return emulib_SetFrameRate (ARG1); + case 9: return emulib_ChgCMemSize(ctx, ARG1); + case 10: return emulib_ChgSMemSize(ctx, ARG1); + case 11: return emulib_ChgFMemSize(ctx, ARG1); + case 12: return emulib_ChangeLanguage (ARG1); + /* The next call brings bad luck */ + case 13: return emulib_ExitEmu (); + case 14: return emulib_GetDisk(ctx, ARG1, ARG2); + case 15: return 0; - case 68: return emulib_Minimize(); - case 69: return emulib_ExecuteNativeCode(); + case 68: return 0; + case 69: return 0; - case 70: return 0; /* RESERVED. Something uses this.. */ + case 70: return 0; /* RESERVED. Something uses this.. */ - case 80: - if (!currprefs.maprom) - return 0xffffffff; - /* Disable possible ROM protection */ - //unprotect_maprom(); - return currprefs.maprom; - case 81: return cfgfile_uaelib(ctx, ARG1, ARG2, ARG3, ARG4); - case 82: return cfgfile_uaelib_modify(ctx, ARG1, ARG2, ARG3, ARG4, ARG5); - case 83: currprefs.mmkeyboard = ARG1 ? 1 : 0; return currprefs.mmkeyboard; -#ifdef DEBUGGER - case 84: return mmu_init(ARG1, ARG2, ARG3); -#endif - case 85: return native_dos_op(ctx, ARG1, ARG2, ARG3, ARG4); - case 86: - if (valid_address(ARG1, 1)) { - TCHAR *s = au((char*)get_real_address(ARG1)); - write_log(_T("DBG: %s\n"), s); - xfree(s); - return 1; - } - return 0; - case 87: - { - uae_u32 d0, d1; - d0 = emulib_target_getcpurate(ARG1, &d1); - m68k_dreg(regs, 1) = d1; - return d0; - } - - } - return 0; + case 80: + return 0xffffffff; + case 81: return cfgfile_uaelib(ctx, ARG1, ARG2, ARG3, ARG4); + case 82: return cfgfile_uaelib_modify(ctx, ARG1, ARG2, ARG3, ARG4, ARG5); + case 83: return 0; + case 85: return native_dos_op(ctx, ARG1, ARG2, ARG3, ARG4); + case 86: + if (valid_address(ARG1, 1)) { + uae_char tmp[MAX_DPATH]; + trap_get_string(ctx, tmp, ARG1, sizeof tmp); + TCHAR *s = au(tmp); + write_log (_T("DBG: %s\n"), s); + xfree (s); + return 1; + } + return 0; + case 87: + { + uae_u32 d0, d1; + d0 = emulib_target_getcpurate (ARG1, &d1); + trap_set_dreg(ctx, 1, d1); + return d0; + } + } + return 0; } -uae_u32 uaeboard_demux(uae_u32 *board) +static uae_u32 REGPARAM2 uaelib_demux2 (TrapContext *ctx) { - uae_u32 arg0, arg1, arg2, arg3, arg4, arg5; - - arg0 = do_get_mem_word((uae_u16*)&board[0]); - arg1 = do_get_mem_long(&board[2]); - arg2 = do_get_mem_long(&board[3]); - arg3 = do_get_mem_long(&board[4]); - arg4 = do_get_mem_long(&board[5]); - arg5 = do_get_mem_long(&board[6]); - return uaelib_demux_common(NULL, arg0, arg1, arg2, arg3, arg4, arg5); -} - -static uae_u32 REGPARAM2 uaelib_demux2(TrapContext *ctx) -{ -#define ARG0 (get_long (m68k_areg (regs, 7) + 4)) -#define ARG1 (get_long (m68k_areg (regs, 7) + 8)) -#define ARG2 (get_long (m68k_areg (regs, 7) + 12)) -#define ARG3 (get_long (m68k_areg (regs, 7) + 16)) -#define ARG4 (get_long (m68k_areg (regs, 7) + 20)) -#define ARG5 (get_long (m68k_areg (regs, 7) + 24)) +#define ARG0 (trap_get_long(ctx, trap_get_areg(ctx, 7) + 4)) +#define ARG1 (trap_get_long(ctx, trap_get_areg(ctx, 7) + 8)) +#define ARG2 (trap_get_long(ctx, trap_get_areg(ctx, 7) + 12)) +#define ARG3 (trap_get_long(ctx, trap_get_areg(ctx, 7) + 16)) +#define ARG4 (trap_get_long(ctx, trap_get_areg(ctx, 7) + 20)) +#define ARG5 (trap_get_long(ctx, trap_get_areg(ctx, 7) + 24)) #ifdef PICASSO96 if (ARG0 >= 16 && ARG0 <= 39) @@ -424,11 +367,11 @@ static uae_u32 REGPARAM2 uaelib_demux2(TrapContext *ctx) return uaelib_demux_common(ctx, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5); } -static uae_u32 REGPARAM2 uaelib_demux (TrapContext *context) +static uae_u32 REGPARAM2 uaelib_demux (TrapContext *ctx) { uae_u32 v; - v = uaelib_demux2 (context); + v = uaelib_demux2 (ctx); return v; } @@ -438,15 +381,10 @@ static uae_u32 REGPARAM2 uaelib_demux (TrapContext *context) void emulib_install (void) { uaecptr a; - if (!uae_boot_rom_type) - return; + if (!uae_boot_rom_type) + return; a = here (); org (rtarea_base + 0xFF60); -#if 0 - dw (0x4eb9); - dw ((rtarea_base >> 16) | get_word(rtarea_base + 36)); - dw (get_word(rtarea_base + 38) + 12); -#endif calltrap (deftrapres (uaelib_demux, 0, _T("uaelib_demux"))); dw (RTS); org (a); diff --git a/src/zfile_archive.cpp b/src/zfile_archive.cpp index 6aa56453..bbbb3ac1 100644 --- a/src/zfile_archive.cpp +++ b/src/zfile_archive.cpp @@ -1,14 +1,19 @@ - /* - * UAE - The Un*x Amiga Emulator - * - * transparent archive handling - * - * 2007 Toni Wilen - */ +/* +* UAE - The Un*x Amiga Emulator +* +* transparent archive handling +* +* 2007 Toni Wilen +*/ #include "sysconfig.h" #include "sysdeps.h" +#ifdef _WIN32_ +#include +#include "win32.h" +#endif + #include "options.h" #include "zfile.h" #include "archivers/zip/unzip.h" @@ -21,39 +26,40 @@ #define unpack_log write_log #undef unpack_log -#define unpack_log +#define unpack_log(fmt, ...) -static time_t fromdostime(uae_u32 dd) +static time_t fromdostime (uae_u32 dd) { - struct tm tm; - time_t t; - memset(&tm, 0, sizeof tm); - tm.tm_hour = (dd >> 11) & 0x1f; - tm.tm_min = (dd >> 5) & 0x3f; - tm.tm_sec = ((dd >> 0) & 0x1f) * 2; - tm.tm_year = ((dd >> 25) & 0x7f) + 80; - tm.tm_mon = ((dd >> 21) & 0x0f) - 1; - tm.tm_mday = (dd >> 16) & 0x1f; - t = mktime(&tm); - t -= _timezone; - return t; + struct tm tm; + time_t t; + + memset (&tm, 0, sizeof tm); + tm.tm_hour = (dd >> 11) & 0x1f; + tm.tm_min = (dd >> 5) & 0x3f; + tm.tm_sec = ((dd >> 0) & 0x1f) * 2; + tm.tm_year = ((dd >> 25) & 0x7f) + 80; + tm.tm_mon = ((dd >> 21) & 0x0f) - 1; + tm.tm_mday = (dd >> 16) & 0x1f; + t = mktime (&tm); + t -= _timezone; + return t; } static struct zvolume *getzvolume (struct znode *parent, struct zfile *zf, unsigned int id) { - struct zvolume *zv = NULL; + struct zvolume *zv = NULL; - switch (id) - { + switch (id) + { #ifdef A_ZIP case ArchiveFormatZIP: - zv = archive_directory_zip (zf); - break; + zv = archive_directory_zip (zf); + break; #endif #ifdef A_7Z case ArchiveFormat7Zip: - zv = archive_directory_7z (zf); - break; + zv = archive_directory_7z (zf); + break; #endif #ifdef A_RAR case ArchiveFormatRAR: @@ -62,20 +68,20 @@ static struct zvolume *getzvolume (struct znode *parent, struct zfile *zf, unsig #endif #ifdef A_LHA case ArchiveFormatLHA: - zv = archive_directory_lha (zf); - break; + zv = archive_directory_lha (zf); + break; #endif #ifdef A_LZX case ArchiveFormatLZX: - zv = archive_directory_lzx (zf); - break; + zv = archive_directory_lzx (zf); + break; #endif case ArchiveFormatPLAIN: - zv = archive_directory_plain (zf); - break; + zv = archive_directory_plain (zf); + break; case ArchiveFormatADF: - zv = archive_directory_adf (parent, zf); - break; + zv = archive_directory_adf (parent, zf); + break; case ArchiveFormatRDB: zv = archive_directory_rdb (zf); break; @@ -85,81 +91,81 @@ static struct zvolume *getzvolume (struct znode *parent, struct zfile *zf, unsig case ArchiveFormatFAT: zv = archive_directory_fat (zf); break; - } + } #ifdef ARCHIVEACCESS if (!zv) zv = archive_directory_arcacc (zf, id); #endif - return zv; + return zv; } struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, unsigned int id, int dodefault, int *retcode, int index) { - struct zvolume *zv; - struct znode *zn; - int zipcnt, first, select; - TCHAR tmphist[MAX_DPATH]; - struct zfile *z = NULL; - int we_have_file; + struct zvolume *zv; + struct znode *zn; + int zipcnt, first, select; + TCHAR tmphist[MAX_DPATH]; + struct zfile *z = NULL; + int we_have_file; int diskimg; int mask = zf->zfdmask; int canhistory = (mask & ZFD_DISKHISTORY) && !(mask & ZFD_CHECKONLY); int getflag = (mask & ZFD_DELAYEDOPEN) ? FILE_DELAYEDOPEN : 0; - if (retcode) - *retcode = 0; - if (index > 0) - return NULL; + if (retcode) + *retcode = 0; + if (index > 0) + return NULL; if (zfile_needwrite (zf)) { if (retcode) *retcode = -1; return NULL; } - zv = getzvolume (parent, zf, id); - if (!zv) - return NULL; - we_have_file = 0; - tmphist[0] = 0; - zipcnt = 1; - first = 1; - zn = &zv->root; - while (zn) { + zv = getzvolume (parent, zf, id); + if (!zv) + return NULL; + we_have_file = 0; + tmphist[0] = 0; + zipcnt = 1; + first = 1; + zn = &zv->root; + while (zn) { int isok = 1; - + diskimg = -1; - if (zn->type != ZNODE_FILE) - isok = 0; - if (zfile_is_ignore_ext(zn->fullname)) - isok = 0; + if (zn->type != ZNODE_FILE) + isok = 0; + if (zfile_is_ignore_ext (zn->fullname)) + isok = 0; diskimg = zfile_is_diskimage (zn->fullname); - if (isok) { - if (tmphist[0]) { + if (isok) { + if (tmphist[0]) { #ifndef _CONSOLE - if (diskimg >= 0&& canhistory) - DISK_history_add (tmphist, -1, diskimg, 1); + if (diskimg >= 0 && canhistory) + DISK_history_add (tmphist, -1, diskimg, 1); #endif - tmphist[0] = 0; - first = 0; - } - if (first) { + tmphist[0] = 0; + first = 0; + } + if (first) { if (diskimg >= 0) - _tcscpy (tmphist, zn->fullname); - } else { - _tcscpy (tmphist, zn->fullname); + _tcscpy (tmphist, zn->fullname); + } else { + _tcscpy (tmphist, zn->fullname); #ifndef _CONSOLE - if (diskimg >= 0&& canhistory) - DISK_history_add (tmphist, -1, diskimg, 1); + if (diskimg >= 0 && canhistory) + DISK_history_add (tmphist, -1, diskimg, 1); #endif - tmphist[0] = 0; - } - select = 0; - if (!zf->zipname) - select = 1; - if (zf->zipname && _tcslen (zn->fullname) >= _tcslen (zf->zipname) && !strcasecmp (zf->zipname, zn->fullname + _tcslen (zn->fullname) - _tcslen (zf->zipname))) - select = -1; - if (zf->zipname && zf->zipname[0] == '#' && _tstol (zf->zipname + 1) == zipcnt) - select = -1; - if (select && we_have_file < 10) { + tmphist[0] = 0; + } + select = 0; + if (!zf->zipname) + select = 1; + if (zf->zipname && _tcslen (zn->fullname) >= _tcslen (zf->zipname) && !strcasecmp (zf->zipname, zn->fullname + _tcslen (zn->fullname) - _tcslen (zf->zipname))) + select = -1; + if (zf->zipname && zf->zipname[0] == '#' && _tstol (zf->zipname + 1) == zipcnt) + select = -1; + if (select && we_have_file < 10) { struct zfile *zt = NULL; TCHAR *ext = _tcsrchr (zn->fullname, '.'); int whf = 1; @@ -169,12 +175,10 @@ struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, uns whf = 2; ft = ZFILE_CDIMAGE; } -#ifdef WITH_CHD if (ext && !_tcsicmp (ext, _T(".chd"))) { whf = 2; ft = ZFILE_CDIMAGE; } -#endif if (ext && !_tcsicmp (ext, _T(".ccd"))) { whf = 9; ft = ZFILE_CDIMAGE; @@ -188,8 +192,8 @@ struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, uns ft = zfile_gettype (zt); } if ((select < 0 || ft) && whf > we_have_file) { - if (!zt) - zt = archive_getzfile (zn, id, getflag); + if (!zt) + zt = archive_getzfile (zn, id, getflag); we_have_file = whf; if (z) zfile_fclose (z); @@ -197,28 +201,28 @@ struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, uns zt = NULL; } zfile_fclose (zt); - } - } - zipcnt++; - zn = zn->next; - } + } + } + zipcnt++; + zn = zn->next; + } #ifndef _CONSOLE diskimg = zfile_is_diskimage (zfile_getname (zf)); if (diskimg >= 0 && first && tmphist[0] && canhistory) DISK_history_add (zfile_getname (zf), -1, diskimg, 1); #endif - zfile_fclose_archive (zv); - if (z) { - zfile_fclose(zf); - zf = z; - } else if (!dodefault && zf->zipname && zf->zipname[0]) { - if (retcode) - *retcode = -1; - zf = NULL; + zfile_fclose_archive (zv); + if (z) { + zfile_fclose (zf); + zf = z; + } else if (!dodefault && zf->zipname && zf->zipname[0]) { + if (retcode) + *retcode = -1; + zf = NULL; } else { - zf = NULL; - } - return zf; + zf = NULL; + } + return zf; } struct zfile *archive_access_arcacc_select (struct zfile *zf, unsigned int id, int *retcode) @@ -233,31 +237,31 @@ struct zfile *archive_access_arcacc_select (struct zfile *zf, unsigned int id, i void archive_access_scan (struct zfile *zf, zfile_callback zc, void *user, unsigned int id) { - struct zvolume *zv; - struct znode *zn; + struct zvolume *zv; + struct znode *zn; - zv = getzvolume (NULL, zf, id); - if (!zv) - return; - zn = &zv->root; - while (zn) { - if (zn->type == ZNODE_FILE) { - struct zfile *zf2 = archive_getzfile (zn, id, 0); - if (zf2) { - int ztype = iszip (zf2); - if (ztype) { - zfile_fclose (zf2); - } else { - int ret = zc (zf2, user); - zfile_fclose(zf2); - if (ret) - break; - } - } - } - zn = zn->next; - } - zfile_fclose_archive (zv); + zv = getzvolume (NULL, zf, id); + if (!zv) + return; + zn = &zv->root; + while (zn) { + if (zn->type == ZNODE_FILE) { + struct zfile *zf2 = archive_getzfile (zn, id, 0); + if (zf2) { + int ztype = iszip (zf2); + if (ztype) { + zfile_fclose (zf2); + } else { + int ret = zc (zf2, user); + zfile_fclose (zf2); + if (ret) + break; + } + } + } + zn = zn->next; + } + zfile_fclose_archive (zv); } /* TAR */ @@ -317,7 +321,7 @@ struct zvolume *archive_directory_tar (struct zfile *z) if (zn) zn->offset = zfile_ftell (z); } - xfree ((char*)zai.name); + xfree (zai.name); } zfile_fseek (z, (size + 511) & ~511, SEEK_CUR); } @@ -327,14 +331,7 @@ struct zvolume *archive_directory_tar (struct zfile *z) struct zfile *archive_access_tar (struct znode *zn) { -#if 0 - struct zfile *zf = zfile_fopen_empty (zn->volume->archive, zn->fullname, zn->size); - zfile_fseek (zn->volume->archive, zn->offset, SEEK_SET); - zfile_fwrite (zf->data, zn->size, 1, zn->volume->archive); - return zf; -#else return zfile_fopen_parent (zn->volume->archive, zn->fullname, zn->offset, zn->size); -#endif } /* ZIP */ @@ -346,59 +343,59 @@ static void archive_close_zip (void *handle) struct zvolume *archive_directory_zip (struct zfile *z) { - unzFile uz; - unz_file_info file_info; - struct zvolume *zv; - int err; + unzFile uz; + unz_file_info file_info; + struct zvolume *zv; + int err; - uz = unzOpen (z); - if (!uz) - return 0; - if (unzGoToFirstFile (uz) != UNZ_OK) - return 0; - zv = zvolume_alloc(z, ArchiveFormatZIP, NULL, NULL); - for (;;) { + uz = unzOpen (z); + if (!uz) + return 0; + if (unzGoToFirstFile (uz) != UNZ_OK) + return 0; + zv = zvolume_alloc (z, ArchiveFormatZIP, NULL, NULL); + for (;;) { char filename_inzip2[MAX_DPATH]; - TCHAR c; - struct zarchive_info zai; - time_t t; - unsigned int dd; + TCHAR c; + struct zarchive_info zai; + time_t t; + unsigned int dd; TCHAR *filename_inzip; err = unzGetCurrentFileInfo (uz, &file_info, filename_inzip2, sizeof (filename_inzip2), NULL, 0, NULL, 0); - if (err != UNZ_OK) - return 0; + if (err != UNZ_OK) + return 0; if (file_info.flag & (1 << 11)) { // UTF-8 encoded filename_inzip = utf8u (filename_inzip2); } else { filename_inzip = au (filename_inzip2); } - dd = file_info.dosDate; - t = fromdostime(dd); - memset(&zai, 0, sizeof zai); - zai.name = filename_inzip; + dd = file_info.dosDate; + t = fromdostime (dd); + memset (&zai, 0, sizeof zai); + zai.name = filename_inzip; zai.tv.tv_sec = t; - zai.flags = -1; - c = filename_inzip[_tcslen(filename_inzip) - 1]; - if (c != '/' && c != '\\') { - int err = unzOpenCurrentFile (uz); - if (err == UNZ_OK) { - struct znode *zn; - zai.size = file_info.uncompressed_size; - zn = zvolume_addfile_abs(zv, &zai); - } - } else { - filename_inzip[_tcslen (filename_inzip) - 1] = 0; - zvolume_adddir_abs(zv, &zai); - } + zai.flags = -1; + c = filename_inzip[_tcslen (filename_inzip) - 1]; + if (c != '/' && c != '\\') { + int err = unzOpenCurrentFile (uz); + if (err == UNZ_OK) { + struct znode *zn; + zai.size = file_info.uncompressed_size; + zn = zvolume_addfile_abs (zv, &zai); + } + } else { + filename_inzip[_tcslen (filename_inzip) - 1] = 0; + zvolume_adddir_abs (zv, &zai); + } xfree (filename_inzip); - err = unzGoToNextFile (uz); - if (err != UNZ_OK) - break; - } - unzClose (uz); - zv->method = ArchiveFormatZIP; - return zv; + err = unzGoToNextFile (uz); + if (err != UNZ_OK) + break; + } + unzClose (uz); + zv->method = ArchiveFormatZIP; + return zv; } @@ -481,72 +478,83 @@ static struct zfile *archive_unpack_zip (struct zfile *zf) return archive_do_zip (NULL, zf, 0); } #endif - + #ifdef A_7Z /* 7Z */ -#include "archivers/7z/Types.h" -#include "archivers/7z/7zCrc.h" -#include "archivers/7z/7zIn.h" -#include "archivers/7z/7zExtract.h" -#include "archivers/7z/7zAlloc.h" +#include "7z/7z.h" +#include "7z/Alloc.h" +#include "7z/7zFile.h" +#include "7z/7zVersion.h" +#include "7z/7zCrc.h" + +static void *SzAlloc (void *p, size_t size) +{ + return xmalloc (uae_u8, size); +} +static void SzFree(void *p, void *address) +{ + xfree (address); +} static ISzAlloc allocImp; static ISzAlloc allocTempImp; -typedef struct -{ - ISeekInStream s; - struct zfile *zf; -} CFileInStream; - static SRes SzFileReadImp (void *object, void *buffer, size_t *size) { - CFileInStream *s = (CFileInStream *)object; - struct zfile *zf = s->zf; - *size = zfile_fread (buffer, 1, *size, zf); - return SZ_OK; + CFileInStream *s = (CFileInStream *)object; +#ifdef WIN32 + struct zfile *zf = (struct zfile*)s->file.myhandle; +#else + struct zfile *zf = (struct zfile*)s->file.file; +#endif + *size = zfile_fread (buffer, 1, *size, zf); + return SZ_OK; } static SRes SzFileSeekImp(void *object, Int64 *pos, ESzSeek origin) { - CFileInStream *s = (CFileInStream *)object; - struct zfile *zf = s->zf; - int org = 0; - switch (origin) - { - case SZ_SEEK_SET: org = SEEK_SET; break; - case SZ_SEEK_CUR: org = SEEK_CUR; break; - case SZ_SEEK_END: org = SEEK_END; break; - } - zfile_fseek (zf, *pos, org); - *pos = zfile_ftell (zf); - return SZ_OK; + CFileInStream *s = (CFileInStream *)object; +#ifdef WIN32 + struct zfile *zf = (struct zfile*)s->file.myhandle; +#else + struct zfile *zf =(struct zfile*) s->file.file; +#endif + int org = 0; + switch (origin) + { + case SZ_SEEK_SET: org = SEEK_SET; break; + case SZ_SEEK_CUR: org = SEEK_CUR; break; + case SZ_SEEK_END: org = SEEK_END; break; + } + zfile_fseek (zf, *pos, org); + *pos = zfile_ftell (zf); + return SZ_OK; } -static void init_7z(void) +static void init_7z (void) { - static int initialized; - - if (initialized) - return; - initialized = 1; - allocImp.Alloc = SzAlloc; - allocImp.Free = SzFree; - allocTempImp.Alloc = SzAllocTemp; - allocTempImp.Free = SzFreeTemp; - CrcGenerateTable (); - _tzset (); + static int initialized; + + if (initialized) + return; + initialized = 1; + allocImp.Alloc = SzAlloc; + allocImp.Free = SzFree; + allocTempImp.Alloc = SzAlloc; + allocTempImp.Free = SzFree; + CrcGenerateTable (); + _tzset (); } struct SevenZContext { - CSzArEx db; - CFileInStream archiveStream; - CLookToRead lookStream; - Byte *outBuffer; - size_t outBufferSize; - UInt32 blockIndex; + CSzArEx db; + CFileInStream archiveStream; + CLookToRead lookStream; + Byte *outBuffer; + size_t outBufferSize; + UInt32 blockIndex; }; static void archive_close_7z (void *ctx) @@ -554,7 +562,7 @@ static void archive_close_7z (void *ctx) struct SevenZContext *ctx7 = (struct SevenZContext*)ctx; SzArEx_Free (&ctx7->db, &allocImp); allocImp.Free (&allocImp, ctx7->outBuffer); - xfree(ctx); + xfree (ctx); } #define EPOCH_DIFF 0x019DB1DED53E8000LL /* 116444736000000000 nsecs */ @@ -562,81 +570,86 @@ static void archive_close_7z (void *ctx) struct zvolume *archive_directory_7z (struct zfile *z) { - SRes res; - struct zvolume *zv; - int i; - struct SevenZContext *ctx; + SRes res; + struct zvolume *zv; + int i; + struct SevenZContext *ctx; - init_7z(); - ctx = xcalloc (struct SevenZContext, 1); - ctx->blockIndex = 0xffffffff; - ctx->archiveStream.s.Read = SzFileReadImp; - ctx->archiveStream.s.Seek = SzFileSeekImp; - ctx->archiveStream.zf = z; - LookToRead_CreateVTable (&ctx->lookStream, False); - ctx->lookStream.realStream = &ctx->archiveStream.s; - LookToRead_Init (&ctx->lookStream); + init_7z (); + ctx = xcalloc (struct SevenZContext, 1); + ctx->blockIndex = 0xffffffff; + ctx->archiveStream.s.Read = SzFileReadImp; + ctx->archiveStream.s.Seek = SzFileSeekImp; +#ifdef WIN32 + ctx->archiveStream.file.myhandle = (void*)z; +#else + ctx->archiveStream.file.file = (FILE*)z; +#endif + LookToRead_CreateVTable (&ctx->lookStream, False); + ctx->lookStream.realStream = &ctx->archiveStream.s; + LookToRead_Init (&ctx->lookStream); - SzArEx_Init (&ctx->db); - res = SzArEx_Open (&ctx->db, &ctx->lookStream.s, &allocImp, &allocTempImp); - if (res != SZ_OK) { - write_log(_T("7Z: SzArchiveOpen %s returned %d\n"), zfile_getname(z), res); - xfree (ctx); - return NULL; - } - zv = zvolume_alloc (z, ArchiveFormat7Zip, ctx, NULL); - for (i = 0; i < ctx->db.db.NumFiles; i++) { - CSzFileItem *f = ctx->db.db.Files + i; - TCHAR *name = f->Name; - struct zarchive_info zai; + SzArEx_Init (&ctx->db); + res = SzArEx_Open (&ctx->db, &ctx->lookStream.s, &allocImp, &allocTempImp); + if (res != SZ_OK) { + write_log (_T("7Z: SzArchiveOpen %s returned %d\n"), zfile_getname (z), res); + xfree (ctx); + return NULL; + } + zv = zvolume_alloc (z, ArchiveFormat7Zip, ctx, NULL); + for (i = 0; i < ctx->db.db.NumFiles; i++) { + CSzFileItem *f = ctx->db.db.Files + i; + TCHAR *name = (TCHAR*)(ctx->db.FileNames.data + ctx->db.FileNameOffsets[i] * 2); + struct zarchive_info zai; - memset(&zai, 0, sizeof zai); - zai.name = name; - zai.flags = -1; - zai.size = f->Size; - if (f->MTimeDefined) { - uae_u64 t = (((uae_u64)f->MTime.High) << 32) | f->MTime.Low; - if (t >= EPOCH_DIFF) { + memset(&zai, 0, sizeof zai); + zai.name = name; + zai.flags = f->AttribDefined ? f->Attrib : -1; + zai.size = f->Size; + if (f->MTimeDefined) { + uae_u64 t = (((uae_u64)f->MTime.High) << 32) | f->MTime.Low; + if (t >= EPOCH_DIFF) { zai.tv.tv_sec = (t - EPOCH_DIFF) / RATE_DIFF; zai.tv.tv_sec -= _timezone; - if (_daylight) + if (_daylight) zai.tv.tv_sec += 1 * 60 * 60; - } - } - if (!f->IsDir) { - struct znode *zn = zvolume_addfile_abs(zv, &zai); - zn->offset = i; - } - } - zv->method = ArchiveFormat7Zip; - return zv; + } + } + if (!f->IsDir) { + struct znode *zn = zvolume_addfile_abs (zv, &zai); + if (zn) + zn->offset = i; + } + } + zv->method = ArchiveFormat7Zip; + return zv; } static struct zfile *archive_access_7z (struct znode *zn) { - SRes res; - struct zvolume *zv = zn->volume; - struct zfile *z = NULL; - size_t offset; - size_t outSizeProcessed; - struct SevenZContext *ctx; + SRes res; + struct zvolume *zv = zn->volume; + struct zfile *z = NULL; + size_t offset; + size_t outSizeProcessed; + struct SevenZContext *ctx; z = zfile_fopen_empty (NULL, zn->fullname, zn->size); if (!z) return NULL; - ctx = (struct SevenZContext *) zv->handle; - res = SzAr_Extract (&ctx->db, &ctx->lookStream.s, zn->offset, - &ctx->blockIndex, &ctx->outBuffer, &ctx->outBufferSize, - &offset, &outSizeProcessed, - &allocImp, &allocTempImp); - if (res == SZ_OK) { - zfile_fwrite (ctx->outBuffer + offset, zn->size, 1, z); - } else { - write_log(_T("7Z: SzExtract %s returned %d\n"), zn->fullname, res); + ctx = (struct SevenZContext*)zv->handle; + res = SzArEx_Extract (&ctx->db, &ctx->lookStream.s, zn->offset, + &ctx->blockIndex, &ctx->outBuffer, &ctx->outBufferSize, + &offset, &outSizeProcessed, + &allocImp, &allocTempImp); + if (res == SZ_OK) { + zfile_fwrite (ctx->outBuffer + offset, zn->size, 1, z); + } else { + write_log (_T("7Z: SzExtract %s returned %d\n"), zn->fullname, res); zfile_fclose (z); z = NULL; - } - return z; + } + return z; } #endif @@ -665,7 +678,7 @@ static int canrar (void) if (israr == 0) { israr = -1; -#ifdef _WIN32 +#ifdef _WIN32_ { HMODULE rarlib; @@ -699,7 +712,7 @@ static int canrar (void) return israr < 0 ? 0 : 1; } -static int CALLBACK RARCallbackProc (UINT msg,LONG UserData,LONG P1,LONG P2) +static int CALLBACK RARCallbackProc (UINT msg, LONG UserData, LONG P1, LONG P2) { if (msg == UCM_PROCESSDATA) { zfile_fwrite ((uae_u8*)P1, 1, P2, rarunpackzf); @@ -723,6 +736,9 @@ static void archive_close_rar (void *ctx) struct zvolume *archive_directory_rar (struct zfile *z) { +#ifdef WIN64 + return archive_directory_arcacc (z, ArchiveFormatRAR); +#else struct zvolume *zv; struct RARContext *rc; struct zfile *zftmp; @@ -753,7 +769,8 @@ struct zvolume *archive_directory_rar (struct zfile *z) zai.flags = -1; zai.tv.tv_sec = fromdostime (rc->HeaderData.FileTime); zn = zvolume_addfile_abs (zv, &zai); - zn->offset = cnt++; + if (zn) + zn->offset = cnt++; pRARProcessFile (rc->hArcData, RAR_SKIP, NULL, NULL); } pRARCloseArchive (rc->hArcData); @@ -761,10 +778,12 @@ struct zvolume *archive_directory_rar (struct zfile *z) zv->archive = zftmp; zv->method = ArchiveFormatRAR; return zv; +#endif } static struct zfile *archive_access_rar (struct znode *zn) { +#ifndef WIN64 struct RARContext *rc = (struct RARContext*)zn->volume->handle; int i; struct zfile *zf = NULL; @@ -795,6 +814,9 @@ static struct zfile *archive_access_rar (struct znode *zn) end: pRARCloseArchive(rc->hArcData); return zf; +#else + return NULL; +#endif } #endif @@ -837,7 +859,7 @@ static aapGetFileInfo aaGetFileInfo; static aapExtract aaExtract; static aapCloseArchive aaCloseArchive; -#ifdef _WIN32 +#ifdef _WIN32_ static HMODULE arcacc_mod; static void arcacc_free (void) @@ -944,9 +966,11 @@ struct zvolume *archive_directory_arcacc (struct zfile *z, unsigned int id) zai.flags = -1; zai.size = (unsigned int)fi.UncompressedFileSize; zn = zvolume_addfile_abs (zv, &zai); - xfree (name); - zn->offset = f; - zn->method = id; + if (zn) { + zn->offset = f; + zn->method = id; + } + xfree(name); if (id == ArchiveFormat7Zip) { if (fi.CompressedFileSize) @@ -998,71 +1022,72 @@ static struct zfile *archive_access_arcacc (struct znode *zn) static struct znode *addfile (struct zvolume *zv, struct zfile *zf, const TCHAR *path, uae_u8 *data, int size) { - struct zarchive_info zai; - struct znode *zn; - struct zfile *z; + struct zarchive_info zai; + struct znode *zn; + struct zfile *z; - z = zfile_fopen_empty (zf, path, size); + z = zfile_fopen_empty (zf, path, size); if (!z) return NULL; - zfile_fwrite(data, size, 1, z); - memset(&zai, 0, sizeof zai); + zfile_fwrite (data, size, 1, z); + memset (&zai, 0, sizeof zai); zai.name = my_strdup (path); - zai.flags = -1; - zai.size = size; - zn = zvolume_addfile_abs(zv, &zai); - if (zn) - zn->f = z; - else - zfile_fclose(z); - xfree ((char*)zai.name); - return zn; + zai.flags = -1; + zai.size = size; + zn = zvolume_addfile_abs (zv, &zai); + if (zn) + zn->f = z; + else + zfile_fclose (z); + xfree (zai.name); + return zn; } static uae_u8 exeheader[]={0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00}; struct zvolume *archive_directory_plain (struct zfile *z) { - struct zfile *zf, *zf2; - struct zvolume *zv; - struct znode *zn; - struct zarchive_info zai; - uae_u8 id[8]; + struct zfile *zf, *zf2; + struct zvolume *zv; + struct znode *zn; + struct zarchive_info zai; + uae_u8 id[8]; int rc, index; - memset(&zai, 0, sizeof zai); - zv = zvolume_alloc(z, ArchiveFormatPLAIN, NULL, NULL); - memset(id, 0, sizeof id); - zai.name = zfile_getfilename (z); - zai.flags = -1; - zfile_fseek(z, 0, SEEK_END); - zai.size = zfile_ftell(z); - zfile_fseek(z, 0, SEEK_SET); - zfile_fread(id, sizeof id, 1, z); - zfile_fseek(z, 0, SEEK_SET); - zn = zvolume_addfile_abs(zv, &zai); - if (!memcmp (id, exeheader, sizeof id)) { + memset (&zai, 0, sizeof zai); + zv = zvolume_alloc (z, ArchiveFormatPLAIN, NULL, NULL); + memset(id, 0, sizeof id); + zai.name = zfile_getfilename (z); + zai.flags = -1; + zfile_fseek(z, 0, SEEK_END); + zai.size = zfile_ftell (z); + zfile_fseek(z, 0, SEEK_SET); + zfile_fread(id, sizeof id, 1, z); + zfile_fseek(z, 0, SEEK_SET); + zn = zvolume_addfile_abs (zv, &zai); + if (!memcmp (id, exeheader, sizeof id)) { char *an = ua (zai.name); char *data = xmalloc (char, 1 + strlen (an) + 1 + 1 + 1); sprintf (data, "\"%s\"\n", an); - zn = addfile (zv, z, _T("s/startup-sequence"), (uae_u8*)data, strlen (data)); - xfree(data); + zn = addfile (zv, z, _T("s/startup-sequence"), (uae_u8*)data, strlen (data)); + xfree (data); xfree (an); - } + } index = 0; for (;;) { - zf = zfile_dup (z); + zf = zfile_dup (z); if (!zf) break; zf2 = zuncompress (NULL, zf, 0, ZFD_ALL & ~ZFD_ADF, &rc, index); - if (zf2) { - zf = NULL; - zai.name = zfile_getfilename (zf2); - zai.flags = -1; - zfile_fseek (zf2, 0, SEEK_END); - zai.size = zfile_ftell (zf2); - zfile_fseek (zf2, 0, SEEK_SET); - zn = zvolume_addfile_abs (zv, &zai); - zn->f = zf2; + if (zf2) { + zf = NULL; + zai.name = zfile_getfilename (zf2); + zai.flags = -1; + zfile_fseek (zf2, 0, SEEK_END); + zai.size = zfile_ftell (zf2); + zfile_fseek (zf2, 0, SEEK_SET); + zn = zvolume_addfile_abs (zv, &zai); + if (zn) + zn->f = zf2; // if (zn) // zn->offset = index + 1; // zfile_fclose (zf2); @@ -1071,567 +1096,568 @@ struct zvolume *archive_directory_plain (struct zfile *z) zfile_fclose (zf); break; } - } + } index++; - zfile_fclose (zf); + zfile_fclose (zf); } - return zv; + return zv; } - static struct zfile *archive_access_plain (struct znode *zn) { - struct zfile *z; + struct zfile *z; - if (zn->offset) { - struct zfile *zf; - z = zfile_fopen_empty (zn->volume->archive, zn->fullname, zn->size); - zf = zfile_fopen (zfile_getname (zn->volume->archive), _T("rb"), zn->volume->archive->zfdmask & ~ZFD_ADF, zn->offset - 1); - if (zf) { - zfile_fread (z->data, zn->size, 1, zf); - zfile_fclose (zf); - } - } else { - z = zfile_fopen_empty (zn->volume->archive, zn->fullname, zn->size); - if (z) { - zfile_fseek (zn->volume->archive, 0, SEEK_SET); - zfile_fread(z->data, zn->size, 1, zn->volume->archive); - } - } - return z; + if (zn->offset) { + struct zfile *zf; + z = zfile_fopen_empty (zn->volume->archive, zn->fullname, zn->size); + zf = zfile_fopen (zfile_getname (zn->volume->archive), _T("rb"), zn->volume->archive->zfdmask & ~ZFD_ADF, zn->offset - 1); + if (zf) { + zfile_fread (z->data, zn->size, 1, zf); + zfile_fclose (zf); + } + } else { + z = zfile_fopen_empty (zn->volume->archive, zn->fullname, zn->size); + if (z) { + zfile_fseek (zn->volume->archive, 0, SEEK_SET); + zfile_fread (z->data, zn->size, 1, zn->volume->archive); + } + } + return z; } struct adfhandle { - int size; - int highblock; - int blocksize; - int rootblock; - struct zfile *z; - uae_u8 block[65536]; - uae_u32 dostype; + int size; + int highblock; + int blocksize; + int rootblock; + struct zfile *z; + uae_u8 block[65536]; + uae_u32 dostype; }; static int dos_checksum (uae_u8 *p, int blocksize) { - uae_u32 cs = 0; - int i; - for (i = 0; i < blocksize; i += 4) - cs += (p[i] << 24) | (p[i + 1] << 16) | (p[i + 2] << 8) | (p[i + 3] << 0); - return cs; + uae_u32 cs = 0; + int i; + for (i = 0; i < blocksize; i += 4) + cs += (p[i] << 24) | (p[i + 1] << 16) | (p[i + 2] << 8) | (p[i + 3] << 0); + return cs; } static int sfs_checksum (uae_u8 *p, int blocksize, int sfs2) { - uae_u32 cs = sfs2 ? 2 : 1; - int i; - for (i = 0; i < blocksize; i += 4) - cs += (p[i] << 24) | (p[i + 1] << 16) | (p[i + 2] << 8) | (p[i + 3] << 0); - return cs; + uae_u32 cs = sfs2 ? 2 : 1; + int i; + for (i = 0; i < blocksize; i += 4) + cs += (p[i] << 24) | (p[i + 1] << 16) | (p[i + 2] << 8) | (p[i + 3] << 0); + return cs; } static TCHAR *getBSTR (uae_u8 *bstr) { - int n = *bstr++; - uae_char buf[257]; - int i; + int n = *bstr++; + uae_char buf[257]; + int i; - for (i = 0; i < n; i++) - buf[i] = *bstr++; - buf[i] = 0; + for (i = 0; i < n; i++) + buf[i] = *bstr++; + buf[i] = 0; return au (buf); } static uae_u32 gl (struct adfhandle *adf, int off) { - uae_u8 *p = adf->block + off; - return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3] << 0); + uae_u8 *p = adf->block + off; + return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3] << 0); } static uae_u32 glx (uae_u8 *p) { - return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3] << 0); + return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3] << 0); } static uae_u32 gwx (uae_u8 *p) { - return (p[0] << 8) | (p[1] << 0); + return (p[0] << 8) | (p[1] << 0); } static const int secs_per_day = 24 * 60 * 60; static const int diff = (8 * 365 + 2) * (24 * 60 * 60); static const int diff2 = (-8 * 365 - 2) * (24 * 60 * 60); + static time_t put_time (long days, long mins, long ticks) { - time_t t; + time_t t; - if (days < 0) - days = 0; - if (days > 9900 * 365) - days = 9900 * 365; // in future far enough? - if (mins < 0 || mins >= 24 * 60) - mins = 0; - if (ticks < 0 || ticks >= 60 * 50) - ticks = 0; + if (days < 0) + days = 0; + if (days > 9900 * 365) + days = 9900 * 365; // in future far enough? + if (mins < 0 || mins >= 24 * 60) + mins = 0; + if (ticks < 0 || ticks >= 60 * 50) + ticks = 0; - t = ticks / 50; - t += mins * 60; - t += ((uae_u64)days) * secs_per_day; - t += diff; + t = ticks / 50; + t += mins * 60; + t += ((uae_u64)days) * secs_per_day; + t += diff; - return t; + return t; } static int adf_read_block (struct adfhandle *adf, int block) { - memset (adf->block, 0, adf->blocksize); - if (block >= adf->highblock || block < 0) - return 0; - zfile_fseek (adf->z, block * adf->blocksize, SEEK_SET); - zfile_fread (adf->block, adf->blocksize, 1, adf->z); - return 1; + memset (adf->block, 0, adf->blocksize); + if (block >= adf->highblock || block < 0) + return 0; + zfile_fseek (adf->z, block * adf->blocksize, SEEK_SET); + zfile_fread (adf->block, adf->blocksize, 1, adf->z); + return 1; } static void recurseadf (struct znode *zn, int root, TCHAR *name) { - int i; - struct zvolume *zv = zn->volume; - struct adfhandle *adf = (struct adfhandle *)zv->handle; - TCHAR name2[MAX_DPATH]; - int bs = adf->blocksize; + int i; + struct zvolume *zv = zn->volume; + struct adfhandle *adf = (struct adfhandle*)zv->handle; + TCHAR name2[MAX_DPATH]; + int bs = adf->blocksize; - for (i = 0; i < bs / 4 - 56; i++) { - int block; - if (!adf_read_block (adf, root)) - return; - block = gl (adf, (i + 6) * 4); - while (block > 0 && block < adf->size / bs) { - struct zarchive_info zai; - TCHAR *fname; - uae_u32 size, secondary; + for (i = 0; i < bs / 4 - 56; i++) { + int block; + if (!adf_read_block (adf, root)) + return; + block = gl (adf, (i + 6) * 4); + while (block > 0 && block < adf->size / bs) { + struct zarchive_info zai; + TCHAR *fname; + uae_u32 size, secondary; - if (!adf_read_block (adf, block)) - return; - if (gl (adf, 0) != 2) - break; - if (gl (adf, 1 * 4) != block) - break; - secondary = gl (adf, bs - 1 * 4); - if (secondary != -3 && secondary != 2) - break; - memset (&zai, 0, sizeof zai); - fname = getBSTR (adf->block + bs - 20 * 4); - size = gl (adf, bs - 47 * 4); - name2[0] = 0; - if (name[0]) { - TCHAR sep[] = { FSDB_DIR_SEPARATOR, 0 }; - _tcscpy (name2, name); - _tcscat (name2, sep); - } - _tcscat (name2, fname); - zai.name = name2; - if (size < 0 || size > 0x7fffffff) - size = 0; - zai.size = size; - zai.flags = gl (adf, bs - 48 * 4); - amiga_to_timeval (&zai.tv, gl (adf, bs - 23 * 4), gl (adf, bs - 22 * 4),gl (adf, bs - 21 * 4)); - if (secondary == -3) { - struct znode *znnew = zvolume_addfile_abs (zv, &zai); - znnew->offset = block; - } else { - struct znode *znnew = zvolume_adddir_abs (zv, &zai); - znnew->offset = block; - recurseadf (znnew, block, name2); - if (!adf_read_block (adf, block)) - return; - } - xfree (fname); - block = gl (adf, bs - 4 * 4); - } - } + if (!adf_read_block (adf, block)) + return; + if (gl (adf, 0) != 2) + break; + if (gl (adf, 1 * 4) != block) + break; + secondary = gl (adf, bs - 1 * 4); + if (secondary != -3 && secondary != 2) + break; + memset (&zai, 0, sizeof zai); + fname = getBSTR (adf->block + bs - 20 * 4); + size = gl (adf, bs - 47 * 4); + name2[0] = 0; + if (name[0]) { + TCHAR sep[] = { FSDB_DIR_SEPARATOR, 0 }; + _tcscpy (name2, name); + _tcscat (name2, sep); + } + _tcscat (name2, fname); + zai.name = name2; + if (size < 0 || size > 0x7fffffff) + size = 0; + zai.size = size; + zai.flags = gl (adf, bs - 48 * 4); + amiga_to_timeval (&zai.tv, gl (adf, bs - 23 * 4), gl (adf, bs - 22 * 4),gl (adf, bs - 21 * 4), 50); + if (secondary == -3) { + struct znode *znnew = zvolume_addfile_abs (zv, &zai); + if (znnew) + znnew->offset = block; + } else { + struct znode *znnew = zvolume_adddir_abs (zv, &zai); + if (znnew) { + znnew->offset = block; + recurseadf (znnew, block, name2); + } + if (!adf_read_block (adf, block)) + return; + } + xfree (fname); + block = gl (adf, bs - 4 * 4); + } + } } static void recursesfs (struct znode *zn, int root, TCHAR *name, int sfs2) { - struct zvolume *zv = zn->volume; - struct adfhandle *adf = (struct adfhandle *)zv->handle; - TCHAR name2[MAX_DPATH]; - int bs = adf->blocksize; - int block; - uae_u8 *p, *s; - struct zarchive_info zai; + struct zvolume *zv = zn->volume; + struct adfhandle *adf = (struct adfhandle*)zv->handle; + TCHAR name2[MAX_DPATH]; + int block; + uae_u8 *p, *s; + struct zarchive_info zai; - block = root; - while (block) { - if (!adf_read_block (adf, block)) - return; - p = adf->block + 12 + 3 * 4; - while (glx (p + 4) && p < adf->block + adf->blocksize - 27) { - TCHAR *fname; - int i; - int align; + block = root; + while (block) { + if (!adf_read_block (adf, block)) + return; + p = adf->block + 12 + 3 * 4; + while (glx (p + 4) && p < adf->block + adf->blocksize - 27) { + TCHAR *fname; + int i; + int align; - memset (&zai, 0, sizeof zai); - zai.flags = glx (p + 8) ^ 0x0f; - s = p + (sfs2 ? 27 : 25); + memset (&zai, 0, sizeof zai); + zai.flags = glx (p + 8) ^ 0x0f; + s = p + (sfs2 ? 27 : 25); fname = au ((char*)s); - i = 0; - while (*s) { - s++; - i++; - } - s++; - i++; - if (*s) + i = 0; + while (*s) { + s++; + i++; + } + s++; + i++; + if (*s) zai.comment = au ((char*)s); - while (*s) { - s++; - i++; - } - s++; - i++; - i += sfs2 ? 27 : 25; - align = i & 1; + while (*s) { + s++; + i++; + } + s++; + i++; + i += sfs2 ? 27 : 25; + align = i & 1; - name2[0] = 0; - if (name[0]) { - TCHAR sep[] = { FSDB_DIR_SEPARATOR, 0 }; - _tcscpy (name2, name); - _tcscat (name2, sep); - } - _tcscat (name2, fname); - zai.name = name2; - if (sfs2) + name2[0] = 0; + if (name[0]) { + TCHAR sep[] = { FSDB_DIR_SEPARATOR, 0 }; + _tcscpy (name2, name); + _tcscat (name2, sep); + } + _tcscat (name2, fname); + zai.name = name2; + if (sfs2) zai.tv.tv_sec = glx (p + 22) - diff2; - else + else zai.tv.tv_sec = glx (p + 20) - diff; - if (p[sfs2 ? 26 : 24] & 0x80) { // dir - struct znode *znnew = zvolume_adddir_abs (zv, &zai); - int newblock = glx (p + 16); - if (newblock) { - znnew->offset = block; - recursesfs (znnew, newblock, name2, sfs2); - } - if (!adf_read_block (adf, block)) - return; - } else { - struct znode *znnew; - if (sfs2) { - uae_u64 b1 = p[16]; - uae_u64 b2 = p[17]; - zai.size = (b1 << 40) | (b2 << 32) | glx (p + 18) ; - } else { - zai.size = glx (p + 16); - } - znnew = zvolume_addfile_abs (zv, &zai); - znnew->offset = block; - znnew->offset2 = p - adf->block; - } - xfree ((char*)zai.comment); - xfree (fname); - p += i + align; - } - block = gl (adf, 12 + 4); - } + if (p[sfs2 ? 26 : 24] & 0x80) { // dir + struct znode *znnew = zvolume_adddir_abs (zv, &zai); + int newblock = glx (p + 16); + if (newblock) { + znnew->offset = block; + recursesfs (znnew, newblock, name2, sfs2); + } + if (!adf_read_block (adf, block)) + return; + } else { + struct znode *znnew; + if (sfs2) { + uae_u64 b1 = p[16]; + uae_u64 b2 = p[17]; + zai.size = (b1 << 40) | (b2 << 32) | glx (p + 18) ; + } else { + zai.size = glx (p + 16); + } + znnew = zvolume_addfile_abs (zv, &zai); + if (znnew) { + znnew->offset = block; + znnew->offset2 = p - adf->block; + } + } + xfree (zai.comment); + xfree (fname); + p += i + align; + } + block = gl (adf, 12 + 4); + } } struct zvolume *archive_directory_adf (struct znode *parent, struct zfile *z) { - struct zvolume *zv; - struct adfhandle *adf; - TCHAR *volname = NULL; - TCHAR name[MAX_DPATH]; - int gotroot = 0; + struct zvolume *zv; + struct adfhandle *adf; + TCHAR name[MAX_DPATH]; + int gotroot = 0; - adf = xcalloc (struct adfhandle, 1); - zfile_fseek (z, 0, SEEK_END); - adf->size = zfile_ftell (z); - zfile_fseek (z, 0, SEEK_SET); + adf = xcalloc (struct adfhandle, 1); + zfile_fseek (z, 0, SEEK_END); + adf->size = zfile_ftell (z); + zfile_fseek (z, 0, SEEK_SET); - adf->blocksize = 512; - if (parent && parent->offset2) { - if (parent->offset2 == 1024 || parent->offset2 == 2048 || parent->offset2 == 4096 || parent->offset2 == 8192 || - parent->offset2 == 16384 || parent->offset2 == 32768 || parent->offset2 == 65536) { - adf->blocksize = parent->offset2; - gotroot = 1; - } - } + adf->blocksize = 512; + if (parent && parent->offset2) { + if (parent->offset2 == 1024 || parent->offset2 == 2048 || parent->offset2 == 4096 || parent->offset2 == 8192 || + parent->offset2 == 16384 || parent->offset2 == 32768 || parent->offset2 == 65536) { + adf->blocksize = parent->offset2; + gotroot = 1; + } + } - adf->highblock = adf->size / adf->blocksize; - adf->z = z; + adf->highblock = adf->size / adf->blocksize; + adf->z = z; - if (!adf_read_block (adf, 0)) - goto fail; - adf->dostype = gl (adf, 0); + if (!adf_read_block (adf, 0)) + goto fail; + adf->dostype = gl (adf, 0); - if ((adf->dostype & 0xffffff00) == MCC('D', 'O', 'S', '\0')) { - int bs = adf->blocksize; - int res; + if ((adf->dostype & 0xffffff00) == MCC('D', 'O', 'S', '\0')) { + int bs = adf->blocksize; + int res; - adf->rootblock = ((adf->size / bs) - 1 + 2) / 2; - if (!gotroot) { - for (res = 2; res >= 1; res--) { - for (bs = 512; bs < 65536; bs <<= 1) { - adf->blocksize = bs; - adf->rootblock = ((adf->size / bs) - 1 + res) / 2; - if (!adf_read_block (adf, adf->rootblock)) - continue; - if (gl (adf, 0) != 2 || gl (adf, bs - 1 * 4) != 1) - continue; - if (dos_checksum (adf->block, bs) != 0) - continue; - gotroot = 1; - break; - } - if (gotroot) - break; - } - } - if (!gotroot) { - bs = adf->blocksize = 512; - if (adf->size < 2000000 && adf->rootblock != 880) { - adf->rootblock = 880; - if (!adf_read_block (adf, adf->rootblock)) - goto fail; - if (gl (adf, 0) != 2 || gl (adf, bs - 1 * 4) != 1) - goto fail; - if (dos_checksum (adf->block, bs) != 0) - goto fail; - } - } + adf->rootblock = ((adf->size / bs) - 1 + 2) / 2; + if (!gotroot) { + for (res = 2; res >= 1; res--) { + for (bs = 512; bs < 65536; bs <<= 1) { + adf->blocksize = bs; + adf->rootblock = ((adf->size / bs) - 1 + res) / 2; + if (!adf_read_block (adf, adf->rootblock)) + continue; + if (gl (adf, 0) != 2 || gl (adf, bs - 1 * 4) != 1) + continue; + if (dos_checksum (adf->block, bs) != 0) + continue; + gotroot = 1; + break; + } + if (gotroot) + break; + } + } + if (!gotroot) { + bs = adf->blocksize = 512; + if (adf->size < 2000000 && adf->rootblock != 880) { + adf->rootblock = 880; + if (!adf_read_block (adf, adf->rootblock)) + goto fail; + if (gl (adf, 0) != 2 || gl (adf, bs - 1 * 4) != 1) + goto fail; + if (dos_checksum (adf->block, bs) != 0) + goto fail; + } + } - if (!adf_read_block (adf, adf->rootblock)) - goto fail; - if (gl (adf, 0) != 2 || gl (adf, bs - 1 * 4) != 1) - goto fail; - if (dos_checksum (adf->block, adf->blocksize) != 0) - goto fail; - adf->blocksize = bs; - adf->highblock = adf->size / adf->blocksize; - volname = getBSTR (adf->block + adf->blocksize - 20 * 4); - zv = zvolume_alloc (z, ArchiveFormatADF, NULL, NULL); - zv->method = ArchiveFormatADF; - zv->handle = adf; - - name[0] = 0; - recurseadf (&zv->root, adf->rootblock, name); + if (!adf_read_block (adf, adf->rootblock)) + goto fail; + if (gl (adf, 0) != 2 || gl (adf, bs - 1 * 4) != 1) + goto fail; + if (dos_checksum (adf->block, adf->blocksize) != 0) + goto fail; + adf->blocksize = bs; + adf->highblock = adf->size / adf->blocksize; + zv = zvolume_alloc (z, ArchiveFormatADF, NULL, NULL); + zv->method = ArchiveFormatADF; + zv->handle = adf; + zv->volumename = getBSTR (adf->block + adf->blocksize - 20 * 4); - } else if ((adf->dostype & 0xffffff00) == MCC('S', 'F', 'S', '\0')) { + name[0] = 0; + recurseadf (&zv->root, adf->rootblock, name); - uae_u16 version, sfs2; + } else if ((adf->dostype & 0xffffff00) == MCC('S', 'F', 'S', '\0')) { - for (;;) { - for (;;) { - version = gl (adf, 12) >> 16; - sfs2 = version > 3; - if (version > 4) - break; - adf->rootblock = gl (adf, 104); - if (!adf_read_block (adf, adf->rootblock)) - break; - if (gl (adf, 0) != MCC('O', 'B', 'J', 'C')) - break; - if (sfs_checksum (adf->block, adf->blocksize, sfs2)) - break; - adf->rootblock = gl (adf, 40); - if (!adf_read_block (adf, adf->rootblock)) - break; - if (gl (adf, 0) != MCC('O', 'B', 'J', 'C')) - break; - if (sfs_checksum (adf->block, adf->blocksize, sfs2)) - break; - gotroot = 1; - break; - } - if (gotroot) - break; - adf->blocksize <<= 1; - if (adf->blocksize == 65536) - break; - } - if (!gotroot) - goto fail; + uae_u16 version, sfs2; - zv = zvolume_alloc (z, ArchiveFormatADF, NULL, NULL); - zv->method = ArchiveFormatADF; - zv->handle = adf; + for (;;) { + for (;;) { + version = gl (adf, 12) >> 16; + sfs2 = version > 3; + if (version > 4) + break; + adf->rootblock = gl (adf, 104); + if (!adf_read_block (adf, adf->rootblock)) + break; + if (gl (adf, 0) != MCC('O', 'B', 'J', 'C')) + break; + if (sfs_checksum (adf->block, adf->blocksize, sfs2)) + break; + adf->rootblock = gl (adf, 40); + if (!adf_read_block (adf, adf->rootblock)) + break; + if (gl (adf, 0) != MCC('O', 'B', 'J', 'C')) + break; + if (sfs_checksum (adf->block, adf->blocksize, sfs2)) + break; + gotroot = 1; + break; + } + if (gotroot) + break; + adf->blocksize <<= 1; + if (adf->blocksize == 65536) + break; + } + if (!gotroot) + goto fail; - name[0] = 0; - recursesfs (&zv->root, adf->rootblock, name, version > 3); + zv = zvolume_alloc (z, ArchiveFormatADF, NULL, NULL); + zv->method = ArchiveFormatADF; + zv->handle = adf; - } else { - goto fail; - } + name[0] = 0; + recursesfs (&zv->root, adf->rootblock, name, version > 3); + } else { + goto fail; + } - xfree (volname); - return zv; + return zv; fail: - xfree (adf); - return NULL; + xfree (adf); + return NULL; } struct sfsblock { - int block; - int length; + int block; + int length; }; static int sfsfindblock (struct adfhandle *adf, int btree, int theblock, struct sfsblock **sfsb, int *sfsblockcnt, int *sfsmaxblockcnt, int sfs2) { - int nodecount, isleaf, nodesize; - int i; - uae_u8 *p; + int nodecount, isleaf, nodesize; + int i; + uae_u8 *p; - if (!btree) - return 0; - if (!adf_read_block (adf, btree)) - return 0; - if (memcmp (adf->block, "BNDC", 4)) - return 0; - nodecount = gwx (adf->block + 12); - isleaf = adf->block[14]; - nodesize = adf->block[15]; - p = adf->block + 16; - for (i = 0; i < nodecount; i++) { - if (isleaf) { - uae_u32 key = glx (p); - uae_u32 next = glx (p + 4); - uae_u32 prev = glx (p + 8); - uae_u32 blocks; - if (sfs2) - blocks = glx (p + 12); - else - blocks = gwx (p + 12); - if (key == theblock) { - struct sfsblock *sb; - if (*sfsblockcnt >= *sfsmaxblockcnt) { - *sfsmaxblockcnt += 100; - *sfsb = xrealloc (struct sfsblock, *sfsb, *sfsmaxblockcnt); - } - sb = *sfsb + (*sfsblockcnt); - sb->block = key; - sb->length = blocks; - (*sfsblockcnt)++; - return next; - } - } else { - uae_u32 key = glx (p); - uae_u32 data = glx (p + 4); - int newblock = sfsfindblock (adf, data, theblock, sfsb, sfsblockcnt, sfsmaxblockcnt, sfs2); - if (newblock) - return newblock; - if (!adf_read_block (adf, btree)) - return 0; - if (memcmp (adf->block, "BNDC", 4)) - return 0; - } - p += nodesize; - } - return 0; + if (!btree) + return 0; + if (!adf_read_block (adf, btree)) + return 0; + if (memcmp (adf->block, "BNDC", 4)) + return 0; + nodecount = gwx (adf->block + 12); + isleaf = adf->block[14]; + nodesize = adf->block[15]; + p = adf->block + 16; + for (i = 0; i < nodecount; i++) { + if (isleaf) { + uae_u32 key = glx (p); + uae_u32 next = glx (p + 4); + uae_u32 prev = glx (p + 8); + uae_u32 blocks; + if (sfs2) + blocks = glx (p + 12); + else + blocks = gwx (p + 12); + if (key == theblock) { + struct sfsblock *sb; + if (*sfsblockcnt >= *sfsmaxblockcnt) { + *sfsmaxblockcnt += 100; + *sfsb = xrealloc (struct sfsblock, *sfsb, *sfsmaxblockcnt); + } + sb = *sfsb + (*sfsblockcnt); + sb->block = key; + sb->length = blocks; + (*sfsblockcnt)++; + return next; + } + } else { + uae_u32 key = glx (p); + uae_u32 data = glx (p + 4); + int newblock = sfsfindblock (adf, data, theblock, sfsb, sfsblockcnt, sfsmaxblockcnt, sfs2); + if (newblock) + return newblock; + if (!adf_read_block (adf, btree)) + return 0; + if (memcmp (adf->block, "BNDC", 4)) + return 0; + } + p += nodesize; + } + return 0; } static struct zfile *archive_access_adf (struct znode *zn) { - struct zfile *z = NULL; - int root, ffs; - struct adfhandle *adf = (struct adfhandle *)zn->volume->handle; - int size, bs; - int i; - uae_u8 *dst; + struct zfile *z = NULL; + int root, ffs; + struct adfhandle *adf = (struct adfhandle*)zn->volume->handle; + uae_s64 size; + int i, bs; + uae_u8 *dst; - size = zn->size; - bs = adf->blocksize; - z = zfile_fopen_empty (zn->volume->archive, zn->fullname, size); - if (!z) - return NULL; + size = zn->size; + bs = adf->blocksize; + z = zfile_fopen_empty (zn->volume->archive, zn->fullname, size); + if (!z) + return NULL; - if ((adf->dostype & 0xffffff00) == MCC('D', 'O', 'S', '\0')) { + if ((adf->dostype & 0xffffff00) == MCC('D', 'O', 'S', '\0')) { - ffs = adf->dostype & 1; - root = zn->offset; - dst = z->data; - for (;;) { - adf_read_block (adf, root); - for (i = bs / 4 - 51; i >= 6; i--) { - int bsize = ffs ? bs : bs - 24; - int block = gl (adf, i * 4); - if (size < bsize) - bsize = size; - if (ffs) - zfile_fseek (adf->z, block * adf->blocksize, SEEK_SET); - else - zfile_fseek (adf->z, block * adf->blocksize + 24, SEEK_SET); - zfile_fread (dst, bsize, 1, adf->z); - size -= bsize; - dst += bsize; - if (size <= 0) - break; - } - if (size <= 0) - break; - root = gl (adf, bs - 2 * 4); - } - } else if ((adf->dostype & 0xffffff00) == MCC('S', 'F', 'S', '\0')) { + ffs = adf->dostype & 1; + root = zn->offset; + dst = z->data; + for (;;) { + adf_read_block (adf, root); + for (i = bs / 4 - 51; i >= 6; i--) { + uae_s64 bsize = ffs ? bs : bs - 24; + int block = gl (adf, i * 4); + if (size < bsize) + bsize = size; + if (ffs) + zfile_fseek (adf->z, block * adf->blocksize, SEEK_SET); + else + zfile_fseek (adf->z, block * adf->blocksize + 24, SEEK_SET); + zfile_fread (dst, bsize, 1, adf->z); + size -= bsize; + dst += bsize; + if (size <= 0) + break; + } + if (size <= 0) + break; + root = gl (adf, bs - 2 * 4); + } + } else if ((adf->dostype & 0xffffff00) == MCC('S', 'F', 'S', '\0')) { - struct sfsblock *sfsblocks; - int sfsblockcnt, sfsmaxblockcnt, i; - int bsize; - int block = zn->offset; - int dblock; - int btree, version, sfs2; - uae_u8 *p; + struct sfsblock *sfsblocks; + int sfsblockcnt, sfsmaxblockcnt, i; + uae_s64 bsize; + int block = zn->offset; + int dblock; + int btree, version, sfs2; + uae_u8 *p; - if (!adf_read_block (adf, 0)) - goto end; - btree = glx (adf->block + 108); - version = gwx (adf->block + 12); - sfs2 = version > 3; + if (!adf_read_block (adf, 0)) + goto end; + btree = glx (adf->block + 108); + version = gwx (adf->block + 12); + sfs2 = version > 3; - if (!adf_read_block (adf, block)) - goto end; - p = adf->block + zn->offset2; - dblock = glx (p + 12); + if (!adf_read_block (adf, block)) + goto end; + p = adf->block + zn->offset2; + dblock = glx (p + 12); - sfsblockcnt = 0; - sfsmaxblockcnt = 0; - sfsblocks = NULL; - if (size > 0) { - int nextblock = dblock; - while (nextblock) { - nextblock = sfsfindblock (adf, btree, nextblock, &sfsblocks, &sfsblockcnt, &sfsmaxblockcnt, sfs2); - } - } + sfsblockcnt = 0; + sfsmaxblockcnt = 0; + sfsblocks = NULL; + if (size > 0) { + int nextblock = dblock; + while (nextblock) { + nextblock = sfsfindblock (adf, btree, nextblock, &sfsblocks, &sfsblockcnt, &sfsmaxblockcnt, sfs2); + } + } - bsize = 0; - for (i = 0; i < sfsblockcnt; i++) - bsize += sfsblocks[i].length * adf->blocksize; - if (bsize < size) - write_log (_T("SFS extracting error, %s size mismatch %d<%d\n"), z->name, bsize, size); + bsize = 0; + for (i = 0; i < sfsblockcnt; i++) + bsize += sfsblocks[i].length * adf->blocksize; + if (bsize < size) + write_log (_T("SFS extracting error, %s size mismatch %d<%d\n"), z->name, bsize, size); - dst = z->data; - block = zn->offset; - for (i = 0; i < sfsblockcnt; i++) { - block = sfsblocks[i].block; - bsize = sfsblocks[i].length * adf->blocksize; - zfile_fseek (adf->z, block * adf->blocksize, SEEK_SET); - if (bsize > size) - bsize = size; - zfile_fread (dst, bsize, 1, adf->z); - dst += bsize; - size -= bsize; - } + dst = z->data; + block = zn->offset; + for (i = 0; i < sfsblockcnt; i++) { + block = sfsblocks[i].block; + bsize = sfsblocks[i].length * adf->blocksize; + zfile_fseek (adf->z, block * adf->blocksize, SEEK_SET); + if (bsize > size) + bsize = size; + zfile_fread (dst, bsize, 1, adf->z); + dst += bsize; + size -= bsize; + } - xfree (sfsblocks); - } - return z; + xfree (sfsblocks); + } + return z; end: - zfile_fclose (z); - return NULL; + zfile_fclose (z); + return NULL; } static void archive_close_adf (void *v) { - struct adfhandle *adf = (struct adfhandle *)v; - xfree (adf); + struct adfhandle *adf = (struct adfhandle*)v; + xfree (adf); } static int rl (uae_u8 *p) @@ -1724,14 +1750,16 @@ struct zvolume *archive_directory_rdb (struct zfile *z) zai.size = size; zai.flags = -1; zn = zvolume_addfile_abs (zv, &zai); - zn->offset = partblock; - zn->offset2 = blocksize; // abuse of offset2.. + if (zn) { + zn->offset = partblock; + zn->offset2 = blocksize; // abuse of offset2.. + } } zfile_fseek (z, 0, SEEK_SET); p = buf; zfile_fread (buf, 1, 512, z); - zai.name = _T("rdb_dump.dat"); + zai.name = my_strdup(_T("rdb_dump.dat")); bs = rl (p + 16); zai.size = rl (p + 140) * bs; zai.comment = NULL; @@ -1748,7 +1776,8 @@ static struct zfile *archive_access_rdb (struct znode *zn) struct zfile *zf; uae_u8 buf[512] = { 0 }; int surf, spb, spt, lowcyl, highcyl; - int size, block, blocksize; + int block, blocksize; + uae_s64 size; uae_u8 *p; if (zn->offset) { @@ -1897,7 +1926,7 @@ static int getcluster (struct zfile *z, int cluster, int fatstart, int fatbits) return fat; } -static void fatdirectory (struct zfile *z, struct zvolume *zv, const char *name, int startblock, int entries, int sectorspercluster, int fatstart, int dataregion, int fatbits) +static void fatdirectory (struct zfile *z, struct zvolume *zv, const TCHAR *name, int startblock, int entries, int sectorspercluster, int fatstart, int dataregion, int fatbits) { struct zarchive_info zai; struct znode *znnew; @@ -1972,7 +2001,9 @@ static void fatdirectory (struct zfile *z, struct zvolume *zv, const char *name, } else { zai.size = size; znnew = zvolume_addfile_abs (zv, &zai); - znnew->offset = startcluster; + if (znnew) { + znnew->offset = startcluster; + } } xfree (fname); @@ -2011,12 +2042,12 @@ static struct zfile *archive_access_fat (struct znode *zn) { uae_u8 buf[512] = { 0 }; int fatbits = 12; - int size = zn->size; + uae_s64 size = zn->size; struct zfile *sz, *dz; int rootdir, reserved, sectorspercluster; int numfats, sectorsperfat, rootentries; - int dataregion; - int offset, cluster; + int dataregion, cluster; + uae_s64 offset; sz = zn->volume->archive; @@ -2040,7 +2071,7 @@ static struct zfile *archive_access_fat (struct znode *zn) offset = 0; cluster = zn->offset; while (size && cluster >= 2) { - int left = size > sectorspercluster * 512 ? sectorspercluster * 512 : size; + uae_s64 left = size > sectorspercluster * 512 ? sectorspercluster * 512 : size; int sector = dataregion + (cluster - 2) * sectorspercluster; zfile_fseek (sz, sector * 512, SEEK_SET); zfile_fread (dz->data + offset, 1, left, sz); @@ -2054,17 +2085,17 @@ static struct zfile *archive_access_fat (struct znode *zn) void archive_access_close (void *handle, unsigned int id) { - switch (id) - { + switch (id) + { #ifdef A_ZIP case ArchiveFormatZIP: - archive_close_zip(handle); - break; + archive_close_zip (handle); + break; #endif #ifdef A_7Z case ArchiveFormat7Zip: - archive_close_7z(handle); - break; + archive_close_7z (handle); + break; #endif #ifdef A_RAR case ArchiveFormatRAR: @@ -2073,15 +2104,15 @@ void archive_access_close (void *handle, unsigned int id) #endif #ifdef A_LHA case ArchiveFormatLHA: - break; + break; #endif case ArchiveFormatADF: - archive_close_adf (handle); - break; + archive_close_adf (handle); + break; case ArchiveFormatTAR: archive_close_tar (handle); break; - } + } } static struct zfile *archive_access_dir (struct znode *zn) @@ -2112,18 +2143,19 @@ struct zfile *archive_unpackzfile (struct zfile *zf) struct zfile *archive_getzfile (struct znode *zn, unsigned int id, int flags) { - struct zfile *zf = NULL; - switch (id) - { + struct zfile *zf = NULL; + + switch (id) + { #ifdef A_ZIP case ArchiveFormatZIP: - zf = archive_access_zip (zn, flags); - break; + zf = archive_access_zip (zn, flags); + break; #endif #ifdef A_7Z case ArchiveFormat7Zip: - zf = archive_access_7z (zn); - break; + zf = archive_access_7z (zn); + break; #endif #ifdef A_RAR case ArchiveFormatRAR: @@ -2132,23 +2164,23 @@ struct zfile *archive_getzfile (struct znode *zn, unsigned int id, int flags) #endif #ifdef A_LHA case ArchiveFormatLHA: - zf = archive_access_lha (zn); - break; + zf = archive_access_lha (zn); + break; #endif #ifdef A_LZX case ArchiveFormatLZX: - zf = archive_access_lzx (zn); - break; + zf = archive_access_lzx (zn); + break; #endif case ArchiveFormatPLAIN: - zf = archive_access_plain (zn); - break; + zf = archive_access_plain (zn); + break; case ArchiveFormatADF: - zf = archive_access_adf (zn); + zf = archive_access_adf (zn); break; case ArchiveFormatRDB: zf = archive_access_rdb (zn); - break; + break; case ArchiveFormatFAT: zf = archive_access_fat (zn); break; @@ -2158,10 +2190,10 @@ struct zfile *archive_getzfile (struct znode *zn, unsigned int id, int flags) case ArchiveFormatTAR: zf = archive_access_tar (zn); break; - } + } if (zf) { zf->archiveid = id; zfile_fseek (zf, 0, SEEK_SET); } - return zf; + return zf; }