From 087b7e7abfe81dd7f0fdcdea36ac9f245950df1a Mon Sep 17 00:00:00 2001 From: Loki Rautio Date: Sat, 7 Mar 2026 21:12:22 -0600 Subject: Revert "Project modernization (#630)" This code was not tested and breaks in Release builds, reverting to restore functionality of the nightly. All in-game menus do not work and generating a world crashes. This reverts commit a9be52c41a02d207233199e98898fe7483d7e817. --- Minecraft.World/File.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'Minecraft.World/File.cpp') diff --git a/Minecraft.World/File.cpp b/Minecraft.World/File.cpp index 11871e42..82e593dc 100644 --- a/Minecraft.World/File.cpp +++ b/Minecraft.World/File.cpp @@ -24,7 +24,7 @@ File::File( const File &parent, const std::wstring& child ) } //Creates a new File instance by converting the given pathname string into an abstract pathname. -File::File( const wstring& pathname ) //: parent( nullptr ) +File::File( const wstring& pathname ) //: parent( NULL ) { // #ifndef _CONTENT_PACKAGE // char buf[256]; @@ -62,7 +62,7 @@ File::File( const wstring& pathname ) //: parent( nullptr ) if( path.back().compare( pathRoot ) != 0 ) this->parent = new File( &path ); else - this->parent = nullptr; + this->parent = NULL; } */ } @@ -75,7 +75,7 @@ File::File( const std::wstring& parent, const std::wstring& child ) //: m_abstr //Creates a new File instance by converting the given path vector into an abstract pathname. /* -File::File( vector *path ) : parent( nullptr ) +File::File( vector *path ) : parent( NULL ) { m_abstractPathName = path->back(); path->pop_back(); @@ -86,7 +86,7 @@ if( path->size() > 0 ) if( path->back().compare( pathRoot ) != 0 ) this->parent = new File( path ); else -this->parent = nullptr; +this->parent = NULL; } } */ @@ -120,10 +120,10 @@ bool File::_delete() bool File::mkdir() const { #ifdef _UNICODE - return CreateDirectory( getPath().c_str(), nullptr) != 0; + return CreateDirectory( getPath().c_str(), NULL) != 0; #else - return CreateDirectory( wstringtofilename(getPath()), nullptr) != 0; + return CreateDirectory( wstringtofilename(getPath()), NULL) != 0; #endif } @@ -167,7 +167,7 @@ bool File::mkdirs() const #ifdef _UNICODE if( GetFileAttributes( pathToHere.c_str() ) == -1 ) { - DWORD result = CreateDirectory( pathToHere.c_str(), nullptr); + DWORD result = CreateDirectory( pathToHere.c_str(), NULL); if( result == 0 ) { // Failed to create @@ -177,7 +177,7 @@ bool File::mkdirs() const #else if( GetFileAttributes( wstringtofilename(pathToHere) ) == -1 ) { - DWORD result = CreateDirectory( wstringtofilename(pathToHere), nullptr); + DWORD result = CreateDirectory( wstringtofilename(pathToHere), NULL); if( result == 0 ) { // Failed to create @@ -321,7 +321,7 @@ std::vector *File::listFiles() const else sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName ); - bool exists = sceFiosDirectoryExistsSync( nullptr, filePath ); + bool exists = sceFiosDirectoryExistsSync( NULL, filePath ); if( !exists ) { app.DebugPrintf("\nsceFiosDirectoryExistsSync - Directory doesn't exist\n"); @@ -334,7 +334,7 @@ std::vector *File::listFiles() const SceFiosDH dh = SCE_FIOS_DH_INVALID; SceFiosBuffer buf; buf.length = 0; - SceFiosOp op = sceFiosDHOpen(nullptr, &dh, filePath, buf); + SceFiosOp op = sceFiosDHOpen(NULL, &dh, filePath, buf); int err = sceFiosOpWait(op); if( err != SCE_FIOS_OK ) @@ -346,24 +346,24 @@ std::vector *File::listFiles() const buf.set(pBuf, (size_t)size); sceFiosOpDelete( op ); - sceFiosDHClose(nullptr, dh); + sceFiosDHClose(NULL, dh); - err = sceFiosDHOpenSync(nullptr, &dh, filePath, buf); + err = sceFiosDHOpenSync(NULL, &dh, filePath, buf); if( err != SCE_FIOS_OK ) { app.DebugPrintf("\nsceFiosDHOpenSync = 0x%x\n",err); } SceFiosDirEntry entry; ZeroMemory(&entry, sizeof(SceFiosDirEntry)); - err = sceFiosDHReadSync(nullptr, dh, &entry); + err = sceFiosDHReadSync(NULL, dh, &entry); while( err == SCE_FIOS_OK) { vOutput->push_back( new File( *this, filenametowstring( entry.fullPath + entry.offsetToName ) ) ); ZeroMemory(&entry, sizeof(SceFiosDirEntry)); - err = sceFiosDHReadSync(nullptr, dh, &entry); + err = sceFiosDHReadSync(NULL, dh, &entry); }; - sceFiosDHClose(nullptr, dh); + sceFiosDHClose(NULL, dh); delete pBuf; #else @@ -418,7 +418,7 @@ std::vector *File::listFiles(FileFilter *filter) const { // TODO 4J Stu - Also need to check for I/O errors? if( !isDirectory() ) - return nullptr; + return NULL; std::vector *vOutput = new std::vector(); @@ -576,7 +576,7 @@ int64_t File::length() // check if the file exists first SceFiosStat statData; - if(sceFiosStatSync(nullptr, filePath, &statData) != SCE_FIOS_OK) + if(sceFiosStatSync(NULL, filePath, &statData) != SCE_FIOS_OK) { return 0; } @@ -660,7 +660,7 @@ const std::wstring File::getPath() const { /* wstring path; - if ( parent != nullptr) + if ( parent != NULL) path = parent->getPath(); else path = wstring(pathRoot); @@ -673,7 +673,7 @@ const std::wstring File::getPath() const std::wstring File::getName() const { - size_t sep = m_abstractPathName.find_last_of(this->pathSeparator); + unsigned int sep = (unsigned int )(m_abstractPathName.find_last_of( this->pathSeparator )); return m_abstractPathName.substr( sep + 1, m_abstractPathName.length() ); } @@ -687,7 +687,7 @@ int File::hash_fnct(const File &k) { int hashCode = 0; - //if (k->parent != nullptr) + //if (k->parent != NULL) // hashCode = hash_fnct(k->getParent()); wchar_t *ref = (wchar_t *) k.m_abstractPathName.c_str(); -- cgit v1.2.3