mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2024-12-02 08:51:57 +00:00
prepare unification of more sys/win32/ and sys/posix/ stuff
because the code is almost the same anyway, so * add win32 support to sys/posix/posix_signin.cpp * add posix support to sys/win32/win_savegame.cpp
This commit is contained in:
parent
c635566bcc
commit
95a1066004
3 changed files with 37 additions and 3 deletions
|
@ -402,10 +402,13 @@ void idSessionLocalWin::Connect_f( const idCmdArgs& args )
|
|||
lobbyConnectInfo_t connectInfo;
|
||||
|
||||
Sys_StringToNetAdr( args.Argv( 1 ), &connectInfo.netAddr, true );
|
||||
// DG: don't use net_port to select port to connect to
|
||||
// the port can be specified in the command, else the default port is used
|
||||
if( connectInfo.netAddr.port == 0 )
|
||||
{
|
||||
connectInfo.netAddr.port = 27015;
|
||||
}
|
||||
// DG end
|
||||
|
||||
ConnectAndMoveToLobby( GetPartyLobby(), connectInfo, false );
|
||||
}
|
||||
|
|
|
@ -31,9 +31,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "../../framework/PlayerProfile.h"
|
||||
#include "../sys_session_local.h"
|
||||
#include "posix_signin.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h>
|
||||
|
||||
#endif
|
||||
#ifdef _DEBUG
|
||||
idCVar win_userPersistent( "win_userPersistent", "1", CVAR_BOOL, "debugging cvar for profile persistence status" );
|
||||
idCVar win_userOnline( "win_userOnline", "1", CVAR_BOOL, "debugging cvar for profile online status" );
|
||||
|
@ -117,7 +117,12 @@ void idSignInManagerWin::RegisterLocalUser( int inputDevice )
|
|||
if( idStr::Length( nameSource ) == 0 )
|
||||
{
|
||||
// ui_name was empty => default to hostname
|
||||
#ifdef _WIN32
|
||||
DWORD len = 128;
|
||||
::GetComputerName( machineName, &len );
|
||||
#else
|
||||
gethostname( machineName, sizeof( machineName ) );
|
||||
#endif
|
||||
nameSource = machineName;
|
||||
}
|
||||
// DG end
|
||||
|
|
|
@ -38,6 +38,11 @@ extern idCVar savegame_error;
|
|||
|
||||
#define SAVEGAME_SENTINAL 0x12358932
|
||||
|
||||
// RB begin
|
||||
#ifndef _WIN32 // DG: unify win32 and posix savegames
|
||||
#define ERROR_SUCCESS 0
|
||||
#endif
|
||||
// RB end
|
||||
/*
|
||||
========================
|
||||
void Sys_ExecuteSavegameCommandAsync
|
||||
|
@ -176,7 +181,11 @@ int idSaveGameThread::Save()
|
|||
idFile* outputFile = fileSystem->OpenFileWrite( tempFileName, "fs_savePath" );
|
||||
if( outputFile == NULL )
|
||||
{
|
||||
#ifdef _WIN32 // DG: unify windows and posix savegames => replace GetLastError with strerror(errno)
|
||||
idLib::Warning( "[%s]: Couldn't open file for writing, %s. Error = %08x", __FUNCTION__, tempFileName.c_str(), GetLastError() );
|
||||
#else
|
||||
idLib::Warning( "[%s]: Couldn't open file for writing, %s. Error = %s", __FUNCTION__, tempFileName.c_str(), strerror( errno ) );
|
||||
#endif // DG end
|
||||
file->error = true;
|
||||
callback->errorCode = SAVEGAME_E_UNKNOWN;
|
||||
ret = -1;
|
||||
|
@ -194,7 +203,11 @@ int idSaveGameThread::Save()
|
|||
{
|
||||
if( ( size_t )outputFile->Write( block.data, block.bytes ) != block.bytes )
|
||||
{
|
||||
#ifdef _WIN32 // DG: unify windows and posix savegames => replace GetLastError with strerror(errno)
|
||||
idLib::Warning( "[%s]: Write failed. Error = %08x", __FUNCTION__, GetLastError() );
|
||||
#else
|
||||
idLib::Warning( "[%s]: Write failed. Error = %s", __FUNCTION__, strerror( errno ) );
|
||||
#endif // DG end
|
||||
file->error = true;
|
||||
callback->errorCode = SAVEGAME_E_INSUFFICIENT_ROOM;
|
||||
ret = -1;
|
||||
|
@ -214,7 +227,11 @@ int idSaveGameThread::Save()
|
|||
size_t size = outputFile->WriteBig( checksum );
|
||||
if( size != sizeof( checksum ) )
|
||||
{
|
||||
#ifdef _WIN32 // DG: unify windows and posix savegames => replace GetLastError with strerror(errno)
|
||||
idLib::Warning( "[%s]: Write failed. Error = %08x", __FUNCTION__, GetLastError() );
|
||||
#else
|
||||
idLib::Warning( "[%s]: Write failed. Error = %s", __FUNCTION__, strerror( errno ) );
|
||||
#endif // DG end
|
||||
file->error = true;
|
||||
callback->errorCode = SAVEGAME_E_INSUFFICIENT_ROOM;
|
||||
ret = -1;
|
||||
|
@ -225,7 +242,11 @@ int idSaveGameThread::Save()
|
|||
size_t size = outputFile->Write( file->GetDataPtr(), file->Length() );
|
||||
if( size != ( size_t )file->Length() )
|
||||
{
|
||||
#ifdef _WIN32 // DG: unify windows and posix savegames => replace GetLastError with strerror(errno)
|
||||
idLib::Warning( "[%s]: Write failed. Error = %08x", __FUNCTION__, GetLastError() );
|
||||
#else
|
||||
idLib::Warning( "[%s]: Write failed. Error = %s", __FUNCTION__, strerror( errno ) );
|
||||
#endif // DG end
|
||||
file->error = true;
|
||||
callback->errorCode = SAVEGAME_E_INSUFFICIENT_ROOM;
|
||||
ret = -1;
|
||||
|
@ -473,7 +494,7 @@ int idSaveGameThread::Enumerate()
|
|||
ret = -1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32 // DG: unification of win32 and posix savagame code
|
||||
// Use the date from the directory
|
||||
WIN32_FILE_ATTRIBUTE_DATA attrData;
|
||||
BOOL attrRet = GetFileAttributesEx( file->GetFullPath(), GetFileExInfoStandard, &attrData );
|
||||
|
@ -500,6 +521,11 @@ int idSaveGameThread::Enumerate()
|
|||
itime.QuadPart /= second;
|
||||
details->date = itime.QuadPart;
|
||||
}
|
||||
#else
|
||||
// DG: just use the idFile object's timestamp - the windows code gets file attributes and
|
||||
// other complicated stuff like that.. I'm wonderin what that was good for.. this seems to work.
|
||||
details->date = file->Timestamp();
|
||||
#endif // DG end
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue