Proof of concept : Split off xboxkrnl::Av* methods into it's own .cpp file

This seems to work, so I'll probably split off all others too (just like
I did in Dxbx)
This commit is contained in:
PatrickvL 2016-11-15 17:00:29 +01:00
parent ffc20a5c1f
commit 61835e7c4b
3 changed files with 125 additions and 74 deletions

View File

@ -517,6 +517,7 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="..\..\src\CxbxKrnl\EmuKrnlAv.cpp" />
<ClCompile Include="..\..\src\CxbxKrnl\EmuNtDll.cpp">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -144,7 +144,6 @@ PCSTProxyParam;
// Global Variable(s)
extern PVOID g_pfnThreadNotification[16] = { NULL };
extern int g_iThreadNotificationCount = 0;
PVOID g_pPersistedData = NULL;
// A critical section containing the PC and Xbox equivalent
struct INTERNAL_CRITICAL_SECTION
@ -1364,79 +1363,6 @@ NTSTATUS CxbxObjectAttributesToNT(xboxkrnl::POBJECT_ATTRIBUTES ObjectAttributes,
using namespace xboxkrnl;
// ******************************************************************
// * 0x0001 AvGetSavedDataAddress()
// ******************************************************************
XBSYSAPI EXPORTNUM(1) xboxkrnl::PVOID NTAPI xboxkrnl::AvGetSavedDataAddress()
{
LOG_FUNC();
__asm int 3;
// Allocate a buffer the size of the screen buffer and return that.
// TODO: Fill this buffer with the contents of the front buffer.
// TODO: This isn't always the size we need...
if( g_pPersistedData )
{
CxbxFree( g_pPersistedData );
g_pPersistedData = NULL;
}
g_pPersistedData = CxbxMalloc( 640*480*4 );
#if 0
// Get a copy of the front buffer
IDirect3DSurface8* pFrontBuffer = NULL;
if( SUCCEEDED(g_pD3DDevice8->GetFrontBuffer(pFrontBuffer)))
{
D3DLOCKED_RECT LockedRect;
pFrontBuffer->LockRect( 0, NULL, &LockedRect );
CopyMemory( g_pPersistedData, LockRect.pBits, 640*480*4 );
pFrontBuffer->UnlockRect();
}
#endif
// TODO: We might want to return something sometime...
/*if( !g_pPersistedData )
{
FILE* fp = fopen( "PersistedSurface.bin", "rb" );
fseek( fp, 0, SEEK_END );
long size = ftell( fp );
g_pPersistedData = malloc( size );
fread( g_pPersistedData, size, 1, fp );
fclose(fp);
}*/
return NULL;//g_pPersistedData;
}
// ******************************************************************
// * 0x0002 AvSendTVEncoderOption()
// ******************************************************************
XBSYSAPI EXPORTNUM(2) VOID NTAPI xboxkrnl::AvSendTVEncoderOption
(
IN PVOID RegisterBase,
IN ULONG Option,
IN ULONG Param,
OUT ULONG *Result
)
{
LOG_FUNC_BEGIN
LOG_FUNC_ARG(RegisterBase)
LOG_FUNC_ARG(Option)
LOG_FUNC_ARG(Param)
LOG_FUNC_ARG_OUT(Result)
LOG_FUNC_END;
// TODO: What does this do?
EmuWarning( "AvSendTVEncoderOption ignored!" );
}
// ******************************************************************
// * 0x0008 DbgPrint
// ******************************************************************

124
src/CxbxKrnl/EmuKrnlAv.cpp Normal file
View File

@ -0,0 +1,124 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->CxbxKrnl->EmuKrnlAv.cpp
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2016 Patrick van Logchem <pvanlogchem@gmail.com>
// *
// * All rights reserved
// *
// ******************************************************************
#define _CXBXKRNL_INTERNAL
#define _XBOXKRNL_DEFEXTRN_
// prevent name collisions
namespace xboxkrnl
{
#include <xboxkrnl/xboxkrnl.h> // For AvGetSavedDataAddress, etc.
};
#include "Logging.h" // For LOG_FUNC()
#include "Emu.h" // For EmuWarning()
#include "EmuAlloc.h" // For CxbxFree(), CxbxMalloc(), etc.
// Global Variable(s)
PVOID g_pPersistedData = NULL;
using namespace xboxkrnl;
// ******************************************************************
// * 0x0001 AvGetSavedDataAddress()
// ******************************************************************
XBSYSAPI EXPORTNUM(1) xboxkrnl::PVOID NTAPI xboxkrnl::AvGetSavedDataAddress()
{
LOG_FUNC();
__asm int 3;
// Allocate a buffer the size of the screen buffer and return that.
// TODO: Fill this buffer with the contents of the front buffer.
// TODO: This isn't always the size we need...
if (g_pPersistedData)
{
CxbxFree(g_pPersistedData);
g_pPersistedData = NULL;
}
g_pPersistedData = CxbxMalloc(640 * 480 * 4);
#if 0
// Get a copy of the front buffer
IDirect3DSurface8* pFrontBuffer = NULL;
if (SUCCEEDED(g_pD3DDevice8->GetFrontBuffer(pFrontBuffer)))
{
D3DLOCKED_RECT LockedRect;
pFrontBuffer->LockRect(0, NULL, &LockedRect);
CopyMemory(g_pPersistedData, LockRect.pBits, 640 * 480 * 4);
pFrontBuffer->UnlockRect();
}
#endif
// TODO: We might want to return something sometime...
/*if( !g_pPersistedData )
{
FILE* fp = fopen( "PersistedSurface.bin", "rb" );
fseek( fp, 0, SEEK_END );
long size = ftell( fp );
g_pPersistedData = malloc( size );
fread( g_pPersistedData, size, 1, fp );
fclose(fp);
}*/
return NULL;//g_pPersistedData;
}
// ******************************************************************
// * 0x0002 AvSendTVEncoderOption()
// ******************************************************************
XBSYSAPI EXPORTNUM(2) VOID NTAPI xboxkrnl::AvSendTVEncoderOption
(
IN PVOID RegisterBase,
IN ULONG Option,
IN ULONG Param,
OUT ULONG *Result
)
{
LOG_FUNC_BEGIN
LOG_FUNC_ARG(RegisterBase)
LOG_FUNC_ARG(Option)
LOG_FUNC_ARG(Param)
LOG_FUNC_ARG_OUT(Result)
LOG_FUNC_END;
// TODO: What does this do?
EmuWarning("AvSendTVEncoderOption ignored!");
}