Merge branch 'master' into interp_cores

This commit is contained in:
YoshiRulz 2019-06-15 02:11:24 +10:00
commit 4dd40305bc
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
707 changed files with 19172 additions and 13729 deletions

5
.gitignore vendored
View File

@ -12,6 +12,7 @@ svnrev.cs
**/ipch/**
*.ilk
*.il
*.tlog
*.obj
*.o
@ -74,3 +75,7 @@ libsnes/vs2015/libsnes.VC.db
waterbox/**/*.wbx
waterbox/**/*.wbx.in
/BizHawkTool_template.zip
mono_crash*
.idea

View File

@ -8,11 +8,14 @@ libpath=""
if [ "$(command -v lsb_release)" ]; then
case "$(lsb_release -i | cut -c17- | tr -d "\n")" in
"Arch"|"ManjaroLinux") libpath="/usr/lib/wine";;
"Debian"|"Ubuntu"|"LinuxMint") libpath="/usr/lib/x86_64-linux-gnu/wine";;
"Debian"|"LinuxMint") libpath="/usr/lib/x86_64-linux-gnu/wine";;
"Ubuntu") libpath="/usr/lib/x86_64-linux-gnu/wine"; export MONO_WINFORMS_XIM_STYLE=disabled;; # see https://bugzilla.xamarin.com/show_bug.cgi?id=28047#c9
esac
else
printf "Distro does not provide LSB release info API! (You've met with a terrible fate, haven't you?)\n"
fi
if [ -z "$libpath" ]; then
printf "%s\n" "Unknown distro, assuming WINE library location is /usr/lib/wine..."
libpath="/usr/lib/wine"
fi
LD_LIBRARY_PATH="$libpath" mono ./EmuHawk.exe
LD_LIBRARY_PATH="$libpath" mono ./EmuHawk.exe >EmuHawkMono_laststdout.txt

View File

@ -21,11 +21,13 @@
#include gamedb_sega_md.txt
#include gamedb_snes.txt
#include gamedb_user.txt
#include gamedb_vectrex.txt
#include gamedb_ws.txt
#include gamedb_wsc.txt
#include gamedb_zxspectrum.txt
#include gamedb_amstradcpc.txt
#include gamedb_ngp.txt
#include gamedb_channelf.txt
; ************ TI-83 ************

View File

