Compare commits

...

78 Commits

Author SHA1 Message Date
Josh Pearson
63bfa4c2c6 Merge branch 'ph3nom/fsaa' into ph3nom/fsaa-mr 2025-03-04 11:25:08 -07:00
Josh Pearson
dac22aedf0 FSAA - Explicit typecast for sim-clang build
error: type 'float' cannot be narrowed to 'rw::int32'
2025-03-04 11:09:45 -07:00
Falco Girgis
1fcf0a2338 Fixed v1 and v3 blurs with FSAA enabled.
- Both blurs had hard-coded screen resolution parameters
- FSAA horizontally stretches by 2x
- Made both algorithms now dynamic based on screen resolution
- Verified both work with and without FSAA now
2025-02-28 16:43:26 -06:00
Stefanos Kornilios Mitsis Poiitidis
3a4aa88259 Merge branch 'skmp/oix-emulator-workarounds' into 'main'
Submit via OCR path if emulator is detected with no support for OIX

See merge request skmp/dca3-game!26
2025-02-25 17:07:58 +00:00
Stefanos Kornilios Mitsis Poiitidis
97a4e0d3a4 Merge branch 'skmp/fix-sniper' into 'main'
Fix sniper bug / bulletInfoInUse counting

See merge request skmp/dca3-game!25
2025-02-25 17:01:28 +00:00
Stefanos Kornilios Mitsis Poiitidis
7748c85d6b Submit via OCR path if emulator is detected with no support for OIX 2025-02-25 18:55:51 +02:00
Stefanos Kornilios Mitsis Poiitidis
e5308dea97 Fix sniper bug / bulletInfoInUse counting 2025-02-25 18:54:32 +02:00
Stefanos Kornilios Mitsis Poiitidis
87bfbcab2d Merge branch 'skmp/texconv-edit-txds' into 'main'
texconv: Add support for modifying txds, add gamepad assets

See merge request skmp/dca3-game!22
2025-02-07 17:19:21 +00:00
Stefanos Kornilios Mitsis Poiitidis
bdc27bf2fc texconv: Add support for modifying txds, add gamepad assets 2025-02-07 19:06:03 +02:00
Stefanos Kornilios Mitsis Poiitidis
1ee51d5136 Merge branch 'ph3nom/updated-fog-2.0' into 'main'
Fog Parameters Updated

See merge request skmp/dca3-game!21
2025-02-06 08:22:59 +00:00
Stefanos Kornilios Mitsis Poiitidis
725d60a9fb Merge branch 'ph3nom/audio-volume-fixes' into 'main'
Fixes for audio volume

See merge request skmp/dca3-game!20
2025-02-06 08:20:45 +00:00
Josh Pearson
05e9e7452e Custom Fog Table index fix 2025-02-05 09:24:02 -07:00
Josh Pearson
51b21c02b9 Merge branch 'ph3nom/updated-fog' into ph3nom/updated-fog-2.0 2025-02-03 16:47:41 -07:00
Josh Pearson
86806215a5 Revert "Fixes for audio volume"
This reverts commit 8c81349c69.
2025-02-03 16:47:27 -07:00
Josh Pearson
a056fdecc7 Custom Fog Table
KOS fog functions always start at 0, meaning fog is not really applied near the camera.  This custom table allows fog to "psuedo" start before the camera so that vertices near the camera have fog applied as this game expects
2025-02-03 15:53:05 -07:00
Josh Pearson
b6d5c628b2 Fixes for audio volume
Main menu will now adjust music and sfx volume.  Fade in and fade out for cutscenes now working.
2025-02-03 13:05:49 -07:00
Josh Pearson
8c81349c69 Fixes for audio volume
Main menu will now adjust music and sfx volume.  Fade in and fade out for cutscenes now working.
2025-02-03 12:59:12 -07:00
Josh Pearson
282b639a4c Fog Parameters Updated
Hook timecycle to get fog start value.  This is then converted into a density value (based on known range) to produce a nicer fog cutoff value using EXP fog instead of linear table mode.
2025-01-29 15:58:40 -07:00
Stefanos Kornilios Mitsis Poiitidis
69f9bbcf7b Merge branch 'skmp/fix-audio-sample-calculations' into 'main'
audio: Do sample <-> milisecond in 64 bit precision, as intermediate steps might overflow int32

See merge request skmp/dca3-game!19
2025-01-26 14:43:07 +00:00
Stefanos Kornilios Mitsis Poiitidis
40f212e131 audio: Do sample <-> milisecond in 64 bit precision, as intermediate steps might overflow int32 2025-01-26 15:36:43 +01:00
Stefanos Kornilios Mitsis Poiitidis
43c0e99ebf Merge branch 'skmp/fix-dam-flamethrower' into 'main'
Fix Dynamic Acoustic Modelling: off & Flamethrower SFX

See merge request skmp/dca3-game!18
2025-01-26 13:55:55 +00:00
Stefanos Kornilios Mitsis Poiitidis
42647ddc6b Fix Dynamic Acoustic Modelling: off & Flamethrower SFX 2025-01-26 14:44:29 +01:00
Stefanos Kornilios Mitsis Poiitidis
b3ccf1f900 Merge branch 'ph3nom/fix-throwing-controls' into 'main'
Fix Throwing Grenade and Moltov Coctail Controls

See merge request skmp/dca3-game!17
2025-01-25 10:50:26 +00:00
Josh Pearson
baf7612fcf Fix Throwing Grenade and Moltov Coctail Controls 2025-01-24 17:08:55 -07:00
Josh Pearson
714f34464e Fix moon and corona aspect ratio with FSAA 2025-01-17 16:41:25 -07:00
Stefanos Kornilios Mitsis Poiitidis
33b9dd1c8a Merge branch 'skmp/protect-from-zero-delta-times' into 'main'
CAnimBlendNode::GetCurrentTranslation: Protect against zero delta times

See merge request skmp/dca3-game!15
2025-01-16 06:13:03 +00:00
Stefanos Kornilios Mitsis Poiitidis
5786eeecb8 Merge branch 'falco/fuck_da_fences' into 'main'
Fixed the goddamn fences.

See merge request skmp/dca3-game!14
2025-01-16 06:11:54 +00:00
Stefanos Kornilios Mitsis Poiitidis
20864fdac6 Merge branch '49-game-crash-when-entering-parking-garage-on-staunton-island' into 'main'
Resolve "Parking garage crash fix"

See merge request skmp/dca3-game!16
2025-01-16 06:09:08 +00:00
mark wallace
1587d707a8 Parking garage bug fix. 2025-01-16 04:11:34 +00:00
Stefanos Kornilios Mitsis Poiitidis
911b93bd0f CAnimBlendNode::GetCurrentTranslation: Protect against zero delta times 2025-01-14 23:18:24 +02:00
Falco Girgis
e86fb27a48 Fixed the goddamn fences.
Colliding with and/or brushing against the metal chain-linked fences in
the game caused severe performance degredation as the SH4 struggled to
keep up with the physics.

The PSVita REGTA3 port also struggled, somehow, with its bazillion times
faster CPU. The PS2 version has no fences. The Xbox version implemented
an interesting compromise, where fences could be collided with and
knocked over, but individual links did not interact with one-another,
only with the car.

So that's what I've essentially done here. Intersection testing is still
happening between all of the previous CPhysical entities in question
(player vs fences vs fences); however, the contact resolution for fence vs
fence collisions is now being essentially canceled.

Apparently that's all that was needed, as you can now mow down long-ass
fences with no performance impact and a response that looks like what
the Xbox does.
2025-01-12 00:29:42 -06:00
Josh Pearson
214d913c4a FSAA Implemented as a Video Mode of 1280x480
Video mode must be set in main menu before starting game.  Changing this setting restarts the video driver which resets the PVR.  Settings persist after shutting down game via INI saves.
2025-01-09 16:40:58 -07:00
Stefanos Kornilios Mitsis Poiitidis
2065c9a93f Merge branch 'skmp/fix-AllocateBoatWakeArray' into 'main'
Some checks failed
re3 conan+cmake / build-cmake (openal, glfw, macos-latest, gl3) (push) Has been cancelled
re3 conan+cmake / build-cmake (openal, glfw, ubuntu-18.04, gl3) (push) Has been cancelled
re3 conan+cmake / build-cmake (openal, glfw, windows-latest, gl3) (push) Has been cancelled
re3 conan+cmake / build-cmake (openal, windows-latest, d3d9) (push) Has been cancelled
re3 cmake devkitA64 (Nintendo Switch) / build-nintendo-switch (push) Has been cancelled
re3 premake amd64 / build (Debug, win-amd64-librw_d3d9-oal) (push) Has been cancelled
re3 premake amd64 / build (Debug, win-amd64-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake amd64 / build (Release, win-amd64-librw_d3d9-oal) (push) Has been cancelled
re3 premake amd64 / build (Release, win-amd64-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_d3d9-mss) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_d3d9-oal) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-mss) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_d3d9-mss) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_d3d9-oal) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-mss) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-mss) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-oal) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-mss) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-oal) (push) Has been cancelled
Fix AllocateBoatWakeArray, it needs RpGeometryCreate with HAS_TRIANGLES

See merge request skmp/dca3-game!12
2025-01-06 11:46:50 +00:00
Stefanos Kornilios Mitsis Poiitidis
a2caa56275 Merge branch 'skmp/material-alpha-override-pt' into 'main'
Perform full blending for mat.a != 0xFF, should fade-in sprites (eg, Trees)

See merge request skmp/dca3-game!11
2025-01-06 11:41:11 +00:00
Stefanos Kornilios Mitsis Poiitidis
fa65f637ad Fix AllocateBoatWakeArray, it needs RpGeometryCreate with HAS_TRIANGLES 2025-01-06 13:40:31 +02:00
Stefanos Kornilios Mitsis Poiitidis
0a0a664428 Perform full blending for mat.a != 0xFF, should fade-in sprites (eg, Trees) 2025-01-05 15:40:18 +02:00
Stefanos Kornilios Mitsis Poiitidis
5abd0641a4 Merge branch 'skmp/fix-staring-into-the-void' into 'main'
Some checks are pending
re3 conan+cmake / build-cmake (openal, glfw, macos-latest, gl3) (push) Waiting to run
re3 conan+cmake / build-cmake (openal, glfw, ubuntu-18.04, gl3) (push) Waiting to run
re3 conan+cmake / build-cmake (openal, glfw, windows-latest, gl3) (push) Waiting to run
re3 conan+cmake / build-cmake (openal, windows-latest, d3d9) (push) Waiting to run
re3 cmake devkitA64 (Nintendo Switch) / build-nintendo-switch (push) Waiting to run
re3 premake amd64 / build (Debug, win-amd64-librw_d3d9-oal) (push) Waiting to run
re3 premake amd64 / build (Debug, win-amd64-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake amd64 / build (Release, win-amd64-librw_d3d9-oal) (push) Waiting to run
re3 premake amd64 / build (Release, win-amd64-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake x86 / build (Debug, win-x86-librw_d3d9-mss) (push) Waiting to run
re3 premake x86 / build (Debug, win-x86-librw_d3d9-oal) (push) Waiting to run
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-mss) (push) Waiting to run
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake x86 / build (Release, win-x86-librw_d3d9-mss) (push) Waiting to run
re3 premake x86 / build (Release, win-x86-librw_d3d9-oal) (push) Waiting to run
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-mss) (push) Waiting to run
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-mss) (push) Waiting to run
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-oal) (push) Waiting to run
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-mss) (push) Waiting to run
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-oal) (push) Waiting to run
Revert buggy optimizations in CMatrix::Rotate*. Didn't investigate much, they aren't often called

Closes #8 and #6

See merge request skmp/dca3-game!9
2025-01-05 08:21:54 +00:00
Stefanos Kornilios Mitsis Poiitidis
ca866bdb2a Fix sim build 2025-01-05 10:15:30 +02:00
Stefanos Kornilios Mitsis Poiitidis
bf0e36858e Use fipr in CMatrix::Rotate, simplifies it so it doesn't ICE
Some checks failed
re3 conan+cmake / build-cmake (openal, glfw, macos-latest, gl3) (push) Has been cancelled
re3 conan+cmake / build-cmake (openal, glfw, ubuntu-18.04, gl3) (push) Has been cancelled
re3 conan+cmake / build-cmake (openal, glfw, windows-latest, gl3) (push) Has been cancelled
re3 conan+cmake / build-cmake (openal, windows-latest, d3d9) (push) Has been cancelled
re3 cmake devkitA64 (Nintendo Switch) / build-nintendo-switch (push) Has been cancelled
re3 premake amd64 / build (Debug, win-amd64-librw_d3d9-oal) (push) Has been cancelled
re3 premake amd64 / build (Debug, win-amd64-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake amd64 / build (Release, win-amd64-librw_d3d9-oal) (push) Has been cancelled
re3 premake amd64 / build (Release, win-amd64-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_d3d9-mss) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_d3d9-oal) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-mss) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_d3d9-mss) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_d3d9-oal) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-mss) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-mss) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-oal) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-mss) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-oal) (push) Has been cancelled
2025-01-05 09:19:02 +02:00
Stefanos Kornilios Mitsis Poiitidis
b90e8433da Revert buggy optimizations in CMatrix::Rotate*. Didn't investigate much, they aren't often called 2025-01-05 09:12:56 +02:00
Stefanos Kornilios Mitsis Poiitidis
133110c15c Merge branch 'skmp/async-pedsfx-load' into 'main'
Some checks are pending
re3 conan+cmake / build-cmake (openal, glfw, macos-latest, gl3) (push) Waiting to run
re3 conan+cmake / build-cmake (openal, glfw, ubuntu-18.04, gl3) (push) Waiting to run
re3 conan+cmake / build-cmake (openal, glfw, windows-latest, gl3) (push) Waiting to run
re3 conan+cmake / build-cmake (openal, windows-latest, d3d9) (push) Waiting to run
re3 cmake devkitA64 (Nintendo Switch) / build-nintendo-switch (push) Waiting to run
re3 premake amd64 / build (Debug, win-amd64-librw_d3d9-oal) (push) Waiting to run
re3 premake amd64 / build (Debug, win-amd64-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake amd64 / build (Release, win-amd64-librw_d3d9-oal) (push) Waiting to run
re3 premake amd64 / build (Release, win-amd64-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake x86 / build (Debug, win-x86-librw_d3d9-mss) (push) Waiting to run
re3 premake x86 / build (Debug, win-x86-librw_d3d9-oal) (push) Waiting to run
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-mss) (push) Waiting to run
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake x86 / build (Release, win-x86-librw_d3d9-mss) (push) Waiting to run
re3 premake x86 / build (Release, win-x86-librw_d3d9-oal) (push) Waiting to run
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-mss) (push) Waiting to run
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-mss) (push) Waiting to run
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-oal) (push) Waiting to run
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-mss) (push) Waiting to run
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-oal) (push) Waiting to run
PedSfx: Read from I/O thread, load them on the background

See merge request skmp/dca3-game!10
2025-01-04 19:15:39 +00:00
Stefanos Kornilios Mitsis Poiitidis
6f71cfc458 PedSfx: Read from I/O thread, load them on the background 2025-01-04 17:46:48 +02:00
Stefanos Kornilios Mitsis Poiitidis
02d0103b20 Redirect to dca3.net 2024-12-31 09:05:08 +00:00
Stefanos Kornilios Mitsis Poiitidis
72da27ef0b Edit README.md 2024-12-29 22:23:08 +00:00
Stefanos Kornilios Mitsis Poiitidis
ff9df6c760 Merge branch 'soniccd123/HintMessagesV2' into 'main'
Hints V2 + Controller layout images

See merge request skmp/dca3-game!8
2024-12-29 21:34:46 +00:00
Stefanos Kornilios Mitsis Poiitidis
0c0d8c88b6 Merge branch 'thegang/cull-atomics-if-vbuf-full' into 'main'
Cull atomics if vbuf is nearly full

See merge request skmp/dca3-game!7
2024-12-29 19:22:51 +00:00
Stefanos Kornilios Mitsis Poiitidis
ab6a65ba4f Cull atomics if vbuf is nearly full 2024-12-29 21:15:18 +02:00
Soniccd123
d8b6a02494 Update to hints, add help layout images to controller setup page (WIP) 2024-12-29 13:13:12 -03:00
Stefanos Kornilios Mitsis Poiitidis
d6e5be5a5d Edit README.md 2024-12-29 14:58:09 +00:00
Stefanos Kornilios Mitsis Poiitidis
a6a3b9e7b4 Merge branch 'skmp/dca3-kos-gdrom' into 'main'
Update dca3-kos with gdrom dma code

See merge request skmp/dca3-game!5
2024-12-29 09:41:40 +00:00
Stefanos Kornilios Mitsis Poiitidis
ddfc21dd97 Update dca3-kos with gdrom dma code 2024-12-29 11:35:59 +02:00
Soniccd123
62bfbbc3a7 Fix Labels, Fix compiling error 2024-12-28 20:16:14 -03:00
Soniccd123
a4342f3abf Merge remote-tracking branch 'origin/main' into soniccd123/HintMessagesV2 2024-12-28 18:09:58 -03:00
Stefanos Kornilios Mitsis Poiitidis
8023daf18a Merge branch 'soniccd123/rstickquerytest-2' into 'main'
Implement dual stick, new bindings, lots of other things

See merge request skmp/dca3-game!4
2024-12-28 15:45:48 +00:00
Stefanos Kornilios Mitsis Poiitidis
6c39b294ca Add cdi baking instructions 2024-12-28 07:07:31 +00:00
Soniccd123
2e0dcf9c3f Try fix Sim building 2024-12-28 03:14:06 -03:00
Soniccd123
77e43aa727 Typos, need to wait for merging of some dependencies on other PR 2024-12-27 20:19:29 -03:00
Soniccd123
e7b97ed558 Hints V2
Made the hints change depending on controller scheme selected, corrected some mis-bindings
2024-12-27 20:13:16 -03:00
Soniccd123
d0c97eedb5 Added command to center camera on player when walking, double click X button to do it 2024-12-28 00:03:54 +02:00
Soniccd123
267f39b9fd Should actually fix the unpluggin problem, also reset Dual analog state when reconnected, in case a normal controller is connected 2024-12-28 00:03:54 +02:00
Soniccd123
76c5fae015 Fixes unplugging and pluggin back controller bug 2024-12-28 00:03:54 +02:00
Soniccd123
f179638f46 More fixes, added dead zone for analogs 2024-12-28 00:03:54 +02:00
Soniccd123
8e6a952da3 New RightStick querying code 2024-12-28 00:03:54 +02:00
Soniccd123
970ac8c691 Bug fix: Camera falling 2024-12-28 00:03:54 +02:00
Soniccd123
fcd2e4bb91 Test new query method for Right Stick availability 2024-12-28 00:03:54 +02:00
Soniccd123
1e03ff65d8 Fixed controll bugs, Enabled controller config menu, PS2 like layout is finished, Testing is needed on Xbox and PS2 dual stick modes 2024-12-28 00:03:54 +02:00
Soniccd123
c458e6c466 Implement dual stick, new bindings
Create bindings options for PS2 and Xbox like controll schemes, PS2 and Xbox bindings for dual stick
2024-12-28 00:03:54 +02:00
Stefanos Kornilios Mitsis Poiitidis
a12489844b tweak the build id a bit 2024-12-27 19:33:43 +02:00
Stefanos Kornilios Mitsis Poiitidis
d06d827833 Merge branch 'skmp/git-build-ci-ids' into 'main'
tag executables with build, git and CI ids

