Commit graph

1028 commits

Author SHA1 Message Date
gm-matthew ac53101214 Implement LOD blending
If two translucent polygons with opposing patterns overlap the result is always opaque
Also the LOD scale calculation depends on Euclidean distance of x, y and z, not just z
2023-11-17 15:13:27 +00:00
Ian Curtis a065df24b8 Correct scroll fog attenuation logic (gm_matthew)
The attenuation value effects the spot light on fog for the scroll fog layer. The old implemention was nearly correct but the paramaters for the mix function were swapped.
2023-11-05 23:44:27 +00:00
Ian Curtis aecf61762e Various fixes
- Scroll fog needed a break statement otherwise it could draw potentially multiples times.
- The fog atttenuation paramater doesn't appear to effect scroll fog, other than to potentially enable it. This fixes some issues with emergency call ambulance.
- Added support for the node discard attributes which sega rally2 uses to throw away specific geometry. This fixes junk that starts to show up in the levels after multiple runs.
2023-11-05 17:39:23 +00:00
dukeeeey 628eeebbc3
Merge pull request #101 from gm-matthew/lod-and-blending
Add LOD switching and blending out culling nodes
2023-11-03 19:56:17 +00:00
Ian Curtis 8dda8e9105 Fix the line of sight function.
Polygons have a line of sight value that's either a 0 or 1. We write this value into the stencil buffer, then read the app can read it back to determine the polygon attribute is visible or not. The returned value is 1/depth value in world coordinates. The first bit of the float is actually a control bit, 1 indicates no geometry hit, 0 indicates geometry hit.
2023-11-03 13:24:59 +00:00
gm-matthew 483dbdda2e Add LOD switching and blending out culling nodes
We're not blending between LODs yet as we're not sure of the best way to implement it
Also implementing control bits for disable culling and enable model scale (needed for ECA and Harley)
2023-11-02 14:16:07 +00:00
Ian Curtis 3a85bd9e25 remove debug code 2023-11-01 16:03:11 +00:00
Ian Curtis d16ba90856 Update comments for the culling node function. gm_matthew worked out that the last 2 bits of the model scale float appear to be control bits for disable culling and valid model scale. Strange logic but the line of sight (LOS) function does something similar by re-using float bits for control words. 2023-11-01 16:01:13 +00:00
Ian Curtis 37065ce478 Merge branch 'master' of https://github.com/trzy/Supermodel 2023-10-31 23:50:33 +00:00
Ian Curtis 8fea5bd3bf gm_mathew - the line scroll values, the top 16bits are the even lines, the bottom 16bits are the odd lines. We had it swapped. This fixes the number below the word results in daytona, when you finish a game. 2023-10-31 23:50:19 +00:00
Bart Trzynadlowski d42317db83
Update README.md to define GIF widths (for Safari) 2023-10-30 14:47:25 -07:00
Ian Curtis acab274526 Set language standard to c++ 17 2023-10-30 14:04:48 +00:00
Ian Curtis f89da17f17 Fix white gfx on linux / intel gpus. These optimisations originally came from toxieainc 2023-10-27 10:45:16 +01:00
Ian Curtis c5f9a3ad26 Amend the ambient fog logic to be disabled if fog density/start is set to zero. This fixes a regression where the sky stops drawing in lost world.
Rewrite the scroll fog shader slightly. Scroll fog is a 2d layer, it has no depth, or can be considered to be drawn at infinity, therefore is not effected by the viewport light. The scroll attenatuion value also I think attenatutes the scroll fog alpha value. This fixes various effects in emergency call ambulance.
2023-10-24 10:17:15 +01:00
Ian Curtis a214c6dae8 Prior scroll fog logic was nearly correct. For scroll fogging to draw it needs either a start value or a fog density value, but these can come from a different viewport if they have the same colour fog set. This fixes the credits in vf3 which sets scroll fog, but it never draws on the original hardware.
For a long time we've had bug reports that in vf3 the background in the Dural levels was the wrong colour, it should have been much darker. We thought it was again missing scroll fog, but gm_mathew worked out it was actually coming from the fogAmbient paramater. Not only does it darken the fog, but it also has an effect on the 2d background from the tilegen, similar to scroll fog. This also fixes the sky in lemans24.
2023-10-22 21:07:35 +01:00
Ian Curtis 2af0787279 Remove debug code 2023-10-17 17:33:26 +01:00
Ian Curtis 79ddc8c739 Rewrite the logic for the scoll fog (render buffer clear colour). Each viewport can potentially have a scroll fog value so the logic of which value to pick wasn't immediately clear. TLDR I think it picks the highest value starting from the lowest priority layers. This fixes the sky in daytona battle on the edge. 2023-10-17 17:30:14 +01:00
Ian Curtis 86d477263f Scroll fog is like a clear colour for the render target, but can be semi transparent as the tilegen layer can be shown underneath. I assumed that transprent polys would be drawn to the render target for transparent polys but unfortunately the logic does not work. So where else could it be drawn? Well with limited memory it must be draw to the buffer for opaque polys, which means this render target is also blended. 2023-10-15 17:16:52 +01:00
gm-matthew 392900fee2 Implement correct "round to nearest" mode
On PowerPC round to nearest ties to even, not away from zero
Also implement correct behavior for ppc_fresx
Fixes "tips to win" sequence in Daytona 2 BOTE
2023-10-14 17:45:27 -07:00
Ian Curtis d32641030d Merge branch 'master' of https://github.com/trzy/Supermodel 2023-10-14 20:05:07 +01:00
Ian Curtis 6595b9320e Rewrite the renderer a bit to spit out the finished graphics from the 3d chip on separate buffers. One buffer is for opaque pixels, and 2 more for translucent pixels. Before the frame was composited on the back buffer, which meant the tilegen had to have been drawn first. This way the images are now totally independant of the tilegen chip so can be drawn as soon as the register write 0xC is written to the tilegen.
Some games update the tilegen after the ping_ping bit has flipped at 66% of the frame, so we need to split the tilegen drawing up into two stages to get some effects to work. So having the tilegen draw independantly of the 3d chip can make this happen.
2023-10-14 20:05:00 +01:00
Bart Trzynadlowski 0e494a0219 Updated build script to use SFTP (Supermodel3.com server upgrade no longer supports ftp) 2023-10-03 18:02:19 -07:00
Ian Curtis d656643087 gm_mathew worked out that the camera flashes in sega rally 2 have the 'reset-matrix' attribute set inside the culling nodes, which was unsupported until now because we never found any games to have used this bit. The reset matrix is a bit strange, I would assume it would just reset the matrix back to identity, instead it seems to just reset the rotation back to identity whilst preserving the scale/position. 2023-09-27 16:33:53 +01:00
Bart Trzynadlowski e6b5468680
Update README.md: copyright dates. 2023-09-25 14:46:28 +02:00
Bart Trzynadlowski 7867c0145e
Model3.cpp: Comment describing scan line timing. 2023-09-25 14:45:57 +02:00
Matthew Daniels 801945d066 Whitespace 2023-09-25 14:41:35 +02:00
gm-matthew 24d24db988 Ping-pong flip timing depends of the value of tilegen register 0x08
Also make the debugger display 16 bytes per line when using the "listmemory" command. Mirrored system registers can now be watched
2023-09-25 14:41:35 +02:00
Ian Curtis a00e8de988 Update rules file. Not tested this but hopefully it should work 2023-09-23 17:28:18 +01:00
Ian Curtis 6b0d5c453a Merge branch 'master' of https://github.com/trzy/Supermodel 2023-09-23 15:27:12 +01:00
Ian Curtis c6ea81d996 Emulate the entire tilegen chip in a GLSL shader. (This is now possible with opengl 3+). The tilegen drawing was emulated on the CPU, but was one of the most expensive functions in the emulator according to a profiler. On a modern GPU it's pretty much free, because a GPU is a massive SIMD monster.
Tilegen shaders are mapped to uniforms, and the vram and palette are mapped to two textures.