@ -50,9 +50,9 @@ sha1:a65f487740069640952803218b70580b2fb724b7 A-Team, The (Atari) (Prototype) (
sha1:821cffe5f5940b2951f280d07d2691e140f54ad2 A-Team, The (Atari) (Prototype) (PAL-60) [!] A26 m=F8;NTSC=true
sha1:53413577afe7def1d390e3892c45822405513c07 A-Team, The (Atari) (Prototype) [!] A26 m=F8;NTSC=true
sha1:3607f46475f4b1b8989f7327f90ca53a4ac0e9fe A-VCS-tec Challenge (beta 5) (PD) A26 m=F8;NTSC=true
sha1:d7c62df8300a68b21ce672cfaa4d0f2f4b3d0ce1 Acid Drop (1992) (Salu) (PAL) [!] A26 m=F6;PAL=true
sha1:66216ed98295f3fde35a0cc9398b4f2fc79f2375 Acid Drop (1992) (Salu) (PAL) [b1] A26 m=F8;PAL=true
sha1:2ad5e47e360842bb5f9c23bbe2c19866d890f427 Acid Drop (NTSC Conversion) (TJ) A26 m=F8;NTSC=true
sha1:d7c62df8300a68b21ce672cfaa4d0f2f4b3d0ce1 Acid Drop (1992) (Salu) (PAL) [!] A26 SP_RESET=true;m=F6;PAL=true
sha1:66216ed98295f3fde35a0cc9398b4f2fc79f2375 Acid Drop (1992) (Salu) (PAL) [b1] A26 SP_RESET=true;m=F8;PAL=true
sha1:2ad5e47e360842bb5f9c23bbe2c19866d890f427 Acid Drop (NTSC Conversion) (TJ) A26 SP_RESET=true;m=F8;NTSC=true
sha1:9e6fb047ee9fa0a454ca23673ed9693430032dc6 Action Force (1983) (Parker Bros) (PAL) [!] A26 m=4K;PAL=true
sha1:bfcc35feee3713f5028122844d027c88a84772b6 2 Pak Special Red - Motocross,Boom Bang (1990) (PAL) [!] A26 m=F6;PAL=true
sha1:8a503416ca6f2404bc52382e337f31238bba9534 3-D Corridor Demo 2 (29-03-2003) (MP) A26 m=4K;NTSC=true
@ -68,13 +68,13 @@ sha1:317a7b8693af44095c23437253a32cc748824ccf Adventure (Color Scrolling) [h1]
sha1:4ffe36c5113305714e27c72d7f3abecc9b08a630 Adventure (New Graphics) [h1] A26 m=4K;NTSC=true
sha1:0b0875ad1bd494c9dd8de4ff0a06938e699f60d5 Adventure 34 by Kurt Howe (Adventure Hack) A26 m=4K;NTSC=true
sha1:8501444b12f7f9e2103cd2bcf0c8d3f5b7536569 Adventure II (Adventure Hack) A26 m=4K;NTSC=true
sha1:03a495c7bfa0671e24aa4d9460d232731f68cb43 Adventures of Tron (1983) (Mattel) A26 m=4K;NTSC=true
sha1:03a495c7bfa0671e24aa4d9460d232731f68cb43 Adventures of Tron (1983) (Mattel) A26 SP_RESET=true;m=4K;NTSC=true
sha1:6e420544bf91f603639188824a2b570738bb7e02 Adventures on GX-12 (Telegames) (PAL) [!] A26 m=4K;PAL=true
sha1:3b02e7dacb418c44d0d3dc77d60a9663b90b0fbc Air Raid (Men-A-Vision) A26 m=4K;NTSC=true
sha1:e65a0c6c5a1f9f05ebcfaaa7b2c9ee6625bf2d83 Air Raiders (1982) (Mattel) (PAL) [p1][!] A26 m=4K;PAL=true
sha1:29f5c73d1fe806a4284547274dd73f9972a7ed70 Air Raiders (1982) (Mattel) [!] A26 m=4K;NTSC=true
sha1:a9a51405b521ae0b465f521fa098e8b3aedd018b Air Raiders (1982) (Mattel) [a1][!] A26 m=4K;NTSC=true
sha1:39a98b42f0670dfe6a842645f09f24583ae8ee60 Air Raiders (1982) (Mattel) [h1] A26 m=4K;NTSC=true
sha1:e65a0c6c5a1f9f05ebcfaaa7b2c9ee6625bf2d83 Air Raiders (1982) (Mattel) (PAL) [p1][!] A26 SP_RESET=true;m=4K;PAL=true
sha1:29f5c73d1fe806a4284547274dd73f9972a7ed70 Air Raiders (1982) (Mattel) [!] A26 SP_RESET=true;m=4K;NTSC=true
sha1:a9a51405b521ae0b465f521fa098e8b3aedd018b Air Raiders (1982) (Mattel) [a1][!] A26 SP_RESET=true;m=4K;NTSC=true
sha1:39a98b42f0670dfe6a842645f09f24583ae8ee60 Air Raiders (1982) (Mattel) [h1] A26 SP_RESET=true;m=4K;NTSC=true
sha1:b96c7a509bf610f61f82377bfd506db3dba2b423 Air-Sea Battle (1977) (Atari) (PAL) [!] A26 m=2K;PAL=true
sha1:a746fdc82b336a9d499bf17f50b41e0193ba595e Air-Sea Battle (1977) (Atari) [!] A26 m=2K;NTSC=true
sha1:d3897fc60585e420ae816a2db909400f6cbadd88 Air-Sea Battle (1977) (Atari) [o1] A26 m=2K;NTSC=true
@ -323,9 +323,9 @@ sha1:67387d0d3d48a44800c44860bf15339a81f41aa9 Bugs (1982) (Data Age) [!] A26 m
sha1:a8aedea627c67c38032cdde441fb98dad226916a Bugs (1983) (Gameworld) (PAL) [!] A26 m=4K;PAL=true
sha1:9c0e13af336a986c271fe828fafdca250afba647 Bugs Bunny (Atari) (Prototype) [!] A26 m=F8;NTSC=true
sha1:13534da5c382ed20d070ffe93f35c4c11b36e1bc Bullet Demo (20-12-2002) (CT) A26 m=4K;NTSC=true
sha1:5614c32e76c8b272c38c16720ebbb1818d3d3103 Bump 'N' Jump (1983) (Mattel) [b1] A26 m=F6;NTSC=true
sha1:1819ef408c1216c83dcfeceec28d13f6ea5ca477 Bump 'N' Jump (1983) (Mattel) A26 m=E7;NTSC=true
sha1:35bc4048f58bb170313872a0bce44fb1ca3217cc Bump 'N' Jump (Telegames) (PAL) [!] A26 m=F8;PAL=true
sha1:5614c32e76c8b272c38c16720ebbb1818d3d3103 Bump 'N' Jump (1983) (Mattel) [b1] A26 SP_RESET=true;m=F6;NTSC=true
sha1:1819ef408c1216c83dcfeceec28d13f6ea5ca477 Bump 'N' Jump (1983) (Mattel) A26 SP_RESET=true;m=E7;NTSC=true
sha1:35bc4048f58bb170313872a0bce44fb1ca3217cc Bump 'N' Jump (Telegames) (PAL) [!] A26 SP_RESET=true;m=F8;PAL=true
sha1:ad48f4952e867a2b97900d965b69f50fddf8ba2d Bumper Bash (1983) (Spectravideo) (PAL) [!] A26 m=4K;PAL=true
sha1:6c199782c79686dc0cbce6d5fe805f276a86a3f5 Bumper Bash (1983) (Spectravideo) A26 m=4K;NTSC=true
sha1:49e01b8048ae344cb65838f6b1c1de0e1f416f29 Burgertime (1982) (Mattel) A26 SP_RESET=true;m=E7;NTSC=true
@ -855,8 +855,8 @@ sha1:6b9e591cc53844795725fc66c564f0364d1fbe40 Frogger II - Threedeep! (1983) (P
sha1:bce92de22fc8950f0eebb643d96fe9fa5dba2b72 Frogger II - Threedeep! (1984) (Parker Bros) (PAL) [!] A26 m=E0;PAL=true
sha1:5215cf9051e833482e115d16ff90fee5f01c3e84 Frogger Preview (1982) (Starpath) [a1] A26 m=AR;NTSC=true
sha1:2edb64be1bb6f4215f520ec2f487b19f29724b8d Frogger Preview (1982) (Starpath) A26 m=AR;NTSC=true
sha1:7682b4b6d45865b7eec1244e5d76f0f2efdb17e7 Frogs and Flies (1982) (Mattel) (PAL) [p1][!] A26 m=4K;PAL=true
sha1:f344d5a8dc895c5a2ae0288f3c6cb66650e49167 Frogs and Flies (1982) (Mattel) [!] A26 m=4K;NTSC=true
sha1:7682b4b6d45865b7eec1244e5d76f0f2efdb17e7 Frogs and Flies (1982) (Mattel) (PAL) [p1][!] A26 SP_RESET=true;m=4K;PAL=true
sha1:f344d5a8dc895c5a2ae0288f3c6cb66650e49167 Frogs and Flies (1982) (Mattel) [!] A26 SP_RESET=true;m=4K;NTSC=true
sha1:cf32bfcd7f2c3b7d2a6ad2f298aea2dfad8242e7 Front Line (1982) (Coleco) A26 m=F8;NTSC=true
sha1:58a6f82434ccf49ca420596809ce9545373845a2 Frostbite (1983) (Activision) (PAL) [!] A26 m=4K;PAL=true
sha1:8ad03667bbf73d3c7760cb82f2c4442f8745483c Frostbite (1983) (Activision) (PAL) [p1][!] A26 m=4K;PAL=true
@ -1256,9 +1256,9 @@ sha1:128c3a98d78b043edabe8964cf7998955342fa2d Kiss Meets Pacman (Cody Pittman)
sha1:45623a1c8fb5074de98c37f005edd5b1d0937dae Klax (1990) (Atari) (PAL) [!] A26 m=F6SC;PAL=true
sha1:3162259c6dbfbb57a2ea41d849155702151ee39b Klax (1990) (Atari) A26 m=F6SC;NTSC=true
sha1:759597d1d779cfdfd7aa30fd28a59acc58ca2533 Knight on the Town (1982) (Playaround) A26 m=4K;NTSC=true
sha1:2f550743e237f6dc8c75c389a01b02e9a396fdad Kool Aid Man (1982) (Mattel) A26 m=4K;NTSC=true
sha1:f5c193ed00bf557ddd5ab698d92a7483b89c6519 Kool Aid Man (Fixed) (15-11-2002) (CT) A26 m=4K;NTSC=true
sha1:38f55fc76bec14eb661a7b594301c271aa5f5f3b Kool Aid Man (PAL Conversion) (16-11-2002) (Fabrizio Zavagli) A26 m=4K;NTSC=true
sha1:2f550743e237f6dc8c75c389a01b02e9a396fdad Kool Aid Man (1982) (Mattel) A26 SP_RESET=true;m=4K;NTSC=true
sha1:f5c193ed00bf557ddd5ab698d92a7483b89c6519 Kool Aid Man (Fixed) (15-11-2002) (CT) A26 SP_RESET=true;m=4K;NTSC=true
sha1:38f55fc76bec14eb661a7b594301c271aa5f5f3b Kool Aid Man (PAL Conversion) (16-11-2002) (Fabrizio Zavagli) A26 SP_RESET=true;m=4K;NTSC=true
sha1:82e64366795b011c2a2f1755bf899cc2c0617fe8 Krieg Der Sterne (Atlantis-Ariola) (PAL) [!] A26 m=4K;PAL=true
sha1:4bdf1cf73316bdb0002606facf11b6ddcb287207 Krull (1983) (Atari) [!] A26 m=F8;NTSC=true
sha1:07a1c1b1a2297c4edde0e16f610b5ec23c775217 Krull (CCE) A26 m=F8;NTSC=true
@ -1305,9 +1305,9 @@ sha1:4f3e51f68c10d2fa7c4b9764b0cb81fdded0fde4 Lilly Adventure (Starsoft) (NTSC
sha1:63f4776aa4c35d124001918b733cdb4d46dfbe9b Lilly Adventure (Starsoft) (PAL) [!] A26 m=4K;PAL=true
sha1:5425578808363ee72dbba6195533549679137777 Lines Demo (Eckhard Stolberg) (PAL) (PD) A26 m=2K;PAL=true
sha1:fe208ad775cbf9523e7a99632b9f10f2c9c7aa87 Lochjaw (1982) (Apollo) A26 m=4K;NTSC=true
sha1:119171935ed9ea877de4f2a68aee31cd55bc697d Lock 'N' Chase (1982) (Mattel) (PAL) [p1][!] A26 m=4K;PAL=true
sha1:fc3d75d46d917457aa1701bf47844817d0ba96c3 Lock 'N' Chase (1982) (Mattel) [!] A26 m=4K;NTSC=true
sha1:075ec3678ceabbee46a7d576fdd199a4ab908cc0 Lock 'N' Chase (1982) (Telegames) (PAL) [!] A26 m=4K;PAL=true
sha1:119171935ed9ea877de4f2a68aee31cd55bc697d Lock 'N' Chase (1982) (Mattel) (PAL) [p1][!] A26 SP_RESET=true;m=4K;PAL=true
sha1:fc3d75d46d917457aa1701bf47844817d0ba96c3 Lock 'N' Chase (1982) (Mattel) [!] A26 SP_RESET=true;m=4K;NTSC=true
sha1:075ec3678ceabbee46a7d576fdd199a4ab908cc0 Lock 'N' Chase (1982) (Telegames) (PAL) [!] A26 SP_RESET=true;m=4K;PAL=true
sha1:ef02fdb94ac092247bfcd5f556e01a68c06a4832 Lord of The Rings (1983) (Parker Bros) (Prototype) A26 m=E0;NTSC=true
sha1:43575ed97f8a585c5bae6fb1a7b2133c87b4d256 Lord of the Rings - Fellowship of the Ring by Adam Thornton (Dark Mage Hack) (PD) [a1] A26 m=4K;NTSC=true
sha1:721514e5c31c8f2b30b4a2bf2cda69a810cac75b Lord of the Rings - Fellowship of the Ring by Adam Thornton (Dark Mage Hack) (PD) A26 m=4K;NTSC=true
@ -1359,8 +1359,8 @@ sha1:6ef010513e01520560616994cbe3f10995490996 Max3 (2001) (Maxime Beauvais) (PD
sha1:a2b13017d759346174e3d8dd53b6347222d3b85d Maze (AKA Slot Racers) (1978) (Sears) [!] A26 m=2K;NTSC=true
sha1:05f8d0e9f9bec192dfe5947965039817c8c390df Maze (AKA Slot Racers) (1978) (Sears) [o1] A26 m=2K;NTSC=true
sha1:365a3af336d71f8f80345de9fcebb100f5141182 Maze 003 Demo (PD) A26 m=4K;NTSC=true
sha1:4a255c1d277f9ceb98dfe61ec2c6f7537ca4e7bf Maze Craze (1978) (Atari) (PAL) [!] A26 m=4K;PAL=true
sha1:aba25089d87cd6fee8d206b880baa5d938aae255 Maze Craze (1978) (Atari) A26 m=4K;NTSC=true
sha1:4a255c1d277f9ceb98dfe61ec2c6f7537ca4e7bf Maze Craze (1978) (Atari) (PAL) [!] A26 SP_FRAME=true;m=4K;PAL=true
sha1:aba25089d87cd6fee8d206b880baa5d938aae255 Maze Craze (1978) (Atari) A26 SP_FRAME=true;m=4K;NTSC=true
sha1:43c309177fde4adf59c99ba5d3865df2a588a79e Maze Demo 1 (PD) A26 m=4K;NTSC=true
sha1:648e91958afdf264e8e6b45521ecb542fb340586 Maze Demo 2 (PD) A26 m=4K;NTSC=true
sha1:0103b35b1aef6b10c1c0a44b213ebf30af708df6 McDonald's (1983) (Parker Bros) (Prototype) [!] A26 m=4K;NTSC=true
@ -1559,9 +1559,9 @@ sha1:03eb4a3b3db04c1782e1a91d27ea515163d258fb Oink! (CCE) A26 m=4K;NTSC=true
sha1:7feef3965706bc64f0f0a940149b2523e0735ce6 Okie Dokie (4K) (PD) A26 m=4K;NTSC=true
sha1:7bd1cbddefcf3bd24da570be015234d0c444a7e5 Okie Dokie (Older) (PD) A26 m=2K;NTSC=true
sha1:8a47b1930971f271a935c50d423e152aaea6ac59 Okie Dokie (PD) A26 m=2K;NTSC=true
sha1:ca4f26716120d2e4ba531c2ea50b570b9980756e Omega Race (1983) (CBS Electronics) [o1] A26 m=F6SC;NTSC=true
sha1:dcaab259e7617c7ac7d349893451896a9ca0e292 Omega Race (1983) (CBS Electronics) A26 m=FA;NTSC=true
sha1:c7a9ecad6c1a82048de54d33b231abd89fb08bd8 Omega Race JS (TJ) A26 m=FA;NTSC=true
sha1:ca4f26716120d2e4ba531c2ea50b570b9980756e Omega Race (1983) (CBS Electronics) [o1] A26 SP_RESET=true;m=F6SC;NTSC=true
sha1:dcaab259e7617c7ac7d349893451896a9ca0e292 Omega Race (1983) (CBS Electronics) A26 SP_RESET=true;m=FA;NTSC=true
sha1:c7a9ecad6c1a82048de54d33b231abd89fb08bd8 Omega Race JS (TJ) A26 SP_RESET=true;m=FA;NTSC=true
sha1:fbf180f8f35178099244bc1ae341ccff87838907 One Blue Bar Demo (PD) A26 m=4K;NTSC=true
sha1:e52ca6e73c931ef71c63e164704fb398086e4308 One On One by Angelino (Basketball Hack) A26 m=2K;NTSC=true
sha1:98007f26356b4032a2ae4e9fddea5a38a988eb13 Oscar's Trash Race (1983) (Atari) (PAL) [!] A26 m=F8;PAL=true
@ -2302,8 +2302,8 @@ sha1:7c2a2ddbdef639ed2985ce66ae717b2285a94ae0 Star Raiders (1982) (Atari) (PAL)
sha1:e10cce1a438c82bd499e1eb31a3f07d7254198f5 Star Raiders (1982) (Atari) A26 m=F8;NTSC=true
sha1:d2b6290afb81bad126321d923d222c26e2de5fa8 Star Ship - Outer Space (1977) [o1] A26 m=2K;NTSC=true
sha1:878e78ed46e29c44949d0904a2198826e412ed81 Star Ship - Outer Space (1977) A26 m=2K;NTSC=true
sha1:de05d1ca8ad1e7a85df3faf25b1aa90b159afded Star Strike (1982) (Mattel) A26 m=4K;NTSC=true
sha1:a0e29405a92773bf3baa2845788a8add8f3bc0b1 Star Strike (Telegames) (PAL) [!] A26 m=4K;PAL=true
sha1:de05d1ca8ad1e7a85df3faf25b1aa90b159afded Star Strike (1982) (Mattel) A26 SP_RESET=true;m=4K;NTSC=true
sha1:a0e29405a92773bf3baa2845788a8add8f3bc0b1 Star Strike (Telegames) (PAL) [!] A26 SP_RESET=true;m=4K;PAL=true
sha1:667a528e8cf3fd7f533cf67993f48bcc3c100e0d Star Trek - Strategic Operations Simulator (1983) (Sega) (PAL) [!] A26 m=F8;PAL=true
sha1:61a3ebbffa0bfb761295c66e189b62915f4818d9 Star Trek - Strategic Operations Simulator (1983) (Sega) A26 m=F8;NTSC=true
sha1:417bb89e1117413321ffba48a17e005b2687680b Star Voyager (1982) (CCE) [!] A26 m=4K;NTSC=true
@ -2554,8 +2554,8 @@ sha1:ccf422636180f24becaa8af0cc391f95e599a330 Tunnel Demo (28-03-2003) (AD) A26
sha1:0f6552a0afe40cc1c448313569db8c9a8cda6d21 Tunnel Demo (Cycling Colours 2) (29-03-2003) (AD) A26 m=4K;NTSC=true
sha1:8dad50a3918c7462811c2def42f289cd123822af Tunnel Demo (Red Spiral) (30-03-2003) (AD) A26 m=4K;NTSC=true
sha1:4df103678f9c88b017e64f1e14e741fc6e15340c Tunnel Demo 2 (27-03-2003) (CT) A26 m=4K;NTSC=true
sha1:fc1a0b58765a7dcbd8e33562e1074ddd9e0ac624 Tunnel Runner (1983) (CBS Electronics) [!] A26 m=FA;NTSC=true
sha1:460094d7689ac0c4435b72e3e390f4b6f2ef112c Tunnel Runner (1983) (CBS Electronics) [a1][!] A26 m=FA;NTSC=true
sha1:fc1a0b58765a7dcbd8e33562e1074ddd9e0ac624 Tunnel Runner (1983) (CBS Electronics) [!] A26 SP_RESET=true;m=FA;NTSC=true
sha1:460094d7689ac0c4435b72e3e390f4b6f2ef112c Tunnel Runner (1983) (CBS Electronics) [a1][!] A26 SP_RESET=true;m=FA;NTSC=true
sha1:0921fab66ce4b712701326ce105e1a84ac47b497 Turbo (Coleco) Prototype Fake v0.1 (TJ) A26 m=2K;NTSC=true
sha1:b594a9acedd4734070776bf69d0f08abb5c261bf Turbo WIP (TJ) A26 m=F8;NTSC=true
sha1:1162fe46977f01b4d25efab813e0d05ec90aeadc Turmoil (1982) (20th Century Fox) [!] A26 m=4K;NTSC=true
@ -2596,7 +2596,7 @@ sha1:082a7bc7d0fdbf307501cd146e18ed3d03b9ec0f Vertical Ship Demo 1 (PD) A26 m=
sha1:1d641abfb95e3b4b7abaad42a8760c8c9ce993a6 Vertically Scrolling Playfield (02-02-2003) (Aaron Bergstrom) A26 m=4K;NTSC=true
sha1:24c1c6e1a495137bec53818c2cd8bd83c8336d21 Video Checkers (1978) (Atari) (PAL) [!] A26 m=4K;PAL=true
sha1:babae88a832b76d8c5af6ea63b8f10a0da5bb992 Video Checkers (1978) (Atari) A26 m=4K;NTSC=true
sha1:043ef523e4fcb9fc2fc2fda21f15671bf8620fc3 Video Chess (1978) (Atari) A26 m=4K;NTSC=true
sha1:043ef523e4fcb9fc2fc2fda21f15671bf8620fc3 Video Chess (1978) (Atari) A26 SP_FRAME=true;m=4K;NTSC=true
sha1:3f2ad3666eb713b20484e3677d8e1cac8fbd323e Video Cube (CCE) A26 m=4K;NTSC=true
sha1:1554b146d076b64776bf49136cea01f60eeba4c1 Video Jogger (Exus) (PAL) A26 m=4K;PAL=true
sha1:19d4f52d399c2ab70e411be51b715341db7a41bf Video Life (CommaVid) [h1] A26 m=CV;NTSC=true

View File

@ -0,0 +1,58 @@
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;; Type: NO-INTRO
;;; Source: Fairchild - Channel F - 20120223-000000
;;; FileGen: 2019-04-16 13:59:49 (UTC)
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;; Bad Dumps
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;; Hacks
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;; Over Dumps
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;; Translated
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;; Believed Good
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
F7BF7D55A7660FFA80D08AD1BA903FF7 Alien Invasion (USA) ChannelF USA
D89B48AE8C906488CAAC2B2AE1D63D88 Backgammon, Acey-Deucey (USA) ChannelF USA
4FA83F734C139963AA02BDBB7A52E500 Baseball (USA) ChannelF USA
25E231E7A464A32B4715BFB47AF89240 Bowling (USA) ChannelF USA
BB7F7BBBE21F142591CDCAFA98D7F6E4 Casino Poker (USA) ChannelF USA
35D61D40EF7EC337CBA092AABAC74DBD Checkers (USA) ChannelF USA
54CF17C48707467295749490D458EAFB Demonstration Cartridge (USA) ChannelF USA
F6916B665893AA8138CDE57C37E50ADA Demonstration Cartridge 2 (USA) ChannelF USA
4F11F13CBCA685CB20E888F87B3B1586 Desert Fox, Shooting Gallery (USA) ChannelF USA
6FFEDAED3C5CD8BA74D98901849CC451 Dodge It (USA) ChannelF USA
F80AF74B09D058B90E719BB7DFBDD50E Drag Race (USA) ChannelF USA
9E0711B140E22729687DB1E1354980AB Galactic Space Wars, Lunar Lander (USA) ChannelF USA
0124CD0B61DF5502AABD59029CCB6D5A Hangman (USA) ChannelF USA
4C10FA5C7316C59EFA241043FC67DFA8 Magic Numbers - Mind Reader + Nim (USA) ChannelF USA
A8E6103FCAE4D0F9E14D9EDCFC3FC493 Math Quiz I - Addition + Subtraction (USA) ChannelF USA
86B77EAFDF7B806E19E01724987E384F Math Quiz II - Multiplication + Division (USA) ChannelF USA
6565DF74539476D66FD78DE1BAC0259C Maze, Jailbreak, Blind-man's-bluff, Trailblazer (USA) ChannelF USA
53E4CC2DA0F2C167E0692B794CB7692C Maze, Jailbreak, Blind-man's-bluff, Trailblazer (USA) (Alt 1) ChannelF USA
2B3CA549E27579E4519A765FD8F52D0F Memory Match 1 & 2 (USA) ChannelF USA
1FBD86DCCA0E4619963B902C48AE77F2 Muehle, Tontauben-Schiessen, Kreatives Malspiel, Videoscope (Germany) ChannelF Germany
C2A44D22D3865B036479E9311C74D3AD Ordtaevling (Sweden) ChannelF Sweden
E90339B7068C6227D54F3C0CA637E017 Pinball Challenge (USA) ChannelF USA
5CBCDA1C44F0DAD02B0DFE209B6325D5 Pinball Challenge (USA) (Alt 1) ChannelF USA
9A894D745356A050F95410983C3BC54A Pro Football (USA) ChannelF USA
913ECBAA30816C6D78DE8651251761FC Rat' Mal (Germany) ChannelF Germany
3783B6AC359E21B99CFA17773AA811C6 Robot War, Torpedo Alley (USA) ChannelF USA
5568205F926333914DEDC8EF8BF16AF2 Schach (Germany) ChannelF Germany
DFB66EE145FAB65062FDEADAFC8DC34C Slot Machine (USA) ChannelF USA
4CB12EDAE37DF23851884B82CA410754 Sonar Search (USA) ChannelF USA
32CCA8FF09041A39251D7AADE21EE22F Space War (USA) ChannelF USA
1B409FE1154584F4D1AB76B344A73D99 Spitfire (USA) ChannelF USA
7E5C26A6D1F9A90C68669A9800BA522D Tic-Tac-Toe, Shooting Gallery, Doodle, Quadra-Doodle (USA) ChannelF USA
B074C867F235FB69CED96C6916673B45 Video Blackjack (USA) ChannelF USA
90A9B3952568F91502A7088BFB0AE07E Video Whizball (USA) ChannelF USA

View File

@ -0,0 +1,3 @@
SHA1:67F8513958C04E936B135740ED4EC6E6FA1763D5 Clean Sweep VEC
SHA1:38E38B5C60466146D4648F8929B5CE3A08DCBE0D Scramble VEC

View File

@ -13,28 +13,28 @@ namespace BizHawk.Client.ApiHawk
public MemEventsApi () : base()
{ }
public void AddReadCallback(Action cb, uint address, string domain)
public void AddReadCallback(MemoryCallbackDelegate cb, uint? address, string domain)
{
if (DebuggableCore.MemoryCallbacksAvailable())
{
DebuggableCore.MemoryCallbacks.Add(new MemoryCallback(domain, MemoryCallbackType.Read, "Plugin Hook", cb, address, null));
}
}
public void AddWriteCallback(Action cb, uint address, string domain)
public void AddWriteCallback(MemoryCallbackDelegate cb, uint? address, string domain)
{
if (DebuggableCore.MemoryCallbacksAvailable())
{
DebuggableCore.MemoryCallbacks.Add(new MemoryCallback(domain, MemoryCallbackType.Write, "Plugin Hook", cb, address, null));
}
}
public void AddExecCallback(Action cb, uint address, string domain)
public void AddExecCallback(MemoryCallbackDelegate cb, uint? address, string domain)
{
if (DebuggableCore.MemoryCallbacksAvailable() && DebuggableCore.MemoryCallbacks.ExecuteCallbacksAvailable)
{
DebuggableCore.MemoryCallbacks.Add(new MemoryCallback(domain, MemoryCallbackType.Execute, "Plugin Hook", cb, address, null));
}
}
public void RemoveMemoryCallback(Action cb)
public void RemoveMemoryCallback(MemoryCallbackDelegate cb)
{
if (DebuggableCore.MemoryCallbacksAvailable())
{

View File

@ -93,6 +93,9 @@ namespace BizHawk.Client.ApiHawk
case "TI83":
return CoreSystem.TI83;
case "VEC":
return CoreSystem.Vectrex;
case "WSWAN":
return CoreSystem.WonderSwan;
@ -105,6 +108,9 @@ namespace BizHawk.Client.ApiHawk
case "GGL":
return CoreSystem.GGL;
case "ChannelF":
return CoreSystem.ChannelF;
case "VB":
case "NGP":
case "DNGP":

View File

@ -97,7 +97,9 @@ namespace BizHawk.Client.ApiHawk
method = mainFormClass.GetMethod(name, typeList.ToArray());
}
else method = mainFormClass.GetMethod(name);
method.Invoke(clientMainFormInstance, paramList);
if(method != null)
method.Invoke(clientMainFormInstance, paramList);
}
private static object GetMainFormField(string name)
@ -161,7 +163,7 @@ namespace BizHawk.Client.ApiHawk
/// <param name="name">Savetate friendly name</param>
public static void LoadState(string name)
{
InvokeMainFormMethod("LoadState", new object[] { Path.Combine(PathManager.GetSaveStatePath(Global.Game), $"{name}.{"State"}"), name, false, false });
InvokeMainFormMethod("LoadState", new object[] { Path.Combine(PathManager.GetSaveStatePath(Global.Game), $"{name}.State"), name, false, false });
}
@ -250,7 +252,7 @@ namespace BizHawk.Client.ApiHawk
/// <param name="name">Savetate friendly name</param>
public static void SaveState(string name)
{
InvokeMainFormMethod("SaveState", new object[] { Path.Combine(PathManager.GetSaveStatePath(Global.Game), $"{name}.{"State"}"), name, false });
InvokeMainFormMethod("SaveState", new object[] { Path.Combine(PathManager.GetSaveStatePath(Global.Game), $"{name}.State"), name, false });
}
/// <summary>

View File

@ -13,7 +13,7 @@
#region MemoryMappedFiles
void MmfSetFilename(string filename);
string MmfSetFilename();
string MmfGetFilename();
int MmfScreenshot();
int MmfWrite(string mmf_filename, string outputString);
string MmfRead(string mmf_filename, int expectedSize);

View File

@ -1,7 +1,7 @@
namespace BizHawk.Client.ApiHawk
{
/// <summary>
/// This interface specifies that a client exposes a given interface, such as <seealso cref="IDebuggable"/>,
/// This interface specifies that a client exposes a given interface, such as <see cref="BizHawk.Emulation.Common.IDebuggable"/>,
/// for use by external tools.
/// </summary>
public interface IExternalApi

View File

@ -1,12 +1,14 @@
using System;
namespace BizHawk.Client.ApiHawk
{
public interface IMemEvents : IExternalApi
{
void AddReadCallback(Action cb, uint address, string domain);
void AddWriteCallback(Action cb, uint address, string domain);
void AddExecCallback(Action cb, uint address, string domain);
void RemoveMemoryCallback(Action cb);
}
}
using System;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.ApiHawk
{
public interface IMemEvents : IExternalApi
{
void AddReadCallback(MemoryCallbackDelegate cb, uint? address, string domain);
void AddWriteCallback(MemoryCallbackDelegate cb, uint? address, string domain);
void AddExecCallback(MemoryCallbackDelegate cb, uint? address, string domain);
void RemoveMemoryCallback(MemoryCallbackDelegate cb);
}
}

View File

@ -89,7 +89,7 @@ namespace SevenZip
// private static string _LibraryVersion;
private static bool? _modifyCapabale;
private static readonly PlatformLinkedLibSingleton.PlatformLinkedLibManager libLoader = PlatformLinkedLibSingleton.LinkedLibManager;
private static readonly OSTailoredCode.ILinkedLibManager libLoader = OSTailoredCode.LinkedLibManager;
private static void InitUserInFormat(object user, InArchiveFormat format)
{

View File

@ -29,9 +29,11 @@
WonderSwan,
Libretro,
VirtualBoy,
Vectrex,
NeoGeoPocket,
ZXSpectrum,
AmstradCPC,
GGL
GGL,
ChannelF
}
}

View File

@ -60,8 +60,8 @@ namespace BizHawk.Client.Common
public static BinaryStateLump BranchInputLog { get; private set; }
[Name("Branches\\FrameBuffer", "bmp")]
public static BinaryStateLump BranchFrameBuffer { get; private set; }
[Name("Branches\\LagLog", "bin")]
public static BinaryStateLump BranchLagLog { get; private set; }
[Name("Branches\\CoreFrameBuffer", "bmp")]
public static BinaryStateLump BranchCoreFrameBuffer { get; private set; }
[Name("Branches\\Header", "json")]
public static BinaryStateLump BranchHeader { get; private set; }
[Name("Branches\\Markers", "txt")]

View File

@ -129,8 +129,6 @@ namespace BizHawk.Client.Common
/// <summary>
/// Test to determine whether the supplied firmware file matches something in the firmware database
/// </summary>
/// <param name="f"></param>
/// <returns></returns>
public bool CanFileBeImported(string f)
{
try

View File

@ -154,6 +154,8 @@ namespace BizHawk.Client.Common
return SystemInfo.ZXSpectrum;
case "AmstradCPC":
return SystemInfo.AmstradCPC;
case "ChannelF":
return SystemInfo.ChannelF;
}
}
}

View File

@ -28,6 +28,8 @@ using GPGX64 = BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
using BizHawk.Emulation.Cores.Consoles.Sega.Saturn;
using BizHawk.Emulation.Cores.Consoles.NEC.PCFX;
using BizHawk.Emulation.Cores.Computers.AmstradCPC;
using BizHawk.Emulation.Cores.Consoles.Vectrex;
using BizHawk.Emulation.Cores.Consoles.ChannelF;
namespace BizHawk.Client.Common
{
@ -1078,6 +1080,9 @@ namespace BizHawk.Client.Common
Deterministic);
nextEmulator = zx;
break;
case "ChannelF":
nextEmulator = new ChannelF(nextComm, game, rom.FileData, GetCoreSettings<ChannelF>(), GetCoreSyncSettings<ChannelF>());
break;
case "AmstradCPC":
var cpc = new AmstradCPC(nextComm, Enumerable.Repeat(rom.RomData, 1), Enumerable.Repeat(rom.GameInfo, 1).ToList(), GetCoreSettings<AmstradCPC>(), GetCoreSyncSettings<AmstradCPC>());
nextEmulator = cpc;

View File

@ -183,6 +183,11 @@ namespace BizHawk.Client.Common
/// </summary>
public static SystemInfo VirtualBoy { get; } = new SystemInfo("Virtual Boy", CoreSystem.VirtualBoy, 1);
/// <summary>
/// Gets the <see cref="SystemInfo"/> instance for Vectrex
/// </summary>
public static SystemInfo Vectrex { get; } = new SystemInfo("Vextrex", CoreSystem.Vectrex, 2);
/// <summary>
/// Gets the <see cref="SystemInfo"/> instance for TI-83
/// </summary>
@ -199,10 +204,15 @@ namespace BizHawk.Client.Common
public static SystemInfo AmstradCPC { get; } = new SystemInfo("Amstrad CPC", CoreSystem.AmstradCPC, 2);
/// <summary>
/// Gets the <see cref="SystemInfo"/> instance for AmstradCPC
/// Gets the <see cref="SystemInfo"/> instance for GGL
/// </summary>
public static SystemInfo GGL { get; } = new SystemInfo("Game Gear Linked", CoreSystem.GGL, 2);
/// <summary>
/// Gets the <see cref="SystemInfo"/> instance for ChannelF
/// </summary>
public static SystemInfo ChannelF { get; } = new SystemInfo("Channel F", CoreSystem.ChannelF, 2);
#endregion Get SystemInfo
/// <summary>

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Drawing;
using BizHawk.Common;
using BizHawk.Emulation.Common;
// ReSharper disable FieldCanBeMadeReadOnly.Global
@ -341,8 +342,13 @@ namespace BizHawk.Client.Common
public int DispPrescale = 1;
// warning: we dont even want to deal with changing this at runtime. but we want it changed here for config purposes. so dont check this variable. check in GlobalWin or something like that.
public EDispMethod DispMethod = EDispMethod.SlimDX9;
/// <remarks>
/// warning: we dont even want to deal with changing this at runtime. but we want it changed here for config purposes. so dont check this variable. check in GlobalWin or something like that.
/// force DX for Windows and GDI+ for Unix when a new config is generated
/// </remarks>
public EDispMethod DispMethod = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
? EDispMethod.SlimDX9
: EDispMethod.GdiPlus;
public int DispChrome_FrameWindowed = 2;
public bool DispChrome_StatusBarWindowed = true;
@ -370,11 +376,9 @@ namespace BizHawk.Client.Common
public int DispCropBottom = 0;
// Sound options
#if WINDOWS
public ESoundOutputMethod SoundOutputMethod = ESoundOutputMethod.DirectSound;
#else
public ESoundOutputMethod SoundOutputMethod = ESoundOutputMethod.OpenAL;
#endif
public ESoundOutputMethod SoundOutputMethod = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
? ESoundOutputMethod.DirectSound
: ESoundOutputMethod.OpenAL; // force OpenAL for Unix when config is generated
public bool SoundEnabled = true;
public bool SoundEnabledNormal = true;
public bool SoundEnabledRWFF = true;

View File

@ -382,6 +382,12 @@ namespace BizHawk.Client.Common
new PathEntry { System = "PCFX", SystemDisplayName = "PCFX", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry { System = "PCFX", SystemDisplayName = "PCFX", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry { System = "PCFX", SystemDisplayName = "PCFX", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry { System = "ChannelF", SystemDisplayName = "Fairchild Channel F", Type = "Base", Path = Path.Combine(".", "ZXSpectrum"), Ordinal = 0 },
new PathEntry { System = "ChannelF", SystemDisplayName = "Fairchild Channel F", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry { System = "ChannelF", SystemDisplayName = "Fairchild Channel F", Type = "Savestates", Path = Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry { System = "ChannelF", SystemDisplayName = "Fairchild Channel F", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry { System = "ChannelF", SystemDisplayName = "Fairchild Channel F", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
};
}
}

View File

@ -231,7 +231,7 @@ namespace BizHawk.Client.Common
}
DebuggableCore.MemoryCallbacks.Add(
new MemoryCallback(domain, MemoryCallbackType.Execute, "Lua Hook", nlf.Callback, address, null));
new MemoryCallback(domain, MemoryCallbackType.Execute, "Lua Hook", nlf.MemCallback, address, null));
return nlf.Guid.ToString();
}
}
@ -270,7 +270,7 @@ namespace BizHawk.Client.Common
}
DebuggableCore.MemoryCallbacks.Add(
new MemoryCallback(domain, MemoryCallbackType.Read, "Lua Hook", nlf.Callback, address, null));
new MemoryCallback(domain, MemoryCallbackType.Read, "Lua Hook", nlf.MemCallback, address, null));
return nlf.Guid.ToString();
}
}
@ -309,7 +309,7 @@ namespace BizHawk.Client.Common
}
DebuggableCore.MemoryCallbacks.Add(
new MemoryCallback(domain, MemoryCallbackType.Write, "Lua Hook", nlf.Callback, address, null));
new MemoryCallback(domain, MemoryCallbackType.Write, "Lua Hook", nlf.MemCallback, address, null));
return nlf.Guid.ToString();
}
}

