Compare commits

...

35 Commits

Author SHA1 Message Date
Rosalie Wanders 9742deb7ac Package: v0.6.0 2024-05-24 20:24:29 +02:00
Rosalie Wanders a234cb0463 RMG: rename variable MainWindow.{cpp,hpp} 2024-05-24 13:40:11 +02:00
Rosalie Wanders 85c1c1af91 RMG: rate limit callbacks to prevent freezing 2024-05-24 13:25:49 +02:00
Rosalie Wanders c81575610c 3rdParty: update mupen64plus-core 2024-05-24 12:24:38 +02:00
Rosalie Wanders f306caa55b 3rdParty: apply pending patches for mupen64plus-video-GLideN64 2024-05-24 12:24:18 +02:00
Rosalie Wanders 5febea43de 3rdParty: update mupen64plus-video-GLideN64 2024-05-24 12:21:36 +02:00
Rosalie Wanders 8ce42a52ce RMG-Input: use macro for loading input mapping settings 2024-05-22 21:12:56 +02:00
Rosalie Wanders 7d9b6175f5 3rdParty: update mupen64plus-video-angrylion-plus 2024-05-04 20:54:18 +02:00
Rosalie Wanders ec9f4f9806 3rdParty: update SDL_GameControllerDB 2024-05-04 20:51:24 +02:00
Rosalie Wanders 82295c8394 3rdParty: apply pending patches for mupen64plus-core 2024-05-04 15:19:33 +02:00
Rosalie Wanders 6b050464ba 3rdParty: build mupen64plus-core with VULKAN=0
RMG overrides the video extension functions anyways,
so we don't need to have vulkan support in the default
video extension implementation, which just adds an
unneeded dependency in some cases
2024-05-04 14:47:42 +02:00
Rosalie Wanders 1a05e6aec0 3rdParty: update mupen64plus-core 2024-05-04 14:25:48 +02:00
Rosalie Wanders 49c7db75ba 3rdParty: update mupen64plus-video-GLideN64 2024-05-04 14:24:17 +02:00
Rosalie Wanders e62094efcf RMG: add .7z to RomBrowserEmptyWidget.ui 2024-05-04 14:23:03 +02:00
Rosalie Wanders 4a30160398 Package: v0.5.9 2024-05-01 12:23:57 +02:00
Rosalie Wanders 478f226cad RMG: add safety around --load-state-slot commandline option 2024-05-01 12:19:18 +02:00
Rosalie Wanders 6746711bc3 RMG: account for CoreSetSaveStateSlot() failure 2024-05-01 12:18:51 +02:00
Rosalie Wanders 7bd9c320ea RMG: add --load-state-slot commandline option 2024-05-01 12:10:55 +02:00
Rosalie Wanders ec197c3ee9 3rdParty: update mupen64plus-video-GLideN64 2024-05-01 11:57:15 +02:00
Rosalie Wanders 4c000101e3 RMG: fix speedAction signal handler in MainWindow.cpp 2024-05-01 11:54:25 +02:00
Rosalie Wanders 4107ee598b RMG: fix slotAction signal handler in MainWindow.cpp 2024-05-01 11:51:14 +02:00
Rosalie Wanders 1b4820c7f7 RMG: give up loading save state slot after 5 attempts 2024-05-01 11:51:14 +02:00
Rosalie Wanders cc398720b6 RMG: fix unneeded argument for ->addAction() 2024-05-01 02:23:34 +02:00
Rosalie Wanders 256d1c512a RMG: implement 'Play Game with State' 2024-05-01 01:56:40 +02:00
Rosalie Wanders 642e768e92 RMG-Core: add another version of CoreGetSaveStatePath() 2024-05-01 01:51:06 +02:00
Rosalie Wanders 8660efe2dc RMG-Input: fix ci build failure 2024-04-30 13:30:55 +02:00
Rosalie Wanders a47160714a RMG-Input: make 'Test Rumble' button visible when rumble pak is selected 2024-04-30 13:22:33 +02:00
Rosalie Wanders 9155faf1d2 RMG-Input: implement 'Test Rumble' button in the options dialog 2024-04-30 13:17:16 +02:00
Rosalie Wanders 042717c3a4 3rdParty: change copyToRDRAM default in GLideN64 2024-04-30 12:36:23 +02:00
Rosalie Wanders 5e0c5bfbb0 RMG: implement custom color settings for the OSD 2024-04-30 12:17:57 +02:00
Rosalie Wanders 08ff5a5ad4 RMG-Core: add GUI_OnScreenDisplay{Background,Text}Color settings 2024-04-30 12:14:44 +02:00
Rosalie Wanders b89655e4b3 Data: update generated cheats 2024-04-30 10:44:02 +02:00
Rosalie Wanders c6cbda856b Script: update commit used by GenerateCheatFiles.sh 2024-04-30 10:41:06 +02:00
Rosalie Wanders b5b97b187a RMG: simplify on_Action_Audio_{Increase,Decrease}Volume() 2024-04-04 23:18:11 +02:00
Rosalie Wanders c6ec9c0686 3rdParty: update mupen64plus-rsp-parallel 2024-03-27 15:20:09 +01:00
98 changed files with 2324 additions and 1737 deletions
@@ -377,3 +377,12 @@ Note=Put this code on and it will now take where you wanted to go, turn it back
9214 Zora Shop
B214 Snowhead (Path to temple - warp in)
D214 East Clock Down
$Time Control
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
D01F30F6 0008
811E6F06 FFFD
D01F30F6 0004
811E6F06 0000
D01F30F6 0002
811E6F06 FFFE
@@ -421,3 +421,12 @@ D03E6B3A 0000
9214 Zora Shop
B214 Snowhead (Path to temple - warp in)
D214 East Clock Down
$Time Control
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
D01FB876 0008
811EF686 FFFD
D01FB876 0004
811EF686 0000
D01FB876 0002
811EF686 FFFE
@@ -361,3 +361,12 @@ D03E6FCA 0000
9214 Zora Shop
B214 Snowhead (Path to temple - warp in)
D214 East Clock Down
$Time Control
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
D01FBC96 0008
811EF726 FFFD
D01FBC96 0004
811EF726 0000
D01FBC96 0002
811EF726 FFFE
@@ -388,3 +388,12 @@ Note=Put this code on and it will now take where you wanted to go, turn it back
9214 Zora Shop
B214 Snowhead (Path to temple - warp in)
D214 East Clock Down
$Time Control
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
D01F0496 0008
811E5496 FFFD
D01F0496 0004
811E5496 0000
D01F0496 0002
811E5496 FFFE
@@ -383,3 +383,12 @@ Note=Put this code on and it will now take where you wanted to go, turn it back
9214 Zora Shop
B214 Snowhead (Path to temple - warp in)
D214 East Clock Down
$Time Control
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
D01F8836 0008
811ED836 FFFD
D01F8836 0004
811ED836 0000
D01F8836 0002
811ED836 FFFE
@@ -418,3 +418,12 @@ D03E4CFA 0000
9214 Zora Shop
B214 Snowhead (Path to temple - warp in)
D214 East Clock Down
$Time Control
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
D01F88A0 0008
811ED846 FFFD
D01F88A0 0004
811ED846 0000
D01F88A0 0002
811ED846 FFFE
@@ -1,5 +1,5 @@
[C0F6DB17-80E0D532-C:44]
Name=Armorines Project S.
Name=Armorines - Project S.W.A.R.M. (G)
$[Press L For Levitate]
D10F7550 0020
@@ -394,3 +394,12 @@ Note=Put this code on and it will now take where you wanted to go, turn it back
9214 Zora Shop
B214 Snowhead (Path to temple - warp in)
D214 East Clock Down
$Time Control
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
D01F2D56 0008
811E6B66 FFFD
D01F2D56 0004
811E6B66 0000
D01F2D56 0002
811E6B66 FFFE
@@ -361,3 +361,12 @@ D05EC55A 0000
9214 Zora Shop
B214 Snowhead (Path to temple - warp in)
D214 East Clock Down
$Time Control
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
D01FBA40 0008
811EF476 FFFD
D01FBA40 0004
811EF476 0000
D01FBA40 0002
811EF476 FFFE
+2 -2
View File
@@ -1,13 +1,13 @@
# Maintainer: Rosalie Wanders <rosalie@mailbox.org>
pkgname=rmg
pkgver=0.5.8
pkgver=0.6.0
pkgrel=1
pkgdesc="Rosalie's Mupen GUI"
arch=('x86_64' 'aarch64')
url="https://github.com/Rosalie241/$pkgname"
license=('GPL3')
depends=("hidapi" "libsamplerate" "speexdsp" "minizip" "sdl2" "zlib" "freetype2" "qt6-base" "qt6-svg" "xdg-user-dirs")
depends=("hidapi" "libsamplerate" "speexdsp" "minizip" "sdl2" "zlib" "freetype2" "qt6-base" "qt6-svg")
makedepends=("git" "nasm" "cmake" "ninja")
source=("git+https://github.com/Rosalie241/$pkgname.git#tag=v$pkgver")
+1 -1
View File
@@ -1,5 +1,5 @@
Name: RMG
Version: 0.5.8
Version: 0.6.0
Release: %autorelease
Summary: Rosalie's Mupen GUI
@@ -33,6 +33,34 @@
</screenshot>
</screenshots>
<releases>
<release version="v0.6.0" date="2024-05-24" type="stable">
<description>
<p>Changes:</p>
<ul>
<li>Fix 7z not being listed in the ROM browser when there are no ROMs found</li>
<li>Fix crash in GLideN64 with certain texture packs</li>
<li>Fix GLideN64 being able to create a large log file</li>
<li>Fix possible freezing by rate limiting callback messages</li>
<li>Update mupen64plus-core, angrylion-rdp-plus, GLideN64 and SDL_GameControllerDB</li>
</ul>
</description>
</release>
<release version="v0.5.9" date="2024-05-01" type="stable">
<description>
<p>Changes:</p>
<ul>
<li>Fix parallel-rsp regression introduced in v0.5.8</li>
<li>Fix corruption when using GLideN64 and resizing the window</li>
<li>Fix changing save state slot always selecting slot 0 on some system configurations</li>
<li>Fix changing speed factor always using 0% on some system configurations</li>
<li>Add color settings for the OSD in the settings dialog</li>
<li>Add 'Test Rumble' button to the options dialog in RMG-Input</li>
<li>Add 'Play Game with State' to the context menu of the ROM browser</li>
<li>Add '--load-state-slot' commandline option</li>
<li>Update cheats and GLideN64</li>
</ul>
</description>
</release>
<release version="v0.5.8" date="2024-03-25" type="stable">
<description>
<p>Changes:</p>
+1 -1
View File
@@ -71,7 +71,7 @@ ExternalProject_Add(mupen64plus-core
BUILD_COMMAND ${MAKE_CMD} all -f ${M64P_CORE_DIR}/projects/unix/Makefile
SRCDIR=${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-core/src
SUBDIR=${CMAKE_CURRENT_SOURCE_DIR}/mupen64plus-core/subprojects
OSD=0 NEW_DYNAREC=1 NO_ASM=$<BOOL:${NO_ASM}> KEYBINDINGS=0 ACCURATE_FPU=1
OSD=0 NEW_DYNAREC=1 NO_ASM=$<BOOL:${NO_ASM}> KEYBINDINGS=0 ACCURATE_FPU=1 VULKAN=0
TARGET=${CORE_FILE} DEBUG=${MAKE_DEBUG}
CC=${MAKE_CC_COMPILER} CXX=${MAKE_CXX_COMPILER}
OPTFLAGS=${MAKE_OPTFLAGS}
+2 -2
View File
@@ -6,7 +6,7 @@
[subrepo]
remote = git@github.com:/gabomdq/SDL_GameControllerDB.git
branch = master
commit = e5a5fa2ac6e645d72c619ea99520a3a4586ee005
parent = cb07131fbbf9cf9f139ef4281799613a71580182
commit = 01700b13626cc06944f5e9ec9b2042a7ad96bc00
parent = 82295c83947e5ceca5874768494c26c10e9941be
method = merge
cmdver = 0.4.6
+21 -12
View File
@@ -172,6 +172,7 @@
03000000317300000100000000000000,DualShock 3,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Windows,
030000006f0e00003001000000000000,EA Sports PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
03000000fc0400000250000000000000,Easy Grip,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b2,start:b9,x:b3,y:b4,platform:Windows,
03000000bc2000000091000000000000,EasySMX Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
030000006e0500000a20000000000000,Elecom DUX60 MMO,a:b2,b:b3,back:b17,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b14,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b15,righttrigger:b13,rightx:a3,righty:a4,start:b20,x:b0,y:b1,platform:Windows,
03000000b80500000410000000000000,Elecom Gamepad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,platform:Windows,
03000000b80500000610000000000000,Elecom Gamepad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,platform:Windows,
@@ -435,6 +436,7 @@
03000000250900006688000000000000,MP-8866 Super Dual Box,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,
03000000091200004488000000000000,MUSIA PlayStation 2 Input Display,a:b0,b:b2,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b6,lefttrigger:b10,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b7,righttrigger:b11,rightx:a2,righty:a3,start:b5,x:b1,y:b3,platform:Windows,
03000000f70600000100000000000000,N64 Adaptoid,+rightx:b2,+righty:b1,-rightx:b4,-righty:b5,a:b0,b:b3,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,leftshoulder:b6,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,platform:Windows,
030000006f0e00001311000000000000,N64 Controller,+rightx:b10,+righty:b3,-rightx:b0,-righty:b11,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,platform:Windows,
030000006b140000010c000000000000,Nacon GC 400ES,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
030000006b1400001106000000000000,Nacon Revolution 3 PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
0300000085320000170d000000000000,Nacon Revolution 5 Pro,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,touchpad:b13,x:b0,y:b3,platform:Windows,
@@ -584,6 +586,7 @@
030000009b2800002b00000000000000,Raphnet Wii Classic Adapter,a:b1,b:b4,back:b2,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b10,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a3,righty:a4,start:b3,x:b0,y:b5,platform:Windows,
030000009b2800002c00000000000000,Raphnet Wii Classic Adapter,a:b1,b:b4,back:b2,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b10,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a3,righty:a4,start:b3,x:b0,y:b5,platform:Windows,
030000009b2800008000000000000000,Raphnet Wii Classic Adapter,a:b1,b:b4,back:b2,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b10,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a3,righty:a4,start:b3,x:b0,y:b5,platform:Windows,
03000000790000008f18000000000000,Rapoo Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b3,y:b0,platform:Windows,
03000000321500000003000000000000,Razer Hydra,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
03000000f8270000bf0b000000000000,Razer Kishi,a:b6,b:b7,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b18,leftshoulder:b12,leftstick:b19,lefttrigger:b14,leftx:a0,lefty:a1,rightshoulder:b13,rightstick:b20,righttrigger:b15,rightx:a3,righty:a4,start:b17,x:b9,y:b10,platform:Windows,
03000000321500000204000000000000,Razer Panthera PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
@@ -799,6 +802,7 @@
03000000bc2000005060000000000000,Xiaomi XMGP01YM,+lefty:+a2,+righty:+a5,-lefty:-a1,-righty:-a4,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,start:b11,x:b3,y:b4,platform:Windows,
xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
030000007d0400000340000000000000,Xterminator Digital Gamepad,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:-a4,lefttrigger:+a4,leftx:a0,lefty:a1,paddle1:b7,paddle2:b6,rightshoulder:b5,rightstick:b9,righttrigger:b2,rightx:a3,righty:a5,start:b8,x:b3,y:b4,platform:Windows,
030000002c3600000100000000000000,Yawman Arrow,+rightx:h0.2,+righty:h0.4,-rightx:h0.8,-righty:h0.1,a:b4,b:b5,back:b6,dpdown:b15,dpleft:b14,dpright:b16,dpup:b13,leftshoulder:b10,leftstick:b0,lefttrigger:-a4,leftx:a0,lefty:a1,paddle1:b11,paddle2:b12,rightshoulder:b8,rightstick:b9,righttrigger:+a4,start:b3,x:b1,y:b2,platform:Windows,
03000000790000004f18000000000000,ZDT Android Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,
03000000120c00000500000000000000,Zeroplus Adapter,a:b2,b:b1,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b0,righttrigger:b5,rightx:a3,righty:a2,start:b8,x:b3,y:b0,platform:Windows,
03000000120c0000101e000000000000,Zeroplus P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
@@ -915,6 +919,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
030000000d0f00003801000008010000,Hori PC Engine Mini Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,start:b9,platform:Mac OS X,
030000000d0f00009200000000010000,Hori Pokken Tournament DX Pro,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X,
030000000d0f0000aa00000072050000,Hori Real Arcade Pro for Nintendo Switch,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Mac OS X,
030000000d0f00000002000017010000,Hori Split Pad Fit,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
030000000d0f00000002000015010000,Hori Switch Split Pad Pro,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
030000000d0f00006e00000000010000,Horipad 4 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
030000000d0f00006600000000010000,Horipad 4 PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
@@ -1152,8 +1157,9 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
03000000c82d00001630000011010000,8BitDo Ultimate C,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
03000000c82d00001730000011010000,8BitDo Ultimate C,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
03000000c82d00001130000011010000,8BitDo Ultimate Wired,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b26,paddle1:b24,paddle2:b25,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
03000000c82d00000631000010010000,8BitDo Ultimate Wireless,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
03000000c82d00000760000011010000,8BitDo Ultimate Wireless,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,
03000000c82d00001230000011010000,8BitDo Ultimate Wireless,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
03000000c82d00001230000011010000,8BitDo Ultimate Wireless,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,paddle1:b2,paddle2:b5,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
03000000c82d00001330000011010000,8BitDo Ultimate Wireless,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b26,paddle1:b23,paddle2:b19,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
03000000c82d00000631000014010000,8BitDo Ultimate Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
03000000c82d00000121000011010000,8BitDo Xbox One SN30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
@@ -1182,16 +1188,16 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
05000000050b00000045000040000000,ASUS Gamepad,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b10,x:b2,y:b3,platform:Linux,
03000000050b00000579000011010000,ASUS ROG Kunai 3,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b36,paddle1:b52,paddle2:b53,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
05000000050b00000679000000010000,ASUS ROG Kunai 3,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b21,paddle1:b22,paddle2:b23,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
03000000503200000110000000000000,Atari Classic Controller,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,platform:Linux,
03000000503200000110000011010000,Atari Classic Controller,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,platform:Linux,
05000000503200000110000000000000,Atari Classic Controller,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,platform:Linux,
05000000503200000110000044010000,Atari Classic Controller,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,platform:Linux,
05000000503200000110000046010000,Atari Classic Controller,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,platform:Linux,
03000000503200000210000000000000,Atari Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a4,rightx:a2,righty:a3,start:b8,x:b2,y:b3,platform:Linux,
03000000503200000210000011010000,Atari Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,platform:Linux,
05000000503200000210000000000000,Atari Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,platform:Linux,
05000000503200000210000045010000,Atari Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,platform:Linux,
05000000503200000210000046010000,Atari Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,platform:Linux,
03000000503200000110000000000000,Atari VCS Classic Controller,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,platform:Linux,
03000000503200000110000011010000,Atari VCS Classic Controller,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,platform:Linux,
05000000503200000110000000000000,Atari VCS Classic Controller,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,platform:Linux,
05000000503200000110000044010000,Atari VCS Classic Controller,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,platform:Linux,
05000000503200000110000046010000,Atari VCS Classic Controller,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,platform:Linux,
03000000503200000210000000000000,Atari VCS Modern Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a4,rightx:a2,righty:a3,start:b8,x:b2,y:b3,platform:Linux,
03000000503200000210000011010000,Atari VCS Modern Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,platform:Linux,
05000000503200000210000000000000,Atari VCS Modern Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,platform:Linux,
05000000503200000210000045010000,Atari VCS Modern Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,platform:Linux,
05000000503200000210000046010000,Atari VCS Modern Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,platform:Linux,
05000000503200000210000047010000,Atari VCS Modern Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:+a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:-a4,rightx:a2,righty:a3,start:b8,x:b2,y:b3,platform:Linux,
030000008a3500000201000011010000,Backbone One,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
030000008a3500000202000011010000,Backbone One,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
@@ -1257,7 +1263,6 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
06000000adde0000efbe000002010000,Hidromancer Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
03000000d81400000862000011010000,HitBox PS3 PC Analog Mode,a:b1,b:b2,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,guide:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b12,x:b0,y:b3,platform:Linux,
03000000c9110000f055000011010000,HJC Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
030000000d0f00000d00000000010000,Hori,a:b0,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b3,rightshoulder:b7,start:b9,x:b1,y:b2,platform:Linux,
030000000d0f00006d00000020010000,Hori EDGE 301,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:+a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
030000000d0f00008400000011010000,Hori Fighting Commander,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
030000000d0f00005f00000011010000,Hori Fighting Commander 4 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
@@ -1280,6 +1285,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
030000000d0f00006b00000011010000,Hori Real Arcade Pro 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
030000000d0f00001600000000010000,Hori Real Arcade Pro EXSE,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b2,y:b3,platform:Linux,
030000000d0f0000aa00000011010000,Hori Real Arcade Pro for Nintendo Switch,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,
030000000d0f00008501000017010000,Hori Split Pad Fit,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
030000000d0f00008501000015010000,Hori Switch Split Pad Pro,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
030000000d0f00006e00000011010000,Horipad 4 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
030000000d0f00006600000011010000,Horipad 4 PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
@@ -1394,6 +1400,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
05000000c62400001a89000000010000,MOGA XP5X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
03000000250900006688000000010000,MP8866 Super Dual Box,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Linux,
030000005e0400008e02000010020000,MSI GC20 V2,a:b0,b:b1,back:b6,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
030000006f0e00001311000011010000,N64 Controller,+rightx:b10,+righty:b3,-rightx:b0,-righty:b11,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,platform:Linux,
030000006b1400000906000014010000,Nacon Asymmetric Wireless PS4 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
030000006b140000010c000010010000,Nacon GC 400ES,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
03000000853200000706000012010000,Nacon GC-100,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
@@ -1692,6 +1699,8 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
060000005e040000120b000007050000,Xbox Series Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
060000005e040000120b00000b050000,Xbox Series Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
060000005e040000120b00000f050000,Xbox Series Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,misc1:b11,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
030000005e040000120b000011050000,Xbox Series X Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,misc1:b11,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
030000005e040000120b000014050000,Xbox Series X Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,misc1:b11,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
050000005e040000130b000017050000,Xbox Series X Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b15,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
060000005e040000120b00000d050000,Xbox Series X Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,misc1:b11,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
050000005e040000200b000013050000,Xbox Wireless Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
+55 -176
View File
@@ -3,16 +3,12 @@ name: Core
on:
push:
paths-ignore:
- '**/*.md'
- '.{gitattributes,gitignore,travis.yml}'
- 'appveyor.yml,README'
- '*.md,appveyor.yml,README'
pull_request:
paths-ignore:
- '**/*.md'
- '.{gitattributes,gitignore,travis.yml}'
- 'appveyor.yml,README'
schedule:
- cron: '55 14 21 * *'
- '*.md,appveyor.yml,README'
workflow_dispatch:
jobs:
@@ -23,71 +19,39 @@ jobs:
matrix:
include:
- cc: GCC
platform: x64
bits: 64
arch: x64
- cc: GCC
platform: x86
bits: 32
arch: x86
- cc: Clang
platform: x64
bits: 64
arch: x64
- cc: Clang
platform: x86
bits: 32
name: Linux / ${{ matrix.cc }} / ${{ matrix.platform }}
arch: x86
name: Linux / ${{ matrix.cc }} / ${{ matrix.arch }}
runs-on: ubuntu-22.04
if: (github.event_name == 'schedule' && github.repository == 'mupen64plus/mupen64plus-core') || (github.event_name != 'schedule')
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Get build dependencies and arrange the environment
run: |
echo "G_REV=$(git rev-parse --short HEAD)" >> "${GITHUB_ENV}"
if [[ ${{ matrix.bits }} -eq 32 ]]; then sudo dpkg --add-architecture i386; fi
sudo apt-get update
sudo apt-get -y install libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libsdl1.2-dev libsdl2-dev libvulkan-dev nasm zlib1g-dev
if [[ ${{ matrix.bits }} -eq 32 ]]; then sudo apt-get --reinstall -y install gcc-multilib g++-multilib libc6 libc6-dev-i386 libatomic1:i386 libgcc-s1:i386 libstdc++6:i386 libfreetype6-dev:i386 libgl1-mesa-dev:i386 libglu1-mesa-dev:i386 libpng-dev:i386 libsdl1.2-dev:i386 libsdl2-dev:i386 libvulkan-dev:i386 zlib1g-dev:i386; fi
sudo ldconfig
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
export BUILD_DEPS="libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libsdl1.2-dev libsdl2-dev libvulkan-dev zlib1g-dev"
./.github/workflows/scripts/ci_install_ubuntu_deps.sh ${{ matrix.arch }} ${{ matrix.cc }}
- name: Build and related stuff, backup binaries
run: |
if [[ ${{ matrix.bits }} -eq 32 ]]; then export PIC="1" CPU_TUNE="-msse2 -mtune=pentium4"; else CPU_TUNE="-mtune=core2"; fi
export OPTFLAGS="-O2 -flto ${CPU_TUNE}"
ORIG="$(pwd)"
CC="gcc"
CXX="g++"
if [[ "${{ matrix.cc }}" != "GCC" ]]; then
CC="clang"
CXX="clang++"
fi
${CC} --version
SDL="sdl"
MSG="1.2"
mkdir pkg
for DYN in 0 1 0 1; do
unset POSTFIX
if [[ ${DYN} -eq 0 ]]; then export POSTFIX="-old"; else MSG="${MSG} / NEW_DYNAREC"; fi
echo ""
echo ":: ${{ matrix.cc }} ${{ matrix.platform }} / SDL${MSG} ::"
echo ""
make NEW_DYNAREC="${DYN}" -C projects/unix clean
echo ""
make CC="${CC}" CXX="${CXX}" BITS="${{ matrix.bits }}" SDL_CONFIG="${SDL}-config" NEW_DYNAREC="${DYN}" -C projects/unix all -j4
echo ""
make BITS="${{ matrix.bits }}" NEW_DYNAREC="${DYN}" -C projects/unix install DESTDIR="${ORIG}/pkg/"
echo ""
ls -gG pkg/usr/local/lib/libmupen64plus${POSTFIX}.so*
echo ""
ldd pkg/usr/local/lib/libmupen64plus${POSTFIX}.so.2.0.0
if [[ ${DYN} -eq 1 ]]; then
SDL="sdl2"
MSG="2"
fi
done
tar cvzf pkg/mupen64plus-core-linux-${{ matrix.platform }}-g${{ env.G_REV }}.tar.gz -C pkg/ "usr"
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
export PATH="$(pwd)/.github/workflows/scripts:${PATH}"
export CONFIG_OVERRIDE="ACCURATE_FPU=1 NEW_DYNAREC=1 SDL_CONFIG="sdl-config""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
export CONFIG_OVERRIDE="ACCURATE_FPU=1 NEW_DYNAREC=1 SDL_CONFIG="sdl2-config""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
export CONFIG_OVERRIDE="ACCURATE_FPU=0 NEW_DYNAREC=0 SDL_CONFIG="sdl-config" POSTFIX="-old""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
export CONFIG_OVERRIDE="ACCURATE_FPU=0 NEW_DYNAREC=0 SDL_CONFIG="sdl2-config" POSTFIX="-old""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }} makepkg
- name: Upload artifact
if: matrix.cc == 'GCC'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: mupen64plus-core-linux-${{ matrix.platform }}-g${{ env.G_REV }}
name: ${{ env.PKG_NAME }}
path: pkg/*.tar.gz
MSYS2:
@@ -96,24 +60,23 @@ jobs:
matrix:
include:
- cc: GCC
platform: x64
arch: x64
cross: x86_64
bits: 64
env: MINGW64
- cc: GCC
platform: x86
arch: x86
cross: i686
bits: 32
name: Windows / MSYS2 ${{ matrix.cc }} / ${{ matrix.platform }}
env: MINGW32
name: Windows / MSYS2 ${{ matrix.cc }} / ${{ matrix.arch }}
runs-on: windows-2022
if: (github.event_name == 'schedule' && github.repository == 'mupen64plus/mupen64plus-core') || (github.event_name != 'schedule')
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW${{ matrix.bits }}
msystem: ${{ matrix.env }}
update: true
install: >-
git
@@ -124,46 +87,24 @@ jobs:
mingw-w64-${{ matrix.cross }}-freetype
mingw-w64-${{ matrix.cross }}-libpng
mingw-w64-${{ matrix.cross }}-nasm
mingw-w64-${{ matrix.cross }}-ntldd
mingw-w64-${{ matrix.cross }}-SDL2
mingw-w64-${{ matrix.cross }}-vulkan-headers
mingw-w64-${{ matrix.cross }}-zlib
- name: Build and related stuff, backup binaries
run: |
echo "G_REV=$(git rev-parse --short HEAD)" >> "${GITHUB_ENV}"
if [[ ${{ matrix.bits }} -eq 32 ]]; then CPU_TUNE="-msse2 -mtune=pentium4"; else CPU_TUNE="-mtune=core2"; fi
export OPTFLAGS="-O2 -flto ${CPU_TUNE}"
ORIG="$(pwd)"
CC="gcc"
CXX="g++"
${CC} --version
mkdir pkg
export POSTFIX="-old"
for DYN in 0 1; do
echo ""
echo ":: ${{ matrix.cc }} ${{ matrix.platform }} / SDL2${MSG} ::"
echo ""
make NEW_DYNAREC="${DYN}" -C projects/unix clean
echo ""
make CC="${CC}" CXX="${CXX}" BITS="${{ matrix.bits }}" NEW_DYNAREC="${DYN}" -C projects/unix all -j4
echo ""
make BITS="${{ matrix.bits }}" NEW_DYNAREC="${DYN}" -C projects/unix install PLUGINDIR="" SHAREDIR="" BINDIR="" MANDIR="" LIBDIR="" APPSDIR="" ICONSDIR="icons" INCDIR="api" LDCONFIG="true" DESTDIR="${ORIG}/pkg/"
echo ""
ls -gG pkg/mupen64plus${POSTFIX}.dll
echo ""
ldd pkg/mupen64plus${POSTFIX}.dll
unset POSTFIX
MSG=" / NEW_DYNAREC"
done
export PATH="$(pwd)/.github/workflows/scripts:${PATH}"
export CONFIG_OVERRIDE="ACCURATE_FPU=1 NEW_DYNAREC=1"
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
export CONFIG_OVERRIDE="ACCURATE_FPU=0 NEW_DYNAREC=0 POSTFIX="-old""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
- name: Backup dependencies, etc...
run: |
if [[ ${{ matrix.bits }} -eq 32 ]]; then LIBGCC="libgcc_s_dw2-1"; else LIBGCC="libgcc_s_seh-1"; fi
for LIB in libbrotlicommon libbrotlidec libbz2-1 libfreetype-6 ${LIBGCC} libglib-2.0-0 libgraphite2 libharfbuzz-0 libiconv-2 libintl-8 libpcre2-8-0 libpng16-16 libstdc++-6 libwinpthread-1 SDL2 zlib1; do
echo ":: Copying ${LIB}.dll"
cp "/mingw${{ matrix.bits }}/bin/${LIB}.dll" pkg/
done
./.github/workflows/scripts/ci_backup_mingw_deps.sh ${{ matrix.env }}
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: mupen64plus-core-msys2-${{ matrix.platform }}-g${{ env.G_REV }}
name: ${{ env.PKG_NAME }}
path: pkg/*
MSVC:
@@ -172,52 +113,32 @@ jobs:
matrix:
include:
- toolset: v143
platform: x64
arch: x64
vs: 2022
- toolset: v141_xp
platform: x86
arch: x86
vs: 2019
name: Windows / MSVC with ${{ matrix.toolset }} / ${{ matrix.platform }}
name: Windows / MSVC with ${{ matrix.toolset }} / ${{ matrix.arch }}
runs-on: windows-${{ matrix.vs }}
if: (github.event_name == 'schedule' && github.repository == 'mupen64plus/mupen64plus-core') || (github.event_name != 'schedule')
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v3
- uses: microsoft/setup-msbuild@v1
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
- name: Build and related stuff, backup binaries
run: |
for /f "tokens=1" %%R in ('git rev-parse --short HEAD') do echo G_REV=%%R>> "%GITHUB_ENV%"
set "ARCH=${{ matrix.platform }}"
if [%ARCH%] == [x86] set "ARCH=Win32"
echo.
msbuild --version
echo.
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-win32-deps.git ..\mupen64plus-win32-deps
md pkg
for %%B in (Release New_Dynarec_Release) do (
echo.
msbuild projects\msvc\mupen64plus-core.vcxproj /p:Configuration=%%B;Platform=%ARCH%;PlatformToolset=${{ matrix.toolset }} /t:Rebuild
echo.
copy "projects\msvc\%ARCH%\%%B\mupen64plus.dll" pkg\
if not exist "pkg\mupen64plus-old.dll" (
ren "pkg\mupen64plus.dll" mupen64plus-old.dll
dir pkg\mupen64plus-old.dll
) else dir pkg\mupen64plus.dll
)
set PATH=%CD%\.github\workflows\scripts;%PATH%
set TOOLSET=${{ matrix.toolset }}
call ci_msvc_build.cmd ${{ matrix.arch }}
ci_msvc_build.cmd ${{ matrix.arch }} newdyn
- name: Backup dependencies, etc...
run: |
xcopy data pkg
copy "..\mupen64plus-win32-deps\freetype-2.13.0\lib\${{ matrix.platform }}\*.dll" pkg\
copy "..\mupen64plus-win32-deps\libpng-1.6.39\lib\${{ matrix.platform }}\*.dll" pkg\
copy "..\mupen64plus-win32-deps\SDL2-2.26.3\lib\${{ matrix.platform }}\*.dll" pkg\
copy "..\mupen64plus-win32-deps\SDL2_net-2.2.0\lib\${{ matrix.platform }}\*.dll" pkg\
copy "..\mupen64plus-win32-deps\zlib-1.2.13\lib\${{ matrix.platform }}\*.dll" pkg\
.\.github\workflows\scripts\ci_backup_msvc_deps.cmd ${{ matrix.arch }} freetype.dll libpng16.dll SDL2.dll SDL2_net.dll zlib.dll
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: mupen64plus-core-msvc-${{ matrix.platform }}-g${{ env.G_REV }}
name: ${{ env.PKG_NAME }}
path: pkg/*
Nightly-build:
@@ -225,9 +146,9 @@ jobs:
if: github.ref_name == 'master'
needs: [Linux, MSYS2, MSVC]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: binaries
- name: Get some tools
@@ -236,49 +157,7 @@ jobs:
sudo apt-get -y install hashdeep
- name: Creating new artifacts and update nightly-build
run: |
mkdir pkg
cd binaries
for BIN in *; do
cd "${BIN}"
if [[ "${BIN:17:4}" == "msys" ]]; then
echo ":: Creating ${BIN}.zip"
zip -r "../../pkg/${BIN}.zip" *
elif [[ "${BIN:17:4}" == "msvc" ]]; then
echo ":: Creating ${BIN}.zip"
zip -r "../../pkg/${BIN}.zip" *
else
echo ":: Recovering ${BIN}.tar.gz"
mv *.tar.gz ../../pkg/
fi
cd ..
done
cd ../pkg
echo ""
for BIN in *; do
ls -gG ${BIN}
tigerdeep -lz ${BIN} >> ../${BIN:0:16}.tiger.txt
sha256sum ${BIN} >> ../${BIN:0:16}.sha256.txt
sha512sum ${BIN} >> ../${BIN:0:16}.sha512.txt
b2sum ${BIN} >> ../${BIN:0:16}.blake2.txt
done
mv ../*.tiger.txt .
mv ../*.sha*.txt .
mv ../*.blake2.txt .
echo ""
echo "TIGER:"
cat *.tiger.txt
echo ""
echo "SHA256:"
cat *.sha256.txt
echo ""
echo "SHA512:"
cat *.sha512.txt
echo ""
echo "BLAKE2:"
cat *.blake2.txt
echo ""
git tag -f nightly-build
git push -f origin nightly-build
./.github/workflows/scripts/ci_nightly_artifacts.sh
- name: Nightly-build
uses: ncipollo/release-action@v1
with:
@@ -0,0 +1,165 @@
name: Core - Scheduled
on:
schedule:
- cron: '55 14 21 * *'
jobs:
Linux:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
arch: x64
- cc: GCC
arch: x86
- cc: Clang
arch: x64
- cc: Clang
arch: x86
name: Linux / ${{ matrix.cc }} / ${{ matrix.arch }}
runs-on: ubuntu-22.04
if: github.repository == 'mupen64plus/mupen64plus-core'
steps:
- uses: actions/checkout@v4
- name: Get build dependencies and arrange the environment
run: |
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
export BUILD_DEPS="libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libsdl1.2-dev libsdl2-dev libvulkan-dev zlib1g-dev"
./.github/workflows/scripts/ci_install_ubuntu_deps.sh ${{ matrix.arch }} ${{ matrix.cc }}
- name: Build and related stuff, backup binaries
run: |
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
export PATH="$(pwd)/.github/workflows/scripts:${PATH}"
export CONFIG_OVERRIDE="ACCURATE_FPU=1 NEW_DYNAREC=1 SDL_CONFIG="sdl-config""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
export CONFIG_OVERRIDE="ACCURATE_FPU=1 NEW_DYNAREC=1 SDL_CONFIG="sdl2-config""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
export CONFIG_OVERRIDE="ACCURATE_FPU=0 NEW_DYNAREC=0 SDL_CONFIG="sdl-config" POSTFIX="-old""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
export CONFIG_OVERRIDE="ACCURATE_FPU=0 NEW_DYNAREC=0 SDL_CONFIG="sdl2-config" POSTFIX="-old""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }} makepkg
- name: Upload artifact
if: matrix.cc == 'GCC'
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*.tar.gz
MSYS2:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
arch: x64
cross: x86_64
env: MINGW64
- cc: GCC
arch: x86
cross: i686
env: MINGW32
name: Windows / MSYS2 ${{ matrix.cc }} / ${{ matrix.arch }}
runs-on: windows-2022
if: github.repository == 'mupen64plus/mupen64plus-core'
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.env }}
update: true
install: >-
git
libtool
make
mingw-w64-${{ matrix.cross }}-gcc
mingw-w64-${{ matrix.cross }}-toolchain
mingw-w64-${{ matrix.cross }}-freetype
mingw-w64-${{ matrix.cross }}-libpng
mingw-w64-${{ matrix.cross }}-nasm
mingw-w64-${{ matrix.cross }}-ntldd
mingw-w64-${{ matrix.cross }}-SDL2
mingw-w64-${{ matrix.cross }}-vulkan-headers
mingw-w64-${{ matrix.cross }}-zlib
- name: Build and related stuff, backup binaries
run: |
export PATH="$(pwd)/.github/workflows/scripts:${PATH}"
export CONFIG_OVERRIDE="ACCURATE_FPU=1 NEW_DYNAREC=1"
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
export CONFIG_OVERRIDE="ACCURATE_FPU=0 NEW_DYNAREC=0 POSTFIX="-old""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
- name: Backup dependencies, etc...
run: |
./.github/workflows/scripts/ci_backup_mingw_deps.sh ${{ matrix.env }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*
MSVC:
strategy:
fail-fast: false
matrix:
include:
- toolset: v143
arch: x64
vs: 2022
- toolset: v141_xp
arch: x86
vs: 2019
name: Windows / MSVC with ${{ matrix.toolset }} / ${{ matrix.arch }}
runs-on: windows-${{ matrix.vs }}
if: github.repository == 'mupen64plus/mupen64plus-core'
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
- name: Build and related stuff, backup binaries
run: |
set PATH=%CD%\.github\workflows\scripts;%PATH%
set TOOLSET=${{ matrix.toolset }}
call ci_msvc_build.cmd ${{ matrix.arch }}
ci_msvc_build.cmd ${{ matrix.arch }} newdyn
- name: Backup dependencies, etc...
run: |
.\.github\workflows\scripts\ci_backup_msvc_deps.cmd ${{ matrix.arch }} freetype.dll libpng16.dll SDL2.dll SDL2_net.dll zlib.dll
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*
Nightly-build:
runs-on: ubuntu-latest
if: github.ref_name == 'master'
needs: [Linux, MSYS2, MSVC]
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: binaries
- name: Get some tools
run: |
sudo apt-get update
sudo apt-get -y install hashdeep
- name: Creating new artifacts and update nightly-build
run: |
./.github/workflows/scripts/ci_nightly_artifacts.sh
- name: Nightly-build
uses: ncipollo/release-action@v1
with:
prerelease: true
allowUpdates: true
removeArtifacts: true
replacesArtifacts: false
tag: nightly-build
artifacts: pkg/*
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -e +u
if [[ ${#} -ne 1 ]]; then exit 9; fi
export ENV_MSYS="$(echo "${1}" | tr [A-Z] [a-z])"
export DEPS="$(LC_ALL=C grep "${ENV_MSYS}" pkg/ldd.log | tr -s '\t' ' ' | sort | cut -d ' ' -f4 | tr '\\' '/' | tr -d ':')"
rm -f pkg/ldd.log
if [[ "${DEPS}" == "" ]]; then
echo ":: None..."
exit 0
fi
for LIB in ${DEPS}; do
echo ":: Copying ${LIB##*/}"
cp "/${LIB}" pkg/
done
exit 0
@@ -0,0 +1,36 @@
@echo off
setlocal enableextensions enabledelayedexpansion
cls
if not exist "projects\msvc\" exit /b 9
set ARCH=
set DEPS=
if "%*" == "" exit /b 8
for %%P in (%*) do (
if /i "%%P" == "x86" (set ARCH=x86) else (
if /i "%%P" == "x64" (set ARCH=x64) else (
set "DEPS=!DEPS! %%P") )
)
if not defined ARCH exit /b 7
if exist "data\" xcopy /e data pkg
if errorlevel 1 exit /b 6
if exist "pkg\mupen64plus.desktop" del /f /q pkg\mupen64plus.desktop
if not defined DEPS (
echo :: None...
exit /b 0
)
set PKG=%CD%\pkg
cd ..\mupen64plus-win32-deps
if errorlevel 1 exit /b 5
for %%D in (%DEPS%) do (
for /f "tokens=*" %%T in ('dir /b /s %%D ^| findstr "%ARCH%"') do (
if exist "%%T" xcopy "%%T" "%PKG%\"
if errorlevel 1 exit /b 4
)
)
exit /b 0
+116
View File
@@ -0,0 +1,116 @@
#!/usr/bin/env bash
set -e +u
if [[ ${#} -lt 2 ]]; then exit 9; fi
unset ARCH_ARG CC_ARG
export MAKE_PKG=0 MULTILIB=0
export ENV_ARGS="$(echo "${*}" | tr [A-Z] [a-z])"
for ARG in ${ENV_ARGS}; do
case "${ARG}" in
clang )
export CC_ARG="Clang" CC="clang${C_CLANG_SUFFIX}" CXX="clang++${C_CLANG_SUFFIX}"
;;
gcc )
export CC_ARG="GCC" CC="gcc${C_GCC_SUFFIX}" CXX="g++${C_GCC_SUFFIX}"
;;
makepkg )
export MAKE_PKG=1
;;
multilib )
export MULTILIB=1
;;
x64 )
export ARCH_ARG="x64" CPU_TUNE="-march=nocona" BITS=64
;;
x86 )
export ARCH_ARG="x86" CPU_TUNE="-march=pentium4" BITS=32
;;
esac
done
if [[ -z ${ARCH_ARG} ]]; then exit 8; fi
if [[ -z ${CC_ARG} ]]; then exit 7; fi
export REPO="${PWD##*/}"
if [[ "${REPO}" == "" ]]; then exit 6; fi
export BIN_OS="$(uname -s | tr [A-Z] [a-z])"
if [[ ! -z ${MSYSTEM} ]]; then export BIN_OS="msys2"; fi
export ENV_NAME="$(uname -s)"
export LDD="ldd"
export PKG_PATH="usr/local/lib/mupen64plus/"
if [[ "${REPO}" == *"core"* ]]; then
export PKG_PATH="usr/local/lib/"
elif [[ "${REPO}" == *"ui-console"* ]]; then
export PKG_PATH="usr/local/bin/"
fi
if [[ "${ENV_NAME}" == *"Linux"* ]]; then
if [[ "${ARCH_ARG}" == "x86" ]]; then export PIC=1 PIE=1; fi
if [[ ${MULTILIB} -eq 0 ]]; then
if [[ "${CC_ARG}" == "GCC" ]]; then
if [[ "${ARCH_ARG}" == "x86" ]]; then export CC="i686-linux-gnu-${CC}" CXX="i686-linux-gnu-${CXX}"; fi
fi
fi
fi
if [[ "${ENV_NAME}" == *"MINGW"* ]]; then
export INSTALL_OVERRIDE="PLUGINDIR="" SHAREDIR="" BINDIR="" MANDIR="" LIBDIR="" APPSDIR="" ICONSDIR="icons" INCDIR="api""
export LDD="ntldd -R"
unset PKG_PATH
fi
export G_REV="$(git rev-parse --short HEAD)"
export PKG_NAME="${REPO}-${BIN_OS}-${ARCH_ARG}-g${G_REV}"
if [[ -f "${GITHUB_ENV}" ]]; then
set +e
grep "PKG_NAME=${PKG_NAME}" "${GITHUB_ENV}" > /dev/null
if [[ ${?} -ne 0 ]]; then echo "PKG_NAME=${PKG_NAME}" >> "${GITHUB_ENV}"; fi
set -e
fi
if [[ -z ${OPTFLAGS} ]]; then export OPTFLAGS="-O3 -flto ${CPU_TUNE}"; fi
echo ""
echo ":: CC=${CC} CXX=${CXX} BITS=${BITS} ${CONFIG_OVERRIDE} ::"
echo ""
${CC} --version
echo ""
make_clean () {
make CC="${CC}" CXX="${CXX}" BITS=${BITS} ${CONFIG_OVERRIDE} -C projects/unix clean
echo ""
}
make_clean
make CC="${CC}" CXX="${CXX}" BITS=${BITS} ${CONFIG_OVERRIDE} -C projects/unix all -j4
echo ""
if [[ ! -d pkg ]]; then
mkdir pkg
chmod -R 755 pkg
fi
pushd projects/unix > /dev/null
export ARTIFACT="$(find *mupen64plus* -type f 2> /dev/null | head -n 1)"
popd > /dev/null
make CC="${CC}" CXX="${CXX}" BITS=${BITS} ${CONFIG_OVERRIDE} -C projects/unix install ${INSTALL_OVERRIDE} DESTDIR="$(pwd)/pkg/"
echo ""
make_clean
if [[ -z ${ARTIFACT} ]]; then
exit 5
else
cd pkg
ls -gG "${PKG_PATH}${ARTIFACT}"
echo ""
${LDD} "${PKG_PATH}${ARTIFACT}" > ldd.log
cat ldd.log
echo ""
if [[ ${MAKE_PKG} -eq 1 ]]; then tar --owner=0 --group=0 --mode='og-w' -czf "${PKG_NAME}.tar.gz" usr; fi
fi
exit 0
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -e +u
# NOTE: There is no native "libglew-dev:i386" in Ubuntu 22.04, we will use Debian ones...
export GLEWVER="$(apt list libglew-dev | grep "amd64" | cut -d ' ' -f2)"
export PKGS="$(apt list libglew* | grep "${GLEWVER}" | cut -d '/' -f1)"
export DEBSOURCE="http://http.us.debian.org/debian/pool/main/g/glew/"
export PKGVER_LS="$(curl -sS ${DEBSOURCE} | grep "${GLEWVER}" | grep "amd64" | cut -d '_' -f2 | sort)"
if [[ "${PKGVER_LS}" != "" ]]; then
for VER in ${PKGVER_LS}; do export PKGVER="${VER}"; done
cd /tmp
for PKG in ${PKGS}; do
for ARCH in amd64 i386; do curl -L -O "${DEBSOURCE}${PKG}_${PKGVER}_${ARCH}.deb"; done
done
sudo dpkg -i libglew*${PKGVER}*.deb
else
exit 9
fi
sudo ldconfig
exit 0
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -e +u
if [[ ${#} -lt 2 ]]; then exit 9; fi
unset ARCH_DEP CC_DEP
export BUILD_DEPS_I386="crossbuild-essential-i386 g++${C_GCC_SUFFIX}-i686-linux-gnu gcc${C_GCC_SUFFIX}-i686-linux-gnu libc6-i386"
export HOTFIX_I386="libatomic1:i386 libgcc-s1:i386 libstdc++6:i386 ${HOTFIX_I386}"
export ENV_ARGS="$(echo "${*}" | tr [A-Z] [a-z])"
for ARG in ${ENV_ARGS}; do
case "${ARG}" in
clang )
export CC_DEP="clang${C_CLANG_SUFFIX}"
;;
gcc )
export CC_DEP="g++${C_GCC_SUFFIX} gcc${C_GCC_SUFFIX}"
;;
multilib )
export BUILD_DEPS_I386="g++${C_GCC_SUFFIX}-multilib gcc${C_GCC_SUFFIX}-multilib libc6-dev-i386"
;;
x64 )
export ARCH_DEP="x64"
;;
x86 )
export ARCH_DEP="x86"
;;
esac
done
if [[ -z ${ARCH_DEP} ]]; then exit 8; fi
if [[ -z ${CC_DEP} ]]; then exit 7; fi
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
if [[ "${ARCH_DEP}" == "x86" ]]; then sudo dpkg --add-architecture i386; fi
sudo apt-get update
sudo apt-get -y install build-essential git nasm pkg-config ${CC_DEP} ${BUILD_DEPS}
if [[ "${ARCH_DEP}" == "x86" ]]; then
if [[ "${BUILD_DEPS}" != "" ]]; then
for DEP in ${BUILD_DEPS}; do
if [[ "${DEP}" != "libglew-dev" ]]; then export BUILD_DEPS_I386="${BUILD_DEPS_I386} ${DEP}:i386"; fi
done
fi
sudo apt-get --reinstall -y install ${BUILD_DEPS_I386} ${HOTFIX_I386}
fi
sudo ldconfig
exit 0
@@ -0,0 +1,62 @@
@echo off
setlocal enableextensions disabledelayedexpansion
cls
if not exist "projects\msvc\" exit /b 9
set ARCH=
set CONF=Release
if "%*" == "" exit /b 8
for %%P in (%*) do (
if /i "%%P" == "x86" set ARCH_ARG=x86& set ARCH=Win32
if /i "%%P" == "x64" set ARCH_ARG=x64& set ARCH=x64
if /i "%%P" == "newdyn" set CONF=New_Dynarec_Release
)
if not defined ARCH exit /b 7
for %%T in (.) do set REPO=%%~nxT
if not defined REPO exit /b 6
set ARTIFACT=
set FPROJ=
set EXT=dll
echo %REPO% | findstr "ui-console" >nul 2>&1
if not errorlevel 1 set EXT=exe
if not defined TOOLSET set TOOLSET=v143
for /f "tokens=1" %%R in ('git rev-parse --short HEAD') do set G_REV=%%R
set PKG_NAME=%REPO%-msvc-%ARCH_ARG%-g%G_REV%
if exist "%GITHUB_ENV%" (
type "%GITHUB_ENV%" | findstr "PKG_NAME=%PKG_NAME%" >nul 2>&1
if errorlevel 1 echo PKG_NAME=%PKG_NAME%>> "%GITHUB_ENV%"
)
echo.
msbuild --version
echo.
if not exist "..\mupen64plus-win32-deps\" git clone --depth 1 https://github.com/mupen64plus/mupen64plus-win32-deps.git ..\mupen64plus-win32-deps
pushd projects\msvc\
for /f "tokens=*" %%F in ('dir /b *.vcxproj') do set FPROJ=%%F
popd
if not defined FPROJ exit /b 5
echo.
msbuild "projects\msvc\%FPROJ%" /p:Configuration=%CONF%;Platform=%ARCH%;PlatformToolset=%TOOLSET% /t:Rebuild
if errorlevel 1 exit /b 4
echo.
if exist "projects\msvc\%ARCH%\Release\mupen64plus.dll" ren "projects\msvc\%ARCH%\Release\mupen64plus.dll" mupen64plus-old.dll
pushd projects\msvc\%ARCH%\%CONF%\
for /f "tokens=*" %%S in ('dir /b mupen64plus*%EXT%') do set ARTIFACT=%%S
popd
if not defined ARTIFACT exit /b 3
md pkg 2>nul
xcopy "projects\msvc\%ARCH%\%CONF%\%ARTIFACT%" pkg\
if errorlevel 1 exit /b 2
dir "pkg\%ARTIFACT%"
exit /b 0
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -e +u
export REPO="${PWD##*/}"
if [[ "${REPO}" == "" ]]; then exit 9; fi
rm -fr pkg
mkdir pkg
cd binaries
for BIN in *; do
cd "${BIN}"
case "${BIN}" in
*msvc* | *msys2* )
echo ":: Creating ${BIN}.zip"
zip -r "../../pkg/${BIN}.zip" *
;;
* )
echo ":: Recovering ${BIN}.tar.gz"
mv *.tar.gz ../../pkg/
;;
esac
cd ..
done
cd ../pkg
echo ""
for ZIP in *; do
ls -gG ${ZIP}
tigerdeep -lz ${ZIP} >> ../${REPO}.tiger.txt
sha256sum ${ZIP} >> ../${REPO}.sha256.txt
sha512sum ${ZIP} >> ../${REPO}.sha512.txt
b2sum ${ZIP} >> ../${REPO}.blake2.txt
done
mv ../${REPO}.*.txt .
echo ""
for HASH in tiger sha256 sha512 blake2; do
echo "${HASH}:" | tr [a-z] [A-Z]
cat *.${HASH}.txt
echo ""
done
if [[ -f "${GITHUB_ENV}" ]]; then
git tag -f nightly-build
git push -f origin nightly-build
fi
exit 0
+2 -2
View File
@@ -6,7 +6,7 @@
[subrepo]
remote = git@github.com:mupen64plus/mupen64plus-core.git
branch = master
commit = 860fac3fbae94194a392c1d9857e185eda6d083e
parent = 84681fdd0d326e400524c422f182f7fa60e6493f
commit = 5340dafcc0f5e8284057ab931dd5c66222d3d49e
parent = f306caa55b20e873623e58c470b72bb94d105777
method = merge
cmdver = 0.4.6
+2 -2
View File
@@ -796,7 +796,7 @@ targets:
@echo " VULKAN=0 == Disable vulkan support for the default video extension implementation"
@echo " POSTFIX=name == String added to the name of the the build (default: '')"
@echo " Install Options:"
@echo " PREFIX=path == install/uninstall prefix (default: /usr/local/)"
@echo " PREFIX=path == install/uninstall prefix (default: /usr/local)"
@echo " SHAREDIR=path == path to install shared data files (default: PREFIX/share/mupen64plus)"
@echo " LIBDIR=path == path to install core library (default: PREFIX/lib)"
@echo " INCDIR=path == path to install core header files (default: PREFIX/include/mupen64plus)"
@@ -833,7 +833,7 @@ uninstall:
$(RM) "$(DESTDIR)$(SHAREDIR)/mupencheat.txt"
clean:
$(RM) -r $(TARGET) $(SONAME) _obj $(OBJDIR) $(SRCDIR)/asm_defines/asm_defines_*
$(RM) -r _obj $(OBJDIR) $(TARGET) $(SONAME) $(SRCDIR)/asm_defines/asm_defines_*.h
# build dependency files
CFLAGS += -MD -MP
+1 -1
View File
@@ -181,7 +181,7 @@ EXPORT m64p_error CALL CoreDoCommand(m64p_command Command, int ParamInt, void *P
if (g_EmulatorRunning || l_DiskOpen || l_ROMOpen)
return M64ERR_INVALID_STATE;
// ROM buffer size must be divisible by 4 to avoid out-of-bounds read in swap_copy_rom (v64/n64 formats)
if (ParamPtr == NULL || ParamInt < 4096 || ParamInt > CART_ROM_MAX_SIZE/*|| ParamInt % 4 != 0*/)
if (ParamPtr == NULL || ParamInt < 4096 || ParamInt > CART_ROM_MAX_SIZE)
return M64ERR_INPUT_ASSERT;
rval = open_rom((const unsigned char *) ParamPtr, ParamInt);
if (rval == M64ERR_SUCCESS)
@@ -56,27 +56,36 @@ static void do_sp_dma(struct rsp_core* sp, const struct sp_dma* dma)
{
for(j=0; j<count; j++) {
for(i=0; i<length; i++) {
dram[dramaddr^S8] = spmem[memaddr^S8];
dram[(dramaddr^S8) & 0x7fffff] = spmem[(memaddr^S8) & 0xfff];
memaddr++;
dramaddr++;
}
post_framebuffer_write(&sp->dp->fb, dramaddr - length, length);
if (dramaddr <= 0x800000)
post_framebuffer_write(&sp->dp->fb, dramaddr - length, length);
dramaddr+=skip;
}
sp->regs[SP_MEM_ADDR_REG] = memaddr & 0xfff;
sp->regs[SP_DRAM_ADDR_REG] = dramaddr & 0xffffff;
sp->regs[SP_RD_LEN_REG] = 0xff8;
}
else
{
for(j=0; j<count; j++) {
pre_framebuffer_read(&sp->dp->fb, dramaddr);
if (dramaddr < 0x800000)
pre_framebuffer_read(&sp->dp->fb, dramaddr);
for(i=0; i<length; i++) {
spmem[memaddr^S8] = dram[dramaddr^S8];
spmem[(memaddr^S8) & 0xfff] = dram[(dramaddr^S8) & 0x7fffff];
memaddr++;
dramaddr++;
}
dramaddr+=skip;
}
sp->regs[SP_MEM_ADDR_REG] = memaddr & 0xfff;
sp->regs[SP_DRAM_ADDR_REG] = dramaddr & 0xffffff;
sp->regs[SP_RD_LEN_REG] = 0xff8;
}
/* schedule end of dma event */
@@ -137,68 +146,68 @@ static void fifo_pop(struct rsp_core* sp)
static void update_sp_status(struct rsp_core* sp, uint32_t w)
{
/* clear / set halt */
if (w & 0x1) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_HALT;
if (w & 0x2) sp->regs[SP_STATUS_REG] |= SP_STATUS_HALT;
if ((w & 0x3) == 0x1) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_HALT;
if ((w & 0x3) == 0x2) sp->regs[SP_STATUS_REG] |= SP_STATUS_HALT;
/* clear broke */
if (w & 0x4) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_BROKE;
/* clear SP interrupt */
if (w & 0x8)
if ((w & 0x18) == 0x8)
{
clear_rcp_interrupt(sp->mi, MI_INTR_SP);
}
/* set SP interrupt */
if (w & 0x10)
if ((w & 0x18) == 0x10)
{
signal_rcp_interrupt(sp->mi, MI_INTR_SP);
}
/* clear / set single step */
if (w & 0x20) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SSTEP;
if (w & 0x40) sp->regs[SP_STATUS_REG] |= SP_STATUS_SSTEP;
if ((w & 0x60) == 0x20) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SSTEP;
if ((w & 0x60) == 0x40) sp->regs[SP_STATUS_REG] |= SP_STATUS_SSTEP;
/* clear / set interrupt on break */
if (w & 0x80) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_INTR_BREAK;
if (w & 0x100) sp->regs[SP_STATUS_REG] |= SP_STATUS_INTR_BREAK;
if ((w & 0x180) == 0x80) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_INTR_BREAK;
if ((w & 0x180) == 0x100) sp->regs[SP_STATUS_REG] |= SP_STATUS_INTR_BREAK;
/* clear / set signal 0 */
if (w & 0x200) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SIG0;
if (w & 0x400) sp->regs[SP_STATUS_REG] |= SP_STATUS_SIG0;
if ((w & 0x600) == 0x200) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SIG0;
if ((w & 0x600) == 0x400) sp->regs[SP_STATUS_REG] |= SP_STATUS_SIG0;
/* clear / set signal 1 */
if (w & 0x800) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SIG1;
if (w & 0x1000) sp->regs[SP_STATUS_REG] |= SP_STATUS_SIG1;
if ((w & 0x1800) == 0x800) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SIG1;
if ((w & 0x1800) == 0x1000) sp->regs[SP_STATUS_REG] |= SP_STATUS_SIG1;
/* clear / set signal 2 */
if (w & 0x2000) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SIG2;
if (w & 0x4000) sp->regs[SP_STATUS_REG] |= SP_STATUS_SIG2;
if ((w & 0x6000) == 0x2000) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SIG2;
if ((w & 0x6000) == 0x4000) sp->regs[SP_STATUS_REG] |= SP_STATUS_SIG2;
/* clear / set signal 3 */
if (w & 0x8000) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SIG3;
if (w & 0x10000) sp->regs[SP_STATUS_REG] |= SP_STATUS_SIG3;
if ((w & 0x18000) == 0x8000) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SIG3;
if ((w & 0x18000) == 0x10000) sp->regs[SP_STATUS_REG] |= SP_STATUS_SIG3;
/* clear / set signal 4 */
if (w & 0x20000) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SIG4;
if (w & 0x40000) sp->regs[SP_STATUS_REG] |= SP_STATUS_SIG4;
if ((w & 0x60000) == 0x20000) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SIG4;
if ((w & 0x60000) == 0x40000) sp->regs[SP_STATUS_REG] |= SP_STATUS_SIG4;
/* clear / set signal 5 */
if (w & 0x80000) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SIG5;
if (w & 0x100000) sp->regs[SP_STATUS_REG] |= SP_STATUS_SIG5;
if ((w & 0x180000) == 0x80000) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SIG5;
if ((w & 0x180000) == 0x100000) sp->regs[SP_STATUS_REG] |= SP_STATUS_SIG5;
/* clear / set signal 6 */
if (w & 0x200000) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SIG6;
if (w & 0x400000) sp->regs[SP_STATUS_REG] |= SP_STATUS_SIG6;
if ((w & 0x600000) == 0x200000) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SIG6;
if ((w & 0x600000) == 0x400000) sp->regs[SP_STATUS_REG] |= SP_STATUS_SIG6;
/* clear / set signal 7 */
if (w & 0x800000) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SIG7;
if (w & 0x1000000) sp->regs[SP_STATUS_REG] |= SP_STATUS_SIG7;
if ((w & 0x1800000) == 0x800000) sp->regs[SP_STATUS_REG] &= ~SP_STATUS_SIG7;
if ((w & 0x1800000) == 0x1000000) sp->regs[SP_STATUS_REG] |= SP_STATUS_SIG7;
if (sp->rsp_task_locked && (get_event(&sp->mi->r4300->cp0.q, SP_INT))) return;
if (!(w & 0x1) && !(w & 0x4) && !sp->rsp_task_locked)
if (!((w & 0x3) == 1) && !(w & 0x4) && !sp->rsp_task_locked)
return;
if (!(sp->regs[SP_STATUS_REG] & (SP_STATUS_HALT | SP_STATUS_BROKE)))
if (!(sp->regs[SP_STATUS_REG] & SP_STATUS_HALT))
do_SP_Task(sp);
}
@@ -224,6 +233,8 @@ void poweron_rsp(struct rsp_core* sp)
sp->rsp_task_locked = 0;
sp->mi->r4300->cp0.interrupt_unsafe_state &= ~INTR_UNSAFE_RSP;
sp->regs[SP_STATUS_REG] = 1;
sp->regs[SP_RD_LEN_REG] = 0xff8;
sp->regs[SP_WR_LEN_REG] = 0xff8;
}
@@ -294,6 +305,10 @@ void read_rsp_regs2(void* opaque, uint32_t address, uint32_t* value)
uint32_t reg = rsp_reg2(address);
*value = sp->regs2[reg];
if (reg == SP_PC_REG)
*value &= 0xffc;
}
void write_rsp_regs2(void* opaque, uint32_t address, uint32_t value, uint32_t mask)
@@ -301,6 +316,9 @@ void write_rsp_regs2(void* opaque, uint32_t address, uint32_t value, uint32_t ma
struct rsp_core* sp = (struct rsp_core*)opaque;
uint32_t reg = rsp_reg2(address);
if (reg == SP_PC_REG)
mask &= 0xffc;
masked_write(&sp->regs2[reg], value, mask);
}
+6 -6
View File
@@ -76,12 +76,12 @@ static const uint8_t Z64_SIGNATURE[4] = { 0x80, 0x37, 0x12, 0x40 };
static const uint8_t V64_SIGNATURE[4] = { 0x37, 0x80, 0x40, 0x12 };
static const uint8_t N64_SIGNATURE[4] = { 0x40, 0x12, 0x37, 0x80 };
/* Tests if a file is a valid N64 rom by checking the first 4 bytes. */
static int is_valid_rom(const unsigned char *buffer)
/* Tests if a file is a valid N64 rom by checking the first 4 bytes and size */
static int is_valid_rom(const unsigned char *buffer, unsigned int size)
{
if (memcmp(buffer, Z64_SIGNATURE, sizeof(Z64_SIGNATURE)) == 0
|| memcmp(buffer, V64_SIGNATURE, sizeof(V64_SIGNATURE)) == 0
|| memcmp(buffer, N64_SIGNATURE, sizeof(N64_SIGNATURE)) == 0)
if ((memcmp(buffer, Z64_SIGNATURE, sizeof(Z64_SIGNATURE)) == 0)
|| (memcmp(buffer, V64_SIGNATURE, sizeof(V64_SIGNATURE)) == 0 && size % 2 == 0)
|| (memcmp(buffer, N64_SIGNATURE, sizeof(N64_SIGNATURE)) == 0 && size % 4 == 0))
return 1;
else
return 0;
@@ -146,7 +146,7 @@ m64p_error open_rom(const unsigned char* romimage, unsigned int size)
int i;
/* check input requirements */
if (romimage == NULL || !is_valid_rom(romimage))
if (romimage == NULL || !is_valid_rom(romimage, size))
{
DebugMessage(M64MSG_ERROR, "open_rom(): not a valid ROM image");
return M64ERR_INPUT_INVALID;
+77 -66
View File
@@ -27,7 +27,7 @@
This code implements the MD5 Algorithm defined in RFC 1321, whose
text is available at
http://www.ietf.org/rfc/rfc1321.txt
http://www.ietf.org/rfc/rfc1321.txt
The code is derived from the text of the RFC, including the test suite
(section A.5) but excluding the rest of Appendix A. It does not include
any code or documentation that is identified in the RFC as being
@@ -38,24 +38,24 @@
that follows (in reverse chronological order):
2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order
either statically or dynamically; added missing #include <string.h>
in library.
either statically or dynamically; added missing #include <string.h>
in library.
2002-03-11 lpd Corrected argument list for main(), and added int return
type, in test program and T value program.
type, in test program and T value program.
2002-02-21 lpd Added missing #include <stdio.h> in test program.
2000-07-03 lpd Patched to eliminate warnings about "constant is
unsigned in ANSI C, signed in traditional"; made test program
self-checking.
unsigned in ANSI C, signed in traditional"; made test program
self-checking.
1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5).
1999-05-03 lpd Original version.
*/
#include "md5.h"
#include <string.h>
#include <limits.h>
#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */
#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */
#ifdef ARCH_IS_BIG_ENDIAN
# define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1)
#else
@@ -133,8 +133,8 @@ static void
md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
{
md5_word_t
a = pms->abcd[0], b = pms->abcd[1],
c = pms->abcd[2], d = pms->abcd[3];
a = pms->abcd[0], b = pms->abcd[1],
c = pms->abcd[2], d = pms->abcd[3];
md5_word_t t;
#if BYTE_ORDER > 0
/* Define storage only for big-endian CPUs. */
@@ -147,51 +147,51 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
{
#if BYTE_ORDER == 0
/*
* Determine dynamically whether this is a big-endian or
* little-endian machine, since we can use a more efficient
* algorithm on the latter.
*/
static const int w = 1;
if (*((const md5_byte_t *)&w)) /* dynamic little-endian */
#endif
#if BYTE_ORDER <= 0 /* little-endian */
{
/*
* On little-endian machines, we can process properly aligned
* data without copying it.
* Determine dynamically whether this is a big-endian or
* little-endian machine, since we can use a more efficient
* algorithm on the latter.
*/
if (!((data - (const md5_byte_t *)0) & 3)) {
/* data are properly aligned */
X = (const md5_word_t *)data;
} else {
/* not aligned */
memcpy(xbuf, data, 64);
X = xbuf;
static const int w = 1;
if (*((const md5_byte_t *)&w)) /* dynamic little-endian */
#endif
#if BYTE_ORDER <= 0 /* little-endian */
{
/*
* On little-endian machines, we can process properly aligned
* data without copying it.
*/
if (!((data - (const md5_byte_t *)0) & 3)) {
/* data are properly aligned */
X = (const md5_word_t *)data;
} else {
/* not aligned */
memcpy(xbuf, data, 64);
X = xbuf;
}
}
}
#endif
#if BYTE_ORDER == 0
else /* dynamic big-endian */
else /* dynamic big-endian */
#endif
#if BYTE_ORDER >= 0 /* big-endian */
{
/*
* On big-endian machines, we must arrange the bytes in the
* right order.
*/
const md5_byte_t *xp = data;
int i;
#if BYTE_ORDER >= 0 /* big-endian */
{
/*
* On big-endian machines, we must arrange the bytes in the
* right order.
*/
const md5_byte_t *xp = data;
int i;
# if BYTE_ORDER == 0
X = xbuf; /* (dynamic only) */
X = xbuf; /* (dynamic only) */
# else
# define xbuf X /* (static only) */
# define xbuf X /* (static only) */
# endif
for (i = 0; i < 16; ++i, xp += 4)
xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
}
for (i = 0; i < 16; ++i, xp += 4)
xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
}
#endif
}
@@ -321,63 +321,74 @@ md5_init(md5_state_t *pms)
}
void
md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
md5_append(md5_state_t *pms, const md5_byte_t *data, unsigned int nbytes)
{
const md5_byte_t *p = data;
int left = nbytes;
int offset = (pms->count[0] >> 3) & 63;
unsigned int left = nbytes;
unsigned int offset = (pms->count[0] >> 3) & 63;
md5_word_t nbits = (md5_word_t)(nbytes << 3);
if (nbytes <= 0)
return;
return;
/* this special case is handled recursively */
if (nbytes > INT_MAX - offset) {
unsigned int overlap;
/* handle the append in two steps to prevent overflow */
overlap = 64 - offset;
md5_append(pms, data, overlap);
md5_append(pms, data + overlap, nbytes - overlap);
return;
}
/* Update the message length. */
pms->count[1] += nbytes >> 29;
pms->count[0] += nbits;
if (pms->count[0] < nbits)
pms->count[1]++;
pms->count[1]++;
/* Process an initial partial block. */
if (offset) {
int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
unsigned int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
memcpy(pms->buf + offset, p, copy);
if (offset + copy < 64)
return;
p += copy;
left -= copy;
md5_process(pms, pms->buf);
memcpy(pms->buf + offset, p, copy);
if (offset + copy < 64)
return;
p += copy;
left -= copy;
md5_process(pms, pms->buf);
}
/* Process full blocks. */
for (; left >= 64; p += 64, left -= 64)
md5_process(pms, p);
md5_process(pms, p);
/* Process a final partial block. */
if (left)
memcpy(pms->buf, p, left);
memcpy(pms->buf, p, left);
}
void
md5_finish(md5_state_t *pms, md5_byte_t digest[16])
{
static const md5_byte_t pad[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
md5_byte_t data[8];
int i;
/* Save the length before padding. */
for (i = 0; i < 8; ++i)
data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
/* Pad to 56 bytes mod 64. */
md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
/* Append the length. */
md5_append(pms, data, 8);
for (i = 0; i < 16; ++i)
digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
}
+10 -11
View File
@@ -21,13 +21,13 @@
ghost@aladdin.com
*/
/* $Id: md5.h,v 1.4 2002/04/13 19:20:28 lpd Exp $ */
/* $Id$ */
/*
Independent implementation of MD5 (RFC 1321).
This code implements the MD5 Algorithm defined in RFC 1321, whose
text is available at
http://www.ietf.org/rfc/rfc1321.txt
http://www.ietf.org/rfc/rfc1321.txt
The code is derived from the text of the RFC, including the test suite
(section A.5) but excluding the rest of Appendix A. It does not include
any code or documentation that is identified in the RFC as being
@@ -38,12 +38,12 @@
that follows (in reverse chronological order):
2002-04-13 lpd Removed support for non-ANSI compilers; removed
references to Ghostscript; clarified derivation from RFC 1321;
now handles byte order either statically or dynamically.
references to Ghostscript; clarified derivation from RFC 1321;
now handles byte order either statically or dynamically.
1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
added conditionalization for C++ compilation from Martin
Purschke <purschke@bnl.gov>.
added conditionalization for C++ compilation from Martin
Purschke <purschke@bnl.gov>.
1999-05-03 lpd Original version.
*/
@@ -65,9 +65,9 @@ typedef unsigned int md5_word_t; /* 32-bit word */
/* Define the state of the MD5 Algorithm. */
typedef struct md5_state_s {
md5_word_t count[2]; /* message length in bits, lsw first */
md5_word_t abcd[4]; /* digest buffer */
md5_byte_t buf[64]; /* accumulate block */
md5_word_t count[2]; /* message length in bits, lsw first */
md5_word_t abcd[4]; /* digest buffer */
md5_byte_t buf[64]; /* accumulate block */
} md5_state_t;
#ifdef __cplusplus
@@ -79,7 +79,7 @@ extern "C"
void md5_init(md5_state_t *pms);
/* Append a string to the message. */
void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
void md5_append(md5_state_t *pms, const md5_byte_t *data, unsigned int nbytes);
/* Finish the message and return the digest. */
void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
@@ -89,4 +89,3 @@ void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
#endif
#endif /* md5_INCLUDED */
+13 -16
View File
@@ -32,12 +32,12 @@
/***********************************************************************
* Return the next byte in the pseudo-random sequence
*/
static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
{
static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) {
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
* unpredictable manner on 16-bit systems; not a problem
* with any known compiler so far, though */
(void)pcrc_32_tab;
temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
}
@@ -45,8 +45,7 @@ static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
/***********************************************************************
* Update the encryption keys with the next byte of plain text
*/
static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)
{
static int update_keys(unsigned long* pkeys, const z_crc_t* pcrc_32_tab, int c) {
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
@@ -62,8 +61,7 @@ static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int
* Initialize the encryption keys and the random header according to
* the given password.
*/
static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)
{
static void init_keys(const char* passwd, unsigned long* pkeys, const z_crc_t* pcrc_32_tab) {
*(pkeys+0) = 305419896L;
*(pkeys+1) = 591751049L;
*(pkeys+2) = 878082192L;
@@ -77,24 +75,23 @@ static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned lon
(update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
#define zencode(pkeys,pcrc_32_tab,c,t) \
(t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
(t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), (Byte)t^(c))
#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
#define RAND_HEAD_LEN 12
/* "last resort" source for second part of crypt seed pattern */
# ifndef ZCR_SEED2
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
# endif
static int crypthead(const char* passwd, /* password string */
unsigned char* buf, /* where to write header */
int bufSize,
unsigned long* pkeys,
const unsigned long* pcrc_32_tab,
unsigned long crcForCrypting)
{
int n; /* index in random header */
static unsigned crypthead(const char* passwd, /* password string */
unsigned char* buf, /* where to write header */
int bufSize,
unsigned long* pkeys,
const z_crc_t* pcrc_32_tab,
unsigned long crcForCrypting) {
unsigned n; /* index in random header */
int t; /* temporary */
int c; /* random byte */
unsigned char header[RAND_HEAD_LEN-2]; /* random header */
+31 -47
View File
@@ -14,7 +14,7 @@
#define _CRT_SECURE_NO_WARNINGS
#endif
#if defined(__APPLE__) || defined(IOAPI_NO_64)
#if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
#define FTELLO_FUNC(stream) ftello(stream)
@@ -28,8 +28,7 @@
#include "ioapi.h"
voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
{
voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc, const void*filename, int mode) {
if (pfilefunc->zfile_func64.zopen64_file != NULL)
return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);
else
@@ -38,8 +37,7 @@ voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename
}
}
long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)
{
long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin) {
if (pfilefunc->zfile_func64.zseek64_file != NULL)
return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin);
else
@@ -52,13 +50,12 @@ long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZP
}
}
ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)
{
ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc, voidpf filestream) {
if (pfilefunc->zfile_func64.zseek64_file != NULL)
return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
else
{
uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
uLong tell_uLong = (uLong)(*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
if ((tell_uLong) == MAXU32)
return (ZPOS64_T)-1;
else
@@ -66,11 +63,9 @@ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream
}
}
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32)
{
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32, const zlib_filefunc_def* p_filefunc32) {
p_filefunc64_32->zfile_func64.zopen64_file = NULL;
p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;
p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;
p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;
p_filefunc64_32->zfile_func64.ztell64_file = NULL;
@@ -84,18 +79,10 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));
static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size));
static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream));
static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream));
static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
{
static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char* filename, int mode) {
FILE* file = NULL;
const char* mode_fopen = NULL;
(void)opaque;
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
mode_fopen = "rb";
else
@@ -110,10 +97,10 @@ static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, in
return file;
}
static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
{
static voidpf ZCALLBACK fopen64_file_func(voidpf opaque, const void* filename, int mode) {
FILE* file = NULL;
const char* mode_fopen = NULL;
(void)opaque;
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
mode_fopen = "rb";
else
@@ -129,39 +116,39 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
}
static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
{
static uLong ZCALLBACK fread_file_func(voidpf opaque, voidpf stream, void* buf, uLong size) {
uLong ret;
(void)opaque;
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
return ret;
}
static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
{
static uLong ZCALLBACK fwrite_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) {
uLong ret;
(void)opaque;
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
return ret;
}
static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
{
static long ZCALLBACK ftell_file_func(voidpf opaque, voidpf stream) {
long ret;
(void)opaque;
ret = ftell((FILE *)stream);
return ret;
}
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
{
static ZPOS64_T ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream) {
ZPOS64_T ret;
ret = FTELLO_FUNC((FILE *)stream);
(void)opaque;
ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream);
return ret;
}
static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
{
static long ZCALLBACK fseek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) {
int fseek_origin=0;
long ret;
(void)opaque;
switch (origin)
{
case ZLIB_FILEFUNC_SEEK_CUR :
@@ -176,15 +163,15 @@ static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offs
default: return -1;
}
ret = 0;
if (fseek((FILE *)stream, offset, fseek_origin) != 0)
if (fseek((FILE *)stream, (long)offset, fseek_origin) != 0)
ret = -1;
return ret;
}
static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
{
static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) {
int fseek_origin=0;
long ret;
(void)opaque;
switch (origin)
{
case ZLIB_FILEFUNC_SEEK_CUR :
@@ -200,30 +187,28 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
}
ret = 0;
if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0)
if(FSEEKO_FUNC((FILE *)stream, (z_off64_t)offset, fseek_origin) != 0)
ret = -1;
return ret;
}
static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
{
static int ZCALLBACK fclose_file_func(voidpf opaque, voidpf stream) {
int ret;
(void)opaque;
ret = fclose((FILE *)stream);
return ret;
}
static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
{
static int ZCALLBACK ferror_file_func(voidpf opaque, voidpf stream) {
int ret;
(void)opaque;
ret = ferror((FILE *)stream);
return ret;
}
void fill_fopen_filefunc (pzlib_filefunc_def)
zlib_filefunc_def* pzlib_filefunc_def;
{
void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def) {
pzlib_filefunc_def->zopen_file = fopen_file_func;
pzlib_filefunc_def->zread_file = fread_file_func;
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
@@ -234,8 +219,7 @@ void fill_fopen_filefunc (pzlib_filefunc_def)
pzlib_filefunc_def->opaque = NULL;
}
void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
{
void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) {
pzlib_filefunc_def->zopen64_file = fopen64_file_func;
pzlib_filefunc_def->zread_file = fread_file_func;
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
+24 -28
View File
@@ -43,19 +43,14 @@
#include <stdio.h>
#include <stdlib.h>
#include "zlib.h"
#ifndef OF
#define OF _Z_OF
#endif
#if defined(USE_FILE32API)
#define fopen64 fopen
#define ftello64 ftell
#define fseeko64 fseek
#else
#ifdef __FreeBSD__
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
#define fopen64 fopen
#define ftello64 ftello
#define fseeko64 fseeko
@@ -87,18 +82,16 @@
#include "mz64conf.h"
#endif
/* a type choosen by DEFINE */
/* a type chosen by DEFINE */
#ifdef HAVE_64BIT_INT_CUSTOM
typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
#else
#ifdef HAS_STDINT_H
#include "stdint.h"
typedef uint64_t ZPOS64_T;
#else
/* Maximum unsigned 32-bit value used as placeholder for zip64 */
#define MAXU32 0xffffffff
#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef unsigned __int64 ZPOS64_T;
@@ -108,7 +101,10 @@ typedef unsigned long long int ZPOS64_T;
#endif
#endif
/* Maximum unsigned 32-bit value used as placeholder for zip64 */
#ifndef MAXU32
#define MAXU32 (0xffffffff)
#endif
#ifdef __cplusplus
extern "C" {
@@ -138,17 +134,17 @@ extern "C" {
typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
typedef voidpf (ZCALLBACK *open_file_func) (voidpf opaque, const char* filename, int mode);
typedef uLong (ZCALLBACK *read_file_func) (voidpf opaque, voidpf stream, void* buf, uLong size);
typedef uLong (ZCALLBACK *write_file_func) (voidpf opaque, voidpf stream, const void* buf, uLong size);
typedef int (ZCALLBACK *close_file_func) (voidpf opaque, voidpf stream);
typedef int (ZCALLBACK *testerror_file_func) (voidpf opaque, voidpf stream);
typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
typedef long (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream);
typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin);
/* here is the "old" 32 bits structure structure */
/* here is the "old" 32 bits structure */
typedef struct zlib_filefunc_def_s
{
open_file_func zopen_file;
@@ -161,9 +157,9 @@ typedef struct zlib_filefunc_def_s
voidpf opaque;
} zlib_filefunc_def;
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode));
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) (voidpf opaque, voidpf stream);
typedef long (ZCALLBACK *seek64_file_func) (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin);
typedef voidpf (ZCALLBACK *open64_file_func) (voidpf opaque, const void* filename, int mode);
typedef struct zlib_filefunc64_def_s
{
@@ -177,8 +173,8 @@ typedef struct zlib_filefunc64_def_s
voidpf opaque;
} zlib_filefunc64_def;
void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def);
void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def);
/* now internal definition, only for zip.c and unzip.h */
typedef struct zlib_filefunc64_32_def_s
@@ -197,11 +193,11 @@ typedef struct zlib_filefunc64_32_def_s
#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
voidpf call_zopen64(const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode);
long call_zseek64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin);
ZPOS64_T call_ztell64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream);
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
#define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
#define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))
File diff suppressed because it is too large Load Diff
+76 -76
View File
@@ -83,12 +83,12 @@ typedef voidp unzFile;
/* tm_unz contain date/time info */
typedef struct tm_unz_s
{
uInt tm_sec; /* seconds after the minute - [0,59] */
uInt tm_min; /* minutes after the hour - [0,59] */
uInt tm_hour; /* hours since midnight - [0,23] */
uInt tm_mday; /* day of the month - [1,31] */
uInt tm_mon; /* months since January - [0,11] */
uInt tm_year; /* years - [1980..2044] */
int tm_sec; /* seconds after the minute - [0,59] */
int tm_min; /* minutes after the hour - [0,59] */
int tm_hour; /* hours since midnight - [0,23] */
int tm_mday; /* day of the month - [1,31] */
int tm_mon; /* months since January - [0,11] */
int tm_year; /* years - [1980..2044] */
} tm_unz;
/* unz_global_info structure contain global data about the ZIPfile
@@ -150,21 +150,21 @@ typedef struct unz_file_info_s
tm_unz tmu_date;
} unz_file_info;
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
const char* fileName2,
int iCaseSensitivity));
extern int ZEXPORT unzStringFileNameCompare(const char* fileName1,
const char* fileName2,
int iCaseSensitivity);
/*
Compare two filename (fileName1,fileName2).
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
Compare two filenames (fileName1,fileName2).
If iCaseSensitivity = 1, comparison is case sensitive (like strcmp)
If iCaseSensitivity = 2, comparison is not case sensitive (like strcmpi
or strcasecmp)
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
If iCaseSensitivity = 0, case sensitivity is default of your operating system
(like 1 on Unix, 2 on Windows)
*/
extern unzFile ZEXPORT unzOpen OF((const char *path));
extern unzFile ZEXPORT unzOpen64 OF((const void *path));
extern unzFile ZEXPORT unzOpen(const char *path);
extern unzFile ZEXPORT unzOpen64(const void *path);
/*
Open a Zip file. path contain the full pathname (by example,
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
@@ -181,41 +181,41 @@ extern unzFile ZEXPORT unzOpen64 OF((const void *path));
*/
extern unzFile ZEXPORT unzOpen2 OF((const char *path,
zlib_filefunc_def* pzlib_filefunc_def));
extern unzFile ZEXPORT unzOpen2(const char *path,
zlib_filefunc_def* pzlib_filefunc_def);
/*
Open a Zip file, like unzOpen, but provide a set of file low level API
for read/write the zip file (see ioapi.h)
*/
extern unzFile ZEXPORT unzOpen2_64 OF((const void *path,
zlib_filefunc64_def* pzlib_filefunc_def));
extern unzFile ZEXPORT unzOpen2_64(const void *path,
zlib_filefunc64_def* pzlib_filefunc_def);
/*
Open a Zip file, like unz64Open, but provide a set of file low level API
for read/write the zip file (see ioapi.h)
*/
extern int ZEXPORT unzClose OF((unzFile file));
extern int ZEXPORT unzClose(unzFile file);
/*
Close a ZipFile opened with unzipOpen.
Close a ZipFile opened with unzOpen.
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
these files MUST be closed with unzCloseCurrentFile before call unzClose.
return UNZ_OK if there is no problem. */
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
unz_global_info *pglobal_info));
extern int ZEXPORT unzGetGlobalInfo(unzFile file,
unz_global_info *pglobal_info);
extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file,
unz_global_info64 *pglobal_info));
extern int ZEXPORT unzGetGlobalInfo64(unzFile file,
unz_global_info64 *pglobal_info);
/*
Write info about the ZipFile in the *pglobal_info structure.
No preparation of the structure is needed
return UNZ_OK if there is no problem. */
extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
char *szComment,
uLong uSizeBuf));
extern int ZEXPORT unzGetGlobalComment(unzFile file,
char *szComment,
uLong uSizeBuf);
/*
Get the global comment string of the ZipFile, in the szComment buffer.
uSizeBuf is the size of the szComment buffer.
@@ -226,22 +226,22 @@ extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
/***************************************************************************/
/* Unzip package allow you browse the directory of the zipfile */
extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
extern int ZEXPORT unzGoToFirstFile(unzFile file);
/*
Set the current file of the zipfile to the first file.
return UNZ_OK if there is no problem
*/
extern int ZEXPORT unzGoToNextFile OF((unzFile file));
extern int ZEXPORT unzGoToNextFile(unzFile file);
/*
Set the current file of the zipfile to the next file.
return UNZ_OK if there is no problem
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
*/
extern int ZEXPORT unzLocateFile OF((unzFile file,
const char *szFileName,
int iCaseSensitivity));
extern int ZEXPORT unzLocateFile(unzFile file,
const char *szFileName,
int iCaseSensitivity);
/*
Try locate the file szFileName in the zipfile.
For the iCaseSensitivity signification, see unzStringFileNameCompare
@@ -285,28 +285,28 @@ extern int ZEXPORT unzGoToFilePos64(
/* ****************************************** */
extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file,
unz_file_info64 *pfile_info,
char *szFileName,
uLong fileNameBufferSize,
void *extraField,
uLong extraFieldBufferSize,
char *szComment,
uLong commentBufferSize));
extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file,
unz_file_info64 *pfile_info,
char *szFileName,
uLong fileNameBufferSize,
void *extraField,
uLong extraFieldBufferSize,
char *szComment,
uLong commentBufferSize);
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
unz_file_info *pfile_info,
char *szFileName,
uLong fileNameBufferSize,
void *extraField,
uLong extraFieldBufferSize,
char *szComment,
uLong commentBufferSize));
extern int ZEXPORT unzGetCurrentFileInfo(unzFile file,
unz_file_info *pfile_info,
char *szFileName,
uLong fileNameBufferSize,
void *extraField,
uLong extraFieldBufferSize,
char *szComment,
uLong commentBufferSize);
/*
Get Info about the current file
if pfile_info!=NULL, the *pfile_info structure will contain somes info about
if pfile_info!=NULL, the *pfile_info structure will contain some info about
the current file
if szFileName!=NULL, the filemane string will be copied in szFileName
if szFileName!=NULL, the filename string will be copied in szFileName
(fileNameBufferSize is the size of the buffer)
if extraField!=NULL, the extra field information will be copied in extraField
(extraFieldBufferSize is the size of the buffer).
@@ -318,7 +318,7 @@ extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
/** Addition for GDAL : START */
extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file));
extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file);
/** Addition for GDAL : END */
@@ -328,24 +328,24 @@ extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file));
from it, and close it (you can close it before reading all the file)
*/
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
extern int ZEXPORT unzOpenCurrentFile(unzFile file);
/*
Open for reading data the current file in the zipfile.
If there is no error, the return value is UNZ_OK.
*/
extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
const char* password));
extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file,
const char* password);
/*
Open for reading data the current file in the zipfile.
password is a crypting password
If there is no error, the return value is UNZ_OK.
*/
extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
int* method,
int* level,
int raw));
extern int ZEXPORT unzOpenCurrentFile2(unzFile file,
int* method,
int* level,
int raw);
/*
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
if raw==1
@@ -355,11 +355,11 @@ extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
but you CANNOT set method parameter as NULL
*/
extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
int* method,
int* level,
int raw,
const char* password));
extern int ZEXPORT unzOpenCurrentFile3(unzFile file,
int* method,
int* level,
int raw,
const char* password);
/*
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
if raw==1
@@ -370,41 +370,41 @@ extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
*/
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
extern int ZEXPORT unzCloseCurrentFile(unzFile file);
/*
Close the file in zip opened with unzOpenCurrentFile
Return UNZ_CRCERROR if all the file was read but the CRC is not good
*/
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
voidp buf,
unsigned len));
extern int ZEXPORT unzReadCurrentFile(unzFile file,
voidp buf,
unsigned len);
/*
Read bytes from the current file (opened by unzOpenCurrentFile)
buf contain buffer where data must be copied
len the size of buf.
return the number of byte copied if somes bytes are copied
return the number of byte copied if some bytes are copied
return 0 if the end of file was reached
return <0 with error code if there is an error
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
*/
extern z_off_t ZEXPORT unztell OF((unzFile file));
extern z_off_t ZEXPORT unztell(unzFile file);
extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file));
extern ZPOS64_T ZEXPORT unztell64(unzFile file);
/*
Give the current position in uncompressed data
*/
extern int ZEXPORT unzeof OF((unzFile file));
extern int ZEXPORT unzeof(unzFile file);
/*
return 1 if the end of file was reached, 0 elsewhere
*/
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
voidp buf,
unsigned len));
extern int ZEXPORT unzGetLocalExtrafield(unzFile file,
voidp buf,
unsigned len);
/*
Read extra field from the current file (opened by unzOpenCurrentFile)
This is the local-header version of the extra field (sometimes, there is
+170 -221
View File
@@ -14,8 +14,8 @@
Oct-2009 - Mathias Svensson - Added Zip64 Support when creating new file archives
Oct-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions.
Oct-2009 - Mathias Svensson - Added zipRemoveExtraInfoBlock to strip extra field data from its ZIP64 data
It is used when recreting zip archive with RAW when deleting items from a zip.
ZIP64 data is automaticly added to items that needs it, and existing ZIP64 data need to be removed.
It is used when recreating zip archive with RAW when deleting items from a zip.
ZIP64 data is automatically added to items that needs it, and existing ZIP64 data need to be removed.
Oct-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required)
Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
@@ -25,15 +25,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <time.h>
#include "zip.h"
#include "zlib.h"
#include "zip.h"
#ifdef STDC
# include <stddef.h>
# include <stdlib.h>
# include <string.h>
#endif
#ifdef NO_ERRNO_H
extern int errno;
@@ -48,7 +46,7 @@
/* compile with -Dlocal if your debugger can't find static symbols */
#ifndef VERSIONMADEBY
# define VERSIONMADEBY (0x0) /* platform depedent */
# define VERSIONMADEBY (0x0) /* platform dependent */
#endif
#ifndef Z_BUFSIZE
@@ -62,9 +60,6 @@
#ifndef ALLOC
# define ALLOC(size) (malloc(size))
#endif
#ifndef TRYFREE
# define TRYFREE(p) {if (p) free(p);}
#endif
/*
#define SIZECENTRALDIRITEM (0x2e)
@@ -117,7 +112,7 @@ typedef struct linkedlist_datablock_internal_s
struct linkedlist_datablock_internal_s* next_datablock;
uLong avail_in_this_block;
uLong filled_in_this_block;
uLong unused; /* for future use and alignement */
uLong unused; /* for future use and alignment */
unsigned char data[SIZEDATA_INDATABLOCK];
} linkedlist_datablock_internal;
@@ -139,40 +134,40 @@ typedef struct
uInt pos_in_buffered_data; /* last written byte in buffered_data */
ZPOS64_T pos_local_header; /* offset of the local header of the file
currenty writing */
currently writing */
char* central_header; /* central header data for the current file */
uLong size_centralExtra;
uLong size_centralheader; /* size of the central header for cur file */
uLong size_centralExtraFree; /* Extra bytes allocated to the centralheader but that are not used */
uLong flag; /* flag of the file currently writing */
int method; /* compression method of file currenty wr.*/
int method; /* compression method of file currently wr.*/
int raw; /* 1 for directly writing raw data */
Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/
uLong dosDate;
uLong crc32;
int encrypt;
int zip64; /* Add ZIP64 extened information in the extra field */
int zip64; /* Add ZIP64 extended information in the extra field */
ZPOS64_T pos_zip64extrainfo;
ZPOS64_T totalCompressedData;
ZPOS64_T totalUncompressedData;
#ifndef NOCRYPT
unsigned long keys[3]; /* keys defining the pseudo-random sequence */
const unsigned long* pcrc_32_tab;
int crypt_header_size;
const z_crc_t* pcrc_32_tab;
unsigned crypt_header_size;
#endif
} curfile64_info;
typedef struct
{
zlib_filefunc64_32_def z_filefunc;
voidpf filestream; /* io structore of the zipfile */
voidpf filestream; /* io structure of the zipfile */
linkedlist_data central_dir;/* datablock with central dir in construction*/
int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/
curfile64_info ci; /* info on the file curretly writing */
curfile64_info ci; /* info on the file currently writing */
ZPOS64_T begin_pos; /* position of the beginning of the zipfile */
ZPOS64_T add_position_when_writting_offset;
ZPOS64_T add_position_when_writing_offset;
ZPOS64_T number_entry;
#ifndef NO_ADDFILEINEXISTINGZIP
@@ -187,8 +182,7 @@ typedef struct
#include "crypt.h"
#endif
local linkedlist_datablock_internal* allocate_new_datablock()
{
local linkedlist_datablock_internal* allocate_new_datablock(void) {
linkedlist_datablock_internal* ldi;
ldi = (linkedlist_datablock_internal*)
ALLOC(sizeof(linkedlist_datablock_internal));
@@ -201,30 +195,26 @@ local linkedlist_datablock_internal* allocate_new_datablock()
return ldi;
}
local void free_datablock(linkedlist_datablock_internal* ldi)
{
local void free_datablock(linkedlist_datablock_internal* ldi) {
while (ldi!=NULL)
{
linkedlist_datablock_internal* ldinext = ldi->next_datablock;
TRYFREE(ldi);
free(ldi);
ldi = ldinext;
}
}
local void init_linkedlist(linkedlist_data* ll)
{
local void init_linkedlist(linkedlist_data* ll) {
ll->first_block = ll->last_block = NULL;
}
local void free_linkedlist(linkedlist_data* ll)
{
local void free_linkedlist(linkedlist_data* ll) {
free_datablock(ll->first_block);
ll->first_block = ll->last_block = NULL;
}
local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
{
local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len) {
linkedlist_datablock_internal* ldi;
const unsigned char* from_copy;
@@ -239,7 +229,7 @@ local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
}
ldi = ll->last_block;
from_copy = (unsigned char*)buf;
from_copy = (const unsigned char*)buf;
while (len>0)
{
@@ -284,9 +274,7 @@ local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T)
*/
local int zip64local_putValue OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte));
local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte)
{
local int zip64local_putValue(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte) {
unsigned char buf[8];
int n;
for (n = 0; n < nbByte; n++)
@@ -302,15 +290,13 @@ local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def,
}
}
if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte)
if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,(uLong)nbByte)!=(uLong)nbByte)
return ZIP_ERRNO;
else
return ZIP_OK;
}
local void zip64local_putValue_inmemory OF((void* dest, ZPOS64_T x, int nbByte));
local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte)
{
local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte) {
unsigned char* buf=(unsigned char*)dest;
int n;
for (n = 0; n < nbByte; n++) {
@@ -330,25 +316,21 @@ local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte)
/****************************************************************************/
local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm)
{
local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm) {
uLong year = (uLong)ptm->tm_year;
if (year>=1980)
year-=1980;
else if (year>=80)
year-=80;
return
(uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) |
((ptm->tm_sec/2) + (32* ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
(uLong) (((uLong)(ptm->tm_mday) + (32 * (uLong)(ptm->tm_mon+1)) + (512 * year)) << 16) |
(((uLong)ptm->tm_sec/2) + (32 * (uLong)ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
}
/****************************************************************************/
local int zip64local_getByte OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi));
local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,voidpf filestream,int* pi)
{
local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int* pi) {
unsigned char c;
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
if (err==1)
@@ -369,10 +351,7 @@ local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,vo
/* ===========================================================================
Reads a long in LSB order from the given gz_stream. Sets
*/
local int zip64local_getShort OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX));
local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
{
local int zip64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) {
uLong x ;
int i = 0;
int err;
@@ -391,10 +370,7 @@ local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def,
return err;
}
local int zip64local_getLong OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX));
local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
{
local int zip64local_getLong(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) {
uLong x ;
int i = 0;
int err;
@@ -421,11 +397,8 @@ local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def,
return err;
}
local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX));
local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)
{
local int zip64local_getLong64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX) {
ZPOS64_T x;
int i = 0;
int err;
@@ -476,10 +449,7 @@ local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def
Locate the Central directory of a zipfile (at the end, just before
the global comment)
*/
local ZPOS64_T zip64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
{
local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
unsigned char* buf;
ZPOS64_T uSizeFile;
ZPOS64_T uBackRead;
@@ -523,14 +493,14 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
{
uPosFound = uReadPos+i;
uPosFound = uReadPos+(unsigned)i;
break;
}
if (uPosFound!=0)
break;
}
TRYFREE(buf);
free(buf);
return uPosFound;
}
@@ -538,10 +508,7 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before
the global comment)
*/
local ZPOS64_T zip64local_SearchCentralDir64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
{
local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
unsigned char* buf;
ZPOS64_T uSizeFile;
ZPOS64_T uBackRead;
@@ -587,7 +554,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
// Signature "0x07064b50" Zip64 end of central directory locater
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
{
uPosFound = uReadPos+i;
uPosFound = uReadPos+(unsigned)i;
break;
}
}
@@ -596,7 +563,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
break;
}
TRYFREE(buf);
free(buf);
if (uPosFound == 0)
return 0;
@@ -608,7 +575,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
return 0;
/* number of the disk with the start of the zip64 end of central directory */
/* number of the disk with the start of the zip64 end of central directory */
if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
return 0;
if (uL != 0)
@@ -638,8 +605,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
return relativeOffset;
}
int LoadCentralDirectoryRecord(zip64_internal* pziinit)
{
local int LoadCentralDirectoryRecord(zip64_internal* pziinit) {
int err=ZIP_OK;
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
@@ -648,10 +614,10 @@ int LoadCentralDirectoryRecord(zip64_internal* pziinit)
ZPOS64_T central_pos;
uLong uL;
uLong number_disk; /* number of the current dist, used for
spaning ZIP, unsupported, always 0*/
uLong number_disk_with_CD; /* number the the disk with central dir, used
for spaning ZIP, unsupported, always 0*/
uLong number_disk; /* number of the current disk, used for
spanning ZIP, unsupported, always 0*/
uLong number_disk_with_CD; /* number of the disk with central dir, used
for spanning ZIP, unsupported, always 0*/
ZPOS64_T number_entry;
ZPOS64_T number_entry_CD; /* total number of entries in
the central dir
@@ -808,7 +774,7 @@ int LoadCentralDirectoryRecord(zip64_internal* pziinit)
}
byte_before_the_zipfile = central_pos - (offset_central_dir+size_central_dir);
pziinit->add_position_when_writting_offset = byte_before_the_zipfile;
pziinit->add_position_when_writing_offset = byte_before_the_zipfile;
{
ZPOS64_T size_central_dir_to_read = size_central_dir;
@@ -831,7 +797,7 @@ int LoadCentralDirectoryRecord(zip64_internal* pziinit)
size_central_dir_to_read-=read_this;
}
TRYFREE(buf_read);
free(buf_read);
}
pziinit->begin_pos = byte_before_the_zipfile;
pziinit->number_entry = number_entry_CD;
@@ -847,8 +813,7 @@ int LoadCentralDirectoryRecord(zip64_internal* pziinit)
/************************************************************/
extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def)
{
extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def) {
zip64_internal ziinit;
zip64_internal* zi;
int err=ZIP_OK;
@@ -876,7 +841,7 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl
ziinit.in_opened_file_inzip = 0;
ziinit.ci.stream_initialised = 0;
ziinit.number_entry = 0;
ziinit.add_position_when_writting_offset = 0;
ziinit.add_position_when_writing_offset = 0;
init_linkedlist(&(ziinit.central_dir));
@@ -906,9 +871,9 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl
if (err != ZIP_OK)
{
# ifndef NO_ADDFILEINEXISTINGZIP
TRYFREE(ziinit.globalcomment);
free(ziinit.globalcomment);
# endif /* !NO_ADDFILEINEXISTINGZIP*/
TRYFREE(zi);
free(zi);
return NULL;
}
else
@@ -918,8 +883,7 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl
}
}
extern zipFile ZEXPORT zipOpen2 (const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def)
{
extern zipFile ZEXPORT zipOpen2(const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def) {
if (pzlib_filefunc32_def != NULL)
{
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
@@ -930,8 +894,7 @@ extern zipFile ZEXPORT zipOpen2 (const char *pathname, int append, zipcharpc* gl
return zipOpen3(pathname, append, globalcomment, NULL);
}
extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def)
{
extern zipFile ZEXPORT zipOpen2_64(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def) {
if (pzlib_filefunc_def != NULL)
{
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
@@ -946,18 +909,15 @@ extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc*
extern zipFile ZEXPORT zipOpen (const char* pathname, int append)
{
extern zipFile ZEXPORT zipOpen(const char* pathname, int append) {
return zipOpen3((const void*)pathname,append,NULL,NULL);
}
extern zipFile ZEXPORT zipOpen64 (const void* pathname, int append)
{
extern zipFile ZEXPORT zipOpen64(const void* pathname, int append) {
return zipOpen3(pathname,append,NULL,NULL);
}
int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
{
local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local) {
/* write the local header */
int err;
uInt size_filename = (uInt)strlen(filename);
@@ -1035,8 +995,8 @@ int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_ex
// Remember position of Zip64 extended info for the local file header. (needed when we update size after done with file)
zi->ci.pos_zip64extrainfo = ZTELL64(zi->z_filefunc,zi->filestream);
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)HeaderID,2);
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)DataSize,2);
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)HeaderID,2);
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)DataSize,2);
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8);
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)CompressedSize,8);
@@ -1053,14 +1013,13 @@ int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_ex
It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize
unnecessary allocations.
*/
extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
const void* extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, uInt size_extrafield_global,
const char* comment, int method, int level, int raw,
int windowBits,int memLevel, int strategy,
const char* password, uLong crcForCrypting,
uLong versionMadeBy, uLong flagBase, int zip64)
{
extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
const void* extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, uInt size_extrafield_global,
const char* comment, int method, int level, int raw,
int windowBits,int memLevel, int strategy,
const char* password, uLong crcForCrypting,
uLong versionMadeBy, uLong flagBase, int zip64) {
zip64_internal* zi;
uInt size_filename;
uInt size_comment;
@@ -1068,6 +1027,7 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
int err = ZIP_OK;
# ifdef NOCRYPT
(crcForCrypting);
if (password != NULL)
return ZIP_PARAMERROR;
# endif
@@ -1083,6 +1043,17 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
return ZIP_PARAMERROR;
#endif
// The filename and comment length must fit in 16 bits.
if ((filename!=NULL) && (strlen(filename)>0xffff))
return ZIP_PARAMERROR;
if ((comment!=NULL) && (strlen(comment)>0xffff))
return ZIP_PARAMERROR;
// The extra field length must fit in 16 bits. If the member also requires
// a Zip64 extra block, that will also need to fit within that 16-bit
// length, but that will be checked for later.
if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff))
return ZIP_PARAMERROR;
zi = (zip64_internal*)file;
if (zi->in_opened_file_inzip == 1)
@@ -1164,7 +1135,7 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
if(zi->ci.pos_local_header >= 0xffffffff)
zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)0xffffffff,4);
else
zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header - zi->add_position_when_writting_offset,4);
zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header - zi->add_position_when_writing_offset,4);
for (i=0;i<size_filename;i++)
*(zi->ci.central_header+SIZECENTRALHEADER+i) = *(filename+i);
@@ -1262,35 +1233,33 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
return err;
}
extern int ZEXPORT zipOpenNewFileInZip4 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
const void* extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, uInt size_extrafield_global,
const char* comment, int method, int level, int raw,
int windowBits,int memLevel, int strategy,
const char* password, uLong crcForCrypting,
uLong versionMadeBy, uLong flagBase)
{
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, raw,
windowBits, memLevel, strategy,
password, crcForCrypting, versionMadeBy, flagBase, 0);
extern int ZEXPORT zipOpenNewFileInZip4(zipFile file, const char* filename, const zip_fileinfo* zipfi,
const void* extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, uInt size_extrafield_global,
const char* comment, int method, int level, int raw,
int windowBits,int memLevel, int strategy,
const char* password, uLong crcForCrypting,
uLong versionMadeBy, uLong flagBase) {
return zipOpenNewFileInZip4_64(file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, raw,
windowBits, memLevel, strategy,
password, crcForCrypting, versionMadeBy, flagBase, 0);
}
extern int ZEXPORT zipOpenNewFileInZip3 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
const void* extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, uInt size_extrafield_global,
const char* comment, int method, int level, int raw,
int windowBits,int memLevel, int strategy,
const char* password, uLong crcForCrypting)
{
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, raw,
windowBits, memLevel, strategy,
password, crcForCrypting, VERSIONMADEBY, 0, 0);
extern int ZEXPORT zipOpenNewFileInZip3(zipFile file, const char* filename, const zip_fileinfo* zipfi,
const void* extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, uInt size_extrafield_global,
const char* comment, int method, int level, int raw,
int windowBits,int memLevel, int strategy,
const char* password, uLong crcForCrypting) {
return zipOpenNewFileInZip4_64(file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, raw,
windowBits, memLevel, strategy,
password, crcForCrypting, VERSIONMADEBY, 0, 0);
}
extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
@@ -1298,70 +1267,64 @@ extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, c
const void* extrafield_global, uInt size_extrafield_global,
const char* comment, int method, int level, int raw,
int windowBits,int memLevel, int strategy,
const char* password, uLong crcForCrypting, int zip64)
{
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, raw,
windowBits, memLevel, strategy,
password, crcForCrypting, VERSIONMADEBY, 0, zip64);
const char* password, uLong crcForCrypting, int zip64) {
return zipOpenNewFileInZip4_64(file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, raw,
windowBits, memLevel, strategy,
password, crcForCrypting, VERSIONMADEBY, 0, zip64);
}
extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi,
const void* extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, uInt size_extrafield_global,
const char* comment, int method, int level, int raw)
{
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, raw,
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
NULL, 0, VERSIONMADEBY, 0, 0);
const char* comment, int method, int level, int raw) {
return zipOpenNewFileInZip4_64(file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, raw,
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
NULL, 0, VERSIONMADEBY, 0, 0);
}
extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
const void* extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, uInt size_extrafield_global,
const char* comment, int method, int level, int raw, int zip64)
{
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, raw,
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
NULL, 0, VERSIONMADEBY, 0, zip64);
const void* extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, uInt size_extrafield_global,
const char* comment, int method, int level, int raw, int zip64) {
return zipOpenNewFileInZip4_64(file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, raw,
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
NULL, 0, VERSIONMADEBY, 0, zip64);
}
extern int ZEXPORT zipOpenNewFileInZip64 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
const void* extrafield_local, uInt size_extrafield_local,
const void*extrafield_global, uInt size_extrafield_global,
const char* comment, int method, int level, int zip64)
{
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, 0,
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
NULL, 0, VERSIONMADEBY, 0, zip64);
extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
const void* extrafield_local, uInt size_extrafield_local,
const void*extrafield_global, uInt size_extrafield_global,
const char* comment, int method, int level, int zip64) {
return zipOpenNewFileInZip4_64(file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, 0,
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
NULL, 0, VERSIONMADEBY, 0, zip64);
}
extern int ZEXPORT zipOpenNewFileInZip (zipFile file, const char* filename, const zip_fileinfo* zipfi,
const void* extrafield_local, uInt size_extrafield_local,
const void*extrafield_global, uInt size_extrafield_global,
const char* comment, int method, int level)
{
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, 0,
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
NULL, 0, VERSIONMADEBY, 0, 0);
extern int ZEXPORT zipOpenNewFileInZip(zipFile file, const char* filename, const zip_fileinfo* zipfi,
const void* extrafield_local, uInt size_extrafield_local,
const void*extrafield_global, uInt size_extrafield_global,
const char* comment, int method, int level) {
return zipOpenNewFileInZip4_64(file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, 0,
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
NULL, 0, VERSIONMADEBY, 0, 0);
}
local int zip64FlushWriteBuffer(zip64_internal* zi)
{
local int zip64FlushWriteBuffer(zip64_internal* zi) {
int err=ZIP_OK;
if (zi->ci.encrypt != 0)
@@ -1399,8 +1362,7 @@ local int zip64FlushWriteBuffer(zip64_internal* zi)
return err;
}
extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned int len)
{
extern int ZEXPORT zipWriteInFileInZip(zipFile file, const void* buf, unsigned int len) {
zip64_internal* zi;
int err=ZIP_OK;
@@ -1450,7 +1412,7 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in
else
#endif
{
zi->ci.stream.next_in = (Bytef*)buf;
zi->ci.stream.next_in = (Bytef*)(uintptr_t)buf;
zi->ci.stream.avail_in = len;
while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
@@ -1471,11 +1433,6 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in
{
uLong uTotalOutBefore = zi->ci.stream.total_out;
err=deflate(&zi->ci.stream, Z_NO_FLUSH);
if(uTotalOutBefore > zi->ci.stream.total_out)
{
int bBreak = 0;
bBreak++;
}
zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
}
@@ -1506,17 +1463,15 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in
return err;
}
extern int ZEXPORT zipCloseFileInZipRaw (zipFile file, uLong uncompressed_size, uLong crc32)
{
extern int ZEXPORT zipCloseFileInZipRaw(zipFile file, uLong uncompressed_size, uLong crc32) {
return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32);
}
extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_size, uLong crc32)
{
extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_size, uLong crc32) {
zip64_internal* zi;
ZPOS64_T compressed_size;
uLong invalidValue = 0xffffffff;
short datasize = 0;
unsigned datasize = 0;
int err=ZIP_OK;
if (file == NULL)
@@ -1653,7 +1608,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s
if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree)
{
// we can not write more data to the buffer that we have room for.
// we cannot write more data to the buffer that we have room for.
return ZIP_BADZIPFILE;
}
@@ -1747,15 +1702,13 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s
return err;
}
extern int ZEXPORT zipCloseFileInZip (zipFile file)
{
extern int ZEXPORT zipCloseFileInZip(zipFile file) {
return zipCloseFileInZipRaw (file,0,0);
}
int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
{
local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip) {
int err = ZIP_OK;
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writting_offset;
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset;
err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDLOCHEADERMAGIC,4);
@@ -1774,8 +1727,7 @@ int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eo
return err;
}
int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
{
local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) {
int err = ZIP_OK;
uLong Zip64DataSize = 44;
@@ -1808,13 +1760,13 @@ int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centra
if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */
{
ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writting_offset;
ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (ZPOS64_T)pos,8);
}
return err;
}
int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
{
local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) {
int err = ZIP_OK;
/*signature*/
@@ -1849,20 +1801,19 @@ int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir,
if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */
{
ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writting_offset;
ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
if(pos >= 0xffffffff)
{
err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)0xffffffff,4);
}
else
err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)(centraldir_pos_inzip - zi->add_position_when_writting_offset),4);
err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)(centraldir_pos_inzip - zi->add_position_when_writing_offset),4);
}
return err;
}
int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
{
local int Write_GlobalComment(zip64_internal* zi, const char* global_comment) {
int err = ZIP_OK;
uInt size_global_comment = 0;
@@ -1879,8 +1830,7 @@ int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
return err;
}
extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
{
extern int ZEXPORT zipClose(zipFile file, const char* global_comment) {
zip64_internal* zi;
int err = 0;
uLong size_centraldir = 0;
@@ -1921,8 +1871,8 @@ extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
}
free_linkedlist(&(zi->central_dir));
pos = centraldir_pos_inzip - zi->add_position_when_writting_offset;
if(pos >= 0xffffffff || zi->number_entry > 0xFFFF)
pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
if(pos >= 0xffffffff || zi->number_entry >= 0xFFFF)
{
ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream);
Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip);
@@ -1941,15 +1891,14 @@ extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
err = ZIP_ERRNO;
#ifndef NO_ADDFILEINEXISTINGZIP
TRYFREE(zi->globalcomment);
free(zi->globalcomment);
#endif
TRYFREE(zi);
free(zi);
return err;
}
extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHeader)
{
extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader) {
char* p = pData;
int size = 0;
char* pNewHeader;
@@ -1959,10 +1908,10 @@ extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHe
int retVal = ZIP_OK;
if(pData == NULL || *dataLen < 4)
if(pData == NULL || dataLen == NULL || *dataLen < 4)
return ZIP_PARAMERROR;
pNewHeader = (char*)ALLOC(*dataLen);
pNewHeader = (char*)ALLOC((unsigned)*dataLen);
pTmp = pNewHeader;
while(p < (pData + *dataLen))
@@ -2001,7 +1950,7 @@ extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHe
else
retVal = ZIP_ERRNO;
TRYFREE(pNewHeader);
free(pNewHeader);
return retVal;
}
+149 -147
View File
@@ -88,12 +88,12 @@ typedef voidp zipFile;
/* tm_zip contain date/time info */
typedef struct tm_zip_s
{
uInt tm_sec; /* seconds after the minute - [0,59] */
uInt tm_min; /* minutes after the hour - [0,59] */
uInt tm_hour; /* hours since midnight - [0,23] */
uInt tm_mday; /* day of the month - [1,31] */
uInt tm_mon; /* months since January - [0,11] */
uInt tm_year; /* years - [1980..2044] */
int tm_sec; /* seconds after the minute - [0,59] */
int tm_min; /* minutes after the hour - [0,59] */
int tm_hour; /* hours since midnight - [0,23] */
int tm_mday; /* day of the month - [1,31] */
int tm_mon; /* months since January - [0,11] */
int tm_year; /* years - [1980..2044] */
} tm_zip;
typedef struct
@@ -113,8 +113,8 @@ typedef const char* zipcharpc;
#define APPEND_STATUS_CREATEAFTER (1)
#define APPEND_STATUS_ADDINZIP (2)
extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append));
extern zipFile ZEXPORT zipOpen(const char *pathname, int append);
extern zipFile ZEXPORT zipOpen64(const void *pathname, int append);
/*
Create a zipfile.
pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
@@ -131,50 +131,55 @@ extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append));
/* Note : there is no delete function into a zipfile.
If you want delete file into a zipfile, you must open a zipfile, and create another
Of couse, you can use RAW reading and writing to copy the file you did not want delte
Of course, you can use RAW reading and writing to copy the file you did not want delete
*/
extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
extern zipFile ZEXPORT zipOpen2(const char *pathname,
int append,
zipcharpc* globalcomment,
zlib_filefunc_def* pzlib_filefunc_def);
extern zipFile ZEXPORT zipOpen2_64(const void *pathname,
int append,
zipcharpc* globalcomment,
zlib_filefunc_def* pzlib_filefunc_def));
zlib_filefunc64_def* pzlib_filefunc_def);
extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname,
int append,
zipcharpc* globalcomment,
zlib_filefunc64_def* pzlib_filefunc_def));
extern zipFile ZEXPORT zipOpen3(const void *pathname,
int append,
zipcharpc* globalcomment,
zlib_filefunc64_32_def* pzlib_filefunc64_32_def);
extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level));
extern int ZEXPORT zipOpenNewFileInZip(zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level);
extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int zip64));
extern int ZEXPORT zipOpenNewFileInZip64(zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int zip64);
/*
Open a file in the ZIP for writing.
filename : the filename in zip (if NULL, '-' without quote will be used
*zipfi contain supplemental information
if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
contains the extrafield data the the local header
contains the extrafield data for the local header
if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
contains the extrafield data the the local header
contains the extrafield data for the global header
if comment != NULL, comment contain the comment string
method contain the compression method (0 for store, Z_DEFLATED for deflate)
level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
@@ -184,70 +189,69 @@ extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file,
*/
extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int raw));
extern int ZEXPORT zipOpenNewFileInZip2(zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int raw);
extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int raw,
int zip64));
extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int raw,
int zip64);
/*
Same than zipOpenNewFileInZip, except if raw=1, we write raw file
*/
extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int raw,
int windowBits,
int memLevel,
int strategy,
const char* password,
uLong crcForCrypting));
extern int ZEXPORT zipOpenNewFileInZip3(zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int raw,
int windowBits,
int memLevel,
int strategy,
const char* password,
uLong crcForCrypting);
extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int raw,
int windowBits,
int memLevel,
int strategy,
const char* password,
uLong crcForCrypting,
int zip64
));
extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int raw,
int windowBits,
int memLevel,
int strategy,
const char* password,
uLong crcForCrypting,
int zip64);
/*
Same than zipOpenNewFileInZip2, except
@@ -256,47 +260,45 @@ extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file,
crcForCrypting : crc of file to compress (needed for crypting)
*/
extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int raw,
int windowBits,
int memLevel,
int strategy,
const char* password,
uLong crcForCrypting,
uLong versionMadeBy,
uLong flagBase
));
extern int ZEXPORT zipOpenNewFileInZip4(zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int raw,
int windowBits,
int memLevel,
int strategy,
const char* password,
uLong crcForCrypting,
uLong versionMadeBy,
uLong flagBase);
extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int raw,
int windowBits,
int memLevel,
int strategy,
const char* password,
uLong crcForCrypting,
uLong versionMadeBy,
uLong flagBase,
int zip64
));
extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int raw,
int windowBits,
int memLevel,
int strategy,
const char* password,
uLong crcForCrypting,
uLong versionMadeBy,
uLong flagBase,
int zip64);
/*
Same than zipOpenNewFileInZip4, except
versionMadeBy : value for Version made by field
@@ -304,25 +306,25 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file,
*/
extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
const void* buf,
unsigned len));
extern int ZEXPORT zipWriteInFileInZip(zipFile file,
const void* buf,
unsigned len);
/*
Write data in the zipfile
*/
extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
extern int ZEXPORT zipCloseFileInZip(zipFile file);
/*
Close the current file in the zipfile
*/
extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
uLong uncompressed_size,
uLong crc32));
extern int ZEXPORT zipCloseFileInZipRaw(zipFile file,
uLong uncompressed_size,
uLong crc32);
extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file,
ZPOS64_T uncompressed_size,
uLong crc32));
extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file,
ZPOS64_T uncompressed_size,
uLong crc32);
/*
Close the current file in the zipfile, for file opened with
@@ -330,14 +332,14 @@ extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file,
uncompressed_size and crc32 are value for the uncompressed size
*/
extern int ZEXPORT zipClose OF((zipFile file,
const char* global_comment));
extern int ZEXPORT zipClose(zipFile file,
const char* global_comment);
/*
Close the zipfile
*/
extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader));
extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader);
/*
zipRemoveExtraInfoBlock - Added by Mathias Svensson
+2 -2
View File
@@ -6,7 +6,7 @@
[subrepo]
remote = git@github.com:/Rosalie241/parallel-rsp.git
branch = RMG
commit = 71f52c492ac5896a02725152a0e6c59036ee9576
parent = e8f10693c73eeed017f45cf8289a3763ae16c257
commit = f7c164cf0c4131f6cfbcaefba9af3c8eaf6df1b0
parent = eb6dd8068ef4d82e47807ebccca0444d2e3300e2
method = merge
cmdver = 0.4.6
+2
View File
@@ -40,6 +40,7 @@ extern "C"
}
#endif
#if 0 // FIXME: this is broken with upstream mupen64plus-core
if (rd == CP0_REGISTER_SP_SEMAPHORE)
{
if (*rsp->cp0.cr[CP0_REGISTER_SP_SEMAPHORE])
@@ -56,6 +57,7 @@ extern "C"
else
*rsp->cp0.cr[CP0_REGISTER_SP_SEMAPHORE] = 1;
}
#endif
//if (rd == 4) // SP_STATUS_REG
// fprintf(stderr, "READING STATUS REG!\n");
+2 -2
View File
@@ -6,7 +6,7 @@
[subrepo]
remote = git@github.com:/gonetz/GLideN64.git
branch = master
commit = ded38f88aafb41bd3db574f2ec9f101b9bdba355
parent = 363131c1753ababf6d7745be6b850fe0e767e008
commit = 4972e76aea6b327959d1761c786077fd96b6cb30
parent = 8ce42a52ce5ab9e71eef061f8db04114b96e08d1
method = merge
cmdver = 0.4.6
@@ -369,7 +369,6 @@ copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir_x64)")</Command>
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\N64.cpp" />
<ClCompile Include="..\..\src\NoiseTexture.cpp" />
<ClCompile Include="..\..\src\PaletteTexture.cpp" />
<ClCompile Include="..\..\src\Performance.cpp" />
<ClCompile Include="..\..\src\PostProcessor.cpp" />
@@ -520,7 +519,6 @@ copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir_x64)")</Command>
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\..\src\N64.h" />
<ClInclude Include="..\..\src\NoiseTexture.h" />
<ClInclude Include="..\..\src\PaletteTexture.h" />
<ClInclude Include="..\..\src\Performance.h" />
<ClInclude Include="..\..\src\Platform.h" />
@@ -245,9 +245,6 @@
<ClCompile Include="..\..\src\Graphics\OpenGLContext\GLSL\glsl_CombinerInputs.cpp">
<Filter>Source Files\Graphics\OpenGL\GLSL</Filter>
</ClCompile>
<ClCompile Include="..\..\src\NoiseTexture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ZlutTexture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -610,9 +607,6 @@
<ClInclude Include="..\..\src\Graphics\OpenGLContext\GLSL\glsl_CombinerInputs.h">
<Filter>Header Files\Graphics\OpenGL\GLSL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\NoiseTexture.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\Graphics\ShaderProgram.h">
<Filter>Header Files\Graphics</Filter>
</ClInclude>
@@ -59,7 +59,6 @@ set(GLideN64_SOURCES
gSP.cpp
Log.cpp
N64.cpp
NoiseTexture.cpp
PaletteTexture.cpp
Performance.cpp
PostProcessor.cpp
@@ -192,7 +191,7 @@ if( NOT CMAKE_BUILD_TYPE)
set( CMAKE_BUILD_TYPE Release)
endif( NOT CMAKE_BUILD_TYPE)
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR
CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
set(GLIDEN64_BUILD_TYPE Release)
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
@@ -73,7 +73,11 @@ void Config::resetToDefaults()
frameBufferEmulation.copyDepthToRDRAM = cdSoftwareRender;
frameBufferEmulation.copyFromRDRAM = 0;
frameBufferEmulation.copyAuxToRDRAM = 0;
#ifdef M64P_GLIDENUI
frameBufferEmulation.copyToRDRAM = ctSync;
#else
frameBufferEmulation.copyToRDRAM = ctDoubleBuffer;
#endif
frameBufferEmulation.N64DepthCompare = dcDisable;
frameBufferEmulation.forceDepthBufferClear = 0;
frameBufferEmulation.aspect = a43;
@@ -31,10 +31,11 @@ namespace graphics {
DatatypeParam lutType;
u32 lutFormatBytes;
InternalColorFormatParam noiseInternalFormat;
ColorFormatParam noiseFormat;
DatatypeParam noiseType;
u32 noiseFormatBytes;
// Used for font atlas
InternalColorFormatParam fontInternalFormat;
ColorFormatParam fontFormat;
DatatypeParam fontType;
u32 fontFormatBytes;
virtual ~FramebufferTextureFormats() {}
};
@@ -1003,26 +1003,18 @@ class ShaderNoise : public ShaderPart
public:
ShaderNoise(const opengl::GLInfo & _glinfo)
{
if (_glinfo.isGLES2) {
m_part =
"uniform sampler2D uTexNoise; \n"
"lowp float snoise() \n"
"{ \n"
" mediump vec2 texSize = vec2(640.0, 580.0); \n"
" mediump vec2 coord = gl_FragCoord.xy/uScreenScale/texSize; \n"
" return texture2D(uTexNoise, coord).r; \n"
"} \n"
;
} else {
m_part =
"uniform sampler2D uTexNoise; \n"
"lowp float snoise() \n"
"{ \n"
" ivec2 coord = ivec2(gl_FragCoord.xy/uScreenScale); \n"
" return texelFetch(uTexNoise, coord, 0).r; \n"
"} \n"
;
}
m_part =
"uniform float uNoiseSeed; \n"
"lowp float snoise() \n"
"{ \n"
" mediump vec2 coord = floor(gl_FragCoord.xy/uScreenScale); \n"
" mediump vec3 p3 = vec3(uNoiseSeed, coord); \n"
// hash13 from https://www.shadertoy.com/view/4djSRW
" p3 = fract(p3 * .1031); \n"
" p3 += dot(p3, p3.zyx + 31.32); \n"
" return fract((p3.x + p3.y) * p3.z); \n"
"} \n"
;
}
};
@@ -1067,7 +1059,6 @@ public:
"} \n"
"lowp vec3 snoiseRGB() \n"
"{ \n"
" mediump vec2 texSize = vec2(640.0, 580.0); \n"
;
if (config.generalEmulation.enableHiresNoiseDithering != 0)
// multiplier for higher res noise effect
@@ -1077,19 +1068,15 @@ public:
m_part +=
" lowp float mult = 1.0; \n";
m_part +=
" mediump vec2 coordR = mult * ((gl_FragCoord.xy)/uScreenScale/texSize);\n"
" mediump vec2 coordG = mult * ((gl_FragCoord.xy + vec2( 0.0, texSize.y / 2.0 ))/uScreenScale/texSize);\n"
" mediump vec2 coordB = mult * ((gl_FragCoord.xy + vec2( texSize.x / 2.0, 0.0))/uScreenScale/texSize);\n"
// Only red channel of noise texture contains noise.
" lowp float r = texture(uTexNoise,coordR).r; \n"
" lowp float g = texture(uTexNoise,coordG).r; \n"
" lowp float b = texture(uTexNoise,coordB).r; \n"
" \n"
" return vec3(r,g,b); \n"
"} \n"
" mediump vec2 coord = floor(mult * (gl_FragCoord.xy/uScreenScale)); \n"
" mediump vec3 p3 = vec3(uNoiseSeed, coord); \n"
// hash33 from https://www.shadertoy.com/view/4djSRW
" p3 = fract(p3 * vec3(.1031, .1030, .0973)); \n"
" p3 += dot(p3, p3.yxz+33.33); \n"
" return fract((p3.xxy + p3.yxx)*p3.zyx); \n"
"} \n"
"lowp float snoiseA() \n"
"{ \n"
" mediump vec2 texSize = vec2(640.0, 580.0); \n"
;
if (config.generalEmulation.enableHiresNoiseDithering != 0)
// multiplier for higher res noise effect
@@ -1100,10 +1087,12 @@ public:
" lowp float mult = 1.0; \n";
m_part +=
" \n"
" mediump vec2 coord = mult * ((gl_FragCoord.xy)/uScreenScale/texSize);\n"
" \n"
// Only red channel of noise texture contains noise.
" return texture(uTexNoise,coord).r; \n"
" mediump vec2 coord = floor(mult * (gl_FragCoord.xy/uScreenScale)); \n"
" mediump vec3 p3 = vec3(uNoiseSeed, coord); \n"
// hash13 from https://www.shadertoy.com/view/4djSRW
" p3 = fract(p3 * .1031); \n"
" p3 += dot(p3, p3.zyx + 31.32); \n"
" return fract((p3.x + p3.y) * p3.z); \n"
"} \n"
;
}
@@ -19,7 +19,7 @@ void CombinerProgramUniformFactory::buildUniforms(GLuint _program,
const CombinerKey &_key,
UniformGroups &_uniforms) {
_addNoiseTex(_program, _uniforms);
_addNoiseSeed(_program, _uniforms);
_addScreenSpaceTriangleInfo(_program, _uniforms);
_addRasterInfo(_program, _uniforms);
_addViewportInfo(_program, _uniforms);
@@ -71,7 +71,7 @@ void CombinerProgramUniformFactory::buildUniforms(GLuint _program,
_addBlendCvg(_program, _uniforms);
_addDitherMode(_program, _uniforms, _inputs.usesNoise());
_addDitherMode(_program, _uniforms);
_addScreenScale(_program, _uniforms);
@@ -15,7 +15,7 @@ public:
UniformGroups &_uniforms);
private:
virtual void _addNoiseTex(GLuint _program, UniformGroups &_uniforms) const = 0;
virtual void _addNoiseSeed(GLuint _program, UniformGroups &_uniforms) const = 0;
virtual void _addScreenSpaceTriangleInfo(GLuint _program, UniformGroups &_uniforms) const = 0;
@@ -55,7 +55,7 @@ private:
virtual void _addBlendCvg(GLuint _program, UniformGroups &_uniforms) const = 0;
virtual void _addDitherMode(GLuint _program, UniformGroups &_uniforms, bool _usesNoise) const = 0;
virtual void _addDitherMode(GLuint _program, UniformGroups &_uniforms) const = 0;
virtual void _addScreenScale(GLuint _program, UniformGroups &_uniforms) const = 0;
@@ -317,7 +317,6 @@ public:
uTexWrap[t].set(aTexWrap[t][0], aTexWrap[t][1], _force);
uTexClamp[t].set(aTexClamp[t][0], aTexClamp[t][1], _force);
uTexWrapEn[t].set(aTexWrapEn[t][0], aTexWrapEn[t][1], _force);
uTexWrapEn[t].set(aTexWrapEn[t][0], aTexWrapEn[t][1], _force);
uTexClampEn[t].set(aTexClampEn[t][0], aTexClampEn[t][1], _force);
uTexMirrorEn[t].set(aTexMirrorEn[t][0], aTexMirrorEn[t][1], _force);
uTexSize[t].set(aTexSize[t][0], aTexSize[t][1], _force);
@@ -5,7 +5,6 @@
#include <Graphics/Context.h>
#include <Textures.h>
#include <NoiseTexture.h>
#include <FrameBuffer.h>
#include <DisplayWindow.h>
#include <RSP.h>
@@ -15,20 +14,21 @@ namespace {
using namespace glsl;
/*---------------UniformGroup-------------*/
class UNoiseTex : public UniformGroup
class UNoiseSeed : public UniformGroup
{
public:
UNoiseTex(GLuint _program) {
LocateUniform(uTexNoise);
UNoiseSeed(GLuint _program) {
LocateUniform(uNoiseSeed);
}
void update(bool _force) override
{
uTexNoise.set(int(graphics::textureIndices::NoiseTex), _force);
u32 counter = dwnd().getBuffersSwapCount();
uNoiseSeed.set(counter & 0xff, _force);
}
private:
iUniform uTexNoise;
fUniform uNoiseSeed;
};
class UDepthTex : public UniformGroup
@@ -323,8 +323,7 @@ private:
class UDitherMode : public UniformGroup
{
public:
UDitherMode(GLuint _program, bool _usesNoise)
: m_usesNoise(_usesNoise)
UDitherMode(GLuint _program)
{
LocateUniform(uAlphaCompareMode);
LocateUniform(uAlphaDitherMode);
@@ -343,18 +342,12 @@ public:
uAlphaDitherMode.set(0, _force);
uColorDitherMode.set(0, _force);
}
bool updateNoiseTex = m_usesNoise;
updateNoiseTex |= (gDP.otherMode.cycleType < G_CYC_COPY) && (gDP.otherMode.colorDither == G_CD_NOISE || gDP.otherMode.alphaDither == G_AD_NOISE || gDP.otherMode.alphaCompare == G_AC_DITHER);
if (updateNoiseTex)
g_noiseTexture.update();
}
private:
iUniform uAlphaCompareMode;
iUniform uAlphaDitherMode;
iUniform uColorDitherMode;
bool m_usesNoise;
};
class UScreenScale : public UniformGroup
@@ -770,9 +763,9 @@ private:
/*---------------CombinerProgramUniformFactoryCommon-------------*/
namespace glsl {
void CombinerProgramUniformFactoryCommon::_addNoiseTex(GLuint _program, UniformGroups &_uniforms) const
void CombinerProgramUniformFactoryCommon::_addNoiseSeed(GLuint _program, UniformGroups &_uniforms) const
{
_uniforms.emplace_back(new UNoiseTex(_program));
_uniforms.emplace_back(new UNoiseSeed(_program));
}
void CombinerProgramUniformFactoryCommon::_addScreenSpaceTriangleInfo(GLuint _program, UniformGroups &_uniforms) const
@@ -845,9 +838,9 @@ void CombinerProgramUniformFactoryCommon::_addBlendCvg(GLuint _program, UniformG
_uniforms.emplace_back(new UBlendCvg(_program));
}
void CombinerProgramUniformFactoryCommon::_addDitherMode(GLuint _program, UniformGroups &_uniforms, bool _usesNoise) const
void CombinerProgramUniformFactoryCommon::_addDitherMode(GLuint _program, UniformGroups &_uniforms) const
{
_uniforms.emplace_back(new UDitherMode(_program, _usesNoise));
_uniforms.emplace_back(new UDitherMode(_program));
}
void CombinerProgramUniformFactoryCommon::_addScreenScale(GLuint _program, UniformGroups &_uniforms) const
@@ -100,7 +100,7 @@ public:
CombinerProgramUniformFactoryCommon(const opengl::GLInfo & _glInfo);
private:
void _addNoiseTex(GLuint _program, UniformGroups &_uniforms) const override;
void _addNoiseSeed(GLuint _program, UniformGroups &_uniforms) const override;
void _addScreenSpaceTriangleInfo(GLuint _program, UniformGroups &_uniforms) const override;
@@ -130,7 +130,7 @@ private:
void _addBlendCvg(GLuint _program, UniformGroups &_uniforms) const override;
void _addDitherMode(GLuint _program, UniformGroups &_uniforms, bool _usesNoise) const override;
void _addDitherMode(GLuint _program, UniformGroups &_uniforms) const override;
void _addScreenScale(GLuint _program, UniformGroups &_uniforms) const override;
@@ -282,10 +282,10 @@ struct FramebufferTextureFormatsGLES2 : public graphics::FramebufferTextureForma
colorFormatBytes = 2;
}
noiseInternalFormat = graphics::internalcolorFormat::LUMINANCE;
noiseFormat = graphics::colorFormat::LUMINANCE;
noiseType = GL_UNSIGNED_BYTE;
noiseFormatBytes = 1;
fontInternalFormat = graphics::internalcolorFormat::LUMINANCE;
fontFormat = graphics::colorFormat::LUMINANCE;
fontType = GL_UNSIGNED_BYTE;
fontFormatBytes = 1;
}
};
@@ -339,10 +339,10 @@ struct FramebufferTextureFormatsGLES3 : public graphics::FramebufferTextureForma
lutType = GL_UNSIGNED_INT;
lutFormatBytes = 4;
noiseInternalFormat = GL_R8;
noiseFormat = GL_RED;
noiseType = GL_UNSIGNED_BYTE;
noiseFormatBytes = 1;
fontInternalFormat = GL_R8;
fontFormat = GL_RED;
fontType = GL_UNSIGNED_BYTE;
fontFormatBytes = 1;
}
};
@@ -379,10 +379,10 @@ struct FramebufferTextureFormatsOpenGL : public graphics::FramebufferTextureForm
lutType = GL_UNSIGNED_INT;
lutFormatBytes = 4;
noiseInternalFormat = GL_R8;
noiseFormat = GL_RED;
noiseType = GL_UNSIGNED_BYTE;
noiseFormatBytes = 1;
fontInternalFormat = GL_R8;
fontFormat = GL_RED;
fontType = GL_UNSIGNED_BYTE;
fontFormatBytes = 1;
}
};
@@ -71,11 +71,10 @@ namespace graphics {
namespace textureIndices {
TextureUnitParam Tex[2] = { 0U, 1U };
TextureUnitParam NoiseTex(2U);
TextureUnitParam DepthTex(3U);
TextureUnitParam ZLUTTex(4U);
TextureUnitParam PaletteTex(5U);
TextureUnitParam MSTex[2] = { 6U, 7U };
TextureUnitParam DepthTex(2U);
TextureUnitParam ZLUTTex(3U);
TextureUnitParam PaletteTex(4U);
TextureUnitParam MSTex[2] = { 5U, 6U };
}
namespace textureImageUnits {
@@ -71,7 +71,6 @@ namespace graphics {
namespace textureIndices {
extern TextureUnitParam Tex[2];
extern TextureUnitParam NoiseTex;
extern TextureUnitParam DepthTex;
extern TextureUnitParam ZLUTTex;
extern TextureUnitParam PaletteTex;
@@ -11,7 +11,6 @@
#include "Performance.h"
#include "TextureFilterHandler.h"
#include "PostProcessor.h"
#include "NoiseTexture.h"
#include "ZlutTexture.h"
#include "PaletteTexture.h"
#include "TextDrawer.h"
@@ -1959,7 +1958,6 @@ void GraphicsDrawer::_initData()
TFH.init();
PostProcessor::get().init();
g_zlutTexture.init();
g_noiseTexture.init();
g_paletteTexture.init();
perf.reset();
FBInfo::fbInfo.reset();
@@ -1983,7 +1981,6 @@ void GraphicsDrawer::_destroyData()
m_texrectDrawer.destroy();
g_paletteTexture.destroy();
g_zlutTexture.destroy();
g_noiseTexture.destroy();
PostProcessor::get().destroy();
if (TFH.optionsChanged())
TFH.shutdown();
+50
View File
@@ -13,6 +13,8 @@
#include <fstream>
#include <ctime>
#ifndef MUPENPLUSAPI // zilmar spec
std::mutex g_logMutex;
std::wofstream fileOutput;
@@ -113,6 +115,54 @@ void LogDebug(const char* _fileName, int _line, u16 _type, const char* _format,
fileOutput.flush();
}
#else // mupen64plus
#include "mupenplus/GLideN64_mupenplus.h"
void LogDebug(const char* _fileName, int _line, u16 _type, const char* _format, ...)
{
static const int logLevel[] = {
M64MSG_INFO,
M64MSG_ERROR,
M64MSG_INFO,
M64MSG_WARNING,
M64MSG_VERBOSE,
M64MSG_VERBOSE
};
if (CoreDebugCallback == nullptr ||
_type > LOG_LEVEL)
{
return;
}
// initialize use of the variable argument array
va_list vaArgs;
va_start(vaArgs, _format);
// reliably acquire the size from a copy of
// the variable argument array
// and a functionally reliable call
// to mock the formatting
va_list vaCopy;
va_copy(vaCopy, vaArgs);
const int iLen = std::vsnprintf(NULL, 0, _format, vaCopy);
va_end(vaCopy);
// return a formatted string without
// risking memory mismanagement
// and without assuming any compiler
// or platform specific behavior
std::vector<char> zc(iLen + 1);
std::vsnprintf(zc.data(), zc.size(), _format, vaArgs);
va_end(vaArgs);
std::stringstream formatString;
formatString << _fileName << ":" << _line << ", \"" << zc.data() << "\"";
CoreDebugCallback(CoreDebugCallbackContext, logLevel[_type], formatString.str().c_str());
}
#endif
#if defined(OS_WINDOWS) && !defined(MINGW)
#include "windows/GLideN64_windows.h"
void debugPrint(const char * format, ...) {
@@ -32,7 +32,7 @@ EXPORT m64p_error CALL PluginStartup(
void (*DebugCallback)(void *, int, const char *)
)
{
return api().PluginStartup(CoreLibHandle);
return api().PluginStartup(CoreLibHandle, Context, DebugCallback);
}
#ifdef M64P_GLIDENUI
@@ -134,7 +134,7 @@ void InverseTransformVectorNormalize(float src[3], float dst[3], float mtx[4][4]
dst[2] = product[2];
}
void InverseTransformVectorNormalize4(float src[4][3], float dst[4][3], float mtx[4][4])
static void InverseTransformVectorNormalize4(float src[4][3], float dst[4][3], float mtx[4][4])
{
// Load mtx
float32x4x4_t _mtx = vld4q_f32(mtx[0]);
@@ -216,7 +216,7 @@ void InverseTransformVectorNormalize4(float src[4][3], float dst[4][3], float mt
dst[3][2] = product.val[3][2];
}
void InverseTransformVectorNormalize7(float src[4][3], float dst[4][3], float mtx[4][4])
static void InverseTransformVectorNormalize7(float src[4][3], float dst[4][3], float mtx[4][4])
{
// Load mtx
float32x4x4_t _mtx = vld4q_f32(mtx[0]);
@@ -140,7 +140,7 @@ void gSPInverseTransformVector_NEON(float vec[3], float mtx[4][4])
vec[2] = _mtx.val[0][2]; // store vec[2]
}
void DotProductMax7FullNeon( float v0[3], float v1[7][3], float lights[7][3], float _vtx[3])
static void DotProductMax7FullNeon( float v0[3], float v1[7][3], float lights[7][3], float _vtx[3])
{
// load v1
float32x4x3_t _v10 = vld3q_f32(v1[0]); // load 4x3 mtx interleaved
@@ -203,7 +203,7 @@ void DotProductMax7FullNeon( float v0[3], float v1[7][3], float lights[7][3], fl
_vtx[2] += d20[0];
}
void DotProductMax4FullNeon( float v0[3], float v1[4][3], float lights[4][3], float vtx[3])
static void DotProductMax4FullNeon( float v0[3], float v1[4][3], float lights[4][3], float vtx[3])
{
float32x4x3_t _v1 = vld3q_f32(v1[0]); // load 4x3 mtx interleaved
float32x4x3_t _lights = vld3q_f32(lights[0]); // load 4x3 mtx interleaved
@@ -1,148 +0,0 @@
#ifdef MINGW
#define _CRT_RAND_S
#endif
#include <thread>
#include <algorithm>
#include <random>
#include <functional>
#include <cstdlib>
#include <Graphics/Context.h>
#include <Graphics/Parameters.h>
#include "FrameBuffer.h"
#include "Config.h"
#include "GBI.h"
#include "VI.h"
#include "Textures.h"
#include "NoiseTexture.h"
#include "DisplayWindow.h"
#include "DisplayLoadProgress.h"
using namespace graphics;
#define NOISE_TEX_WIDTH 640
#define NOISE_TEX_HEIGHT 580
NoiseTexture g_noiseTexture;
NoiseTexture::NoiseTexture()
: m_DList(0)
, m_currTex(0)
, m_prevTex(0)
{
for (u32 i = 0; i < NOISE_TEX_NUM; ++i)
m_pTexture[i] = nullptr;
}
static
u32 Rand(u32 rand_value)
{
static u32 iseed = 1;
iseed *= 0x343fd;
iseed += 0x269ec3;
return ((iseed >> 16) & 0x7fff);
}
static
void FillTextureData(u32 _seed, NoiseTexturesData * _pData, u32 _start, u32 _stop)
{
srand(_seed);
for (u32 i = _start; i < _stop; ++i) {
auto & vec = _pData->at(i);
const size_t sz = vec.size();
u32 rand_value(0U);
for (size_t t = 0; t < sz; ++t) {
rand_value = Rand(rand_value);
vec[t] = rand_value & 0xFF;
}
}
}
void NoiseTexture::_fillTextureData()
{
displayLoadProgress(L"INIT NOISE TEXTURES. PLEASE WAIT...");
for (auto& vec : m_texData)
vec.resize(NOISE_TEX_WIDTH * NOISE_TEX_HEIGHT);
FillTextureData(static_cast<u32>(time(nullptr)), &m_texData, 0, static_cast<u32>(m_texData.size()));
displayLoadProgress(L"");
}
void NoiseTexture::init()
{
if (m_texData[0].empty())
_fillTextureData();
for (u32 i = 0; i < NOISE_TEX_NUM; ++i) {
m_pTexture[i] = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D);
m_pTexture[i]->format = G_IM_FMT_RGBA;
m_pTexture[i]->clampS = 1;
m_pTexture[i]->clampT = 1;
m_pTexture[i]->frameBufferTexture = CachedTexture::fbOneSample;
m_pTexture[i]->maskS = 0;
m_pTexture[i]->maskT = 0;
m_pTexture[i]->mirrorS = 0;
m_pTexture[i]->mirrorT = 0;
m_pTexture[i]->width = NOISE_TEX_WIDTH;
m_pTexture[i]->height = NOISE_TEX_HEIGHT;
m_pTexture[i]->textureBytes = m_pTexture[i]->width * m_pTexture[i]->height;
const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats();
{
Context::InitTextureParams params;
params.handle = m_pTexture[i]->name;
params.textureUnitIndex = textureIndices::NoiseTex;
params.width = m_pTexture[i]->width;
params.height = m_pTexture[i]->height;
params.internalFormat = fbTexFormats.noiseInternalFormat;
params.format = fbTexFormats.noiseFormat;
params.dataType = fbTexFormats.noiseType;
params.data = m_texData[i].data();
gfxContext.init2DTexture(params);
}
{
Context::TexParameters params;
params.handle = m_pTexture[i]->name;
params.target = textureTarget::TEXTURE_2D;
params.textureUnitIndex = textureIndices::NoiseTex;
params.minFilter = textureParameters::FILTER_NEAREST;
params.magFilter = textureParameters::FILTER_NEAREST;
gfxContext.setTextureParameters(params);
}
}
}
void NoiseTexture::destroy()
{
for (u32 i = 0; i < NOISE_TEX_NUM; ++i) {
textureCache().removeFrameBufferTexture(m_pTexture[i]);
m_pTexture[i] = nullptr;
}
}
void NoiseTexture::update()
{
if (m_texData[0].empty() || m_DList == dwnd().getBuffersSwapCount())
return;
u32 rand_value(0U);
while (m_currTex == m_prevTex) {
rand_value = Rand(rand_value);
m_currTex = rand_value % NOISE_TEX_NUM;
}
m_prevTex = m_currTex;
if (m_pTexture[m_currTex] == nullptr)
return;
{
Context::BindTextureParameters params;
params.texture = m_pTexture[m_currTex]->name;
params.textureUnitIndex = textureIndices::NoiseTex;
params.target = textureTarget::TEXTURE_2D;
gfxContext.bindTexture(params);
}
m_DList = dwnd().getBuffersSwapCount();
}
@@ -1,30 +0,0 @@
#pragma once
#include <array>
#include <vector>
#include <memory>
#include "Types.h"
#define NOISE_TEX_NUM 30
struct CachedTexture;
typedef std::array<std::vector<u8>, NOISE_TEX_NUM> NoiseTexturesData;
class NoiseTexture
{
public:
NoiseTexture();
void init();
void destroy();
void update();
private:
void _fillTextureData();
CachedTexture * m_pTexture[NOISE_TEX_NUM];
u32 m_DList;
u32 m_currTex, m_prevTex;
NoiseTexturesData m_texData;
};
extern NoiseTexture g_noiseTexture;
+1 -1
View File
@@ -76,7 +76,7 @@ public:
void ResizeVideoOutput(int _Width, int _Height);
void ReadScreen2(void * _dest, int * _width, int * _height, int _front);
m64p_error PluginStartup(m64p_dynlib_handle _CoreLibHandle);
m64p_error PluginStartup(m64p_dynlib_handle _CoreLibHandle, void * Context, void (*DebugCallback)(void *, int, const char *));
#ifdef M64P_GLIDENUI
m64p_error PluginConfig();
#endif // M64P_GLIDENUI
@@ -111,16 +111,16 @@ struct Atlas {
m_pTexture->mirrorT = 0;
m_pTexture->width = w;
m_pTexture->height = h;
m_pTexture->textureBytes = m_pTexture->width * m_pTexture->height * fbTexFormats.noiseFormatBytes;
m_pTexture->textureBytes = m_pTexture->width * m_pTexture->height * fbTexFormats.fontFormatBytes;
Context::InitTextureParams initParams;
initParams.handle = m_pTexture->name;
initParams.textureUnitIndex = textureIndices::Tex[0];
initParams.width = w;
initParams.height = h;
initParams.internalFormat = fbTexFormats.noiseInternalFormat;
initParams.format = fbTexFormats.noiseFormat;
initParams.dataType = fbTexFormats.noiseType;
initParams.internalFormat = fbTexFormats.fontInternalFormat;
initParams.format = fbTexFormats.fontFormat;
initParams.dataType = fbTexFormats.fontType;
gfxContext.init2DTexture(initParams);
Context::TexParameters setParams;
@@ -1226,10 +1226,8 @@ bool TextureCache::_loadHiresTexture(u32 _tile, CachedTexture *_pTexture, u64 &
GHQTexInfo ghqTexInfo;
// TODO: fix problem with zero texture dimensions on GLideNHQ side.
auto hirestexFound = txfilter_hirestex(_pTexture->crc, _ricecrc, palette, N64FormatSize(_pTexture->format, _pTexture->size), &ghqTexInfo);
if (!hirestexFound) {
if (!hirestexFound && _strongcrc != 0U) {
// Texture with RiceCRC was not found. Try alternative CRC.
if (_strongcrc == 0U)
_strongcrc = txfilter_checksum_strong(addr, width, height, _pTexture->size, bpl, paladdr);
hirestexFound = txfilter_hirestex(_pTexture->crc, _strongcrc, palette, N64FormatSize(_pTexture->format, _pTexture->size), &ghqTexInfo);
}
if (hirestexFound && ghqTexInfo.width != 0 && ghqTexInfo.height != 0) {
@@ -4,6 +4,7 @@
#include "m64p_common.h"
#include "m64p_config.h"
#include "m64p_vidext.h"
#include "m64p_frontend.h"
#define PLUGIN_VERSION 0x020000
#define VIDEO_PLUGIN_API_VERSION 0x020200
@@ -53,6 +54,9 @@ extern ptr_VidExt_GL_GetDefaultFramebuffer CoreVideo_GL_GetDefaultFramebuffer;
extern ptr_PluginGetVersion CoreGetVersion;
extern void* CoreDebugCallbackContext;
extern ptr_DebugCallback CoreDebugCallback;
extern const unsigned int* rdram_size;
extern void(*renderCallback)(int);
@@ -49,12 +49,18 @@ ptr_VidExt_GL_GetDefaultFramebuffer CoreVideo_GL_GetDefaultFramebuffer = nullptr
ptr_PluginGetVersion CoreGetVersion = nullptr;
void* CoreDebugCallbackContext = nullptr;
ptr_DebugCallback CoreDebugCallback = nullptr;
const unsigned int* rdram_size = nullptr;
void(*renderCallback)(int) = nullptr;
void (*renderCallback)(int) = nullptr;
m64p_error PluginAPI::PluginStartup(m64p_dynlib_handle _CoreLibHandle)
m64p_error PluginAPI::PluginStartup(m64p_dynlib_handle _CoreLibHandle, void* Context, void (*DebugCallback)(void *, int, const char *))
{
CoreDebugCallbackContext = Context;
CoreDebugCallback = DebugCallback;
ConfigGetSharedDataFilepath = (ptr_ConfigGetSharedDataFilepath) DLSYM(_CoreLibHandle, "ConfigGetSharedDataFilepath");
ConfigGetUserConfigPath = (ptr_ConfigGetUserConfigPath) DLSYM(_CoreLibHandle, "ConfigGetUserConfigPath");
ConfigGetUserCachePath = (ptr_ConfigGetUserCachePath)DLSYM(_CoreLibHandle, "ConfigGetUserCachePath");
@@ -62,7 +62,8 @@ void F3DJFG_DMA_Vtx(u32 w0, u32 w1)
void F3DDKR_DMA_Tri(u32 w0, u32 w1)
{
gSPDMATriangles( w1, _SHIFTR( w0, 4, 12 ) );
gSP.texture.on = _SHIFTR(w0, 16, 4);
gSPDMATriangles(w1, _SHIFTR(w0, 20, 4) + 1);
gSP.vertexi = 0;
}
+2 -2
View File
@@ -6,7 +6,7 @@
[subrepo]
remote = git@github.com:/Rosalie241/angrylion-rdp-plus.git
branch = RMG
commit = ed18534fe570ee47b24790579cc54e414c69e1f4
parent = e0a5205db5fbbc0d418a71c6f468b05e7c6fada8
commit = c48015782853ac017e862f2e5c8f2c81d1afa327
parent = ec9f4f9806f7c53e78eba7b3306e1951b1acd97d
method = merge
cmdver = 0.4.6
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.9)
option(BUILD_MUPEN64PLUS "Enables build of mupen64plus version" ON)
option(BUILD_PROJECT64 "Enables build of project64 version" WIN32)
@@ -650,6 +650,8 @@ void n64video_update_screen(struct n64video_frame_buffer* fb)
if (ctrl.aa_mode == VI_AA_REPLICATE && (ctrl.type & 2) && h_start < (ctrl.type == VI_TYPE_RGBA5551 ? 0x80 : 0x40) && x_add <= 0x200) {
vinnglitch = ctrl.type == VI_TYPE_RGBA5551 ? 0x40 : 0x20;
} else {
vinnglitch = 0;
}
// cancel if the frame buffer contains no valid address
+26 -21
View File
@@ -124,25 +124,14 @@ bool CoreDecreaseSaveStateSlot(void)
return CoreSetSaveStateSlot(slot - 1);
}
bool CoreGetSaveStatePath(int slot, std::filesystem::path& path)
bool CoreGetSaveStatePath(CoreRomHeader header, CoreRomSettings settings, int slot, std::filesystem::path& path)
{
// TODO: this should probably be an API function
// in mupen64plus-core instead
std::filesystem::path saveStatePath;
std::filesystem::path oldSaveStatePath;
std::string saveStateFileName;
std::filesystem::path saveStateExtension;
CoreRomHeader romHeader;
CoreRomSettings romSettings;
// attempt to retrieve the current
// rom header and settings
if (!CoreGetCurrentRomHeader(romHeader) ||
!CoreGetCurrentRomSettings(romSettings))
{
return false;
}
// retrieve save state directory
saveStatePath = CoreGetSaveStateDirectory();
@@ -154,7 +143,7 @@ bool CoreGetSaveStatePath(int slot, std::filesystem::path& path)
// construct old save state path
oldSaveStatePath = saveStatePath;
oldSaveStatePath += romSettings.GoodName;
oldSaveStatePath += settings.GoodName;
oldSaveStatePath += saveStateExtension;
// use old filename if it exists
@@ -168,32 +157,32 @@ bool CoreGetSaveStatePath(int slot, std::filesystem::path& path)
int format = CoreSettingsGetIntValue(SettingsID::Core_SaveFileNameFormat);
if (format == 0)
{
saveStatePath += romHeader.Name;
saveStatePath += header.Name;
saveStatePath += saveStateExtension;
}
else
{
if (romSettings.GoodName.find("(unknown rom)") == std::string::npos)
if (settings.GoodName.find("(unknown rom)") == std::string::npos)
{
if (romSettings.GoodName.size() < 32)
if (settings.GoodName.size() < 32)
{
saveStatePath += romSettings.GoodName;
saveStatePath += settings.GoodName;
}
else
{
saveStatePath += romSettings.GoodName.substr(0, 32);
saveStatePath += settings.GoodName.substr(0, 32);
}
}
else if (!romHeader.Name.empty())
else if (!header.Name.empty())
{
saveStatePath += romHeader.Name;
saveStatePath += header.Name;
}
else
{
saveStatePath += "unknown";
}
saveStatePath += "-";
saveStatePath += romSettings.MD5.substr(0, 8);
saveStatePath += settings.MD5.substr(0, 8);
saveStatePath += saveStateExtension;
}
@@ -210,6 +199,22 @@ bool CoreGetSaveStatePath(int slot, std::filesystem::path& path)
return true;
}
bool CoreGetSaveStatePath(int slot, std::filesystem::path& path)
{
CoreRomHeader romHeader;
CoreRomSettings romSettings;
// attempt to retrieve the current
// rom header and settings
if (!CoreGetCurrentRomHeader(romHeader) ||
!CoreGetCurrentRomSettings(romSettings))
{
return false;
}
return CoreGetSaveStatePath(romHeader, romSettings, slot, path);
}
bool CoreSaveState(void)
{
std::string error;
+9
View File
@@ -10,6 +10,9 @@
#ifndef CORE_SAVESTATE_HPP
#define CORE_SAVESTATE_HPP
#include "RomHeader.hpp"
#include "RomSettings.hpp"
#include <filesystem>
// sets save state slot
@@ -27,8 +30,14 @@ bool CoreDecreaseSaveStateSlot(void);
// retrieves the file path for
// the save state in the given slot
// for the currently opened ROM
bool CoreGetSaveStatePath(int slot, std::filesystem::path& path);
// retrieves the file path for
// the save state in the given slot
bool CoreGetSaveStatePath(CoreRomHeader header, CoreRomSettings settings, int slot, std::filesystem::path& path);
// saves state
bool CoreSaveState(void);
+5 -2
View File
@@ -117,8 +117,11 @@ static l_Setting get_setting(SettingsID settingId)
case SettingsID::GUI_OnScreenDisplayPaddingY:
setting = {SETTING_SECTION_GUI, "OnScreenDisplayPaddingY", 20};
break;
case SettingsID::GUI_OnScreenDisplayOpacity:
setting = {SETTING_SECTION_GUI, "OnScreenDisplayOpacity", 0.5f};
case SettingsID::GUI_OnScreenDisplayBackgroundColor:
setting = {SETTING_SECTION_GUI, "OnScreenDisplayBackgroundColor", std::string("0;0;0;127")};
break;
case SettingsID::GUI_OnScreenDisplayTextColor:
setting = {SETTING_SECTION_GUI, "OnScreenDisplayTextColor", std::string("255;255;255;255")};
break;
case SettingsID::GUI_OnScreenDisplayDuration:
setting = {SETTING_SECTION_GUI, "OnScreenDisplayDuration", 3};
+2 -1
View File
@@ -18,7 +18,8 @@ enum class SettingsID
GUI_OnScreenDisplayLocation,
GUI_OnScreenDisplayPaddingX,
GUI_OnScreenDisplayPaddingY,
GUI_OnScreenDisplayOpacity,
GUI_OnScreenDisplayBackgroundColor,
GUI_OnScreenDisplayTextColor,
GUI_OnScreenDisplayDuration,
GUI_Toolbar,
GUI_ToolbarArea,
@@ -117,6 +117,7 @@ void MainDialog::openInputDevice(QString deviceName, int deviceNum)
this->currentDeviceName = "";
this->currentDeviceNum = deviceNum;
controllerWidget->SetCurrentJoystickID(this->currentDeviceNum);
controllerWidget->SetCurrentJoystick(nullptr, nullptr);
return;
}
@@ -133,6 +134,7 @@ void MainDialog::openInputDevice(QString deviceName, int deviceNum)
this->currentDeviceName = "";
this->currentDeviceNum = (int)InputDeviceType::Keyboard;
controllerWidget->SetCurrentJoystickID(this->currentDeviceNum);
controllerWidget->SetCurrentJoystick(nullptr, nullptr);
return;
}
}
@@ -152,6 +154,7 @@ void MainDialog::openInputDevice(QString deviceName, int deviceNum)
joystickId = SDL_JoystickGetDeviceInstanceID(deviceNum);
controllerWidget->SetCurrentJoystickID(joystickId);
controllerWidget->SetIsCurrentJoystickGameController(currentController != nullptr);
controllerWidget->SetCurrentJoystick(this->currentJoystick, this->currentController);
}
void MainDialog::closeInputDevice()
@@ -10,11 +10,15 @@
#include "OptionsDialog.hpp"
#include <QFileDialog>
#include <QMessageBox>
#include <RMG-Core/Core.hpp>
#include <SDL.h>
using namespace UserInterface;
OptionsDialog::OptionsDialog(QWidget* parent, OptionsDialogSettings settings) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint)
OptionsDialog::OptionsDialog(QWidget* parent, OptionsDialogSettings settings,
SDL_Joystick* joystick, SDL_GameController* controller) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint)
{
this->setupUi(this);
@@ -31,6 +35,12 @@ OptionsDialog::OptionsDialog(QWidget* parent, OptionsDialogSettings settings) :
{
this->hideEmulationInfoText();
}
this->currentJoystick = joystick;
this->currentController = controller;
this->testRumbleButton->setVisible(settings.ControllerPak == 1);
this->testRumbleButton->setEnabled(this->currentJoystick != nullptr || this->currentController != nullptr);
}
OptionsDialogSettings OptionsDialog::GetSettings()
@@ -79,6 +89,11 @@ void OptionsDialog::accept()
QDialog::accept();
}
void OptionsDialog::on_controllerPakComboBox_currentIndexChanged(int index)
{
this->testRumbleButton->setVisible(index == 1);
}
void OptionsDialog::on_changeGameboyRomButton_clicked()
{
QString gameBoyRom;
@@ -100,3 +115,29 @@ void OptionsDialog::on_changeGameboySaveButton_clicked()
this->gameboySaveLineEdit->setText(QDir::toNativeSeparators(gameBoySave));
}
}
void OptionsDialog::on_testRumbleButton_clicked()
{
#if SDL_VERSION_ATLEAST(2,0,18)
if ((this->currentJoystick != nullptr && SDL_JoystickHasRumble(this->currentJoystick) != SDL_TRUE) ||
(this->currentController != nullptr && SDL_GameControllerHasRumble(this->currentController) != SDL_TRUE))
{
QMessageBox msgBox(this);
msgBox.setIcon(QMessageBox::Icon::Critical);
msgBox.setWindowTitle("Error");
msgBox.setText("Controller doesn't support rumble");
msgBox.addButton(QMessageBox::Ok);
msgBox.exec();
return;
}
#endif
if (this->currentJoystick != nullptr)
{
SDL_JoystickRumble(this->currentJoystick, 0xFFFF, 0xFFFF, 1500);
}
else
{
SDL_GameControllerRumble(this->currentController, 0xFFFF, 0xFFFF, 1500);
}
}
@@ -13,6 +13,8 @@
#include <QDialog>
#include <string>
#include <SDL.h>
#include "ui_OptionsDialog.h"
struct OptionsDialogSettings
@@ -35,7 +37,8 @@ class OptionsDialog : public QDialog, private Ui::OptionsDialog
Q_OBJECT
public:
OptionsDialog(QWidget *parent, OptionsDialogSettings settings);
OptionsDialog(QWidget *parent, OptionsDialogSettings settings,
SDL_Joystick* joystick, SDL_GameController* controller);
OptionsDialogSettings GetSettings();
@@ -45,12 +48,18 @@ protected:
private:
OptionsDialogSettings settings;
SDL_Joystick* currentJoystick = nullptr;
SDL_GameController* currentController = nullptr;
void setIconsForEmulationInfoText(void);
void hideEmulationInfoText(void);
private slots:
void on_controllerPakComboBox_currentIndexChanged(int index);
void on_changeGameboyRomButton_clicked();
void on_changeGameboySaveButton_clicked();
void on_testRumbleButton_clicked();
};
}
@@ -72,7 +72,7 @@
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -82,6 +82,13 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="testRumbleButton">
<property name="text">
<string>Test Rumble</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
@@ -138,7 +145,7 @@
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -219,7 +226,7 @@
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -236,10 +243,10 @@
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
</property>
</widget>
</item>
@@ -853,7 +853,11 @@ void ControllerWidget::on_resetButton_clicked()
void ControllerWidget::on_optionsButton_clicked()
{
OptionsDialog dialog(this, this->optionsDialogSettings);
bool isKeyboard = this->inputDeviceComboBox->currentData().toInt() == (int)InputDeviceType::Keyboard;
OptionsDialog dialog(this, this->optionsDialogSettings,
isKeyboard ? nullptr : this->currentJoystick,
isKeyboard ? nullptr : this->currentController);
int ret = dialog.exec();
// when saved, store settings for later
@@ -1866,6 +1870,12 @@ void ControllerWidget::SetIsCurrentJoystickGameController(bool isGameController)
this->isCurrentJoystickGameController = isGameController;
}
void ControllerWidget::SetCurrentJoystick(SDL_Joystick* joystick, SDL_GameController* controller)
{
this->currentJoystick = joystick;
this->currentController = controller;
}
void ControllerWidget::AddUserProfile(QString name, QString section)
{
int index = this->profileComboBox->findData(section);
@@ -104,6 +104,9 @@ private:
SDL_JoystickID currentJoystickId = -1;
bool isCurrentJoystickGameController = false;
SDL_Joystick* currentJoystick = nullptr;
SDL_GameController* currentController = nullptr;
int previousProfileComboBoxIndex = -1;
bool onlyLoadGameProfile = false;
@@ -143,6 +146,7 @@ public:
void SetCurrentJoystickID(SDL_JoystickID joystickId);
void SetIsCurrentJoystickGameController(bool isGameController);
void SetCurrentJoystick(SDL_Joystick* joystick, SDL_GameController* controller);
void AddUserProfile(QString name, QString section);
void RemoveUserProfile(QString name, QString section);
+61 -56
View File
@@ -305,65 +305,70 @@ static void load_settings(void)
profile->SensitivityValue = 100;
}
#define LOAD_INPUT_MAPPING(mapping, setting) \
load_inputmapping_settings(&profile->mapping, section, SettingsID::setting##_Name, SettingsID::setting##_InputType, SettingsID::setting##_Data, SettingsID::setting##_ExtraData)
// load inputmapping settings
load_inputmapping_settings(&profile->Button_A, section, SettingsID::Input_A_Name, SettingsID::Input_A_InputType, SettingsID::Input_A_Data, SettingsID::Input_A_ExtraData);
load_inputmapping_settings(&profile->Button_B, section, SettingsID::Input_B_Name, SettingsID::Input_B_InputType, SettingsID::Input_B_Data, SettingsID::Input_B_ExtraData);
load_inputmapping_settings(&profile->Button_Start, section, SettingsID::Input_Start_Name, SettingsID::Input_Start_InputType, SettingsID::Input_Start_Data, SettingsID::Input_Start_ExtraData);
load_inputmapping_settings(&profile->Button_DpadUp, section, SettingsID::Input_DpadUp_Name, SettingsID::Input_DpadUp_InputType, SettingsID::Input_DpadUp_Data, SettingsID::Input_DpadUp_ExtraData);
load_inputmapping_settings(&profile->Button_DpadDown, section, SettingsID::Input_DpadDown_Name, SettingsID::Input_DpadDown_InputType, SettingsID::Input_DpadDown_Data, SettingsID::Input_DpadDown_ExtraData);
load_inputmapping_settings(&profile->Button_DpadLeft, section, SettingsID::Input_DpadLeft_Name, SettingsID::Input_DpadLeft_InputType, SettingsID::Input_DpadLeft_Data, SettingsID::Input_DpadLeft_ExtraData);
load_inputmapping_settings(&profile->Button_DpadRight, section, SettingsID::Input_DpadRight_Name, SettingsID::Input_DpadRight_InputType, SettingsID::Input_DpadRight_Data, SettingsID::Input_DpadRight_ExtraData);
load_inputmapping_settings(&profile->Button_CButtonUp, section, SettingsID::Input_CButtonUp_Name, SettingsID::Input_CButtonUp_InputType, SettingsID::Input_CButtonUp_Data, SettingsID::Input_CButtonUp_ExtraData);
load_inputmapping_settings(&profile->Button_CButtonDown, section, SettingsID::Input_CButtonDown_Name, SettingsID::Input_CButtonDown_InputType, SettingsID::Input_CButtonDown_Data, SettingsID::Input_CButtonDown_ExtraData);
load_inputmapping_settings(&profile->Button_CButtonLeft, section, SettingsID::Input_CButtonLeft_Name, SettingsID::Input_CButtonLeft_InputType, SettingsID::Input_CButtonLeft_Data, SettingsID::Input_CButtonLeft_ExtraData);
load_inputmapping_settings(&profile->Button_CButtonRight, section, SettingsID::Input_CButtonRight_Name, SettingsID::Input_CButtonRight_InputType, SettingsID::Input_CButtonRight_Data, SettingsID::Input_CButtonRight_ExtraData);
load_inputmapping_settings(&profile->Button_LeftTrigger, section, SettingsID::Input_LeftTrigger_Name, SettingsID::Input_LeftTrigger_InputType, SettingsID::Input_LeftTrigger_Data, SettingsID::Input_LeftTrigger_ExtraData);
load_inputmapping_settings(&profile->Button_RightTrigger, section, SettingsID::Input_RightTrigger_Name, SettingsID::Input_RightTrigger_InputType, SettingsID::Input_RightTrigger_Data, SettingsID::Input_RightTrigger_ExtraData);
load_inputmapping_settings(&profile->Button_ZTrigger, section, SettingsID::Input_ZTrigger_Name, SettingsID::Input_ZTrigger_InputType, SettingsID::Input_ZTrigger_Data, SettingsID::Input_ZTrigger_ExtraData);
load_inputmapping_settings(&profile->AnalogStick_Up, section, SettingsID::Input_AnalogStickUp_Name, SettingsID::Input_AnalogStickUp_InputType, SettingsID::Input_AnalogStickUp_Data, SettingsID::Input_AnalogStickUp_ExtraData);
load_inputmapping_settings(&profile->AnalogStick_Down, section, SettingsID::Input_AnalogStickDown_Name, SettingsID::Input_AnalogStickDown_InputType, SettingsID::Input_AnalogStickDown_Data, SettingsID::Input_AnalogStickDown_ExtraData);
load_inputmapping_settings(&profile->AnalogStick_Left, section, SettingsID::Input_AnalogStickLeft_Name, SettingsID::Input_AnalogStickLeft_InputType, SettingsID::Input_AnalogStickLeft_Data, SettingsID::Input_AnalogStickLeft_ExtraData);
load_inputmapping_settings(&profile->AnalogStick_Right, section, SettingsID::Input_AnalogStickRight_Name, SettingsID::Input_AnalogStickRight_InputType, SettingsID::Input_AnalogStickRight_Data, SettingsID::Input_AnalogStickRight_ExtraData);
LOAD_INPUT_MAPPING(Button_A, Input_A);
LOAD_INPUT_MAPPING(Button_B, Input_B);
LOAD_INPUT_MAPPING(Button_Start, Input_Start);
LOAD_INPUT_MAPPING(Button_DpadUp, Input_DpadUp);
LOAD_INPUT_MAPPING(Button_DpadDown, Input_DpadDown);
LOAD_INPUT_MAPPING(Button_DpadLeft, Input_DpadLeft);
LOAD_INPUT_MAPPING(Button_DpadRight, Input_DpadRight);
LOAD_INPUT_MAPPING(Button_CButtonUp, Input_CButtonUp);
LOAD_INPUT_MAPPING(Button_CButtonDown, Input_CButtonDown);
LOAD_INPUT_MAPPING(Button_CButtonLeft, Input_CButtonLeft);
LOAD_INPUT_MAPPING(Button_CButtonRight, Input_CButtonRight);
LOAD_INPUT_MAPPING(Button_LeftTrigger, Input_LeftTrigger);
LOAD_INPUT_MAPPING(Button_RightTrigger, Input_RightTrigger);
LOAD_INPUT_MAPPING(Button_ZTrigger, Input_ZTrigger);
LOAD_INPUT_MAPPING(AnalogStick_Up, Input_AnalogStickUp);
LOAD_INPUT_MAPPING(AnalogStick_Down, Input_AnalogStickDown);
LOAD_INPUT_MAPPING(AnalogStick_Left, Input_AnalogStickLeft);
LOAD_INPUT_MAPPING(AnalogStick_Right, Input_AnalogStickRight);
// load hotkeys settings
load_inputmapping_settings(&profile->Hotkey_Shutdown, section, SettingsID::Input_Hotkey_Shutdown_Name, SettingsID::Input_Hotkey_Shutdown_InputType, SettingsID::Input_Hotkey_Shutdown_Data, SettingsID::Input_Hotkey_Shutdown_ExtraData);
load_inputmapping_settings(&profile->Hotkey_Exit, section, SettingsID::Input_Hotkey_Exit_Name, SettingsID::Input_Hotkey_Exit_InputType, SettingsID::Input_Hotkey_Exit_Data, SettingsID::Input_Hotkey_Exit_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SoftReset, section, SettingsID::Input_Hotkey_SoftReset_Name, SettingsID::Input_Hotkey_SoftReset_InputType, SettingsID::Input_Hotkey_SoftReset_Data, SettingsID::Input_Hotkey_SoftReset_ExtraData);
load_inputmapping_settings(&profile->Hotkey_HardReset, section, SettingsID::Input_Hotkey_HardReset_Name, SettingsID::Input_Hotkey_HardReset_InputType, SettingsID::Input_Hotkey_HardReset_Data, SettingsID::Input_Hotkey_HardReset_ExtraData);
load_inputmapping_settings(&profile->Hotkey_Resume, section, SettingsID::Input_Hotkey_Resume_Name, SettingsID::Input_Hotkey_Resume_InputType, SettingsID::Input_Hotkey_Resume_Data, SettingsID::Input_Hotkey_Resume_ExtraData);
load_inputmapping_settings(&profile->Hotkey_Screenshot, section, SettingsID::Input_Hotkey_Screenshot_Name, SettingsID::Input_Hotkey_Screenshot_InputType, SettingsID::Input_Hotkey_Screenshot_Data, SettingsID::Input_Hotkey_Screenshot_ExtraData);
load_inputmapping_settings(&profile->Hotkey_LimitFPS, section, SettingsID::Input_Hotkey_LimitFPS_Name, SettingsID::Input_Hotkey_LimitFPS_InputType, SettingsID::Input_Hotkey_LimitFPS_Data, SettingsID::Input_Hotkey_LimitFPS_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SpeedFactor25, section, SettingsID::Input_Hotkey_SpeedFactor25_Name, SettingsID::Input_Hotkey_SpeedFactor25_InputType, SettingsID::Input_Hotkey_SpeedFactor25_Data, SettingsID::Input_Hotkey_SpeedFactor25_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SpeedFactor50, section, SettingsID::Input_Hotkey_SpeedFactor50_Name, SettingsID::Input_Hotkey_SpeedFactor50_InputType, SettingsID::Input_Hotkey_SpeedFactor50_Data, SettingsID::Input_Hotkey_SpeedFactor50_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SpeedFactor75, section, SettingsID::Input_Hotkey_SpeedFactor75_Name, SettingsID::Input_Hotkey_SpeedFactor75_InputType, SettingsID::Input_Hotkey_SpeedFactor75_Data, SettingsID::Input_Hotkey_SpeedFactor75_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SpeedFactor100, section, SettingsID::Input_Hotkey_SpeedFactor100_Name, SettingsID::Input_Hotkey_SpeedFactor100_InputType, SettingsID::Input_Hotkey_SpeedFactor100_Data, SettingsID::Input_Hotkey_SpeedFactor100_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SpeedFactor125, section, SettingsID::Input_Hotkey_SpeedFactor125_Name, SettingsID::Input_Hotkey_SpeedFactor125_InputType, SettingsID::Input_Hotkey_SpeedFactor125_Data, SettingsID::Input_Hotkey_SpeedFactor125_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SpeedFactor150, section, SettingsID::Input_Hotkey_SpeedFactor150_Name, SettingsID::Input_Hotkey_SpeedFactor150_InputType, SettingsID::Input_Hotkey_SpeedFactor150_Data, SettingsID::Input_Hotkey_SpeedFactor150_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SpeedFactor175, section, SettingsID::Input_Hotkey_SpeedFactor175_Name, SettingsID::Input_Hotkey_SpeedFactor175_InputType, SettingsID::Input_Hotkey_SpeedFactor175_Data, SettingsID::Input_Hotkey_SpeedFactor175_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SpeedFactor200, section, SettingsID::Input_Hotkey_SpeedFactor200_Name, SettingsID::Input_Hotkey_SpeedFactor200_InputType, SettingsID::Input_Hotkey_SpeedFactor200_Data, SettingsID::Input_Hotkey_SpeedFactor200_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SpeedFactor225, section, SettingsID::Input_Hotkey_SpeedFactor225_Name, SettingsID::Input_Hotkey_SpeedFactor225_InputType, SettingsID::Input_Hotkey_SpeedFactor225_Data, SettingsID::Input_Hotkey_SpeedFactor225_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SpeedFactor250, section, SettingsID::Input_Hotkey_SpeedFactor250_Name, SettingsID::Input_Hotkey_SpeedFactor250_InputType, SettingsID::Input_Hotkey_SpeedFactor250_Data, SettingsID::Input_Hotkey_SpeedFactor250_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SpeedFactor275, section, SettingsID::Input_Hotkey_SpeedFactor275_Name, SettingsID::Input_Hotkey_SpeedFactor275_InputType, SettingsID::Input_Hotkey_SpeedFactor275_Data, SettingsID::Input_Hotkey_SpeedFactor275_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SpeedFactor300, section, SettingsID::Input_Hotkey_SpeedFactor300_Name, SettingsID::Input_Hotkey_SpeedFactor300_InputType, SettingsID::Input_Hotkey_SpeedFactor300_Data, SettingsID::Input_Hotkey_SpeedFactor300_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SaveState, section, SettingsID::Input_Hotkey_SaveState_Name, SettingsID::Input_Hotkey_SaveState_InputType, SettingsID::Input_Hotkey_SaveState_Data, SettingsID::Input_Hotkey_SaveState_ExtraData);
load_inputmapping_settings(&profile->Hotkey_LoadState, section, SettingsID::Input_Hotkey_LoadState_Name, SettingsID::Input_Hotkey_LoadState_InputType, SettingsID::Input_Hotkey_LoadState_Data, SettingsID::Input_Hotkey_LoadState_ExtraData);
load_inputmapping_settings(&profile->Hotkey_GSButton, section, SettingsID::Input_Hotkey_GSButton_Name, SettingsID::Input_Hotkey_GSButton_InputType, SettingsID::Input_Hotkey_GSButton_Data, SettingsID::Input_Hotkey_GSButton_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SaveStateSlot0, section, SettingsID::Input_Hotkey_SaveStateSlot0_Name, SettingsID::Input_Hotkey_SaveStateSlot0_InputType, SettingsID::Input_Hotkey_SaveStateSlot0_Data, SettingsID::Input_Hotkey_SaveStateSlot0_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SaveStateSlot1, section, SettingsID::Input_Hotkey_SaveStateSlot1_Name, SettingsID::Input_Hotkey_SaveStateSlot1_InputType, SettingsID::Input_Hotkey_SaveStateSlot1_Data, SettingsID::Input_Hotkey_SaveStateSlot1_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SaveStateSlot2, section, SettingsID::Input_Hotkey_SaveStateSlot2_Name, SettingsID::Input_Hotkey_SaveStateSlot2_InputType, SettingsID::Input_Hotkey_SaveStateSlot2_Data, SettingsID::Input_Hotkey_SaveStateSlot2_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SaveStateSlot3, section, SettingsID::Input_Hotkey_SaveStateSlot3_Name, SettingsID::Input_Hotkey_SaveStateSlot3_InputType, SettingsID::Input_Hotkey_SaveStateSlot3_Data, SettingsID::Input_Hotkey_SaveStateSlot3_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SaveStateSlot4, section, SettingsID::Input_Hotkey_SaveStateSlot4_Name, SettingsID::Input_Hotkey_SaveStateSlot4_InputType, SettingsID::Input_Hotkey_SaveStateSlot4_Data, SettingsID::Input_Hotkey_SaveStateSlot4_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SaveStateSlot5, section, SettingsID::Input_Hotkey_SaveStateSlot5_Name, SettingsID::Input_Hotkey_SaveStateSlot5_InputType, SettingsID::Input_Hotkey_SaveStateSlot5_Data, SettingsID::Input_Hotkey_SaveStateSlot5_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SaveStateSlot6, section, SettingsID::Input_Hotkey_SaveStateSlot6_Name, SettingsID::Input_Hotkey_SaveStateSlot6_InputType, SettingsID::Input_Hotkey_SaveStateSlot6_Data, SettingsID::Input_Hotkey_SaveStateSlot6_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SaveStateSlot7, section, SettingsID::Input_Hotkey_SaveStateSlot7_Name, SettingsID::Input_Hotkey_SaveStateSlot7_InputType, SettingsID::Input_Hotkey_SaveStateSlot7_Data, SettingsID::Input_Hotkey_SaveStateSlot7_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SaveStateSlot8, section, SettingsID::Input_Hotkey_SaveStateSlot8_Name, SettingsID::Input_Hotkey_SaveStateSlot8_InputType, SettingsID::Input_Hotkey_SaveStateSlot8_Data, SettingsID::Input_Hotkey_SaveStateSlot8_ExtraData);
load_inputmapping_settings(&profile->Hotkey_SaveStateSlot9, section, SettingsID::Input_Hotkey_SaveStateSlot9_Name, SettingsID::Input_Hotkey_SaveStateSlot9_InputType, SettingsID::Input_Hotkey_SaveStateSlot9_Data, SettingsID::Input_Hotkey_SaveStateSlot9_ExtraData);
load_inputmapping_settings(&profile->Hotkey_IncreaseSaveStateSlot, section, SettingsID::Input_Hotkey_IncreaseSaveStateSlot_Name, SettingsID::Input_Hotkey_IncreaseSaveStateSlot_InputType, SettingsID::Input_Hotkey_IncreaseSaveStateSlot_Data, SettingsID::Input_Hotkey_IncreaseSaveStateSlot_ExtraData);
load_inputmapping_settings(&profile->Hotkey_DecreaseSaveStateSlot, section, SettingsID::Input_Hotkey_DecreaseSaveStateSlot_Name, SettingsID::Input_Hotkey_DecreaseSaveStateSlot_InputType, SettingsID::Input_Hotkey_DecreaseSaveStateSlot_Data, SettingsID::Input_Hotkey_DecreaseSaveStateSlot_ExtraData);
load_inputmapping_settings(&profile->Hotkey_MemoryPak, section, SettingsID::Input_Hotkey_MemoryPak_Name, SettingsID::Input_Hotkey_MemoryPak_InputType, SettingsID::Input_Hotkey_MemoryPak_Data, SettingsID::Input_Hotkey_MemoryPak_ExtraData);
load_inputmapping_settings(&profile->Hotkey_RumblePak, section, SettingsID::Input_Hotkey_RumblePak_Name, SettingsID::Input_Hotkey_RumblePak_InputType, SettingsID::Input_Hotkey_RumblePak_Data, SettingsID::Input_Hotkey_RumblePak_ExtraData);
load_inputmapping_settings(&profile->Hotkey_NoPak, section, SettingsID::Input_Hotkey_NoPak_Name, SettingsID::Input_Hotkey_NoPak_InputType, SettingsID::Input_Hotkey_NoPak_Data, SettingsID::Input_Hotkey_NoPak_ExtraData);
load_inputmapping_settings(&profile->Hotkey_Fullscreen, section, SettingsID::Input_Hotkey_Fullscreen_Name, SettingsID::Input_Hotkey_Fullscreen_InputType, SettingsID::Input_Hotkey_Fullscreen_Data, SettingsID::Input_Hotkey_Fullscreen_ExtraData);
LOAD_INPUT_MAPPING(Hotkey_Shutdown, Input_Hotkey_Shutdown);
LOAD_INPUT_MAPPING(Hotkey_Exit, Input_Hotkey_Exit);
LOAD_INPUT_MAPPING(Hotkey_SoftReset, Input_Hotkey_SoftReset);
LOAD_INPUT_MAPPING(Hotkey_HardReset, Input_Hotkey_HardReset);
LOAD_INPUT_MAPPING(Hotkey_Resume, Input_Hotkey_Resume);
LOAD_INPUT_MAPPING(Hotkey_Screenshot, Input_Hotkey_Screenshot);
LOAD_INPUT_MAPPING(Hotkey_LimitFPS, Input_Hotkey_LimitFPS);
LOAD_INPUT_MAPPING(Hotkey_SpeedFactor25, Input_Hotkey_SpeedFactor25);
LOAD_INPUT_MAPPING(Hotkey_SpeedFactor50, Input_Hotkey_SpeedFactor50);
LOAD_INPUT_MAPPING(Hotkey_SpeedFactor75, Input_Hotkey_SpeedFactor75);
LOAD_INPUT_MAPPING(Hotkey_SpeedFactor100, Input_Hotkey_SpeedFactor100);
LOAD_INPUT_MAPPING(Hotkey_SpeedFactor125, Input_Hotkey_SpeedFactor125);
LOAD_INPUT_MAPPING(Hotkey_SpeedFactor150, Input_Hotkey_SpeedFactor150);
LOAD_INPUT_MAPPING(Hotkey_SpeedFactor175, Input_Hotkey_SpeedFactor175);
LOAD_INPUT_MAPPING(Hotkey_SpeedFactor200, Input_Hotkey_SpeedFactor200);
LOAD_INPUT_MAPPING(Hotkey_SpeedFactor225, Input_Hotkey_SpeedFactor225);
LOAD_INPUT_MAPPING(Hotkey_SpeedFactor250, Input_Hotkey_SpeedFactor250);
LOAD_INPUT_MAPPING(Hotkey_SpeedFactor275, Input_Hotkey_SpeedFactor275);
LOAD_INPUT_MAPPING(Hotkey_SpeedFactor300, Input_Hotkey_SpeedFactor300);
LOAD_INPUT_MAPPING(Hotkey_SaveState, Input_Hotkey_SaveState);
LOAD_INPUT_MAPPING(Hotkey_LoadState, Input_Hotkey_LoadState);
LOAD_INPUT_MAPPING(Hotkey_GSButton, Input_Hotkey_GSButton);
LOAD_INPUT_MAPPING(Hotkey_SaveStateSlot0, Input_Hotkey_SaveStateSlot0);
LOAD_INPUT_MAPPING(Hotkey_SaveStateSlot1, Input_Hotkey_SaveStateSlot1);
LOAD_INPUT_MAPPING(Hotkey_SaveStateSlot2, Input_Hotkey_SaveStateSlot2);
LOAD_INPUT_MAPPING(Hotkey_SaveStateSlot3, Input_Hotkey_SaveStateSlot3);
LOAD_INPUT_MAPPING(Hotkey_SaveStateSlot4, Input_Hotkey_SaveStateSlot4);
LOAD_INPUT_MAPPING(Hotkey_SaveStateSlot5, Input_Hotkey_SaveStateSlot5);
LOAD_INPUT_MAPPING(Hotkey_SaveStateSlot6, Input_Hotkey_SaveStateSlot6);
LOAD_INPUT_MAPPING(Hotkey_SaveStateSlot7, Input_Hotkey_SaveStateSlot7);
LOAD_INPUT_MAPPING(Hotkey_SaveStateSlot8, Input_Hotkey_SaveStateSlot8);
LOAD_INPUT_MAPPING(Hotkey_SaveStateSlot9, Input_Hotkey_SaveStateSlot9);
LOAD_INPUT_MAPPING(Hotkey_IncreaseSaveStateSlot, Input_Hotkey_IncreaseSaveStateSlot);
LOAD_INPUT_MAPPING(Hotkey_DecreaseSaveStateSlot, Input_Hotkey_DecreaseSaveStateSlot);
LOAD_INPUT_MAPPING(Hotkey_MemoryPak, Input_Hotkey_MemoryPak);
LOAD_INPUT_MAPPING(Hotkey_RumblePak, Input_Hotkey_RumblePak);
LOAD_INPUT_MAPPING(Hotkey_NoPak, Input_Hotkey_NoPak);
LOAD_INPUT_MAPPING(Hotkey_Fullscreen, Input_Hotkey_Fullscreen);
#undef LOAD_INPUT_MAPPING
}
}
+35 -2
View File
@@ -9,6 +9,9 @@
*/
#include "Callbacks.hpp"
#include <QTimerEvent>
#include <QMutex>
#include <RMG-Core/Core.hpp>
//
@@ -18,6 +21,9 @@
static CoreCallbacks* l_CoreCallbacks = nullptr;
static bool l_showVerboseMessages = false;
static QMutex l_CallbackMessagesMutex;
static QList<CoreCallbackMessage> l_CallbackMessages;
//
// Exported Functions
//
@@ -37,16 +43,27 @@ bool CoreCallbacks::Init(void)
// needed for Qt
qRegisterMetaType<CoreDebugMessageType>("CoreDebugMessageType");
qRegisterMetaType<CoreDebugMessageType>("CoreStateCallbackType");
qRegisterMetaType<CoreCallbackMessage>("CoreCallbackMessage");
this->LoadSettings();
l_CoreCallbacks = this;
return CoreSetupCallbacks(this->coreDebugCallback, this->coreStateCallback);
if (!CoreSetupCallbacks(this->coreDebugCallback, this->coreStateCallback))
{
return false;
}
this->callbackTimerId = this->startTimer(100);
return true;
}
void CoreCallbacks::Stop(void)
{
l_CoreCallbacks = nullptr;
this->killTimer(this->callbackTimerId);
this->callbackTimerId = -1;
}
void CoreCallbacks::LoadSettings(void)
@@ -54,6 +71,20 @@ void CoreCallbacks::LoadSettings(void)
l_showVerboseMessages = CoreSettingsGetBoolValue(SettingsID::GUI_ShowVerboseLogMessages);
}
void CoreCallbacks::timerEvent(QTimerEvent *event)
{
if (event->timerId() == this->callbackTimerId)
{
l_CallbackMessagesMutex.lock();
if (!l_CallbackMessages.isEmpty())
{
emit this->OnCoreDebugCallback(l_CallbackMessages);
l_CallbackMessages.clear();
}
l_CallbackMessagesMutex.unlock();
}
}
void CoreCallbacks::coreDebugCallback(CoreDebugMessageType type, std::string context, std::string message)
{
if (l_CoreCallbacks == nullptr)
@@ -67,7 +98,9 @@ void CoreCallbacks::coreDebugCallback(CoreDebugMessageType type, std::string con
return;
}
emit l_CoreCallbacks->OnCoreDebugCallback(type, QString::fromStdString(context), QString::fromStdString(message));
l_CallbackMessagesMutex.lock();
l_CallbackMessages.append({type, QString::fromStdString(context), QString::fromStdString(message)});
l_CallbackMessagesMutex.unlock();
}
void CoreCallbacks::coreStateCallback(CoreStateCallbackType type, int value)
+15 -1
View File
@@ -10,12 +10,20 @@
#ifndef RMG_CALLBACKS_HPP
#define RMG_CALLBACKS_HPP
#include <QList>
#include <QObject>
#include <RMG-Core/Core.hpp>
#include <string>
struct CoreCallbackMessage
{
CoreDebugMessageType Type;
QString Context;
QString Message;
};
class CoreCallbacks : public QObject
{
Q_OBJECT
@@ -29,12 +37,18 @@ public:
void LoadSettings(void);
protected:
void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
private:
static void coreDebugCallback(CoreDebugMessageType type, std::string context, std::string message);
static void coreStateCallback(CoreStateCallbackType type, int value);
int callbackTimerId = -1;
signals:
void OnCoreDebugCallback(CoreDebugMessageType type, QString context, QString message);
void OnCoreDebugCallback(QList<CoreCallbackMessage> callbackMessages);
void OnCoreStateCallback(CoreStateCallbackType type, int value);
};
+37 -10
View File
@@ -24,12 +24,20 @@ static bool l_Enabled = false;
static bool l_RenderingPaused = false;
static std::chrono::time_point<std::chrono::high_resolution_clock> l_MessageTime;
static std::string l_Message;
static int l_MessagePosition = 1;
static float l_MessagePaddingX = 20.0f;
static float l_MessagePaddingY = 20.0f;
static float l_MessageOpacity = 1.0f;
static int l_MessageDuration = 3;
static std::string l_Message;
static int l_MessagePosition = 1;
static float l_MessagePaddingX = 20.0f;
static float l_MessagePaddingY = 20.0f;
static float l_MessageOpacity = 1.0f;
static float l_BackgroundRed = 1.0f;
static float l_BackgroundGreen = 1.0f;
static float l_BackgroundBlue = 1.0f;
static float l_BackgroundAlpha = 1.0f;
static float l_TextRed = 1.0f;
static float l_TextGreen = 1.0f;
static float l_TextBlue = 1.0f;
static float l_TextAlpha = 1.0f;
static int l_MessageDuration = 3;
//
// Exported Functions
@@ -76,8 +84,24 @@ void OnScreenDisplayLoadSettings(void)
l_MessagePosition = CoreSettingsGetIntValue(SettingsID::GUI_OnScreenDisplayLocation);
l_MessagePaddingX = CoreSettingsGetIntValue(SettingsID::GUI_OnScreenDisplayPaddingX);
l_MessagePaddingY = CoreSettingsGetIntValue(SettingsID::GUI_OnScreenDisplayPaddingY);
l_MessageOpacity = CoreSettingsGetFloatValue(SettingsID::GUI_OnScreenDisplayOpacity);
l_MessageDuration = CoreSettingsGetIntValue(SettingsID::GUI_OnScreenDisplayDuration);
std::vector<int> backgroundColor = CoreSettingsGetIntListValue(SettingsID::GUI_OnScreenDisplayBackgroundColor);
std::vector<int> textColor = CoreSettingsGetIntListValue(SettingsID::GUI_OnScreenDisplayTextColor);
if (backgroundColor.size() == 4)
{
l_BackgroundRed = backgroundColor.at(0) / 255.0f;
l_BackgroundGreen = backgroundColor.at(1) / 255.0f;
l_BackgroundBlue = backgroundColor.at(2) / 255.0f;
l_BackgroundAlpha = backgroundColor.at(3) / 255.0f;
}
if (textColor.size() == 4)
{
l_TextRed = textColor.at(0) / 255.0f;
l_TextGreen = textColor.at(1) / 255.0f;
l_TextBlue = textColor.at(2) / 255.0f;
l_TextAlpha = textColor.at(3) / 255.0f;
}
}
bool OnScreenDisplaySetDisplaySize(int width, int height)
@@ -123,8 +147,6 @@ void OnScreenDisplayRender(void)
ImGuiIO& io = ImGui::GetIO();
ImGui::SetNextWindowBgAlpha(l_MessageOpacity);
// right bottom = ImGui::SetNextWindowPos(ImVec2(io.DisplaySize.x - 20.0f, io.DisplaySize.y - 20.0f), ImGuiCond_Always, ImVec2(1.0f, 1.0f));
// right top = ImGui::SetNextWindowPos(ImVec2(io.DisplaySize.x - 20.0f, 20.0f), ImGuiCond_Always, ImVec2(1.0f, 0));
// left bottom = ImGui::SetNextWindowPos(ImVec2(20.0f, io.DisplaySize.y - 20.0f), ImGuiCond_Always, ImVec2(0.0f, 1.0f));
@@ -146,12 +168,17 @@ void OnScreenDisplayRender(void)
break;
}
ImGui::Begin("Message", nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoFocusOnAppearing);
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(l_BackgroundRed, l_BackgroundGreen, l_BackgroundBlue, l_BackgroundAlpha));
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(l_TextRed, l_TextGreen, l_TextBlue, l_TextAlpha));
ImGui::Begin("Message", nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoFocusOnAppearing);
ImGui::Text("%s", l_Message.c_str());
ImGui::End();
ImGui::Render();
ImGui::PopStyleColor(2);
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
}
+26 -23
View File
@@ -34,34 +34,37 @@ int LogDialog::GetLineCount(void)
return this->plainTextEdit->document()->lineCount();
}
void LogDialog::AddLogLine(CoreDebugMessageType type, QString context, QString line)
void LogDialog::AddMessages(const QList<CoreCallbackMessage>& messages)
{
QString text;
text = context;
switch (type)
for (const auto& message : messages)
{
case CoreDebugMessageType::Error:
text += "[ERROR] ";
break;
case CoreDebugMessageType::Info:
text += "[INFO] ";
break;
case CoreDebugMessageType::Verbose:
text += "[VERBOSE] ";
break;
case CoreDebugMessageType::Warning:
text += "[WARNING] ";
break;
case CoreDebugMessageType::Status:
text += "[STATUS] ";
break;
text = message.Context;
switch (message.Type)
{
case CoreDebugMessageType::Error:
text += "[ERROR] ";
break;
case CoreDebugMessageType::Info:
text += "[INFO] ";
break;
case CoreDebugMessageType::Verbose:
text += "[VERBOSE] ";
break;
case CoreDebugMessageType::Warning:
text += "[WARNING] ";
break;
case CoreDebugMessageType::Status:
text += "[STATUS] ";
break;
}
text += message.Message;
this->plainTextEdit->appendPlainText(text);
}
text += line;
this->plainTextEdit->appendPlainText(text);
}
void LogDialog::Clear(void)
@@ -10,6 +10,9 @@
#ifndef LOGDIALOG_HPP
#define LOGDIALOG_HPP
#include "Callbacks.hpp"
#include <QList>
#include <QWidget>
#include <QDialog>
@@ -33,7 +36,7 @@ class LogDialog : public QDialog, private Ui::LogDialog
int GetLineCount(void);
void AddLogLine(CoreDebugMessageType type, QString context, QString line);
void AddMessages(const QList<CoreCallbackMessage>& messages);
void Clear(void);
};
} // namespace Dialog
@@ -14,6 +14,7 @@
#include "UserInterface/Widget/KeybindButton.hpp"
#include <QFileDialog>
#include <QColorDialog>
#include <QMessageBox>
#include <QDirIterator>
#include <QLabel>
@@ -401,8 +402,20 @@ void SettingsDialog::loadInterfaceOSDSettings(void)
this->osdLocationComboBox->setCurrentIndex(CoreSettingsGetIntValue(SettingsID::GUI_OnScreenDisplayLocation));
this->osdVerticalPaddingSpinBox->setValue(CoreSettingsGetIntValue(SettingsID::GUI_OnScreenDisplayPaddingY));
this->osdHorizontalPaddingSpinBox->setValue(CoreSettingsGetIntValue(SettingsID::GUI_OnScreenDisplayPaddingX));
this->osdOpacitySpinBox->setValue(CoreSettingsGetFloatValue(SettingsID::GUI_OnScreenDisplayOpacity));
this->osdDurationSpinBox->setValue(CoreSettingsGetIntValue(SettingsID::GUI_OnScreenDisplayDuration));
std::vector<int> backgroundColor = CoreSettingsGetIntListValue(SettingsID::GUI_OnScreenDisplayBackgroundColor);
std::vector<int> textColor = CoreSettingsGetIntListValue(SettingsID::GUI_OnScreenDisplayTextColor);
if (backgroundColor.size() == 4)
{
this->currentBackgroundColor = QColor(backgroundColor.at(0), backgroundColor.at(1), backgroundColor.at(2), backgroundColor.at(3));
this->chooseColor(this->changeBackgroundColorButton, &this->currentBackgroundColor, true);
}
if (textColor.size() == 4)
{
this->currentTextColor = QColor(textColor.at(0), textColor.at(1), textColor.at(2), textColor.at(3));
this->chooseColor(this->changeTextColorButton, &this->currentTextColor, true);
}
}
void SettingsDialog::loadInterfaceMiscSettings(void)
@@ -562,8 +575,20 @@ void SettingsDialog::loadDefaultInterfaceOSDSettings(void)
this->osdLocationComboBox->setCurrentIndex(CoreSettingsGetDefaultIntValue(SettingsID::GUI_OnScreenDisplayLocation));
this->osdVerticalPaddingSpinBox->setValue(CoreSettingsGetDefaultIntValue(SettingsID::GUI_OnScreenDisplayPaddingY));
this->osdHorizontalPaddingSpinBox->setValue(CoreSettingsGetDefaultIntValue(SettingsID::GUI_OnScreenDisplayPaddingX));
this->osdOpacitySpinBox->setValue(CoreSettingsGetDefaultFloatValue(SettingsID::GUI_OnScreenDisplayOpacity));
this->osdDurationSpinBox->setValue(CoreSettingsGetDefaultIntValue(SettingsID::GUI_OnScreenDisplayDuration));
std::vector<int> backgroundColor = CoreSettingsGetDefaultIntListValue(SettingsID::GUI_OnScreenDisplayBackgroundColor);
std::vector<int> textColor = CoreSettingsGetDefaultIntListValue(SettingsID::GUI_OnScreenDisplayTextColor);
if (backgroundColor.size() == 4)
{
this->currentBackgroundColor = QColor(backgroundColor.at(0), backgroundColor.at(1), backgroundColor.at(2), backgroundColor.at(3));
this->chooseColor(this->changeBackgroundColorButton, &this->currentBackgroundColor, true);
}
if (textColor.size() == 4)
{
this->currentTextColor = QColor(textColor.at(0), textColor.at(1), textColor.at(2), textColor.at(3));
this->chooseColor(this->changeTextColorButton, &this->currentTextColor, true);
}
}
void SettingsDialog::loadDefaultInterfaceMiscSettings(void)
@@ -770,8 +795,17 @@ void SettingsDialog::saveInterfaceOSDSettings(void)
CoreSettingsSetValue(SettingsID::GUI_OnScreenDisplayLocation, this->osdLocationComboBox->currentIndex());
CoreSettingsSetValue(SettingsID::GUI_OnScreenDisplayPaddingY, this->osdVerticalPaddingSpinBox->value());
CoreSettingsSetValue(SettingsID::GUI_OnScreenDisplayPaddingX, this->osdHorizontalPaddingSpinBox->value());
CoreSettingsSetValue(SettingsID::GUI_OnScreenDisplayOpacity, (float)this->osdOpacitySpinBox->value());
CoreSettingsSetValue(SettingsID::GUI_OnScreenDisplayDuration, this->osdDurationSpinBox->value());
CoreSettingsSetValue(SettingsID::GUI_OnScreenDisplayBackgroundColor, std::vector<int>({ this->currentBackgroundColor.red(),
this->currentBackgroundColor.green(),
this->currentBackgroundColor.blue(),
this->currentBackgroundColor.alpha()
}));
CoreSettingsSetValue(SettingsID::GUI_OnScreenDisplayTextColor, std::vector<int>({ this->currentTextColor.red(),
this->currentTextColor.green(),
this->currentTextColor.blue(),
this->currentTextColor.alpha()
}));
}
void SettingsDialog::saveInterfaceMiscSettings(void)
@@ -1053,6 +1087,28 @@ void SettingsDialog::chooseIPLRom(QLineEdit *lineEdit)
lineEdit->setText(QDir::toNativeSeparators(file));
}
void SettingsDialog::chooseColor(QPushButton *pushButton, QColor *initialColor, bool skipChoice)
{
QColor color = QColor::Invalid;
if (skipChoice)
{
color = *initialColor;
}
else
{
color = QColorDialog::getColor(*initialColor, this, "", QColorDialog::ColorDialogOption::ShowAlphaChannel);
}
if (!color.isValid())
{
return;
}
pushButton->setStyleSheet("background-color: " + color.name());
*initialColor = color;
}
bool SettingsDialog::applyPluginSettings(void)
{
// attempt to apply plugin settings when emulation
@@ -1182,6 +1238,16 @@ void SettingsDialog::on_changeDevelopmentIPLRomPathButton_clicked(void)
this->chooseIPLRom(this->developmentIPLRomLineEdit);
}
void SettingsDialog::on_changeBackgroundColorButton_clicked(void)
{
this->chooseColor(this->changeBackgroundColorButton, &this->currentBackgroundColor);
}
void SettingsDialog::on_changeTextColorButton_clicked(void)
{
this->chooseColor(this->changeTextColorButton, &this->currentTextColor);
}
void SettingsDialog::on_KeybindButton_KeybindingChanged(KeybindButton* button)
{
if (this->keybindButtonTimerId != -1)
@@ -19,6 +19,7 @@
#include <QTreeWidget>
#include <QWidget>
#include <QMutex>
#include <QColor>
#include <RMG-Core/Core.hpp>
@@ -56,6 +57,9 @@ class SettingsDialog : public QDialog, private Ui::SettingsDialog
int keybindButtonTimeLeft = 5;
KeybindButton* currentKeybindButton = nullptr;
QColor currentBackgroundColor;
QColor currentTextColor;
std::vector<CorePlugin> pluginList;
int currentIndex(void);
@@ -118,6 +122,7 @@ class SettingsDialog : public QDialog, private Ui::SettingsDialog
void chooseDirectory(QLineEdit *);
void chooseIPLRom(QLineEdit *);
void chooseColor(QPushButton *, QColor *, bool skipChoice = false);
bool applyPluginSettings(void);
@@ -138,6 +143,9 @@ class SettingsDialog : public QDialog, private Ui::SettingsDialog
void on_changeAmericanIPLRomPathButton_clicked(void);
void on_changeDevelopmentIPLRomPathButton_clicked(void);
void on_changeBackgroundColorButton_clicked(void);
void on_changeTextColorButton_clicked(void);
void on_KeybindButton_KeybindingChanged(KeybindButton* button);
void on_KeybindButton_Clicked(KeybindButton* button);
@@ -23,7 +23,7 @@
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
<enum>QLayout::SizeConstraint::SetNoConstraint</enum>
</property>
<property name="rightMargin">
<number>0</number>
@@ -34,7 +34,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
<enum>QLayout::SizeConstraint::SetNoConstraint</enum>
</property>
<item>
<widget class="QTabWidget" name="tabWidget">
@@ -125,7 +125,7 @@
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -171,7 +171,7 @@
<string>Changes will be applied on next emulation run</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
<enum>Qt::TextFormat::PlainText</enum>
</property>
</widget>
</item>
@@ -222,7 +222,7 @@
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -249,7 +249,7 @@
<item>
<spacer name="verticalSpacer_12">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -351,24 +351,36 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
<widget class="QLabel" name="label_10">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Opacity</string>
<string>Background Color</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="osdOpacitySpinBox">
<property name="decimals">
<number>1</number>
<widget class="QPushButton" name="changeBackgroundColorButton">
<property name="text">
<string/>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item>
<widget class="QLabel" name="label_15">
<property name="text">
<string>Text Color</string>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</widget>
</item>
<item>
<widget class="QPushButton" name="changeTextColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
@@ -398,7 +410,7 @@
<item>
<spacer name="verticalSpacer_17">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -444,7 +456,7 @@
<string>The On-Screen Display will only work with OpenGL video plugins</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
<enum>Qt::TextFormat::PlainText</enum>
</property>
</widget>
</item>
@@ -534,7 +546,7 @@
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -580,7 +592,7 @@
<string>Changes will be applied on next application run</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
<enum>Qt::TextFormat::PlainText</enum>
</property>
</widget>
</item>
@@ -600,7 +612,7 @@
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<enum>QFrame::Shadow::Plain</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
@@ -610,8 +622,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>442</width>
<height>692</height>
<width>444</width>
<height>690</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_11">
@@ -898,7 +910,7 @@
<item>
<spacer name="verticalSpacer_14">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -1134,7 +1146,7 @@
<item>
<spacer name="verticalSpacer_9">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -1334,7 +1346,7 @@
<item>
<spacer name="verticalSpacer_13">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -1408,7 +1420,7 @@
<item>
<spacer name="verticalSpacer_18">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -1518,7 +1530,7 @@
<item>
<spacer name="verticalSpacer_15">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -1592,7 +1604,7 @@
<item>
<spacer name="verticalSpacer_16">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -1801,7 +1813,7 @@
<item>
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -1847,7 +1859,7 @@
<string>Changes will be applied on next emulation run</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
<enum>Qt::TextFormat::PlainText</enum>
</property>
</widget>
</item>
@@ -2033,7 +2045,7 @@
<item>
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -2123,7 +2135,7 @@
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -2233,7 +2245,7 @@
<string>Reality Signal Processor Plugin</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
</property>
<property name="flat">
<bool>false</bool>
@@ -2261,7 +2273,7 @@
<item>
<spacer name="verticalSpacer_10">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -2307,7 +2319,7 @@
<string>Make sure to use a LLE RSP plugin (i.e paraLLEl RSP) when using a LLE Video plugin (i.e paraLLEl)</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
<enum>Qt::TextFormat::PlainText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -2356,7 +2368,7 @@
<string>Changes will be applied on next emulation run</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
<enum>Qt::TextFormat::PlainText</enum>
</property>
</widget>
</item>
@@ -2432,7 +2444,7 @@
<string>Reality Signal Processor Plugin</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
</property>
<property name="flat">
<bool>false</bool>
@@ -2457,7 +2469,7 @@
<item>
<spacer name="verticalSpacer_11">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -2503,7 +2515,7 @@
<string>Make sure to use a LLE RSP plugin (i.e paraLLEl RSP) when using a LLE Video plugin (i.e paraLLEl)</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
<enum>Qt::TextFormat::PlainText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -2548,7 +2560,7 @@
<string>Changes will be applied on next emulation run</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
<enum>Qt::TextFormat::PlainText</enum>
</property>
</widget>
</item>
@@ -2636,7 +2648,7 @@
<bool>true</bool>
</property>
<property name="title">
<string>Override User Directories</string>
<string>Override &amp;User Directories</string>
</property>
<property name="checkable">
<bool>true</bool>
@@ -2697,7 +2709,7 @@
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -2710,7 +2722,7 @@
<item>
<layout class="QHBoxLayout" name="emulationInfoLayout_13">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
<enum>QLayout::SizeConstraint::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="infoIconLabel_3">
@@ -2746,7 +2758,7 @@
<string>Changes will be applied on next application run</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
<enum>Qt::TextFormat::PlainText</enum>
</property>
</widget>
</item>
@@ -2856,7 +2868,7 @@
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -2902,7 +2914,7 @@
<string>Changes will be applied on next emulation run</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
<enum>Qt::TextFormat::PlainText</enum>
</property>
</widget>
</item>
@@ -2917,10 +2929,10 @@
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults</set>
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok|QDialogButtonBox::StandardButton::RestoreDefaults</set>
</property>
</widget>
</item>
+100 -39
View File
@@ -109,7 +109,7 @@ bool MainWindow::Init(QApplication* app, bool showUI, bool launchROM)
return true;
}
void MainWindow::OpenROM(QString file, QString disk, bool fullscreen, bool quitAfterEmulation)
void MainWindow::OpenROM(QString file, QString disk, bool fullscreen, bool quitAfterEmulation, int stateSlot)
{
this->ui_LaunchInFullscreen = fullscreen;
this->ui_QuitAfterEmulation = quitAfterEmulation;
@@ -120,7 +120,7 @@ void MainWindow::OpenROM(QString file, QString disk, bool fullscreen, bool quitA
// state, then the transition will be smoother
this->updateUI(true, false);
this->launchEmulationThread(file, disk, true);
this->launchEmulationThread(file, disk, true, stateSlot);
}
void MainWindow::closeEvent(QCloseEvent *event)
@@ -182,6 +182,8 @@ void MainWindow::initializeUI(bool launchROM)
&MainWindow::on_RomBrowser_PlayGame);
connect(this->ui_Widget_RomBrowser, &Widget::RomBrowserWidget::PlayGameWith, this,
&MainWindow::on_RomBrowser_PlayGameWith);
connect(this->ui_Widget_RomBrowser, &Widget::RomBrowserWidget::PlayGameWithSlot, this,
&MainWindow::on_RomBrowser_PlayGameWithSlot);
connect(this->ui_Widget_RomBrowser, &Widget::RomBrowserWidget::EditGameSettings, this,
&MainWindow::on_RomBrowser_EditGameSettings);
connect(this->ui_Widget_RomBrowser, &Widget::RomBrowserWidget::EditGameInputSettings, this,
@@ -251,7 +253,7 @@ void MainWindow::configureUI(QApplication* app, bool showUI)
this->addToolBar(toolbarArea, this->toolBar);
}
this->ui_TimerTimeout = CoreSettingsGetIntValue(SettingsID::GUI_StatusbarMessageDuration);
this->ui_StatusBarTimerTimeout = CoreSettingsGetIntValue(SettingsID::GUI_StatusbarMessageDuration);
this->ui_Widgets->addWidget(this->ui_Widget_RomBrowser);
this->ui_Widgets->addWidget(this->ui_Widget_OpenGL->GetWidget());
@@ -461,7 +463,7 @@ void MainWindow::updateUI(bool inEmulation, bool isPaused)
}
// update timer timeout
this->ui_TimerTimeout = CoreSettingsGetIntValue(SettingsID::GUI_StatusbarMessageDuration);
this->ui_StatusBarTimerTimeout = CoreSettingsGetIntValue(SettingsID::GUI_StatusbarMessageDuration);
}
void MainWindow::storeGeometry(void)
@@ -557,7 +559,7 @@ void MainWindow::connectEmulationThreadSignals(void)
Qt::BlockingQueuedConnection);
}
void MainWindow::launchEmulationThread(QString cartRom, QString diskRom, bool refreshRomListAfterEmulation)
void MainWindow::launchEmulationThread(QString cartRom, QString diskRom, bool refreshRomListAfterEmulation, int slot)
{
CoreSettingsSave();
@@ -593,6 +595,13 @@ void MainWindow::launchEmulationThread(QString cartRom, QString diskRom, bool re
this->ui_LaunchInFullscreen = false;
}
this->ui_LoadSaveStateSlotCounter = 0;
this->ui_LoadSaveStateSlot = slot;
if (slot != -1)
{
this->ui_LoadSaveStateSlotTimerId = this->startTimer(100);
}
this->ui_CheckVideoSizeTimerId = this->startTimer(2000);
this->ui_HideCursorInEmulation = CoreSettingsGetBoolValue(SettingsID::GUI_HideCursorInEmulation);
@@ -964,8 +973,12 @@ void MainWindow::configureActions(void)
{
if (checked)
{
int factor = speedAction->text().split("%").first().toInt();
this->on_Action_System_SpeedFactor(factor);
QString factorText = speedAction->text().split("%").first();
// sometimes the text can contain a '&'
// which will make the toInt() function return 0
// so strip it out
factorText.remove('&');
this->on_Action_System_SpeedFactor(factorText.toInt());
}
});
}
@@ -986,8 +999,12 @@ void MainWindow::configureActions(void)
{
if (checked)
{
int slot = slotAction->text().split(" ").at(1).toInt();
this->on_Action_System_CurrentSaveState(slot);
QString slotText = slotAction->text().split(" ").at(1);
// sometimes the text can contain a '&'
// which will make the toInt() function return 0
// so strip it out
slotText.remove('&');
this->on_Action_System_CurrentSaveState(slotText.toInt());
}
});
}
@@ -1108,7 +1125,7 @@ void MainWindow::timerEvent(QTimerEvent *event)
{
int timerId = event->timerId();
if (timerId == this->ui_TimerId)
if (timerId == this->ui_ResetStatusBarTimerId)
{
this->ui_StatusBar_Label->clear();
}
@@ -1181,6 +1198,29 @@ void MainWindow::timerEvent(QTimerEvent *event)
CoreSetVideoSize(expectedWidth, expectedHeight);
}
}
else if (timerId == this->ui_LoadSaveStateSlotTimerId)
{
if (!CoreIsEmulationRunning())
{
return;
}
if (!CoreSetSaveStateSlot(this->ui_LoadSaveStateSlot) ||
!CoreLoadSaveState())
{
this->ui_LoadSaveStateSlotCounter++;
if (this->ui_LoadSaveStateSlotCounter >= 5)
{ // give up after 5 attempts
this->killTimer(this->ui_LoadSaveStateSlotTimerId);
this->ui_LoadSaveStateSlotCounter = 0;
this->ui_LoadSaveStateSlotTimerId = -1;
this->ui_LoadSaveStateSlot = -1;
}
return;
}
this->killTimer(this->ui_LoadSaveStateSlotTimerId);
}
}
void MainWindow::on_EventFilter_KeyPressed(QKeyEvent *event)
@@ -1801,24 +1841,12 @@ void MainWindow::on_Action_Help_Update(void)
void MainWindow::on_Action_Audio_IncreaseVolume(void)
{
if (!CoreIncreaseVolume())
{
// It's rather annoying to have an error message pop-up everytime
// you use the increase volume hotkey when the volume is already
// at 100%, so we'll disable the error message
//this->showErrorMessage("CoreIncreaseVolume() Failed", QString::fromStdString(CoreGetError()));
}
CoreIncreaseVolume();
}
void MainWindow::on_Action_Audio_DecreaseVolume(void)
{
if (!CoreDecreaseVolume())
{
// It's rather annoying to have an error message pop-up everytime
// you use the decrease volume hotkey when the volume is already
// at 0%, so we'll disable the error message
//this->showErrorMessage("CoreDecreaseVolume() Failed", QString::fromStdString(CoreGetError()));
}
CoreDecreaseVolume();
}
void MainWindow::on_Action_Audio_ToggleVolumeMute(void)
@@ -1916,6 +1944,11 @@ void MainWindow::on_RomBrowser_PlayGameWith(CoreRomType type, QString file)
this->launchEmulationThread(mainRom, otherRom);
}
void MainWindow::on_RomBrowser_PlayGameWithSlot(QString file, int slot)
{
this->launchEmulationThread(file, "", false, slot);
}
void MainWindow::on_RomBrowser_ChangeRomDirectory(void)
{
QString dir;
@@ -2322,10 +2355,10 @@ void MainWindow::on_VidExt_ToggleFS(bool fullscreen)
}
}
void MainWindow::on_Core_DebugCallback(CoreDebugMessageType type, QString context, QString message)
void MainWindow::on_Core_DebugCallback(QList<CoreCallbackMessage> messages)
{
// pass callback to the log window
this->logDialog.AddLogLine(type, context, message);
// pass callback messages to the log window
this->logDialog.AddMessages(messages);
// only display in statusbar when emulation is running
if (!this->emulationThread->isRunning())
@@ -2333,32 +2366,34 @@ void MainWindow::on_Core_DebugCallback(CoreDebugMessageType type, QString contex
return;
}
if (!context.startsWith("[CORE]"))
const CoreCallbackMessage& statusbarMessage = messages.last();
if (!statusbarMessage.Context.startsWith("[CORE]"))
{
return;
}
// drop verbose messages
if (type == CoreDebugMessageType::Verbose)
if (statusbarMessage.Type == CoreDebugMessageType::Verbose)
{
return;
}
// drop IS64 messages
if (message.startsWith("IS64:"))
if (statusbarMessage.Message.startsWith("IS64:"))
{
return;
}
if (type == CoreDebugMessageType::Error)
if (statusbarMessage.Type == CoreDebugMessageType::Error)
{
// when we've reached 50 of the same error in the same
// emulation run, we'll stop displaying it
if (this->ui_DebugCallbackErrors.count(message) < 50)
if (this->ui_DebugCallbackErrors.count(statusbarMessage.Message) < 50)
{
this->showErrorMessage("Core Error", message, false);
this->showErrorMessage("Core Error", statusbarMessage.Message, false);
}
this->ui_DebugCallbackErrors.append(message);
this->ui_DebugCallbackErrors.append(statusbarMessage.Message);
return;
}
@@ -2367,14 +2402,14 @@ void MainWindow::on_Core_DebugCallback(CoreDebugMessageType type, QString contex
return;
}
this->ui_StatusBar_Label->setText(message);
this->ui_StatusBar_Label->setText(statusbarMessage.Message);
// reset label deletion timer
if (this->ui_TimerId != 0)
if (this->ui_ResetStatusBarTimerId != 0)
{
this->killTimer(this->ui_TimerId);
this->killTimer(this->ui_ResetStatusBarTimerId);
}
this->ui_TimerId = this->startTimer(this->ui_TimerTimeout * 1000);
this->ui_ResetStatusBarTimerId = this->startTimer(this->ui_StatusBarTimerTimeout * 1000);
}
void MainWindow::on_Core_StateCallback(CoreStateCallbackType type, int value)
@@ -2403,6 +2438,11 @@ void MainWindow::on_Core_StateCallback(CoreStateCallbackType type, int value)
QString dateTimeText = this->getSaveStateSlotDateTimeText(slotAction);
std::string message = "Selected save slot: " + std::to_string(value);
if (this->ui_LoadSaveStateSlotTimerId != -1)
{
return;
}
// add date and time when available
if (!dateTimeText.isEmpty())
{
@@ -2442,7 +2482,28 @@ void MainWindow::on_Core_StateCallback(CoreStateCallbackType type, int value)
} break;
case CoreStateCallbackType::SaveStateLoaded:
{
if (value == 0)
if (this->ui_LoadSaveStateSlotTimerId != -1 && value == 0)
{
this->ui_LoadSaveStateSlotCounter++;
if (this->ui_LoadSaveStateSlotCounter >= 5)
{ // give up after 5 attempts
this->showErrorMessage("Failed to load save state");
this->ui_LoadSaveStateSlotCounter = 0;
this->ui_LoadSaveStateSlotTimerId = -1;
this->ui_LoadSaveStateSlot = -1;
}
else
{
this->ui_LoadSaveStateSlotTimerId = this->startTimer(500);
}
}
else if (this->ui_LoadSaveStateSlotTimerId != -1 && value != 0)
{
this->ui_LoadSaveStateSlotCounter = 0;
this->ui_LoadSaveStateSlotTimerId = -1;
this->ui_LoadSaveStateSlot = -1;
}
else if (value == 0)
{
OnScreenDisplaySetMessage("Failed to load save state.");
}
+10 -5
View File
@@ -50,7 +50,7 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
~MainWindow(void);
bool Init(QApplication* app, bool showUI, bool launchROM);
void OpenROM(QString file, QString disk, bool fullscreen, bool quitAfterEmulation);
void OpenROM(QString file, QString disk, bool fullscreen, bool quitAfterEmulation, int stateSlot);
private:
Thread::EmulationThread *emulationThread = nullptr;
@@ -76,6 +76,7 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
bool ui_LaunchInFullscreen = false;
bool ui_QuitAfterEmulation = false;
bool ui_RefreshRomListAfterEmulation = false;
int ui_LoadSaveStateSlot = -1;
VidExtRenderMode ui_VidExtRenderMode = VidExtRenderMode::OpenGL;
@@ -104,14 +105,17 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
bool ui_SilentUpdateCheck = false;
int ui_TimerId = 0;
int ui_TimerTimeout = 0;
int ui_ResetStatusBarTimerId = 0;
int ui_StatusBarTimerTimeout = 0;
int ui_FullscreenTimerId = 0;
int ui_GamesharkButtonTimerId = 0;
int ui_UpdateSaveStateSlotTimerId = 0;
int ui_CheckVideoSizeTimerId = 0;
int ui_LoadSaveStateSlotCounter = 0;
int ui_LoadSaveStateSlotTimerId = -1;
QString ui_WindowTitle;
Dialog::LogDialog logDialog;
@@ -132,7 +136,7 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
void initializeEmulationThread(void);
void connectEmulationThreadSignals(void);
void launchEmulationThread(QString cartRom, QString diskRom = "", bool refreshRomListAfterEmulation = false);
void launchEmulationThread(QString cartRom, QString diskRom = "", bool refreshRomListAfterEmulation = false, int slot = -1);
QString getSaveStateSlotDateTimeText(QAction* action);
QString getSaveStateSlotText(QAction* action, int slot);
@@ -214,6 +218,7 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
void on_RomBrowser_PlayGame(QString file);
void on_RomBrowser_PlayGameWith(CoreRomType type, QString file);
void on_RomBrowser_PlayGameWithSlot(QString file, int slot);
void on_RomBrowser_ChangeRomDirectory(void);
void on_RomBrowser_RomInformation(QString file);
void on_RomBrowser_EditGameSettings(QString file);
@@ -229,7 +234,7 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
void on_VidExt_ResizeWindow(int width, int height);
void on_VidExt_ToggleFS(bool fullscreen);
void on_Core_DebugCallback(CoreDebugMessageType type, QString context, QString message);
void on_Core_DebugCallback(QList<CoreCallbackMessage> messages);
void on_Core_StateCallback(CoreStateCallbackType type, int value);
};
} // namespace UserInterface
@@ -17,7 +17,7 @@
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -33,10 +33,10 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:700;&quot;&gt;No ROMs in supported formats were found.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Please select a directory with ROMs to begin.&lt;/p&gt;&lt;p&gt;ROMs in the following formats will be scanned and listed: &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
<enum>Qt::TextFormat::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -49,7 +49,7 @@
<string>.n64/.z64/.v64 (N64 Roms)</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
@@ -59,17 +59,17 @@
<string>.ndd/.d64 (64DD Disks)</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>.zip (Archive)</string>
<string>.zip/.7z (Archive)</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
@@ -78,7 +78,7 @@
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -98,7 +98,7 @@
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -115,7 +115,7 @@
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -135,7 +135,7 @@
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -150,7 +150,7 @@
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -174,6 +174,7 @@ RomBrowserWidget::RomBrowserWidget(QWidget *parent) : QStackedWidget(parent)
this->contextMenu = new QMenu(this);
this->action_PlayGame = new QAction(this);
this->action_PlayGameWith = new QAction(this);
this->menu_PlayGameWithSlot = new QMenu(this);
this->action_RefreshRomList = new QAction(this);
this->action_OpenRomDirectory = new QAction(this);
this->action_ChangeRomDirectory = new QAction(this);
@@ -192,6 +193,7 @@ RomBrowserWidget::RomBrowserWidget(QWidget *parent) : QStackedWidget(parent)
// configure context menu contents
this->action_PlayGame->setText("Play Game");
this->action_PlayGameWith->setText("Play Game with Disk");
this->menu_PlayGameWithSlot->menuAction()->setText("Play Game with State");
this->action_RefreshRomList->setText("Refresh ROM List");
this->action_OpenRomDirectory->setText("Open ROM Directory");
this->action_ChangeRomDirectory->setText("Change ROM Directory...");
@@ -219,6 +221,7 @@ RomBrowserWidget::RomBrowserWidget(QWidget *parent) : QStackedWidget(parent)
// configure context menu
this->contextMenu->addAction(this->action_PlayGame);
this->contextMenu->addAction(this->action_PlayGameWith);
this->contextMenu->addMenu(this->menu_PlayGameWithSlot);
this->contextMenu->addSeparator();
this->contextMenu->addAction(this->action_RefreshRomList);
this->contextMenu->addSeparator();
@@ -600,6 +603,7 @@ void RomBrowserWidget::customContextMenuRequested(QPoint position)
this->action_PlayGame->setEnabled(hasSelection);
this->action_PlayGameWith->setEnabled(hasSelection);
this->menu_PlayGameWithSlot->menuAction()->setEnabled(hasSelection);
this->action_RomInformation->setEnabled(hasSelection);
this->action_EditGameSettings->setEnabled(hasSelection);
this->action_EditGameInputSettings->setEnabled(hasSelection && CorePluginsHasROMConfig(CorePluginType::Input));
@@ -611,6 +615,11 @@ void RomBrowserWidget::customContextMenuRequested(QPoint position)
this->action_RemoveCoverImage->setEnabled(hasSelection && !data.coverFile.isEmpty());
this->action_RemoveCoverImage->setVisible(view == this->gridViewWidget);
if (hasSelection)
{
this->generateStateMenu();
}
if (hasSelection && data.type == CoreRomType::Disk)
{ // disk selected
this->action_PlayGameWith->setText("Play Game with Cartridge");
@@ -658,6 +667,49 @@ void RomBrowserWidget::generateColumnsMenu(void)
}
}
void RomBrowserWidget::generateStateMenu(void)
{
this->menu_PlayGameWithSlot->clear();
RomBrowserModelData data;
if (!this->getCurrentData(data))
{
return;
}
std::filesystem::path saveStatePath;
QString saveStateSlotText;
for (int i = 0; i < 10; i++)
{
if (!CoreGetSaveStatePath(data.header, data.settings, i, saveStatePath))
{
continue;
}
QFileInfo saveStateFileInfo(QString::fromStdWString(saveStatePath.wstring()));
if (!saveStatePath.empty() && saveStateFileInfo.exists())
{
saveStateSlotText = "Slot " + QString::number(i) + " - ";
saveStateSlotText += saveStateFileInfo.lastModified().toString("dd/MM/yyyy hh:mm");
QAction* slotAction = this->menu_PlayGameWithSlot->addAction(saveStateSlotText);
connect(slotAction, &QAction::triggered, [=, this]()
{
QString slotText = slotAction->text().split(" ").at(1);
// sometimes the text can contain a '&'
// which will make the toInt() function return 0
// so strip it out
slotText.remove('&');
this->on_Action_PlayGameWithSlot(slotText.toInt());
});
}
}
this->menu_PlayGameWithSlot->setDisabled(this->menu_PlayGameWithSlot->isEmpty());
}
void RomBrowserWidget::on_listViewWidget_sortIndicatorChanged(int logicalIndex, Qt::SortOrder sortOrder)
{
CoreSettingsSetValue(SettingsID::RomBrowser_ListViewSortSection, logicalIndex);
@@ -891,6 +943,18 @@ void RomBrowserWidget::on_Action_PlayGameWith(void)
emit this->PlayGameWith(data.type, data.file);
}
void RomBrowserWidget::on_Action_PlayGameWithSlot(int slot)
{
RomBrowserModelData data;
if (!this->getCurrentData(data))
{
return;
}
emit this->PlayGameWithSlot(data.file, slot);
}
void RomBrowserWidget::on_Action_RefreshRomList(void)
{
this->RefreshRomList();
@@ -88,6 +88,7 @@ class RomBrowserWidget : public QStackedWidget
QAction* action_SetCoverImage;
QAction* action_RemoveCoverImage;
QMenu* menu_PlayGameWithSlot;
QMenu* menu_Columns;
QAction* action_ColumnsMenuEntry;
@@ -110,6 +111,7 @@ class RomBrowserWidget : public QStackedWidget
void on_DoubleClicked(const QModelIndex& index);
void customContextMenuRequested(QPoint position);
void generateColumnsMenu(void);
void generateStateMenu(void);
void on_listViewWidget_sortIndicatorChanged(int logicalIndex, Qt::SortOrder sortOrder);
void on_listViewWidget_sectionResized(int logicalIndex, int oldWidth, int newWidth);
@@ -126,6 +128,7 @@ class RomBrowserWidget : public QStackedWidget
void on_Action_PlayGame(void);
void on_Action_PlayGameWith(void);
void on_Action_PlayGameWithSlot(int);
void on_Action_RefreshRomList(void);
void on_Action_OpenRomDirectory(void);
void on_Action_ChangeRomDirectory(void);
@@ -140,6 +143,7 @@ class RomBrowserWidget : public QStackedWidget
signals:
void PlayGame(QString);
void PlayGameWith(CoreRomType, QString);
void PlayGameWithSlot(QString, int);
void EditGameSettings(QString);
void EditGameInputSettings(QString);
void Cheats(QString);
+11 -1
View File
@@ -169,6 +169,7 @@ int main(int argc, char **argv)
QCommandLineOption fullscreenOption({"f", "fullscreen"}, "Launches ROM in fullscreen mode");
QCommandLineOption noGuiOption({"n", "nogui"}, "Hides GUI elements (menubar, toolbar, statusbar)");
QCommandLineOption quitAfterEmulationOption({"q", "quit-after-emulation"}, "Quits RMG when emulation has finished");
QCommandLineOption loadStateSlot("load-state-slot", "Loads save state slot when launching the ROM", "Slot Number");
QCommandLineOption diskOption("disk", "64DD Disk to open ROM in combination with", "64DD Disk");
#ifndef PORTABLE_INSTALL
@@ -181,6 +182,7 @@ int main(int argc, char **argv)
parser.addOption(fullscreenOption);
parser.addOption(noGuiOption);
parser.addOption(quitAfterEmulationOption);
parser.addOption(loadStateSlot);
parser.addOption(diskOption);
parser.addPositionalArgument("ROM", "ROM to open");
@@ -228,7 +230,15 @@ int main(int argc, char **argv)
if (!args.empty())
{
window.OpenROM(args.at(0), parser.value(diskOption), parser.isSet(fullscreenOption), parser.isSet(quitAfterEmulationOption));
bool parsedNumber = false;
int saveStateSlot = parser.value(loadStateSlot).toInt(&parsedNumber);
if (parser.value(loadStateSlot).isEmpty() || !parsedNumber ||
saveStateSlot < 0 || saveStateSlot > 9)
{
saveStateSlot = -1;
}
window.OpenROM(args.at(0), parser.value(diskOption), parser.isSet(fullscreenOption), parser.isSet(quitAfterEmulationOption), saveStateSlot);
}
// show window
+1 -1
View File
@@ -12,7 +12,7 @@ git clone https://github.com/project64/project64 "$tmp_dir"
cd "$tmp_dir"
# latest commit of cheats change
git checkout e60f7ec6489e22c8b1988931f8ce3ca46edae91c -f
git checkout 1bde8589e95478a7e82bfa67e84c3face0802e1b -f
for file in "$source_cheat_dir"/*.cht
do
+1 -1
View File
@@ -1 +1 @@
v0.5.8
v0.6.0