TODO rip out the redundant code in the tilegen class. We don't need to pre-calculate palettes anymore. etc

The tilegen code supports has a start/end line so we can emulate as many lines as we want in a chunk, which will come in later as some games update the tilegen immediately after the ping_pong bit has flipped ~ 66% of the frame.

The scud rolling start tilegen bug is probably actually a bug in the original h/w implementation, that ends up looking correct on original h/w but not for us. Need hardware testing to confirm what it's actually doing.
2023-09-23 15:27:04 +01:00
gm-matthew 38a95088e8 Prevent "ROLLING START" scrolling glitch in Scud Race
There is a quirk of the tilegen chip that causes this glitch not to occur on real hardware, but we can't be sure what it is without testing
Much easier to just patch all the Scud Race ROM sets
2023-09-02 20:40:40 -07:00
gm-matthew c9b718e89a Fix Z80Debug.cpp compile with C++20
String literals should not be used to initialize char* but C++17 and earlier were letting it slide
2023-09-02 20:38:24 -07:00
Bart Trzynadlowski ebff9a8b2d SCSP: added more detail to comment explaining 68K clock speed as recommended by Brian Troha 2023-09-02 20:32:11 -07:00
gm-matthew b2fee4242c DMA device register always returns Step 1.x PCI ID
Step 2.x games by AM3 request PCI ID this way and expect to see 0x16c311db
2023-08-20 17:43:40 -07:00
gm-matthew 7924fed369 Set soundboard CPU to correct clock speed
The 68K on the soundboard is rated at 12 MHz but runs at 11.2896 MHz, which is 256 cycles/sample with a 44100 Hz sample rate. Removed SoundClock and Freq as they are not needed
2023-08-20 17:43:27 -07:00
gm-matthew 015e8e9212 Drive board uses the value 0xFF (not 0x00) on ports 42 and 45 to stop all effects when port 46 is set to 0xFF; fixes FFB effects continuing after game ends 2023-07-01 23:21:51 -07:00
Matthew Daniels 84aa972ef2 Add description of swtrilgy patch from MAME
Star Wars Trilogy will sometimes write to a JTAG register and then read it back to verify it, but this doesn't work correctly with Supermodel's current JTAG implementation; it will try again and never succeed, getting stuck in an infinite loop. This patch stops the code from branching up and trying the write/read cycle again, allowing the subroutine to continue normally.