View File

@ -24,7 +24,7 @@ namespace BizHawk.Client.Common
if (Global.Emulator.MemoryCallbacksAvailable())
{
Global.Emulator.AsDebuggable().MemoryCallbacks.Remove(function.Callback);
Global.Emulator.AsDebuggable().MemoryCallbacks.Remove(function.MemCallback);
}
return base.Remove(function);
@ -40,7 +40,7 @@ namespace BizHawk.Client.Common
if (Global.Emulator.MemoryCallbacksAvailable())
{
var memoryCallbacks = Global.Emulator.AsDebuggable().MemoryCallbacks;
memoryCallbacks.RemoveAll(this.Select(w => w.Callback));
memoryCallbacks.RemoveAll(this.Select(w => w.MemCallback));
}
Clear();

View File

@ -1,5 +1,8 @@
using System;
using System.Runtime.InteropServices;
using BizHawk.Common;
using NLua;
// TODO - evaluate for re-entrancy problems
@ -18,12 +21,10 @@ namespace BizHawk.Client.Common
private string _currentDirectory;
#if WINDOWS
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool SetCurrentDirectoryW(byte* lpPathName);
[DllImport("kernel32.dll", SetLastError=true)]
static extern uint GetCurrentDirectoryW(uint nBufferLength, byte* pBuffer);
#endif
private bool CoolSetCurrentDirectory(string path, string currDirSpeedHack = null)
{
@ -42,40 +43,43 @@ namespace BizHawk.Client.Common
return true;
}
// WARNING: setting the current directory is SLOW!!! security checks for some reason.
// so we're bypassing it with windows hacks
#if WINDOWS
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
{
// WARNING: setting the current directory is SLOW!!! security checks for some reason.
// so we're bypassing it with windows hacks
fixed (byte* pstr = &System.Text.Encoding.Unicode.GetBytes($"{target}\0")[0])
return SetCurrentDirectoryW(pstr);
#else
if (System.IO.Directory.Exists(CurrentDirectory)) // race condition for great justice
{
Environment.CurrentDirectory = CurrentDirectory; // thats right, you can't set a directory as current that doesnt exist because .net's got to do SENSELESS SLOW-ASS SECURITY CHECKS on it and it can't do that on a NONEXISTENT DIRECTORY
return true;
}
else
{
return false;
}
#endif
}
else
{
if (System.IO.Directory.Exists(_currentDirectory)) // race condition for great justice
{
Environment.CurrentDirectory = _currentDirectory; // thats right, you can't set a directory as current that doesnt exist because .net's got to do SENSELESS SLOW-ASS SECURITY CHECKS on it and it can't do that on a NONEXISTENT DIRECTORY
return true;
}
else
{
return false;
}
}
}
private string CoolGetCurrentDirectory()
{
// GUESS WHAT!
// .NET DOES A SECURITY CHECK ON THE DIRECTORY WE JUST RETRIEVED
// AS IF ASKING FOR THE CURRENT DIRECTORY IS EQUIVALENT TO TRYING TO ACCESS IT
// SCREW YOU
#if WINDOWS
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
{
// GUESS WHAT!
// .NET DOES A SECURITY CHECK ON THE DIRECTORY WE JUST RETRIEVED
// AS IF ASKING FOR THE CURRENT DIRECTORY IS EQUIVALENT TO TRYING TO ACCESS IT
// SCREW YOU
var buf = new byte[32768];
fixed(byte* pBuf = &buf[0])
{
uint ret = GetCurrentDirectoryW(32767, pBuf);
return System.Text.Encoding.Unicode.GetString(buf, 0, (int)ret*2);
}
#else
fixed (byte* pBuf = &buf[0])
return System.Text.Encoding.Unicode.GetString(buf, 0, 2 * (int) GetCurrentDirectoryW(32767, pBuf));
}
else
{
return Environment.CurrentDirectory;
#endif
}
}
private void Sandbox(Action callback, Action exceptionCallback)

View File

@ -1,6 +1,8 @@
using System;
using NLua;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.Common
{
public class NamedLuaFunction
@ -26,6 +28,11 @@ namespace BizHawk.Client.Common
logCallback($"error running function attached by the event {Event}\nError message: {ex.Message}");
}
};
MemCallback = delegate
{
Callback();
};
}
public Guid Guid { get; private set; }
@ -38,6 +45,8 @@ namespace BizHawk.Client.Common
public Action Callback { get; }
public MemoryCallbackDelegate MemCallback { get; }
public void Call(string name = null)
{
LuaSandbox.Sandbox(Lua, () =>

View File

@ -93,11 +93,17 @@ namespace BizHawk.Client.Common
{
if (value)
{
Header.Add(HeaderKeys.STARTSFROMSAVERAM, "True");
if (!Header.ContainsKey(HeaderKeys.STARTSFROMSAVERAM))
{
Header.Add(HeaderKeys.STARTSFROMSAVERAM, "True");
}
}
else
{
Header.Remove(HeaderKeys.STARTSFROMSAVERAM);
if (Header.ContainsKey(HeaderKeys.STARTSFROMSAVERAM))
{
Header.Remove(HeaderKeys.STARTSFROMSAVERAM);
}
}
}
}

View File

@ -156,6 +156,8 @@ namespace BizHawk.Client.Common
backwardFrame = currentFrame;
}
}
int decayStatesLast = decayStates;
if (forwardFrame > -1 && backwardFrame > -1)
{
@ -192,10 +194,11 @@ namespace BizHawk.Client.Common
decayStates--;
}
}
else
{
// we're very sorry about failing to find states to remove, but we can't go beyond capacity, so remove at least something
// this shouldn't happen, but if we don't do it here, nothing good will happen either
if (decayStatesLast == decayStates)
{
if (_tsm.RemoveState(_tsm.GetStateFrameByIndex(1)))
{
// decrementing this if no state was removed is BAD

View File

@ -12,8 +12,8 @@ namespace BizHawk.Client.Common
public int Frame { get; set; }
public byte[] CoreData { get; set; }
public IStringLog InputLog { get; set; }
public BitmapBuffer CoreFrameBuffer { get; set; }
public BitmapBuffer OSDFrameBuffer { get; set; }
public TasLagLog LagLog { get; set; }
public TasMovieChangeLog ChangeLog { get; set; }
public DateTime TimeStamp { get; set; }
public TasMovieMarkerList Markers { get; set; }
@ -50,7 +50,7 @@ namespace BizHawk.Client.Common
var ncore = new IndexedStateLump(BinaryStateLump.BranchCoreData);
var ninput = new IndexedStateLump(BinaryStateLump.BranchInputLog);
var nframebuffer = new IndexedStateLump(BinaryStateLump.BranchFrameBuffer);
var nlaglog = new IndexedStateLump(BinaryStateLump.BranchLagLog);
var ncoreframebuffer = new IndexedStateLump(BinaryStateLump.BranchCoreFrameBuffer);
var nmarkers = new IndexedStateLump(BinaryStateLump.BranchMarkers);
var nusertext = new IndexedStateLump(BinaryStateLump.BranchUserText);
foreach (var b in this)
@ -86,9 +86,10 @@ namespace BizHawk.Client.Common
QuickBmpFile.Save(vp, s, b.OSDFrameBuffer.Width, b.OSDFrameBuffer.Height);
});
bs.PutLump(nlaglog, delegate(BinaryWriter bw)
bs.PutLump(ncoreframebuffer, delegate(Stream s)
{
b.LagLog.Save(bw);
var vp = new BitmapBufferVideoProvider(b.CoreFrameBuffer);
QuickBmpFile.Save(vp, s, b.CoreFrameBuffer.Width, b.CoreFrameBuffer.Height);
});
bs.PutLump(nmarkers, delegate(TextWriter tw)
@ -105,7 +106,7 @@ namespace BizHawk.Client.Common
ncore.Increment();
ninput.Increment();
nframebuffer.Increment();
nlaglog.Increment();
ncoreframebuffer.Increment();
nmarkers.Increment();
nusertext.Increment();
}
@ -117,7 +118,7 @@ namespace BizHawk.Client.Common
var ncore = new IndexedStateLump(BinaryStateLump.BranchCoreData);
var ninput = new IndexedStateLump(BinaryStateLump.BranchInputLog);
var nframebuffer = new IndexedStateLump(BinaryStateLump.BranchFrameBuffer);
var nlaglog = new IndexedStateLump(BinaryStateLump.BranchLagLog);
var ncoreframebuffer = new IndexedStateLump(BinaryStateLump.BranchCoreFrameBuffer);
var nmarkers = new IndexedStateLump(BinaryStateLump.BranchMarkers);
var nusertext = new IndexedStateLump(BinaryStateLump.BranchUserText);
@ -180,10 +181,11 @@ namespace BizHawk.Client.Common
b.OSDFrameBuffer = new BitmapBuffer(vp.BufferWidth, vp.BufferHeight, vp.VideoBuffer);
});
bl.GetLump(nlaglog, true, delegate(BinaryReader br)
bl.GetLump(ncoreframebuffer, false, delegate(Stream s, long length)
{
b.LagLog = new TasLagLog();
b.LagLog.Load(br);
var vp = new QuickBmpFile.LoadedBMP();
QuickBmpFile.Load(vp, s);
b.CoreFrameBuffer = new BitmapBuffer(vp.BufferWidth, vp.BufferHeight, vp.VideoBuffer);
});
b.Markers = new TasMovieMarkerList(movie);
@ -217,7 +219,7 @@ namespace BizHawk.Client.Common
ncore.Increment();
ninput.Increment();
nframebuffer.Increment();
nlaglog.Increment();
ncoreframebuffer.Increment();
nmarkers.Increment();
nusertext.Increment();
}