See merge request skmp/dca3-game!3
2024-12-27 17:21:06 +00:00
Stefanos Kornilios Mitsis Poiitidis
0e3fd254b0 Refactor makefiles, a bit 2024-12-27 19:07:30 +02:00
Stefanos Kornilios Mitsis Poiitidis
0bfd0a3b06 limit build id t0 10 chars, add to menus 2024-12-27 18:52:41 +02:00
Stefanos Kornilios Mitsis Poiitidis
9a91660f50 Git, Build and CI ids, show them on crash screens; stash a copy of the source in the cdi on repack 2024-12-27 18:22:51 +02:00
Stefanos Kornilios Mitsis Poiitidis
5a7dd57720 Add cdi success messages 2024-12-27 09:23:20 +02:00
Stefanos Kornilios Mitsis Poiitidis
292a83165b Merge branch 'skmp/add-C565-C4444-textures' into 'main'
Add support for C565 and C4444 on texture import, some game distro uses those in particle.txd

See merge request skmp/dca3-game!2
2024-12-26 19:06:44 +00:00
Stefanos Kornilios Mitsis Poiitidis
4e8f09ac66 Add support for C565 and C4444 on texture import, some game distro uses those in particle.txd 2024-12-26 21:01:15 +02:00
Stefanos Kornilios Mitsis Poiitidis
d523140fa4 Silence all touches for faster build 2024-12-26 17:17:46 +02:00
Stefanos Kornilios Mitsis Poiitidis
6a1fbd3704 MAke texconv and aud2adpcm error code positive, for mingw compat 2024-12-26 17:17:21 +02:00
Stefanos Kornilios Mitsis Poiitidis
4c07bbfd53 Make KOS_BASE optional 2024-12-26 13:23:28 +02:00
49 changed files with 2751 additions and 787 deletions

2
.gitignore vendored
View File

@@ -387,4 +387,6 @@ dreamcast/aud2adpcm*
dreamcast/repack-data
dreamcast/output.map
dreamcast/dca3.ds.iso
dreamcast/git-version.h
dreamcast/git-version.tmp
.DS_Store

View File

