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 a9be52c41a.
This commit is contained in:
@@ -107,8 +107,8 @@ public:
|
||||
|
||||
void SetMenuDisplayed(int iPad, bool bVal);
|
||||
|
||||
// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr);
|
||||
// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr);
|
||||
// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL);
|
||||
// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL);
|
||||
EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode);
|
||||
void GetText(uint16_t *UTF16String);
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
// ACHIEVEMENTS & AWARDS
|
||||
|
||||
void RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected=false,
|
||||
CXuiStringTable*pStringTable=nullptr, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=nullptr, unsigned int uiThemeSize=0L);
|
||||
CXuiStringTable*pStringTable=NULL, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=NULL, unsigned int uiThemeSize=0L);
|
||||
int GetAwardId(int iAwardNumber);
|
||||
eAwardType GetAwardType(int iAwardNumber);
|
||||
bool CanBeAwarded(int iQuadrant, int iAwardNumber);
|
||||
|
||||
@@ -16,8 +16,8 @@ public:
|
||||
int GetType() { return m_type; }
|
||||
void *GetBufferPointer() { return m_pBuffer; }
|
||||
int GetBufferSize() { return m_bufferSize; }
|
||||
void Release() { free(m_pBuffer); m_pBuffer = nullptr; }
|
||||
bool Allocated() { return m_pBuffer != nullptr; }
|
||||
void Release() { free(m_pBuffer); m_pBuffer = NULL; }
|
||||
bool Allocated() { return m_pBuffer != NULL; }
|
||||
};
|
||||
|
||||
typedef struct
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
void StartFrame();
|
||||
void DoScreenGrabOnNextPresent();
|
||||
void Present();
|
||||
void Clear(int flags, D3D11_RECT *pRect = nullptr);
|
||||
void Clear(int flags, D3D11_RECT *pRect = NULL);
|
||||
void SetClearColour(const float colourRGBA[4]);
|
||||
bool IsWidescreen();
|
||||
bool IsHiDef();
|
||||
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
|
||||
// Messages
|
||||
C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY,
|
||||
int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=nullptr,LPVOID lpParam=nullptr, C4JStringTable *pStringTable=nullptr, WCHAR *pwchFormatString=nullptr,DWORD dwFocusButton=0);
|
||||
int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, C4JStringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0);
|
||||
|
||||
|
||||
C4JStorage::EMessageResult GetMessageBoxResult();
|
||||
@@ -296,17 +296,17 @@ public:
|
||||
|
||||
C4JStorage::EDLCStatus GetInstalledDLC(int iPad,int( *Func)(LPVOID, int, int),LPVOID lpParam);
|
||||
XCONTENT_DATA& GetDLC(DWORD dw);
|
||||
DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive=nullptr);
|
||||
DWORD UnmountInstalledDLC(LPCSTR szMountDrive = nullptr);
|
||||
DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive=NULL);
|
||||
DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL);
|
||||
void GetMountedDLCFileList(const char* szMountDrive, std::vector<std::string>& fileList);
|
||||
std::string GetMountedPath(std::string szMount);
|
||||
|
||||
// Global title storage
|
||||
C4JStorage::ETMSStatus ReadTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,C4JStorage::eTMS_FileType eFileType,
|
||||
WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int)=nullptr,LPVOID lpParam=nullptr, int iAction=0);
|
||||
WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int)=NULL,LPVOID lpParam=NULL, int iAction=0);
|
||||
bool WriteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename,BYTE *pBuffer,DWORD dwBufferSize);
|
||||
bool DeleteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename);
|
||||
void StoreTMSPathName(WCHAR *pwchName=nullptr);
|
||||
void StoreTMSPathName(WCHAR *pwchName=NULL);
|
||||
|
||||
// TMS++
|
||||
#ifdef _XBOX
|
||||
@@ -314,11 +314,11 @@ public:
|
||||
HRESULT GetUserQuotaInfo(int iPad,TMSCLIENT_CALLBACK Func,LPVOID lpParam);
|
||||
#endif
|
||||
|
||||
// C4JStorage::ETMSStatus TMSPP_WriteFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=nullptr,LPVOID lpParam=nullptr, int iUserData=0);
|
||||
// C4JStorage::ETMSStatus TMSPP_WriteFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=NULL,LPVOID lpParam=NULL, int iUserData=0);
|
||||
// C4JStorage::ETMSStatus TMSPP_GetUserQuotaInfo(int iPad,TMSCLIENT_CALLBACK Func,LPVOID lpParam, int iUserData=0);
|
||||
C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)=nullptr,LPVOID lpParam=nullptr, int iUserData=0);
|
||||
// C4JStorage::ETMSStatus TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,CHAR *pchFilePath,int( *Func)(LPVOID,int,int,PTMSPP_FILE_LIST)=nullptr,LPVOID lpParam=nullptr, int iUserData=0);
|
||||
// C4JStorage::ETMSStatus TMSPP_DeleteFile(int iPad,LPCSTR szFilePath,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,int( *Func)(LPVOID,int,int),LPVOID lpParam=nullptr, int iUserData=0);
|
||||
C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)=NULL,LPVOID lpParam=NULL, int iUserData=0);
|
||||
// C4JStorage::ETMSStatus TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,CHAR *pchFilePath,int( *Func)(LPVOID,int,int,PTMSPP_FILE_LIST)=NULL,LPVOID lpParam=NULL, int iUserData=0);
|
||||
// C4JStorage::ETMSStatus TMSPP_DeleteFile(int iPad,LPCSTR szFilePath,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,int( *Func)(LPVOID,int,int),LPVOID lpParam=NULL, int iUserData=0);
|
||||
// bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const wstring &Filename);
|
||||
// unsigned int CRC(unsigned char *buf, int len);
|
||||
|
||||
|
||||
@@ -1364,7 +1364,7 @@ static DWORD pshader_exceptional_blend_12[276] = {
|
||||
};
|
||||
|
||||
static ProgramWithCachedVariableLocations pshader_exceptional_blend_arr[13] = {
|
||||
{ nullptr, 0, },
|
||||
{ NULL, 0, },
|
||||
{ pshader_exceptional_blend_1, 1340, },
|
||||
{ pshader_exceptional_blend_2, 1444, },
|
||||
{ pshader_exceptional_blend_3, 1424, },
|
||||
@@ -2672,10 +2672,10 @@ static ProgramWithCachedVariableLocations pshader_filter_arr[32] = {
|
||||
{ pshader_filter_9, 708, },
|
||||
{ pshader_filter_10, 1644, },
|
||||
{ pshader_filter_11, 1372, },
|
||||
{ nullptr, 0, },
|
||||
{ nullptr, 0, },
|
||||
{ nullptr, 0, },
|
||||
{ nullptr, 0, },
|
||||
{ NULL, 0, },
|
||||
{ NULL, 0, },
|
||||
{ NULL, 0, },
|
||||
{ NULL, 0, },
|
||||
{ pshader_filter_16, 1740, },
|
||||
{ pshader_filter_17, 1732, },
|
||||
{ pshader_filter_18, 1820, },
|
||||
@@ -2688,10 +2688,10 @@ static ProgramWithCachedVariableLocations pshader_filter_arr[32] = {
|
||||
{ pshader_filter_25, 1468, },
|
||||
{ pshader_filter_26, 1820, },
|
||||
{ pshader_filter_27, 1548, },
|
||||
{ nullptr, 0, },
|
||||
{ nullptr, 0, },
|
||||
{ nullptr, 0, },
|
||||
{ nullptr, 0, },
|
||||
{ NULL, 0, },
|
||||
{ NULL, 0, },
|
||||
{ NULL, 0, },
|
||||
{ NULL, 0, },
|
||||
};
|
||||
|
||||
static DWORD pshader_blur_2[320] = {
|
||||
@@ -3193,8 +3193,8 @@ static DWORD pshader_blur_9[621] = {
|
||||
};
|
||||
|
||||
static ProgramWithCachedVariableLocations pshader_blur_arr[10] = {
|
||||
{ nullptr, 0, },
|
||||
{ nullptr, 0, },
|
||||
{ NULL, 0, },
|
||||
{ NULL, 0, },
|
||||
{ pshader_blur_2, 1280, },
|
||||
{ pshader_blur_3, 1452, },
|
||||
{ pshader_blur_4, 1624, },
|
||||
|
||||
@@ -64,7 +64,7 @@ static void *map_buffer(ID3D1XContext *ctx, ID3D11Buffer *buf, bool discard)
|
||||
HRESULT hr = ctx->Map(buf, 0, discard ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE, 0, &msr);
|
||||
if (FAILED(hr)) {
|
||||
report_d3d_error(hr, "Map", "of buffer");
|
||||
return nullptr;
|
||||
return NULL;
|
||||
} else
|
||||
return msr.pData;
|
||||
}
|
||||
@@ -76,12 +76,12 @@ static void unmap_buffer(ID3D1XContext *ctx, ID3D11Buffer *buf)
|
||||
|
||||
static RADINLINE void set_pixel_shader(ID3D11DeviceContext *ctx, ID3D11PixelShader *shader)
|
||||
{
|
||||
ctx->PSSetShader(shader, nullptr, 0);
|
||||
ctx->PSSetShader(shader, NULL, 0);
|
||||
}
|
||||
|
||||
static RADINLINE void set_vertex_shader(ID3D11DeviceContext *ctx, ID3D11VertexShader *shader)
|
||||
{
|
||||
ctx->VSSetShader(shader, nullptr, 0);
|
||||
ctx->VSSetShader(shader, NULL, 0);
|
||||
}
|
||||
|
||||
static ID3D11BlendState *create_blend_state(ID3D11Device *dev, BOOL blend, D3D11_BLEND src, D3D11_BLEND dst)
|
||||
@@ -100,7 +100,7 @@ static ID3D11BlendState *create_blend_state(ID3D11Device *dev, BOOL blend, D3D11
|
||||
HRESULT hr = dev->CreateBlendState(&desc, &res);
|
||||
if (FAILED(hr)) {
|
||||
report_d3d_error(hr, "CreateBlendState", "");
|
||||
res = nullptr;
|
||||
res = NULL;
|
||||
}
|
||||
|
||||
return res;
|
||||
@@ -113,10 +113,10 @@ static void create_pixel_shader(ProgramWithCachedVariableLocations *p, ProgramWi
|
||||
{
|
||||
*p = *src;
|
||||
if(p->bytecode) {
|
||||
HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, p->size, nullptr, &p->pshader);
|
||||
HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, p->size, NULL, &p->pshader);
|
||||
if (FAILED(hr)) {
|
||||
report_d3d_error(hr, "CreatePixelShader", "");
|
||||
p->pshader = nullptr;
|
||||
p->pshader = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -126,10 +126,10 @@ static void create_vertex_shader(ProgramWithCachedVariableLocations *p, ProgramW
|
||||
{
|
||||
*p = *src;
|
||||
if(p->bytecode) {
|
||||
HRESULT hr = gdraw->d3d_device->CreateVertexShader(p->bytecode, p->size, nullptr, &p->vshader);
|
||||
HRESULT hr = gdraw->d3d_device->CreateVertexShader(p->bytecode, p->size, NULL, &p->vshader);
|
||||
if (FAILED(hr)) {
|
||||
report_d3d_error(hr, "CreateVertexShader", "");
|
||||
p->vshader = nullptr;
|
||||
p->vshader = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ IDOC extern GDrawFunctions * gdraw_D3D11_CreateContext(ID3D11Device *dev, ID3D11
|
||||
There can only be one D3D GDraw context active at any one time.
|
||||
|
||||
If initialization fails for some reason (the main reason would be an out of memory condition),
|
||||
nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */
|
||||
NULL is returned. Otherwise, you can pass the return value to IggySetGDraw. */
|
||||
|
||||
IDOC extern void gdraw_D3D11_DestroyContext(void);
|
||||
/* Destroys the current GDraw context, if any. */
|
||||
@@ -70,7 +70,7 @@ IDOC extern void gdraw_D3D11_SetTileOrigin(ID3D11RenderTargetView *main_rt, ID3D
|
||||
If your rendertarget uses multisampling, you also need to specify a shader
|
||||
resource view for a non-MSAA rendertarget texture (identically sized to main_rt)
|
||||
in non_msaa_rt. This is only used if the Flash content includes non-standard
|
||||
blend modes which have to use a special blend shader, so you can leave it nullptr
|
||||
blend modes which have to use a special blend shader, so you can leave it NULL
|
||||
if you forbid such content.
|
||||
|
||||
You need to call this before Iggy calls any rendering functions. */
|
||||
|
||||
@@ -196,16 +196,16 @@ static void safe_release(T *&p)
|
||||
{
|
||||
if (p) {
|
||||
p->Release();
|
||||
p = nullptr;
|
||||
p = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void report_d3d_error(HRESULT hr, const char *call, const char *context)
|
||||
{
|
||||
if (hr == E_OUTOFMEMORY)
|
||||
IggyGDrawSendWarning(nullptr, "GDraw D3D out of memory in %s%s", call, context);
|
||||
IggyGDrawSendWarning(NULL, "GDraw D3D out of memory in %s%s", call, context);
|
||||
else
|
||||
IggyGDrawSendWarning(nullptr, "GDraw D3D error in %s%s: 0x%08x", call, context, hr);
|
||||
IggyGDrawSendWarning(NULL, "GDraw D3D error in %s%s: 0x%08x", call, context, hr);
|
||||
}
|
||||
|
||||
static void unbind_resources(void)
|
||||
@@ -214,13 +214,13 @@ static void unbind_resources(void)
|
||||
|
||||
// unset active textures and vertex/index buffers,
|
||||
// to make sure there are no dangling refs
|
||||
static ID3D1X(ShaderResourceView) *no_views[3] = { nullptr };
|
||||
ID3D1X(Buffer) *no_vb = nullptr;
|
||||
static ID3D1X(ShaderResourceView) *no_views[3] = { 0 };
|
||||
ID3D1X(Buffer) *no_vb = NULL;
|
||||
UINT no_offs = 0;
|
||||
|
||||
d3d->PSSetShaderResources(0, 3, no_views);
|
||||
d3d->IASetVertexBuffers(0, 1, &no_vb, &no_offs, &no_offs);
|
||||
d3d->IASetIndexBuffer(nullptr, DXGI_FORMAT_UNKNOWN, 0);
|
||||
d3d->IASetIndexBuffer(NULL, DXGI_FORMAT_UNKNOWN, 0);
|
||||
}
|
||||
|
||||
static void api_free_resource(GDrawHandle *r)
|
||||
@@ -251,11 +251,11 @@ static void RADLINK gdraw_UnlockHandles(GDrawStats * /*stats*/)
|
||||
|
||||
static void *start_write_dyn(DynBuffer *buf, U32 size)
|
||||
{
|
||||
U8 *ptr = nullptr;
|
||||
U8 *ptr = NULL;
|
||||
|
||||
if (size > buf->size) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw dynamic vertex buffer usage of %d bytes in one call larger than buffer size %d", size, buf->size);
|
||||
return nullptr;
|
||||
IggyGDrawSendWarning(NULL, "GDraw dynamic vertex buffer usage of %d bytes in one call larger than buffer size %d", size, buf->size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// update statistics
|
||||
@@ -270,7 +270,7 @@ static void *start_write_dyn(DynBuffer *buf, U32 size)
|
||||
// discard buffer whenever the current write position is 0;
|
||||
// done this way so that if a DISCARD Map() were to fail, we would
|
||||
// just keep retrying the next time around.
|
||||
ptr = static_cast<U8 *>(map_buffer(gdraw->d3d_context, buf->buffer, buf->write_pos == 0));
|
||||
ptr = (U8 *) map_buffer(gdraw->d3d_context, buf->buffer, buf->write_pos == 0);
|
||||
if (ptr) {
|
||||
ptr += buf->write_pos; // we return pointer to write position in buffer
|
||||
buf->alloc_pos = buf->write_pos + size; // bump alloc position
|
||||
@@ -373,19 +373,19 @@ extern GDrawTexture *gdraw_D3D1X_(WrappedTextureCreate)(ID3D1X(ShaderResourceVie
|
||||
{
|
||||
GDrawStats stats={0};
|
||||
GDrawHandle *p = gdraw_res_alloc_begin(gdraw->texturecache, 0, &stats); // it may need to free one item to give us a handle
|
||||
p->handle.tex.d3d = nullptr;
|
||||
p->handle.tex.d3d = NULL;
|
||||
p->handle.tex.d3d_view = tex_view;
|
||||
p->handle.tex.d3d_rtview = nullptr;
|
||||
p->handle.tex.d3d_rtview = NULL;
|
||||
p->handle.tex.w = 1;
|
||||
p->handle.tex.h = 1;
|
||||
gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned);
|
||||
gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned);
|
||||
return (GDrawTexture *) p;
|
||||
}
|
||||
|
||||
extern void gdraw_D3D1X_(WrappedTextureChange)(GDrawTexture *tex, ID3D1X(ShaderResourceView) *tex_view)
|
||||
{
|
||||
GDrawHandle *p = (GDrawHandle *) tex;
|
||||
p->handle.tex.d3d = nullptr;
|
||||
p->handle.tex.d3d = NULL;
|
||||
p->handle.tex.d3d_view = tex_view;
|
||||
}
|
||||
|
||||
@@ -407,12 +407,12 @@ static void RADLINK gdraw_SetTextureUniqueID(GDrawTexture *tex, void *old_id, vo
|
||||
|
||||
static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format format, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *stats)
|
||||
{
|
||||
GDrawHandle *t = nullptr;
|
||||
GDrawHandle *t = NULL;
|
||||
DXGI_FORMAT dxgi_fmt;
|
||||
S32 bpp, size = 0, nmips = 0;
|
||||
|
||||
if (width >= 16384 || height >= 16384) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw texture size too large (%d x %d), dimension limit is 16384", width, height);
|
||||
IggyGDrawSendWarning(NULL, "GDraw texture size too large (%d x %d), dimension limit is 16384", width, height);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -433,7 +433,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height,
|
||||
// try to allocate memory for the client to write to
|
||||
p->texture_data = (U8 *) IggyGDrawMalloc(size);
|
||||
if (!p->texture_data) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height);
|
||||
IggyGDrawSendWarning(NULL, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -446,9 +446,9 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height,
|
||||
|
||||
t->handle.tex.w = width;
|
||||
t->handle.tex.h = height;
|
||||
t->handle.tex.d3d = nullptr;
|
||||
t->handle.tex.d3d_view = nullptr;
|
||||
t->handle.tex.d3d_rtview = nullptr;
|
||||
t->handle.tex.d3d = NULL;
|
||||
t->handle.tex.d3d_view = NULL;
|
||||
t->handle.tex.d3d_rtview = NULL;
|
||||
|
||||
p->texture_type = GDRAW_TEXTURE_TYPE_rgba;
|
||||
p->p0 = t;
|
||||
@@ -474,7 +474,7 @@ static rrbool RADLINK gdraw_MakeTextureMore(GDraw_MakeTexture_ProcessingInfo * /
|
||||
|
||||
static GDrawTexture * RADLINK gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *stats)
|
||||
{
|
||||
GDrawHandle *t = static_cast<GDrawHandle *>(p->p0);
|
||||
GDrawHandle *t = (GDrawHandle *) p->p0;
|
||||
D3D1X_(SUBRESOURCE_DATA) mipdata[24];
|
||||
S32 i, w, h, nmips, bpp;
|
||||
HRESULT hr = S_OK;
|
||||
@@ -512,7 +512,7 @@ static GDrawTexture * RADLINK gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingI
|
||||
|
||||
// and create a corresponding shader resource view
|
||||
failed_call = "CreateShaderResourceView";
|
||||
hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_view);
|
||||
hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_view);
|
||||
|
||||
done:
|
||||
if (!FAILED(hr)) {
|
||||
@@ -525,7 +525,7 @@ done:
|
||||
safe_release(t->handle.tex.d3d_view);
|
||||
|
||||
gdraw_HandleCacheAllocateFail(t);
|
||||
t = nullptr;
|
||||
t = NULL;
|
||||
report_d3d_error(hr, failed_call, " while creating texture");
|
||||
}
|
||||
|
||||
@@ -554,8 +554,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *t, void * /*unique_id*/
|
||||
static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *stats)
|
||||
{
|
||||
GDrawHandle *t = (GDrawHandle *) tt;
|
||||
assert(t != nullptr); // @GDRAW_ASSERT
|
||||
if (t->owner == unique_id || unique_id == nullptr) {
|
||||
assert(t != NULL); // @GDRAW_ASSERT
|
||||
if (t->owner == unique_id || unique_id == NULL) {
|
||||
if (t->cache == &gdraw->rendertargets) {
|
||||
gdraw_HandleCacheUnlock(t);
|
||||
// cache it by simply not freeing it
|
||||
@@ -595,7 +595,7 @@ static void RADLINK gdraw_SetAntialiasTexture(S32 width, U8 *rgba)
|
||||
return;
|
||||
}
|
||||
|
||||
hr = gdraw->d3d_device->CreateShaderResourceView(gdraw->aa_tex, nullptr, &gdraw->aa_tex_view);
|
||||
hr = gdraw->d3d_device->CreateShaderResourceView(gdraw->aa_tex, NULL, &gdraw->aa_tex_view);
|
||||
if (FAILED(hr)) {
|
||||
report_d3d_error(hr, "CreateShaderResourceView", " while creating texture");
|
||||
safe_release(gdraw->aa_tex);
|
||||
@@ -616,8 +616,8 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat
|
||||
if (p->vertex_data && p->index_data) {
|
||||
GDrawHandle *vb = gdraw_res_alloc_begin(gdraw->vbufcache, vbuf_size + ibuf_size, stats);
|
||||
if (vb) {
|
||||
vb->handle.vbuf.verts = nullptr;
|
||||
vb->handle.vbuf.inds = nullptr;
|
||||
vb->handle.vbuf.verts = NULL;
|
||||
vb->handle.vbuf.inds = NULL;
|
||||
|
||||
p->vertex_data_length = vbuf_size;
|
||||
p->index_data_length = ibuf_size;
|
||||
@@ -643,7 +643,7 @@ static rrbool RADLINK gdraw_MakeVertexBufferMore(GDraw_MakeVertexBuffer_Processi
|
||||
|
||||
static GDrawVertexBuffer * RADLINK gdraw_MakeVertexBufferEnd(GDraw_MakeVertexBuffer_ProcessingInfo *p, GDrawStats * /*stats*/)
|
||||
{
|
||||
GDrawHandle *vb = static_cast<GDrawHandle *>(p->p0);
|
||||
GDrawHandle *vb = (GDrawHandle *) p->p0;
|
||||
|
||||
HRESULT hr;
|
||||
D3D1X_(BUFFER_DESC) vbdesc = { static_cast<U32>(p->vertex_data_length), D3D1X_(USAGE_IMMUTABLE), D3D1X_(BIND_VERTEX_BUFFER), 0U, 0U };
|
||||
@@ -661,7 +661,7 @@ static GDrawVertexBuffer * RADLINK gdraw_MakeVertexBufferEnd(GDraw_MakeVertexBuf
|
||||
safe_release(vb->handle.vbuf.inds);
|
||||
|
||||
gdraw_HandleCacheAllocateFail(vb);
|
||||
vb = nullptr;
|
||||
vb = NULL;
|
||||
|
||||
report_d3d_error(hr, "CreateBuffer", " creating vertex buffer");
|
||||
} else {
|
||||
@@ -682,7 +682,7 @@ static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer *vb, void *uni
|
||||
static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats)
|
||||
{
|
||||
GDrawHandle *h = (GDrawHandle *) vb;
|
||||
assert(h != nullptr); // @GDRAW_ASSERT
|
||||
assert(h != NULL); // @GDRAW_ASSERT
|
||||
if (h->owner == unique_id)
|
||||
gdraw_res_free(h, stats);
|
||||
}
|
||||
@@ -712,31 +712,31 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats)
|
||||
// ran out of RTs, allocate a new one
|
||||
S32 size = gdraw->frametex_width * gdraw->frametex_height * 4;
|
||||
if (gdraw->rendertargets.bytes_free < size) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit size limit of %d bytes", gdraw->rendertargets.total_bytes);
|
||||
return nullptr;
|
||||
IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit size limit of %d bytes", gdraw->rendertargets.total_bytes);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets);
|
||||
if (!t) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit handle limit");
|
||||
IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit handle limit");
|
||||
return t;
|
||||
}
|
||||
|
||||
D3D1X_(TEXTURE2D_DESC) desc = { static_cast<U32>(gdraw->frametex_width), static_cast<U32>(gdraw->frametex_height), 1U, 1U, DXGI_FORMAT_R8G8B8A8_UNORM, { 1, 0 },
|
||||
D3D1X_(USAGE_DEFAULT), D3D1X_(BIND_SHADER_RESOURCE) | D3D1X_(BIND_RENDER_TARGET), 0U, 0U };
|
||||
|
||||
t->handle.tex.d3d = nullptr;
|
||||
t->handle.tex.d3d_view = nullptr;
|
||||
t->handle.tex.d3d_rtview = nullptr;
|
||||
t->handle.tex.d3d = NULL;
|
||||
t->handle.tex.d3d_view = NULL;
|
||||
t->handle.tex.d3d_rtview = NULL;
|
||||
|
||||
HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, nullptr, &t->handle.tex.d3d);
|
||||
HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, NULL, &t->handle.tex.d3d);
|
||||
failed_call = "CreateTexture2D";
|
||||
if (!FAILED(hr)) {
|
||||
hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_view);
|
||||
hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_view);
|
||||
failed_call = "CreateTexture2D";
|
||||
}
|
||||
if (!FAILED(hr)) {
|
||||
hr = gdraw->d3d_device->CreateRenderTargetView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_rtview);
|
||||
hr = gdraw->d3d_device->CreateRenderTargetView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_rtview);
|
||||
failed_call = "CreateRenderTargetView";
|
||||
}
|
||||
|
||||
@@ -748,7 +748,7 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats)
|
||||
|
||||
report_d3d_error(hr, failed_call, " creating rendertarget");
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gdraw_HandleCacheAllocateEnd(t, size, (void *) 1, GDRAW_HANDLE_STATE_locked);
|
||||
@@ -768,10 +768,10 @@ static ID3D1X(DepthStencilView) *get_rendertarget_depthbuffer(GDrawStats *stats)
|
||||
D3D1X_(TEXTURE2D_DESC) desc = { static_cast<U32>(gdraw->frametex_width), static_cast<U32>(gdraw->frametex_height), 1U, 1U, DXGI_FORMAT_D24_UNORM_S8_UINT, { 1, 0 },
|
||||
D3D1X_(USAGE_DEFAULT), D3D1X_(BIND_DEPTH_STENCIL), 0U, 0U };
|
||||
|
||||
HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, nullptr, &gdraw->rt_depth_buffer);
|
||||
HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, NULL, &gdraw->rt_depth_buffer);
|
||||
failed_call = "CreateTexture2D";
|
||||
if (!FAILED(hr)) {
|
||||
hr = gdraw->d3d_device->CreateDepthStencilView(gdraw->rt_depth_buffer, nullptr, &gdraw->depth_buffer[1]);
|
||||
hr = gdraw->d3d_device->CreateDepthStencilView(gdraw->rt_depth_buffer, NULL, &gdraw->depth_buffer[1]);
|
||||
failed_call = "CreateDepthStencilView while creating rendertarget";
|
||||
}
|
||||
|
||||
@@ -861,7 +861,7 @@ static void disable_scissor(int force)
|
||||
|
||||
static void set_viewport_raw(S32 x, S32 y, S32 w, S32 h)
|
||||
{
|
||||
D3D1X_(VIEWPORT) vp = { static_cast<ViewCoord>(x), static_cast<ViewCoord>(y), static_cast<ViewCoord>(w), static_cast<ViewCoord>(h), 0.0f, 1.0f };
|
||||
D3D1X_(VIEWPORT) vp = { (ViewCoord) x, (ViewCoord) y, (ViewCoord) w, (ViewCoord) h, 0.0f, 1.0f };
|
||||
gdraw->d3d_context->RSSetViewports(1, &vp);
|
||||
gdraw->cview.x = x;
|
||||
gdraw->cview.y = y;
|
||||
@@ -891,8 +891,8 @@ static void set_projection_raw(S32 x0, S32 x1, S32 y0, S32 y1)
|
||||
{
|
||||
gdraw->projection[0] = 2.0f / (x1-x0);
|
||||
gdraw->projection[1] = 2.0f / (y1-y0);
|
||||
gdraw->projection[2] = (x1+x0)/static_cast<F32>(x0 - x1);
|
||||
gdraw->projection[3] = (y1+y0)/static_cast<F32>(y0 - y1);
|
||||
gdraw->projection[2] = (x1+x0)/(F32)(x0-x1);
|
||||
gdraw->projection[3] = (y1+y0)/(F32)(y0-y1);
|
||||
|
||||
set_projection_base();
|
||||
}
|
||||
@@ -1113,7 +1113,7 @@ static void set_render_target(GDrawStats *stats)
|
||||
gdraw->d3d_context->OMSetRenderTargets(1, &target, gdraw->depth_buffer[0]);
|
||||
gdraw->d3d_context->RSSetState(gdraw->raster_state[gdraw->main_msaa]);
|
||||
} else {
|
||||
ID3D1X(DepthStencilView) *depth = nullptr;
|
||||
ID3D1X(DepthStencilView) *depth = NULL;
|
||||
if (gdraw->cur->flags & (GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_id | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_stencil))
|
||||
depth = get_rendertarget_depthbuffer(stats);
|
||||
|
||||
@@ -1128,15 +1128,15 @@ static void set_render_target(GDrawStats *stats)
|
||||
static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_texture_format /*format*/, U32 flags, void *owner, GDrawStats *stats)
|
||||
{
|
||||
GDrawFramebufferState *n = gdraw->cur+1;
|
||||
GDrawHandle *t = nullptr;
|
||||
GDrawHandle *t = NULL;
|
||||
if (gdraw->tw == 0 || gdraw->th == 0) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw warning: w=0,h=0 rendertarget");
|
||||
IggyGDrawSendWarning(NULL, "GDraw warning: w=0,h=0 rendertarget");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) {
|
||||
assert(0);
|
||||
IggyGDrawSendWarning(nullptr, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH");
|
||||
IggyGDrawSendWarning(NULL, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1150,10 +1150,10 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex
|
||||
|
||||
n->flags = flags;
|
||||
n->color_buffer = t;
|
||||
assert(n->color_buffer != nullptr); // @GDRAW_ASSERT
|
||||
assert(n->color_buffer != NULL); // @GDRAW_ASSERT
|
||||
|
||||
++gdraw->cur;
|
||||
gdraw->cur->cached = owner != nullptr;
|
||||
gdraw->cur->cached = owner != NULL;
|
||||
if (owner) {
|
||||
gdraw->cur->base_x = region->x0;
|
||||
gdraw->cur->base_y = region->y0;
|
||||
@@ -1164,7 +1164,7 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex
|
||||
set_render_target(stats);
|
||||
assert(gdraw->frametex_width >= gdraw->tw && gdraw->frametex_height >= gdraw->th); // @GDRAW_ASSERT
|
||||
|
||||
S32 k = static_cast<S32>(t - gdraw->rendertargets.handle);
|
||||
S32 k = (S32) (t - gdraw->rendertargets.handle);
|
||||
|
||||
if (region) {
|
||||
gswf_recti r;
|
||||
@@ -1190,7 +1190,7 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex
|
||||
|
||||
if (r.x1 <= r.x0 || r.y1 <= r.y0) { // region doesn't intersect with current tile
|
||||
--gdraw->cur;
|
||||
gdraw_FreeTexture((GDrawTexture *) t, nullptr, stats);
|
||||
gdraw_FreeTexture((GDrawTexture *) t, 0, stats);
|
||||
// note: don't send a warning since this will happen during regular tiled rendering
|
||||
return false;
|
||||
}
|
||||
@@ -1224,17 +1224,17 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats)
|
||||
{
|
||||
GDrawFramebufferState *n = gdraw->cur;
|
||||
GDrawFramebufferState *m = --gdraw->cur;
|
||||
if (gdraw->tw == 0 || gdraw->th == 0) return nullptr;
|
||||
if (gdraw->tw == 0 || gdraw->th == 0) return 0;
|
||||
|
||||
if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH])
|
||||
return nullptr; // already returned a warning in Begin
|
||||
return 0; // already returned a warning in Begin
|
||||
|
||||
assert(m >= gdraw->frame); // bug in Iggy -- unbalanced
|
||||
|
||||
if (m != gdraw->frame) {
|
||||
assert(m->color_buffer != nullptr); // @GDRAW_ASSERT
|
||||
assert(m->color_buffer != NULL); // @GDRAW_ASSERT
|
||||
}
|
||||
assert(n->color_buffer != nullptr); // @GDRAW_ASSERT
|
||||
assert(n->color_buffer != NULL); // @GDRAW_ASSERT
|
||||
|
||||
// switch back to old render target
|
||||
set_render_target(stats);
|
||||
@@ -1284,15 +1284,15 @@ static void RADLINK gdraw_ClearID(void)
|
||||
// assuming the depth buffer has been mappped to 0..1
|
||||
static F32 depth_from_id(S32 id)
|
||||
{
|
||||
return 1.0f - (static_cast<F32>(id) + 1.0f) / MAX_DEPTH_VALUE;
|
||||
return 1.0f - ((F32) id + 1.0f) / MAX_DEPTH_VALUE;
|
||||
}
|
||||
|
||||
static void set_texture(S32 texunit, GDrawTexture *tex, rrbool nearest, S32 wrap)
|
||||
{
|
||||
ID3D1XContext *d3d = gdraw->d3d_context;
|
||||
|
||||
if (tex == nullptr) {
|
||||
ID3D1X(ShaderResourceView) *notex = nullptr;
|
||||
if (tex == NULL) {
|
||||
ID3D1X(ShaderResourceView) *notex = NULL;
|
||||
d3d->PSSetShaderResources(texunit, 1, ¬ex);
|
||||
} else {
|
||||
GDrawHandle *h = (GDrawHandle *) tex;
|
||||
@@ -1303,7 +1303,7 @@ static void set_texture(S32 texunit, GDrawTexture *tex, rrbool nearest, S32 wrap
|
||||
|
||||
static void RADLINK gdraw_Set3DTransform(F32 *mat)
|
||||
{
|
||||
if (mat == nullptr)
|
||||
if (mat == NULL)
|
||||
gdraw->use_3d = 0;
|
||||
else {
|
||||
gdraw->use_3d = 1;
|
||||
@@ -1319,7 +1319,7 @@ static int set_renderstate_full(S32 vertex_format, GDrawRenderState *r, GDrawSta
|
||||
set_vertex_shader(d3d, gdraw->vert[vertex_format].vshader);
|
||||
|
||||
// set vertex shader constants
|
||||
if (VertexVars *vvars = static_cast<VertexVars *>(map_buffer(gdraw->d3d_context, gdraw->cb_vertex, true))) {
|
||||
if (VertexVars *vvars = (VertexVars *) map_buffer(gdraw->d3d_context, gdraw->cb_vertex, true)) {
|
||||
F32 depth = depth_from_id(r->id);
|
||||
if (!r->use_world_space)
|
||||
gdraw_ObjectSpace(vvars->world[0], r->o2w, depth, 0.0f);
|
||||
@@ -1366,9 +1366,9 @@ static int set_renderstate_full(S32 vertex_format, GDrawRenderState *r, GDrawSta
|
||||
// in stencil set mode, prefer not doing any shading at all
|
||||
// but if alpha test is on, we need to make an exception
|
||||
|
||||
#ifndef GDRAW_D3D11_LEVEL9 // level9 can't do nullptr PS it seems
|
||||
#ifndef GDRAW_D3D11_LEVEL9 // level9 can't do NULL PS it seems
|
||||
if (which != GDRAW_TEXTURE_alpha_test)
|
||||
program = nullptr;
|
||||
program = NULL;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -1384,7 +1384,7 @@ static int set_renderstate_full(S32 vertex_format, GDrawRenderState *r, GDrawSta
|
||||
set_texture(0, r->tex[0], r->nearest0, r->wrap0);
|
||||
|
||||
// pixel shader constants
|
||||
if (PixelCommonVars *pvars = static_cast<PixelCommonVars *>(map_buffer(gdraw->d3d_context, gdraw->cb_ps_common, true))) {
|
||||
if (PixelCommonVars *pvars = (PixelCommonVars *) map_buffer(gdraw->d3d_context, gdraw->cb_ps_common, true)) {
|
||||
memcpy(pvars->color_mul, r->color, 4*sizeof(float));
|
||||
|
||||
if (r->cxf_add) {
|
||||
@@ -1478,13 +1478,13 @@ static int vertsize[GDRAW_vformat__basic_count] = {
|
||||
// Draw triangles with a given renderstate
|
||||
//
|
||||
|
||||
static void tag_resources(void *r1, void *r2=nullptr, void *r3=nullptr, void *r4=nullptr)
|
||||
static void tag_resources(void *r1, void *r2=NULL, void *r3=NULL, void *r4=NULL)
|
||||
{
|
||||
U64 now = gdraw->frame_counter;
|
||||
if (r1) static_cast<GDrawHandle *>(r1)->fence.value = now;
|
||||
if (r2) static_cast<GDrawHandle *>(r2)->fence.value = now;
|
||||
if (r3) static_cast<GDrawHandle *>(r3)->fence.value = now;
|
||||
if (r4) static_cast<GDrawHandle *>(r4)->fence.value = now;
|
||||
if (r1) ((GDrawHandle *) r1)->fence.value = now;
|
||||
if (r2) ((GDrawHandle *) r2)->fence.value = now;
|
||||
if (r3) ((GDrawHandle *) r3)->fence.value = now;
|
||||
if (r4) ((GDrawHandle *) r4)->fence.value = now;
|
||||
}
|
||||
|
||||
static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimitive *p, GDrawVertexBuffer *buf, GDrawStats *stats)
|
||||
@@ -1501,10 +1501,10 @@ static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimiti
|
||||
d3d->IASetInputLayout(gdraw->inlayout[vfmt]);
|
||||
|
||||
if (vb) {
|
||||
UINT offs = static_cast<UINT>((UINTa)p->vertices);
|
||||
UINT offs = (UINT) (UINTa) p->vertices;
|
||||
|
||||
d3d->IASetVertexBuffers(0, 1, &vb->handle.vbuf.verts, &stride, &offs);
|
||||
d3d->IASetIndexBuffer(vb->handle.vbuf.inds, DXGI_FORMAT_R16_UINT, static_cast<UINT>((UINTa)p->indices));
|
||||
d3d->IASetIndexBuffer(vb->handle.vbuf.inds, DXGI_FORMAT_R16_UINT, (UINT) (UINTa) p->indices);
|
||||
d3d->DrawIndexed(p->num_indices, 0, 0);
|
||||
} else if (p->indices) {
|
||||
U32 vbytes = p->num_vertices * stride;
|
||||
@@ -1581,10 +1581,10 @@ static void set_pixel_constant(F32 *constant, F32 x, F32 y, F32 z, F32 w)
|
||||
static void do_screen_quad(gswf_recti *s, const F32 *tc, GDrawStats *stats)
|
||||
{
|
||||
ID3D1XContext *d3d = gdraw->d3d_context;
|
||||
F32 px0 = static_cast<F32>(s->x0), py0 = static_cast<F32>(s->y0), px1 = static_cast<F32>(s->x1), py1 = static_cast<F32>(s->y1);
|
||||
F32 px0 = (F32) s->x0, py0 = (F32) s->y0, px1 = (F32) s->x1, py1 = (F32) s->y1;
|
||||
|
||||
// generate vertex data
|
||||
gswf_vertex_xyst *vert = static_cast<gswf_vertex_xyst *>(start_write_dyn(&gdraw->dyn_vb, 4 * sizeof(gswf_vertex_xyst)));
|
||||
gswf_vertex_xyst *vert = (gswf_vertex_xyst *) start_write_dyn(&gdraw->dyn_vb, 4 * sizeof(gswf_vertex_xyst));
|
||||
if (!vert)
|
||||
return;
|
||||
|
||||
@@ -1595,7 +1595,7 @@ static void do_screen_quad(gswf_recti *s, const F32 *tc, GDrawStats *stats)
|
||||
UINT offs = end_write_dyn(&gdraw->dyn_vb);
|
||||
UINT stride = sizeof(gswf_vertex_xyst);
|
||||
|
||||
if (VertexVars *vvars = static_cast<VertexVars *>(map_buffer(gdraw->d3d_context, gdraw->cb_vertex, true))) {
|
||||
if (VertexVars *vvars = (VertexVars *) map_buffer(gdraw->d3d_context, gdraw->cb_vertex, true)) {
|
||||
gdraw_PixelSpace(vvars->world[0]);
|
||||
memcpy(vvars->x3d, gdraw->projmat, 12*sizeof(F32));
|
||||
unmap_buffer(gdraw->d3d_context, gdraw->cb_vertex);
|
||||
@@ -1629,7 +1629,7 @@ static void manual_clear(gswf_recti *r, GDrawStats *stats)
|
||||
set_projection_raw(0, gdraw->frametex_width, gdraw->frametex_height, 0);
|
||||
set_pixel_shader(d3d, gdraw->clear_ps.pshader);
|
||||
|
||||
if (PixelCommonVars *pvars = static_cast<PixelCommonVars *>(map_buffer(gdraw->d3d_context, gdraw->cb_ps_common, true))) {
|
||||
if (PixelCommonVars *pvars = (PixelCommonVars *) map_buffer(gdraw->d3d_context, gdraw->cb_ps_common, true)) {
|
||||
memset(pvars, 0, sizeof(*pvars));
|
||||
unmap_buffer(gdraw->d3d_context, gdraw->cb_ps_common);
|
||||
d3d->PSSetConstantBuffers(0, 1, &gdraw->cb_ps_common);
|
||||
@@ -1643,7 +1643,7 @@ static void gdraw_DriverBlurPass(GDrawRenderState *r, int taps, float *data, gs
|
||||
set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp);
|
||||
|
||||
set_pixel_shader(gdraw->d3d_context, gdraw->blur_prog[taps].pshader);
|
||||
PixelParaBlur *para = static_cast<PixelParaBlur *>(start_ps_constants(gdraw->cb_blur));
|
||||
PixelParaBlur *para = (PixelParaBlur *) start_ps_constants(gdraw->cb_blur);
|
||||
memcpy(para->clamp, clamp, 4 * sizeof(float));
|
||||
memcpy(para->tap, data, taps * 4 * sizeof(float));
|
||||
end_ps_constants(gdraw->cb_blur);
|
||||
@@ -1654,13 +1654,13 @@ static void gdraw_DriverBlurPass(GDrawRenderState *r, int taps, float *data, gs
|
||||
|
||||
static void gdraw_Colormatrix(GDrawRenderState *r, gswf_recti *s, float *tc, GDrawStats *stats)
|
||||
{
|
||||
if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, stats))
|
||||
if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, 0, stats))
|
||||
return;
|
||||
|
||||
set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp);
|
||||
set_pixel_shader(gdraw->d3d_context, gdraw->colormatrix.pshader);
|
||||
|
||||
PixelParaColorMatrix *para = static_cast<PixelParaColorMatrix *>(start_ps_constants(gdraw->cb_colormatrix));
|
||||
PixelParaColorMatrix *para = (PixelParaColorMatrix *) start_ps_constants(gdraw->cb_colormatrix);
|
||||
memcpy(para->data, r->shader_data, 5 * 4 * sizeof(float));
|
||||
end_ps_constants(gdraw->cb_colormatrix);
|
||||
|
||||
@@ -1672,7 +1672,7 @@ static void gdraw_Colormatrix(GDrawRenderState *r, gswf_recti *s, float *tc, GDr
|
||||
static gswf_recti *get_valid_rect(GDrawTexture *tex)
|
||||
{
|
||||
GDrawHandle *h = (GDrawHandle *) tex;
|
||||
S32 n = static_cast<S32>(h - gdraw->rendertargets.handle);
|
||||
S32 n = (S32) (h - gdraw->rendertargets.handle);
|
||||
assert(n >= 0 && n <= MAX_RENDER_STACK_DEPTH+1);
|
||||
return &gdraw->rt_valid[n];
|
||||
}
|
||||
@@ -1690,7 +1690,7 @@ static void set_clamp_constant(F32 *constant, GDrawTexture *tex)
|
||||
|
||||
static void gdraw_Filter(GDrawRenderState *r, gswf_recti *s, float *tc, int isbevel, GDrawStats *stats)
|
||||
{
|
||||
if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, stats))
|
||||
if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, stats))
|
||||
return;
|
||||
|
||||
set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp);
|
||||
@@ -1698,12 +1698,12 @@ static void gdraw_Filter(GDrawRenderState *r, gswf_recti *s, float *tc, int isbe
|
||||
set_texture(2, r->tex[2], false, GDRAW_WRAP_clamp);
|
||||
set_pixel_shader(gdraw->d3d_context, gdraw->filter_prog[isbevel][r->filter_mode].pshader);
|
||||
|
||||
PixelParaFilter *para = static_cast<PixelParaFilter *>(start_ps_constants(gdraw->cb_filter));
|
||||
PixelParaFilter *para = (PixelParaFilter *) start_ps_constants(gdraw->cb_filter);
|
||||
set_clamp_constant(para->clamp0, r->tex[0]);
|
||||
set_clamp_constant(para->clamp1, r->tex[1]);
|
||||
set_pixel_constant(para->color, r->shader_data[0], r->shader_data[1], r->shader_data[2], r->shader_data[3]);
|
||||
set_pixel_constant(para->color2, r->shader_data[8], r->shader_data[9], r->shader_data[10], r->shader_data[11]);
|
||||
set_pixel_constant(para->tc_off, -r->shader_data[4] / static_cast<F32>(gdraw->frametex_width), -r->shader_data[5] / static_cast<F32>(gdraw->frametex_height), r->shader_data[6], 0);
|
||||
set_pixel_constant(para->tc_off, -r->shader_data[4] / (F32)gdraw->frametex_width, -r->shader_data[5] / (F32)gdraw->frametex_height, r->shader_data[6], 0);
|
||||
end_ps_constants(gdraw->cb_filter);
|
||||
|
||||
do_screen_quad(s, tc, stats);
|
||||
@@ -1725,10 +1725,10 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1
|
||||
if (s.x1 < s.x0 || s.y1 < s.y0)
|
||||
return;
|
||||
|
||||
tc[0] = (s.x0 - gdraw->tx0p) / static_cast<F32>(gdraw->frametex_width);
|
||||
tc[1] = (s.y0 - gdraw->ty0p) / static_cast<F32>(gdraw->frametex_height);
|
||||
tc[2] = (s.x1 - gdraw->tx0p) / static_cast<F32>(gdraw->frametex_width);
|
||||
tc[3] = (s.y1 - gdraw->ty0p) / static_cast<F32>(gdraw->frametex_height);
|
||||
tc[0] = (s.x0 - gdraw->tx0p) / (F32) gdraw->frametex_width;
|
||||
tc[1] = (s.y0 - gdraw->ty0p) / (F32) gdraw->frametex_height;
|
||||
tc[2] = (s.x1 - gdraw->tx0p) / (F32) gdraw->frametex_width;
|
||||
tc[3] = (s.y1 - gdraw->ty0p) / (F32) gdraw->frametex_height;
|
||||
|
||||
// clear to known render state
|
||||
d3d->OMSetBlendState(gdraw->blend_state[GDRAW_BLEND_none], four_zeros, ~0u);
|
||||
@@ -1778,7 +1778,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1
|
||||
assert(0);
|
||||
}
|
||||
} else {
|
||||
GDrawHandle *blend_tex = nullptr;
|
||||
GDrawHandle *blend_tex = NULL;
|
||||
|
||||
// for crazy blend modes, we need to read back from the framebuffer
|
||||
// and do the blending in the pixel shader. we do this with copies
|
||||
@@ -1811,10 +1811,10 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1
|
||||
d3d->PSSetSamplers(1, 1, &gdraw->sampler_state[0][GDRAW_WRAP_clamp]);
|
||||
|
||||
// calculate texture coordinate remapping
|
||||
rescale1[0] = gdraw->frametex_width / static_cast<F32>(texdesc.Width);
|
||||
rescale1[1] = gdraw->frametex_height / static_cast<F32>(texdesc.Height);
|
||||
rescale1[2] = (gdraw->vx - gdraw->tx0 + gdraw->tx0p) / static_cast<F32>(texdesc.Width);
|
||||
rescale1[3] = (gdraw->vy - gdraw->ty0 + gdraw->ty0p) / static_cast<F32>(texdesc.Height);
|
||||
rescale1[0] = gdraw->frametex_width / (F32) texdesc.Width;
|
||||
rescale1[1] = gdraw->frametex_height / (F32) texdesc.Height;
|
||||
rescale1[2] = (gdraw->vx - gdraw->tx0 + gdraw->tx0p) / (F32) texdesc.Width;
|
||||
rescale1[3] = (gdraw->vy - gdraw->ty0 + gdraw->ty0p) / (F32) texdesc.Height;
|
||||
} else {
|
||||
D3D1X_(BOX) box = { 0,0,0,0,0,1 };
|
||||
S32 dx = 0, dy = 0;
|
||||
@@ -1847,7 +1847,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1
|
||||
do_screen_quad(&s, tc, stats);
|
||||
tag_resources(r->tex[0], r->tex[1]);
|
||||
if (blend_tex)
|
||||
gdraw_FreeTexture((GDrawTexture *) blend_tex, nullptr, stats);
|
||||
gdraw_FreeTexture((GDrawTexture *) blend_tex, 0, stats);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1862,18 +1862,18 @@ static void destroy_shader(ProgramWithCachedVariableLocations *p)
|
||||
{
|
||||
if (p->pshader) {
|
||||
p->pshader->Release();
|
||||
p->pshader = nullptr;
|
||||
p->pshader = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static ID3D1X(Buffer) *create_dynamic_buffer(U32 size, U32 bind)
|
||||
{
|
||||
D3D1X_(BUFFER_DESC) desc = { size, D3D1X_(USAGE_DYNAMIC), bind, D3D1X_(CPU_ACCESS_WRITE), 0 };
|
||||
ID3D1X(Buffer) *buf = nullptr;
|
||||
HRESULT hr = gdraw->d3d_device->CreateBuffer(&desc, nullptr, &buf);
|
||||
ID3D1X(Buffer) *buf = NULL;
|
||||
HRESULT hr = gdraw->d3d_device->CreateBuffer(&desc, NULL, &buf);
|
||||
if (FAILED(hr)) {
|
||||
report_d3d_error(hr, "CreateBuffer", " creating dynamic vertex buffer");
|
||||
buf = nullptr;
|
||||
buf = NULL;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
@@ -1910,7 +1910,7 @@ static void create_all_shaders_and_state(void)
|
||||
HRESULT hr = d3d->CreateInputLayout(vformats[i].desc, vformats[i].nelem, vsh->bytecode, vsh->size, &gdraw->inlayout[i]);
|
||||
if (FAILED(hr)) {
|
||||
report_d3d_error(hr, "CreateInputLayout", "");
|
||||
gdraw->inlayout[i] = nullptr;
|
||||
gdraw->inlayout[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2029,11 +2029,11 @@ static void create_all_shaders_and_state(void)
|
||||
hr = gdraw->d3d_device->CreateBuffer(&bufdesc, &data, &gdraw->quad_ib);
|
||||
if (FAILED(hr)) {
|
||||
report_d3d_error(hr, "CreateBuffer", " for constants");
|
||||
gdraw->quad_ib = nullptr;
|
||||
gdraw->quad_ib = NULL;
|
||||
}
|
||||
IggyGDrawFree(inds);
|
||||
} else
|
||||
gdraw->quad_ib = nullptr;
|
||||
gdraw->quad_ib = NULL;
|
||||
}
|
||||
|
||||
static void destroy_all_shaders_and_state()
|
||||
@@ -2106,7 +2106,7 @@ static void free_gdraw()
|
||||
if (gdraw->texturecache) IggyGDrawFree(gdraw->texturecache);
|
||||
if (gdraw->vbufcache) IggyGDrawFree(gdraw->vbufcache);
|
||||
IggyGDrawFree(gdraw);
|
||||
gdraw = nullptr;
|
||||
gdraw = NULL;
|
||||
}
|
||||
|
||||
static bool alloc_dynbuffer(U32 size)
|
||||
@@ -2142,7 +2142,7 @@ static bool alloc_dynbuffer(U32 size)
|
||||
gdraw->max_quad_vert_count = RR_MIN(size / sizeof(gswf_vertex_xyst), QUAD_IB_COUNT * 4);
|
||||
gdraw->max_quad_vert_count &= ~3; // must be multiple of four
|
||||
|
||||
return gdraw->dyn_vb.buffer != nullptr && gdraw->dyn_ib.buffer != nullptr;
|
||||
return gdraw->dyn_vb.buffer != NULL && gdraw->dyn_ib.buffer != NULL;
|
||||
}
|
||||
|
||||
int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S32 num_bytes)
|
||||
@@ -2181,7 +2181,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3
|
||||
IggyGDrawFree(gdraw->texturecache);
|
||||
}
|
||||
gdraw->texturecache = make_handle_cache(GDRAW_D3D1X_(RESOURCE_texture));
|
||||
return gdraw->texturecache != nullptr;
|
||||
return gdraw->texturecache != NULL;
|
||||
|
||||
case GDRAW_D3D1X_(RESOURCE_vertexbuffer):
|
||||
if (gdraw->vbufcache) {
|
||||
@@ -2189,7 +2189,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3
|
||||
IggyGDrawFree(gdraw->vbufcache);
|
||||
}
|
||||
gdraw->vbufcache = make_handle_cache(GDRAW_D3D1X_(RESOURCE_vertexbuffer));
|
||||
return gdraw->vbufcache != nullptr;
|
||||
return gdraw->vbufcache != NULL;
|
||||
|
||||
case GDRAW_D3D1X_(RESOURCE_dynbuffer):
|
||||
unbind_resources();
|
||||
@@ -2205,7 +2205,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3
|
||||
static GDrawFunctions *create_context(ID3D1XDevice *dev, ID3D1XContext *ctx, S32 w, S32 h)
|
||||
{
|
||||
gdraw = (GDraw *) IggyGDrawMalloc(sizeof(*gdraw));
|
||||
if (!gdraw) return nullptr;
|
||||
if (!gdraw) return NULL;
|
||||
|
||||
memset(gdraw, 0, sizeof(*gdraw));
|
||||
|
||||
@@ -2220,7 +2220,7 @@ static GDrawFunctions *create_context(ID3D1XDevice *dev, ID3D1XContext *ctx, S32
|
||||
|
||||
if (!gdraw->texturecache || !gdraw->vbufcache || !alloc_dynbuffer(gdraw_limits[GDRAW_D3D1X_(RESOURCE_dynbuffer)].num_bytes)) {
|
||||
free_gdraw();
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
create_all_shaders_and_state();
|
||||
@@ -2291,7 +2291,7 @@ void gdraw_D3D1X_(DestroyContext)(void)
|
||||
if (gdraw->texturecache) gdraw_res_flush(gdraw->texturecache, &stats);
|
||||
if (gdraw->vbufcache) gdraw_res_flush(gdraw->vbufcache, &stats);
|
||||
|
||||
gdraw->d3d_device = nullptr;
|
||||
gdraw->d3d_device = NULL;
|
||||
}
|
||||
|
||||
free_gdraw();
|
||||
@@ -2354,7 +2354,7 @@ void RADLINK gdraw_D3D1X_(GetResourceUsageStats)(gdraw_resourcetype type, S32 *h
|
||||
case GDRAW_D3D1X_(RESOURCE_texture): cache = gdraw->texturecache; break;
|
||||
case GDRAW_D3D1X_(RESOURCE_vertexbuffer): cache = gdraw->vbufcache; break;
|
||||
case GDRAW_D3D1X_(RESOURCE_dynbuffer): *handles_used = 0; *bytes_used = gdraw->last_dyn_maxalloc; return;
|
||||
default: cache = nullptr; break;
|
||||
default: cache = NULL; break;
|
||||
}
|
||||
|
||||
*handles_used = *bytes_used = 0;
|
||||
@@ -2385,14 +2385,14 @@ static S32 num_pixels(S32 w, S32 h, S32 mipmaps)
|
||||
GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, S32 /*len*/, IggyFileTextureRaw *texture)
|
||||
{
|
||||
const char *failed_call="";
|
||||
U8 *free_data = nullptr;
|
||||
GDrawTexture *t=nullptr;
|
||||
U8 *free_data = 0;
|
||||
GDrawTexture *t=0;
|
||||
S32 width, height, mipmaps, size, blk;
|
||||
ID3D1X(Texture2D) *tex=nullptr;
|
||||
ID3D1X(ShaderResourceView) *view=nullptr;
|
||||
ID3D1X(Texture2D) *tex=0;
|
||||
ID3D1X(ShaderResourceView) *view=0;
|
||||
|
||||
DXGI_FORMAT d3dfmt;
|
||||
D3D1X_(SUBRESOURCE_DATA) mipdata[24] = { nullptr };
|
||||
D3D1X_(SUBRESOURCE_DATA) mipdata[24] = { 0 };
|
||||
S32 k;
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
@@ -2413,7 +2413,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file,
|
||||
case IFT_FORMAT_DXT3 : size=16; d3dfmt = DXGI_FORMAT_BC2_UNORM; blk = 4; break;
|
||||
case IFT_FORMAT_DXT5 : size=16; d3dfmt = DXGI_FORMAT_BC3_UNORM; blk = 4; break;
|
||||
default: {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw .iggytex raw texture format %d not supported by hardware", texture->format);
|
||||
IggyGDrawSendWarning(NULL, "GDraw .iggytex raw texture format %d not supported by hardware", texture->format);
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
@@ -2430,7 +2430,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file,
|
||||
|
||||
free_data = (U8 *) IggyGDrawMalloc(total_size);
|
||||
if (!free_data) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height);
|
||||
IggyGDrawSendWarning(NULL, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height);
|
||||
done = true;
|
||||
} else {
|
||||
U8 *cur = free_data;
|
||||
@@ -2463,7 +2463,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file,
|
||||
hr = gdraw->d3d_device->CreateTexture2D(&desc, mipdata, &tex);
|
||||
if (!FAILED(hr)) {
|
||||
failed_call = "CreateShaderResourceView for texture creation";
|
||||
hr = gdraw->d3d_device->CreateShaderResourceView(tex, nullptr, &view);
|
||||
hr = gdraw->d3d_device->CreateShaderResourceView(tex, NULL, &view);
|
||||
if (!FAILED(hr))
|
||||
t = gdraw_D3D1X_(WrappedTextureCreate)(view);
|
||||
}
|
||||
@@ -2483,14 +2483,14 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file,
|
||||
if (tex)
|
||||
tex->Release();
|
||||
} else {
|
||||
reinterpret_cast<GDrawHandle *>(t)->handle.tex.d3d = tex;
|
||||
((GDrawHandle *) t)->handle.tex.d3d = tex;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
void RADLINK gdraw_D3D1X_(DestroyTextureFromResource)(GDrawTexture *tex)
|
||||
{
|
||||
GDrawHandle *h = reinterpret_cast<GDrawHandle *>(tex);
|
||||
GDrawHandle *h = (GDrawHandle *) tex;
|
||||
safe_release(h->handle.tex.d3d_view);
|
||||
safe_release(h->handle.tex.d3d);
|
||||
gdraw_D3D1X_(WrappedTextureDestroy)(tex);
|
||||
|
||||
@@ -181,7 +181,7 @@ static char *pshader_basic_vars[] = {
|
||||
"color_mul",
|
||||
"color_add",
|
||||
"focal",
|
||||
nullptr
|
||||
NULL
|
||||
};
|
||||
|
||||
static char pshader_general2_frag0[] =
|
||||
@@ -293,7 +293,7 @@ static char **pshader_general2(void)
|
||||
|
||||
static char *pshader_general2_vars[] = {
|
||||
"tex0",
|
||||
nullptr
|
||||
NULL
|
||||
};
|
||||
|
||||
static char pshader_exceptional_blend_frag0[] =
|
||||
@@ -414,7 +414,7 @@ static char pshader_exceptional_blend_frag13[] =
|
||||
|
||||
#define NUMFRAGMENTS_pshader_exceptional_blend 3
|
||||
static char *pshader_exceptional_blend_arr[13][NUMFRAGMENTS_pshader_exceptional_blend] = {
|
||||
{ nullptr, nullptr, nullptr, },
|
||||
{ NULL, NULL, NULL, },
|
||||
{ pshader_exceptional_blend_frag0, pshader_exceptional_blend_frag1, pshader_exceptional_blend_frag2, },
|
||||
{ pshader_exceptional_blend_frag0, pshader_exceptional_blend_frag3, pshader_exceptional_blend_frag2, },
|
||||
{ pshader_exceptional_blend_frag0, pshader_exceptional_blend_frag4, pshader_exceptional_blend_frag2, },
|
||||
@@ -439,7 +439,7 @@ static char *pshader_exceptional_blend_vars[] = {
|
||||
"tex1",
|
||||
"color_mul",
|
||||
"color_add",
|
||||
nullptr
|
||||
NULL
|
||||
};
|
||||
|
||||
static char pshader_filter_frag0[] =
|
||||
@@ -593,10 +593,10 @@ static char *pshader_filter_arr[32][NUMFRAGMENTS_pshader_filter] = {
|
||||
{ pshader_filter_frag0, pshader_filter_frag1, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag3, pshader_filter_frag2, },
|
||||
{ pshader_filter_frag0, pshader_filter_frag1, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag4, pshader_filter_frag1, pshader_filter_frag2, },
|
||||
{ pshader_filter_frag0, pshader_filter_frag1, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag4, pshader_filter_frag3, pshader_filter_frag2, },
|
||||
{ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, },
|
||||
{ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, },
|
||||
{ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, },
|
||||
{ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, },
|
||||
{ pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag2, },
|
||||
{ pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag3, pshader_filter_frag2, },
|
||||
{ pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag4, pshader_filter_frag1, pshader_filter_frag2, },
|
||||
@@ -609,10 +609,10 @@ static char *pshader_filter_arr[32][NUMFRAGMENTS_pshader_filter] = {
|
||||
{ pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag3, pshader_filter_frag2, },
|
||||
{ pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag4, pshader_filter_frag1, pshader_filter_frag2, },
|
||||
{ pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag4, pshader_filter_frag3, pshader_filter_frag2, },
|
||||
{ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, },
|
||||
{ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, },
|
||||
{ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, },
|
||||
{ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, },
|
||||
};
|
||||
|
||||
static char **pshader_filter(int bevel, int ontop, int inner, int gradient, int knockout)
|
||||
@@ -629,7 +629,7 @@ static char *pshader_filter_vars[] = {
|
||||
"clamp0",
|
||||
"clamp1",
|
||||
"color2",
|
||||
nullptr
|
||||
NULL
|
||||
};
|
||||
|
||||
static char pshader_blur_frag0[] =
|
||||
@@ -701,8 +701,8 @@ static char pshader_blur_frag9[] =
|
||||
|
||||
#define NUMFRAGMENTS_pshader_blur 3
|
||||
static char *pshader_blur_arr[10][NUMFRAGMENTS_pshader_blur] = {
|
||||
{ nullptr, nullptr, nullptr, },
|
||||
{ nullptr, nullptr, nullptr, },
|
||||
{ NULL, NULL, NULL, },
|
||||
{ NULL, NULL, NULL, },
|
||||
{ pshader_blur_frag0, pshader_blur_frag1, pshader_blur_frag2, },
|
||||
{ pshader_blur_frag0, pshader_blur_frag3, pshader_blur_frag2, },
|
||||
{ pshader_blur_frag0, pshader_blur_frag4, pshader_blur_frag2, },
|
||||
@@ -722,7 +722,7 @@ static char *pshader_blur_vars[] = {
|
||||
"tex0",
|
||||
"tap",
|
||||
"clampv",
|
||||
nullptr
|
||||
NULL
|
||||
};
|
||||
|
||||
static char pshader_color_matrix_frag0[] =
|
||||
@@ -804,7 +804,7 @@ static char **pshader_color_matrix(void)
|
||||
static char *pshader_color_matrix_vars[] = {
|
||||
"tex0",
|
||||
"data",
|
||||
nullptr
|
||||
NULL
|
||||
};
|
||||
|
||||
static char pshader_manual_clear_frag0[] =
|
||||
@@ -855,7 +855,7 @@ static char **pshader_manual_clear(void)
|
||||
|
||||
static char *pshader_manual_clear_vars[] = {
|
||||
"color_mul",
|
||||
nullptr
|
||||
NULL
|
||||
};
|
||||
|
||||
static char vshader_vsgl_frag0[] =
|
||||
@@ -966,7 +966,7 @@ static char *vshader_vsgl_vars[] = {
|
||||
"texgen_s",
|
||||
"texgen_t",
|
||||
"viewproj",
|
||||
nullptr
|
||||
NULL
|
||||
};
|
||||
|
||||
static char vshader_vsglihud_frag0[] =
|
||||
@@ -1079,6 +1079,6 @@ static char *vshader_vsglihud_vars[] = {
|
||||
"worldview",
|
||||
"material",
|
||||
"textmode",
|
||||
nullptr
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ static RADINLINE void break_on_err(GLint e)
|
||||
static void report_err(GLint e)
|
||||
{
|
||||
break_on_err(e);
|
||||
IggyGDrawSendWarning(nullptr, "OpenGL glGetError error");
|
||||
IggyGDrawSendWarning(NULL, "OpenGL glGetError error");
|
||||
}
|
||||
|
||||
static void compilation_err(const char *msg)
|
||||
@@ -256,7 +256,7 @@ static void make_texture(GLuint tex)
|
||||
static void make_rendertarget(GDrawHandle *t, GLuint tex, GLenum int_type, GLenum ext_type, GLenum data_type, S32 w, S32 h, S32 size)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, int_type, w, h, 0, ext_type, data_type, nullptr);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, int_type, w, h, 0, ext_type, data_type, NULL);
|
||||
make_texture(tex);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
@@ -309,7 +309,7 @@ extern GDrawTexture *gdraw_GLx_(WrappedTextureCreate)(S32 gl_texture_handle, S32
|
||||
p->handle.tex.w = width;
|
||||
p->handle.tex.h = height;
|
||||
p->handle.tex.nonpow2 = !(is_pow2(width) && is_pow2(height));
|
||||
gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned);
|
||||
gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned);
|
||||
return (GDrawTexture *) p;
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ static void RADLINK gdraw_SetTextureUniqueID(GDrawTexture *tex, void *old_id, vo
|
||||
static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format format, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *gstats)
|
||||
{
|
||||
S32 size=0, asize, stride;
|
||||
GDrawHandle *t = nullptr;
|
||||
GDrawHandle *t = NULL;
|
||||
opengl_check();
|
||||
|
||||
stride = width;
|
||||
@@ -369,7 +369,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height,
|
||||
p->texture_data = IggyGDrawMalloc(size);
|
||||
if (!p->texture_data) {
|
||||
gdraw_HandleCacheAllocateFail(t);
|
||||
IggyGDrawSendWarning(nullptr, "GDraw malloc for texture data failed");
|
||||
IggyGDrawSendWarning(NULL, "GDraw malloc for texture data failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -419,9 +419,9 @@ static GDrawTexture * RADLINK gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingI
|
||||
|
||||
if (e != 0) {
|
||||
gdraw_HandleCacheAllocateFail(t);
|
||||
IggyGDrawSendWarning(nullptr, "GDraw OpenGL error creating texture");
|
||||
IggyGDrawSendWarning(NULL, "GDraw OpenGL error creating texture");
|
||||
eat_gl_err();
|
||||
return nullptr;
|
||||
return NULL;
|
||||
} else {
|
||||
gdraw_HandleCacheAllocateEnd(t, p->i4, p->p1, (flags & GDRAW_MAKETEXTURE_FLAGS_never_flush) ? GDRAW_HANDLE_STATE_pinned : GDRAW_HANDLE_STATE_locked);
|
||||
stats->nonzero_flags |= GDRAW_STATS_alloc_tex;
|
||||
@@ -467,8 +467,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *tex, void *unique_id, G
|
||||
static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *gstats)
|
||||
{
|
||||
GDrawHandle *t = (GDrawHandle *) tt;
|
||||
assert(t != nullptr);
|
||||
if (t->owner == unique_id || unique_id == nullptr) {
|
||||
assert(t != NULL);
|
||||
if (t->owner == unique_id || unique_id == NULL) {
|
||||
if (t->cache == &gdraw->rendertargets) {
|
||||
gdraw_HandleCacheUnlock(t);
|
||||
// cache it by simply not freeing it
|
||||
@@ -516,7 +516,7 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat
|
||||
opengl_check();
|
||||
vb = gdraw_res_alloc_begin(gdraw->vbufcache, vbuf_size + ibuf_size, gstats);
|
||||
if (!vb) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw out of vertex buffer memory");
|
||||
IggyGDrawSendWarning(NULL, "GDraw out of vertex buffer memory");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -526,9 +526,9 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat
|
||||
glGenBuffers(1, &vb->handle.vbuf.base);
|
||||
glGenBuffers(1, &vb->handle.vbuf.indices);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vb->handle.vbuf.base);
|
||||
glBufferData(GL_ARRAY_BUFFER, vbuf_size, nullptr, GL_STATIC_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, vbuf_size, NULL, GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vb->handle.vbuf.indices);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, ibuf_size, nullptr, GL_STATIC_DRAW);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, ibuf_size, NULL, GL_STATIC_DRAW);
|
||||
if (!e) e = glGetError();
|
||||
if (e != GL_NO_ERROR) {
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
@@ -537,7 +537,7 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat
|
||||
glDeleteBuffers(1, &vb->handle.vbuf.indices);
|
||||
gdraw_HandleCacheAllocateFail(vb);
|
||||
eat_gl_err();
|
||||
IggyGDrawSendWarning(nullptr, "GDraw OpenGL vertex buffer creation failed");
|
||||
IggyGDrawSendWarning(NULL, "GDraw OpenGL vertex buffer creation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -556,7 +556,7 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat
|
||||
if (!p->vertex_data || !p->index_data) {
|
||||
if (p->vertex_data) IggyGDrawFree(p->vertex_data);
|
||||
if (p->index_data) IggyGDrawFree(p->index_data);
|
||||
IggyGDrawSendWarning(nullptr, "GDraw malloc for vertex buffer temporary memory failed");
|
||||
IggyGDrawSendWarning(NULL, "GDraw malloc for vertex buffer temporary memory failed");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -602,7 +602,7 @@ static GDrawVertexBuffer * RADLINK gdraw_MakeVertexBufferEnd(GDraw_MakeVertexBuf
|
||||
glDeleteBuffers(1, &vb->handle.vbuf.indices);
|
||||
gdraw_HandleCacheAllocateFail(vb);
|
||||
eat_gl_err();
|
||||
return nullptr;
|
||||
return NULL;
|
||||
} else
|
||||
gdraw_HandleCacheAllocateEnd(vb, p->i0 + p->i1, p->p1, GDRAW_HANDLE_STATE_locked);
|
||||
|
||||
@@ -619,7 +619,7 @@ static rrbool RADLINK gdraw_TryToLockVertexBuffer(GDrawVertexBuffer *vb, void *u
|
||||
static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats)
|
||||
{
|
||||
GDrawHandle *h = (GDrawHandle *) vb;
|
||||
assert(h != nullptr);
|
||||
assert(h != NULL);
|
||||
if (h->owner == unique_id)
|
||||
gdraw_res_free(h, stats);
|
||||
}
|
||||
@@ -678,13 +678,13 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *gstats)
|
||||
// ran out of RTs, allocate a new one
|
||||
size = gdraw->frametex_width * gdraw->frametex_height * 4;
|
||||
if (gdraw->rendertargets.bytes_free < size) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw exceeded available rendertarget memory");
|
||||
return nullptr;
|
||||
IggyGDrawSendWarning(NULL, "GDraw exceeded available rendertarget memory");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets);
|
||||
if (!t) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw exceeded available rendertarget handles");
|
||||
IggyGDrawSendWarning(NULL, "GDraw exceeded available rendertarget handles");
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -873,7 +873,7 @@ static void RADLINK gdraw_SetViewSizeAndWorldScale(S32 w, S32 h, F32 scalex, F32
|
||||
|
||||
static void RADLINK gdraw_Set3DTransform(F32 *mat)
|
||||
{
|
||||
if (mat == nullptr)
|
||||
if (mat == NULL)
|
||||
gdraw->use_3d = 0;
|
||||
else {
|
||||
gdraw->use_3d = 1;
|
||||
@@ -992,30 +992,30 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex
|
||||
GDrawHandle *t;
|
||||
int k;
|
||||
if (gdraw->tw == 0 || gdraw->th == 0) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw got a request for an empty rendertarget");
|
||||
IggyGDrawSendWarning(NULL, "GDraw got a request for an empty rendertarget");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw rendertarget nesting exceeded MAX_RENDER_STACK_DEPTH");
|
||||
IggyGDrawSendWarning(NULL, "GDraw rendertarget nesting exceeded MAX_RENDER_STACK_DEPTH");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (owner) {
|
||||
t = get_rendertarget_texture(region->x1 - region->x0, region->y1 - region->y0, owner, gstats);
|
||||
if (!t) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw ran out of rendertargets for cacheAsBItmap");
|
||||
IggyGDrawSendWarning(NULL, "GDraw ran out of rendertargets for cacheAsBItmap");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
t = get_color_rendertarget(gstats);
|
||||
if (!t) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw ran out of rendertargets");
|
||||
IggyGDrawSendWarning(NULL, "GDraw ran out of rendertargets");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
n->color_buffer = t;
|
||||
assert(n->color_buffer != nullptr);
|
||||
assert(n->color_buffer != NULL);
|
||||
|
||||
if (n == gdraw->frame+1)
|
||||
n->stencil_depth = get_depthstencil_renderbuffer(gstats);
|
||||
@@ -1023,7 +1023,7 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex
|
||||
n->stencil_depth = (n-1)->stencil_depth;
|
||||
++gdraw->cur;
|
||||
|
||||
gdraw->cur->cached = owner != nullptr;
|
||||
gdraw->cur->cached = owner != NULL;
|
||||
if (owner) {
|
||||
gdraw->cur->base_x = region->x0;
|
||||
gdraw->cur->base_y = region->y0;
|
||||
@@ -1161,8 +1161,8 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *gstats)
|
||||
assert(m >= gdraw->frame); // bug in Iggy -- unbalanced
|
||||
|
||||
if (m != gdraw->frame)
|
||||
assert(m->color_buffer != nullptr);
|
||||
assert(n->color_buffer != nullptr);
|
||||
assert(m->color_buffer != NULL);
|
||||
assert(n->color_buffer != NULL);
|
||||
|
||||
// remove color and stencil buffers
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 , GL_RENDERBUFFER, 0);
|
||||
@@ -1274,7 +1274,7 @@ static float depth_from_id(S32 id)
|
||||
static void set_texture(U32 texunit, GDrawTexture *tex)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + texunit);
|
||||
if (tex == nullptr)
|
||||
if (tex == NULL)
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
else
|
||||
glBindTexture(GL_TEXTURE_2D, ((GDrawHandle *) tex)->handle.tex.gl);
|
||||
@@ -1575,7 +1575,7 @@ static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimiti
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
if (!set_render_state(r,p->vertex_format, nullptr, p, gstats)) return;
|
||||
if (!set_render_state(r,p->vertex_format, NULL, p, gstats)) return;
|
||||
gstats->nonzero_flags |= GDRAW_STATS_batches;
|
||||
gstats->num_batches += 1;
|
||||
gstats->drawn_indices += p->num_indices;
|
||||
@@ -1593,7 +1593,7 @@ static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimiti
|
||||
while (pos < p->num_vertices) {
|
||||
S32 vert_count = RR_MIN(p->num_vertices - pos, QUAD_IB_COUNT * 4);
|
||||
set_vertex_format(p->vertex_format, p->vertices + pos*stride);
|
||||
glDrawElements(GL_TRIANGLES, (vert_count >> 2) * 6, GL_UNSIGNED_SHORT, nullptr);
|
||||
glDrawElements(GL_TRIANGLES, (vert_count >> 2) * 6, GL_UNSIGNED_SHORT, NULL);
|
||||
pos += vert_count;
|
||||
}
|
||||
|
||||
@@ -1719,7 +1719,7 @@ static void gdraw_DriverBlurPass(GDrawRenderState *r, int taps, F32 *data, gswf_
|
||||
static void gdraw_Colormatrix(GDrawRenderState *r, gswf_recti *s, float *tc, GDrawStats *gstats)
|
||||
{
|
||||
ProgramWithCachedVariableLocations *prg = &gdraw->colormatrix;
|
||||
if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, gstats))
|
||||
if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, gstats))
|
||||
return;
|
||||
use_lazy_shader(prg);
|
||||
set_texture(0, r->tex[0]);
|
||||
@@ -1752,7 +1752,7 @@ static void set_clamp_constant(GLint constant, GDrawTexture *tex)
|
||||
static void gdraw_Filter(GDrawRenderState *r, gswf_recti *s, float *tc, int isbevel, GDrawStats *gstats)
|
||||
{
|
||||
ProgramWithCachedVariableLocations *prg = &gdraw->filter_prog[isbevel][r->filter_mode];
|
||||
if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, gstats))
|
||||
if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, gstats))
|
||||
return;
|
||||
use_lazy_shader(prg);
|
||||
set_texture(0, r->tex[0]);
|
||||
@@ -1845,7 +1845,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1
|
||||
assert(0);
|
||||
}
|
||||
} else {
|
||||
GDrawTexture *blend_tex = nullptr;
|
||||
GDrawTexture *blend_tex = NULL;
|
||||
const int *vvars;
|
||||
|
||||
// for crazy blend modes, we need to read back from the framebuffer
|
||||
@@ -1864,7 +1864,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1
|
||||
set_texture(1, blend_tex);
|
||||
}
|
||||
|
||||
if (!set_render_state(r, GDRAW_vformat_v2tc2, &vvars, nullptr, gstats))
|
||||
if (!set_render_state(r, GDRAW_vformat_v2tc2, &vvars, NULL, gstats))
|
||||
return;
|
||||
do_screen_quad(&s, tc, vvars, gstats, 0);
|
||||
tag_resources(r->tex[0],r->tex[1],0);
|
||||
@@ -1932,7 +1932,7 @@ static void make_fragment_program(ProgramWithCachedVariableLocations *p, int num
|
||||
}
|
||||
|
||||
shad = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
glShaderSource(shad, num_strings, (const GLchar **)strings, nullptr);
|
||||
glShaderSource(shad, num_strings, (const GLchar **)strings, NULL);
|
||||
glCompileShader(shad);
|
||||
glGetShaderiv(shad, GL_COMPILE_STATUS, &res);
|
||||
if (!res) {
|
||||
@@ -1994,7 +1994,7 @@ static void make_vertex_program(GLuint *vprog, int num_strings, char **strings)
|
||||
if(strings[0])
|
||||
{
|
||||
shad = glCreateShader(GL_VERTEX_SHADER);
|
||||
glShaderSource(shad, num_strings, (const GLchar **)strings, nullptr);
|
||||
glShaderSource(shad, num_strings, (const GLchar **)strings, NULL);
|
||||
glCompileShader(shad);
|
||||
glGetShaderiv(shad, GL_COMPILE_STATUS, &res);
|
||||
if (!res) {
|
||||
@@ -2154,7 +2154,7 @@ static void free_gdraw()
|
||||
if (gdraw->texturecache) IggyGDrawFree(gdraw->texturecache);
|
||||
if (gdraw->vbufcache) IggyGDrawFree(gdraw->vbufcache);
|
||||
IggyGDrawFree(gdraw);
|
||||
gdraw = nullptr;
|
||||
gdraw = NULL;
|
||||
}
|
||||
|
||||
int gdraw_GLx_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S32 num_bytes)
|
||||
@@ -2193,7 +2193,7 @@ int gdraw_GLx_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S32
|
||||
IggyGDrawFree(gdraw->texturecache);
|
||||
}
|
||||
gdraw->texturecache = make_handle_cache(GDRAW_GLx_(RESOURCE_texture));
|
||||
return gdraw->texturecache != nullptr;
|
||||
return gdraw->texturecache != NULL;
|
||||
|
||||
case GDRAW_GLx_(RESOURCE_vertexbuffer):
|
||||
if (gdraw->vbufcache) {
|
||||
@@ -2201,7 +2201,7 @@ int gdraw_GLx_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S32
|
||||
IggyGDrawFree(gdraw->vbufcache);
|
||||
}
|
||||
gdraw->vbufcache = make_handle_cache(GDRAW_GLx_(RESOURCE_vertexbuffer));
|
||||
return gdraw->vbufcache != nullptr;
|
||||
return gdraw->vbufcache != NULL;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
@@ -2220,12 +2220,12 @@ GDrawTexture * RADLINK gdraw_GLx_(MakeTextureFromResource)(U8 *resource_file, S3
|
||||
while (fmt->iggyfmt != texture->format && fmt->blkbytes)
|
||||
fmt++;
|
||||
if (!fmt->blkbytes) // end of list - i.e. format not supported
|
||||
return nullptr;
|
||||
return NULL;
|
||||
|
||||
// prepare texture
|
||||
glGenTextures(1, &gl_texture_handle);
|
||||
if (gl_texture_handle == 0)
|
||||
return nullptr;
|
||||
return NULL;
|
||||
|
||||
opengl_check();
|
||||
make_texture(gl_texture_handle);
|
||||
@@ -2283,7 +2283,7 @@ GDrawTexture * RADLINK gdraw_GLx_(MakeTextureFromResource)(U8 *resource_file, S3
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mips-1);
|
||||
|
||||
tex = gdraw_GLx_(WrappedTextureCreate)(gl_texture_handle, texture->w, texture->h, mips > 1);
|
||||
if (tex == nullptr)
|
||||
if (tex == NULL)
|
||||
glDeleteTextures(1, &gl_texture_handle);
|
||||
opengl_check();
|
||||
return tex;
|
||||
@@ -2301,7 +2301,7 @@ static rrbool hasext(const char *exts, const char *which)
|
||||
size_t len;
|
||||
|
||||
#ifdef GDRAW_USE_glGetStringi
|
||||
if (exts == nullptr) {
|
||||
if (exts == NULL) {
|
||||
GLint i, num_exts;
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts);
|
||||
for (i=0; i < num_exts; ++i)
|
||||
@@ -2316,7 +2316,7 @@ static rrbool hasext(const char *exts, const char *which)
|
||||
|
||||
for(;;) {
|
||||
where = strstr(where, which);
|
||||
if (where == nullptr)
|
||||
if (where == NULL)
|
||||
return false;
|
||||
|
||||
if ( (where == exts || *(where - 1) == ' ') // starts with terminator
|
||||
@@ -2329,7 +2329,7 @@ static rrbool hasext(const char *exts, const char *which)
|
||||
static GDrawFunctions *create_context(S32 w, S32 h)
|
||||
{
|
||||
gdraw = IggyGDrawMalloc(sizeof(*gdraw));
|
||||
if (!gdraw) return nullptr;
|
||||
if (!gdraw) return NULL;
|
||||
|
||||
memset(gdraw, 0, sizeof(*gdraw));
|
||||
|
||||
@@ -2339,7 +2339,7 @@ static GDrawFunctions *create_context(S32 w, S32 h)
|
||||
|
||||
if (!gdraw->texturecache || !gdraw->vbufcache || !make_quad_indices()) {
|
||||
free_gdraw();
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
opengl_check();
|
||||
@@ -2380,7 +2380,7 @@ static GDrawFunctions *create_context(S32 w, S32 h)
|
||||
gdraw_funcs.ClearID = gdraw_ClearID;
|
||||
|
||||
gdraw_funcs.MakeTextureBegin = gdraw_MakeTextureBegin;
|
||||
gdraw_funcs.MakeTextureMore = nullptr;
|
||||
gdraw_funcs.MakeTextureMore = NULL;
|
||||
gdraw_funcs.MakeTextureEnd = gdraw_MakeTextureEnd;
|
||||
|
||||
gdraw_funcs.UpdateTextureRect = gdraw_UpdateTextureRect;
|
||||
|
||||
@@ -226,7 +226,7 @@ static void debug_check_raw_values(GDrawHandleCache *c)
|
||||
s = s->next;
|
||||
}
|
||||
s = c->active;
|
||||
while (s != nullptr) {
|
||||
while (s != NULL) {
|
||||
assert(s->raw_ptr != t->raw_ptr);
|
||||
s = s->next;
|
||||
}
|
||||
@@ -368,7 +368,7 @@ static void gdraw_HandleTransitionInsertBefore(GDrawHandle *t, GDrawHandleState
|
||||
{
|
||||
check_lists(t->cache);
|
||||
assert(t->state != GDRAW_HANDLE_STATE_sentinel); // sentinels should never get here!
|
||||
assert(t->state != static_cast<U32>(new_state)); // code should never call "transition" if it's not transitioning!
|
||||
assert(t->state != (U32) new_state); // code should never call "transition" if it's not transitioning!
|
||||
// unlink from prev state
|
||||
t->prev->next = t->next;
|
||||
t->next->prev = t->prev;
|
||||
@@ -433,7 +433,7 @@ static rrbool gdraw_HandleCacheLockStats(GDrawHandle *t, void *owner, GDrawStats
|
||||
|
||||
static rrbool gdraw_HandleCacheLock(GDrawHandle *t, void *owner)
|
||||
{
|
||||
return gdraw_HandleCacheLockStats(t, owner, nullptr);
|
||||
return gdraw_HandleCacheLockStats(t, owner, NULL);
|
||||
}
|
||||
|
||||
static void gdraw_HandleCacheUnlock(GDrawHandle *t)
|
||||
@@ -461,11 +461,11 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte
|
||||
c->is_thrashing = false;
|
||||
c->did_defragment = false;
|
||||
for (i=0; i < GDRAW_HANDLE_STATE__count; i++) {
|
||||
c->state[i].owner = nullptr;
|
||||
c->state[i].cache = nullptr; // should never follow cache link from sentinels!
|
||||
c->state[i].owner = NULL;
|
||||
c->state[i].cache = NULL; // should never follow cache link from sentinels!
|
||||
c->state[i].next = c->state[i].prev = &c->state[i];
|
||||
#ifdef GDRAW_MANAGE_MEM
|
||||
c->state[i].raw_ptr = nullptr;
|
||||
c->state[i].raw_ptr = NULL;
|
||||
#endif
|
||||
c->state[i].fence.value = 0;
|
||||
c->state[i].bytes = 0;
|
||||
@@ -478,7 +478,7 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte
|
||||
c->handle[i].bytes = 0;
|
||||
c->handle[i].state = GDRAW_HANDLE_STATE_free;
|
||||
#ifdef GDRAW_MANAGE_MEM
|
||||
c->handle[i].raw_ptr = nullptr;
|
||||
c->handle[i].raw_ptr = NULL;
|
||||
#endif
|
||||
}
|
||||
c->state[GDRAW_HANDLE_STATE_free].next = &c->handle[0];
|
||||
@@ -486,10 +486,10 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte
|
||||
c->prev_frame_start.value = 0;
|
||||
c->prev_frame_end.value = 0;
|
||||
#ifdef GDRAW_MANAGE_MEM
|
||||
c->alloc = nullptr;
|
||||
c->alloc = NULL;
|
||||
#endif
|
||||
#ifdef GDRAW_MANAGE_MEM_TWOPOOL
|
||||
c->alloc_other = nullptr;
|
||||
c->alloc_other = NULL;
|
||||
#endif
|
||||
check_lists(c);
|
||||
}
|
||||
@@ -497,14 +497,14 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte
|
||||
static GDrawHandle *gdraw_HandleCacheAllocateBegin(GDrawHandleCache *c)
|
||||
{
|
||||
GDrawHandle *free_list = &c->state[GDRAW_HANDLE_STATE_free];
|
||||
GDrawHandle *t = nullptr;
|
||||
GDrawHandle *t = NULL;
|
||||
if (free_list->next != free_list) {
|
||||
t = free_list->next;
|
||||
gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_alloc);
|
||||
t->bytes = 0;
|
||||
t->owner = 0;
|
||||
#ifdef GDRAW_MANAGE_MEM
|
||||
t->raw_ptr = nullptr;
|
||||
t->raw_ptr = NULL;
|
||||
#endif
|
||||
#ifdef GDRAW_CORRUPTION_CHECK
|
||||
t->has_check_value = false;
|
||||
@@ -558,7 +558,7 @@ static GDrawHandle *gdraw_HandleCacheGetLRU(GDrawHandleCache *c)
|
||||
// at the front of the LRU list are the oldest ones, since in-use resources
|
||||
// will get appended on every transition from "locked" to "live".
|
||||
GDrawHandle *sentinel = &c->state[GDRAW_HANDLE_STATE_live];
|
||||
return (sentinel->next != sentinel) ? sentinel->next : nullptr;
|
||||
return (sentinel->next != sentinel) ? sentinel->next : NULL;
|
||||
}
|
||||
|
||||
static void gdraw_HandleCacheTick(GDrawHandleCache *c, GDrawFence now)
|
||||
@@ -773,7 +773,7 @@ static GDrawTexture *gdraw_BlurPass(GDrawFunctions *g, GDrawBlurInfo *c, GDrawRe
|
||||
if (!g->TextureDrawBufferBegin(draw_bounds, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, 0, gstats))
|
||||
return r->tex[0];
|
||||
|
||||
c->BlurPass(r, taps, data, draw_bounds, tc, static_cast<F32>(c->h) / c->frametex_height, clamp, gstats);
|
||||
c->BlurPass(r, taps, data, draw_bounds, tc, (F32) c->h / c->frametex_height, clamp, gstats);
|
||||
return g->TextureDrawBufferEnd(gstats);
|
||||
}
|
||||
|
||||
@@ -825,7 +825,7 @@ static GDrawTexture *gdraw_BlurPassDownsample(GDrawFunctions *g, GDrawBlurInfo *
|
||||
assert(clamp[0] <= clamp[2]);
|
||||
assert(clamp[1] <= clamp[3]);
|
||||
|
||||
c->BlurPass(r, taps, data, &z, tc, static_cast<F32>(c->h) / c->frametex_height, clamp, gstats);
|
||||
c->BlurPass(r, taps, data, &z, tc, (F32) c->h / c->frametex_height, clamp, gstats);
|
||||
return g->TextureDrawBufferEnd(gstats);
|
||||
}
|
||||
|
||||
@@ -837,7 +837,7 @@ static void gdraw_BlurAxis(S32 axis, GDrawFunctions *g, GDrawBlurInfo *c, GDrawR
|
||||
GDrawTexture *t;
|
||||
F32 data[MAX_TAPS][4];
|
||||
S32 off_axis = 1-axis;
|
||||
S32 w = static_cast<S32>(ceil((blur_width - 1) / 2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5
|
||||
S32 w = ((S32) ceil((blur_width-1)/2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5
|
||||
F32 edge_weight = 1 - (w - blur_width)/2; // 3 => 0 => 1; 1.2 => 1.8 => 0.9 => 0.1
|
||||
F32 inverse_weight = 1.0f / blur_width;
|
||||
|
||||
@@ -944,7 +944,7 @@ static void gdraw_BlurAxis(S32 axis, GDrawFunctions *g, GDrawBlurInfo *c, GDrawR
|
||||
// max coverage is 25 samples, or a filter width of 13. with 7 taps, we sample
|
||||
// 13 samples in one pass, max coverage is 13*13 samples or (13*13-1)/2 width,
|
||||
// which is ((2T-1)*(2T-1)-1)/2 or (4T^2 - 4T + 1 -1)/2 or 2T^2 - 2T or 2T*(T-1)
|
||||
S32 w_mip = static_cast<S32>(ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS)));
|
||||
S32 w_mip = (S32) ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS));
|
||||
S32 downsample = w_mip;
|
||||
F32 sample_spacing = texel;
|
||||
if (downsample < 2) downsample = 2;
|
||||
@@ -1090,7 +1090,7 @@ static void make_pool_aligned(void **start, S32 *num_bytes, U32 alignment)
|
||||
if (addr_aligned != addr_orig) {
|
||||
S32 diff = (S32) (addr_aligned - addr_orig);
|
||||
if (*num_bytes < diff) {
|
||||
*start = nullptr;
|
||||
*start = NULL;
|
||||
*num_bytes = 0;
|
||||
return;
|
||||
} else {
|
||||
@@ -1127,7 +1127,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align)
|
||||
UINTa remaining = arena->end - arena->current;
|
||||
UINTa total_size = (ptr - arena->current) + size;
|
||||
if (remaining < total_size) // doesn't fit
|
||||
return nullptr;
|
||||
return NULL;
|
||||
|
||||
arena->current = ptr + size;
|
||||
return ptr;
|
||||
@@ -1152,7 +1152,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align)
|
||||
// (i.e. block->next->prev == block->prev->next == block)
|
||||
// - All allocated blocks are also kept in a hash table, indexed by their
|
||||
// pointer (to allow free to locate the corresponding block_info quickly).
|
||||
// There's a single-linked, nullptr-terminated list of elements in each hash
|
||||
// There's a single-linked, NULL-terminated list of elements in each hash
|
||||
// bucket.
|
||||
// - The physical block list is ordered. It always contains all currently
|
||||
// active blocks and spans the whole managed memory range. There are no
|
||||
@@ -1161,7 +1161,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align)
|
||||
// they are coalesced immediately.
|
||||
// - The maximum number of blocks that could ever be necessary is allocated
|
||||
// on initialization. All block_infos not currently in use are kept in a
|
||||
// single-linked, nullptr-terminated list of unused blocks. Every block is either
|
||||
// single-linked, NULL-terminated list of unused blocks. Every block is either
|
||||
// in the physical block list or the unused list, and the total number of
|
||||
// blocks is constant.
|
||||
// These invariants always hold before and after an allocation/free.
|
||||
@@ -1379,7 +1379,7 @@ static void gfxalloc_check2(gfx_allocator *alloc)
|
||||
|
||||
static gfx_block_info *gfxalloc_pop_unused(gfx_allocator *alloc)
|
||||
{
|
||||
GFXALLOC_ASSERT(alloc->unused_list != nullptr);
|
||||
GFXALLOC_ASSERT(alloc->unused_list != NULL);
|
||||
GFXALLOC_ASSERT(alloc->unused_list->is_unused);
|
||||
GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_unused);)
|
||||
|
||||
@@ -1452,7 +1452,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma
|
||||
U32 i, max_blocks, size;
|
||||
|
||||
if (!align || (align & (align - 1)) != 0) // align must be >0 and a power of 2
|
||||
return nullptr;
|
||||
return NULL;
|
||||
|
||||
// for <= max_allocs live allocs, there's <= 2*max_allocs+1 blocks. worst case:
|
||||
// [free][used][free] .... [free][used][free]
|
||||
@@ -1460,7 +1460,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma
|
||||
size = sizeof(gfx_allocator) + max_blocks * sizeof(gfx_block_info);
|
||||
a = (gfx_allocator *) IggyGDrawMalloc(size);
|
||||
if (!a)
|
||||
return nullptr;
|
||||
return NULL;
|
||||
|
||||
memset(a, 0, size);
|
||||
|
||||
@@ -1501,16 +1501,16 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma
|
||||
a->blocks[i].is_unused = 1;
|
||||
|
||||
gfxalloc_check(a);
|
||||
debug_complete_check(a, nullptr, 0,0);
|
||||
debug_complete_check(a, NULL, 0,0);
|
||||
return a;
|
||||
}
|
||||
|
||||
static void *gfxalloc_alloc(gfx_allocator *alloc, U32 size_in_bytes)
|
||||
{
|
||||
gfx_block_info *cur, *best = nullptr;
|
||||
gfx_block_info *cur, *best = NULL;
|
||||
U32 i, best_wasted = ~0u;
|
||||
U32 size = size_in_bytes;
|
||||
debug_complete_check(alloc, nullptr, 0,0);
|
||||
debug_complete_check(alloc, NULL, 0,0);
|
||||
gfxalloc_check(alloc);
|
||||
GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == alloc->num_alloc + alloc->num_free + alloc->num_unused);)
|
||||
GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks+1);)
|
||||
@@ -1560,7 +1560,7 @@ gfxalloc_check(alloc);
|
||||
debug_check_overlap(alloc->cache, best->ptr, best->size);
|
||||
return best->ptr;
|
||||
} else
|
||||
return nullptr; // not enough space!
|
||||
return NULL; // not enough space!
|
||||
}
|
||||
|
||||
static void gfxalloc_free(gfx_allocator *alloc, void *ptr)
|
||||
@@ -1730,7 +1730,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta
|
||||
// (unused for allocated blocks, we'll use it to store a back-pointer to the corresponding handle)
|
||||
for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b=b->next_phys)
|
||||
if (!b->is_free)
|
||||
b->prev = nullptr;
|
||||
b->prev = NULL;
|
||||
|
||||
// go through all handles and store a pointer to the handle in the corresponding memory block
|
||||
for (i=0; i < c->max_handles; i++)
|
||||
@@ -1743,7 +1743,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta
|
||||
break;
|
||||
}
|
||||
|
||||
GFXALLOC_ASSERT(b != nullptr); // didn't find this block anywhere!
|
||||
GFXALLOC_ASSERT(b != NULL); // didn't find this block anywhere!
|
||||
}
|
||||
|
||||
// clear alloc hash table (we rebuild it during defrag)
|
||||
@@ -1905,7 +1905,7 @@ static rrbool gdraw_CanDefragment(GDrawHandleCache *c)
|
||||
static rrbool gdraw_MigrateResource(GDrawHandle *t, GDrawStats *stats)
|
||||
{
|
||||
GDrawHandleCache *c = t->cache;
|
||||
void *ptr = nullptr;
|
||||
void *ptr = NULL;
|
||||
|
||||
assert(t->state == GDRAW_HANDLE_STATE_live || t->state == GDRAW_HANDLE_STATE_locked || t->state == GDRAW_HANDLE_STATE_pinned);
|
||||
// anything we migrate should be in the "other" (old) pool
|
||||
@@ -2295,7 +2295,7 @@ static void gdraw_bufring_init(gdraw_bufring * RADRESTRICT ring, void *ptr, U32
|
||||
|
||||
static void gdraw_bufring_shutdown(gdraw_bufring * RADRESTRICT ring)
|
||||
{
|
||||
ring->cur = nullptr;
|
||||
ring->cur = NULL;
|
||||
ring->seg_size = 0;
|
||||
}
|
||||
|
||||
@@ -2305,7 +2305,7 @@ static void *gdraw_bufring_alloc(gdraw_bufring * RADRESTRICT ring, U32 size, U32
|
||||
gdraw_bufring_seg *seg;
|
||||
|
||||
if (size > ring->seg_size)
|
||||
return nullptr; // nope, won't fit
|
||||
return NULL; // nope, won't fit
|
||||
|
||||
assert(align <= ring->align);
|
||||
|
||||
@@ -2410,7 +2410,7 @@ static rrbool gdraw_res_free_lru(GDrawHandleCache *c, GDrawStats *stats)
|
||||
// was it referenced since end of previous frame (=in this frame)?
|
||||
// if some, we're thrashing; report it to the user, but only once per frame.
|
||||
if (c->prev_frame_end.value < r->fence.value && !c->is_thrashing) {
|
||||
IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory");
|
||||
IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory");
|
||||
c->is_thrashing = true;
|
||||
}
|
||||
|
||||
@@ -2430,8 +2430,8 @@ static GDrawHandle *gdraw_res_alloc_outofmem(GDrawHandleCache *c, GDrawHandle *t
|
||||
{
|
||||
if (t)
|
||||
gdraw_HandleCacheAllocateFail(t);
|
||||
IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type);
|
||||
return nullptr;
|
||||
IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef GDRAW_MANAGE_MEM
|
||||
@@ -2440,7 +2440,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt
|
||||
{
|
||||
GDrawHandle *t;
|
||||
if (size > c->total_bytes)
|
||||
gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)");
|
||||
gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)");
|
||||
else {
|
||||
// given how much data we're going to allocate, throw out
|
||||
// data until there's "room" (this basically lets us use
|
||||
@@ -2448,7 +2448,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt
|
||||
// packing it and being exact)
|
||||
while (c->bytes_free < size) {
|
||||
if (!gdraw_res_free_lru(c, stats)) {
|
||||
gdraw_res_alloc_outofmem(c, nullptr, "memory");
|
||||
gdraw_res_alloc_outofmem(c, NULL, "memory");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2463,8 +2463,8 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt
|
||||
// we'd trade off cost of regenerating)
|
||||
if (gdraw_res_free_lru(c, stats)) {
|
||||
t = gdraw_HandleCacheAllocateBegin(c);
|
||||
if (t == nullptr) {
|
||||
gdraw_res_alloc_outofmem(c, nullptr, "handles");
|
||||
if (t == NULL) {
|
||||
gdraw_res_alloc_outofmem(c, NULL, "handles");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2508,7 +2508,7 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats)
|
||||
{
|
||||
GDRAW_FENCE_FLUSH(); // dead list is sorted by fence index - make sure all fence values are current.
|
||||
|
||||
r->owner = nullptr;
|
||||
r->owner = NULL;
|
||||
gdraw_HandleCacheInsertDead(r);
|
||||
gdraw_res_reap(r->cache, stats);
|
||||
}
|
||||
@@ -2516,11 +2516,11 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats)
|
||||
static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawStats *stats)
|
||||
{
|
||||
GDrawHandle *t;
|
||||
void *ptr = nullptr;
|
||||
void *ptr = NULL;
|
||||
|
||||
gdraw_res_reap(c, stats); // NB this also does GDRAW_FENCE_FLUSH();
|
||||
if (size > c->total_bytes)
|
||||
return gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)");
|
||||
return gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)");
|
||||
|
||||
// now try to allocate a handle
|
||||
t = gdraw_HandleCacheAllocateBegin(c);
|
||||
@@ -2532,7 +2532,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt
|
||||
gdraw_res_free_lru(c, stats);
|
||||
t = gdraw_HandleCacheAllocateBegin(c);
|
||||
if (!t)
|
||||
return gdraw_res_alloc_outofmem(c, nullptr, "handles");
|
||||
return gdraw_res_alloc_outofmem(c, NULL, "handles");
|
||||
}
|
||||
|
||||
// try to allocate first
|
||||
|
||||
@@ -356,13 +356,13 @@ IDOC typedef struct GDrawPrimitive
|
||||
IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState *r, GDrawPrimitive *prim, GDrawVertexBuffer *buf, GDrawStats *stats);
|
||||
/* Draws a collection of indexed triangles, ignoring special filters or blend modes.
|
||||
|
||||
If buf is nullptr, then the pointers in 'prim' are machine pointers, and
|
||||
If buf is NULL, then the pointers in 'prim' are machine pointers, and
|
||||
you need to make a copy of the data (note currently all triangles
|
||||
implementing strokes (wide lines) go this path).
|
||||
|
||||
If buf is non-nullptr, then use the appropriate vertex buffer, and the
|
||||
If buf is non-NULL, then use the appropriate vertex buffer, and the
|
||||
pointers in prim are actually offsets from the beginning of the
|
||||
vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) nullptr;
|
||||
vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) NULL;
|
||||
(note there are separate spaces for vertices and indices; e.g. the
|
||||
first mesh in a given vertex buffer will normally have a 0 offset
|
||||
for the vertices and a 0 offset for the indices)
|
||||
@@ -455,7 +455,7 @@ IDOC typedef GDrawTexture * RADLINK gdraw_make_texture_end(GDraw_MakeTexture_Pro
|
||||
/* Ends specification of a new texture.
|
||||
|
||||
$:info The same handle initially passed to $gdraw_make_texture_begin
|
||||
$:return Handle for the newly created texture, or nullptr if an error occured
|
||||
$:return Handle for the newly created texture, or NULL if an error occured
|
||||
*/
|
||||
|
||||
IDOC typedef rrbool RADLINK gdraw_update_texture_begin(GDrawTexture *tex, void *unique_id, GDrawStats *stats);
|
||||
|
||||
@@ -25,8 +25,8 @@ IDOC RADEXPFUNC HIGGYEXP RADEXPLINK IggyExpCreate(char *ip_address, S32 port, vo
|
||||
$:storage A small block of storage that needed to store the $HIGGYEXP, must be at least $IGGYEXP_MIN_STORAGE
|
||||
$:storage_size_in_bytes The size of the block pointer to by <tt>storage</tt>
|
||||
|
||||
Returns a nullptr HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer
|
||||
can be contacted at the specified address/port. Otherwise returns a non-nullptr $HIGGYEXP
|
||||
Returns a NULL HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer
|
||||
can be contacted at the specified address/port. Otherwise returns a non-NULL $HIGGYEXP
|
||||
which you can pass to $IggyUseExplorer. */
|
||||
|
||||
IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p);
|
||||
|
||||
@@ -288,7 +288,7 @@ void KeyboardMouseInput::SetMouseGrabbed(bool grabbed)
|
||||
else if (!grabbed && !m_cursorHiddenForUI && g_hWnd)
|
||||
{
|
||||
while (ShowCursor(TRUE) < 0) {}
|
||||
ClipCursor(nullptr);
|
||||
ClipCursor(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ void KeyboardMouseInput::SetCursorHiddenForUI(bool hidden)
|
||||
else if (!hidden && !m_mouseGrabbed && g_hWnd)
|
||||
{
|
||||
while (ShowCursor(TRUE) < 0) {}
|
||||
ClipCursor(nullptr);
|
||||
ClipCursor(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,13 +347,13 @@ void KeyboardMouseInput::SetWindowFocused(bool focused)
|
||||
else
|
||||
{
|
||||
while (ShowCursor(TRUE) < 0) {}
|
||||
ClipCursor(nullptr);
|
||||
ClipCursor(NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (ShowCursor(TRUE) < 0) {}
|
||||
ClipCursor(nullptr);
|
||||
ClipCursor(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ static bool RecvExact(SOCKET sock, BYTE* buf, int len);
|
||||
|
||||
SOCKET WinsockNetLayer::s_listenSocket = INVALID_SOCKET;
|
||||
SOCKET WinsockNetLayer::s_hostConnectionSocket = INVALID_SOCKET;
|
||||
HANDLE WinsockNetLayer::s_acceptThread = nullptr;
|
||||
HANDLE WinsockNetLayer::s_clientRecvThread = nullptr;
|
||||
HANDLE WinsockNetLayer::s_acceptThread = NULL;
|
||||
HANDLE WinsockNetLayer::s_clientRecvThread = NULL;
|
||||
|
||||
bool WinsockNetLayer::s_isHost = false;
|
||||
bool WinsockNetLayer::s_connected = false;
|
||||
@@ -34,14 +34,14 @@ CRITICAL_SECTION WinsockNetLayer::s_connectionsLock;
|
||||
std::vector<Win64RemoteConnection> WinsockNetLayer::s_connections;
|
||||
|
||||
SOCKET WinsockNetLayer::s_advertiseSock = INVALID_SOCKET;
|
||||
HANDLE WinsockNetLayer::s_advertiseThread = nullptr;
|
||||
HANDLE WinsockNetLayer::s_advertiseThread = NULL;
|
||||
volatile bool WinsockNetLayer::s_advertising = false;
|
||||
Win64LANBroadcast WinsockNetLayer::s_advertiseData = {};
|
||||
CRITICAL_SECTION WinsockNetLayer::s_advertiseLock;
|
||||
int WinsockNetLayer::s_hostGamePort = WIN64_NET_DEFAULT_PORT;
|
||||
|
||||
SOCKET WinsockNetLayer::s_discoverySock = INVALID_SOCKET;
|
||||
HANDLE WinsockNetLayer::s_discoveryThread = nullptr;
|
||||
HANDLE WinsockNetLayer::s_discoveryThread = NULL;
|
||||
volatile bool WinsockNetLayer::s_discovering = false;
|
||||
CRITICAL_SECTION WinsockNetLayer::s_discoveryLock;
|
||||
std::vector<Win64LANSession> WinsockNetLayer::s_discoveredSessions;
|
||||
@@ -123,18 +123,18 @@ void WinsockNetLayer::Shutdown()
|
||||
s_connections.clear();
|
||||
LeaveCriticalSection(&s_connectionsLock);
|
||||
|
||||
if (s_acceptThread != nullptr)
|
||||
if (s_acceptThread != NULL)
|
||||
{
|
||||
WaitForSingleObject(s_acceptThread, 2000);
|
||||
CloseHandle(s_acceptThread);
|
||||
s_acceptThread = nullptr;
|
||||
s_acceptThread = NULL;
|
||||
}
|
||||
|
||||
if (s_clientRecvThread != nullptr)
|
||||
if (s_clientRecvThread != NULL)
|
||||
{
|
||||
WaitForSingleObject(s_clientRecvThread, 2000);
|
||||
CloseHandle(s_clientRecvThread);
|
||||
s_clientRecvThread = nullptr;
|
||||
s_clientRecvThread = NULL;
|
||||
}
|
||||
|
||||
if (s_initialized)
|
||||
@@ -172,22 +172,22 @@ bool WinsockNetLayer::HostGame(int port, const char* bindIp)
|
||||
LeaveCriticalSection(&s_smallIdToSocketLock);
|
||||
|
||||
struct addrinfo hints = {};
|
||||
struct addrinfo* result = nullptr;
|
||||
struct addrinfo* result = NULL;
|
||||
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
hints.ai_flags = (bindIp == nullptr || bindIp[0] == 0) ? AI_PASSIVE : 0;
|
||||
hints.ai_flags = (bindIp == NULL || bindIp[0] == 0) ? AI_PASSIVE : 0;
|
||||
|
||||
char portStr[16];
|
||||
sprintf_s(portStr, "%d", port);
|
||||
|
||||
const char* resolvedBindIp = (bindIp != nullptr && bindIp[0] != 0) ? bindIp : nullptr;
|
||||
const char* resolvedBindIp = (bindIp != NULL && bindIp[0] != 0) ? bindIp : NULL;
|
||||
int iResult = getaddrinfo(resolvedBindIp, portStr, &hints, &result);
|
||||
if (iResult != 0)
|
||||
{
|
||||
app.DebugPrintf("getaddrinfo failed for %s:%d - %d\n",
|
||||
resolvedBindIp != nullptr ? resolvedBindIp : "*",
|
||||
resolvedBindIp != NULL ? resolvedBindIp : "*",
|
||||
port,
|
||||
iResult);
|
||||
return false;
|
||||
@@ -204,7 +204,7 @@ bool WinsockNetLayer::HostGame(int port, const char* bindIp)
|
||||
int opt = 1;
|
||||
setsockopt(s_listenSocket, SOL_SOCKET, SO_REUSEADDR, (const char*)&opt, sizeof(opt));
|
||||
|
||||
iResult = ::bind(s_listenSocket, result->ai_addr, static_cast<int>(result->ai_addrlen));
|
||||
iResult = ::bind(s_listenSocket, result->ai_addr, (int)result->ai_addrlen);
|
||||
freeaddrinfo(result);
|
||||
if (iResult == SOCKET_ERROR)
|
||||
{
|
||||
@@ -226,10 +226,10 @@ bool WinsockNetLayer::HostGame(int port, const char* bindIp)
|
||||
s_active = true;
|
||||
s_connected = true;
|
||||
|
||||
s_acceptThread = CreateThread(nullptr, 0, AcceptThreadProc, nullptr, 0, nullptr);
|
||||
s_acceptThread = CreateThread(NULL, 0, AcceptThreadProc, NULL, 0, NULL);
|
||||
|
||||
app.DebugPrintf("Win64 LAN: Hosting on %s:%d\n",
|
||||
resolvedBindIp != nullptr ? resolvedBindIp : "*",
|
||||
resolvedBindIp != NULL ? resolvedBindIp : "*",
|
||||
port);
|
||||
return true;
|
||||
}
|
||||
@@ -250,7 +250,7 @@ bool WinsockNetLayer::JoinGame(const char* ip, int port)
|
||||
}
|
||||
|
||||
struct addrinfo hints = {};
|
||||
struct addrinfo* result = nullptr;
|
||||
struct addrinfo* result = NULL;
|
||||
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
@@ -282,7 +282,7 @@ bool WinsockNetLayer::JoinGame(const char* ip, int port)
|
||||
int noDelay = 1;
|
||||
setsockopt(s_hostConnectionSocket, IPPROTO_TCP, TCP_NODELAY, (const char*)&noDelay, sizeof(noDelay));
|
||||
|
||||
iResult = connect(s_hostConnectionSocket, result->ai_addr, static_cast<int>(result->ai_addrlen));
|
||||
iResult = connect(s_hostConnectionSocket, result->ai_addr, (int)result->ai_addrlen);
|
||||
if (iResult == SOCKET_ERROR)
|
||||
{
|
||||
int err = WSAGetLastError();
|
||||
@@ -342,7 +342,7 @@ bool WinsockNetLayer::JoinGame(const char* ip, int port)
|
||||
s_active = true;
|
||||
s_connected = true;
|
||||
|
||||
s_clientRecvThread = CreateThread(nullptr, 0, ClientRecvThreadProc, nullptr, 0, nullptr);
|
||||
s_clientRecvThread = CreateThread(NULL, 0, ClientRecvThreadProc, NULL, 0, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -354,10 +354,10 @@ bool WinsockNetLayer::SendOnSocket(SOCKET sock, const void* data, int dataSize)
|
||||
EnterCriticalSection(&s_sendLock);
|
||||
|
||||
BYTE header[4];
|
||||
header[0] = static_cast<BYTE>((dataSize >> 24) & 0xFF);
|
||||
header[1] = static_cast<BYTE>((dataSize >> 16) & 0xFF);
|
||||
header[2] = static_cast<BYTE>((dataSize >> 8) & 0xFF);
|
||||
header[3] = static_cast<BYTE>(dataSize & 0xFF);
|
||||
header[0] = (BYTE)((dataSize >> 24) & 0xFF);
|
||||
header[1] = (BYTE)((dataSize >> 16) & 0xFF);
|
||||
header[2] = (BYTE)((dataSize >> 8) & 0xFF);
|
||||
header[3] = (BYTE)(dataSize & 0xFF);
|
||||
|
||||
int totalSent = 0;
|
||||
int toSend = 4;
|
||||
@@ -375,7 +375,7 @@ bool WinsockNetLayer::SendOnSocket(SOCKET sock, const void* data, int dataSize)
|
||||
totalSent = 0;
|
||||
while (totalSent < dataSize)
|
||||
{
|
||||
int sent = send(sock, static_cast<const char *>(data) + totalSent, dataSize - totalSent, 0);
|
||||
int sent = send(sock, (const char*)data + totalSent, dataSize - totalSent, 0);
|
||||
if (sent == SOCKET_ERROR || sent == 0)
|
||||
{
|
||||
LeaveCriticalSection(&s_sendLock);
|
||||
@@ -450,18 +450,18 @@ void WinsockNetLayer::HandleDataReceived(BYTE fromSmallId, BYTE toSmallId, unsig
|
||||
INetworkPlayer* pPlayerFrom = g_NetworkManager.GetPlayerBySmallId(fromSmallId);
|
||||
INetworkPlayer* pPlayerTo = g_NetworkManager.GetPlayerBySmallId(toSmallId);
|
||||
|
||||
if (pPlayerFrom == nullptr || pPlayerTo == nullptr) return;
|
||||
if (pPlayerFrom == NULL || pPlayerTo == NULL) return;
|
||||
|
||||
if (s_isHost)
|
||||
{
|
||||
::Socket* pSocket = pPlayerFrom->GetSocket();
|
||||
if (pSocket != nullptr)
|
||||
if (pSocket != NULL)
|
||||
pSocket->pushDataToQueue(data, dataSize, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
::Socket* pSocket = pPlayerTo->GetSocket();
|
||||
if (pSocket != nullptr)
|
||||
if (pSocket != NULL)
|
||||
pSocket->pushDataToQueue(data, dataSize, true);
|
||||
}
|
||||
}
|
||||
@@ -470,7 +470,7 @@ DWORD WINAPI WinsockNetLayer::AcceptThreadProc(LPVOID param)
|
||||
{
|
||||
while (s_active)
|
||||
{
|
||||
SOCKET clientSocket = accept(s_listenSocket, nullptr, nullptr);
|
||||
SOCKET clientSocket = accept(s_listenSocket, NULL, NULL);
|
||||
if (clientSocket == INVALID_SOCKET)
|
||||
{
|
||||
if (s_active)
|
||||
@@ -532,11 +532,11 @@ DWORD WINAPI WinsockNetLayer::AcceptThreadProc(LPVOID param)
|
||||
conn.tcpSocket = clientSocket;
|
||||
conn.smallId = assignedSmallId;
|
||||
conn.active = true;
|
||||
conn.recvThread = nullptr;
|
||||
conn.recvThread = NULL;
|
||||
|
||||
EnterCriticalSection(&s_connectionsLock);
|
||||
s_connections.push_back(conn);
|
||||
int connIdx = static_cast<int>(s_connections.size()) - 1;
|
||||
int connIdx = (int)s_connections.size() - 1;
|
||||
LeaveCriticalSection(&s_connectionsLock);
|
||||
|
||||
app.DebugPrintf("Win64 LAN: Client connected, assigned smallId=%d\n", assignedSmallId);
|
||||
@@ -555,10 +555,10 @@ DWORD WINAPI WinsockNetLayer::AcceptThreadProc(LPVOID param)
|
||||
|
||||
DWORD* threadParam = new DWORD;
|
||||
*threadParam = connIdx;
|
||||
HANDLE hThread = CreateThread(nullptr, 0, RecvThreadProc, threadParam, 0, nullptr);
|
||||
HANDLE hThread = CreateThread(NULL, 0, RecvThreadProc, threadParam, 0, NULL);
|
||||
|
||||
EnterCriticalSection(&s_connectionsLock);
|
||||
if (connIdx < static_cast<int>(s_connections.size()))
|
||||
if (connIdx < (int)s_connections.size())
|
||||
s_connections[connIdx].recvThread = hThread;
|
||||
LeaveCriticalSection(&s_connectionsLock);
|
||||
}
|
||||
@@ -567,11 +567,11 @@ DWORD WINAPI WinsockNetLayer::AcceptThreadProc(LPVOID param)
|
||||
|
||||
DWORD WINAPI WinsockNetLayer::RecvThreadProc(LPVOID param)
|
||||
{
|
||||
DWORD connIdx = *static_cast<DWORD *>(param);
|
||||
delete static_cast<DWORD *>(param);
|
||||
DWORD connIdx = *(DWORD*)param;
|
||||
delete (DWORD*)param;
|
||||
|
||||
EnterCriticalSection(&s_connectionsLock);
|
||||
if (connIdx >= static_cast<DWORD>(s_connections.size()))
|
||||
if (connIdx >= (DWORD)s_connections.size())
|
||||
{
|
||||
LeaveCriticalSection(&s_connectionsLock);
|
||||
return 0;
|
||||
@@ -593,10 +593,10 @@ DWORD WINAPI WinsockNetLayer::RecvThreadProc(LPVOID param)
|
||||
}
|
||||
|
||||
int packetSize =
|
||||
(static_cast<uint32_t>(header[0]) << 24) |
|
||||
(static_cast<uint32_t>(header[1]) << 16) |
|
||||
(static_cast<uint32_t>(header[2]) << 8) |
|
||||
static_cast<uint32_t>(header[3]);
|
||||
((uint32_t)header[0] << 24) |
|
||||
((uint32_t)header[1] << 16) |
|
||||
((uint32_t)header[2] << 8) |
|
||||
((uint32_t)header[3]);
|
||||
|
||||
if (packetSize <= 0 || packetSize > WIN64_NET_MAX_PACKET_SIZE)
|
||||
{
|
||||
@@ -607,7 +607,7 @@ DWORD WINAPI WinsockNetLayer::RecvThreadProc(LPVOID param)
|
||||
break;
|
||||
}
|
||||
|
||||
if (static_cast<int>(recvBuf.size()) < packetSize)
|
||||
if ((int)recvBuf.size() < packetSize)
|
||||
{
|
||||
recvBuf.resize(packetSize);
|
||||
app.DebugPrintf("Win64 LAN: Resized host recv buffer to %d bytes for client smallId=%d\n", packetSize, clientSmallId);
|
||||
@@ -706,7 +706,7 @@ DWORD WINAPI WinsockNetLayer::ClientRecvThreadProc(LPVOID param)
|
||||
break;
|
||||
}
|
||||
|
||||
if (static_cast<int>(recvBuf.size()) < packetSize)
|
||||
if ((int)recvBuf.size() < packetSize)
|
||||
{
|
||||
recvBuf.resize(packetSize);
|
||||
app.DebugPrintf("Win64 LAN: Resized client recv buffer to %d bytes\n", packetSize);
|
||||
@@ -734,7 +734,7 @@ bool WinsockNetLayer::StartAdvertising(int gamePort, const wchar_t* hostName, un
|
||||
memset(&s_advertiseData, 0, sizeof(s_advertiseData));
|
||||
s_advertiseData.magic = WIN64_LAN_BROADCAST_MAGIC;
|
||||
s_advertiseData.netVersion = netVer;
|
||||
s_advertiseData.gamePort = static_cast<WORD>(gamePort);
|
||||
s_advertiseData.gamePort = (WORD)gamePort;
|
||||
wcsncpy_s(s_advertiseData.hostName, 32, hostName, _TRUNCATE);
|
||||
s_advertiseData.playerCount = 1;
|
||||
s_advertiseData.maxPlayers = MINECRAFT_NET_MAX_PLAYERS;
|
||||
@@ -756,7 +756,7 @@ bool WinsockNetLayer::StartAdvertising(int gamePort, const wchar_t* hostName, un
|
||||
setsockopt(s_advertiseSock, SOL_SOCKET, SO_BROADCAST, (const char*)&broadcast, sizeof(broadcast));
|
||||
|
||||
s_advertising = true;
|
||||
s_advertiseThread = CreateThread(nullptr, 0, AdvertiseThreadProc, nullptr, 0, nullptr);
|
||||
s_advertiseThread = CreateThread(NULL, 0, AdvertiseThreadProc, NULL, 0, NULL);
|
||||
|
||||
app.DebugPrintf("Win64 LAN: Started advertising on UDP port %d\n", WIN64_LAN_DISCOVERY_PORT);
|
||||
return true;
|
||||
@@ -772,11 +772,11 @@ void WinsockNetLayer::StopAdvertising()
|
||||
s_advertiseSock = INVALID_SOCKET;
|
||||
}
|
||||
|
||||
if (s_advertiseThread != nullptr)
|
||||
if (s_advertiseThread != NULL)
|
||||
{
|
||||
WaitForSingleObject(s_advertiseThread, 2000);
|
||||
CloseHandle(s_advertiseThread);
|
||||
s_advertiseThread = nullptr;
|
||||
s_advertiseThread = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -862,7 +862,7 @@ bool WinsockNetLayer::StartDiscovery()
|
||||
setsockopt(s_discoverySock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeout, sizeof(timeout));
|
||||
|
||||
s_discovering = true;
|
||||
s_discoveryThread = CreateThread(nullptr, 0, DiscoveryThreadProc, nullptr, 0, nullptr);
|
||||
s_discoveryThread = CreateThread(NULL, 0, DiscoveryThreadProc, NULL, 0, NULL);
|
||||
|
||||
app.DebugPrintf("Win64 LAN: Listening for LAN games on UDP port %d\n", WIN64_LAN_DISCOVERY_PORT);
|
||||
return true;
|
||||
@@ -878,11 +878,11 @@ void WinsockNetLayer::StopDiscovery()
|
||||
s_discoverySock = INVALID_SOCKET;
|
||||
}
|
||||
|
||||
if (s_discoveryThread != nullptr)
|
||||
if (s_discoveryThread != NULL)
|
||||
{
|
||||
WaitForSingleObject(s_discoveryThread, 2000);
|
||||
CloseHandle(s_discoveryThread);
|
||||
s_discoveryThread = nullptr;
|
||||
s_discoveryThread = NULL;
|
||||
}
|
||||
|
||||
EnterCriticalSection(&s_discoveryLock);
|
||||
@@ -916,7 +916,7 @@ DWORD WINAPI WinsockNetLayer::DiscoveryThreadProc(LPVOID param)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (recvLen < static_cast<int>(sizeof(Win64LANBroadcast)))
|
||||
if (recvLen < (int)sizeof(Win64LANBroadcast))
|
||||
continue;
|
||||
|
||||
Win64LANBroadcast* broadcast = (Win64LANBroadcast*)recvBuf;
|
||||
@@ -934,7 +934,7 @@ DWORD WINAPI WinsockNetLayer::DiscoveryThreadProc(LPVOID param)
|
||||
for (size_t i = 0; i < s_discoveredSessions.size(); i++)
|
||||
{
|
||||
if (strcmp(s_discoveredSessions[i].hostIP, senderIP) == 0 &&
|
||||
s_discoveredSessions[i].hostPort == static_cast<int>(broadcast->gamePort))
|
||||
s_discoveredSessions[i].hostPort == (int)broadcast->gamePort)
|
||||
{
|
||||
s_discoveredSessions[i].netVersion = broadcast->netVersion;
|
||||
wcsncpy_s(s_discoveredSessions[i].hostName, 32, broadcast->hostName, _TRUNCATE);
|
||||
@@ -955,7 +955,7 @@ DWORD WINAPI WinsockNetLayer::DiscoveryThreadProc(LPVOID param)
|
||||
Win64LANSession session;
|
||||
memset(&session, 0, sizeof(session));
|
||||
strncpy_s(session.hostIP, sizeof(session.hostIP), senderIP, _TRUNCATE);
|
||||
session.hostPort = static_cast<int>(broadcast->gamePort);
|
||||
session.hostPort = (int)broadcast->gamePort;
|
||||
session.netVersion = broadcast->netVersion;
|
||||
wcsncpy_s(session.hostName, 32, broadcast->hostName, _TRUNCATE);
|
||||
session.playerCount = broadcast->playerCount;
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
static bool Initialize();
|
||||
static void Shutdown();
|
||||
|
||||
static bool HostGame(int port, const char* bindIp = nullptr);
|
||||
static bool HostGame(int port, const char* bindIp = NULL);
|
||||
static bool JoinGame(const char* ip, int port);
|
||||
|
||||
static bool SendToSmallId(BYTE targetSmallId, const void* data, int dataSize);
|
||||
|
||||
@@ -52,8 +52,8 @@ void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *pbData,DWORD *pdwSize)
|
||||
}
|
||||
else
|
||||
{
|
||||
// No capture happened (e.g. first save on world creation) leave thumbnail as nullptr
|
||||
if (pbData) *pbData = nullptr;
|
||||
// No capture happened (e.g. first save on world creation) leave thumbnail as NULL
|
||||
if (pbData) *pbData = NULL;
|
||||
if (pdwSize) *pdwSize = 0;
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart()
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit
|
||||
|
||||
app.setLevelGenerationOptions(nullptr);
|
||||
app.setLevelGenerationOptions(NULL);
|
||||
|
||||
// From CScene_Main::RunPlayGame
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
@@ -99,7 +99,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart()
|
||||
|
||||
NetworkGameInitData *param = new NetworkGameInitData();
|
||||
param->seed = seedValue;
|
||||
param->saveData = nullptr;
|
||||
param->saveData = NULL;
|
||||
|
||||
app.SetGameHostOption(eGameHostOption_Difficulty,0);
|
||||
app.SetGameHostOption(eGameHostOption_FriendsOfFriends,0);
|
||||
@@ -125,7 +125,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart()
|
||||
|
||||
LoadingInputParams *loadingParams = new LoadingInputParams();
|
||||
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
|
||||
loadingParams->lpParam = static_cast<LPVOID>(param);
|
||||
loadingParams->lpParam = (LPVOID)param;
|
||||
|
||||
// Reset the autosave time
|
||||
app.SetAutosaveTimerTime();
|
||||
|
||||
@@ -25,9 +25,9 @@ public:
|
||||
virtual int GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameIncludesExtension,eFileExtensionType eEXT=eFileExtensionType_PNG);
|
||||
|
||||
// BANNED LEVEL LIST
|
||||
virtual void ReadBannedList(int iPad, eTMSAction action=static_cast<eTMSAction>(0), bool bCallback=false) {}
|
||||
virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false) {}
|
||||
|
||||
C4JStringTable *GetStringTable() { return nullptr;}
|
||||
C4JStringTable *GetStringTable() { return NULL;}
|
||||
|
||||
// original code
|
||||
virtual void TemporaryCreateGameStart();
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
#include "..\GameRenderer.h"
|
||||
#include "Network\WinsockNetLayer.h"
|
||||
#include "Windows64_Xuid.h"
|
||||
#include "Common/UI/UI.h"
|
||||
|
||||
#include "Xbox/resource.h"
|
||||
|
||||
@@ -83,6 +82,7 @@ DWORD dwProfileSettingsA[NUM_PROFILE_VALUES]=
|
||||
0,0,0,0,0
|
||||
#endif
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Time Since fAppTime is a float, we need to keep the quadword app time
|
||||
// as a LARGE_INTEGER so that we don't lose precision after running
|
||||
@@ -124,17 +124,17 @@ static void CopyWideArgToAnsi(LPCWSTR source, char* dest, size_t destSize)
|
||||
return;
|
||||
|
||||
dest[0] = 0;
|
||||
if (source == nullptr)
|
||||
if (source == NULL)
|
||||
return;
|
||||
|
||||
WideCharToMultiByte(CP_ACP, 0, source, -1, dest, static_cast<int>(destSize), nullptr, nullptr);
|
||||
WideCharToMultiByte(CP_ACP, 0, source, -1, dest, (int)destSize, NULL, NULL);
|
||||
dest[destSize - 1] = 0;
|
||||
}
|
||||
|
||||
// ---------- Persistent options (options.txt next to exe) ----------
|
||||
static void GetOptionsFilePath(char *out, size_t outSize)
|
||||
{
|
||||
GetModuleFileNameA(nullptr, out, static_cast<DWORD>(outSize));
|
||||
GetModuleFileNameA(NULL, out, (DWORD)outSize);
|
||||
char *p = strrchr(out, '\\');
|
||||
if (p) *(p + 1) = '\0';
|
||||
strncat_s(out, outSize, "options.txt", _TRUNCATE);
|
||||
@@ -210,7 +210,7 @@ static Win64LaunchOptions ParseLaunchOptions()
|
||||
|
||||
int argc = 0;
|
||||
LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||
if (argv == nullptr)
|
||||
if (argv == NULL)
|
||||
return options;
|
||||
|
||||
if (argc > 1 && lstrlenW(argv[1]) == 1)
|
||||
@@ -252,14 +252,14 @@ static Win64LaunchOptions ParseLaunchOptions()
|
||||
}
|
||||
else if (_wcsicmp(argv[i], L"-port") == 0 && (i + 1) < argc)
|
||||
{
|
||||
wchar_t* endPtr = nullptr;
|
||||
const long port = wcstol(argv[++i], &endPtr, 10);
|
||||
wchar_t* endPtr = NULL;
|
||||
long port = wcstol(argv[++i], &endPtr, 10);
|
||||
if (endPtr != argv[i] && *endPtr == 0 && port > 0 && port <= 65535)
|
||||
{
|
||||
if (options.serverMode)
|
||||
g_Win64DedicatedServerPort = static_cast<int>(port);
|
||||
g_Win64DedicatedServerPort = (int)port;
|
||||
else
|
||||
g_Win64MultiplayerPort = static_cast<int>(port);
|
||||
g_Win64MultiplayerPort = (int)port;
|
||||
}
|
||||
}
|
||||
else if (_wcsicmp(argv[i], L"-fullscreen") == 0)
|
||||
@@ -290,7 +290,7 @@ static void SetupHeadlessServerConsole()
|
||||
{
|
||||
if (AllocConsole())
|
||||
{
|
||||
FILE* stream = nullptr;
|
||||
FILE* stream = NULL;
|
||||
freopen_s(&stream, "CONIN$", "r", stdin);
|
||||
freopen_s(&stream, "CONOUT$", "w", stdout);
|
||||
freopen_s(&stream, "CONOUT$", "w", stderr);
|
||||
@@ -491,7 +491,7 @@ HRESULT InitD3D( IDirect3DDevice9 **ppDevice,
|
||||
return pD3D->CreateDevice(
|
||||
0,
|
||||
D3DDEVTYPE_HAL,
|
||||
nullptr,
|
||||
NULL,
|
||||
D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_BUFFER_2_FRAMES,
|
||||
pd3dPP,
|
||||
ppDevice );
|
||||
@@ -509,16 +509,16 @@ void MemSect(int sect)
|
||||
}
|
||||
#endif
|
||||
|
||||
HINSTANCE g_hInst = nullptr;
|
||||
HWND g_hWnd = nullptr;
|
||||
HINSTANCE g_hInst = NULL;
|
||||
HWND g_hWnd = NULL;
|
||||
D3D_DRIVER_TYPE g_driverType = D3D_DRIVER_TYPE_NULL;
|
||||
D3D_FEATURE_LEVEL g_featureLevel = D3D_FEATURE_LEVEL_11_0;
|
||||
ID3D11Device* g_pd3dDevice = nullptr;
|
||||
ID3D11DeviceContext* g_pImmediateContext = nullptr;
|
||||
IDXGISwapChain* g_pSwapChain = nullptr;
|
||||
ID3D11RenderTargetView* g_pRenderTargetView = nullptr;
|
||||
ID3D11DepthStencilView* g_pDepthStencilView = nullptr;
|
||||
ID3D11Texture2D* g_pDepthStencilBuffer = nullptr;
|
||||
ID3D11Device* g_pd3dDevice = NULL;
|
||||
ID3D11DeviceContext* g_pImmediateContext = NULL;
|
||||
IDXGISwapChain* g_pSwapChain = NULL;
|
||||
ID3D11RenderTargetView* g_pRenderTargetView = NULL;
|
||||
ID3D11DepthStencilView* g_pDepthStencilView = NULL;
|
||||
ID3D11Texture2D* g_pDepthStencilBuffer = NULL;
|
||||
|
||||
//
|
||||
// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
|
||||
@@ -586,7 +586,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if ((lParam & 0x40000000) && vk != VK_LEFT && vk != VK_RIGHT && vk != VK_BACK)
|
||||
break;
|
||||
#ifdef _WINDOWS64
|
||||
const Minecraft* pm = Minecraft::GetInstance();
|
||||
Minecraft* pm = Minecraft::GetInstance();
|
||||
ChatScreen* chat = pm && pm->screen ? dynamic_cast<ChatScreen*>(pm->screen) : nullptr;
|
||||
if (chat)
|
||||
{
|
||||
@@ -653,13 +653,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case WM_INPUT:
|
||||
{
|
||||
UINT dwSize = 0;
|
||||
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, nullptr, &dwSize, sizeof(RAWINPUTHEADER));
|
||||
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER));
|
||||
if (dwSize > 0 && dwSize <= 256)
|
||||
{
|
||||
BYTE rawBuffer[256];
|
||||
if (GetRawInputData((HRAWINPUT)lParam, RID_INPUT, rawBuffer, &dwSize, sizeof(RAWINPUTHEADER)) == dwSize)
|
||||
{
|
||||
const RAWINPUT* raw = (RAWINPUT*)rawBuffer;
|
||||
RAWINPUT* raw = (RAWINPUT*)rawBuffer;
|
||||
if (raw->header.dwType == RIM_TYPEMOUSE)
|
||||
{
|
||||
g_KBMInput.OnRawMouseDelta(raw->data.mouse.lLastX, raw->data.mouse.lLastY);
|
||||
@@ -696,7 +696,7 @@ ATOM MyRegisterClass(HINSTANCE hInstance)
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = LoadIcon(hInstance, "Minecraft");
|
||||
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
|
||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wcex.lpszMenuName = "Minecraft";
|
||||
wcex.lpszClassName = "MinecraftClass";
|
||||
@@ -729,10 +729,10 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||
0,
|
||||
wr.right - wr.left, // width of the window
|
||||
wr.bottom - wr.top, // height of the window
|
||||
nullptr,
|
||||
nullptr,
|
||||
NULL,
|
||||
NULL,
|
||||
hInstance,
|
||||
nullptr);
|
||||
NULL);
|
||||
|
||||
if (!g_hWnd)
|
||||
{
|
||||
@@ -847,7 +847,7 @@ HRESULT InitDevice()
|
||||
for( UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++ )
|
||||
{
|
||||
g_driverType = driverTypes[driverTypeIndex];
|
||||
hr = D3D11CreateDeviceAndSwapChain( nullptr, g_driverType, nullptr, createDeviceFlags, featureLevels, numFeatureLevels,
|
||||
hr = D3D11CreateDeviceAndSwapChain( NULL, g_driverType, NULL, createDeviceFlags, featureLevels, numFeatureLevels,
|
||||
D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &g_featureLevel, &g_pImmediateContext );
|
||||
if( HRESULT_SUCCEEDED( hr ) )
|
||||
break;
|
||||
@@ -856,7 +856,7 @@ HRESULT InitDevice()
|
||||
return hr;
|
||||
|
||||
// Create a render target view
|
||||
ID3D11Texture2D* pBackBuffer = nullptr;
|
||||
ID3D11Texture2D* pBackBuffer = NULL;
|
||||
hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), ( LPVOID* )&pBackBuffer );
|
||||
if( FAILED( hr ) )
|
||||
return hr;
|
||||
@@ -876,7 +876,7 @@ HRESULT InitDevice()
|
||||
descDepth.BindFlags = D3D11_BIND_DEPTH_STENCIL;
|
||||
descDepth.CPUAccessFlags = 0;
|
||||
descDepth.MiscFlags = 0;
|
||||
hr = g_pd3dDevice->CreateTexture2D(&descDepth, nullptr, &g_pDepthStencilBuffer);
|
||||
hr = g_pd3dDevice->CreateTexture2D(&descDepth, NULL, &g_pDepthStencilBuffer);
|
||||
|
||||
D3D11_DEPTH_STENCIL_VIEW_DESC descDSView;
|
||||
ZeroMemory(&descDSView, sizeof(descDSView));
|
||||
@@ -886,7 +886,7 @@ HRESULT InitDevice()
|
||||
|
||||
hr = g_pd3dDevice->CreateDepthStencilView(g_pDepthStencilBuffer, &descDSView, &g_pDepthStencilView);
|
||||
|
||||
hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, nullptr, &g_pRenderTargetView );
|
||||
hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, NULL, &g_pRenderTargetView );
|
||||
pBackBuffer->Release();
|
||||
if( FAILED( hr ) )
|
||||
return hr;
|
||||
@@ -895,8 +895,8 @@ HRESULT InitDevice()
|
||||
|
||||
// Setup the viewport
|
||||
D3D11_VIEWPORT vp;
|
||||
vp.Width = static_cast<FLOAT>(width);
|
||||
vp.Height = static_cast<FLOAT>(height);
|
||||
vp.Width = (FLOAT)width;
|
||||
vp.Height = (FLOAT)height;
|
||||
vp.MinDepth = 0.0f;
|
||||
vp.MaxDepth = 1.0f;
|
||||
vp.TopLeftX = 0;
|
||||
@@ -916,7 +916,7 @@ HRESULT InitDevice()
|
||||
void Render()
|
||||
{
|
||||
// Just clear the backbuffer
|
||||
const float ClearColor[4] = { 0.0f, 0.125f, 0.3f, 1.0f }; //red,green,blue,alpha
|
||||
float ClearColor[4] = { 0.0f, 0.125f, 0.3f, 1.0f }; //red,green,blue,alpha
|
||||
|
||||
g_pImmediateContext->ClearRenderTargetView( g_pRenderTargetView, ClearColor );
|
||||
g_pSwapChain->Present( 0, 0 );
|
||||
@@ -927,7 +927,7 @@ void Render()
|
||||
//--------------------------------------------------------------------------------------
|
||||
void ToggleFullscreen()
|
||||
{
|
||||
const DWORD dwStyle = GetWindowLong(g_hWnd, GWL_STYLE);
|
||||
DWORD dwStyle = GetWindowLong(g_hWnd, GWL_STYLE);
|
||||
if (!g_isFullscreen)
|
||||
{
|
||||
MONITORINFO mi = { sizeof(mi) };
|
||||
@@ -946,7 +946,7 @@ void ToggleFullscreen()
|
||||
{
|
||||
SetWindowLong(g_hWnd, GWL_STYLE, dwStyle | WS_OVERLAPPEDWINDOW);
|
||||
SetWindowPlacement(g_hWnd, &g_wpPrev);
|
||||
SetWindowPos(g_hWnd, nullptr, 0, 0, 0, 0,
|
||||
SetWindowPos(g_hWnd, NULL, 0, 0, 0, 0,
|
||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
|
||||
}
|
||||
g_isFullscreen = !g_isFullscreen;
|
||||
@@ -999,7 +999,7 @@ static Minecraft* InitialiseMinecraftRuntime()
|
||||
|
||||
for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++)
|
||||
{
|
||||
IQNet::m_player[i].m_smallId = static_cast<BYTE>(i);
|
||||
IQNet::m_player[i].m_smallId = (BYTE)i;
|
||||
IQNet::m_player[i].m_isRemote = false;
|
||||
IQNet::m_player[i].m_isHostPlayer = (i == 0);
|
||||
swprintf_s(IQNet::m_player[i].m_gamertag, 32, L"Player%d", i);
|
||||
@@ -1021,8 +1021,8 @@ static Minecraft* InitialiseMinecraftRuntime()
|
||||
|
||||
Minecraft::main();
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (pMinecraft == nullptr)
|
||||
return nullptr;
|
||||
if (pMinecraft == NULL)
|
||||
return NULL;
|
||||
|
||||
app.InitGameSettings();
|
||||
app.InitialiseTips();
|
||||
@@ -1054,7 +1054,7 @@ static int HeadlessServerConsoleThreadProc(void* lpParameter)
|
||||
continue;
|
||||
|
||||
MinecraftServer* server = MinecraftServer::getInstance();
|
||||
if (server != nullptr)
|
||||
if (server != NULL)
|
||||
{
|
||||
server->handleConsoleInput(command, server);
|
||||
}
|
||||
@@ -1068,7 +1068,7 @@ static int RunHeadlessServer()
|
||||
SetupHeadlessServerConsole();
|
||||
|
||||
Settings serverSettings(new File(L"server.properties"));
|
||||
const wstring configuredBindIp = serverSettings.getString(L"server-ip", L"");
|
||||
wstring configuredBindIp = serverSettings.getString(L"server-ip", L"");
|
||||
|
||||
const char* bindIp = "*";
|
||||
if (g_Win64DedicatedServerBindIP[0] != 0)
|
||||
@@ -1085,8 +1085,8 @@ static int RunHeadlessServer()
|
||||
printf("Starting headless server on %s:%d\n", bindIp, port);
|
||||
fflush(stdout);
|
||||
|
||||
const Minecraft* pMinecraft = InitialiseMinecraftRuntime();
|
||||
if (pMinecraft == nullptr)
|
||||
Minecraft* pMinecraft = InitialiseMinecraftRuntime();
|
||||
if (pMinecraft == NULL)
|
||||
{
|
||||
fprintf(stderr, "Failed to initialise the Minecraft runtime.\n");
|
||||
return 1;
|
||||
@@ -1152,13 +1152,13 @@ static int RunHeadlessServer()
|
||||
printf("Type 'help' for server commands.\n");
|
||||
fflush(stdout);
|
||||
|
||||
C4JThread* consoleThread = new C4JThread(&HeadlessServerConsoleThreadProc, nullptr, "Server console", 128 * 1024);
|
||||
C4JThread* consoleThread = new C4JThread(&HeadlessServerConsoleThreadProc, NULL, "Server console", 128 * 1024);
|
||||
consoleThread->Run();
|
||||
|
||||
MSG msg = { 0 };
|
||||
while (WM_QUIT != msg.message && !app.m_bShutdown && !MinecraftServer::serverHalted())
|
||||
{
|
||||
if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
|
||||
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
@@ -1196,7 +1196,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
// 4J-Win64: set CWD to exe dir so asset paths resolve correctly
|
||||
{
|
||||
char szExeDir[MAX_PATH] = {};
|
||||
GetModuleFileNameA(nullptr, szExeDir, MAX_PATH);
|
||||
GetModuleFileNameA(NULL, szExeDir, MAX_PATH);
|
||||
char *pSlash = strrchr(szExeDir, '\\');
|
||||
if (pSlash) { *(pSlash + 1) = '\0'; SetCurrentDirectoryA(szExeDir); }
|
||||
}
|
||||
@@ -1208,7 +1208,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
|
||||
// Load username from username.txt
|
||||
char exePath[MAX_PATH] = {};
|
||||
GetModuleFileNameA(nullptr, exePath, MAX_PATH);
|
||||
GetModuleFileNameA(NULL, exePath, MAX_PATH);
|
||||
char *lastSlash = strrchr(exePath, '\\');
|
||||
if (lastSlash)
|
||||
{
|
||||
@@ -1224,7 +1224,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
char buf[128] = {};
|
||||
if (fgets(buf, sizeof(buf), f))
|
||||
{
|
||||
int len = static_cast<int>(strlen(buf));
|
||||
int len = (int)strlen(buf);
|
||||
while (len > 0 && (buf[len - 1] == '\n' || buf[len - 1] == '\r' || buf[len - 1] == ' '))
|
||||
{
|
||||
buf[--len] = '\0';
|
||||
@@ -1239,7 +1239,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
}
|
||||
|
||||
// Load stuff from launch options, including username
|
||||
const Win64LaunchOptions launchOptions = ParseLaunchOptions();
|
||||
Win64LaunchOptions launchOptions = ParseLaunchOptions();
|
||||
ApplyScreenMode(launchOptions.screenMode);
|
||||
|
||||
// Ensure uid.dat exists from startup in client mode (before any multiplayer/login path).
|
||||
@@ -1282,7 +1282,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
|
||||
if (launchOptions.serverMode)
|
||||
{
|
||||
const int serverResult = RunHeadlessServer();
|
||||
int serverResult = RunHeadlessServer();
|
||||
CleanupDevice();
|
||||
return serverResult;
|
||||
}
|
||||
@@ -1292,7 +1292,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
MSG msg = {0};
|
||||
while( WM_QUIT != msg.message )
|
||||
{
|
||||
if( PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE ) )
|
||||
if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
|
||||
{
|
||||
TranslateMessage( &msg );
|
||||
DispatchMessage( &msg );
|
||||
@@ -1340,7 +1340,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
|
||||
#endif
|
||||
Minecraft *pMinecraft = InitialiseMinecraftRuntime();
|
||||
if (pMinecraft == nullptr)
|
||||
if (pMinecraft == NULL)
|
||||
{
|
||||
CleanupDevice();
|
||||
return 1;
|
||||
@@ -1376,7 +1376,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
{
|
||||
g_KBMInput.Tick();
|
||||
|
||||
while( PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE ) )
|
||||
while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
|
||||
{
|
||||
TranslateMessage( &msg );
|
||||
DispatchMessage( &msg );
|
||||
@@ -1409,7 +1409,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
// Detect KBM vs controller input mode
|
||||
if (InputManager.IsPadConnected(0))
|
||||
{
|
||||
const bool controllerUsed = InputManager.ButtonPressed(0) ||
|
||||
bool controllerUsed = InputManager.ButtonPressed(0) ||
|
||||
InputManager.GetJoypadStick_LX(0, false) != 0.0f ||
|
||||
InputManager.GetJoypadStick_LY(0, false) != 0.0f ||
|
||||
InputManager.GetJoypadStick_RX(0, false) != 0.0f ||
|
||||
@@ -1471,7 +1471,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
else
|
||||
{
|
||||
MemSect(28);
|
||||
pMinecraft->soundEngine->tick(nullptr, 0.0f);
|
||||
pMinecraft->soundEngine->tick(NULL, 0.0f);
|
||||
MemSect(0);
|
||||
pMinecraft->textures->tick(true,false);
|
||||
IntCache::Reset();
|
||||
@@ -1568,7 +1568,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
// Update mouse grab: grab when in-game and no menu is open
|
||||
{
|
||||
static bool altToggleSuppressCapture = false;
|
||||
const bool shouldCapture = app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == nullptr;
|
||||
bool shouldCapture = app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL;
|
||||
// Left Alt key toggles capture on/off for debugging
|
||||
if (g_KBMInput.IsKeyPressed(VK_LMENU) || g_KBMInput.IsKeyPressed(VK_RMENU))
|
||||
{
|
||||
@@ -1589,8 +1589,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
// F1 toggles the HUD
|
||||
if (g_KBMInput.IsKeyPressed(VK_F1))
|
||||
{
|
||||
const int primaryPad = ProfileManager.GetPrimaryPad();
|
||||
const unsigned char displayHud = app.GetGameSettings(primaryPad, eGameSetting_DisplayHUD);
|
||||
int primaryPad = ProfileManager.GetPrimaryPad();
|
||||
unsigned char displayHud = app.GetGameSettings(primaryPad, eGameSetting_DisplayHUD);
|
||||
app.SetGameSettings(primaryPad, eGameSetting_DisplayHUD, displayHud ? 0 : 1);
|
||||
app.SetGameSettings(primaryPad, eGameSetting_DisplayHand, displayHud ? 0 : 1);
|
||||
}
|
||||
@@ -1598,7 +1598,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
// F3 toggles onscreen debug info
|
||||
if (g_KBMInput.IsKeyPressed(VK_F3))
|
||||
{
|
||||
if (const Minecraft* pMinecraft = Minecraft::GetInstance())
|
||||
if (Minecraft* pMinecraft = Minecraft::GetInstance())
|
||||
{
|
||||
if (pMinecraft->options)
|
||||
{
|
||||
|
||||
@@ -82,7 +82,7 @@ void ConsoleUIController::render()
|
||||
example, no resolve targets are required. */
|
||||
gdraw_D3D11_SetTileOrigin( m_pRenderTargetView,
|
||||
m_pDepthStencilView,
|
||||
nullptr,
|
||||
NULL,
|
||||
0,
|
||||
0 );
|
||||
|
||||
@@ -147,7 +147,7 @@ void ConsoleUIController::setTileOrigin(S32 xPos, S32 yPos)
|
||||
{
|
||||
gdraw_D3D11_SetTileOrigin( m_pRenderTargetView,
|
||||
m_pDepthStencilView,
|
||||
nullptr,
|
||||
NULL,
|
||||
xPos,
|
||||
yPos );
|
||||
}
|
||||
@@ -163,7 +163,7 @@ GDrawTexture *ConsoleUIController::getSubstitutionTexture(int textureId)
|
||||
ID3D11ShaderResourceView *tex = RenderManager.TextureGetTexture(textureId);
|
||||
ID3D11Resource *resource;
|
||||
tex->GetResource(&resource);
|
||||
ID3D11Texture2D *tex2d = static_cast<ID3D11Texture2D *>(resource);
|
||||
ID3D11Texture2D *tex2d = (ID3D11Texture2D *)resource;
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
tex2d->GetDesc(&desc);
|
||||
GDrawTexture *gdrawTex = gdraw_D3D11_WrappedTextureCreate(tex);
|
||||
|
||||
@@ -26,3 +26,5 @@ public:
|
||||
public:
|
||||
void shutdown();
|
||||
};
|
||||
|
||||
extern ConsoleUIController ui;
|
||||
@@ -138,7 +138,7 @@ private:
|
||||
DWORD m_dwCharsTotal;
|
||||
DWORD m_dwCharsConsumed;
|
||||
|
||||
BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing nullptr
|
||||
BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing NULL
|
||||
WCHAR m_pWriteBuf[ XML_WRITE_BUFFER_SIZE ];
|
||||
|
||||
BYTE* m_pReadPtr;
|
||||
|
||||
Reference in New Issue
Block a user