View File

@ -146,8 +146,6 @@ namespace BizHawk.Client.Common
{
_lagLog.Clear();
_wasLag.Clear();
////if (br.BaseStream.Length > 0)
////{ BaseStream.Length does not return the expected value.
int formatVersion = br.ReadByte();
if (formatVersion == 0)
{
@ -175,7 +173,6 @@ namespace BizHawk.Client.Common
_wasLag.Add(br.ReadBoolean());
}
}
////}
}
public bool? History(int frame)
@ -193,19 +190,6 @@ namespace BizHawk.Client.Common
return null;
}
public int LastValidFrame
{
get
{
if (_lagLog.Count == 0)
{
return 0;
}
return _lagLog.Count - 1;
}
}
public TasLagLog Clone()
{
return new TasLagLog

View File

@ -35,7 +35,7 @@ namespace BizHawk.Client.Common
public TasLagLog TasLagLog => _lagLog;
public IStringLog InputLog => Log;
public int BranchCount => Branches.Count;
public int LastValidFrame => _lagLog.LastValidFrame;
public int LastStatedFrame => _stateManager.LastStatedFrame;
public override string PreferredExtension => Extension;
public TasStateManager TasStateManager => _stateManager;
@ -225,7 +225,9 @@ namespace BizHawk.Client.Common
public void GreenzoneCurrentFrame()
{
if (Global.Emulator.Frame > LastValidFrame)
// todo: this isn't working quite right when autorestore is off and we're editing while seeking
// but accounting for that requires access to Mainform.IsSeeking
if (Global.Emulator.Frame > LastEditedFrame)
{
// emulated a new frame, current editing segment may change now. taseditor logic
LastPositionStable = false;

View File

@ -460,8 +460,6 @@ namespace BizHawk.Client.Common
/// <summary>
/// Returns index of the state right above the given frame
/// </summary>
/// <param name="frame"></param>
/// <returns></returns>
public int GetStateIndexByFrame(int frame)
{
return _states.IndexOfKey(GetStateClosestToFrame(frame).Key);
@ -470,8 +468,6 @@ namespace BizHawk.Client.Common
/// <summary>
/// Returns frame of the state at the given index
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public int GetStateFrameByIndex(int index)
{
// feos: this is called super often by decay

View File

@ -190,7 +190,7 @@ namespace BizHawk.Client.Common
case DisplayType.Signed:
return ((sbyte)val).ToString();
case DisplayType.Hex:
return val.ToHexString(2);
return $"{val:X2}";
case DisplayType.Binary:
return Convert.ToString(val, 2).PadLeft(8, '0').Insert(4, " ");
}

View File

@ -215,7 +215,7 @@ namespace BizHawk.Client.Common
case DisplayType.Signed:
return ((int)val).ToString();
case DisplayType.Hex:
return val.ToHexString(8);
return $"{val:X8}";
case DisplayType.FixedPoint_20_12:
return $"{(int)val / 4096.0:0.######}";
case DisplayType.FixedPoint_16_16:

View File

@ -202,7 +202,7 @@ namespace BizHawk.Client.Common
case DisplayType.Signed:
return ((short)val).ToString();
case DisplayType.Hex:
return val.ToHexString(4);
return $"{val:X4}";
case DisplayType.FixedPoint_12_4:
return $"{val / 16.0:F4}";
case DisplayType.Binary:

View File

@ -29,8 +29,6 @@ namespace BizHawk.Client.DBMan
/// <summary>
/// Choose output directory
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, EventArgs e)
{
var fbd = new FolderBrowserDialog();
@ -45,8 +43,6 @@ namespace BizHawk.Client.DBMan
/// <summary>
/// Add import files to the list box
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonAddFiles_Click(object sender, EventArgs e)
{
var ofd = new OpenFileDialog();
@ -70,8 +66,6 @@ namespace BizHawk.Client.DBMan
/// <summary>
/// Removes selected input files from the listbox
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonRemove_Click(object sender, EventArgs e)
{
List<string> files = new List<string>();
@ -90,8 +84,6 @@ namespace BizHawk.Client.DBMan
/// <summary>
/// Attempt to process all selected files
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonStartProcessing_Click(object sender, EventArgs e)
{
// initial checks
@ -120,7 +112,7 @@ namespace BizHawk.Client.DBMan
{
if (s.ToString().Trim() == "")
{
MessageBox.Show("The selected file: " + s.ToString() + "Cannot be found.\n\nSort this out and try again");
MessageBox.Show($"The selected file: {s}Cannot be found.\n\nSort this out and try again");
return;
}
@ -140,9 +132,7 @@ namespace BizHawk.Client.DBMan
res = dp.ParseDAT(files.ToArray());
}
string fName = "gamedb_" +
GameDB.GetSystemCode((SystemType)Enum.Parse(typeof(SystemType), comboBoxSystemSelect.SelectedValue.ToString())) +
"_DevExport_" + DateTime.UtcNow.ToString("yyyy-MM-dd_HH_mm_ss") + ".txt";
string fName = $"gamedb_{GameDB.GetSystemCode((SystemType)Enum.Parse(typeof(SystemType), comboBoxSystemSelect.SelectedValue.ToString()))}_DevExport_{DateTime.UtcNow:yyyy-MM-dd_HH_mm_ss}.txt";
try
{
@ -150,7 +140,7 @@ namespace BizHawk.Client.DBMan
}
catch (Exception ex)
{
MessageBox.Show("Error writing file: " + fName + "\n\n" + ex.Message);
MessageBox.Show($"Error writing file: {fName}\n\n{ex.Message}");
}
}

View File

@ -17,8 +17,6 @@ namespace BizHawk.Client.DBMan
/// <summary>
/// Parses multiple DAT files and returns a single GamesDB format csv string
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public abstract string ParseDAT(string[] filePath);
protected List<string> IncomingData = new List<string>();
@ -170,8 +168,6 @@ namespace BizHawk.Client.DBMan
/// <summary>
/// Used to get the correct system code (that each gamedb csv needs)
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public static string GetSystemCode(SystemType type)
{
switch (type)
@ -218,6 +214,7 @@ namespace BizHawk.Client.DBMan
Lynx,
VB,
UZE,
NGP
NGP,
ChannelF
}
}

View File

@ -27,8 +27,6 @@ namespace BizHawk.Client.DBMan
/// <summary>
/// Parses multiple DAT files and returns a single GamesDB format csv string
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public override string ParseDAT(string[] filePath)
{
foreach (var s in filePath)
@ -60,9 +58,9 @@ namespace BizHawk.Client.DBMan
// start comment block
List<string> comments = new List<string>
{
"Type:\t" + "NO-INTRO",
"Source:\t" + description,
"FileGen:\t" + DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + " (UTC)",
"Type:\tNO-INTRO",
$"Source:\t{description}",
$"FileGen:\t{DateTime.UtcNow:yyyy-MM-dd HH:mm:ss} (UTC)",
};
AddCommentBlock(comments.ToArray());
@ -116,7 +114,6 @@ namespace BizHawk.Client.DBMan
/// Detailed info here: https://www.tosecdev.org/tosec-naming-convention
/// Guts of this has been reused from here: https://github.com/Asnivor/MedLaunch/blob/master/MedLaunch/_Debug/DATDB/Platforms/TOSEC/StringConverterToSec.cs
/// </summary>
/// <param name="g"></param>
private void ParseNOINTROFlags(GameDB g)
{
string nameString = g.Name;

View File

@ -27,8 +27,6 @@ namespace BizHawk.Client.DBMan
/// <summary>
/// Parses multiple DAT files and returns a single GamesDB format csv string
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public override string ParseDAT(string[] filePath)
{
foreach (var s in filePath)
@ -61,9 +59,9 @@ namespace BizHawk.Client.DBMan
// start comment block
List<string> comments = new List<string>
{
"Type:\t" + category,
"Source:\t" + description,
"FileGen:\t" + DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + " (UTC)",
$"Type:\t{category}",
$"Source:\t{description}",
$"FileGen:\t{DateTime.UtcNow:yyyy-MM-dd HH:mm:ss} (UTC)",
};
AddCommentBlock(comments.ToArray());
@ -121,7 +119,6 @@ namespace BizHawk.Client.DBMan
/// Detailed info here: https://www.tosecdev.org/tosec-naming-convention
/// Guts of this has been reused from here: https://github.com/Asnivor/MedLaunch/blob/master/MedLaunch/_Debug/DATDB/Platforms/TOSEC/StringConverterToSec.cs
/// </summary>
/// <param name="g"></param>
private void ParseTOSECFlags(GameDB g)
{
string nameString = g.Name;

View File

@ -36,7 +36,7 @@ namespace BizHawk.Client.DBMan
}
}
public string SizeFriendly { get { return string.Format("{0} bytes ({1}k)", Size, Size / 1024); } }
public string SizeFriendly => $"{Size} bytes ({Size >> 10}k)";
public bool New { get { return (Created > Modified); } }
public string NameWithTheFlipped

View File

@ -190,10 +190,7 @@ namespace BizHawk.Client.DBMan
}
}
static string Hash_CRC32(byte[] data)
{
return string.Format("{0:X8}", CRC32.Calculate(data));
}
static string Hash_CRC32(byte[] data) => $"{CRC32.Calculate(data):X8}";
static string Hash_SHA1(byte[] data)
{

View File

@ -136,7 +136,6 @@ namespace BizHawk.Client.EmuHawk
/// opens an avi file for recording with the supplied enumerator used to name files.
/// set a video codec token first.
/// </summary>
/// <param name="nameProvider"></param>
public void OpenFile(IEnumerator<string> nameProvider)
{
_nameProvider = nameProvider;

View File

@ -6,6 +6,7 @@ using System.Diagnostics;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Common;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
@ -85,12 +86,9 @@ namespace BizHawk.Client.EmuHawk
try
{
_ffmpeg = new Process();
#if WINDOWS
_ffmpeg.StartInfo.FileName = Path.Combine(PathManager.GetDllDirectory(), "ffmpeg.exe");
#else
ffmpeg.StartInfo.FileName = "ffmpeg"; // expecting native version to be in path
#endif
_ffmpeg.StartInfo.FileName = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
? Path.Combine(PathManager.GetDllDirectory(), "ffmpeg.exe")
: "ffmpeg";
_ffmpeg.StartInfo.Arguments = $"-y -f nut -i - {_token.Commandline} \"{_baseName}{(_segment == 0 ? string.Empty : $"_{_segment}")}{_ext}\"";
_ffmpeg.StartInfo.CreateNoWindow = true;
@ -162,7 +160,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// returns a string containing the commandline sent to ffmpeg and recent console (stderr) output
/// </summary>
/// <returns></returns>
private string ffmpeg_geterror()
{
if (_ffmpeg.StartInfo.RedirectStandardError)

View File

@ -43,7 +43,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// get a list of canned presets
/// </summary>
/// <returns></returns>
public static FormatPreset[] GetPresets()
{
return new[]

View File

@ -94,19 +94,18 @@ namespace BizHawk.Client.EmuHawk
/// <param name="rerecords">Number of rerecords on movie file</param>
void SetMetaData(string gameName, string authors, UInt64 lengthMS, UInt64 rerecords);
/// <summary>
/// short description of this IVideoWriter
/// </summary>
// string WriterDescription();
// /// <summary>
// /// short description of this IVideoWriter
// /// </summary>
// string WriterDescription();
/// <summary>
/// what default extension this writer would like to put on its output
/// </summary>
string DesiredExtension();
/// <summary>
/// name that command line parameters can refer to
/// </summary>
/// <returns></returns>
// string ShortName();
// /// <summary>
// /// name that command line parameters can refer to
// /// </summary>
// string ShortName();
}
public static class VideoWriterExtensions

View File

@ -267,7 +267,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// write big endian 16 bit unsigned
/// </summary>
/// <param name="v"></param>
void writeBE16(UInt16 v)
{
byte[] b = new byte[2];
@ -279,7 +278,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// write big endian 32 bit unsigned
/// </summary>
/// <param name="v"></param>
void writeBE32(UInt32 v)
{
byte[] b = new byte[4];
@ -293,7 +291,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// write big endian 64 bit unsigned
/// </summary>
/// <param name="v"></param>
void writeBE64(UInt64 v)
{
byte[] b = new byte[8];
@ -309,7 +306,6 @@ namespace BizHawk.Client.EmuHawk
/// write variable length value
/// encoding is similar to MIDI
/// </summary>
/// <param name="v"></param>
void writeVar(UInt64 v)
{
byte[] b = new byte[10];
@ -333,7 +329,6 @@ namespace BizHawk.Client.EmuHawk
/// write variable length value
/// encoding is similar to MIDI
/// </summary>
/// <param name="v"></param>
private void writeVar(int v)
{
if (v < 0)
@ -365,7 +360,6 @@ namespace BizHawk.Client.EmuHawk
/// actually write a packet to file
/// timestamp sequence must be nondecreasing
/// </summary>
/// <param name="j"></param>
void writeActual(JMDPacket j)
{
if (j.timestamp < timestampoff)
@ -408,7 +402,6 @@ namespace BizHawk.Client.EmuHawk
/// assemble JMDPacket and send to packetqueue
/// one audio packet is split up into many many JMD packets, since JMD requires only 2 samples (1 left, 1 right) per packet
/// </summary>
/// <param name="samples"></param>
public void AddSamples(short[] samples)
{
if (!stereo)
@ -459,7 +452,6 @@ namespace BizHawk.Client.EmuHawk
/// will be written when order-appropriate wrt video
/// the sound packets added must be internally ordered (but need not match video order)
/// </summary>
/// <param name="j"></param>
void writesound(JMDPacket j)
{
while (vstorage.Count > 0)
@ -479,7 +471,6 @@ namespace BizHawk.Client.EmuHawk
/// will be written when order-appropriate wrt audio
/// the video packets added must be internally ordered (but need not match audio order)
/// </summary>
/// <param name="j"></param>
void writevideo(JMDPacket j)
{
while (astorage.Count > 0)
@ -593,8 +584,6 @@ namespace BizHawk.Client.EmuHawk
/// can be changed in future
/// should always match IVideoProvider
/// </summary>
/// <param name="width"></param>
/// <param name="height"></param>
public void SetVideoParameters(int width, int height)
{
// each frame is dumped independently with its own resolution tag, so we don't care to store this

View File

@ -24,9 +24,6 @@ namespace BizHawk.Client.EmuHawk
private readonly int _capacity;
/// <summary>
///
/// </summary>
/// <param name="capacity">total number of buffers to keep around</param>
public ReusableBufferPool(int capacity)
{
@ -153,8 +150,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// big endian 64 bit unsigned
/// </summary>
/// <param name="v"></param>
/// <param name="stream"></param>
static void WriteBE64(ulong v, Stream stream)
{
byte[] b = new byte[8];
@ -169,8 +164,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// big endian 32 bit unsigned
/// </summary>
/// <param name="v"></param>
/// <param name="stream"></param>
static void WriteBE32(uint v, Stream stream)
{
byte[] b = new byte[4];
@ -185,8 +178,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// big endian 32 bit unsigned
/// </summary>
/// <param name="v"></param>
/// <param name="stream"></param>
static void WriteBE32(int v, Stream stream)
{
byte[] b = new byte[4];
@ -213,7 +204,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// seems to be different than standard CRC32?????
/// </summary>
/// <param name="buf"></param>
/// <returns>crc32, nut variant</returns>
static uint NutCRC32(byte[] buf)
{
@ -510,8 +500,6 @@ namespace BizHawk.Client.EmuHawk
ReusableBufferPool<byte> _pool;
/// <summary>
/// </summary>
/// <param name="payload">frame data</param>
/// <param name="payloadlen">actual length of frame data</param>
/// <param name="pts">presentation timestamp</param>
@ -562,9 +550,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// compare two NutFrames by pts
/// </summary>
/// <param name="lhs"></param>
/// <param name="rhs"></param>
/// <returns></returns>
public static bool operator <=(NutFrame lhs, NutFrame rhs)
{
BigInteger left = new BigInteger(lhs.pts);
@ -587,7 +572,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// write out frame, with syncpoint and all headers
/// </summary>
/// <param name="dest"></param>
public void WriteData(Stream dest)
{
dest.Write(data, 0, actual_length);

View File

@ -149,7 +149,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// Add a given color value to the octree
/// </summary>
/// <param name="pixel"></param>
public void AddColor(int pixel)
{
// Check if this request is for the same color as the last
@ -267,8 +266,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// Get the palette index for the passed color
/// </summary>
/// <param name="pixel"></param>
/// <returns></returns>
public int GetPaletteIndex(int pixel)
{
int ret = -1;

View File

@ -104,7 +104,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// open a new underlying stream
/// </summary>
/// <param name="next"></param>
private void opencurrent(Stream next)
{
file = new BinaryWriter(next, Encoding.ASCII);

View File

@ -163,24 +163,16 @@ namespace BizHawk.Client.EmuHawk
private void AboutBox_Load(object sender, EventArgs e)
{
#if DEBUG
Text = $"BizHawk Developer Build (DEBUG MODE) GIT {SubWCRev.GIT_BRANCH}#{SubWCRev.GIT_SHORTHASH}";
Text = $"BizHawk Developer Build (DEBUG MODE) GIT {SubWCRev.GIT_BRANCH}#{SubWCRev.GIT_SHORTHASH}";
#else
Text = $"BizHawk Developer Build (RELEASE MODE) GIT {SubWCRev.GIT_BRANCH}#{SubWCRev.GIT_SHORTHASH}";
#endif
if (DateTime.Now.Month == 12)
if (DateTime.Now.Month == 12)
{
if (DateTime.Now.Day > 17 && DateTime.Now.Day <= 25)
{
pictureBox1.Image = Properties.Resources.alt_about_image;
}
if (DateTime.Now.Month == 2)
{
if (DateTime.Now.Day >= 7 && DateTime.Now.Day <= 14)
{
pictureBox1.Image = Properties.Resources.HawkInLove;
pictureBox1.Location = new Point(pictureBox1.Location.X - 40, pictureBox1.Location.Y);
pictureBox1.Width = pictureBox1.Width + 80;
}
}
}

View File

@ -48,14 +48,41 @@ namespace BizHawk.Client.EmuHawk
{
GlobalWin.socketServer.SetTimeout(timeout);
}
public void SocketServerSetIp(string ip)
{
GlobalWin.socketServer.Ip = ip;
}
public void SetSocketServerPort(int port)
{
GlobalWin.socketServer.Port = port;
}
public string SocketServerGetIp()
{
return GlobalWin.socketServer.Ip;
}
public int SocketServerGetPort()
{
return GlobalWin.socketServer.Port;
}
public string SocketServerGetInfo()
{
return GlobalWin.socketServer.GetInfo();
}
// All MemoryMappedFile related methods
public void MmfSetFilename(string filename)
{
GlobalWin.memoryMappedFiles.SetFilename(filename);
GlobalWin.memoryMappedFiles.Filename = filename;
}
public string MmfSetFilename()
public string MmfGetFilename()
{
return GlobalWin.memoryMappedFiles.GetFilename();
return GlobalWin.memoryMappedFiles.Filename;
}
public int MmfScreenshot()
@ -67,10 +94,13 @@ namespace BizHawk.Client.EmuHawk
{
return GlobalWin.memoryMappedFiles.WriteToFile(mmf_filename, Encoding.ASCII.GetBytes(outputString));
}
public string MmfRead(string mmf_filename, int expectedSize)
{
return GlobalWin.memoryMappedFiles.ReadFromFile(mmf_filename, expectedSize).ToString();
}
// All HTTP related methods
public string HttpTest()
{
@ -103,19 +133,19 @@ namespace BizHawk.Client.EmuHawk
}
public void HttpSetPostUrl(string url)
{
GlobalWin.httpCommunication.SetPostUrl(url);
GlobalWin.httpCommunication.PostUrl = url;
}
public void HttpSetGetUrl(string url)
{
GlobalWin.httpCommunication.SetGetUrl(url);
GlobalWin.httpCommunication.GetUrl = url;
}
public string HttpGetPostUrl()
{
return GlobalWin.httpCommunication.GetPostUrl();
return GlobalWin.httpCommunication.PostUrl;
}
public string HttpGetGetUrl()
{
return GlobalWin.httpCommunication.GetGetUrl();
return GlobalWin.httpCommunication.GetUrl;
}
}
}

View File

@ -2,14 +2,15 @@
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{
class ArgParser
//parses command line arguments and adds the values to a class attribute
//default values are null for strings and false for boolean
//the last value will overwrite previously set values
//unrecognized parameters are simply ignored or in the worst case assumed to be a ROM name [cmdRom]
class ArgParser
//parses command line arguments and adds the values to a class attribute
//default values are null for strings and false for boolean
//the last value will overwrite previously set values
//unrecognized parameters are simply ignored or in the worst case assumed to be a ROM name [cmdRom]
{
public string cmdRom = null;
public string cmdLoadSlot = null;
@ -21,28 +22,28 @@ namespace BizHawk.Client.EmuHawk
public string cmdDumpName = null;
public HashSet<int> _currAviWriterFrameList;
public int _autoDumpLength;
public bool _autoCloseOnDump = false;
// chrome is never shown, even in windowed mode
public bool _autoCloseOnDump = false;
// chrome is never shown, even in windowed mode
public bool _chromeless = false;
public bool startFullscreen = false;
public string luaScript = null;
public bool luaConsole = false;
public int socket_port = 9999;
public int socket_port = 0;
public string socket_ip = null;
public string mmf_filename = null;
public string URL_get = null;
public string URL_post = null;
public bool? audiosync = null;
public void ParseArguments(string[] args)
{
for (int i = 0; i < args.Length; i++)
{
// For some reason sometimes visual studio will pass this to us on the commandline. it makes no sense.
{
// For some reason sometimes visual studio will pass this to us on the commandline. it makes no sense.
if (args[i] == ">")
{
i++;
var stdout = args[i];
var stdout = args[i];
Console.SetOut(new StreamWriter(stdout));
continue;
}
@ -77,9 +78,9 @@ namespace BizHawk.Client.EmuHawk
foreach (string item in items)
{
_currAviWriterFrameList.Add(int.Parse(item));
}
// automatically set dump length to maximum frame
}
// automatically set dump length to maximum frame
_autoDumpLength = _currAviWriterFrameList.OrderBy(x => x).Last();
}
else if (arg.StartsWith("--dump-name="))
@ -131,43 +132,63 @@ namespace BizHawk.Client.EmuHawk
{
URL_post = args[i].Substring(args[i].IndexOf('=') + 1);
}
else if (arg.StartsWith("--audiosync="))
{
audiosync = arg.Substring(arg.IndexOf('=') + 1) == "true";
}
else
{
cmdRom = args[i];
}
}
////initialize HTTP communication
}
//initialize HTTP communication
if (URL_get != null || URL_post != null)
{
GlobalWin.httpCommunication = new Communication.HttpCommunication();
if (URL_get != null)
{
GlobalWin.httpCommunication.initialized = true;
GlobalWin.httpCommunication.SetGetUrl(URL_get);
GlobalWin.httpCommunication.GetUrl = URL_get;
}
if (URL_post != null)
{
GlobalWin.httpCommunication.initialized = true;
GlobalWin.httpCommunication.SetPostUrl(URL_post);
GlobalWin.httpCommunication.PostUrl = URL_post;
}
}
//inititalize socket server
if (socket_ip != null && socket_port > -1)
{
GlobalWin.socketServer.initialized = true;
}
//inititalize socket server
if (socket_ip != null && socket_port > 0)
{
GlobalWin.socketServer = new Communication.SocketServer();
GlobalWin.socketServer.SetIp(socket_ip, socket_port);
}
else if (socket_ip != null)
else if (socket_ip == null ^ socket_port == 0)
{
GlobalWin.socketServer.initialized = true;
GlobalWin.socketServer.SetIp(socket_ip);
}
//initialize mapped memory files
throw new ArgParserException("Socket server needs both --socket_ip and --socket_port. Socket server was not started");
}
//initialize mapped memory files
if (mmf_filename != null)
{
GlobalWin.memoryMappedFiles.initialized = true;
GlobalWin.memoryMappedFiles.SetFilename(mmf_filename);
GlobalWin.memoryMappedFiles = new Communication.MemoryMappedFiles();
GlobalWin.memoryMappedFiles.Filename = mmf_filename;
}
}
public static string GetCmdConfigFile(string[] args)
{
return args.FirstOrDefault(arg => arg.StartsWith("--config=", StringComparison.InvariantCultureIgnoreCase))?.Substring(9);
}
}
class ArgParserException : Exception
{
public ArgParserException()
{
}
public ArgParserException(string message) : base(message)
{
}
}
}
}

View File

@ -113,8 +113,8 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\BizHawk.Common\PlatformLinkedLibSingleton.cs">
<Link>PlatformLinkedLibSingleton.cs</Link>
<Compile Include="..\BizHawk.Common\OSTailoredCode.cs">
<Link>OSTailoredCode.cs</Link>
</Compile>
<Compile Include="..\Version\svnrev.cs">
<Link>svnrev.cs</Link>
@ -2283,4 +2283,4 @@
<PreBuildEvent />
</PropertyGroup>
<Import Project="$(SolutionDir)Build\Common.targets" />
</Project>
</Project>

View File

@ -12,7 +12,6 @@ using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Emulation.Common.IEmulatorExtensions;
using System.Windows.Forms;
using System.IO;
namespace BizHawk.Client.EmuHawk
{
@ -23,16 +22,14 @@ namespace BizHawk.Client.EmuHawk
public class HttpCommunication
{
private static HttpClient client = new HttpClient();
private string PostUrl = "http://localhost:9876/post/";
private string GetUrl = "http://localhost:9876/index";
public bool initialized = false;
public string PostUrl { get; set; } = null;
public string GetUrl { get; set; } = null;
private ScreenShot screenShot = new ScreenShot();
public int timeout = 0;
public int default_timeout = 500;
public void SetTimeout(int _timeout)
{
//timeout = _timeout.TotalMilliseconds;
if (timeout == 0 && _timeout == 0)
{
timeout = default_timeout;
@ -41,32 +38,15 @@ namespace BizHawk.Client.EmuHawk
{
client.Timeout = new TimeSpan(0, 0, 0, _timeout / 1000, _timeout % 1000);
timeout = _timeout;
}
}
public void SetPostUrl(string url)
{
PostUrl = url;
}
public void SetGetUrl(string url)
{
GetUrl = url;
}
public string GetGetUrl()
{
return GetUrl;
}
public string GetPostUrl()
{
return PostUrl;
}
}
public async Task<string> Get(string url)
{
client.DefaultRequestHeaders.ConnectionClose = false;
HttpResponseMessage response = await client.GetAsync(url).ConfigureAwait(false);
if (response.IsSuccessStatusCode) {
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync();
}
else
@ -82,11 +62,9 @@ namespace BizHawk.Client.EmuHawk
try
{
response = await client.PostAsync(url, content).ConfigureAwait(false);
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
return e.ToString();
}
@ -161,75 +139,89 @@ namespace BizHawk.Client.EmuHawk
return Post(PostUrl, content).Result;
}
}
public class SocketServer
{
string ip = null;
public string Ip
{
get { return ip; }
set
{
ip = value;
ipAdd = System.Net.IPAddress.Parse(ip);
Connect();
}
}
public string ip = "192.168.178.21";
public int port = 9999;
public Decoder decoder = Encoding.UTF8.GetDecoder();
public Socket soc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
public IPAddress ipAdd;
public IPEndPoint remoteEP;
public IVideoProvider currentVideoProvider = null;
int port = 0;
public int Port
{
get { return port; }
set
{
port = value;
Connect();
}
}
readonly Decoder decoder = Encoding.UTF8.GetDecoder();
Socket soc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPAddress ipAdd;
IPEndPoint remoteEP;
IVideoProvider currentVideoProvider = null;
public bool connected = false;
public bool initialized = false;
public int retries = 10;
public int Retries { get; set; } = 10;
public bool success = false; //indicates whether the last command was executed succesfully
public void Initialize(IVideoProvider _currentVideoProvider)
public void Initialize()
{
currentVideoProvider = _currentVideoProvider;
SetIp(ip, port);
if (currentVideoProvider == null) currentVideoProvider = Global.Emulator.AsVideoProviderOrDefault();
initialized = true;
}
public void Connect()
{
if (!initialized)
{
Initialize(currentVideoProvider);
}
remoteEP = new IPEndPoint(ipAdd, port);
soc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
soc.Connect(remoteEP);
connected = true;
soc.ReceiveTimeout = 5;
}
public void SetIp(string ip_)
{
ip = ip_;
ipAdd = System.Net.IPAddress.Parse(ip);
remoteEP = new IPEndPoint(ipAdd, port);
}
public void SetIp(string ip_, int port_)
{
ip = ip_;
port = port_;
ipAdd = System.Net.IPAddress.Parse(ip);
remoteEP = new IPEndPoint(ipAdd, port);
Connect();
}
public string GetInfo()
{
return $"{ip}:{port}";
}
public void SetTimeout(int timeout)
{
soc.ReceiveTimeout = timeout;
}
public void SocketConnected()
{
bool part1 = soc.Poll(1000, SelectMode.SelectRead);
bool part2 = (soc.Available == 0);
if (part1 && part2)
connected = false;
else
connected = true;
connected = !(part1 && part2);
}
public int SendString(string SendString)
{
int sentBytes = SendBytes(Encoding.ASCII.GetBytes(SendString));
success = sentBytes > 0;
return sentBytes;
}
public int SendBytes(byte[] SendBytes)
{
int sentBytes = 0;
@ -248,11 +240,12 @@ namespace BizHawk.Client.EmuHawk
{
return SendScreenshot(0);
}
public string SendScreenshot(int waitingTime)
{
if (!connected)
if (!initialized)
{
Connect();
Initialize();
}
ScreenShot screenShot = new ScreenShot();
using (BitmapBuffer bb = screenShot.MakeScreenShotImage())
@ -262,7 +255,7 @@ namespace BizHawk.Client.EmuHawk
byte[] bmpBytes = screenShot.ImageToByte(img);
int sentBytes = 0;
int tries = 0;
while (sentBytes <= 0 && tries < retries)
while (sentBytes <= 0 && tries < Retries)
{
try
{
@ -279,7 +272,7 @@ namespace BizHawk.Client.EmuHawk
Connect();
}
}
success = (tries < retries);
success = (tries < Retries);
}
}
String resp = "";
@ -294,7 +287,7 @@ namespace BizHawk.Client.EmuHawk
{
return resp;
}
resp = "";
resp = ReceiveMessage();
if (resp == "")
{
@ -302,6 +295,7 @@ namespace BizHawk.Client.EmuHawk
}
return resp;
}
public string ReceiveMessage()
{
if (!connected)
@ -318,14 +312,15 @@ namespace BizHawk.Client.EmuHawk
{
receivedLength = soc.Receive(receivedBytes, receivedBytes.Length, 0);
resp += Encoding.ASCII.GetString(receivedBytes);
} catch
}
catch
{
receivedLength = 0;
}
}
return resp;
}
public bool Successful()
{
return success;
@ -334,29 +329,19 @@ namespace BizHawk.Client.EmuHawk
public class MemoryMappedFiles
{
public string filename_main = "BizhawkTemp_main";
public string Filename { get; set; } = "BizhawkTemp_main";
public Dictionary<string, MemoryMappedFile> mmf_files = new Dictionary<string, MemoryMappedFile>();
public int index = 0;
public bool initialized = false;
public int main_size = 10 ^ 5;
ScreenShot screenShot = new ScreenShot();
public void SetFilename(string filename)
{
filename_main = filename;
}
public string GetFilename()
{
return filename_main;
}
public int ScreenShotToFile()
{
ScreenShot screenShot = new ScreenShot();
var bb = screenShot.MakeScreenShotImage();
var img = bb.ToSysdrawingBitmap();
byte[] bmpBytes = screenShot.ImageToByte(img);
return WriteToFile(@filename_main, bmpBytes);
return WriteToFile(@Filename, bmpBytes);
}
public int WriteToFile(string filename, byte[] outputBytes)
@ -384,7 +369,6 @@ namespace BizHawk.Client.EmuHawk
}
catch (Exception)
{
}
mmf_file = MemoryMappedFile.CreateOrOpen(filename, outputBytes.Length);
@ -417,6 +401,7 @@ namespace BizHawk.Client.EmuHawk
{
private IVideoProvider currentVideoProvider = null;
private ImageConverter converter = new ImageConverter();
public BitmapBuffer MakeScreenShotImage()
{
if (currentVideoProvider == null)
@ -425,14 +410,17 @@ namespace BizHawk.Client.EmuHawk
}
return GlobalWin.DisplayManager.RenderVideoProvider(currentVideoProvider);
}
public byte[] ImageToByte(Image img)
{
return (byte[])converter.ConvertTo(img, typeof(byte[]));
}
public string ImageToString(Image img)
{
return Convert.ToBase64String(ImageToByte(img));
}
public string GetScreenShotAsString()
{
BitmapBuffer bb = MakeScreenShotImage();
@ -440,6 +428,18 @@ namespace BizHawk.Client.EmuHawk
return Convert.ToBase64String(imgBytes);
}
}
class CommunicationSocketServerException : Exception
{
public CommunicationSocketServerException()
{
}
public CommunicationSocketServerException(string message) : base(message)
{
}
}
}
}

View File

@ -125,7 +125,6 @@ namespace BizHawk.Client.EmuHawk.CustomControls
/// </summary>
/// <param name="maxWidth">the max width to render the string in</param>
/// <param name="charFit">the number of characters that will fit under <see cref="maxWidth"/> restriction</param>
/// <param name="charFitWidth"></param>
public Size MeasureString(string str, Font font, float maxWidth, out int charFit, out int charFitWidth)
{
SetFont(font);

View File

@ -530,7 +530,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// Calls QueryItemBkColor callback for all visible cells and fills in the background of those cells.
/// </summary>
/// <param name="e"></param>
private void DoBackGroundCallback(PaintEventArgs e, List<RollColumn> visibleColumns)
{
int startIndex = FirstVisibleRow;

View File

@ -289,7 +289,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// Returns all columns including those that are not visible
/// </summary>
/// <returns></returns>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public RollColumns AllColumns => _columns;
@ -1196,7 +1195,7 @@ namespace BizHawk.Client.EmuHawk
if (AllowRightClickSelecton && e.Button == MouseButtons.Right)
{
if (!IsHoveringOnColumnCell)
if (!IsHoveringOnColumnCell && CurrentCell != null)
{
_currentX = e.X;
_currentY = e.Y;

View File

@ -288,7 +288,6 @@ namespace BizHawk.Client.EmuHawk.CustomControls
/// <summary>
/// Paint the System Icon in the top left corner.
/// </summary>
/// <param name="e"></param>
protected override void OnPaint(PaintEventArgs e)
{
if (m_sysIcon != null)

View File

@ -141,9 +141,6 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// returns a new surface
/// </summary>
/// <param name="xpad"></param>
/// <param name="ypad"></param>
/// <returns></returns>
public DisplaySurface ToPaddedSurface(int xpad0, int ypad0, int xpad1, int ypad1)
{
int new_width = Width + xpad0 + xpad1;

View File

@ -126,7 +126,7 @@ namespace BizHawk.Client.EmuHawk.WinFormExtensions
#region Enumerable to Enumerable<T>
/// <summary>
/// Converts the outdated IEnumerable Controls property to a IEnumerable<T> like .NET should have done a long time ago
/// Converts the outdated IEnumerable Controls property to an <see cref="IEnumerable{T}"/> like .NET should have done a long time ago
/// </summary>
public static IEnumerable<Control> Controls(this Control control)
{

View File

@ -26,8 +26,8 @@ namespace BizHawk.Client.EmuHawk
public static GLManager GLManager;
public static int ExitCode;
public static Communication.HttpCommunication httpCommunication = new Communication.HttpCommunication();
public static Communication.SocketServer socketServer = new Communication.SocketServer();
public static Communication.MemoryMappedFiles memoryMappedFiles = new Communication.MemoryMappedFiles();
public static Communication.HttpCommunication httpCommunication = null;
public static Communication.SocketServer socketServer = null;
public static Communication.MemoryMappedFiles memoryMappedFiles = null;
}
}

View File

@ -42,7 +42,6 @@
/// when a Tool sets WantsToControlRewind
/// Returns whether or not the rewind action actually occured
/// </summary>
/// <returns></returns>
bool Rewind();
bool WantsToControlRestartMovie { get; }

View File

@ -123,24 +123,24 @@ namespace BizHawk.Client.EmuHawk
public static void Initialize()
{
if (PlatformLinkedLibSingleton.RunningOnUnix)
{
OTK_Keyboard.Initialize();
// OTK_Gamepad.Initialize();
}
else
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
{
KeyInput.Initialize();
IPCKeyInput.Initialize();
GamePad.Initialize();
GamePad360.Initialize();
}
else
{
OTK_Keyboard.Initialize();
// OTK_Gamepad.Initialize();
}
Instance = new Input();
}
public static void Cleanup()
{
if (!PlatformLinkedLibSingleton.RunningOnUnix)
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
{
KeyInput.Cleanup();
GamePad.Cleanup();
@ -331,18 +331,18 @@ namespace BizHawk.Client.EmuHawk
{
while (true)
{
var keyEvents = PlatformLinkedLibSingleton.RunningOnUnix
? OTK_Keyboard.Update()
: KeyInput.Update().Concat(IPCKeyInput.Update());
if (PlatformLinkedLibSingleton.RunningOnUnix)
{
//TODO
}
else
var keyEvents = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
? KeyInput.Update().Concat(IPCKeyInput.Update())
: OTK_Keyboard.Update();
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
{
GamePad.UpdateAll();
GamePad360.UpdateAll();
}
else
{
//TODO
}
//this block is going to massively modify data structures that the binding method uses, so we have to lock it all
lock (this)

View File

@ -25,6 +25,7 @@ using BizHawk.Client.EmuHawk.WinFormExtensions;
using BizHawk.Client.EmuHawk.ToolExtensions;
using BizHawk.Emulation.Cores.Computers.AppleII;
using BizHawk.Client.ApiHawk;
using BizHawk.Common;
using BizHawk.Emulation.Cores.Computers.Commodore64;
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
using BizHawk.Emulation.Cores.Computers.SinclairSpectrum;
@ -1469,7 +1470,14 @@ namespace BizHawk.Client.EmuHawk
private void RamSearchMenuItem_Click(object sender, EventArgs e)
{
GlobalWin.Tools.Load<RamSearch>();
var ramSearch = GlobalWin.Tools.Load<RamSearch>();
if (OSTailoredCode.CurrentOS != OSTailoredCode.DistinctOS.Windows)
{
// this is apparently needed for weird mono-forms-on-different-thread issues
// dont do .Show() within Load<T>() for RamSearch - instead put an instance of it here on MainForm, then show here
// the mono winforms implementation is.... weird and buggy
ramSearch.Show();
}
}
private void LuaConsoleMenuItem_Click(object sender, EventArgs e)

View File

@ -104,6 +104,11 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.OSD.AddMessage("Warning: Movie hash does not match the ROM");
}
if (Emulator is NullEmulator)
{
return false;
}
return true;
}

View File

@ -155,13 +155,22 @@ namespace BizHawk.Client.EmuHawk
.ReadAllBytes();
}
};
argParser.ParseArguments(args);
try
{
argParser.ParseArguments(args);
}
catch (ArgParserException e)
{
MessageBox.Show(e.Message);
}
Database.LoadDatabase(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb", "gamedb.txt"));
// TODO GL - a lot of disorganized wiring-up here
CGC.CGCBinPath = Path.Combine(PathManager.GetDllDirectory(), "cgc.exe");
CGC.CGCBinPath = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
? Path.Combine(PathManager.GetDllDirectory(), "cgc.exe")
: "cgc"; // installed separately (via package manager or from https://developer.nvidia.com/cg-toolkit-download), look in $PATH
PresentationPanel = new PresentationPanel();
PresentationPanel.GraphicsControl.MainWindow = true;
GlobalWin.DisplayManager = new DisplayManager(PresentationPanel);
@ -287,6 +296,11 @@ namespace BizHawk.Client.EmuHawk
LoadRomFromRecent(Global.Config.RecentRoms.MostRecent);
}
if (argParser.audiosync.HasValue)
{
Global.Config.VideoWriterAudioSync = argParser.audiosync.Value;
}
if (argParser.cmdMovie != null)
{
_supressSyncSettingsWarning = true; // We dont' want to be nagged if we are attempting to automate
@ -1052,7 +1066,7 @@ namespace BizHawk.Client.EmuHawk
if (!_inFullscreen)
{
SuspendLayout();
#if WINDOWS
// Work around an AMD driver bug in >= vista:
// It seems windows will activate opengl fullscreen mode when a GL control is occupying the exact space of a screen (0,0 and dimensions=screensize)
// AMD cards manifest a problem under these circumstances, flickering other monitors.
@ -1060,7 +1074,9 @@ namespace BizHawk.Client.EmuHawk
// (this could be determined with more work; other side affects of the fullscreen mode include: corrupted taskbar, no modal boxes on top of GL control, no screenshots)
// At any rate, we can solve this by adding a 1px black border around the GL control
// Please note: It is important to do this before resizing things, otherwise momentarily a GL control without WS_BORDER will be at the magic dimensions and cause the flakeout
if (Global.Config.DispFullscreenHacks && Global.Config.DispMethod == Config.EDispMethod.OpenGL)
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
&& Global.Config.DispFullscreenHacks
&& Global.Config.DispMethod == Config.EDispMethod.OpenGL)
{
//ATTENTION: this causes the statusbar to not work well, since the backcolor is now set to black instead of SystemColors.Control.
//It seems that some statusbar elements composite with the backcolor.
@ -1071,7 +1087,6 @@ namespace BizHawk.Client.EmuHawk
// FUTURE WORK:
// re-add this padding back into the display manager (so the image will get cut off a little but, but a few more resolutions will fully fit into the screen)
}
#endif
_windowedLocation = Location;
@ -1088,13 +1103,15 @@ namespace BizHawk.Client.EmuHawk
WindowState = FormWindowState.Normal;
#if WINDOWS
// do this even if DispFullscreenHacks arent enabled, to restore it in case it changed underneath us or something
Padding = new Padding(0);
// it's important that we set the form color back to this, because the statusbar icons blend onto the mainform, not onto the statusbar--
// so we need the statusbar and mainform backdrop color to match
BackColor = SystemColors.Control;
#endif
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
{
// do this even if DispFullscreenHacks arent enabled, to restore it in case it changed underneath us or something
Padding = new Padding(0);
// it's important that we set the form color back to this, because the statusbar icons blend onto the mainform, not onto the statusbar--
// so we need the statusbar and mainform backdrop color to match
BackColor = SystemColors.Control;
}
_inFullscreen = false;
@ -1388,6 +1405,7 @@ namespace BizHawk.Client.EmuHawk
private int _lastOpenRomFilter;
private ArgParser argParser = new ArgParser();
// Resources
private Bitmap _statusBarDiskLightOnImage;
private Bitmap _statusBarDiskLightOffImage;
@ -1893,7 +1911,13 @@ namespace BizHawk.Client.EmuHawk
private void SetPauseStatusbarIcon()
{
if (IsTurboSeeking)
if (EmulatorPaused)
{
PauseStatusButton.Image = Properties.Resources.Pause;
PauseStatusButton.Visible = true;
PauseStatusButton.ToolTipText = "Emulator Paused";
}
else if (IsTurboSeeking)
{
PauseStatusButton.Image = Properties.Resources.Lightning;
PauseStatusButton.Visible = true;
@ -1905,12 +1929,6 @@ namespace BizHawk.Client.EmuHawk
PauseStatusButton.Visible = true;
PauseStatusButton.ToolTipText = $"Emulator is playing to frame {PauseOnFrame.Value} click to stop seek";
}
else if (EmulatorPaused)
{
PauseStatusButton.Image = Properties.Resources.Pause;
PauseStatusButton.Visible = true;
PauseStatusButton.ToolTipText = "Emulator Paused";
}
else
{
PauseStatusButton.Image = Properties.Resources.Blank;
@ -2005,7 +2023,7 @@ namespace BizHawk.Client.EmuHawk
}
}
private BitmapBuffer MakeScreenshotImage()
public BitmapBuffer MakeScreenshotImage()
{
return GlobalWin.DisplayManager.RenderVideoProvider(_currentVideoProvider);
}
@ -2066,7 +2084,22 @@ namespace BizHawk.Client.EmuHawk
// sends an alt+mnemonic combination
private void SendAltKeyChar(char c)
{
typeof(ToolStrip).InvokeMember("ProcessMnemonicInternal", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Instance, null, MainformMenu, new object[] { c });
switch (OSTailoredCode.CurrentOS)
{
case OSTailoredCode.DistinctOS.Linux:
case OSTailoredCode.DistinctOS.macOS:
// no mnemonics for you
break;
case OSTailoredCode.DistinctOS.Windows:
//HACK
var _ = typeof(ToolStrip).InvokeMember(
"ProcessMnemonicInternal",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Instance,
null,
MainformMenu,
new object[] { c });
break;
}
}
public static string FormatFilter(params string[] args)
@ -3642,7 +3675,9 @@ namespace BizHawk.Client.EmuHawk
if (ioa is OpenAdvanced_OpenRom)
{
var ioa_openrom = (OpenAdvanced_OpenRom)ioa;
path = ioa_openrom.Path;
// path already has the right value, while ioa.Path is null (interestingly, these are swapped below)
// I doubt null is meant to be assigned here, and it just prevents gameload
//path = ioa_openrom.Path;
}
CoreFileProvider.SyncCoreCommInputSignals(nextComm);

View File

@ -6,9 +6,6 @@ using sysdrawing2d=System.Drawing.Drawing2D;
using System.IO;
using System.Threading;
using System.Windows.Forms;
#if WINDOWS
using SlimDX;
#endif
using BizHawk.Client.Common;
using BizHawk.Bizware.BizwareGL;

View File

@ -1,21 +1,19 @@
using System;
using System.Linq;
using System.Diagnostics;
using System.IO;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
#if WINDOWS
using Microsoft.VisualBasic.ApplicationServices;
#endif
using BizHawk.Common;
using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk
{
static class Program
internal static class Program
{
static Program()
{
@ -23,56 +21,52 @@ namespace BizHawk.Client.EmuHawk
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var libLoader = EXE_PROJECT.PlatformLinkedLibSingleton.LinkedLibManager;
//http://www.codeproject.com/Articles/310675/AppDomain-AssemblyResolve-Event-Tips
//try loading libraries we know we'll need
//something in the winforms, etc. code below will cause .net to popup a missing msvcr100.dll in case that one's missing
//but oddly it lets us proceed and we'll then catch it here
var libExt = EXE_PROJECT.PlatformLinkedLibSingleton.RunningOnUnix ? ".dll.so" : ".dll";
var d3dx9 = libLoader.LoadPlatformSpecific($"d3dx9_43{libExt}");
var vc2015 = libLoader.LoadPlatformSpecific($"vcruntime140{libExt}");
var vc2012 = libLoader.LoadPlatformSpecific($"msvcr120{libExt}"); //TODO - check version?
var vc2010 = libLoader.LoadPlatformSpecific($"msvcr100{libExt}"); //TODO - check version?
var vc2010p = libLoader.LoadPlatformSpecific($"msvcp100{libExt}");
bool fail = false, warn = false;
warn |= d3dx9 == IntPtr.Zero;
fail |= vc2015 == IntPtr.Zero;
fail |= vc2010 == IntPtr.Zero;
fail |= vc2012 == IntPtr.Zero;
fail |= vc2010p == IntPtr.Zero;
if (fail || warn)
if (EXE_PROJECT.OSTailoredCode.CurrentOS == EXE_PROJECT.OSTailoredCode.DistinctOS.Windows)
{
var sw = new System.IO.StringWriter();
sw.WriteLine("[ OK ] .Net 4.6.1 (You couldn't even get here without it)");
sw.WriteLine("[{0}] Direct3d 9", d3dx9 == IntPtr.Zero ? "FAIL" : " OK ");
sw.WriteLine("[{0}] Visual C++ 2010 SP1 Runtime", (vc2010 == IntPtr.Zero || vc2010p == IntPtr.Zero) ? "FAIL" : " OK ");
sw.WriteLine("[{0}] Visual C++ 2012 Runtime", (vc2012 == IntPtr.Zero) ? "FAIL" : " OK ");
sw.WriteLine("[{0}] Visual C++ 2015 Runtime", (vc2015 == IntPtr.Zero) ? "FAIL" : " OK ");
var str = sw.ToString();
var box = new BizHawk.Client.EmuHawk.CustomControls.PrereqsAlert(!fail);
box.textBox1.Text = str;
box.ShowDialog();
if (!fail) { }
else
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
var libLoader = EXE_PROJECT.OSTailoredCode.LinkedLibManager;
libLoader.FreePlatformSpecific(d3dx9);
libLoader.FreePlatformSpecific(vc2015);
libLoader.FreePlatformSpecific(vc2012);
libLoader.FreePlatformSpecific(vc2010);
libLoader.FreePlatformSpecific(vc2010p);
//http://www.codeproject.com/Articles/310675/AppDomain-AssemblyResolve-Event-Tips
//try loading libraries we know we'll need
//something in the winforms, etc. code below will cause .net to popup a missing msvcr100.dll in case that one's missing
//but oddly it lets us proceed and we'll then catch it here
var d3dx9 = libLoader.LoadPlatformSpecific("d3dx9_43.dll");
var vc2015 = libLoader.LoadPlatformSpecific("vcruntime140.dll");
var vc2012 = libLoader.LoadPlatformSpecific("msvcr120.dll"); //TODO - check version?
var vc2010 = libLoader.LoadPlatformSpecific("msvcr100.dll"); //TODO - check version?
var vc2010p = libLoader.LoadPlatformSpecific("msvcp100.dll");
var fail = vc2015 == IntPtr.Zero || vc2010 == IntPtr.Zero || vc2012 == IntPtr.Zero || vc2010p == IntPtr.Zero;
var warn = d3dx9 == IntPtr.Zero;
if (fail || warn)
{
var alertLines = new[]
{
"[ OK ] .NET CLR (You wouldn't even get here without it)",
$"[{(d3dx9 == IntPtr.Zero ? "WARN" : " OK ")}] Direct3d 9",
$"[{(vc2010 == IntPtr.Zero || vc2010p == IntPtr.Zero ? "FAIL" : " OK ")}] Visual C++ 2010 SP1 Runtime",
$"[{(vc2012 == IntPtr.Zero ? "FAIL" : " OK ")}] Visual C++ 2012 Runtime",
$"[{(vc2015 == IntPtr.Zero ? "FAIL" : " OK ")}] Visual C++ 2015 Runtime"
};
var box = new BizHawk.Client.EmuHawk.CustomControls.PrereqsAlert(!fail)
{
textBox1 = { Text = string.Concat("\n", alertLines) }
};
box.ShowDialog();
if (fail) System.Diagnostics.Process.GetCurrentProcess().Kill();
}
libLoader.FreePlatformSpecific(d3dx9);
libLoader.FreePlatformSpecific(vc2015);
libLoader.FreePlatformSpecific(vc2012);
libLoader.FreePlatformSpecific(vc2010);
libLoader.FreePlatformSpecific(vc2010p);
if (!EXE_PROJECT.PlatformLinkedLibSingleton.RunningOnUnix)
{
// this will look in subdirectory "dll" to load pinvoked stuff
string dllDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
var dllDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
SetDllDirectory(dllDir);
//in case assembly resolution fails, such as if we moved them into the dll subdiretory, this event handler can reroute to them
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
//but before we even try doing that, whack the MOTW from everything in that directory (thats a dll)
//otherwise, some people will have crashes at boot-up due to .net security disliking MOTW.
@ -84,129 +78,20 @@ namespace BizHawk.Client.EmuHawk
}
[STAThread]
static int Main(string[] args)
private static int Main(string[] args)
{
return SubMain(args);
}
private interface PlatformSpecificMainLoopCrashHandler
{
void TryCatchFinally(string[] args);
}
private class Win32MainLoopCrashHandler : PlatformSpecificMainLoopCrashHandler
{
public void TryCatchFinally(string[] args)
var exitCode = SubMain(args);
if (EXE_PROJECT.OSTailoredCode.CurrentOS == EXE_PROJECT.OSTailoredCode.DistinctOS.Linux)
{
try
{
if (Global.Config.SingleInstanceMode)
{
try
{
new SingleInstanceController(args).Run(args);
}
catch (ObjectDisposedException)
{
// Eat it, MainForm disposed itself and Run attempts to dispose of itself. Eventually we would want to figure out a way to prevent that, but in the meantime it is harmless, so just eat the error
}
}
else
{
using (var mf = new MainForm(args))
{
var title = mf.Text;
mf.Show();
mf.Text = title;
try
{
GlobalWin.ExitCode = mf.ProgramRunLoop();
}
catch (Exception e) when (!Debugger.IsAttached && !VersionInfo.DeveloperBuild && Global.MovieSession.Movie.IsActive)
{
var result = MessageBox.Show(
"EmuHawk has thrown a fatal exception and is about to close.\nA movie has been detected. Would you like to try to save?\n(Note: Depending on what caused this error, this may or may not succeed)",
$"Fatal error: {e.GetType().Name}",
MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation
);
if (result == DialogResult.Yes)
{
Global.MovieSession.Movie.Save();
}
}
}
}
}
catch (Exception e) when (!Debugger.IsAttached)
{
new ExceptionBox(e).ShowDialog();
}
finally
{
if (GlobalWin.Sound != null)
{
GlobalWin.Sound.Dispose();
GlobalWin.Sound = null;
}
GlobalWin.GL.Dispose();
Input.Cleanup();
}
Console.WriteLine("BizHawk has completed its shutdown routines, killing process...");
Process.GetCurrentProcess().Kill();
}
return exitCode;
}
private class UnixMonoMainLoopCrashHandler : PlatformSpecificMainLoopCrashHandler
{
// Identical to the implementation in Win32MainLoopCrashHandler sans the single-instance check.
public void TryCatchFinally(string[] args)
{
try
{
using (var mf = new MainForm(args))
{
var title = mf.Text;
mf.Show();
mf.Text = title;
try
{
GlobalWin.ExitCode = mf.ProgramRunLoop();
}
catch (Exception e) when (!Debugger.IsAttached && !VersionInfo.DeveloperBuild && Global.MovieSession.Movie.IsActive)
{
var result = MessageBox.Show(
"EmuHawk has thrown a fatal exception and is about to close.\nA movie has been detected. Would you like to try to save?\n(Note: Depending on what caused this error, this may or may not succeed)",
$"Fatal error: {e.GetType().Name}",
MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation
);
if (result == DialogResult.Yes)
{
Global.MovieSession.Movie.Save();
}
}
}
}
catch (Exception e) when (!Debugger.IsAttached)
{
new ExceptionBox(e).ShowDialog();
}
finally
{
if (GlobalWin.Sound != null)
{
GlobalWin.Sound.Dispose();
GlobalWin.Sound = null;
}
GlobalWin.GL.Dispose();
Input.Cleanup();
}
}
}
private static PlatformSpecificMainLoopCrashHandler mainLoopCrashHandler = EXE_PROJECT.PlatformLinkedLibSingleton.RunningOnUnix
? (PlatformSpecificMainLoopCrashHandler) new UnixMonoMainLoopCrashHandler()
: (PlatformSpecificMainLoopCrashHandler) new Win32MainLoopCrashHandler();
//NoInlining should keep this code from getting jammed into Main() which would create dependencies on types which havent been setup by the resolver yet... or something like that
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
static int SubMain(string[] args)
private static int SubMain(string[] args)
{
// this check has to be done VERY early. i stepped through a debug build with wrong .dll versions purposely used,
// and there was a TypeLoadException before the first line of SubMain was reached (some static ColorType init?)
@ -228,9 +113,8 @@ namespace BizHawk.Client.EmuHawk
HawkFile.ArchiveHandlerFactory = new SevenZipSharpArchiveHandler();
ArgParser argParser = new ArgParser();
argParser.ParseArguments(args);
if (argParser.cmdConfigFile != null) PathManager.SetDefaultIniPath(argParser.cmdConfigFile);
string cmdConfigFile = ArgParser.GetCmdConfigFile(args);
if (cmdConfigFile != null) PathManager.SetDefaultIniPath(cmdConfigFile);
try
{
@ -248,13 +132,9 @@ namespace BizHawk.Client.EmuHawk
BizHawk.Client.Common.StringLogUtil.DefaultToAWE = Global.Config.MoviesInAWE;
// super hacky! this needs to be done first. still not worth the trouble to make this system fully proper
for (int i = 0; i < args.Length; i++)
if (Array.Exists(args, arg => arg.StartsWith("--gdi", StringComparison.InvariantCultureIgnoreCase)))
{
var arg = args[i].ToLower();
if (arg.StartsWith("--gdi"))
{
Global.Config.DispMethod = Config.EDispMethod.GdiPlus;
}
Global.Config.DispMethod = Config.EDispMethod.GdiPlus;
}
// create IGL context. we do this whether or not the user has selected OpenGL, so that we can run opengl-based emulator cores
@ -265,8 +145,10 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.GLManager = GLManager.Instance;
//now create the "GL" context for the display method. we can reuse the IGL_TK context if opengl display method is chosen
if (EXE_PROJECT.PlatformLinkedLibSingleton.RunningOnUnix) Global.Config.DispMethod = Config.EDispMethod.GdiPlus;
REDO_DISPMETHOD:
if (EXE_PROJECT.OSTailoredCode.CurrentOS != EXE_PROJECT.OSTailoredCode.DistinctOS.Windows)
Global.Config.DispMethod = Config.EDispMethod.GdiPlus;
REDO_DISPMETHOD:
if (Global.Config.DispMethod == Config.EDispMethod.GdiPlus)
GlobalWin.GL = new Bizware.BizwareGL.Drivers.GdiPlus.IGL_GdiPlus();
else if (Global.Config.DispMethod == Config.EDispMethod.SlimDX9)
@ -277,8 +159,7 @@ namespace BizHawk.Client.EmuHawk
}
catch(Exception ex)
{
var e2 = new Exception("Initialization of Direct3d 9 Display Method failed; falling back to GDI+", ex);
new ExceptionBox(e2).ShowDialog();
new ExceptionBox(new Exception("Initialization of Direct3d 9 Display Method failed; falling back to GDI+", ex)).ShowDialog();
// fallback
Global.Config.DispMethod = Config.EDispMethod.GdiPlus;
@ -290,8 +171,7 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.GL = GlobalWin.IGL_GL;
// check the opengl version and dont even try to boot this crap up if its too old
int version = GlobalWin.IGL_GL.Version;
if (version < 200)
if (GlobalWin.IGL_GL.Version < 200)
{
// fallback
Global.Config.DispMethod = Config.EDispMethod.GdiPlus;
@ -306,26 +186,75 @@ namespace BizHawk.Client.EmuHawk
}
catch(Exception ex)
{
var e2 = new Exception("Initialization of Display Method failed; falling back to GDI+", ex);
new ExceptionBox(e2).ShowDialog();
new ExceptionBox(new Exception("Initialization of Display Method failed; falling back to GDI+", ex)).ShowDialog();
//fallback
Global.Config.DispMethod = Config.EDispMethod.GdiPlus;
goto REDO_DISPMETHOD;
}
if (!EXE_PROJECT.PlatformLinkedLibSingleton.RunningOnUnix)
if (EXE_PROJECT.OSTailoredCode.CurrentOS == EXE_PROJECT.OSTailoredCode.DistinctOS.Windows)
{
//WHY do we have to do this? some intel graphics drivers (ig7icd64.dll 10.18.10.3304 on an unknown chip on win8.1) are calling SetDllDirectory() for the process, which ruins stuff.
//The relevant initialization happened just before in "create IGL context".
//It isn't clear whether we need the earlier SetDllDirectory(), but I think we do.
//note: this is pasted instead of being put in a static method due to this initialization code being sensitive to things like that, and not wanting to cause it to break
//pasting should be safe (not affecting the jit order of things)
string dllDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
var dllDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
SetDllDirectory(dllDir);
}
// Using a simple conditional to skip the single-instancing step caused crashes on GNU+Linux, even though the single-instancing step wasn't being executed. Something about the way instantiation works in C# means this workaround is possible.
mainLoopCrashHandler.TryCatchFinally(args);
try
{
if (Global.Config.SingleInstanceMode)
{
try
{
new SingleInstanceController(args).Run();
}
catch (ObjectDisposedException)
{
// Eat it, MainForm disposed itself and Run attempts to dispose of itself. Eventually we would want to figure out a way to prevent that, but in the meantime it is harmless, so just eat the error
}
}
else
{
using (var mf = new MainForm(args))
{
var title = mf.Text;
mf.Show();
mf.Text = title;
try
{
GlobalWin.ExitCode = mf.ProgramRunLoop();
}
catch (Exception e) when (Global.MovieSession.Movie.IsActive && !(Debugger.IsAttached || VersionInfo.DeveloperBuild))
{
var result = MessageBox.Show(
"EmuHawk has thrown a fatal exception and is about to close.\nA movie has been detected. Would you like to try to save?\n(Note: Depending on what caused this error, this may or may not succeed)",
$"Fatal error: {e.GetType().Name}",
MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation
);
if (result == DialogResult.Yes)
{
Global.MovieSession.Movie.Save();
}
}
}
}
}
catch (Exception e) when (!Debugger.IsAttached)
{
new ExceptionBox(e).ShowDialog();
}
finally
{
GlobalWin.Sound?.Dispose();
GlobalWin.Sound = null;
GlobalWin.GL.Dispose();
Input.Cleanup();
}
//cleanup:
//cleanup IGL stuff so we can get better refcounts when exiting process, for debugging
@ -341,19 +270,19 @@ namespace BizHawk.Client.EmuHawk
} //SubMain
//declared here instead of a more usual place to avoid dependencies on the more usual place
#if WINDOWS
[DllImport("kernel32.dll", SetLastError = true)]
static extern uint SetDllDirectory(string lpPathName);
private static extern uint SetDllDirectory(string lpPathName);
[DllImport("kernel32.dll", EntryPoint = "DeleteFileW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool DeleteFileW([MarshalAs(UnmanagedType.LPWStr)]string lpFileName);
private static extern bool DeleteFileW([MarshalAs(UnmanagedType.LPWStr)]string lpFileName);
public static void RemoveMOTW(string path)
private static void RemoveMOTW(string path)
{
DeleteFileW($"{path}:Zone.Identifier");
}
static void WhackAllMOTW(string dllDir)
private static void WhackAllMOTW(string dllDir)
{
var todo = new Queue<DirectoryInfo>(new[] { new DirectoryInfo(dllDir) });
while (todo.Count > 0)
@ -365,14 +294,11 @@ namespace BizHawk.Client.EmuHawk
foreach (var fi in di.GetFiles("*.exe"))
RemoveMOTW(fi.FullName);
}
}
#endif
static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
string requested = args.Name;
var requested = args.Name;
//mutate filename depending on selection of lua core. here's how it works
//1. we build NLua to the output/dll/lua directory. that brings KopiLua with it
@ -380,52 +306,43 @@ namespace BizHawk.Client.EmuHawk
//3. When NLua assembly attempts to load, it can't find it
//I. if LuaInterface is selected by the user, we switch to requesting that.
// (those DLLs are built into the output/DLL directory)
//II. if NLua is selected by the user, we skip over this part;
//II. if NLua is selected by the user, we skip over this part;
// later, we look for NLua or KopiLua assembly names and redirect them to files located in the output/DLL/nlua directory
if (new AssemblyName(requested).Name == "NLua")
{
//this method referencing Global.Config makes assemblies get loaded, which isnt smart from the assembly resolver.
//so.. we're going to resort to something really bad.
//avert your eyes.
bool UseNLua = true;
string configPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "config.ini");
if (File.Exists(configPath))
var configPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "config.ini");
if (EXE_PROJECT.OSTailoredCode.CurrentOS == EXE_PROJECT.OSTailoredCode.DistinctOS.Windows // LuaInterface is not currently working on Mono
&& File.Exists(configPath)
&& (Array.Find(File.ReadAllLines(configPath), line => line.Contains(" \"UseNLua\": ")) ?? string.Empty)
.Contains("false"))
{
var cfg = File.ReadAllLines(configPath);
var usenlua_key = cfg.FirstOrDefault(line=>line.Contains(" \"UseNLua\": "));
if (usenlua_key != null)
if (usenlua_key.Contains("false"))
UseNLua = false;
requested = "LuaInterface";
}
if (UseNLua) { }
else requested = "LuaInterface";
}
lock (AppDomain.CurrentDomain)
{
var asms = AppDomain.CurrentDomain.GetAssemblies();
foreach (var asm in asms)
if (asm.FullName == requested)
return asm;
var firstAsm = Array.Find(AppDomain.CurrentDomain.GetAssemblies(), asm => asm.FullName == requested);
if (firstAsm != null) return firstAsm;
//load missing assemblies by trying to find them in the dll directory
string dllname = $"{new AssemblyName(requested).Name}.dll";
string directory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
string simpleName = new AssemblyName(requested).Name;
var dllname = $"{new AssemblyName(requested).Name}.dll";
var directory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
var simpleName = new AssemblyName(requested).Name;
if (simpleName == "NLua" || simpleName == "KopiLua") directory = Path.Combine(directory, "nlua");
string fname = Path.Combine(directory, dllname);
if (!File.Exists(fname)) return null;
//it is important that we use LoadFile here and not load from a byte array; otherwise mixed (managed/unamanged) assemblies can't load
return Assembly.LoadFile(fname);
var fname = Path.Combine(directory, dllname);
//it is important that we use LoadFile here and not load from a byte array; otherwise mixed (managed/unmanaged) assemblies can't load
return File.Exists(fname) ? Assembly.LoadFile(fname) : null;
}
}
#if WINDOWS
public class SingleInstanceController : WindowsFormsApplicationBase
private class SingleInstanceController : WindowsFormsApplicationBase
{
readonly string[] cmdArgs;
private readonly string[] cmdArgs;
public SingleInstanceController(string[] args)
{
cmdArgs = args;
@ -433,10 +350,12 @@ namespace BizHawk.Client.EmuHawk
StartupNextInstance += this_StartupNextInstance;
}
void this_StartupNextInstance(object sender, StartupNextInstanceEventArgs e)
public void Run() => Run(cmdArgs);
private void this_StartupNextInstance(object sender, StartupNextInstanceEventArgs e)
{
if (e.CommandLine.Count >= 1)
(MainForm as MainForm).LoadRom(e.CommandLine[0], new MainForm.LoadRomArgs() { OpenAdvanced = new OpenAdvanced_OpenRom() });
((MainForm)MainForm).LoadRom(e.CommandLine[0], new MainForm.LoadRomArgs { OpenAdvanced = new OpenAdvanced_OpenRom() });
}
protected override void OnCreateMainForm()
@ -445,11 +364,8 @@ namespace BizHawk.Client.EmuHawk
var title = MainForm.Text;
MainForm.Show();
MainForm.Text = title;
GlobalWin.ExitCode = (MainForm as MainForm).ProgramRunLoop();
GlobalWin.ExitCode = ((MainForm)MainForm).ProgramRunLoop();
}
}
#endif
}
}

View File

@ -19,7 +19,7 @@ namespace BizHawk.Client.EmuHawk.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@ -690,16 +690,6 @@ namespace BizHawk.Client.EmuHawk.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap HawkInLove {
get {
object obj = ResourceManager.GetObject("HawkInLove", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@ -1455,9 +1455,6 @@
<data name="ts_h_piano_16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\tastudio\ts_h_piano_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="HawkInLove" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\HawkInLove.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ts_h_piano_00_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\tastudio\ts_h_piano_00_blue.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -1,80 +1,66 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
using BizHawk.Client.Common;
using BizHawk.Common;
namespace BizHawk.Client.EmuHawk
{
// Derived from http://www.codeproject.com/KB/cs/ScreenSaverControl.aspx
/// <remarks>Derived from http://www.codeproject.com/KB/cs/ScreenSaverControl.aspx</remarks>
public static class ScreenSaver
{
private interface PlatformSpecificScreenBlankInterface
private interface IScreenBlankTimer
{
Int32 Get();
void Set(Int32 v);
/// <summary>
/// The screen saver timeout setting, in seconds
/// </summary>
int Duration { get; set; }
}
private class WinScreenBlankInterface : PlatformSpecificScreenBlankInterface
private class Win32ScreenBlankTimer : IScreenBlankTimer
{
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern bool SystemParametersInfo(int uAction, int uParam, ref int lpvParam, int flags);
public Int32 Get()
{
Int32 value = 0;
SystemParametersInfo(SPI_GETSCREENSAVERTIMEOUT, 0, ref value, 0);
return value;
}
public void Set(Int32 v)
{
int nullVar = 0;
SystemParametersInfo(SPI_SETSCREENSAVERTIMEOUT, v, ref nullVar, SPIF_SENDWININICHANGE);
}
}
private class MiscUnixScreenBlankInterface : PlatformSpecificScreenBlankInterface
{
public Int32 Get()
{
return 0; //TODO implement
}
public void Set(Int32 v)
{
//TODO implement
}
}
private static PlatformSpecificScreenBlankInterface screenBlankInterface = PlatformLinkedLibSingleton.RunningOnUnix
? (PlatformSpecificScreenBlankInterface) new MiscUnixScreenBlankInterface()
: (PlatformSpecificScreenBlankInterface) new WinScreenBlankInterface();
private const int SPI_GETSCREENSAVERTIMEOUT = 14;
private const int SPI_SETSCREENSAVERTIMEOUT = 15;
private const int SPIF_SENDWININICHANGE = 2;
private const int SPI_GETSCREENSAVERTIMEOUT = 14;
private const int SPI_SETSCREENSAVERTIMEOUT = 15;
private const int SPIF_SENDWININICHANGE = 2;
public int Duration
{
get
{
var value = 0;
SystemParametersInfo(SPI_GETSCREENSAVERTIMEOUT, 0, ref value, 0);
return value;
}
set
{
var nullVar = 0;
SystemParametersInfo(SPI_SETSCREENSAVERTIMEOUT, value, ref nullVar, SPIF_SENDWININICHANGE);
}
}
}
private class UnixScreenBlankTimer : IScreenBlankTimer
{
public int Duration { get; set; } = 0; //TODO implementation
}
private static readonly IScreenBlankTimer _screenBlankTimer = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
? (IScreenBlankTimer) new Win32ScreenBlankTimer()
: new UnixScreenBlankTimer();
private static int ctr;
public static void ResetTimerImmediate()
{
SetScreenSaverTimeout(GetScreenSaverTimeout());
_screenBlankTimer.Duration = _screenBlankTimer.Duration;
}
private static int ctr;
public static void ResetTimerPeriodically()
{
ctr++;
if (ctr == 120)
{
SetScreenSaverTimeout(GetScreenSaverTimeout());
ctr = 0;
}
}
// Returns the screen saver timeout setting, in seconds
private static Int32 GetScreenSaverTimeout()
{
return screenBlankInterface.Get();
}
// Pass in the number of seconds to set the screen saver timeout value.
private static void SetScreenSaverTimeout(Int32 Value)
{
screenBlankInterface.Set(Value);
if (++ctr < 120) return;
ctr = 0;
ResetTimerImmediate();
}
}
}
}

View File

@ -1,5 +1,4 @@
#if WINDOWS
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
@ -164,4 +163,3 @@ namespace BizHawk.Client.EmuHawk
}
}
}
#endif

View File

@ -1,5 +1,4 @@
#if WINDOWS
using System;
using System;
using System.Collections.Generic;
using System.Linq;
@ -185,4 +184,3 @@ namespace BizHawk.Client.EmuHawk
}
}
}
#endif

View File

@ -25,15 +25,17 @@ namespace BizHawk.Client.EmuHawk
public Sound(IntPtr mainWindowHandle)
{
if (Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.OpenAL)
_outputDevice = new OpenALSoundOutput(this);
if (!PlatformLinkedLibSingleton.RunningOnUnix)
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
{
if (Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.OpenAL)
_outputDevice = new OpenALSoundOutput(this);
if (Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.DirectSound)
_outputDevice = new DirectSoundSoundOutput(this, mainWindowHandle);
if (Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.XAudio2)
_outputDevice = new XAudio2SoundOutput(this);
}
else _outputDevice = new OpenALSoundOutput(this); // at the moment unix/mono can only support OpenAL (so ignore whatever is set in the config)
if (_outputDevice == null)
_outputDevice = new DummySoundOutput(this);
}

View File

@ -153,14 +153,16 @@ namespace BizHawk.Client.EmuHawk
}
private class UnixMonoSysTimer : PlatformSpecificSysTimer
{
[DllImport("winmm.dll.so", EntryPoint = "timeBeginPeriod")]
private static extern uint timeBeginPeriod(uint uMilliseconds);
public uint TimeBeginPeriod(uint ms)
{
return timeBeginPeriod(ms);
// we are not going to bother trying to set a minimum resolution for periodic timers
// (on linux I don't think you can set this in user code)
return ms;
}
}
static PlatformSpecificSysTimer sysTimer = PlatformLinkedLibSingleton.RunningOnUnix ? (PlatformSpecificSysTimer) new UnixMonoSysTimer() : (PlatformSpecificSysTimer) new WinSysTimer();
static PlatformSpecificSysTimer sysTimer = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
? (PlatformSpecificSysTimer) new WinSysTimer()
: new UnixMonoSysTimer();
static uint TimeBeginPeriod(uint ms)
{
return sysTimer.TimeBeginPeriod(ms);
@ -362,18 +364,23 @@ namespace BizHawk.Client.EmuHawk
int sleepTime = (int)((timePerFrame - elapsedTime) * 1000 / afsfreq);
if (sleepTime >= 2 || paused)
{
#if WINDOWS
// Assuming a timer period of 1 ms (i.e. TimeBeginPeriod(1)): The actual sleep time
// on Windows XP is generally within a half millisecond either way of the requested
// time. The actual sleep time on Windows 8 is generally between the requested time
// and up to a millisecond over. So we'll subtract 1 ms from the time to avoid
// sleeping longer than desired.
sleepTime -= 1;
#else
// The actual sleep time on OS X with Mono is generally between the request time
// and up to 25% over. So we'll scale the sleep time back to account for that.
sleepTime = sleepTime * 4 / 5;
#endif
switch (OSTailoredCode.CurrentOS)
{
case OSTailoredCode.DistinctOS.Linux: //TODO repro
case OSTailoredCode.DistinctOS.macOS:
// The actual sleep time on OS X with Mono is generally between the request time
// and up to 25% over. So we'll scale the sleep time back to account for that.
sleepTime = sleepTime * 4 / 5;
break;
case OSTailoredCode.DistinctOS.Windows:
// Assuming a timer period of 1 ms (i.e. TimeBeginPeriod(1)): The actual sleep time
// on Windows XP is generally within a half millisecond either way of the requested
// time. The actual sleep time on Windows 8 is generally between the requested time
// and up to a millisecond over. So we'll subtract 1 ms from the time to avoid
// sleeping longer than desired.
sleepTime -= 1;
break;
}
Thread.Sleep(Math.Max(sleepTime, 1));
}

View File

@ -1,3 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
<runtime>
<loadFromRemoteSources enabled="true"/>
</runtime>
</configuration>

View File

@ -176,7 +176,7 @@ namespace BizHawk.Client.EmuHawk
tt.TabPages[pageidx].Controls.Add(createpanel(settings, cat.Value, tt.Size));
// zxhawk hack - it uses multiple categoryLabels
if (Global.Emulator.SystemId == "ZXSpectrum" || Global.Emulator.SystemId == "AmstradCPC")
if (Global.Emulator.SystemId == "ZXSpectrum" || Global.Emulator.SystemId == "AmstradCPC" || Global.Emulator.SystemId == "ChannelF")
pageidx++;
}
@ -184,7 +184,7 @@ namespace BizHawk.Client.EmuHawk
if (buckets[0].Count > 0)
{
// ZXHawk needs to skip this bit
if (Global.Emulator.SystemId == "ZXSpectrum" || Global.Emulator.SystemId == "AmstradCPC")
if (Global.Emulator.SystemId == "ZXSpectrum" || Global.Emulator.SystemId == "AmstradCPC" || Global.Emulator.SystemId == "ChannelF")
return;
string tabname = (Global.Emulator.SystemId == "C64") ? "Keyboard" : "Console"; // hack
@ -275,6 +275,11 @@ namespace BizHawk.Client.EmuHawk
tableLayoutPanel1.ColumnStyles[1].Width = Properties.Resources.ZXSpectrumKeyboards.Width;
}
if (controlName == "ChannelF Controller")
{
}
if (controlName == "AmstradCPC Controller")
{
/*

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 KiB

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 425 KiB

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -3,6 +3,7 @@ using System.IO;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Common;
namespace BizHawk.Client.EmuHawk
{
@ -91,6 +92,16 @@ namespace BizHawk.Client.EmuHawk
txtCropBottom.Text = Global.Config.DispCropBottom.ToString();
RefreshAspectRatioOptions();
if (OSTailoredCode.CurrentOS != OSTailoredCode.DistinctOS.Windows)
{
// Disable SlimDX on Unix
rbD3D9.Enabled = false;
rbD3D9.AutoCheck = false;
cbAlternateVsync.Enabled = false;
label13.Enabled = false;
label8.Enabled = false;
}
}
private void btnOk_Click(object sender, EventArgs e)

View File

@ -53,7 +53,8 @@ namespace BizHawk.Client.EmuHawk
{ "PCFX", "PC-FX" },
{ "32X", "32X" },
{ "ZXSpectrum", "ZX Spectrum" },
{ "AmstradCPC", "Amstrad CPC" }
{ "AmstradCPC", "Amstrad CPC" },
{ "ChannelF", "Channel F" }
};
public string TargetSystem = null;
@ -357,6 +358,8 @@ namespace BizHawk.Client.EmuHawk
private void tbbOpenFolder_Click(object sender, EventArgs e)
{
var frmWares = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPathFragment, null);
if (OSTailoredCode.CurrentOS != OSTailoredCode.DistinctOS.Windows && !Directory.Exists(frmWares))
Directory.CreateDirectory(frmWares);
System.Diagnostics.Process.Start(frmWares);
}

View File

@ -71,7 +71,7 @@ namespace BizHawk.Client.EmuHawk
protected override void OnMouseClick(MouseEventArgs e)
{
if (!PlatformLinkedLibSingleton.RunningOnUnix) HideCaret(Handle);
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows) HideCaret(Handle);
base.OnMouseClick(e);
}
@ -264,7 +264,7 @@ namespace BizHawk.Client.EmuHawk
protected override void OnGotFocus(EventArgs e)
{
if (!PlatformLinkedLibSingleton.RunningOnUnix) HideCaret(Handle);
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows) HideCaret(Handle);
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)

View File

@ -43,7 +43,7 @@ namespace BizHawk.Client.EmuHawk
var sb = new StringBuilder();
foreach (var b in _syncSettings.InitialWRamStatePattern)
{
sb.Append(b.ToHexString(2));
sb.Append($"{b:X2}");
}
RamPatternOverrideBox.Text = sb.ToString();

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Common;
namespace BizHawk.Client.EmuHawk
{
@ -24,10 +25,14 @@ namespace BizHawk.Client.EmuHawk
cbEnableNormal.Checked = Global.Config.SoundEnabledNormal;
cbEnableRWFF.Checked = Global.Config.SoundEnabledRWFF;
cbMuteFrameAdvance.Checked = Global.Config.MuteFrameAdvance;
#if !WINDOWS
rbOutputMethodDirectSound.Enabled = false;
rbOutputMethodXAudio2.Enabled = false;
#endif
if (OSTailoredCode.CurrentOS != OSTailoredCode.DistinctOS.Windows)
{
// Disable DirectSound and XAudio2 on Mono
rbOutputMethodDirectSound.Enabled = false;
rbOutputMethodXAudio2.Enabled = false;
}
rbOutputMethodDirectSound.Checked = Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.DirectSound;
rbOutputMethodXAudio2.Checked = Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.XAudio2;
rbOutputMethodOpenAL.Checked = Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.OpenAL;
@ -83,11 +88,13 @@ namespace BizHawk.Client.EmuHawk
private void PopulateDeviceList()
{
IEnumerable<string> deviceNames = Enumerable.Empty<string>();
#if WINDOWS
if (rbOutputMethodDirectSound.Checked) deviceNames = DirectSoundSoundOutput.GetDeviceNames();
if (rbOutputMethodXAudio2.Checked) deviceNames = XAudio2SoundOutput.GetDeviceNames();
#endif
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
{
if (rbOutputMethodDirectSound.Checked) deviceNames = DirectSoundSoundOutput.GetDeviceNames();
if (rbOutputMethodXAudio2.Checked) deviceNames = XAudio2SoundOutput.GetDeviceNames();
}
if (rbOutputMethodOpenAL.Checked) deviceNames = OpenALSoundOutput.GetDeviceNames();
listBoxSoundDevices.Items.Clear();
listBoxSoundDevices.Items.Add("<default>");
listBoxSoundDevices.SelectedIndex = 0;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1002 B

After

Width:  |  Height:  |  Size: 929 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 735 B

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 686 B

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 B

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 451 B

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 154 B

Some files were not shown because too many files have changed in this diff Show More