@@ -6,15 +6,70 @@ re3 a fully reversed source code for GTA III.
This project was started by [Stefanos Kornilios Mitsis Poiitidis](https://x.com/poiitidis) and uses [KallistiOS](https://kos-docs.dreamcast.wiki/).
## Building
## Baking the CDI
### Prerequisites
You need GTA 3 installed. This version has been tested and works: https://store.rockstargames.com/game/buy-grand-theft-auto-the-trilogy.
dca3 requires PC game assets to work, so you **must** have GTA III. We have tested the 2cd version, others might work.
Please note that *SOME VERSIONS* of the game may not work. It has been reported that `d4_gta.mp3` is corrupted sometimes.
You need to have installed:
Make sure you have a LEGIT copy with no corrupted files, as this process wont work otherwise.
- GTA III PC
- [DreamSDK R3](https://github.com/dreamsdk/dreamsdk/releases/tag/r3-3.0.4.2311)
- more instructions to follow soon
You will also need the following tools installed
- git-scm http://git-scm.com/downloads/win
- dreamsdk r3 https://github.com/dreamsdk/dreamsdk/releases
### Preparing the gta3 folder
- Open dreamsdk shell
- type `mkdir gta3` (and press enter)
- type `explorer .` (and press enter)
- This will open a folder named gta3. Copy your gta3 files in there.
- If you use the 2cdrom version of the game, make sure to also copy the contents of the play disc to this folder.
- close the folder and the dreamsdk shell and proceed to the next step.
### Cloning the dca3-game repo and downloading the prebuilt elf
- Open dreamsdk shell
- type `git clone --branch alpha https://gitlab.com/skmp/dca3-game.git` (and press enter)
- It should take a moment and successfully clone the repo
- type `cd dca3-game/dreamcast` (and press enter)
- type `explorer .` (and press enter).
- A folder named dreamcast with some files should be open. Keep it on the side.
- Download the Alpha Prebuilt Elf from https://gitlab.com/skmp/dca3-game/-/releases
- Open artifacts.zip and extract dca3.elf to the folder that was kept open before.
- Close the folder and dreamsdk shell
### Repacking and making a prebuilt cdi FOR GD-EMU
- Open dreamsdk shell
- type `cd dca3-game/dreamcast` (and press enter)
- type `make cdi-prebuilt` (and press enter)
- This should take a while (5-15 mins)
- Due to an issue with dreamsdk, this won't fully complete the first time
- type `make cdi-prebuilt` (and press enter)
- It will continue where it left off before
- It should run to completion now and show "*** Repack Completed Successfully ***"
- type `explorer .` (and press enter)
- The dreamcast folder should open up, and it should contain dca3.cdi for you (~ 900 megs)
### Repacking and making a prebuilt cdi FOR burning CD-ROM
- Open dreamsdk shell
- type `cd dca3-game/dreamcast` (and press enter)
- type `make FOR_DISC=1 cdi-prebuilt` (and press enter)
- This should take a while (5-15 mins)
- Due to an issue with dreamsdk, this won't fully complete the first time
- type `make FOR_DISC=1 cdi-prebuilt` (and press enter)
- It will continue where it left off before
- It should run to completion now and show "*** Repack Completed Successfully ***"
- type `explorer .` (and press enter)
- The dreamcast folder should open up, and it should contain dca3.cdi for you (~ 700 megs or ~260 megs)
- If the .cdi is not ~ 700 megs (linux/mkdcdisc) or ~260 megs (windows/cdi4dc), then you did something wrong.
- You can type `rm -rf repack-data` (and press enter)
- And then start this step from the beggining
## How to report issues
- Take a photo of your tv/monitor and vmu
- open a ticket via https://gitlab.com/skmp/dca3-game/-/issues/new
- state which elf you have used (eg, https://gitlab.com/skmp/dca3-game/-/jobs/8725216645)
- write something descriptive of what is/went wrong
## License

View File

@@ -40,6 +40,8 @@ AUDIO_STREAM_OPTION=-q
MKDCDISC_PAD_OPTION=
endif
all: $(TARGET)
include common.mk
OBJS = $(RE3_OBJS) $(RW_OBJS) \
@@ -77,6 +79,9 @@ OBJS_TEXCONV += \
../vendor/librw/src/d3d-x/d3d.texconv.o \
../vendor/librw/src/d3d-x/d3d8.texconv.o \
../vendor/librw/src/d3d-x/d3d8render.texconv.o \
../vendor/librw/src/bmp.texconv.o \
../vendor/librw/src/png.texconv.o \
../vendor/librw/src/lodepng/lodepng.texconv.o
# Add compilation units to this list to explicity compile them with
# -O3 optimizations, while the rest get the default (-Os) treatment
@@ -100,11 +105,11 @@ OBJS_NO_FAST_MATH = \
KOS_CPPFLAGS += -fbuiltin -ffast-math -ffp-contract=fast \
-mfsrra -mfsca
# The rm-elf step is to remove the target before building, to force the
# re-creation of the rom disk.
all: $(TARGET)
ifdef KOS_BASE
include $(KOS_BASE)/Makefile.rules
else
$(warning "KOS_BASE is not set. Only prebuilt targets will work.")
endif
DEPS = $(OBJS:.o=.d) $(OBJS_TEXCONV:.o:.d)
@@ -153,7 +158,7 @@ $(OBJS_NO_FAST_MATH): %.o: %.cpp
$(TARGET): $(OBJS)
kos-c++ -o $(TARGET) $(OBJS) -Wl,--gc-sections -Wl,--as-needed -Wl,-Map,output.map \
-flto=auto $(if $(WITH_IDE),-lkosfat) $(if $(WITH_SD),-lkosfat)
-flto=auto $(if $(WITH_IDE),-lkosfat) $(if $(WITH_SD),-lkosfat) -Wl,--build-id=sha1
@echo && echo && echo "*** Build Completed Successfully ***" && echo && echo
run: $(TARGET)
@@ -210,22 +215,28 @@ $(PROJECT_NAME)-prebuilt.iso: IP.BIN 1ST_READ_PREBUILT.BIN $(REPACK_DIR)/repacke
ifeq ($(HAVE_CDI4DC), yes)
$(PROJECT_NAME).cdi: $(PROJECT_NAME).iso
cdi4dc $(PROJECT_NAME).iso $(PROJECT_NAME).cdi > cdi.log
@echo && echo && echo "*** CDI Baked Successfully ***" && echo && echo
$(PROJECT_NAME)-no-repack.cdi: $(PROJECT_NAME)-no-repack.iso
cdi4dc $(PROJECT_NAME)-no-repack.iso $(PROJECT_NAME)-no-repack.cdi > cdi.log
@echo && echo && echo "*** CDI Baked Successfully ***" && echo && echo
$(PROJECT_NAME)-prebuilt.cdi: $(PROJECT_NAME)-prebuilt.iso
cdi4dc $(PROJECT_NAME).iso $(PROJECT_NAME).cdi > cdi.log
rm 1ST_READ_PREBUILT.BIN
@echo && echo && echo "*** CDI Baked Successfully ***" && echo && echo
else
$(PROJECT_NAME).cdi: $(TARGET) $(REPACK_DIR)/repacked $(REPACK_GTA_DIR)/GTA3SF8.b
mkdcdisc -e $(TARGET) -o $(PROJECT_NAME).cdi -d $(REPACK_GTA_DIR)/ $(MKDCDISC_PAD_OPTION) -n DCA3 -a "the gang"
@echo && echo && echo "*** CDI Baked Successfully ***" && echo && echo
$(PROJECT_NAME)-no-repack.cdi: $(TARGET) $(REPACK_GTA_DIR)/GTA3SF8.b
mkdcdisc -e $(TARGET) -o $(PROJECT_NAME)-no-repack.cdi -d $(REPACK_GTA_DIR)/ $(MKDCDISC_PAD_OPTION) -n DCA3 -a "the gang"
@echo && echo && echo "*** CDI Baked Successfully ***" && echo && echo
$(PROJECT_NAME)-prebuilt.cdi: $(REPACK_DIR)/repacked $(REPACK_GTA_DIR)/GTA3SF8.b
mkdcdisc -e $(TARGET) -o $(PROJECT_NAME).cdi -d $(REPACK_GTA_DIR)/ $(MKDCDISC_PAD_OPTION) -n DCA3 -a "the gang"
@echo && echo && echo "*** CDI Baked Successfully ***" && echo && echo
endif
cdi: $(PROJECT_NAME).cdi
@@ -308,6 +319,22 @@ TXD_OPTS_NEWS = 512 512
TXD_OPTS_SPLASH1 = 512 512
TXD_OPTS_SPLASH2 = 512 512
TXD_OPTS_SPLASH3 = 512 512
TXD_OPTS_frontend = 512 512 \
--delete-tex "fe_arrows4" \
--delete-tex "fe_arrows2" \
--delete-tex "fe_arrows1" \
--delete-tex "fe_controllersh" \
--delete-tex "fe_controller" \
\
--include-tex assets/dc_ps2d.png dc_ps2d \
--include-tex assets/dc_ps2f.png dc_ps2f \
--include-tex assets/dc_xboxd.png dc_xboxd \
--include-tex assets/dc_xboxf.png dc_xboxf \
--include-tex assets/ps4_d.png ps4_d \
--include-tex assets/ps4_f.png ps4_f \
--include-tex assets/xbox_d.png xbox_d \
--include-tex assets/xbox_f.png xbox_f
DEFAULT_RES = 512
PVR_ENCODER ?= PVRTEX
@@ -345,7 +372,8 @@ STREAM_WAV_DECODED = $(addprefix $(REPACK_STREAM_DECODED_DIR)/, $(STREAM_WAV))
$(REPACK_DIR)/repacked: $(REPACK_GTA_DIR)/models/gta3.img $(REPACK_GTA_DIR)/models/gta3.dir $(LOOSE_FILES_DC) $(STREAM_ADPCM_DC) $(SFX_DC_RAW) $(SFX_DC_DSC)
mkdir -p $(@D)
touch $@
@git archive --format zip --output "$(REPACK_GTA_DIR)/DCA3-$(GIT_VERSION).zip" HEAD
@touch $@
@echo && echo && echo "*** Repack Completed Successfully ***" && echo && echo
$(REPACK_DIR)/unpacked: imgtool $(GTA_DIR)/models/gta3.img $(GTA_DIR)/models/gta3.dir
@@ -425,20 +453,20 @@ $(REPACK_DIR)/packed: $(IMG_TEXTURES_DC) $(IMG_MODELS_DC)
mkdir -p $(@D)
mkdir -p "$(REPACK_GTA_DIR)/models/gta3"
./imgtool pack "$(REPACK_GTA_DIR)/models/gta3" "$(REPACK_IMG_DC_DIR)"
touch $@
@touch $@
$(REPACK_GTA_DIR)/models/gta3.img $(REPACK_GTA_DIR)/models/gta3.dir: $(REPACK_DIR)/packed
touch $@
@touch $@
# sfx processing
$(REPACK_DIR)/unpacked-sfx: extract-sfx $(GTA_DIR)/audio/sfx.SDT $(GTA_DIR)/audio/sfx.RAW
mkdir -p $(@D)
mkdir -p "$(REPACK_SFX_ORIG_DIR)"
./extract-sfx "$(GTA_DIR)/audio/sfx.SDT" "$(GTA_DIR)/audio/sfx.RAW" "$(REPACK_SFX_ORIG_DIR)"
touch $@
@touch $@
$(SFX_ORIG): $(REPACK_DIR)/unpacked-sfx
touch $@
@touch $@
$(SFX_ORIG_LOOP): $(SFX_ORIG)
@touch $@

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

BIN
dreamcast/assets/ps4_d.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
dreamcast/assets/ps4_f.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

BIN
dreamcast/assets/xbox_d.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
dreamcast/assets/xbox_f.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View File

@@ -278,17 +278,17 @@ int validate_wav_header(wavhdr_t *wavhdr, wavhdr3_t *wavhdr3, int format, int bi
if (memcmp(wavhdr->hdr1, "RIFF", 4)) {
fprintf(stderr, "Invalid RIFF header.\n");
result = -1;
result = 1;
}
if (memcmp(wavhdr->hdr2, "WAVEfmt ", 8)) {
fprintf(stderr, "Invalid WAVEfmt header.\n");
result = -1;
result = 1;
}
if (wavhdr->hdrsize < 0x10) {
fprintf(stderr, "Invalid header size, %d bytes\n", wavhdr->hdrsize);
result = -1;
result = 1;
} else if (wavhdr->hdrsize > 0x10) {
fprintf(stderr, "Unusual header size, seeking %d bytes\n", wavhdr->hdrsize - 0x10);
fseek(in, wavhdr->hdrsize - 0x10, SEEK_CUR);
@@ -296,29 +296,29 @@ int validate_wav_header(wavhdr_t *wavhdr, wavhdr3_t *wavhdr3, int format, int bi
if (wavhdr->format != format) {
fprintf(stderr, "Unsupported format.\n");
result = -1;
result = 1;
}
if (wavhdr->channels != 1 && wavhdr->channels != 2) {
fprintf(stderr, "Unsupported number of channels.\n");
result = -1;
result = 1;
}
if (wavhdr->bits != bits) {
fprintf(stderr, "Unsupported bit depth.\n");
result = -1;
result = 1;
}
for (;;) {
if (fread(wavhdr3->hdr3, 1, 4, in) != 4) {
fprintf(stderr, "Failed to read next chunk header!\n");
result = -1;
result = 1;
break;
}
if (fread(&wavhdr3->datasize, 1, 4, in) != 4) {
fprintf(stderr, "Failed to read chunk size!\n");
result = -1;
result = 1;
break;
}
@@ -446,7 +446,7 @@ int aud2adpcm(const char *infile, const char *outfile, int use_hdr, int to_mono,
!loadMp3(infile, &pcmsize, &pcmbuf, &channels, &freq) &&
!loadWavIMA(infile, &pcmsize, &pcmbuf, &channels, &freq)) {
fprintf(stderr, "Cannot load input file as wav, mp3, or IMA ADPCM.\n");
return -1;
return 1;
}
if (to_mono && channels == 2) {
@@ -544,7 +544,7 @@ int aud2adpcm(const char *infile, const char *outfile, int use_hdr, int to_mono,
fclose(out);
free(pcmbuf);
free(adpcmbuf);
return -1;
return 1;
}
fclose(out);
@@ -567,6 +567,7 @@ void usage() {
}
int main(int argc, char **argv) {
if (argc == 4) {
if (!strcmp(argv[1], "-t")) {
return aud2adpcm(argv[2], argv[3], 1, 0, 0);
@@ -576,10 +577,10 @@ int main(int argc, char **argv) {
return aud2adpcm(argv[2], argv[3], 0, 0, 0);
} else {
usage();
return -1;
return 1;
}
} else {
usage();
return -1;
return 1;
}
}

View File

@@ -1,3 +1,28 @@
GIT_VERSION := $(shell git describe --always --tags --long --dirty 2>/dev/null || echo "NO_GIT")
CI_JOB_ID ?= 00000000
git-version.tmp:
@echo "Generating git-version.tmp with GIT_VERSION = \"$(GIT_VERSION)\""
@echo "#pragma once" > git-version.tmp
@echo "#ifndef VERSION_H" >> git-version.tmp
@echo "#define VERSION_H" >> git-version.tmp
@echo "#define GIT_VERSION \"$(GIT_VERSION)\"" >> git-version.tmp
@echo "#define CI_JOB_ID \"$(CI_JOB_ID)\"" >> git-version.tmp
@echo "#endif // VERSION_H" >> git-version.tmp
git-version.h: git-version.tmp
@if [ ! -f git-version.h ] || ! cmp -s git-version.tmp git-version.h; then \
echo "Updating git-version.h"; \
cp git-version.tmp git-version.h; \
else \
echo "git-version.h is up to date. No change."; \
fi
.PHONY: git-version.tmp
../src/skel/dc/dc.cpp: git-version.h
# List all of your C files here, but change the extension to ".o"
# Include "romdisk.o" if you want a rom disk.

View File

@@ -3,6 +3,8 @@ TARGET ?= dca3-sim.elf
IS_MAC := $(shell uname -s | grep -i "darwin" > /dev/null && echo "yes" || echo "no")
all: $(TARGET)
include common.mk
OBJS = $(RE3_OBJS) $(RW_OBJS) \
@@ -52,8 +54,6 @@ else
$(CXX) -msse2 -mfpmath=sse -c -O3 -g -fno-pic -no-pie -o $@ $(CXXFLAGS) -I../vendor/koshle -I../vendor/emu -m32 -U_WIN32 -UWIN32 -UWINNT -Ui386 -DDC_SIM -D_FILE_OFFSET_BITS=64 $<
endif
all: $(TARGET)
clean:
-rm -f $(OBJS_SIM) $(TARGET)

View File

@@ -3,6 +3,7 @@
#include <cstring>
#include <set>
#include <vector>
#include <iostream>
using namespace std;
@@ -238,6 +239,40 @@ PluginAttach(void)
const char* currentFile;
namespace rw {
Image* readBMP(const char *filename);
Image* readPNG(const char *filename);
}
void InsertImage(RwTexDictionary* texDict, const char* file, const char* texName) {
RwTexture *tex;
RwRaster *raster;
RwInt32 width, height, depth, format;
RwImage *image = rw::readBMP(file);
if (!image) {
image = rw::readPNG(file);
}
assert(image);
RwImageFindRasterFormat(image, rwRASTERTYPETEXTURE, &width, &height, &depth, &format);
raster = RwRasterCreate(width, height, depth, format);
RwRasterSetFromImage(raster, image);
tex = RwTextureCreate(raster);
RwTextureSetName(tex, texName);
RwTextureSetFilterMode(tex, rwFILTERLINEAR);
RwTexDictionaryAddTexture(texDict, tex);
RwImageDestroy(image);
}
std::vector<std::pair<const char*, const char*>> ImagesToAdd;
std::vector<const char*> ImagesToRemove;
bool listTextures = false;
int main(int argc, const char** argv) {
if (argc >= 5) {
int width = atoi(argv[3]);
@@ -247,7 +282,7 @@ int main(int argc, const char** argv) {
if(height >= 16 && height <= 1024)
rw::dc::maxRasterHeight = height;
}
for (int i = 0; i < argc; i++) {
for (int i = 5; i < argc; i++) {
if (argv[i] != nullptr) {
// Downsample Parameter
if (strcmp(argv[i], "-d") == 0 || strcmp(argv[i], "-D") == 0) {
@@ -271,6 +306,22 @@ int main(int argc, const char** argv) {
}
}
}
if (strcmp(argv[i], "--include-tex") == 0) {
assert(i + 2 < argc);
ImagesToAdd.emplace_back(argv[i+1], argv[i+2]);
i += 2;
}
if (strcmp(argv[i], "--delete-tex") == 0) {
assert(i + 1 < argc);
ImagesToRemove.emplace_back(argv[i+1]);
i += 1;
}
if (strcmp(argv[i], "--list-tex") == 0) {
listTextures = true;
}
}
}
@@ -298,6 +349,31 @@ int main(int argc, const char** argv) {
RwStreamClose(stream, nil);
if (listTextures) {
fprintf(stdout, "Incoming textures:\n");
FORLIST(lnk, texDict->textures) {
auto tex = rw::Texture::fromDict(lnk);
fprintf(stdout, "texture: '%s'\n", tex->name);
}
}
for (auto&& removedTextureName: ImagesToRemove) {
auto removedTexture = texDict->find(removedTextureName);
assert(removedTexture);
texDict->remove(removedTexture);
}
for (auto&& extraTexture: ImagesToAdd) {
InsertImage(texDict, extraTexture.first, extraTexture.second);
}
if (listTextures) {
fprintf(stdout, "Processing textures:\n");
FORLIST(lnk, texDict->textures) {
auto tex = rw::Texture::fromDict(lnk);
fprintf(stdout, "texture: '%s'\n", tex->name);
}
}
auto streamOut = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMWRITE, argv[2]);
assert(streamOut && "failed to open output");
@@ -314,7 +390,7 @@ int main(int argc, const char** argv) {
StoreModelFile(argv[2], clump);
} else {
printf("Invalid format: %s\n", argv[1]);
return -1;
return 1;
}
return 0;

View File

@@ -3,100 +3,10 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DCA3 - A port of RE3 for Dreamcast</title>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background-color: #121212;
color: #ffffff;
}
.navbar {
background-color: #1f1f1f;
}
.hero {
text-align: center;
padding: 100px 20px;
background-color: #333333;
border-radius: 10px;
}
.features {
margin-top: 50px;
}
.footer {
text-align: center;
padding: 20px;
background-color: #1f1f1f;
margin-top: 20px;
border-radius: 10px;
}
</style>
<title>DCA3 Redirect</title>
<meta http-equiv="refresh" content="5;url=https://dca3.net">
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark">
<div class="container">
<a class="navbar-brand" href="#">DCA3</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#features">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#download">Download</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Hero Section -->
<div class="container">
<div class="hero mt-4">
<h1>DCA3</h1>
<p>The first-ever port of Grand Theft Auto III to the SEGA Dreamcast, built from the REGTA reverse engineering project.</p>
<a href="#download" class="btn btn-primary">Download Now</a>
</div>
</div>
<!-- Features Section -->
<div class="container features text-center">
<h2 id="features" class="mb-4">Key Features</h2>
<div class="row">
<div class="col-md-4">
<h3>Faithful Port</h3>
<p>Experience GTA3 as it was meant to be, now on the Dreamcast with okay visuals and sluggish gameplay.</p>
</div>
<div class="col-md-4">
<h3>Open Source</h3>
<p>Built on the REGTA reverse engineering project, ensuring accuracy and community-driven development.</p>
</div>
<div class="col-md-4">
<h3>First Release</h3>
<p>Celebrating our first release with not very much optimized performance and compatibility for Dreamcast hardware.</p>
</div>
</div>
</div>
<!-- Download Section -->
<div class="container text-center mt-5">
<h2 id="download" class="mb-4">Download DCA3</h2>
<p>Get started with the first release of and bring GTA3 to your Dreamcast. You'll need a PC copy of GTA3 to create your .cdi</p>
<a href="#" class="btn btn-success btn-lg">Download Version 1.0</a>
</div>
<!-- Footer -->
<footer class="footer mt-4">
<p>No rights reserved. Made with love for the Dreamcast community.</p>
</footer>
<!-- Bootstrap JS Bundle -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<p>You will be redirected to <a href="https://dca3.net">dca3.net</a> in 5 seconds.</p>
</body>
</html>
</html>

View File

@@ -140,7 +140,7 @@ CAnimBlendNode::GetCurrentTranslation(CVector &trans, float weight)
float blend = association->GetBlendAmount(weight);
if(blend > 0.0f){
auto kfAdt = sequence->GetDeltaTime(frameA);
float t = (kfAdt - remainingTime)/kfAdt;
float t = kfAdt == 0.0f ? 0.0f : (kfAdt - remainingTime)/kfAdt;
if(sequence->type & CAnimBlendSequence::KF_TRANS){
auto kfAt = sequence->GetTranslation(frameA);
auto kfBt = sequence->GetTranslation(frameB);

View File

@@ -3789,6 +3789,10 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
if (iSound > 60)
iSound = 21;
}
// In some cases the left and right channels have different loop points
// This looks like a data file issue where the left and right channels have different loop points
// This is a hot fix to always have the correct loop point for each channel individually
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
AddSampleToRequestedQueue();
}
}
@@ -6302,7 +6306,7 @@ cPedComments::Process()
{
case LOADING_STATUS_NOT_LOADED:
SampleManager.LoadPedComment(sampleIndex);
#ifdef GTA_PS2 // on PC ped comment is loaded at once
#if defined(GTA_PS2) || defined(RW_DC) // on PC ped comment is loaded at once
break;
#endif
case LOADING_STATUS_LOADED:

View File

@@ -174,6 +174,10 @@ public:
void UpdateEffectsVolume(void);
#ifdef DC_SH4
void UpdateChannelVolume(uint32 nChannel);
#endif
void SetEffectsMasterVolume(uint8 nVolume);
void SetMusicMasterVolume (uint8 nVolume);
void SetEffectsFadeVolume (uint8 nVolume);

View File

@@ -151,7 +151,6 @@ void aica_snd_sfx_freq_vol(int chn, int freq, int vol) {
cSampleManager SampleManager;
bool8 _bSampmanInitialised = FALSE;
bool _dcAudioInitialized = false;
uint32 BankStartOffset[MAX_SFX_BANKS];
char SampleBankDescFilename[] = "sfx/sfx_all.dsc";
@@ -166,8 +165,12 @@ struct sfx_bank {
std::map<int, sfx_bank> sfx_banks;
int nPedSlotSfx[MAX_PEDSFX];
uint32 nPedSlotSfxReqId[MAX_PEDSFX];
uintptr_t nPedSlotSfxAddr[MAX_PEDSFX];
uint8_t nCurrentPedSlot;
file_t fdPedSfx;
volatile uint32 nPedSfxReqReadId = 1;
volatile uint32 nPedSfxReqNextId = 1;
struct WavHeader {
// RIFF Header
@@ -442,23 +445,30 @@ cSampleManager::Initialise(void)
}
});
nPedSfxReqNextId = 1;
nPedSfxReqReadId = 1;
for ( int32 i = 0; i < MAX_PEDSFX; i++ )
{
nPedSlotSfx[i] = -1;
nPedSlotSfxReqId[i] = 0;
nPedSlotSfxAddr[i] = snd_mem_malloc(PED_BLOCKSIZE_ADPCM);
debugf("PedSlot %d buffer: %p\n", i, (void*)nPedSlotSfxAddr[i]);
}
nCurrentPedSlot = 0;
_dcAudioInitialized = true;
fdPedSfx = fs_open(SampleBankDataFilename, O_RDONLY);
assert(fdPedSfx >= 0);
_bSampmanInitialised = true;
return TRUE;
}
void
cSampleManager::Terminate(void)
{
fs_close(fdPedSfx);
}
bool8 cSampleManager::CheckForAnAudioFileOnCD(void)
@@ -474,7 +484,14 @@ char cSampleManager::GetCDAudioDriveLetter(void)
void
cSampleManager::UpdateEffectsVolume(void)
{
// TODO
if(_bSampmanInitialised) {
std::lock_guard<std::mutex> lk(channel_mtx);
for (int i = 0; i < MAXCHANNELS+MAX2DCHANNELS; i++) {
if (channels[i].ch != -1) {
UpdateChannelVolume(i);
}
}
}
}
@@ -637,7 +654,7 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment)
slot += ARRAY_SIZE(nPedSlotSfx);
#endif
if ( nComment == nPedSlotSfx[slot] )
return LOADING_STATUS_LOADED;
return nPedSlotSfxReqId[slot] <= nPedSfxReqReadId ? LOADING_STATUS_LOADED : LOADING_STATUS_LOADING;
}
return LOADING_STATUS_NOT_LOADED;
@@ -698,27 +715,28 @@ cSampleManager::LoadPedComment(uint32 nComment)
assert(m_aSamples[nComment].nByteSize < PED_BLOCKSIZE_ADPCM);
file_t fd = fs_open(SampleBankDataFilename, O_RDONLY);
assert(fd >= 0);
debugf("Loading ped comment %d, offset: %d, size: %d\n", nComment, m_aSamples[nComment].nFileOffset, m_aSamples[nComment].nByteSize);
fs_seek(fd, m_aSamples[nComment].nFileOffset, SEEK_SET);
CdStreamQueueAudioRead(nComment, (void*)nPedSlotSfxAddr[nCurrentPedSlot], m_aSamples[nComment].nByteSize, m_aSamples[nComment].nFileOffset, [](AudioReadCmd* cmd) {
debugf("Loading ped comment %d, offset: %d, size: %d\n", nComment, m_aSamples[nComment].nFileOffset, m_aSamples[nComment].nByteSize);
fs_seek(fdPedSfx, cmd->seek, SEEK_SET);
// TODO: When we can dma directly to AICA, we can use this instead
// fs_read(fd, SPU_BASE_U8 + nPedSlotSfxAddr[nCurrentPedSlot], sizeof(nPedSlotSfxAddr));
// TODO: When we can dma directly to AICA, we can use this instead
// fs_read(fdPedSfx, SPU_BASE_U8 + (uintptr_t)cmd->dest, cmd->size);
void* stagingBuffer = memalign(32, m_aSamples[nComment].nByteSize);
assert(stagingBuffer != 0);
debugf("Allocated %d bytes at %p\n", m_aSamples[nComment].nByteSize, stagingBuffer);
int rs = fs_read(fd, stagingBuffer, m_aSamples[nComment].nByteSize);
debugf("Read %d bytes, expected %d\n", rs, m_aSamples[nComment].nByteSize);
assert(rs == m_aSamples[nComment].nByteSize);
void* stagingBuffer = memalign(32, cmd->size);
assert(stagingBuffer != 0);
debugf("Allocated %d bytes at %p\n", cmd->size, stagingBuffer);
int rs = fs_read(fdPedSfx, stagingBuffer, cmd->size);
debugf("Read %d bytes, expected %d\n", rs, cmd->size);
assert(rs == cmd->size);
fs_close(fd);
spu_memload((uintptr_t)cmd->dest, stagingBuffer, cmd->size);
free(stagingBuffer);
nPedSfxReqReadId = nPedSfxReqReadId + 1;
});
spu_memload(nPedSlotSfxAddr[nCurrentPedSlot], stagingBuffer, m_aSamples[nComment].nByteSize);
free(stagingBuffer);
nPedSlotSfxReqId[nCurrentPedSlot] = ++nPedSfxReqNextId;
nPedSlotSfx[nCurrentPedSlot] = nComment;
if ( ++nCurrentPedSlot >= MAX_PEDSFX )
@@ -839,9 +857,10 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
return TRUE;
}
void updateVol(uint32 nChannel) {
void cSampleManager::UpdateChannelVolume(uint32 nChannel) {
auto newVol = channels[nChannel].emittingVol * channels[nChannel].attenuationVol / 255;
newVol = m_nEffectsFadeVolume * newVol * m_nEffectsVolume >> 14;
// newVol = 255;
// printf("updateVol(nChannel: %d) vol: %d, newVol: %d\n", nChannel, channels[nChannel].vol, newVol);
if (channels[nChannel].vol != newVol) {
@@ -864,7 +883,7 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
channels[nChannel].emittingVol = linearlize_volume(nVolume);// nVolume * 255 / MAX_VOLUME;
channels[nChannel].attenuationVol = 255;
updateVol(nChannel);
UpdateChannelVolume(nChannel);
verbosef("SetChannelVolume(nChannel: %d) vol: %d\n", nChannel, nVolume);
}
@@ -1120,7 +1139,8 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
debugf("StartStreamedFile(%d, %d, %d)\n", nFile, nPos, nStream);
uint32_t seek_aligned = 0;
if (nPos) {
uint32 seek_bytes = nPos * streams[nStream].rate / (streams[nStream].stereo ? 1000: 2000);
uint64_t seek_bytes = (uint64_t)nPos * streams[nStream].rate / (streams[nStream].stereo ? 1000: 2000);
assert(seek_bytes <= INT32_MAX);
seek_aligned = seek_bytes & ~(streams[nStream].stereo ? (STREAM_STAGING_READ_SIZE_STEREO-1) : (STREAM_STAGING_READ_SIZE_MONO-1));
}
PreloadStreamedFile(nFile, nStream, seek_aligned);
@@ -1152,7 +1172,9 @@ cSampleManager::GetStreamedFilePosition(uint8 nStream)
ASSERT( nStream < MAX_STREAMS );
int32 rv = 0;
return streams[nStream].played_samples * 1000 / streams[nStream].rate;
int64_t rv64 = (int64_t)streams[nStream].played_samples * 1000 / streams[nStream].rate;
assert(rv64 <= INT32_MAX);
rv = (int32)rv64;
// if(streams[nStream].fd >= 0) {
// rv = fs_tell(streams[nStream].fd);
// }
@@ -1167,6 +1189,7 @@ cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffect
if (nVolume > MAX_VOLUME)
nVolume = MAX_VOLUME;
nVolume = linearlize_volume(nVolume); //nVolume * 255 / MAX_VOLUME;
nVolume = m_nMusicFadeVolume * nVolume * m_nMusicVolume >> 14;
if (streams[nStream].vol != nVolume || streams[nStream].nPan != nPan) {
streams[nStream].vol = nVolume;
streams[nStream].nPan = nPan;
@@ -1195,7 +1218,10 @@ cSampleManager::GetStreamedFileLength(uint8 nFile)
WavHeader hdr;
assert(fs_read(fd, &hdr, sizeof(hdr)) == sizeof(hdr));
rv = hdr.dataSize * 2000 / hdr.numOfChan / hdr.samplesPerSec;
uint64_t rv64 = (uint64_t)hdr.dataSize * 2000 / hdr.numOfChan / hdr.samplesPerSec;
assert(rv64 <= INT32_MAX);
rv = (int32)rv64;
fs_close(fd);
@@ -1275,9 +1301,17 @@ void cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
if (nVolume > MAX_VOLUME)
nVolume = MAX_VOLUME;
// reduce channel volume when JB.MP3 or S4_BDBD.MP3 playing
if ( MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE
&& MusicManager.GetNextTrack() != STREAMED_SOUND_NEWS_INTRO
&& MusicManager.GetNextTrack() != STREAMED_SOUND_CUTSCENE_SAL4_BDBD )
{
nVolume /= 4;
}
std::lock_guard<std::mutex> lk(channel_mtx);
channels[nChannel].emittingVol = linearlize_volume(nVolume); // nVolume * 255 / MAX_VOLUME;
updateVol(nChannel);
UpdateChannelVolume(nChannel);
}
float calculatePan(float x, float z) {
@@ -1322,7 +1356,7 @@ void cSampleManager::SetChannel3DPosition (uint32 nChannel, float fX, float
channels[nChannel].fY = fY;
channels[nChannel].fZ = fZ;
channels[nChannel].attenuationVol = calculateAttenuation(channels[nChannel].fX, channels[nChannel].fY, channels[nChannel].fZ, channels[nChannel].distMin, channels[nChannel].distMax) * 255;
updateVol(nChannel);
UpdateChannelVolume(nChannel);
}
SetChannelPan(nChannel, calculatePan(-fX, fZ) * 63 + 64);
@@ -1335,7 +1369,7 @@ void cSampleManager::SetChannel3DDistances (uint32 nChannel, float fMax, floa
channels[nChannel].distMin = fMin;
channels[nChannel].distMax = fMax;
channels[nChannel].attenuationVol = calculateAttenuation(channels[nChannel].fX, channels[nChannel].fY, channels[nChannel].fZ, channels[nChannel].distMin, channels[nChannel].distMax) * 255;
updateVol(nChannel);
UpdateChannelVolume(nChannel);
}
#endif

View File

@@ -1721,8 +1721,8 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
return 0;
int attempts;
int model = -1;
int index = CGeneral::GetRandomNumberInRange(0, 50);
for (attempts = 0; attempts < 50; attempts++) {
int index = CGeneral::GetRandomNumberInRange(0, MAXVEHICLESLOADED);
for (attempts = 0; attempts < MAXVEHICLESLOADED; attempts++) {
if (model != -1)
break;
model = CStreaming::ms_vehiclesLoaded[index];

View File

@@ -1,4 +1,5 @@
#pragma once
#include <functional>
#define CDSTREAM_SECTOR_SIZE 2048
@@ -43,7 +44,14 @@ char *CdStreamGetImageName(int32 cd);
void CdStreamRemoveImages(void);
int32 CdStreamGetNumImages(void);
void CdStreamQueueAudioRead(int fd, void* pBuffer, size_t bytes, size_t seek);
struct AudioReadCmd {
void* dest;
int fd;
size_t size;
size_t seek;
std::function<void(AudioReadCmd*)> callback;
};
void CdStreamQueueAudioRead(int fd, void* pBuffer, size_t bytes, size_t seek, std::function<void(AudioReadCmd*)> callback = nullptr);
void CdStreamDiscardAudioRead(int fd);
#ifdef FLUSHABLE_STREAMING

View File

@@ -26,12 +26,6 @@
#include "CdStream.h"
#include "rwcore.h"
#include "MemoryMgr.h"
struct AudioReadCmd {
void* dest;
int fd;
size_t size;
size_t seek;
};
#define CDDEBUG(f, ...) debug ("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
#define CDTRACE(f, ...) printf("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
@@ -489,8 +483,16 @@ std::vector<AudioReadCmd> pendingAudioReads;
std::mutex pendingAudioReadsMutex;
#endif
// Will replace a previous read request for the same file descriptor
void CdStreamQueueAudioRead(int fd, void* pBuffer, size_t bytes, size_t seek) {
void CdStreamQueueAudioRead(int fd, void* pBuffer, size_t bytes, size_t seek, std::function<void(AudioReadCmd*)> callback) {
AudioReadCmd cmd = { pBuffer, fd, bytes, seek};
if (!callback) {
cmd.callback = [](AudioReadCmd* cmd){
lseek(cmd->fd, cmd->seek, SEEK_SET);
read(cmd->fd, cmd->dest, cmd->size);
};
} else {
cmd.callback = callback;
}
{
#if !defined(DC_SH4)
std::lock_guard<std::mutex> lock(pendingAudioReadsMutex);
@@ -514,6 +516,7 @@ void CdStreamQueueAudioRead(int fd, void* pBuffer, size_t bytes, size_t seek) {
sem_post(gCdStreamSema);
}
void CdStreamDiscardAudioRead(int fd) {
#if !defined(DC_SH4)
std::lock_guard<std::mutex> lock(pendingAudioReadsMutex);
@@ -564,8 +567,7 @@ int read_loop(int fd, void* pBuffer, size_t bytes) {
total_read += read_bytes;
auto cmd = CdStreamNextAudioRead();
while (cmd.fd != -1) {
lseek(cmd.fd, cmd.seek, SEEK_SET);
read(cmd.fd, cmd.dest, cmd.size);
cmd.callback(&cmd);
cmd = CdStreamNextAudioRead();
}
}
@@ -581,8 +583,7 @@ void *CdStreamThread(void *param)
auto cmd = CdStreamNextAudioRead();
while (cmd.fd != -1) {
lseek(cmd.fd, cmd.seek, SEEK_SET);
read(cmd.fd, cmd.dest, cmd.size);
cmd.callback(&cmd);
cmd = CdStreamNextAudioRead();
}

380
src/core/ControllerConfig.cpp Normal file → Executable file
View File

@@ -2054,21 +2054,60 @@ wchar *CControllerConfigManager::GetControllerSettingTextWithOrderNumber(e_Contr
static const char* Dreamcast_DPad_Down = "D-Pad Down";
static const char* Dreamcast_DPad_Left = "D-Pad Left";
static const char* Dreamcast_DPad_Right = "D-Pad Right";
static const char* Dreamcast_LefAnalog_Up = "Joystick Up";
static const char* Dreamcast_LefAnalog_Down = "Joystick Down";
static const char* Dreamcast_LefAnalog_Left = "Joystick Left";
static const char* Dreamcast_LefAnalog_Right = "Joystick Right";
static const char* Dreamcast_NotAssigned = "Not Assigned";
static const char* Dreamcast_Stick_Up = "Joystick Up";
static const char* Dreamcast_Stick_Down = "Joystick Down";
static const char* Dreamcast_Stick_Left = "Joystick Left";
static const char* Dreamcast_Stick_Right = "Joystick Right";
static const char* Dreamcast_VehicleLookLeft = "A + Joystick Left";
static const char* Dreamcast_VehicleLookRight = "A + Joystick Right";
static const char* Dreamcast_CenterCamera = "Double click X";
static const char* Dreamcast_CameraUp = "X + Joystick Up";
static const char* Dreamcast_CameraDown = "X + Joystick Down";
static const char* Dreamcast_CameraLeft = "X + Joystick Left";
static const char* Dreamcast_CameraRight = "X + Joystick Right";
static const char* Dreamcast_LookBehind = "Right trigger + Left trigger";
static const char* Dreamcast_NotAssigned = "Not Assigned";
if (CMenuManager::m_ControlMethod == CONTROL_CLASSIC) // CONTROL_CLASSIC
//Dual sticks
static const char* LefAnalog_Up = "Left Stick Up";
static const char* LefAnalog_Down = "Left Stick Down";
static const char* LefAnalog_Left = "Left Stick Left";
static const char* LefAnalog_Right = "Left Stick Right";
static const char* RightAnalog_Up = "Right Stick Up";
static const char* RightAnalog_Down = "Right Stick Down";
static const char* RightAnalog_Left = "Right Stick Left";
static const char* RightAnalog_Right = "Right Stick Right";
//Xbox Specific
static const char* Xbox_VehicleLookLeft = "LB";
static const char* Xbox_VehicleLookRight = "RB";
static const char* Xbox_VehicleLookBehind = "RB + LB";
static const char* Xbox_Back = "Back";
//PS2 Specific
static const char* Dreamcast_PS2_VehicleLookLeft = "B + Joystick Left";
static const char* Dreamcast_PS2_VehicleLookRight = "B + Joystick Right";
static const char* PS2_L1 = "L1";
static const char* PS2_R1 = "R1";
static const char* PS2_L2 = "L2";
static const char* PS2_R2 = "R2";
static const char* PS2_Cross = "Cross";
static const char* PS2_Square = "Square";
static const char* PS2_Circle = "Circle";
static const char* PS2_Triangle = "Triangle";
if ((CPad::GetPad(0)->Mode == 0) && (CPad::GetPad(0)->IsDualAnalog == 0)) // Standard DC controller, Xbox like bindings
{
switch (action)
{
case VEHICLE_LOOKLEFT:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Left[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_VehicleLookLeft[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_LOOKRIGHT:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Right[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_VehicleLookRight[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_HORN:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Down[i]) != '\0' && i < iLimitCopy; i++);
@@ -2083,28 +2122,28 @@ wchar *CControllerConfigManager::GetControllerSettingTextWithOrderNumber(e_Contr
for (int i = 0; (ActionText[i] = Dreamcast_RightTrigger[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_CHANGE_RADIO_STATION:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Right[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Left[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_BRAKE:
for (int i = 0; (ActionText[i] = Dreamcast_LeftTrigger[i]) != '\0' && i < iLimitCopy; i++);
break;
case TOGGLE_SUBMISSIONS:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Left[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Right[i]) != '\0' && i < iLimitCopy; i++);
break;
case GO_LEFT:
for (int i = 0; (ActionText[i] = Dreamcast_LefAnalog_Left[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_Stick_Left[i]) != '\0' && i < iLimitCopy; i++);
break;
case GO_RIGHT:
for (int i = 0; (ActionText[i] = Dreamcast_LefAnalog_Right[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_Stick_Right[i]) != '\0' && i < iLimitCopy; i++);
break;
case GO_FORWARD:
for (int i = 0; (ActionText[i] = Dreamcast_LefAnalog_Up[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_Stick_Up[i]) != '\0' && i < iLimitCopy; i++);
break;
case GO_BACK:
for (int i = 0; (ActionText[i] = Dreamcast_LefAnalog_Down[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_Stick_Down[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_LOOKBEHIND:
for (int i = 0; (ActionText[i] = Dreamcast_LefAnalog_Down[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Down[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_FIREWEAPON:
for (int i = 0; (ActionText[i] = Dreamcast_RightTrigger[i]) != '\0' && i < iLimitCopy; i++);
@@ -2122,22 +2161,22 @@ wchar *CControllerConfigManager::GetControllerSettingTextWithOrderNumber(e_Contr
for (int i = 0; (ActionText[i] = Dreamcast_LeftTrigger[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_JUMPING:
for (int i = 0; (ActionText[i] = Dreamcast_X[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_B[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_SPRINT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_CYCLE_TARGET_LEFT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Left[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_CYCLE_TARGET_RIGHT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Right[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_CENTER_CAMERA_BEHIND_PLAYER:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_CenterCamera[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_SNIPER_ZOOM_IN:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_X[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_SNIPER_ZOOM_OUT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
@@ -2170,7 +2209,7 @@ wchar *CControllerConfigManager::GetControllerSettingTextWithOrderNumber(e_Contr
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Up[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_LOOKBEHIND:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Down[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_LookBehind[i]) != '\0' && i < iLimitCopy; i++);
break;
case NETWORK_TALK: // Not Used on Dreamcast
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
@@ -2198,15 +2237,15 @@ wchar *CControllerConfigManager::GetControllerSettingTextWithOrderNumber(e_Contr
break;
}
}
else // CONTROL_STANDARD
if ((CPad::GetPad(0)->Mode == 0) && (CPad::GetPad(0)->IsDualAnalog == 1)) // Dual analog, Xbox like bindings
{
switch (action)
{
case VEHICLE_LOOKLEFT:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Left[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Xbox_VehicleLookLeft[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_LOOKRIGHT:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Right[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Xbox_VehicleLookRight[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_HORN:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Down[i]) != '\0' && i < iLimitCopy; i++);
@@ -2230,19 +2269,19 @@ wchar *CControllerConfigManager::GetControllerSettingTextWithOrderNumber(e_Contr
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Left[i]) != '\0' && i < iLimitCopy; i++);
break;
case GO_LEFT:
for (int i = 0; (ActionText[i] = Dreamcast_LefAnalog_Left[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = LefAnalog_Left[i]) != '\0' && i < iLimitCopy; i++);
break;
case GO_RIGHT:
for (int i = 0; (ActionText[i] = Dreamcast_LefAnalog_Right[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = LefAnalog_Right[i]) != '\0' && i < iLimitCopy; i++);
break;
case GO_FORWARD:
for (int i = 0; (ActionText[i] = Dreamcast_LefAnalog_Up[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = LefAnalog_Up[i]) != '\0' && i < iLimitCopy; i++);
break;
case GO_BACK:
for (int i = 0; (ActionText[i] = Dreamcast_LefAnalog_Down[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = LefAnalog_Down[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_LOOKBEHIND:
for (int i = 0; (ActionText[i] = Dreamcast_LefAnalog_Down[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Down[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_FIREWEAPON:
for (int i = 0; (ActionText[i] = Dreamcast_RightTrigger[i]) != '\0' && i < iLimitCopy; i++);
@@ -2266,17 +2305,155 @@ wchar *CControllerConfigManager::GetControllerSettingTextWithOrderNumber(e_Contr
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_CYCLE_TARGET_LEFT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Left[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_CYCLE_TARGET_RIGHT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Right[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_CENTER_CAMERA_BEHIND_PLAYER:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
for (int i = 0; (ActionText[i] = Dreamcast_CenterCamera[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_SNIPER_ZOOM_IN:
for (int i = 0; (ActionText[i] = Dreamcast_X[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_SNIPER_ZOOM_OUT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_1RST_PERSON_LOOK_LEFT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_1RST_PERSON_LOOK_RIGHT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_1RST_PERSON_LOOK_UP:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_1RST_PERSON_LOOK_DOWN:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_TURRETLEFT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_TURRETRIGHT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_TURRETUP:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_TURRETDOWN:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case CAMERA_CHANGE_VIEW_ALL_SITUATIONS:
for (int i = 0; (ActionText[i] = Xbox_Back[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_LOOKBEHIND:
for (int i = 0; (ActionText[i] = Xbox_VehicleLookBehind[i]) != '\0' && i < iLimitCopy; i++);
break;
case NETWORK_TALK: // Not Used on Dreamcast
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;
case _CONTROLLERACTION_36: // What is that???
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;
case TOGGLE_DPAD: // Not Used on Dreamcast
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;
case SWITCH_DEBUG_CAM_ON: // Not Used on Dreamcast
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;
case TAKE_SCREEN_SHOT: // Not Used on Dreamcast
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;
case SHOW_MOUSE_POINTER_TOGGLE: // Not Used on Dreamcast
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;
case MAX_CONTROLLERACTIONS: // Not Used on Dreamcast
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;
default:
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;
}
}
if ((CPad::GetPad(0)->Mode == 1) && (CPad::GetPad(0)->IsDualAnalog == 0)) // Standard DC controller, PS2 like bindings
{
switch (action)
{
case VEHICLE_LOOKLEFT:
for (int i = 0; (ActionText[i] = Dreamcast_PS2_VehicleLookLeft[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_LOOKRIGHT:
for (int i = 0; (ActionText[i] = Dreamcast_PS2_VehicleLookRight[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_HORN:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Down[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_HANDBRAKE:
for (int i = 0; (ActionText[i] = Dreamcast_RightTrigger[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_ENTER_EXIT:
for (int i = 0; (ActionText[i] = Dreamcast_Y[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_ACCELERATE:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_CHANGE_RADIO_STATION:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Left[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_BRAKE:
for (int i = 0; (ActionText[i] = Dreamcast_X[i]) != '\0' && i < iLimitCopy; i++);
break;
case TOGGLE_SUBMISSIONS:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Right[i]) != '\0' && i < iLimitCopy; i++);
break;
case GO_LEFT:
for (int i = 0; (ActionText[i] = Dreamcast_Stick_Left[i]) != '\0' && i < iLimitCopy; i++);
break;
case GO_RIGHT:
for (int i = 0; (ActionText[i] = Dreamcast_Stick_Right[i]) != '\0' && i < iLimitCopy; i++);
break;
case GO_FORWARD:
for (int i = 0; (ActionText[i] = Dreamcast_Stick_Up[i]) != '\0' && i < iLimitCopy; i++);
break;
case GO_BACK:
for (int i = 0; (ActionText[i] = Dreamcast_Stick_Down[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_LOOKBEHIND:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Down[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_FIREWEAPON:
for (int i = 0; (ActionText[i] = Dreamcast_B[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_FIREWEAPON:
for (int i = 0; (ActionText[i] = Dreamcast_B[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_CYCLE_WEAPON_LEFT:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Left[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_CYCLE_WEAPON_RIGHT:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Right[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_LOCK_TARGET:
for (int i = 0; (ActionText[i] = Dreamcast_RightTrigger[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_JUMPING:
for (int i = 0; (ActionText[i] = Dreamcast_X[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_SPRINT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_CYCLE_TARGET_LEFT:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Left[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_CYCLE_TARGET_RIGHT:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Right[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_CENTER_CAMERA_BEHIND_PLAYER:
for (int i = 0; (ActionText[i] = Dreamcast_CenterCamera[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_SNIPER_ZOOM_IN:
for (int i = 0; (ActionText[i] = Dreamcast_X[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_SNIPER_ZOOM_OUT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
@@ -2308,8 +2485,147 @@ wchar *CControllerConfigManager::GetControllerSettingTextWithOrderNumber(e_Contr
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Up[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_LOOKBEHIND:
for (int i = 0; (ActionText[i] = Dreamcast_LookBehind[i]) != '\0' && i < iLimitCopy; i++);
break;
case NETWORK_TALK: // Not Used on Dreamcast
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;
case _CONTROLLERACTION_36: // What is that???
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;
case TOGGLE_DPAD: // Not Used on Dreamcast
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;
case SWITCH_DEBUG_CAM_ON: // Not Used on Dreamcast
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;
case TAKE_SCREEN_SHOT: // Not Used on Dreamcast
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;
case SHOW_MOUSE_POINTER_TOGGLE: // Not Used on Dreamcast
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;
case MAX_CONTROLLERACTIONS: // Not Used on Dreamcast
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;
default:
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;
}
}
if ((CPad::GetPad(0)->Mode == 1) && (CPad::GetPad(0)->IsDualAnalog == 1)) // Dual Stick, PS2 like bindings
{
switch (action)
{
case VEHICLE_LOOKLEFT:
for (int i = 0; (ActionText[i] = PS2_L2[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_LOOKRIGHT:
for (int i = 0; (ActionText[i] = PS2_R2[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_HORN:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Down[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_HANDBRAKE:
for (int i = 0; (ActionText[i] = PS2_R1[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_ENTER_EXIT:
for (int i = 0; (ActionText[i] = PS2_Triangle[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_ACCELERATE:
for (int i = 0; (ActionText[i] = PS2_Cross[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_CHANGE_RADIO_STATION:
for (int i = 0; (ActionText[i] = PS2_L1[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_BRAKE:
for (int i = 0; (ActionText[i] = PS2_Square[i]) != '\0' && i < iLimitCopy; i++);
break;
case TOGGLE_SUBMISSIONS:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Right[i]) != '\0' && i < iLimitCopy; i++);
break;
case GO_LEFT:
for (int i = 0; (ActionText[i] = LefAnalog_Left[i]) != '\0' && i < iLimitCopy; i++);
break;
case GO_RIGHT:
for (int i = 0; (ActionText[i] = LefAnalog_Right[i]) != '\0' && i < iLimitCopy; i++);
break;
case GO_FORWARD:
for (int i = 0; (ActionText[i] = LefAnalog_Up[i]) != '\0' && i < iLimitCopy; i++);
break;
case GO_BACK:
for (int i = 0; (ActionText[i] = LefAnalog_Down[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_LOOKBEHIND:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Down[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_FIREWEAPON:
for (int i = 0; (ActionText[i] = PS2_Circle[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_FIREWEAPON:
for (int i = 0; (ActionText[i] = PS2_Circle[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_CYCLE_WEAPON_LEFT:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Left[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_CYCLE_WEAPON_RIGHT:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Right[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_LOCK_TARGET:
for (int i = 0; (ActionText[i] = PS2_R1[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_JUMPING:
for (int i = 0; (ActionText[i] = PS2_Square[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_SPRINT:
for (int i = 0; (ActionText[i] = PS2_Circle[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_CYCLE_TARGET_LEFT:
for (int i = 0; (ActionText[i] = PS2_L2[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_CYCLE_TARGET_RIGHT:
for (int i = 0; (ActionText[i] = PS2_R2[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_CENTER_CAMERA_BEHIND_PLAYER:
for (int i = 0; (ActionText[i] = Dreamcast_CenterCamera[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_SNIPER_ZOOM_IN:
for (int i = 0; (ActionText[i] = PS2_Square[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_SNIPER_ZOOM_OUT:
for (int i = 0; (ActionText[i] = PS2_Cross[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_1RST_PERSON_LOOK_LEFT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_1RST_PERSON_LOOK_RIGHT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_1RST_PERSON_LOOK_UP:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case PED_1RST_PERSON_LOOK_DOWN:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_TURRETLEFT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_TURRETRIGHT:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_TURRETUP:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_TURRETDOWN:
for (int i = 0; (ActionText[i] = Dreamcast_A[i]) != '\0' && i < iLimitCopy; i++);
break;
case CAMERA_CHANGE_VIEW_ALL_SITUATIONS:
for (int i = 0; (ActionText[i] = Dreamcast_DPad_Up[i]) != '\0' && i < iLimitCopy; i++);
break;
case VEHICLE_LOOKBEHIND:
for (int i = 0; (ActionText[i] = Dreamcast_LookBehind[i]) != '\0' && i < iLimitCopy; i++);
break;
case NETWORK_TALK: // Not Used on Dreamcast
for (int i = 0; (ActionText[i] = Dreamcast_NotAssigned[i]) != '\0' && i < iLimitCopy; i++);
break;

View File

@@ -35,6 +35,7 @@
#include "FileLoader.h"
#include "frontendoption.h"
#include "IniFile.h"
#include "../skel/dc/dc.h"
// Game has colors inlined in code.
// For easier modification we collect them here:
@@ -234,12 +235,26 @@ const char* FrontendFilenames[][2] = {
{"fe_iconaudio", "" },
{"fe_icondisplay", "" },
{"fe_iconlanguage", "" },
#ifdef RW_DC
{"dc_xboxf",""},
{"dc_xboxd",""},
{"dc_ps2f",""},
{"dc_ps2d",""},
{"xbox_f",""},
{"xbox_d",""},
{"ps2_f",""},
{"ps2_d",""},
#else
{"fe_controller", "" },
{"fe_controllersh", "" },
{"fe_arrows1", "" },
{"fe_arrows2", "" },
{"fe_arrows3", "" },
{"fe_arrows4", "" },
#endif
{"fe_radio1", "" },
{"fe_radio2", "" },
{"fe_radio3", "" },
@@ -1117,6 +1132,46 @@ CMenuManager::Draw()
#ifdef PS2_SAVE_DIALOG
if(!m_bRenderGameInMenu)
#endif
#ifdef RW_DC
if (aScreens[m_nCurrScreen].m_ScreenName[0] != '\0') {
SET_FONT_FOR_MENU_HEADER
if (strcmp("FET_AGS", aScreens[m_nCurrScreen].m_ScreenName) == 0)
{
wchar *PageName = nil;
char asciiTemp[32];
wchar unicodeTemp[64];
sprintf(asciiTemp, "CONTROLLER SETUP");
AsciiToUnicode(asciiTemp, unicodeTemp);
PageName = unicodeTemp;
CFont::PrintString(PAGE_NAME_X(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), PageName);
}
else if (strcmp("FET_CTL", aScreens[m_nCurrScreen].m_ScreenName) == 0)
{
wchar *PageName = nil;
char asciiTemp[32];
wchar unicodeTemp[64];
sprintf(asciiTemp, "KEYBOARD MOUSE SETUP");
AsciiToUnicode(asciiTemp, unicodeTemp);
PageName = unicodeTemp;
CFont::PrintString(PAGE_NAME_X(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), PageName);
}
else
{
CFont::PrintString(PAGE_NAME_X(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
}
// Weird place to put that.
nextYToUse += 24.0f + 10.0f;
}
#else
if (aScreens[m_nCurrScreen].m_ScreenName[0] != '\0') {
SET_FONT_FOR_MENU_HEADER
@@ -1125,6 +1180,7 @@ CMenuManager::Draw()
// Weird place to put that.
nextYToUse += 24.0f + 10.0f;
}
#endif
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_X), MENU_Y(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_Y));
@@ -1379,7 +1435,29 @@ CMenuManager::Draw()
sprintf(gString, "FEM_SL%d", i);
leftText = TheText.Get(gString);
}
} else {
}
else if ((strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FET_AGS")) == 0)
{
//wchar *rightText = nil;
char asciiTemp[32];
wchar unicodeTemp[64];
sprintf(asciiTemp, "CONTROLLER SETUP");
AsciiToUnicode(asciiTemp, unicodeTemp);
leftText = unicodeTemp;
}
else if ((strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FET_CTL")) == 0)
{
//wchar *rightText = nil;
char asciiTemp[32];
wchar unicodeTemp[64];
sprintf(asciiTemp, "KEYBOARD MOUSE SETUP");
AsciiToUnicode(asciiTemp, unicodeTemp);
leftText = unicodeTemp;
}
else {
leftText = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName);
}
@@ -1460,10 +1538,16 @@ CMenuManager::Draw()
case MENUACTION_CTRLCONFIG:
switch (CPad::GetPad(0)->Mode) {
case 0:
rightText = TheText.Get("FEC_CF1");
//rightText = TheText.Get("FEC_CF1");
sprintf(asciiTemp, "XBOX LIKE");
AsciiToUnicode(asciiTemp, unicodeTemp);
rightText = unicodeTemp;
break;
case 1:
rightText = TheText.Get("FEC_CF2");
//rightText = TheText.Get("FEC_CF2");
sprintf(asciiTemp, "PS2 LIKE");
AsciiToUnicode(asciiTemp, unicodeTemp);
rightText = unicodeTemp;
break;
case 2:
rightText = TheText.Get("FEC_CF3");
@@ -1930,6 +2014,15 @@ CMenuManager::Draw()
CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(181), MENU_Y(99), MENU_X_LEFT_ALIGNED(229), MENU_Y(122)), CRGBA(m_PrefsPlayerRed, m_PrefsPlayerGreen, m_PrefsPlayerBlue, FadeIn(255)));
}
char strver[200];
wchar ustr[200];
snprintf(strver, sizeof(strver), "DCA3: %s", getExecutableTag());
AsciiToUnicode(strver, ustr);
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X*3/4), MENU_Y(MENU_TEXT_SIZE_Y*3/4));
CFont::SetColor(CRGBA(MENUOPTION_COLOR.r, MENUOPTION_COLOR.g, MENUOPTION_COLOR.b, FadeIn(255)));
CFont::PrintString(MENU_X_LEFT_ALIGNED(BUILDID_TEXT_LEFT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(BUILDID_TEXT_BOTTOM_MARGIN), ustr);
}
int
@@ -3715,7 +3808,11 @@ CMenuManager::LoadController(int8 type)
}
// Unload current textures
#ifdef RW_DC
for (int i = DC_XBOXF; i <= PS2_D; i++)
#else
for (int i = FE_CONTROLLER; i <= FE_ARROWS4; i++)
#endif
m_aFrontEndSprites[i].Delete();
// Unload txd
@@ -3748,7 +3845,11 @@ CMenuManager::LoadController(int8 type)
assert(txdSlot != -1);
// Load new textures
CTxdStore::SetCurrentTxd(txdSlot);
#ifdef RW_DC
for (int i = DC_XBOXF; i <= PS2_D; i++) {
#else
for (int i = FE_CONTROLLER; i <= FE_ARROWS4; i++) {
#endif
m_aFrontEndSprites[i].SetTexture(FrontendFilenames[i][0], FrontendFilenames[i][1]);
m_aFrontEndSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
}
@@ -5378,10 +5479,12 @@ CMenuManager::ProcessButtonPresses(void)
#ifdef FIX_BUGS
case MENUACTION_CTRLCONFIG:
CPad::GetPad(0)->Mode += changeValueBy;
if (CPad::GetPad(0)->Mode > 3)
//if (CPad::GetPad(0)->Mode > 3)
if (CPad::GetPad(0)->Mode > 1)
CPad::GetPad(0)->Mode = 0;
else if (CPad::GetPad(0)->Mode < 0)
CPad::GetPad(0)->Mode = 3;
//CPad::GetPad(0)->Mode = 3;
CPad::GetPad(0)->Mode = 1;
SaveSettings();
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
@@ -5531,7 +5634,8 @@ CMenuManager::ProcessOnOffMenuOptions()
#ifndef FIX_BUGS
case MENUACTION_CTRLCONFIG:
CPad::GetPad(0)->Mode++;
if (CPad::GetPad(0)->Mode > 3)
//if (CPad::GetPad(0)->Mode > 3)
if (CPad::GetPad(0)->Mode > 1)
CPad::GetPad(0)->Mode = 0;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
@@ -5873,7 +5977,6 @@ CMenuManager::PrintController(void)
#define X(f) ((f)*scale + centerX)
#define Y(f) ((f)*scale + centerY)
m_aFrontEndSprites[FE_CONTROLLERSH].Draw(MENU_X_LEFT_ALIGNED(X(-CONTROLLER_SIZE_X / 2)), MENU_Y(Y(-CONTROLLER_SIZE_Y / 2)), MENU_X((CONTROLLER_SIZE_X + 4.8f) * scale), MENU_Y((CONTROLLER_SIZE_Y + 4.8f) * scale), CRGBA(0, 0, 0, 255));
m_aFrontEndSprites[FE_CONTROLLER].Draw(MENU_X_LEFT_ALIGNED(X(-CONTROLLER_SIZE_X / 2)), MENU_Y(Y(-CONTROLLER_SIZE_Y / 2)), MENU_X(CONTROLLER_SIZE_X * scale), MENU_Y(CONTROLLER_SIZE_Y * scale), CRGBA(255, 255, 255, 255));
if (m_DisplayControllerOnFoot) {
@@ -6164,7 +6267,373 @@ CMenuManager::PrintController(void)
#undef X
#undef Y
}
#elif RW_DC
void
CMenuManager::PrintController(void)
{
// FIX: Originally this function doesn't have StretchX/Y, everything had constant pixel size (due to screen was abandoned early?)
// Also texts and their alignment were very bad, so I tried to make them readable (commented out the original code, and marked the ones I added with X)
switch (CPad::GetPad(0)->Mode)
{
case 0: //Xbox Mode
if (CPad::GetPad(0)->IsDualAnalog)
{
if (m_DisplayControllerOnFoot)
m_aFrontEndSprites[XBOX_F].Draw(MENU_X_LEFT_ALIGNED(65.0f), MENU_Y(75.0f), MENU_X(512.0f), MENU_Y(256.0f), CRGBA(255, 255, 255, 255));
else
m_aFrontEndSprites[XBOX_D].Draw(MENU_X_LEFT_ALIGNED(65.0f), MENU_Y(75.0f), MENU_X(512.0f), MENU_Y(256.0f), CRGBA(255, 255, 255, 255));
}
else
{
if (m_DisplayControllerOnFoot)
m_aFrontEndSprites[DC_XBOXF].Draw(MENU_X_LEFT_ALIGNED(65.0f), MENU_Y(75.0f), MENU_X(512.0f), MENU_Y(256.0f), CRGBA(255, 255, 255, 255));
else
m_aFrontEndSprites[DC_XBOXD].Draw(MENU_X_LEFT_ALIGNED(65.0f), MENU_Y(75.0f), MENU_X(512.0f), MENU_Y(256.0f), CRGBA(255, 255, 255, 255));
}
break;
case 1: //PS2 Mode
if (CPad::GetPad(0)->IsDualAnalog)
{
if (m_DisplayControllerOnFoot)
m_aFrontEndSprites[PS2_F].Draw(MENU_X_LEFT_ALIGNED(65.0f), MENU_Y(75.0f), MENU_X(512.0f), MENU_Y(256.0f), CRGBA(255, 255, 255, 255));
else
m_aFrontEndSprites[PS2_D].Draw(MENU_X_LEFT_ALIGNED(65.0f), MENU_Y(75.0f), MENU_X(512.0f), MENU_Y(256.0f), CRGBA(255, 255, 255, 255));
}
else
{
if (m_DisplayControllerOnFoot)
m_aFrontEndSprites[DC_PS2F].Draw(MENU_X_LEFT_ALIGNED(65.0f), MENU_Y(75.0f), MENU_X(512.0f), MENU_Y(256.0f), CRGBA(255, 255, 255, 255));
else
m_aFrontEndSprites[DC_PS2D].Draw(MENU_X_LEFT_ALIGNED(65.0f), MENU_Y(75.0f), MENU_X(512.0f), MENU_Y(256.0f), CRGBA(255, 255, 255, 255));
}
break;
}
// CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); // X
// // CFont::SetScale(0.4f, 0.4f);
// CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); // X
// // CFont::SetColor(CRGBA(128, 128, 128, FadeIn(255)));
// CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255))); // X
// CFont::SetDropShadowPosition(1); // X
// CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255))); // X
// if (m_DisplayControllerOnFoot) {
// switch (CPad::GetPad(0)->Mode) {
// case 0:
// if (CPad::GetPad(0)->IsDualAnalog)
// {
// CFont::SetRightJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_CWL"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_LOF"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_MOV"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_MOV"));
// CFont::SetJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_CAM"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_PAU"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_CWR"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_TAR"));
// CFont::SetRightJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_JUM"));
// CFont::SetJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_ENV"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_ATT"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_RUN"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_FPC"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_LB3"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_R3"));
// }
// else
// {
// // CFont::SetRightJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(202.0f), MENU_Y(220.0f), TheText.Get("FEC_CWL"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(202.0f), MENU_Y(232.0f), TheText.Get("FEC_LB"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(202.0f), MENU_Y(206.0f), TheText.Get("FEC_CAM"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(202.0f), MENU_Y(176.0f), TheText.Get("FEC_MOV"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(247.0f), MENU_Y(101.0f), TheText.Get("FEC_TAR"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(297.0f), MENU_Y(89.0f), TheText.Get("FEC_CWR"));
// // CFont::SetJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(438.45f), MENU_Y(257.0f), TheText.Get("FEC_PAU"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(89.0f), TheText.Get("FEC_CMR"));
// // CFont::SetJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(438.45f), MENU_Y(195.0f), TheText.Get("FEC_JUM"));
// // CFont::SetJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(438.45f), MENU_Y(178.0f), TheText.Get("FEC_ENV"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(438.45f), MENU_Y(212.0f), TheText.Get("FEC_RUN"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(394.0f), MENU_Y(101.0f), TheText.Get("FEC_ATT"));
// //CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_FPC"));
// //CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_LB3"));
// //CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_R3"));
// }
// break;
// case 1:
// if (CPad::GetPad(0)->IsDualAnalog)
// {
// CFont::SetRightJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_CWL"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_LOF"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_MOV"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_MOV"));
// CFont::SetJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_CAM"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_PAU"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_CWR"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_TAR"));
// CFont::SetRightJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_JUM"));
// CFont::SetJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_ENV"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_ATT"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_RUN"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_FPC"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_LB3"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_R3"));
// }
// else
// {
// CFont::SetRightJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(202.0f), MENU_Y(220.0f), TheText.Get("FEC_CWL"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(202.0f), MENU_Y(232.0f), TheText.Get("FEC_LB"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(202.0f), MENU_Y(206.0f), TheText.Get("FEC_CAM"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(202.0f), MENU_Y(176.0f), TheText.Get("FEC_MOV"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(247.0f), MENU_Y(101.0f), TheText.Get("FEC_CMR"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(297.0f), MENU_Y(89.0f), TheText.Get("FEC_CWR"));
// CFont::SetJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(438.45f), MENU_Y(257.0f), TheText.Get("FEC_PAU"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(89.0f), TheText.Get("FEC_JUM"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(438.45f), MENU_Y(178.0f), TheText.Get("FEC_ENV"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(438.45f), MENU_Y(212.0f), TheText.Get("FEC_RUN"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(394.0f), MENU_Y(101.0f), TheText.Get("FEC_TAR"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(438.45f), MENU_Y(195.0f), TheText.Get("FEC_ATT"));
// //CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_FPC"));
// //CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_LB3"));
// //CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_R3"));
// }
// break;
// // CFont::SetRightJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_CWL"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_LOF"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_CAM"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_MOV"));
// // CFont::SetJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_NA"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_PAU"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_CWR"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_TAR"));
// // CFont::SetRightJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_JUM"));
// // CFont::SetJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_ENV"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_ATT"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_RUN"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_FPC"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_LB3"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_R3"));
// // break;
// // case 2:
// // CFont::SetRightJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_CWL"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_ENV"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_MOV"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_MOV"));
// // CFont::SetJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_CAM"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_PAU"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_CWR"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_TAR"));
// // CFont::SetRightJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_JUM"));
// // CFont::SetJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_LOF"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_RUN"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_ATT"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_FPC"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_LB3"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_R3"));
// // break;
// // case 3:
// // CFont::SetRightJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_CWL"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_TAR"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_NA"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_MOV"));
// // CFont::SetJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_CAM"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_PAU"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_CWR"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_TAR"));
// // CFont::SetRightJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_JUM"));
// // CFont::SetJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_LOF"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_RUN"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_ATT"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_FPC"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_LB3"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_R3"));
// // break;
// default:
// return;
// }
// } else {
// switch (CPad::GetPad(0)->Mode) {
// case 0:
// // CFont::SetRightJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_LL"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_RSC"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_VES"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_VES"));
// // CFont::SetJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_HO3"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_CAM"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_PAU"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_LB"));
// // CFont::SetRightJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_LR"));
// // CFont::SetJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_HAB"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_BRA"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_EXV"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_CAW"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_ACC"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_TUC"));
// // // FIX: Coordinates of this line is undefined in PC...
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(304.0f), TheText.Get("FEC_SM3"));
// // break;
// if (CPad::GetPad(0)->IsDualAnalog)
// {
// CFont::SetRightJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_CWL"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_LOF"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_MOV"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_MOV"));
// CFont::SetJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_CAM"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_PAU"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_CWR"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_TAR"));
// CFont::SetRightJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_JUM"));
// CFont::SetJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_ENV"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_ATT"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_RUN"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_FPC"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_LB3"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_R3"));
// }
// else
// {
// CFont::SetRightJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(202.0f), MENU_Y(220.0f), TheText.Get("FEC_SUB"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(202.0f), MENU_Y(232.0f), TheText.Get("FEC_HRN"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(202.0f), MENU_Y(206.0f), TheText.Get("FEC_CAM"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(202.0f), MENU_Y(176.0f), TheText.Get("FEC_VES"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(247.0f), MENU_Y(101.0f), TheText.Get("FEC_BRA"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(297.0f), MENU_Y(89.0f), TheText.Get("FEC_RSC"));
// CFont::SetJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(438.45f), MENU_Y(257.0f), TheText.Get("FEC_PAU"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(89.0f), TheText.Get("FEC_CMR"));
// CFont::SetJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(438.45f), MENU_Y(195.0f), TheText.Get("FEC_HAB"));
// CFont::SetJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(438.45f), MENU_Y(212.0f), TheText.Get("FEC_PFR"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(394.0f), MENU_Y(101.0f), TheText.Get("FEC_ACC"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(438.45f), MENU_Y(178.0f), TheText.Get("FEC_EXV"));
// //CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_FPC"));
// //CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_LB3"));
// //CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_R3"));
// }
// case 1:
// CFont::SetRightJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_LL"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_HOR"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_CAM"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_VES"));
// CFont::SetJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_NA"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_RSC"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_PAU"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_LB"));
// CFont::SetRightJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_LR"));
// CFont::SetJustifyOn(); // X
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_HAB"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_BRA"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_EXV"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_CAW"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_ACC"));
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_TUC"));
// // FIX: Coordinates of this line is undefined in PC...
// CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(304.0f), TheText.Get("FEC_SM3"));
// break;
// // case 2:
// // CFont::SetRightJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_LL"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_EXV"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_VES"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_VES"));
// // CFont::SetJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_RS3"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_CAM"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_PAU"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_LB"));
// // CFont::SetRightJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_LR"));
// // CFont::SetJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_HOR"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_BRA"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_HAB"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_CAW"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_ACC"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_TUC"));
// // // FIX: Coordinates of this line is undefined in PC...
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(304.0f), TheText.Get("FEC_SM3"));
// // break;
// // case 3:
// // CFont::SetRightJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(146.0f), TheText.Get("FEC_LL"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(185.0f), TheText.Get("FEC_HAB"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(225.0f), TheText.Get("FEC_TUC"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(156.0f), MENU_Y(257.0f), TheText.Get("FEC_VES"));
// // CFont::SetJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(263.0f), MENU_Y(301.0f), TheText.Get("FEC_HO3"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(290.0f), MENU_Y(288.0f), TheText.Get("FEC_CAM"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(344.0f), MENU_Y(146.0f), TheText.Get("FEC_PAU"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(185.0f), TheText.Get("FEC_LB"));
// // CFont::SetRightJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(304.0f), MENU_Y(178.0f), TheText.Get("FEC_LR"));
// // CFont::SetJustifyOn(); // X
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(212.0f), TheText.Get("FEC_CAW"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(225.0f), TheText.Get("FEC_SMT"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(238.0f), TheText.Get("FEC_EXV"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(254.0f), TheText.Get("FEC_RSC"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(269.0f), TheText.Get("FEC_NA"));
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(282.0f), TheText.Get("FEC_ACC"));
// // // FIX: Coordinates of this line is undefined in PC...
// // CFont::PrintString(MENU_X_LEFT_ALIGNED(398.0f), MENU_Y(304.0f), TheText.Get("FEC_BRA"));
// // break;
// default:
// return;
// }
// }
// CFont::SetDropShadowPosition(0); // X
}
#else
void
CMenuManager::PrintController(void)
{
@@ -6385,6 +6854,7 @@ CMenuManager::PrintController(void)
CFont::SetDropShadowPosition(0); // X
}
#endif
#ifdef MENU_MAP

View File

@@ -40,6 +40,9 @@
#define HELPER_TEXT_LEFT_MARGIN 320.0f
#define HELPER_TEXT_BOTTOM_MARGIN 120.0f
#define BUILDID_TEXT_LEFT_MARGIN 320.0f
#define BUILDID_TEXT_BOTTOM_MARGIN 20.0f
#define PLAYERSETUP_LIST_TOP 28.0f
#define PLAYERSETUP_LIST_BOTTOM 125.0f
#define PLAYERSETUP_LIST_LEFT 200.0f
@@ -102,12 +105,23 @@ enum eFrontendSprites
FE_ICONAUDIO,
FE_ICONDISPLAY,
FE_ICONLANGUAGE,
#ifdef RW_DC
DC_XBOXF,
DC_XBOXD,
DC_PS2F,
DC_PS2D,
XBOX_F,
XBOX_D,
PS2_F,
PS2_D,
#else
FE_CONTROLLER,
FE_CONTROLLERSH,
FE_ARROWS1,
FE_ARROWS2,
FE_ARROWS3,
FE_ARROWS4,
#endif
FE_RADIO1,
FE_RADIO2,
FE_RADIO3,

View File

@@ -662,6 +662,9 @@ bool CGame::Initialise(const char* datFile)
CCollision::ms_collisionInMemory = currLevel;
for (int i = 0; i < MAX_PADS; i++)
CPad::GetPad(i)->Clear(true);
#ifdef RW_DC
//CPad::GetPad(0)->IsDualAnalog = false;
#endif
return true;
}

View File

@@ -764,11 +764,8 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
// MENUPAGE_OPTIONS = 41
{ "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, nil, nil,
#ifdef GTA_HANDHELD
MENUACTION_CHANGEMENU, "FET_CTL", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS },
#else
MENUACTION_CHANGEMENU, "FET_AGS", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS },
MENUACTION_CHANGEMENU, "FET_CTL", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC },
#endif
MENUACTION_LOADRADIO, "FET_AUD", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
MENUACTION_CHANGEMENU, "FET_DIS", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
#ifdef GRAPHICS_MENU_OPTIONS

1324
src/core/Pad.cpp Normal file → Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -23,7 +23,7 @@ public:
int16 DPadUp, DPadDown, DPadLeft, DPadRight;
int16 Start, Select;
int16 Square, Triangle, Cross, Circle;
uint32_t A, B, C, X, Y, Z;
uint32_t A, B, C, D, X, Y, Z;
int16 LeftShock, RightShock;
int16 NetworkTalk;
float GetLeftStickX(void) { return LeftStickX/32767.0f; };
@@ -161,6 +161,13 @@ public:
int32 LastTimeTouched;
int32 AverageWeapon;
int32 AverageEntries;
bool IsKeyboardMouse;
bool IsDualAnalog;
bool CameraJustDown;
bool CameraJustUp;
uint32 CameraJustUpTime;
uint32 CameraLastPressed;
bool CameraIsDoublePressed;
#ifdef DETECT_PAD_INPUT_SWITCH
static bool IsAffectedByController;
@@ -211,7 +218,11 @@ public:
void StopShaking(int16 pad);
static CPad *GetPad(int32 pad);
#ifdef RW_DC
bool CameraSinglePress(void); //Checks if camera modifier was double clicked
bool CameraDoublePress(void);
#endif
int16 GetSteeringLeftRight(void);
int16 GetSteeringUpDown(void);
int16 GetCarGunUpDown(void);

View File

@@ -187,8 +187,8 @@ __always_inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#define SCREEN_HEIGHT ((float)448)
#endif
#else
#define SCREEN_WIDTH ((float)640)
#define SCREEN_HEIGHT ((float)480)
extern float SCREEN_WIDTH;
extern float SCREEN_HEIGHT;
#endif
#define SCREEN_HEIGHT_PAL ((float)512)

View File

@@ -311,7 +311,7 @@ enum Config {
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
// #define USE_TXD_CDIMAGE // generate and load textures from txd.img
// #define PS2_ALPHA_TEST // emulate ps2 alpha test
#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
//#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
// #define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time
#ifdef DISABLE_LOADING_SCREEN
// enable the PC splash
@@ -327,7 +327,7 @@ enum Config {
//#define NEW_RENDERER // leeds-like world rendering, needs librw
#endif
#define FIX_SPRITES // fix sprites aspect ratio(moon, coronas, particle etc)
// #define FIX_SPRITES // fix sprites aspect ratio(moon, coronas, particle etc) // JP - Disabled this as it produces incorrect aspect ratio with custom screen resolutions and is not needed otherwise
#ifndef EXTENDED_COLOURFILTER
#undef SCREEN_DROPLETS // we need the backbuffer for this effect

View File

@@ -1196,8 +1196,8 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
stacktrace();
dbgio_dev_select("fb");
sleep(1);
dbgio_printf("RE3 ASSERT FAILED\n\tFile: %s\n\tLine: %d\n\tFunction: %s\n\tExpression: %s\n",filename,lineno,func,expr);
dbgio_printf("POSIX error (may not be relevant): %s\n", strerror(errno));
dbglog(DBG_CRITICAL, "RE3 ASSERT FAILED\n\tFile: %s\n\tLine: %d\n\tFunction: %s\n\tExpression: %s\n",filename,lineno,func,expr);
dbglog(DBG_CRITICAL, "POSIX error (may not be relevant): %s\n", strerror(errno));
stacktrace();
dbgio_flush();
abort();

View File

@@ -83,6 +83,11 @@ CEntity::~CEntity(void)
ResolveReferences();
}
bool
CEntity::IsFence(void) {
return IsObject() && ::IsFence(static_cast<CObject *>(this)->GetModelIndex());
}
void
CEntity::SetModelIndex(uint32 id)
{

View File

@@ -131,6 +131,7 @@ public:
bool IsPed(void) { return m_type == ENTITY_TYPE_PED; }
bool IsObject(void) { return m_type == ENTITY_TYPE_OBJECT; }
bool IsDummy(void) { return m_type == ENTITY_TYPE_DUMMY; }
bool IsFence(void);
RpAtomic *GetAtomic(void) {
assert(RwObjectGetType(m_rwObject) == rpATOMIC);

View File

@@ -59,7 +59,7 @@ CPhysical::CPhysical(void)
bInfiniteMass = false;
bIsInWater = false;
bHitByTrain = false;
bSkipLineCol = false;
bSkipLineCol = IsFence();
m_fDistanceTravelled = 0.0f;
m_treadable[PATH_CAR] = nil;
@@ -1461,6 +1461,10 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
skipCollision = false;
altcollision = false;
if(A->IsFence() && B->IsFence()) {
skipCollision = true;
A->bSkipLineCol = true;
}
if(B->IsBuilding())
skipCollision = false;
else if(IsStreetLight(A->GetModelIndex()) &&
@@ -1922,12 +1926,12 @@ CPhysical::ProcessCollision(void)
n = NUMSTEPS(0.09f);
step = savedTimeStep / n;
}
}else if(responsecase == COLLRESPONSE_SMALLBOX || responsecase == COLLRESPONSE_FENCEPART){
}else if(responsecase == COLLRESPONSE_SMALLBOX){
if(distSq >= sq(0.15f)){
n = NUMSTEPS(0.15f);
step = savedTimeStep / n;
}
}else{
}else if(responsecase != COLLRESPONSE_FENCEPART){
if(distSq >= sq(0.3f)){
n = NUMSTEPS(0.3f);
step = savedTimeStep / n;

View File

@@ -282,7 +282,7 @@ CMatrix::SetRotate(float xAngle, float yAngle, float zAngle)
void
CMatrix::RotateX(float x)
{
#ifdef DC_SH4
#if 0 && defined(DC_SH4) // this is bugged and does not yield correct results
mat_load(reinterpret_cast<matrix_t *>(this));
mat_rotate_x(x);
mat_store(reinterpret_cast<matrix_t *>(this));
@@ -312,7 +312,7 @@ CMatrix::RotateX(float x)
void
CMatrix::RotateY(float y)
{
#ifdef DC_SH4
#if 0 && defined(DC_SH4) // this is bugged and does not yield correct results
mat_load(reinterpret_cast<matrix_t *>(this));
mat_rotate_y(y);
mat_store(reinterpret_cast<matrix_t *>(this));
@@ -342,7 +342,7 @@ CMatrix::RotateY(float y)
void
CMatrix::RotateZ(float z)
{
#ifdef DC_SH4
#if 0 && defined(DC_SH4) // this is bugged and does not yield correct results
mat_load(reinterpret_cast<matrix_t *>(this));
mat_rotate_z(z);
mat_store(reinterpret_cast<matrix_t *>(this));
@@ -372,7 +372,7 @@ CMatrix::RotateZ(float z)
void
CMatrix::Rotate(float x, float y, float z)
{
#ifdef DC_SH4
#if 0 && defined(DC_SH4) // this is bugged and does not yield correct results
mat_load(reinterpret_cast<matrix_t *>(this));
mat_rotate(x, y, z);
mat_store(reinterpret_cast<matrix_t *>(this));
@@ -404,6 +404,20 @@ CMatrix::Rotate(float x, float y, float z)
float z2 = sZ * sY - (cZ * sX) * cY;
float z3 = cX * cY;
#if !defined(DC_TEXCONV) && !defined(DC_SIM)
this->rx = fipr(x1, y1, z1, 0, rx, ry, rz, 0);
this->ry = fipr(x2, y2, z2, 0, rx, ry, rz, 0);
this->rz = fipr(x3, y3, z3, 0, rx, ry, rz, 0);
this->fx = fipr(x1, y1, z1, 0, ux, uy, uz, 0);
this->fy = fipr(x2, y2, z2, 0, ux, uy, uz, 0);
this->fz = fipr(x3, y3, z3, 0, ux, uy, uz, 0);
this->ux = fipr(x1, y1, z1, 0, ax, ay, az, 0);
this->uy = fipr(x2, y2, z2, 0, ax, ay, az, 0);
this->uz = fipr(x3, y3, z3, 0, ax, ay, az, 0);
this->px = fipr(x1, y1, z1, 0, px, py, pz, 0);
this->py = fipr(x2, y2, z2, 0, px, py, pz, 0);
this->pz = fipr(x3, y3, z3, 0, px, py, pz, 0);
#else
this->rx = x1 * rx + y1 * ry + z1 * rz;
this->ry = x2 * rx + y2 * ry + z2 * rz;
this->rz = x3 * rx + y3 * ry + z3 * rz;
@@ -416,6 +430,7 @@ CMatrix::Rotate(float x, float y, float z)
this->px = x1 * px + y1 * py + z1 * pz;
this->py = x2 * px + y2 * py + z2 * pz;
this->pz = x3 * px + y3 * py + z3 * pz;
#endif
#endif
}

View File

@@ -41,7 +41,11 @@ CDraw::FindAspectRatio(void)
#else
switch (FrontEndMenuManager.m_PrefsUseWideScreen) {
case AR_AUTO:
#ifdef DC_SH4
return 4.0f / 3.0f;
#else
return SCREEN_WIDTH / SCREEN_HEIGHT;
#endif
default:
case AR_4_3:
return 4.0f / 3.0f;

View File

@@ -134,7 +134,7 @@ CMBlur::MotionBlurOpen(RwCamera *cam)
return TRUE;
#else
RwRect rect = { 0, 0, 640, 480 };
RwRect rect = { 0, 0, (rw::int32)SCREEN_WIDTH, (rw::int32)SCREEN_HEIGHT };
CreateImmediateModeData(cam, &rect);
return TRUE;
#endif

View File

@@ -1479,7 +1479,8 @@ CWaterLevel::AllocateBoatWakeArray()
apGeomArray[geom] = RpGeometryCreate(9*9, 8*8*2, rpGEOMETRYTRISTRIP
| rpGEOMETRYPRELIT
| rpGEOMETRYMODULATEMATERIALCOLOR
| rpGEOMETRYTEXTURED);
| rpGEOMETRYTEXTURED
| rw::Geometry::HAS_TRIANGLES/* RW_DC specific */);
ASSERT(apGeomArray[geom] != nil);
RpTriangle *geomTriangles = RpGeometryGetTriangles(apGeomArray[geom]);

View File

@@ -62,6 +62,10 @@ long _dwOperatingSystemVersion;
#include "AnimViewer.h"
#include "Font.h"
#include "MemoryMgr.h"
#include "../../dreamcast/git-version.h"
#include "dc.h"
#include <kos/dbglog.h>
// This is defined on project-level, via premake5 or cmake
#ifdef GET_KEYBOARD_INPUT_FROM_X11
@@ -873,10 +877,6 @@ psSelectDevice()
/* Get the default selection */
GcurSel = RwEngineGetCurrentSubSystem();
#ifdef IMPROVED_VIDEOMODE
if(FrontEndMenuManager.m_nPrefsSubsystem < GnumSubSystems)
GcurSel = FrontEndMenuManager.m_nPrefsSubsystem;
#endif
}
/* Set the driver to use the correct sub system */
@@ -885,11 +885,6 @@ psSelectDevice()
return FALSE;
}
#ifdef IMPROVED_VIDEOMODE
FrontEndMenuManager.m_nPrefsSubsystem = GcurSel;
#endif
#ifndef IMPROVED_VIDEOMODE
if ( !useDefault )
{
if ( _psGetVideoModeList()[FrontEndMenuManager.m_nDisplayVideoMode] && FrontEndMenuManager.m_nDisplayVideoMode )
@@ -899,97 +894,11 @@ psSelectDevice()
}
else
{
#ifdef DEFAULT_NATIVE_RESOLUTION
// get the native video mode
HDC hDevice = GetDC(NULL);
int w = GetDeviceCaps(hDevice, HORZRES);
int h = GetDeviceCaps(hDevice, VERTRES);
int d = GetDeviceCaps(hDevice, BITSPIXEL);
#else
const int w = 640;
const int h = 480;
const int d = 16;
#endif
while ( !modeFound && GcurSelVM < RwEngineGetNumVideoModes() )
{
RwEngineGetVideoModeInfo(&vm, GcurSelVM);
if ( defaultFullscreenRes && vm.width != w
|| vm.height != h
|| vm.depth != d
|| !(vm.flags & rwVIDEOMODEEXCLUSIVE) )
++GcurSelVM;
else
modeFound = TRUE;
}
if ( !modeFound )
{
#ifdef DEFAULT_NATIVE_RESOLUTION
GcurSelVM = 1;
#else
printf("WARNING: Cannot find 640x480 video mode, selecting device cancelled\n");
return FALSE;
#endif
}
GcurSelVM = 0;
}
}
#else
if ( !useDefault )
{
if(FrontEndMenuManager.m_nPrefsWidth == 0 ||
FrontEndMenuManager.m_nPrefsHeight == 0 ||
FrontEndMenuManager.m_nPrefsDepth == 0){
// Defaults if nothing specified
//const GLFWvidmode *mode = glfwGetVideoMode(glfwGetPrimaryMonitor());
FrontEndMenuManager.m_nPrefsWidth = 640; //mode->width;
FrontEndMenuManager.m_nPrefsHeight = 480; //mode->height;
FrontEndMenuManager.m_nPrefsDepth = 16;
FrontEndMenuManager.m_nPrefsWindowed = 0;
}
// Find the videomode that best fits what we got from the settings file
RwInt32 bestFsMode = -1;
RwInt32 bestWidth = -1;
RwInt32 bestHeight = -1;
RwInt32 bestDepth = -1;
for(GcurSelVM = 0; GcurSelVM < RwEngineGetNumVideoModes(); GcurSelVM++){
RwEngineGetVideoModeInfo(&vm, GcurSelVM);
bestWndMode = GcurSelVM;
bestWidth = vm.width;
bestHeight = vm.height;
bestDepth = vm.depth;
bestFsMode = GcurSelVM;
break;
}
if(bestFsMode < 0){
printf("WARNING: Cannot find desired video mode, selecting device cancelled\n");
return FALSE;
}
GcurSelVM = bestFsMode;
FrontEndMenuManager.m_nDisplayVideoMode = GcurSelVM;
FrontEndMenuManager.m_nPrefsVideoMode = FrontEndMenuManager.m_nDisplayVideoMode;
FrontEndMenuManager.m_nSelectedScreenMode = FrontEndMenuManager.m_nPrefsWindowed;
}
#endif
RwEngineGetVideoModeInfo(&vm, GcurSelVM);
#ifdef IMPROVED_VIDEOMODE
if (FrontEndMenuManager.m_nPrefsWindowed)
GcurSelVM = bestWndMode;
// Now GcurSelVM is 0 but vm has sizes(and fullscreen flag) of the video mode we want, that's why we changed the rwVIDEOMODEEXCLUSIVE conditions below
FrontEndMenuManager.m_nPrefsWidth = vm.width;
FrontEndMenuManager.m_nPrefsHeight = vm.height;
FrontEndMenuManager.m_nPrefsDepth = vm.depth;
#endif
#ifndef PS2_MENU
FrontEndMenuManager.m_nCurrOption = 0;
#endif
/* Set up the video mode and set the apps window
* dimensions to match */
@@ -1012,25 +921,6 @@ psSelectDevice()
}
}
*/
#ifndef IMPROVED_VIDEOMODE
if (vm.flags & rwVIDEOMODEEXCLUSIVE)
{
RsGlobal.maximumWidth = vm.width;
RsGlobal.maximumHeight = vm.height;
RsGlobal.width = vm.width;
RsGlobal.height = vm.height;
PSGLOBAL(fullScreen) = TRUE;
}
#else
RsGlobal.maximumWidth = FrontEndMenuManager.m_nPrefsWidth;
RsGlobal.maximumHeight = FrontEndMenuManager.m_nPrefsHeight;
RsGlobal.width = FrontEndMenuManager.m_nPrefsWidth;
RsGlobal.height = FrontEndMenuManager.m_nPrefsHeight;
PSGLOBAL(fullScreen) = !FrontEndMenuManager.m_nPrefsWindowed;
#endif
#ifdef MULTISAMPLING
RwD3D8EngineSetMultiSamplingLevels(1 << FrontEndMenuManager.m_nPrefsMSAALevel);
#endif
@@ -1977,13 +1867,14 @@ __attribute__((noinline)) void stacktrace() {
: "+r" (sp), "+r" (pr)
:
: );
dbgio_printf("Stack trace: %p ", (void*)pr);
dbglog(DBG_CRITICAL, "DCA3: %s\n", getExecutableTag());
dbglog(DBG_CRITICAL, "Stack trace: %p ", (void*)pr);
int found = 0;
if(!(sp & 3) && sp > 0x8c000000 && sp < _arch_mem_top) {
char** sp_ptr = (char**)sp;
for (int so = 0; so < 16384; so++) {
if (uintptr_t(&sp_ptr[so]) >= _arch_mem_top) {
dbgio_printf("(@@%p) ", &sp_ptr[so]);
dbglog(DBG_CRITICAL, "(@@%p) ", &sp_ptr[so]);
break;
}
if (sp_ptr[so] > (char*)0x8c000000 && sp_ptr[so] < etext) {
@@ -1999,9 +1890,9 @@ __attribute__((noinline)) void stacktrace() {
uint16_t instr = instrp[-2];
// BSR or BSRF or JSR @Rn ?
if (((instr & 0xf000) == 0xB000) || ((instr & 0xf0ff) == 0x0003) || ((instr & 0xf0ff) == 0x400B)) {
dbgio_printf("%p ", instrp);
dbglog(DBG_CRITICAL, "%p ", instrp);
if (found++ > 24) {
dbgio_printf("(@%p) ", &sp_ptr[so]);
dbglog(DBG_CRITICAL, "(@%p) ", &sp_ptr[so]);
break;
}
} else {
@@ -2011,15 +1902,83 @@ __attribute__((noinline)) void stacktrace() {
// dbglog(DBG_CRITICAL, "Stack trace: %p (@%p): out of range\n", (void*)sp_ptr[so], &sp_ptr[so]);
}
}
dbgio_printf("end\n");
dbglog(DBG_CRITICAL, "end\n");
} else {
dbgio_printf("(@%p)\n", (void*)sp);
dbglog(DBG_CRITICAL, "(@%p)\n", (void*)sp);
}
}
#include <cstdint>
#include <cstdio>
#include <string>
#include <iomanip>
#include <sstream>
extern "C" {
extern const unsigned char _build_id_start[];
extern const unsigned char _build_id_end[];
}
std::string getBuildId()
{
// Pointer to the start of the .note.gnu.build-id section
const unsigned char *p = _build_id_start;
// Parse the ELF note header
struct NoteHeader {
uint32_t n_namesz;
uint32_t n_descsz;
uint32_t n_type;
};
// Read header fields (be careful with endianness if needed)
const auto* note = reinterpret_cast<const NoteHeader*>(p);
// Move p beyond the note header
p += sizeof(NoteHeader);
// Skip the "name" field + alignment (e.g. "GNU\0")
// name is note->n_namesz bytes, then align up to 4 bytes
auto nameBytes = (note->n_namesz + 3u) & ~3u;
p += nameBytes;
// Now p should point to the actual build-id bytes, which are note->n_descsz in length.
const unsigned char* buildId = p;
auto buildIdSize = note->n_descsz;
// Convert it to a hex string
std::ostringstream oss;
oss << std::hex << std::setfill('0');
for (uint32_t i = 0; i < buildIdSize; i++) {
oss << std::setw(2) << static_cast<unsigned>(buildId[i]);
}
return oss.str();
}
#else
std::string getBuildId() {
return "non-dreamcast-build";
}
#endif
const char* getSourceId() {
return GIT_VERSION;
}
const char* getCIJobId() {
return CI_JOB_ID;
}
static std::string executableTag = getBuildId().substr(0, 10) + ":" + getSourceId() + ":" + getCIJobId();
const char* getExecutableTag() {
return executableTag.c_str();
}
int
main(int argc, char *argv[])
{
dbglog(DBG_CRITICAL, "DCA3: %s\n", getExecutableTag());
#if !defined(DC_SIM)
std::set_terminate([]() {
fflush(stdout);
@@ -2029,8 +1988,8 @@ main(int argc, char *argv[])
stacktrace();
dbgio_dev_select("fb");
sleep(1);
dbgio_printf("std::terminate() called\n");
dbgio_printf("POSIX error (may not be relevant): %s\n", strerror(errno));
dbglog(DBG_CRITICAL, "std::terminate() called\n");
dbglog(DBG_CRITICAL, "POSIX error (may not be relevant): %s\n", strerror(errno));
stacktrace();
dbgio_flush();

7
src/skel/dc/dc.h Normal file
View File

@@ -0,0 +1,7 @@
#pragma once
#include <string>
std::string getBuildId();
const char* getSourceId();
const char* getCIJobId();
const char* getExecutableTag();

View File

@@ -10,7 +10,7 @@
# include <dc/sound/sound.h>
# endif
extern bool _dcAudioInitialized;
extern bool _bSampmanInitialised;
// ====== STATIC METHODS =====
@@ -86,7 +86,7 @@ void VmuProfiler::run() {
#ifdef DC_SH4
if(auto *dev = maple_enum_type(0, MAPLE_FUNC_MEMCARD);
dev && _dcAudioInitialized && updated_)
dev && _bSampmanInitialised && updated_)
{
pvr_stats_t pvrStats; pvr_get_stats(&pvrStats);
uint32_t sramStats = snd_mem_available();

View File

@@ -126,6 +126,28 @@ void CBulletInfo::Update(void)
}
pPed->InflictDamage(pBullet->m_pSource, pBullet->m_eWeaponType, pBullet->m_nDamage, (ePedPieceTypes)point.pieceB, pPed->GetLocalDirection(pPed->GetPosition() - point.point));
CEventList::RegisterEvent(pPed->m_nPedType == PEDTYPE_COP ? EVENT_SHOOT_COP : EVENT_SHOOT_PED, EVENT_ENTITY_PED, pPed, (CPed*)pBullet->m_pSource, 1000);
if (CGame::nastyGame) {
CVector vecParticleDirection = (point.point - pPed->GetPosition()) * 0.01f;
vecParticleDirection.z = 0.01f;
if (pPed->GetIsOnScreen()) {
for (int j = 0; j < NUM_PED_BLOOD_PARTICLES; j++)
CParticle::AddParticle(PARTICLE_BLOOD_SMALL, point.point + BLOOD_PARTICLE_OFFSET, vecParticleDirection);
}
if (pPed->GetPedState() == PED_DEAD) {
CAnimBlendAssociation* pAnim;
if (RpAnimBlendClumpGetFirstAssociation(pPed->GetClump(), ASSOC_FRONTAL))
pAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_STD_HIT_FLOOR_FRONT, 8.0f);
else
pAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_STD_HIT_FLOOR, 8.0f);
if (pAnim) {
pAnim->SetCurrentTime(0.0f);
pAnim->flags |= ASSOC_RUNNING;
pAnim->flags &= ~ASSOC_FADEOUTWHENDONE;
}
}
}
pBullet->m_bInUse = false;
#ifdef SQUEEZE_PERFORMANCE
bulletInfoInUse--;
@@ -136,31 +158,6 @@ void CBulletInfo::Update(void)
bAddSound = false;
}
}
if (CGame::nastyGame) {
CVector vecParticleDirection = (point.point - pPed->GetPosition()) * 0.01f;
vecParticleDirection.z = 0.01f;
if (pPed->GetIsOnScreen()) {
for (int j = 0; j < NUM_PED_BLOOD_PARTICLES; j++)
CParticle::AddParticle(PARTICLE_BLOOD_SMALL, point.point + BLOOD_PARTICLE_OFFSET, vecParticleDirection);
}
if (pPed->GetPedState() == PED_DEAD) {
CAnimBlendAssociation* pAnim;
if (RpAnimBlendClumpGetFirstAssociation(pPed->GetClump(), ASSOC_FRONTAL))
pAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_STD_HIT_FLOOR_FRONT, 8.0f);
else
pAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_STD_HIT_FLOOR, 8.0f);
if (pAnim) {
pAnim->SetCurrentTime(0.0f);
pAnim->flags |= ASSOC_RUNNING;
pAnim->flags &= ~ASSOC_FADEOUTWHENDONE;
}
}
pBullet->m_bInUse = false;
#ifdef SQUEEZE_PERFORMANCE
bulletInfoInUse--;
#endif
vecNewPos = point.point;
}
}
else if (pHitEntity->IsVehicle()) {
CVehicle* pVehicle = (CVehicle*)pHitEntity;

View File

@@ -902,10 +902,15 @@ rasterToImage(Raster *raster)
depth = 16;
conv = conv_ARGB1555_from_RGB555;
break;
default:
case Raster::C565:
depth = 24;
conv = conv_RGB888_from_BGR565;
break;
case Raster::C4444:
depth = 32;
conv = conv_RGBA8888_from_BGRA4444;
break;
default:
case Raster::LUM8:
RWERROR((ERR_INVRASTER));
return nil;

View File

@@ -29,6 +29,7 @@ extern const char* currentFile;
#include "rwdc.h"
#include "vq.h"
#include "tex-util.h"
#include "common.h"
#include <vector>
#include <set>
@@ -56,6 +57,12 @@ bool doEnvironmentMaps = true;
#define fclamp0_1(n) ((n) > 1.0f ? 1.0f : n < 0.0f ? 0.0f : n)
#define fclamp1(n) ((n) > 1.0f ? 1.0f : n)
const unsigned short VIDEO_MODES = 2;
unsigned short VIDEO_MODE = 0;
rw::VideoMode videoModes[VIDEO_MODES];
float SCREEN_WIDTH = 640;
float SCREEN_HEIGHT = 480;
struct alignas(32) pvr_vertex16_t {
uint32_t flags; /**< \brief TA command (vertex flags) */
float x; /**< \brief X coordinate */
@@ -176,8 +183,6 @@ static pvr_dr_state_t drState;
#if !defined(DC_TEXCONV) && !defined(DC_SIM)
#include <kos.h>
#define VIDEO_MODE_WIDTH vid_mode->width
#define VIDEO_MODE_HEIGHT vid_mode->height
#define mat_trans_nodiv_nomod(x, y, z, x2, y2, z2, w2) do { \
register float __x __asm__("fr12") = (x); \
@@ -288,8 +293,6 @@ void rw_mat_load_4x4(rw::Matrix* mtx) {
}
#include <dc/matrix.h>
#define VIDEO_MODE_WIDTH 640
#define VIDEO_MODE_HEIGHT 480
#define frsqrt(a) (1.0f/sqrt(a))
#define dcache_pref_block(a) __builtin_prefetch(a)
@@ -305,6 +308,8 @@ void rw_mat_load_4x4(rw::Matrix* mtx) {
#define mat_identity(a)
#define pvr_fog_table_color(a,r,g,b)
#define pvr_fog_table_linear(s,e)
#define pvr_fog_table_exp(d)
#define pvr_fog_table_custom(d)
#endif
#define mat_trans_single3_nomod(x_, y_, z_, x2, y2, z2) do { \
@@ -416,6 +421,66 @@ void leave_oix_() {
#endif
}
void enter_ocr_() {
#if defined(DC_SH4)
auto mask = irq_disable();
dcache_purge_all();
volatile uint32_t * CCN_CCR = (uint32_t *)0xFF00001C;
*CCN_CCR |= (1 << 5); // enable OCR (ORA)
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
irq_restore(mask);
#endif
}
void leave_ocr_() {
#if defined(DC_SH4)
auto mask = irq_disable();
dcache_inval_range(0x92000000, 8192);
dcache_purge_all();
volatile uint32_t * CCN_CCR = (uint32_t *)0xFF00001C;
*CCN_CCR &= ~( 1 << 5); // disable OCR (ORA)
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
irq_restore(mask);
#endif
}
#if defined(DC_SH4)
#define FLUSH_TA_DATA(src) do { __asm__ __volatile__("ocbwb @%0" : : "r" (src) : "memory"); } while(0)
#else
@@ -483,7 +548,7 @@ void DCE_MatrixViewport(float x, float y, float width, float height) {
DCE_MAT_SCREENVIEW[1][1] = height * 0.5f;
DCE_MAT_SCREENVIEW[2][2] = 1;
DCE_MAT_SCREENVIEW[3][0] = -DCE_MAT_SCREENVIEW[0][0] + x;
DCE_MAT_SCREENVIEW[3][1] = VIDEO_MODE_HEIGHT - (DCE_MAT_SCREENVIEW[1][1] + y);
DCE_MAT_SCREENVIEW[3][1] = height - (DCE_MAT_SCREENVIEW[1][1] + y);
}
void DCE_InitMatrices() {
@@ -492,7 +557,7 @@ void DCE_InitMatrices() {
mat_store(&DCE_MAT_SCREENVIEW);
DCE_MatrixViewport(0, 0, VIDEO_MODE_WIDTH, VIDEO_MODE_HEIGHT);
DCE_MatrixViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
}
}
@@ -663,7 +728,10 @@ void malloc_stats() { }
#define UNIMPL_LOGV(...)
#endif
Camera* rwdcCam;
void beginUpdate(Camera* cam) {
rwdcCam = cam;
float view[16], proj[16];
// View Matrix
@@ -739,8 +807,9 @@ std::vector<std::function<void()>> blendCallbacks;
std::vector<std::function<void()>> ptCallbacks;
void dcMotionBlur_v1(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
uint32_t col = (a << 24) | (r << 16) | (g << 8) | b;
int strip_width = SCREEN_WIDTH / 320;
int strip_mult = SCREEN_WIDTH / 640;
blendCallbacks.emplace_back([=]() {
pvr_poly_cxt_t cxt;
@@ -756,8 +825,6 @@ void dcMotionBlur_v1(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
auto addr2 = (pvr_ptr_t)&emu_vram[addr64b + 640 * 2];
#endif
PVR_SET(PVR_TEXTURE_MODULO, 640/32);
auto doquad = [=](float x, float y, float w, float h, float tx, float ty, float tw, float th) {
@@ -782,23 +849,23 @@ void dcMotionBlur_v1(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
pvr_dr_commit(vtx);
vtx = reinterpret_cast<pvr_vertex_t *>(pvr_dr_target(drState));
vtx->flags = PVR_CMD_VERTEX;
//vtx->flags = PVR_CMD_VERTEX;
vtx->x = x;
vtx->y = y+h;
vtx->z = 1000000.0f;
//vtx->z = 1000000.0f;
vtx->u = tx/1024.f;
vtx->v = (ty+th)/512.0f;
vtx->argb = col;
//vtx->argb = col;
pvr_dr_commit(vtx);
vtx = reinterpret_cast<pvr_vertex_t *>(pvr_dr_target(drState));
vtx->flags = PVR_CMD_VERTEX_EOL;
vtx->x = x+w;
vtx->y = y+h;
vtx->z = 1000000.0f;
//vtx->z = 1000000.0f;
vtx->u = (tx+tw)/1024.f;
vtx->v = (ty+th)/512.0f;
vtx->argb = col;
//vtx->argb = col;
pvr_dr_commit(vtx);
};
{
@@ -821,7 +888,7 @@ void dcMotionBlur_v1(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
pvr_dr_commit(hdr);
}
for (int x = 0; x < 320; x+=2) {
doquad(x, 0, 2, 480, x*2 + (is_bank1 ? 2 : 0), 0, 2, 480);
doquad(x*strip_mult, 0, strip_width, 480, x*2 + (is_bank1 ? 2 : 0), 0, 2, 480);
}
{
pvr_poly_cxt_txr(&cxt,
@@ -843,7 +910,7 @@ void dcMotionBlur_v1(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
pvr_dr_commit(hdr);
}
for (int x = 0; x < 320; x+=2) {
doquad(320+x, 0, 2, 480, x*2 + (is_bank1 ? 2 : 0), 0, 2, 480);
doquad(SCREEN_WIDTH/2 + x*strip_mult, 0, strip_width, 480, x*2 + (is_bank1 ? 2 : 0), 0, 2, 480);
}
});
}
@@ -886,23 +953,23 @@ void dcMotionBlur_v3(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
pvr_dr_commit(vtx);
vtx = reinterpret_cast<pvr_vertex_t *>(pvr_dr_target(drState));
vtx->flags = PVR_CMD_VERTEX;
//vtx->flags = PVR_CMD_VERTEX;
vtx->x = x;
vtx->y = y+h;
vtx->z = z;
//vtx->z = z;
vtx->u = umin;
vtx->v = vmax;
vtx->argb = col;
//vtx->argb = col;
pvr_dr_commit(vtx);
vtx = reinterpret_cast<pvr_vertex_t *>(pvr_dr_target(drState));
vtx->flags = PVR_CMD_VERTEX_EOL;
vtx->x = x+w;
vtx->y = y+h;
vtx->z = z;
//vtx->z = z;
vtx->u = umax;
vtx->v = vmax;
vtx->argb = col;
//vtx->argb = col;
pvr_dr_commit(vtx);
};
@@ -921,7 +988,7 @@ void dcMotionBlur_v3(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
pvr_poly_compile(hdr, &cxt);
pvr_dr_commit(hdr);
doquad(0.0f, 0.0f, 1e6f, 640.0f, 480.0f,
doquad(0.0f, 0.0f, 1e6f, SCREEN_WIDTH, 480.0f,
0.0f, 640.0f / 8.0f, 0.0f, 480.0f / 8.0f, mask_col);
pvr_poly_cxt_txr(&cxt, PVR_LIST_TR_POLY,
@@ -940,10 +1007,10 @@ void dcMotionBlur_v3(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
pvr_poly_compile(hdr, &cxt);
pvr_dr_commit(hdr);
doquad(0.0f, 0.0f, 2e6f, 320.0f, 480.0f,
doquad(0.0f, 0.0f, 2e6f, SCREEN_WIDTH / 2.0f, 480.0f,
0.0f, 640.0f / 1024.0f,
0.0f, 960.0f / 1024.0f, col);
doquad(320.0f, 0.0f, 2e6f, 320.0f, 480.0f,
doquad(SCREEN_WIDTH / 2.0f, 0.0f, 2e6f, SCREEN_WIDTH / 2.0f, 480.0f,
0.0f, 640.0f / 1024.0f,
1.0f / 1024.0f, 961.0f / 1024.0f, col);
@@ -954,10 +1021,10 @@ void dcMotionBlur_v3(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
pvr_poly_compile(hdr, &cxt);
pvr_dr_commit(hdr);
doquad(0.0f, 0.0f, 3e6f, 320.0f, 480.0f,
doquad(0.0f, 0.0f, 3e6f, SCREEN_WIDTH / 2.0f, 480.0f,
-1.0f / 1024.0f, 639.0f / 1024.0f,
0.0f, 960.0f / 1024.0f, col);
doquad(320.0f, 0.0f, 3e6f, 320.0f, 480.0f,
doquad(SCREEN_WIDTH / 2.0f, 0.0f, 3e6f, SCREEN_WIDTH / 2.0f, 480.0f,
-1.0f / 1024.0f, 639.0f / 1024.0f,
1.0f / 1024.0f, 961.0f / 1024.0f, col);
@@ -973,7 +1040,7 @@ void dcMotionBlur_v3(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
pvr_poly_compile(hdr, &cxt);
pvr_dr_commit(hdr);
doquad(0.0f, 0.0f, 4e6f, 640.0f, 480.0f,
doquad(0.0f, 0.0f, 4e6f, SCREEN_WIDTH, 480.0f,
0.0f, 640.0f / 8.0f, 0.0f, 480.0f / 8.0f, 0xffffffff);
cxt.blend.src = PVR_BLEND_ONE;
@@ -983,7 +1050,7 @@ void dcMotionBlur_v3(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
pvr_poly_compile(hdr, &cxt);
pvr_dr_commit(hdr);
doquad(0.0f, 0.0f, 4e6f, 640.0f, 480.0f,
doquad(0.0f, 0.0f, 4e6f, SCREEN_WIDTH, 480.0f,
0.0f, 640.0f / 8.0f, 0.0f, 480.0f / 8.0f, 0x000f0f0f);
cxt.blend.src = PVR_BLEND_INVDESTCOLOR;
@@ -993,7 +1060,7 @@ void dcMotionBlur_v3(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
pvr_poly_compile(hdr, &cxt);
pvr_dr_commit(hdr);
doquad(0.0f, 0.0f, 4e6f, 640.0f, 480.0f,
doquad(0.0f, 0.0f, 4e6f, SCREEN_WIDTH, 480.0f,
0.0f, 640.0f / 8.0f, 0.0f, 480.0f / 8.0f, 0xffffffff);
cxt.blend.dst_enable = PVR_BLEND_DISABLE;
@@ -1005,7 +1072,7 @@ void dcMotionBlur_v3(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
pvr_poly_compile(hdr, &cxt);
pvr_dr_commit(hdr);
doquad(0.0f, 0.0f, 4e6f, 640.0f, 480.0f,
doquad(0.0f, 0.0f, 4e6f, SCREEN_WIDTH, 480.0f,
0.0f, 640.0f / 8.0f, 0.0f, 480.0f / 8.0f, 0xffffffff);
});
}
@@ -1098,6 +1165,7 @@ static bool doAlphaTest;
static uint8_t fogFuncPvr = PVR_FOG_DISABLE;
static uint32_t fogColor = 0;
static float fogStart = 0.0f;
static uint32 cullModePvr;
static inline unsigned pvrCullMode(uint32_t cullMode) {
@@ -1198,8 +1266,9 @@ setRenderState(int32 state, void *pvalue)
fogFuncPvr = value ? PVR_FOG_TABLE : PVR_FOG_DISABLE;
break;
case FOGCOLOR:
#if !defined(DC_TEXCONV)
// Set fog color when state changes
if(fogColor != value) {
if(fogColor != value || fogStart != RwCameraGetFogDistance(rwdcCam)) {
fogColor = value;
RGBA c;
c.red = value;
@@ -1207,9 +1276,22 @@ setRenderState(int32 state, void *pvalue)
c.blue = value>>16;
c.alpha = value>>24;
pvr_fog_table_color(c.alpha / 255.0f, c.red / 255.0f, c.green / 255.0f, c.blue / 255.0f);
pvr_fog_table_linear(50.0f, 450.0f);
fogStart = RwCameraGetFogDistance(rwdcCam);
float fogEnd = RwCameraGetFarClipPlane(rwdcCam);
float fogIntensity[129];
uint8_t idx = 0;
float startIntensity = (-fogStart) / (fogEnd - fogStart); //interpolate between start and end to get initial intensity
float step = (1.0f - startIntensity) / 129; // we have 129 entries, create a step such that start + (step*129) = 1.0
for(int i = 128; i >= 0; i--) {
fogIntensity[i] = startIntensity + (idx++ * step);
}
pvr_fog_far_depth(fogEnd);
pvr_fog_table_custom(fogIntensity);
}
#endif
break;
// case CULLMODE:
// if(rwStateCache.cullmode != value){
// rwStateCache.cullmode = value;
@@ -2342,6 +2424,36 @@ __attribute__ ((noinline)) void submitMeshlet(uint8_t* OCR, const int8_t* indexD
} while(--indexCount);
}
template<bool textured>
__attribute__ ((noinline)) void submitMeshletFallback(uint8_t* OCR, const int8_t* indexData, uint32_t indexCount) {
struct SQBUF {
union {
uint32_t flags;
uint64_t data[4];
uint8_t data8[32];
};
};
SQBUF* sq = (SQBUF*)pvr_dr_target(drState);
static_assert(sizeof(SQBUF) == 32);
do {
auto idx = *indexData++;
auto flags = idx & 0x80 ? PVR_CMD_VERTEX_EOL : PVR_CMD_VERTEX;
auto lookup_idx = idx & 0x7F;
auto src = (SQBUF*)(OCR + lookup_idx * 64);
src[0].flags = flags;
*sq = src[0];
pvr_dr_commit(sq);
if (textured) {
*sq = src[1];
pvr_dr_commit(sq);
}
} while(--indexCount);
}
#if defined(DC_SH4)
template<>
@@ -2421,7 +2533,7 @@ __attribute__ ((noinline)) void submitMeshlet<true>(uint8_t* OCR, const int8_t*
// 8 kb in total
#if defined(DC_SH4)
uint8_t* OCR_SPACE = (uint8_t*)0x92000000;
uint8_t* OCR_SPACE;
#else
uint8_t OCR_SPACE[32 * 256] __attribute__((aligned(32)));
#endif
@@ -2652,6 +2764,159 @@ __attribute__ ((noinline)) void clipAndsubmitMeshlet(uint8_t* vertexData, const
}
};
} while(indexCount != 0);
#undef FILLVERT
#undef SUBMIT_VTX
#undef SUBMIT_INTERPOLATE
}
template<bool textured>
__attribute__ ((noinline)) void clipAndsubmitMeshletFallback(uint8_t* vertexData, const int8_t* indexData, uint32_t indexCount) {
struct SQBUF {
union {
uint32_t flags;
uint64_t data[4];
uint8_t data8[32];
};
};
static_assert(sizeof(SQBUF) == 32);
SQBUF* sq = (SQBUF*)pvr_dr_target(drState);
constexpr int8_t VERTEX = 0;
constexpr int8_t VERTEX_EOL = 0x80;
#define FILLVERT(n) \
do { \
auto idx = *indexData++; \
auto local_idx = idx & 0x7f; \
eol_now = idx & 0x80; \
auto local_ptr = (vertexData + local_idx * 64); \
vpp[n] = local_ptr; \
auto v = (const pvr_vertex64_t*)local_ptr; \
vismask >>= 1; \
if((textured?v->tex_z:v->o_b) >= -v->o_g) vismask |= 0b100; \
indexCount--; \
currentCount++; \
} while(0)
#define SUBMIT_VTX(vid, eolf) \
do { \
auto src = (SQBUF*) vpp[vid]; \
src[0].flags = eolf ? PVR_CMD_VERTEX_EOL : PVR_CMD_VERTEX; \
*sq = src[0]; \
pvr_dr_commit(sq); \
if (textured) { \
*sq = src[1]; \
pvr_dr_commit(sq); \
} \
} while(0)
#define SUBMIT_INTERPOLATE(vid1, vid2, eolf) \
do { \
sq = (SQBUF*)interpolateAndSubmit<textured>(sq, vpp[vid1], vpp[vid2], eolf ? PVR_CMD_VERTEX_EOL : PVR_CMD_VERTEX); \
} while(0)
uint32_t vismask = 0;
uint8_t* vpp[3];
int8_t eol = 0;
int8_t eol_now = 0;
do {
uint32_t currentCount = -1;
FILLVERT(0);
FILLVERT(1);
FILLVERT(2);
if (vismask & 1) {
SUBMIT_VTX(0, VERTEX);
if (vismask & 2) {
// both first verts visible
SUBMIT_VTX(1, VERTEX);
} else {
// 0 visible, 1 hidden
SUBMIT_INTERPOLATE(0, 1, VERTEX);
}
} else if (vismask & 2) {
// 0 hidden, 1 visible
SUBMIT_INTERPOLATE(1, 0, VERTEX);
SUBMIT_VTX(1, VERTEX);
}
eol = 0;
// each remaining vertex of the strip
while(!eol) {
// "ring buffery" indices
uint8_t vertZeroIdx = (currentCount - 2) % 3;
uint8_t vertOneIdx = (currentCount - 1) % 3;
uint8_t vertTwoIdx = currentCount % 3;
//dcache_pref_block(&vph[vertZeroIdx]); not sure where to put this honestly -jaxyn
eol = eol_now;
if (!vismask) {
if (!eol) {
// "ring buffery" filling
FILLVERT(vertZeroIdx);
}
continue;
}
if (vismask == 7) {
// all visible
SUBMIT_VTX(vertTwoIdx, eol);
if (!eol) {
// "ring buffery" filling
FILLVERT(vertZeroIdx);
}
continue;
}
switch (vismask) {
case 1: // 0 visible, 1 and 2 hidden
// pause strip
SUBMIT_INTERPOLATE(vertZeroIdx, vertTwoIdx, VERTEX_EOL);
break;
case 3: // 0 and 1 visible, 2 hidden
SUBMIT_INTERPOLATE(vertZeroIdx, vertTwoIdx, VERTEX);
SUBMIT_VTX(vertOneIdx, VERTEX);
case 2: // 0 hidden, 1 visible, 2 hidden
SUBMIT_INTERPOLATE(vertOneIdx, vertTwoIdx, eol);
break;
case 4: // 0 and 1 hidden, 2 visible
SUBMIT_INTERPOLATE(vertTwoIdx, vertZeroIdx, VERTEX);
if (currentCount & 0x01) { // flip directionality
case 5: // 0 visible, 1 hidden, 2 visible
SUBMIT_VTX(vertTwoIdx, VERTEX);
}
SUBMIT_INTERPOLATE(vertTwoIdx, vertOneIdx, VERTEX);
SUBMIT_VTX(vertTwoIdx, eol);
break;
case 6: // 0 hidden, 1 and 2 visible
SUBMIT_INTERPOLATE(vertTwoIdx, vertZeroIdx, VERTEX);
SUBMIT_VTX(vertOneIdx, VERTEX);
SUBMIT_VTX(vertTwoIdx, eol);
break;
default:
break;
}
if (!eol) {
// "ring buffery" filling
FILLVERT(vertZeroIdx);
}
};
} while(indexCount != 0);
#undef FILLVERT
#undef SUBMIT_VTX
#undef SUBMIT_INTERPOLATE
}
@@ -2918,16 +3183,26 @@ static constexpr void (*tnlMeshletDiffuseColorSelector[8])(uint8_t* dstCol, cons
&tnlMeshletDiffuseColor<4, true>,
};
static constexpr void (*submitMeshletSelector[2])(uint8_t* OCR, const int8_t* indexData, uint32_t indexCount) = {
static void (*submitMeshletSelector[2])(uint8_t* OCR, const int8_t* indexData, uint32_t indexCount) = {
&submitMeshlet<false>,
&submitMeshlet<true>,
};
static constexpr void (*clipAndsubmitMeshletSelector[2])(uint8_t* OCR, const int8_t* indexData, uint32_t indexCount) = {
static void (*submitMeshletSelectorFallback[2])(uint8_t* OCR, const int8_t* indexData, uint32_t indexCount) = {
&submitMeshletFallback<false>,
&submitMeshletFallback<true>,
};
static void (*clipAndsubmitMeshletSelector[2])(uint8_t* OCR, const int8_t* indexData, uint32_t indexCount) = {
&clipAndsubmitMeshlet<false>,
&clipAndsubmitMeshlet<true>,
};
static void (*clipAndsubmitMeshletSelectorFallback[2])(uint8_t* OCR, const int8_t* indexData, uint32_t indexCount) = {
&clipAndsubmitMeshletFallback<false>,
&clipAndsubmitMeshletFallback<true>,
};
static constexpr void(*tnlMeshletSkinVerticesSelector[4])(uint8_t *OCR, uint8_t *OCR_normal, const uint8_t* vertex, const uint8_t* normals, const uint8_t* skinWeights, const uint8_t* skinIndexes, int vertexCount, int vertexSize, Matrix* skinMatrices) = {
&tnlMeshletSkinVertices<false, false>,
&tnlMeshletSkinVertices<true , false>,
@@ -3219,6 +3494,15 @@ void pvr_poly_cxt_txr_fast(pvr_poly_hdr_t *hdr, pvr_list_t list,
size_t vertexBufferFree() {
size_t end = PVR_GET(PVR_TA_VERTBUF_END);
size_t pos = PVR_GET(PVR_TA_VERTBUF_POS);
size_t free = end - pos;
return free;
}
void defaultRenderCB(ObjPipeline *pipe, Atomic *atomic) {
rw::Camera *cam = engine->currentCamera;
@@ -3285,6 +3569,8 @@ void defaultRenderCB(ObjPipeline *pipe, Atomic *atomic) {
for (int16_t n = 0; n < numMeshes; n++) {
bool doBlend = meshes[n].material->color.alpha != 255; // TODO: check all vertexes for alpha?
bool doBlendMaterial = doBlend;
bool textured = geo->numTexCoordSets && meshes[n].material->texture;
if (textured) {
doBlend |= Raster::formatHasAlpha(meshes[n].material->texture->raster->format);
@@ -3334,7 +3620,7 @@ void defaultRenderCB(ObjPipeline *pipe, Atomic *atomic) {
pvr_poly_cxt_t cxt;
int pvrList;
if (doBlend || isMatFX) {
if (doAlphaTest) {
if (doAlphaTest && !doBlendMaterial) {
pvrList = PVR_LIST_PT_POLY;
} else {
pvrList = PVR_LIST_TR_POLY;
@@ -3400,6 +3686,9 @@ void defaultRenderCB(ObjPipeline *pipe, Atomic *atomic) {
// clipping performed per meshlet
auto renderCB = [contextId, n] {
if (vertexBufferFree() < (128 * 1024)) {
return;
}
const atomic_context_t* acp = &atomicContexts[contextId];
auto geo = acp->geo;
auto mesh = geo->meshHeader->getMeshes() + n;
@@ -3697,7 +3986,7 @@ void defaultRenderCB(ObjPipeline *pipe, Atomic *atomic) {
};
if (doBlend || isMatFX) {
if (doAlphaTest) {
if (doAlphaTest && !doBlendMaterial) {
ptCallbacks.emplace_back(std::move(renderCB));
} else {
blendCallbacks.emplace_back(std::move(renderCB));
@@ -4234,6 +4523,32 @@ rasterToImage(Raster*)
return nil;
}
static pvr_init_params_t pvr_params = {
.opb_sizes = {
PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_8, PVR_BINSIZE_0,
PVR_BINSIZE_8
},
.vertex_buf_size = (1024 + 1024) * 1024,
.dma_enabled = 0,
.fsaa_enabled = 0,
.autosort_disabled = true,
.opb_overflow_count = 7 // 268800 bytes
};
static void makeVideoModeList() {
videoModes[0].width = 640;
videoModes[0].height = 480;
videoModes[0].depth = 16;
videoModes[0].flags = VIDEOMODEEXCLUSIVE;
videoModes[1].width = 1280;
videoModes[1].height = 480;
videoModes[1].depth = 16;
videoModes[1].flags = VIDEOMODEEXCLUSIVE;
}
int
deviceSystem(DeviceReq req, void *arg0, int32 n)
{
@@ -4262,14 +4577,14 @@ deviceSystem(DeviceReq req, void *arg0, int32 n)
// TODO: implement subsystems
case DEVICEGETVIDEOMODEINFO:{
makeVideoModeList(); // On startup this is not yet called
auto rwmode = (VideoMode*)arg0;
rwmode->width = 640;
rwmode->height = 480;
rwmode->depth = 16;
rwmode->flags = VIDEOMODEEXCLUSIVE;
rwmode->width = videoModes[n].width;
rwmode->height = videoModes[n].height;
rwmode->depth = videoModes[n].depth;
rwmode->flags = videoModes[n].flags;
return 1;
}
}
case DEVICEGETMAXMULTISAMPLINGLEVELS:
{
@@ -4282,11 +4597,21 @@ deviceSystem(DeviceReq req, void *arg0, int32 n)
case DEVICESETSUBSYSTEM:
return 1;
case DEVICEGETNUMVIDEOMODES:
return 1;
return VIDEO_MODES;
case DEVICEGETCURRENTVIDEOMODE:
return 0;
return VIDEO_MODE;
case DEVICESETVIDEOMODE:
return 1;
{
makeVideoModeList(); // On startup this is called before driverOpen
VIDEO_MODE = n;
SCREEN_WIDTH = videoModes[VIDEO_MODE].width;
SCREEN_HEIGHT = videoModes[VIDEO_MODE].height;
pvr_params.fsaa_enabled = n;
return 1;
}
default:
assert(0 && "not implemented");
return 0;
@@ -4314,15 +4639,7 @@ Device renderdevice = {
deviceSystem
};
static pvr_init_params_t pvr_params = {
.opb_sizes = {
PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_8, PVR_BINSIZE_0,
PVR_BINSIZE_8
},
.vertex_buf_size = (1024 + 1024) * 1024,
.autosort_disabled = true,
.opb_overflow_count = 7 // 268800 bytes
};
void defaultInstance(ObjPipeline *pipe, Atomic *atomic) {
#if defined(DC_TEXCONV)
@@ -4348,6 +4665,36 @@ ObjPipeline* makeDefaultPipeline(void)
static void*
driverOpen(void *o, int32, int32)
{
makeVideoModeList();
#if defined(DC_SH4)
OCR_SPACE = (uint8_t*)0x92000000;
bool has_oix = true;
enter_oix();
*(volatile uint8_t*)OCR_SPACE = 1;
if (*(volatile uint8_t*)OCR_SPACE != 1) {
has_oix = false;
}
leave_oix();
if (!has_oix) {
dbglog(DBG_CRITICAL, "You appear to be using an emulator that does not support OIX. Attempting fallback to OCR\n");
OCR_SPACE = (uint8_t*)0x7c001000;
enter_oix = (void(*)())(((uintptr_t)&enter_ocr_) - 0x8c000000 + 0xAc000000);
leave_oix = (void(*)())(((uintptr_t)&leave_ocr_) - 0x8c000000 + 0xAc000000);
for (size_t i = 0; i < ARRAY_SIZE(submitMeshletSelector); i++) {
submitMeshletSelector[i] = submitMeshletSelectorFallback[i];
}
for (size_t i = 0; i < ARRAY_SIZE(clipAndsubmitMeshletSelector); i++) {
clipAndsubmitMeshletSelector[i] = clipAndsubmitMeshletSelectorFallback[i];
}
}
#endif
pvr_init(&pvr_params);
fake_tex = pvr_mem_malloc(sizeof(fake_tex_data));
@@ -4383,6 +4730,8 @@ driverClose(void *o, int32, int32)
{
pvr_mem_free(fake_tex);
pvr_shutdown();
return o;
}

View File

@@ -313,6 +313,34 @@ conv_ARGB1555_from_RGBA5551(uint8 *out, uint8 *in)
out[1] = g>>3 | r<<2 | a<<7;
}
void conv_RGB888_from_BGR565(uint8 *out, uint8 *in)
{
uint16_t col = in[0] | in[1]<<8;
uint32 r, g, b;
r = (col>>11) & 0x1F;
g = (col>>5) & 0x3F;
b = (col>>0) & 0x1F;
out[0] = r*0xFF/0x1f;
out[1] = g*0xFF/0x3f;
out[2] = b*0xFF/0x1f;
}
void conv_RGBA8888_from_BGRA4444(uint8 *out, uint8 *in)
{
uint16_t col = in[0] | in[1]<<8;
uint32 r, g, b, a;
a = (col>>12) & 0xF;
r = (col>>8) & 0xF;
g = (col>>4) & 0xF;
b = (col>>0) & 0xF;
out[0] = r*0xFF/0xf;
out[1] = g*0xFF/0xf;
out[2] = b*0xFF/0xf;
out[3] = a*0xFF/0xf;
}
void
conv_RGBA8888_from_ARGB1555(uint8 *out, uint8 *in)
{

View File

@@ -328,6 +328,8 @@ void conv_ARGB1555_from_ARGB1555(uint8 *out, uint8 *in);
void conv_ARGB1555_from_RGB555(uint8 *out, uint8 *in);
void conv_RGBA5551_from_ARGB1555(uint8 *out, uint8 *in);
void conv_ARGB1555_from_RGBA5551(uint8 *out, uint8 *in);
void conv_RGB888_from_BGR565(uint8 *out, uint8 *in);
void conv_RGBA8888_from_BGRA4444(uint8 *out, uint8 *in);
void conv_RGBA8888_from_ARGB1555(uint8 *out, uint8 *in);
void conv_ABGR1555_from_ARGB1555(uint8 *out, uint8 *in);
inline void conv_8_from_8(uint8 *out, uint8 *in) { *out = *in; }