Handle uint vs ulong for 3ds target

This commit is contained in:
Joshua Peisach 2025-06-15 14:21:24 -04:00
parent f1abdfe2d1
commit d34e8779ad
No known key found for this signature in database
GPG Key ID: 41C3D4189AFEDB5A
5 changed files with 20 additions and 7 deletions

View File

@ -95,15 +95,24 @@ inline Tgl::Result MeshDeepClone(MeshImpl::MeshData* pSource, MeshImpl::MeshData
// Query information from old group // Query information from old group
DWORD dataSize; DWORD dataSize;
#if defined(__3DS__)
unsigned long vcount, fcount, vperface;
#else
unsigned int vcount, fcount, vperface; unsigned int vcount, fcount, vperface;
#endif
Tgl::Result result = Tgl::Result result =
ResultVal(pSource->groupMesh->GetGroup(pSource->groupIndex, (long unsigned int*)&vcount, (long unsigned int*)&fcount, (long unsigned int*)&vperface, &dataSize, NULL)); ResultVal(pSource->groupMesh->GetGroup(pSource->groupIndex, &vcount, &fcount, &vperface, &dataSize, NULL));
assert(Succeeded(result)); assert(Succeeded(result));
#if defined(__3DS__)
unsigned long* faceBuffer = new unsigned long[dataSize];
#else
unsigned int* faceBuffer = new unsigned int[dataSize]; unsigned int* faceBuffer = new unsigned int[dataSize];
#endif
result = result =
ResultVal(pSource->groupMesh->GetGroup(pSource->groupIndex, (long unsigned int*)&vcount, (long unsigned int*)&fcount, (long unsigned int*)&vperface, &dataSize, (long unsigned int*)&faceBuffer) ResultVal(pSource->groupMesh->GetGroup(pSource->groupIndex, &vcount, &fcount, &vperface, &dataSize, faceBuffer)
); );
assert(Succeeded(result)); assert(Succeeded(result));
@ -122,7 +131,7 @@ inline Tgl::Result MeshDeepClone(MeshImpl::MeshData* pSource, MeshImpl::MeshData
// Push information to new group // Push information to new group
D3DRMGROUPINDEX index; D3DRMGROUPINDEX index;
result = ResultVal(pMesh->AddGroup(vcount, fcount, 3, (long unsigned int*)&faceBuffer, &index)); result = ResultVal(pMesh->AddGroup(vcount, fcount, 3, faceBuffer, &index));
assert(Succeeded(result)); assert(Succeeded(result));
rpTarget->groupIndex = index; rpTarget->groupIndex = index;

View File

@ -63,7 +63,11 @@ inline Tgl::Result CreateMesh(
int count = faceCount * 3; int count = faceCount * 3;
int index = 0; int index = 0;
#if defined(__3DS__)
unsigned long* fData = new unsigned long[count];
#else
unsigned int* fData = new unsigned int[count]; unsigned int* fData = new unsigned int[count];
#endif
D3DRMVERTEX* vertices = new D3DRMVERTEX[vertexCount]; D3DRMVERTEX* vertices = new D3DRMVERTEX[vertexCount];
memset(vertices, 0, sizeof(*vertices) * vertexCount); memset(vertices, 0, sizeof(*vertices) * vertexCount);
@ -97,7 +101,7 @@ inline Tgl::Result CreateMesh(
} }
Tgl::Result result; Tgl::Result result;
result = ResultVal(pD3DRM->AddGroup(vertexCount, faceCount, 3, (long unsigned int*)fData, &groupIndex)); result = ResultVal(pD3DRM->AddGroup(vertexCount, faceCount, 3, fData, &groupIndex));
if (Succeeded(result)) { if (Succeeded(result)) {
rpMesh->groupIndex = groupIndex; rpMesh->groupIndex = groupIndex;

View File

@ -517,7 +517,7 @@ SDL3MeshCache Direct3DRMSDL3GPURenderer::UploadMesh(const MeshGroup& meshGroup)
FlattenSurfaces( FlattenSurfaces(
meshGroup.vertices.data(), meshGroup.vertices.data(),
meshGroup.vertices.size(), meshGroup.vertices.size(),
meshGroup.indices.data(), (const DWORD*)meshGroup.indices.data(),
meshGroup.indices.size(), meshGroup.indices.size(),
meshGroup.texture != nullptr, meshGroup.texture != nullptr,
finalVertices, finalVertices,

View File

@ -600,7 +600,7 @@ MeshCache UploadMesh(const MeshGroup& meshGroup)
FlattenSurfaces( FlattenSurfaces(
meshGroup.vertices.data(), meshGroup.vertices.data(),
meshGroup.vertices.size(), meshGroup.vertices.size(),
meshGroup.indices.data(), (const DWORD*) meshGroup.indices.data(),
meshGroup.indices.size(), meshGroup.indices.size(),
meshGroup.texture != nullptr, meshGroup.texture != nullptr,
cache.vertices, cache.vertices,

View File

@ -13,7 +13,7 @@ struct MeshGroup {
int vertexPerFace = 0; int vertexPerFace = 0;
int version = 0; int version = 0;
std::vector<D3DRMVERTEX> vertices; std::vector<D3DRMVERTEX> vertices;
std::vector<DWORD> indices; std::vector<unsigned int> indices;
MeshGroup() = default; MeshGroup() = default;