Commit graph

532 commits

Author SHA1 Message Date
Ian Curtis 89e75a9803 Only check scroll fog value from the first viewport from each priority layer. Seems to fix problems with background fogging. 2016-12-14 19:57:05 +00:00
Ian Curtis 707e945db9 delete unused files 2016-12-09 14:15:11 +00:00
Ian Curtis 2c23268d88 Support microtexture relative scale. The exact scaling values are not known, but a 2x difference between each level seems highly likely. We know from visual inspection from scud that the first level is exactly 4. The SDK has a function that accepts a float input for scale and does this. lod = (1/scale) + 0.5. If lod>3 lod = 3. So this is our best guess. 2016-12-09 14:13:46 +00:00
Ian Curtis da8b63b44b The model3 shares vertices between polygons. But it also seems to do this for polygons with different textures. This means the texture coordinate for potentially different sizes textures is shared. Currently this was broken leading to some corrupted looking textures. The fix is to simply cache the old texture coordinates, and recalculate the normalised coordinates in the new texture coordinate space. 2016-12-06 14:39:46 +00:00
Ian Curtis 10a5d2c0e1 refactor 2016-12-06 12:25:34 +00:00
Ian Curtis eece2d75b4 tweak scroll fog logic 2016-12-04 22:37:49 +00:00
Ian Curtis adbebb0204 clean up 2016-12-04 22:37:22 +00:00
Ian Curtis a310e8e5cf minor optimisations 2016-11-28 17:32:25 +00:00
Ian Curtis abc8c24b69 Only check the geometry for culling with valid node distances. We will need this later. 2016-11-27 19:30:46 +00:00
Ian Curtis fe60d115d2 Revert changes .. if we clip against the real3d clipping planes, our wide screen hack won't work anymore. 2016-11-26 01:19:51 +00:00
Ian Curtis 665fa90425 Get clipping planes directly from the viewport data. Also no need to clip against a far plane 2016-11-26 01:12:08 +00:00
Ian Curtis 54c405709f Need to walk back in memory and check the previous texture tiles to see if they overlap with the current textures being invalidated. If they overlap they must be cleared too. Algorithm is a bit brute forcy and more expensive than I'd like but it fixes the bad textures in Spikeout. 2016-11-22 20:30:10 +00:00
Ian Curtis 84ae8f035c Skip processing the mipmap section of memory. The real3d doesn't create mipmaps down to 1x1 that is needed to do mipmapping properly on modern hardware anyway. 2016-11-21 09:04:56 +00:00
Ian Curtis 2ddc8a30e0 Clear queued texture uploads after processing them. Saves re-uploading the same textures whilst paused 2016-11-20 17:02:59 +00:00
Ian Curtis 10dd530cde More accurate 2D colours. White should map to 255 not 248 2016-11-15 12:44:47 +00:00
Ian Curtis 483ba2f398 Fix the shading in scud. When lighting is disabled the fixed shading intensities appear to be offset values added to the colour value. 2016-11-11 17:50:27 +00:00
Ian Curtis 0a7c0d0864 change throttle logic for smoother playback, we could get closer to 60fps if SDL timers weren't so lame 2016-10-21 00:04:12 +00:00
Ian Curtis 2f49012786 change scroll fog logic to parse the lower priority viewports first 2016-10-09 18:10:57 +00:00
Ian Curtis f0a15febd1 implement scroll fog, fixes a tonne of missing fx 2016-10-09 16:34:12 +00:00
Ian Curtis ef11990d19 Parse out scrollfog value used for blending over the 2d background. 2016-10-08 15:41:16 +00:00
Ian Curtis 33e795de9b Fix scenes with missing fog in ocean hunter. The game was passing negative fog densities. The sign seems to be ignored by the model 3. 2016-10-08 15:15:25 +00:00
Ian Curtis 9eeb81ac69 same fix for legacy engine 2016-10-08 12:10:47 +00:00
Ian Curtis 33cf6c89d1 our scratch mem must match correct max texture size 2016-10-08 11:59:25 +00:00
Ian Curtis c472d90fb9 Fix the sky in advanced stage in Dirt Devils. It uses a massive (for 1998 :p) 1024x256 texture. 2016-10-06 20:10:45 +00:00
Ian Curtis c3581c9fe8 Support multiple microTextures, fixes crazy texturing in sega ski champ. I'm assuming microtextures are always located on the other memory bank to the base texture. This logic seems to work for all our games anyway. 2016-10-06 01:37:29 +00:00
Bart Trzynadlowski e21ea93319 Added RGBA4 format to BMP file writer 2016-09-07 01:25:27 +00:00
Bart Trzynadlowski 3df3610361 Made parsing of hex values more robust 2016-08-25 04:54:08 +00:00
Bart Trzynadlowski 458684eb22 Fixed new 3D engine's fragment shader to work on some older GPUs by reducing the number of discard statements to one 2016-08-24 22:21:18 +00:00
Bart Trzynadlowski 4b184b05dc Updated game loader to make use of latest changes to config tree: generic value types and eliminated pointers 2016-08-24 04:13:23 +00:00
Bart Trzynadlowski c2f80cef6b Support for hex numbers in string to integer conversions (with '0x' prefix) and special keywords in string to bool conversions (true/false/on/off/yes/no) 2016-08-24 04:11:52 +00:00
Bart Trzynadlowski f08ad1584f Added Util::Stricmp() and small tweak to serialization of Util::Format 2016-08-24 04:10:20 +00:00
Bart Trzynadlowski 2efe18b525 Added support for multiple value types in config nodes.
Removed Ptr_t and ConstPtr_t from public interface, moved config tree builders into their own file, and made them pass by reference and value.
Exceptions can be thrown now on lookup failures.
Removed s_empty_node -- failed lookups in [] operator create a permanent "hidden" child.
Updated comment in NewConfig.cpp.
2016-08-21 22:22:45 +00:00
Bart Trzynadlowski 01a6ad1596 Added copy constructor and assignment operator using C++11 move semantics 2016-08-19 00:01:45 +00:00
Bart Trzynadlowski a9816467d8 Defined inputs 2016-08-18 04:19:36 +00:00
Bart Trzynadlowski fbeeb3c922 Support for deep copies via assignment operator. This will pave the way for elimination of Ptr_t and ConstPtr_t. 2016-08-18 04:14:36 +00:00
Bart Trzynadlowski 5652aab91f Added Write() method to write buffer to an ostream, and added an ostream operator overload 2016-08-18 04:13:50 +00:00
Bart Trzynadlowski 1dc360a8b0 Changes to game loader interface, added 32-bit word swapping utility function 2016-08-11 03:53:19 +00:00
Bart Trzynadlowski a2423a8b75 Initial check-in of game loader (not operational yet) 2016-08-10 03:28:40 +00:00
Bart Trzynadlowski 037bfc648d Byte swapping utility function 2016-08-10 03:27:59 +00:00
Bart Trzynadlowski 718c237063 Added ValueAsBool(), ValueAsBoolWithDefault(), and ValueAsUnsignedWithDefault() 2016-08-10 03:27:01 +00:00
Bart Trzynadlowski 52d6eac7e5 Added Util::Config::Node::ValueAsUnsigned() with support for base 10 and 16 ('0x' prefix) 2016-07-10 04:25:41 +00:00
Bart Trzynadlowski 331d7042f2 Added Util::ToLower() 2016-07-10 04:25:12 +00:00
Bart Trzynadlowski a84aacf80b Config::Node::Add() now supports nested keys (e.g., Add("foo/bar/baz", "0") will create three nested config nodes) 2016-07-09 15:19:17 +00:00
Bart Trzynadlowski 24c341120a Changed Config::Node::Create() to Add() and added a Set() method (for INI semantics). Turned Test_Config.cpp into a proper unit test reporting pass/fail for each test. 2016-07-09 14:45:48 +00:00
Bart Trzynadlowski 2e069af603 Adding tinyxml2 lib 2016-07-07 05:05:27 +00:00
Bart Trzynadlowski 724dc93294 XML parsing support for new config system 2016-07-07 04:59:10 +00:00
Bart Trzynadlowski bcc663d4eb Moved logging functions into OSD/Logger.cpp (eventually logging system will be reworked entirely) and added new config tree structure (not yet used). 2016-07-05 01:15:58 +00:00
Bart Trzynadlowski 0ab486645c Updated Fragment_NoSpotlight.glsl (fragment shader for legacy engine without spot light) 2016-07-04 01:00:24 +00:00
Ian Curtis 732bff2769 disable spot light if the extent is zero 2016-06-29 20:53:19 +00:00
Ian Curtis efa7776871 parse some unimplemented spot light values from viewport 2016-06-27 17:35:27 +00:00
Bart Trzynadlowski de043355bc Marked offset of code in CROM for scudp 2016-06-24 01:01:30 +00:00
Ian Curtis d058a29ac8 stencil translucent non textured polys 2016-06-19 23:33:06 +00:00
Ian Curtis 85c4d85562 refactor 2016-06-19 21:43:09 +00:00
Ian Curtis c2b1db11f8 Cull geometry based on the culling distances in the nodes. Should give some sort of speedup on lower end pcs where the CPU is predominantly the bottle neck. 2016-06-16 20:05:29 +00:00
Bart Trzynadlowski f31f06b42e Fix compilation when SUPERMODEL_DEBUGGER enabled 2016-06-13 00:53:39 +00:00
Ian Curtis d799c63b1a cache bound texture 2016-06-10 11:29:20 +00:00
Ian Curtis 48a79a8f14 cleaning 2016-06-10 10:18:47 +00:00
Bart Trzynadlowski b0911afd1f Added drive board and lamp raw outputs (submitted by SailorSat) 2016-06-07 01:51:16 +00:00
Ian Curtis 8440bc7f03 support negative exponent 2016-06-03 09:33:46 +00:00
Ian Curtis 5081ee99dc Add code to convert the 16bit float format used by the hardware back into float 754 format. 16bit floats are used for the culling radiuses in the nodes. 2016-06-03 00:01:34 +00:00
Bart Trzynadlowski 6dc5845d47 Added -vsync and -no-vsync option descriptions to command line help 2016-06-02 23:51:43 +00:00
Ian Curtis 9bc1fbf0cb remove dead code 2016-06-02 21:26:50 +00:00
Bart Trzynadlowski 968652bcfb Added a Split() function to Util::Format. 2016-06-02 03:14:46 +00:00
Bart Trzynadlowski d1330d310c XInput fix: search for all three possible XInput DLLs (xinput1_4.dll, xinput1_3.dll, and xinput9_1_0.dll). I have not tested 32-bit builds. 2016-06-02 00:13:42 +00:00
Ian Curtis ff8e9d6aad Check for overflow. Fixes some fade effects 2016-05-30 23:10:56 +00:00
Bart Trzynadlowski 9a49fefe12 Legacy engine: fixed texture offsets (VON2 was broken by last commit). Texture coordinates are wrapped within the bank first and then the bank can be swapped. This also allows the full range of texture coordinate bits to be used as specified in the Pro-1000 SDK. 2016-05-30 19:18:11 +00:00
Ian Curtis 36074d9fd5 Y texture offsets are just 5 bits. Texture coordinate wrap around happens in the same texture sheet, not into the next one. Fixes various texturing bugs in sega rally. 2016-05-30 13:25:00 +00:00
Bart Trzynadlowski d1f49675b1 Legacy engine: Culling node texture Y offset is only 5 bits (fixes Sega Rally 2 initials decal) 2016-05-29 20:49:28 +00:00
Bart Trzynadlowski 2ee0d9018e New engine: modf -> std::modf (fixes compilation on gcc) 2016-05-28 20:54:25 +00:00
Bart Trzynadlowski 1a908dd414 Legacy engine: expanded color index to 12 bits from 11. Does this affect any games? 2016-05-28 20:50:05 +00:00
Bart Trzynadlowski 5c1a240565 New engine: expanded color indices to 12 bits from 11. Added PolygonHeader::ColorIndex and SensorColorIndex methods. 2016-05-28 20:49:10 +00:00
Bart Trzynadlowski 2ef5203839 Forgot to describe one polygon header field in Model.cpp 2016-05-28 20:40:45 +00:00
Bart Trzynadlowski e4a5c341dd Updated polygon header descriptions 2016-05-28 20:33:10 +00:00
Bart Trzynadlowski 0ebb8d5d47 Legacy engine: Added stencil buffering for layered models and shadows. Not as accurate as new engine because stencil buffering is applied per-model rather than per-polygon, so the entire model must consist of stencil-tested polygons. In practice, though, this seems to work fine. 2016-05-28 19:52:30 +00:00
Ian Curtis ce03c13847 Optimise non smooth texture repeat to only effect texture boundaries, rather than poly boundaries. Fixes a few ugly artefacts 2016-05-28 13:21:35 +00:00
Ian Curtis 661f19be19 fix transparency values, values are from 0-32, not 0-16 where the top bit disables 2016-05-27 22:20:57 +00:00
Ian Curtis 2086b1c9af Stencil layered polys, fixes shadow z fighting in some of the games. Other games maybe using stipple alpha (yuck), not sure yet. 2016-05-27 19:30:40 +00:00
Ian Curtis 8979246642 remove bad rom patches 2016-05-26 16:21:42 +00:00
Ian Curtis 3f9936d664 don't clamp after spot light code, looks much closer to h/w 2016-05-26 09:06:09 +00:00
Bart Trzynadlowski 8ba8d7290e Hooked up Sega Bass Fishing / Get Bass controls 2016-05-26 04:13:22 +00:00
Ian Curtis 89c987fae1 basic spotlight code 2016-05-26 00:08:12 +00:00
Bart Trzynadlowski a0910f96fb Fixed fog in legacy 3D engine. Now computed same as new engine, with 4-bit light modifier and corrected fog mixing in shaders. 2016-05-25 04:00:02 +00:00
Bart Trzynadlowski 6dc35f9563 Updated legacy engine vertex shader to use specular shininess and coefficient along with old equation. Still not correct (too strong compared to the old method). 2016-05-25 03:10:36 +00:00
Ian Curtis c5ce2b9679 fix alpha testing for texture format 7 2016-05-22 19:17:15 +00:00
Ian Curtis 65d6342947 remove dead code 2016-05-21 16:26:00 +00:00
Ian Curtis fd3eb49369 support 4 bit textures 2016-05-21 15:50:54 +00:00
Ian Curtis e108b56664 correctly mask pointers 2016-05-19 22:23:50 +00:00
Ian Curtis a79fd2786a optimise hash table access for better performance 2016-05-19 19:04:44 +00:00
Ian Curtis ff8d311dcc support colour table pointer 2016-05-18 23:06:41 +00:00
Ian Curtis 7e3c097a31 remove debug code 2016-05-16 17:26:53 +00:00
Ian Curtis 828fd8ebb4 Fog start is apparently the fog value at the viewport (0,0,0) I guess like an ambient value. Default value is negative 2016-05-16 17:10:04 +00:00
Ian Curtis 9e279a0c1f Non luminous polygons seem to be effected by the lightModifier also. API seems to have no restriction in this regard, neither does the SDK. The ocean hunter requires this for some of the 2d stuff. Light modifier values only seem to exist between 0-16, which is strange for 5 bits of precision. Possibly top bit disables the effect and lower 4 bits are the value. This clearly differs from the SDK, but without this the values come out clearly wrong. 2016-05-16 10:49:00 +00:00
Ian Curtis 62eafacfc3 adjust (hopefully correct) fog equation 2016-05-16 10:44:16 +00:00
Ian Curtis bc08276d60 preliminary specular 2016-05-15 16:24:49 +00:00
Bart Trzynadlowski c9147bc93d - Removed a stale comment 2016-05-14 06:31:44 +00:00
Bart Trzynadlowski 897b1acb21 Legacy renderer changes:
- Updated shading model. Unfortunately, it is far from perfect but it seems to be the best I can do for now. Not really much of a difference from before except that the Scud Race castle is fixed at the expense of the Yosemite level in LA Machineguns being too bright.
- Added lots of notes in the shading code.
- Passing both specular coefficient and shininess to shader. This will probably break specular lighting for now until the shader is updated to use the shininess correctly.
- Color table address in polygon RAM is now obtained from culling nodes as they are traversed (found this in the Pro-1000 SDK).
2016-05-14 06:25:35 +00:00
Bart Trzynadlowski 147faf37c9 Added palette bit to list of bits to dump for analysis 2016-05-14 06:21:56 +00:00
Ian Curtis c4b5b185c6 Disable light modifier on fog, seems not to work .. values don't make sense. Maybe the model3 doesn't use these. 2016-05-13 19:26:10 +00:00
Ian Curtis c8f8cd1655 remove dead code 2016-05-13 08:40:53 +00:00
Ian Curtis e295ad6868 double up polys for two sided polys, fixes some diffuse lighting problems 2016-05-13 08:39:48 +00:00
Bart Trzynadlowski ddf3d5213d FLT_MAX -> std::numeric_limits<float>::max() 2016-05-10 03:08:36 +00:00
Bart Trzynadlowski 8c082abab9 Added some IRQ-related code (commented out for now) from MAME findings. May incorporate in the future when investigating IRQs and timing again. 2016-05-10 03:08:03 +00:00
Ian Curtis 34c81eabee update header documentation 2016-05-09 16:53:12 +00:00
Ian Curtis 43add90d2f Fix bad texture seems 2016-05-09 16:26:34 +00:00
Bart Trzynadlowski 846c9d0edd Reverted stencil mask change. This reintroduces the Scud Race 'ROLLING START' bug. Previous 'fix' did not work for Magical Truck Adventure anyway and also broke some games (Daytona 2 transmission and course select screen, ECA title screen). The stencil mask is not shifted by 16 pixels and I suspect that either there is some unknown trick to horizontal scrolling or that the behavior is affected by hidden raster timing registers hidden in the JTAG interface. 2016-05-08 21:17:02 +00:00
Bart Trzynadlowski a9095e6c8e Added a register read handler for tilegen (although nothing seems to benefit from it) 2016-05-08 20:30:45 +00:00
Bart Trzynadlowski 9249eaa29f Fixed logic for clearing bottom layer. Added new functions to 2D renderer interface. Avoid drawing top and bottom surfaces when no layers are present there. Added some comments to tile 2016-05-08 19:27:08 +00:00
Bart Trzynadlowski 5d048958b9 Rewrote 2D renderer and fixed 2D layer priorities, stencil mask clipping (Scud Race 'ROLLING START'), and cleaned up code. Unfortunately, the new code is about 50% slower, mostly due to the need to perform stencil clipping after scrolling. 2016-05-07 21:54:03 +00:00
Ian Curtis 69a44a5d5f add texture helper functions 2016-05-07 18:57:06 +00:00
Ian Curtis 242cddac2d remove pointless loop 2016-05-07 15:45:02 +00:00
Ian Curtis ded3168060 Split face colour from per vertex poly colour. Fixes colour bleeding between connected polys in harley. 2016-05-07 15:28:04 +00:00
Bart Trzynadlowski 595e24ad60 Changed XInput DLL failure message 2016-05-07 03:25:05 +00:00
Ian Curtis 05e1e4de37 update poly header class 2016-05-06 15:00:12 +00:00
Bart Trzynadlowski fee1cfb126 Fixed compilation on gcc (gotos cannot cross variable declarations) 2016-05-05 22:01:59 +00:00
Ian Curtis da4bab5f9b Flat shaded polys can't share vertex normals with adjacent connected polys. Fixes some bad lighting in Harley on pavements 2016-05-05 08:06:06 +00:00
Ian Curtis b2da849d90 support flat shading 2016-05-05 00:01:17 +00:00
Ian Curtis 3693a51cbb Make sure texture is bound to correct texture unit, stop flashing micro textures in daytona 2016-05-04 16:30:15 +00:00
Ian Curtis b0569007ef set correct microtexture wrap mode 2016-05-04 10:30:58 +00:00
Ian Curtis c545b9fd85 preliminary microtexture 2016-05-04 00:35:07 +00:00
Ian Curtis 396fba7d24 skip viewports marked as disabled, might stop parsing some bad data 2016-05-03 21:17:37 +00:00
Ian Curtis 6d1aa4d527 fix compilation 2016-05-03 18:38:06 +00:00
Bart Trzynadlowski fa65542d76 Added support for A1RGB5 to BMP file writer and added a (commented-out) example of how to use it to dump texture memory in ~CReal3D() 2016-05-03 00:28:56 +00:00
Ian Curtis c459772f8e wrap invalid texture sizes, seems to fix bad textures in srally2 (skid marks) 2016-05-01 19:52:02 +00:00
Ian Curtis 7ec7906c0f Turn off lighting if fixed shading (or no normals) flag is present. Fixes some of the lighting weirdness in scud 2016-04-30 20:32:44 +00:00
Bart Trzynadlowski 48767b2267 Legacy engine: fixed per-vertex fixed shading to incorporate Ian's findings that the intensity value is signed and that fixed shading applies only when lighting is enabled 2016-04-30 16:23:25 +00:00
Ian Curtis 23a5839d46 Daytona seems to use 3 bits for texture transparency, will figure it out later but for now this works 2016-04-30 09:02:38 +00:00
Ian Curtis 30ca1792bb Fix fixed shading maths 2016-04-30 08:58:13 +00:00
Bart Trzynadlowski e0513ec723 Updated to-do comments 2016-04-29 23:57:15 +00:00
Ian Curtis c499e6640c fixed shading code 2016-04-29 23:03:46 +00:00
Bart Trzynadlowski 57d5bc8367 Legacy engine: preliminary per-vertex fixed shading. Only limited testing with LA Machineguns (appears to work), Sega Rally 2 (appears okay), and Scud Race (fixes expert course bridge but not other mis-colored polygons). 2016-04-29 03:56:06 +00:00
Ian Curtis 2785ecd25f read front buffer 2016-04-28 22:15:36 +00:00
Bart Trzynadlowski 7456aa745c Luminous bit is now also dumped in polygon header analysis because shading modes may depend on whether or not lighting is enabled 2016-04-28 13:18:56 +00:00
Bart Trzynadlowski 34e8f00382 Legacy engine: extracting fixed shading component (but still can't use it because unsure of how to activate) 2016-04-28 13:18:15 +00:00
Bart Trzynadlowski 0ae9e8013b Fixed polygon header bit analysis code: was forgetting to swap GL buffer back to retrieve pixels from last rendered frame 2016-04-28 01:27:35 +00:00
Ian Curtis 09e27e3082 color flag 2016-04-27 16:42:31 +00:00
Ian Curtis a246fc1454 make compilable with visual studio 2016-04-27 11:17:12 +00:00
Ian Curtis 8f6ab2fcf9 simplify 2016-04-27 08:13:22 +00:00
Bart Trzynadlowski 3c5fcbd241 Forgot a newline 2016-04-27 04:15:22 +00:00
Bart Trzynadlowski c0ec610e99 Polygon header bit analysis code (need to #define DEBUG and use -gfx-state option) 2016-04-27 04:09:50 +00:00
Bart Trzynadlowski 04fba1466d Added utility function to write BMP files 2016-04-27 04:08:49 +00:00
Bart Trzynadlowski 3682ab7300 Updated polygon header description with double-sided bit (forgot it in last update!) 2016-04-26 23:06:40 +00:00
Bart Trzynadlowski 85a77bb016 Added an updated description of the polygon header to the top of Legacy3D/Models.cpp 2016-04-26 23:04:11 +00:00
Ian Curtis 3e8439c09c fix model normals, add code for fixed shading, as of yet flag to turn it on is unknown 2016-04-26 09:06:48 +00:00
Bart Trzynadlowski b730fc466c Legacy engine: vertex normals are standalone and do not need to be added to polygon normal 2016-04-26 00:12:02 +00:00
Bart Trzynadlowski 112777385e Added a debug option to load and render a single frame of graphics state from a save state file. Only available if compiled with DEBUG defined. Invoked using: -gfx-state=<file> on command line. 2016-04-24 17:06:14 +00:00
Bart Trzynadlowski 1265c8d184 Using IEmulator interface instead of CModel3 directly 2016-04-24 03:01:42 +00:00
Bart Trzynadlowski 9baa0488e3 Changed save state file version (r340 changed Real3D save format, breaking compatibility with older states, and states were probably already incompatible with 0.2a) 2016-04-24 01:50:03 +00:00
Bart Trzynadlowski 3bd8e20639 Fixed white space and warnings. Fixed second argument to -dis option in cases where other numerical parameters are specified on command line. 2016-04-24 01:40:16 +00:00
Bart Trzynadlowski 908d979cd7 Flattened out nested if-statements in new engine's fragment shader to improve compatibility with older GPUs (e.g., NVS 300) 2016-04-22 23:46:49 +00:00
Ian Curtis 58d187e59a parse viewports in normal order 2016-04-19 22:05:12 +00:00