Compare commits

..

16 Commits

Author SHA1 Message Date
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
Josh Pearson
714f34464e Fix moon and corona aspect ratio with FSAA 2025-01-17 16:41:25 -07: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
14 changed files with 175 additions and 302 deletions

View File

@@ -28,12 +28,12 @@ You will also need the following tools installed
### Cloning the dca3-game repo and downloading the prebuilt elf
- Open dreamsdk shell
- type `git clone https://gitlab.com/skmp/dca3-game.git` (and press enter)
- 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 artifacts from https://gitlab.com/skmp/dca3-game/-/jobs/8725216645
- 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

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

@@ -6302,7 +6302,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

@@ -166,8 +166,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,15 +446,22 @@ 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;
fdPedSfx = fs_open(SampleBankDataFilename, O_RDONLY);
assert(fdPedSfx >= 0);
_dcAudioInitialized = true;
return TRUE;
}
@@ -458,7 +469,7 @@ cSampleManager::Initialise(void)
void
cSampleManager::Terminate(void)
{
fs_close(fdPedSfx);
}
bool8 cSampleManager::CheckForAnAudioFileOnCD(void)
@@ -637,7 +648,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 +709,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 )

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();
}

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

@@ -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

@@ -877,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 */
@@ -889,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 )
@@ -903,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 */
@@ -1016,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

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)
@@ -483,7 +486,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 +495,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);
}
}
@@ -739,8 +742,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 +760,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 +784,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 +823,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 +845,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 +888,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 +923,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 +942,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 +956,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 +975,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 +985,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 +995,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 +1007,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);
});
}
@@ -3294,6 +3296,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);
@@ -3343,7 +3347,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;
@@ -3709,7 +3713,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));
@@ -4246,6 +4250,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)
{
@@ -4274,14 +4304,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:
{
@@ -4294,11 +4324,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;
@@ -4326,15 +4366,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)
@@ -4360,6 +4392,8 @@ ObjPipeline* makeDefaultPipeline(void)
static void*
driverOpen(void *o, int32, int32)
{
makeVideoModeList();
pvr_init(&pvr_params);
fake_tex = pvr_mem_malloc(sizeof(fake_tex_data));
@@ -4395,6 +4429,8 @@ driverClose(void *o, int32, int32)
{
pvr_mem_free(fake_tex);
pvr_shutdown();
return o;
}