diff options
author | aap <aap@papnet.eu> | 2020-04-16 10:26:16 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2020-04-16 10:26:16 +0200 |
commit | 4b602940eb79c637f70a22046d414a0b1358eea8 (patch) | |
tree | 4c8a7e8623be3c639f60d63c25a288c8d732506d | |
parent | Merge branch 'master' of github.com:gtamodding/re3 (diff) | |
download | re3-4b602940eb79c637f70a22046d414a0b1358eea8.tar re3-4b602940eb79c637f70a22046d414a0b1358eea8.tar.gz re3-4b602940eb79c637f70a22046d414a0b1358eea8.tar.bz2 re3-4b602940eb79c637f70a22046d414a0b1358eea8.tar.lz re3-4b602940eb79c637f70a22046d414a0b1358eea8.tar.xz re3-4b602940eb79c637f70a22046d414a0b1358eea8.tar.zst re3-4b602940eb79c637f70a22046d414a0b1358eea8.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/Game.cpp | 4 | ||||
-rw-r--r-- | src/core/config.h | 1 | ||||
-rw-r--r-- | src/fakerw/fake.cpp | 45 | ||||
-rw-r--r-- | src/fakerw/rpworld.h | 30 | ||||
-rw-r--r-- | src/rw/TexRead.cpp | 11 | ||||
-rw-r--r-- | src/rw/rw.cpp | 5 |
6 files changed, 62 insertions, 34 deletions
diff --git a/src/core/Game.cpp b/src/core/Game.cpp index fe747ac1..8699ffeb 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -307,6 +307,7 @@ bool CGame::Initialise(const char* datFile) CDraw::SetFOV(120.0f); CDraw::ms_fLODDistance = 500.0f; LoadingScreen("Loading the Game", "Setup streaming", nil); +#ifdef USE_TXD_CDIMAGE int txdHandle = CFileMgr::OpenFile("MODELS\\TXD.IMG", "r"); if (txdHandle) CFileMgr::CloseFile(txdHandle); @@ -321,6 +322,9 @@ bool CGame::Initialise(const char* datFile) CStreaming::Init(); } } +#else + CStreaming::Init(); +#endif CStreaming::LoadInitialVehicles(); CStreaming::LoadInitialPeds(); CStreaming::RequestBigBuildings(LEVEL_NONE); diff --git a/src/core/config.h b/src/core/config.h index 38e7679f..f684ed3c 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -190,6 +190,7 @@ enum Config { #define TOGGLEABLE_BETA_FEATURES // toggleable from debug menu. not too many things #define MORE_LANGUAGES // Add more translations to the game #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 // Pad #define XINPUT diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp index 1aaa8d11..b91a9c49 100644 --- a/src/fakerw/fake.cpp +++ b/src/fakerw/fake.cpp @@ -178,8 +178,8 @@ RwImage *RwImageWrite(RwImage * image, const RwChar * imageName); RwChar *RwImageGetPath(void); const RwChar *RwImageSetPath(const RwChar * path) { Image::setSearchPath(path); return path; } RwImage *RwImageSetStride(RwImage * image, RwInt32 stride) { image->stride = stride; return image; } -RwImage *RwImageSetPixels(RwImage * image, RwUInt8 * pixels) { image->setPixels(pixels); return image; } -RwImage *RwImageSetPalette(RwImage * image, RwRGBA * palette) { image->setPalette((uint8*)palette); return image; } +RwImage *RwImageSetPixels(RwImage * image, RwUInt8 * pixels) { image->pixels = pixels; return image; } +RwImage *RwImageSetPalette(RwImage * image, RwRGBA * palette) { image->palette = (uint8*)palette; return image; } RwInt32 RwImageGetWidth(const RwImage * image); RwInt32 RwImageGetHeight(const RwImage * image); RwInt32 RwImageGetDepth(const RwImage * image); @@ -252,12 +252,12 @@ RwRaster *RwRasterGetParent(const RwRaster *raster) { return raster->parent; RwRaster *RwRasterGetOffset(RwRaster *raster, RwInt16 *xOffset, RwInt16 *yOffset); RwInt32 RwRasterGetNumLevels(RwRaster * raster); RwRaster *RwRasterSubRaster(RwRaster * subRaster, RwRaster * raster, RwRect * rect); -RwRaster *RwRasterRenderFast(RwRaster * raster, RwInt32 x, RwInt32 y); +RwRaster *RwRasterRenderFast(RwRaster * raster, RwInt32 x, RwInt32 y) { return raster->renderFast(x, y) ? raster : nil; } RwRaster *RwRasterRender(RwRaster * raster, RwInt32 x, RwInt32 y); RwRaster *RwRasterRenderScaled(RwRaster * raster, RwRect * rect); -RwRaster *RwRasterPushContext(RwRaster * raster); -RwRaster *RwRasterPopContext(void); -RwRaster *RwRasterGetCurrentContext(void); +RwRaster *RwRasterPushContext(RwRaster * raster) { return Raster::pushContext(raster); } +RwRaster *RwRasterPopContext(void) { return Raster::popContext(); } +RwRaster *RwRasterGetCurrentContext(void) { return Raster::getCurrentContext(); } RwBool RwRasterClear(RwInt32 pixelValue); RwBool RwRasterClearRect(RwRect * rpRect, RwInt32 pixelValue); RwRaster *RwRasterShowRaster(RwRaster * raster, void *dev, RwUInt32 flags); @@ -378,20 +378,27 @@ RwStream *RwStreamOpen(RwStreamType type, RwStreamAccessType accessType, const v default: return nil; } + // oh god this is horrible. librw streams really need fixing switch(type){ - case rwSTREAMFILENAME: + case rwSTREAMFILENAME:{ + StreamFile fakefile; file = rwNewT(StreamFile, 1, 0); + memcpy(file, &fakefile, sizeof(StreamFile)); if(file->open((char*)pData, mode)) return file; rwFree(file); return nil; - case rwSTREAMMEMORY: + } + case rwSTREAMMEMORY:{ + StreamMemory fakemem; memargs = (RwMemory*)pData; mem = rwNewT(StreamMemory, 1, 0); + memcpy(mem, &fakemem, sizeof(StreamMemory)); if(mem->open(memargs->start, memargs->length)) return mem; rwFree(mem); return nil; + } default: assert(0 && "unknown type"); return nil; @@ -501,7 +508,10 @@ RwBool RwEngineOpen(RwEngineOpenParams *initParams) { openParams.window = (HWND)initParams->displayID; return Engine::open(&openParams); } -RwBool RwEngineStart(void) { return Engine::start(); } +RwBool RwEngineStart(void) { + rw::d3d::isP8supported = false; + return Engine::start(); +} RwBool RwEngineStop(void) { Engine::stop(); return true; } RwBool RwEngineClose(void) { Engine::close(); return true; } RwBool RwEngineTerm(void) { Engine::term(); return true; } @@ -582,9 +592,8 @@ RpLight *RpLightSetColor(RpLight *light, const RwRGBAReal *color) { light->setCo RpGeometry *RpGeometryCreate(RwInt32 numVert, RwInt32 numTriangles, RwUInt32 format) { return Geometry::create(numVert, numTriangles, format); } RwBool RpGeometryDestroy(RpGeometry *geometry) { geometry->destroy(); return true; } RpGeometry *_rpGeometryAddRef(RpGeometry *geometry); -// TODO: implement this -RpGeometry *RpGeometryLock(RpGeometry *geometry, RwInt32 lockMode) { return geometry; } -RpGeometry *RpGeometryUnlock(RpGeometry *geometry) { return geometry; } +RpGeometry *RpGeometryLock(RpGeometry *geometry, RwInt32 lockMode) { geometry->lock(lockMode); return geometry; } +RpGeometry *RpGeometryUnlock(RpGeometry *geometry) { geometry->unlock(); return geometry; } RpGeometry *RpGeometryTransform(RpGeometry *geometry, const RwMatrix *matrix); RpGeometry *RpGeometryCreateSpace(RwReal radius); RpMorphTarget *RpMorphTargetSetBoundingSphere(RpMorphTarget *morphTarget, const RwSphere *boundingSphere) { morphTarget->boundingSphere = *boundingSphere; return morphTarget; } @@ -596,7 +605,11 @@ RpGeometry *RpGeometryRemoveMorphTarget(RpGeometry *geometry, RwInt32 morphTarg RwInt32 RpGeometryGetNumMorphTargets(const RpGeometry *geometry); RpMorphTarget *RpGeometryGetMorphTarget(const RpGeometry *geometry, RwInt32 morphTarget) { return &geometry->morphTargets[morphTarget]; } RwRGBA *RpGeometryGetPreLightColors(const RpGeometry *geometry) { return geometry->colors; } -RwTexCoords *RpGeometryGetVertexTexCoords(const RpGeometry *geometry, RwTextureCoordinateIndex uvIndex) { return geometry->texCoords[uvIndex]; } +RwTexCoords *RpGeometryGetVertexTexCoords(const RpGeometry *geometry, RwTextureCoordinateIndex uvIndex) { + if(uvIndex == rwNARWTEXTURECOORDINATEINDEX) + return nil; + return geometry->texCoords[uvIndex-rwTEXTURECOORDINATEINDEX0]; +} RwInt32 RpGeometryGetNumTexCoordSets(const RpGeometry *geometry) { return geometry->numTexCoordSets; } RwInt32 RpGeometryGetNumVertices (const RpGeometry *geometry) { return geometry->numVertices; } RwV3d *RpMorphTargetGetVertices(const RpMorphTarget *morphTarget) { return morphTarget->vertices; } @@ -793,3 +806,9 @@ RpHAnimHierarchy *RpSkinAtomicGetHAnimHierarchy( const RpAtomic *atomic ) { retu RwImage *RtBMPImageWrite(RwImage * image, const RwChar * imageName) { rw::writeBMP(image, imageName); return image; } RwImage *RtBMPImageRead(const RwChar * imageName) { return rw::readBMP(imageName); } + + + + +// fake shit +RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags) { return 1; } diff --git a/src/fakerw/rpworld.h b/src/fakerw/rpworld.h index d2ac2454..f10a3754 100644 --- a/src/fakerw/rpworld.h +++ b/src/fakerw/rpworld.h @@ -122,21 +122,21 @@ enum RpGeometryFlag enum RpGeometryLockMode { - rpGEOMETRYLOCKPOLYGONS = 0x01, - rpGEOMETRYLOCKVERTICES = 0x02, - rpGEOMETRYLOCKNORMALS = 0x04, - rpGEOMETRYLOCKPRELIGHT = 0x08, - rpGEOMETRYLOCKTEXCOORDS = 0x10, - rpGEOMETRYLOCKTEXCOORDS1 = 0x10, - rpGEOMETRYLOCKTEXCOORDS2 = 0x20, - rpGEOMETRYLOCKTEXCOORDS3 = 0x40, - rpGEOMETRYLOCKTEXCOORDS4 = 0x80, - rpGEOMETRYLOCKTEXCOORDS5 = 0x0100, - rpGEOMETRYLOCKTEXCOORDS6 = 0x0200, - rpGEOMETRYLOCKTEXCOORDS7 = 0x0400, - rpGEOMETRYLOCKTEXCOORDS8 = 0x0800, - rpGEOMETRYLOCKTEXCOORDSALL = 0x0ff0, - rpGEOMETRYLOCKALL = 0x0fff + rpGEOMETRYLOCKPOLYGONS = rw::Geometry::LOCKPOLYGONS, + rpGEOMETRYLOCKVERTICES = rw::Geometry::LOCKVERTICES, + rpGEOMETRYLOCKNORMALS = rw::Geometry::LOCKNORMALS, + rpGEOMETRYLOCKPRELIGHT = rw::Geometry::LOCKPRELIGHT, + rpGEOMETRYLOCKTEXCOORDS = rw::Geometry::LOCKTEXCOORDS, + rpGEOMETRYLOCKTEXCOORDS1 = rw::Geometry::LOCKTEXCOORDS1, + rpGEOMETRYLOCKTEXCOORDS2 = rw::Geometry::LOCKTEXCOORDS2, + rpGEOMETRYLOCKTEXCOORDS3 = rw::Geometry::LOCKTEXCOORDS3, + rpGEOMETRYLOCKTEXCOORDS4 = rw::Geometry::LOCKTEXCOORDS4, + rpGEOMETRYLOCKTEXCOORDS5 = rw::Geometry::LOCKTEXCOORDS5, + rpGEOMETRYLOCKTEXCOORDS6 = rw::Geometry::LOCKTEXCOORDS6, + rpGEOMETRYLOCKTEXCOORDS7 = rw::Geometry::LOCKTEXCOORDS7, + rpGEOMETRYLOCKTEXCOORDS8 = rw::Geometry::LOCKTEXCOORDS8, + rpGEOMETRYLOCKTEXCOORDSALL = rw::Geometry::LOCKTEXCOORDSALL, + rpGEOMETRYLOCKALL = rw::Geometry::LOCKALL }; RpGeometry *RpGeometryCreate(RwInt32 numVert, RwInt32 numTriangles, RwUInt32 format); diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp index 8ada080d..c91b71c0 100644 --- a/src/rw/TexRead.cpp +++ b/src/rw/TexRead.cpp @@ -70,7 +70,9 @@ RwTexDictionaryGtaStreamRead(RwStream *stream) if(!RwStreamFindChunk(stream, rwID_STRUCT, &size, &version)) return nil; assert(size == 4); - if(RwStreamRead(stream, &numTextures, size) != size) +int foo = RwStreamRead(stream, &numTextures, size); +if(foo != size) +// if(RwStreamRead(stream, &numTextures, size) != size) return nil; texDict = RwTexDictionaryCreate(); @@ -153,11 +155,6 @@ RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict) } #ifdef GTA_PC -#ifdef RWLIBS -extern "C" RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags); -#else -WRAPPER RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags) { EAXJMP(0x59A350); } -#endif void ReadVideoCardCapsFile(uint32 &cap32, uint32 &cap24, uint32 &cap16, uint32 &cap8) @@ -177,6 +174,8 @@ ReadVideoCardCapsFile(uint32 &cap32, uint32 &cap24, uint32 &cap16, uint32 &cap8) } } +RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags); + bool CheckVideoCardCaps(void) { diff --git a/src/rw/rw.cpp b/src/rw/rw.cpp index 196cf189..c525f49f 100644 --- a/src/rw/rw.cpp +++ b/src/rw/rw.cpp @@ -415,6 +415,9 @@ WRAPPER RxNodeDefinition* RxNodeDefinitionGetMaterialScatter() { EAXJMP(0x5DDAA0 WRAPPER RxNodeDefinition* RxNodeDefinitionGetLight() { EAXJMP(0x5DF040); } WRAPPER RxNodeDefinition* RxNodeDefinitionGetPostLight() { EAXJMP(0x5DF560); } WRAPPER void RxD3D8AllInOneSetRenderCallBack(RxPipelineNode* node, RxD3D8AllInOneRenderCallBack callback) { EAXJMP(0x5DFC60); } + +WRAPPER RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags) { EAXJMP(0x59A350); } + #else extern "C" @@ -433,6 +436,8 @@ extern "C" void* _rwVectorOpen(void* instance, RwInt32 offset, RwInt32 size); RwBool _rwPluginRegistryOpen(); RwBool _rwPluginRegistryClose(); + + RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags); } STARTPATCHES |