We need to implement shift register widths correctly for each JTAG device (Mercury, Venus, Earth, etc.) for the unpatched code to work properly... right now Supermodel implements one JTAG device with a huge 197-bit data shift register
2023-05-16 23:56:03 -07:00
Bart Trzynadlowski ac0e6407b4 Games.xml: Removed seemingly unnecessary swtrilgy and swtrilgya patches, which should re-enable JTAG configuration and fix Endor Death Star tunnel shading 2023-05-07 21:51:22 -07:00
ToBul 583d237b2b Fix GCC 13 build.
MSYS and probably a few Linux distros are now shipping GCC 13.
The new standards and issues are listed here,

https://gcc.gnu.org/gcc-13/porting_to.html
2023-05-07 21:42:21 -07:00
CapitaineSheridan 18f3c23a9f Work around to prevent I/O error after a while on fishing games with tension 2023-05-07 21:41:57 -07:00
CapitaineSheridan 813edb8218 Crosshair optimization:
-create crosshairs only once in Init() instead of created them at every cycle
-use matrix scale to apply the aspect ratio
2023-05-07 21:41:05 -07:00
Bart Trzynadlowski 6993dfcfb0 Makefile.Win32: fixed detection of Windows Command Prompt for rmdir command 2023-03-28 15:38:43 -07:00
Bart Trzynadlowski 87de86f7d1 Crosshair: use actual adjusted viewport resolution (configuration resolution is not the same thing). Fixes crosshair alignment for resolutions with non-Model 3 aspect. 2023-03-18 10:00:28 -07:00
Bart Trzynadlowski 95fc08e0a3 Windows app manifest added to enable PerMonitorV2 DPI awareness 2023-03-15 18:24:01 -07:00
ToBul f497de50d1 Update README.txt
Fix old typos, leaving alone the American English.
Remove the "Virtua Striker 2 '99" unlock code.
I don't think it works,  others have also tried,
https://www.supermodel3.com/Forum/viewtopic.php?f=3&t=2096&p=19784#p19784
2023-03-15 17:35:48 -07:00
Bart Trzynadlowski 5fdb50a869 README.txt: Updated Section 5 (video settings), squeezed everything back into 80 columns, changed 'Virtua Fighter 2 '98' to 'Virtua Striker 2 '98' in Section 10 2023-03-14 17:56:17 -07:00
Bart Trzynadlowski b5ca365928 NetBoard: guard against freeing null pointers and INetBoard needed a virtual destructor (was causing crashes on exit on some systems) 2023-03-14 11:18:20 -07:00
CapitaineSheridan 3848d276da Autobuild script update following crosshair update 2023-03-14 00:59:18 -07:00
CapitaineSheridan abc2900770 m_crosshair is not needed and the config should be checked every frame because otherwise Alt-I command was broken (the number of crosshairs to render is mapped to a UI key) [Bart] 2023-03-13 20:18:51 -07:00
CapitaineSheridan a319bbee0c Better optimisations.
Moved all UI rendering from Main to CCrosshair.
Take care of syntax about crosshair style.
2023-03-13 20:18:51 -07:00