diff --git a/.gitignore b/.gitignore index 1f0cd120e6..5e6b96b51c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,37 +1,46 @@ +# For MSVC +*.lastcodeanalysissucceeded *.pdb *.ilk *.obj *.pch -Logs *.log *.dll *.rar *.exe -*.ini *.map *.lib *.user *.sdf *.ncb -Debug -DebugFast -Release *.opensdf *.suo *.aps +*.exp +Debug +DebugFast +Release +Windows/x64 +Windows/ipch + +# For ppsspp.ini, etc. +*.ini + +Logs +Memstick + bin gen libs obj -*.exp +build*/ + .pspsh.hist -GameLogNotes.txt -Windows/x64 -Windows/ipch -Memstick -android/ui_atlas.zim __testoutput.txt __testerror.txt +__testfinish.txt +GameLogNotes.txt + +android/ui_atlas.zim ppge_atlas.zim.png local.properties -build*/ diff --git a/Common/ConsoleListener.cpp b/Common/ConsoleListener.cpp index 04729985d0..e590d46c15 100644 --- a/Common/ConsoleListener.cpp +++ b/Common/ConsoleListener.cpp @@ -318,9 +318,7 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text) Text += 10; } SetConsoleTextAttribute(hConsole, Color); - size_t len = strlen(Text); - if (Text[len-1] == '\n' && Text[len-1] == '\r') - len--; + size_t len = strlen(Text); WriteConsole(hConsole, Text, (DWORD)len, &cCharsWritten, NULL); #else char ColorAttr[16] = ""; diff --git a/Common/MemArena.cpp b/Common/MemArena.cpp index 22acf02f73..35b5dee794 100644 --- a/Common/MemArena.cpp +++ b/Common/MemArena.cpp @@ -283,7 +283,7 @@ static bool Memory_TryBase(u8 *base, const MemoryView *views, int num_views, u32 int i; for (i = 0; i < num_views; i++) { - const MemoryView &view = views[i]; + const MemoryView &view = views[i]; SKIP(flags, view.flags); if (view.flags & MV_MIRROR_PREVIOUS) { position = last_position; diff --git a/Core/Debugger/Breakpoints.cpp b/Core/Debugger/Breakpoints.cpp index f682b96727..c426dfb7d7 100644 --- a/Core/Debugger/Breakpoints.cpp +++ b/Core/Debugger/Breakpoints.cpp @@ -40,7 +40,7 @@ void MemCheck::Action(u32 iValue, u32 addr, bool write, int size, u32 pc) if (bLog) { char temp[256]; - printf(temp,"CHK %08x %s%i at %08x (%s), PC=%08x (%s)",iValue,write?"Write":"Read",size*8,addr,symbolMap.GetDescription(addr),pc,symbolMap.GetDescription(pc)); + sprintf(temp,"CHK %08x %s%i at %08x (%s), PC=%08x (%s)",iValue,write?"Write":"Read",size*8,addr,symbolMap.GetDescription(addr),pc,symbolMap.GetDescription(pc)); ERROR_LOG(MEMMAP,"%s",temp); } if (bBreak) diff --git a/Core/Debugger/SymbolMap.cpp b/Core/Debugger/SymbolMap.cpp index b4f454b32f..c2481ec71d 100644 --- a/Core/Debugger/SymbolMap.cpp +++ b/Core/Debugger/SymbolMap.cpp @@ -144,10 +144,9 @@ bool SymbolMap::LoadSymbolMap(const char *filename) { char line[512],temp[256]; fgets(line,511,f); - if (strlen(line)<4) + if (strlen(line) < 4 || sscanf(line, "%s", temp) != 1) continue; - sscanf(line,"%s",temp); if (strcmp(temp,"UNUSED")==0) continue; if (strcmp(temp,".text")==0) {started=true;continue;}; if (strcmp(temp,".init")==0) {started=true;continue;}; @@ -233,7 +232,7 @@ int SymbolMap::GetSymbolNum(unsigned int address, SymbolType symmask) } -char temp[256]; +char descriptionTemp[256]; char *SymbolMap::GetDescription(unsigned int address) { @@ -244,8 +243,8 @@ char *SymbolMap::GetDescription(unsigned int address) return entries[fun].name; else { - sprintf(temp, "(%08x)", address); - return temp; + sprintf(descriptionTemp, "(%08x)", address); + return descriptionTemp; } //} //else @@ -438,11 +437,12 @@ void SymbolMap::UseFuncSignaturesFile(const char *filename, u32 maxAddress) //#1: Read the signature file and put them in a fast data structure FILE *f = fopen(filename, "r"); int count; - fscanf(f,"%08x\n",&count); - u32 inst,size,hash; + if (fscanf(f, "%08x\n", &count) != 1) + count = 0; char name[256]; for (int a=0; asecond.hFile, (LPVOID)pointer, (DWORD)size, (LPDWORD)&bytesRead, 0); #else - bytesRead = fread(pointer, 1, size, iter->second.hFile); + bytesRead = fread(pointer, 1, size, iter->second.hFile); #endif return bytesRead; } diff --git a/Core/FileSystems/ISOFileSystem.cpp b/Core/FileSystems/ISOFileSystem.cpp index 2964d8e684..a7e7bf01f6 100644 --- a/Core/FileSystems/ISOFileSystem.cpp +++ b/Core/FileSystems/ISOFileSystem.cpp @@ -16,7 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Globals.h" -#include "Log.h" +#include "Common.h" #include "ISOFileSystem.h" #include #include @@ -29,11 +29,13 @@ static bool parseLBN(std::string filename, u32 *sectorStart, u32 *readSize) { if (filename.substr(0, 8) != "/sce_lbn") return false; - std::string yo = filename; + std::string prev = filename; filename.erase(0, 10); - sscanf(filename.c_str(), "%08x", sectorStart); + if (sscanf(filename.c_str(), "%08x", sectorStart) != 1) + WARN_LOG(FILESYS, "Invalid LBN reference: %s", prev.c_str()); filename.erase(0, filename.find("_size") + 7); - sscanf(filename.c_str(), "%08x", readSize); + if (sscanf(filename.c_str(), "%08x", readSize) != 1) + WARN_LOG(FILESYS, "Incomplete LBN reference: %s", prev.c_str()); return true; } @@ -393,6 +395,8 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size) } else { + _dbg_assert_msg_(HLE, e.file != 0, "Expecting non-raw fd to have a tree entry."); + //clamp read length if ((s64)e.seekPos > e.file->size - (s64)size) { diff --git a/Core/HLE/HLE.cpp b/Core/HLE/HLE.cpp index 2126ce2024..2290737f36 100644 --- a/Core/HLE/HLE.cpp +++ b/Core/HLE/HLE.cpp @@ -211,7 +211,7 @@ void hleCheckCurrentCallbacks() void hleReSchedule(const char *reason) { _dbg_assert_msg_(HLE, reason != 0, "hleReSchedule: Expecting a valid reason."); - _dbg_assert_msg_(HLE, strlen(reason) < 256, "hleReSchedule: Not too long reason."); + _dbg_assert_msg_(HLE, reason != 0 && strlen(reason) < 256, "hleReSchedule: Not too long reason."); hleAfterSyscall |= HLE_AFTER_RESCHED; diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index dba162c325..1a36d9130a 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -298,8 +298,13 @@ u32 sceDisplaySetFramebuf() if (sync == PSP_DISPLAY_SETBUF_IMMEDIATE) { // Write immediately to the current framebuffer parameters - framebuf = fbstate; - gpu->SetDisplayFramebuffer(framebuf.topaddr, framebuf.pspFramebufLinesize, framebuf.pspFramebufFormat); + if (topaddr != 0) + { + framebuf = fbstate; + gpu->SetDisplayFramebuffer(framebuf.topaddr, framebuf.pspFramebufLinesize, framebuf.pspFramebufFormat); + } + else + WARN_LOG(HLE, "%s: PSP_DISPLAY_SETBUF_IMMEDIATE without topaddr?", __FUNCTION__); } else if (topaddr != 0) { diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index 664a6699d5..d2caefb3ad 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -235,32 +235,32 @@ int sceFontGetFontInfo(u32 fontHandle, u32 fontInfoPtr) memset (&fi, 0, sizeof(fi)); if (Memory::IsValidAddress(fontInfoPtr)) { - fi.BPP =4; + fi.BPP = 4; fi.charMapLength = 255; // fi.fontStyle =1; fi.maxGlyphAdvanceXF = 2.0; - fi.maxGlyphAdvanceXI =2; + fi.maxGlyphAdvanceXI = 2; fi.maxGlyphAdvanceYF = 2.0; fi.maxGlyphAdvanceYI = 32 << 6; - fi.maxGlyphAscenderF =32 << 6; + fi.maxGlyphAscenderF = 32 << 6; fi.maxGlyphAscenderI = 32 << 6; - fi.maxGlyphBaseYF= 0.0; - fi.maxGlyphBaseYI=0.0; - fi.maxGlyphDescenderF =0; - fi.maxGlyphDescenderI =0; + fi.maxGlyphBaseYF = 0.0; + fi.maxGlyphBaseYI = 0; + fi.maxGlyphDescenderF = 0; + fi.maxGlyphDescenderI = 0; fi.maxGlyphHeight = 32; - fi.maxGlyphHeightF= 32; + fi.maxGlyphHeightF = 32; fi.maxGlyphHeightI = 32; - fi.maxGlyphLeftXF= 0; + fi.maxGlyphLeftXF = 0; fi.maxGlyphLeftXI = 0; - fi.maxGlyphTopYF =0; + fi.maxGlyphTopYF = 0; fi.maxGlyphTopYI = 0; - fi.maxGlyphWidth =32; + fi.maxGlyphWidth = 32; fi.maxGlyphWidthF = 32; - fi.maxGlyphWidthI= 32; + fi.maxGlyphWidthI = 32; fi.minGlyphCenterXF = 16; - fi.minGlyphCenterXI= 16; - fi.shadowMapLength=0; + fi.minGlyphCenterXI = 16; + fi.shadowMapLength = 0; Memory::WriteStruct(fontInfoPtr, &fi); } diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index c485ecc999..941d3a63ef 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -192,7 +192,6 @@ void __IoInit() { } void __IoShutdown() { - } u32 sceIoAssign(const char *aliasname, const char *physname, const char *devname, u32 flag) { diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index e9ea4db1e8..adcc652b84 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -270,12 +270,12 @@ void KernelObjectPool::List() if (pool[i]) { pool[i]->GetQuickInfo(buffer,256); + INFO_LOG(HLE, "KO %i: %s \"%s\": %s", i + handleOffset, pool[i]->GetTypeName(), pool[i]->GetName(), buffer); } else { strcpy(buffer,"WTF? Zero Pointer"); } - INFO_LOG(HLE, "KO %i: %s \"%s\": %s", i + handleOffset, pool[i]->GetTypeName(), pool[i]->GetName(), buffer); } } } diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 3624d5f523..4303eca9e2 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -448,13 +448,13 @@ bool __KernelLoadPBP(const char *filename, std::string *error_string) in.seekg(offsets[5]); //in.read((char*)&id,4); { - u8 *temp = new u8[1024*1024*8]; - in.read((char*)temp, 1024*1024*8); - Module *module = __KernelLoadELFFromPtr(temp, PSP_GetDefaultLoadAddress(), error_string); + u8 *elftemp = new u8[1024*1024*8]; + in.read((char*)elftemp, 1024*1024*8); + Module *module = __KernelLoadELFFromPtr(elftemp, PSP_GetDefaultLoadAddress(), error_string); if (!module) return false; mipsr4k.pc = module->nm.entry_addr; - delete [] temp; + delete [] elftemp; } in.close(); return true; @@ -612,7 +612,7 @@ u32 sceKernelLoadModule(const char *name, u32 flags) // TODO: Use position to decide whether to load high or low if (PARAM(2)) { - SceKernelLMOption *lmoption = (SceKernelLMOption *)Memory::GetPointer(PARAM(2)); + lmoption = (SceKernelLMOption *)Memory::GetPointer(PARAM(2)); } diff --git a/Core/HLE/sceKernelMsgPipe.cpp b/Core/HLE/sceKernelMsgPipe.cpp index ca8fa76a73..1521d5f188 100644 --- a/Core/HLE/sceKernelMsgPipe.cpp +++ b/Core/HLE/sceKernelMsgPipe.cpp @@ -98,7 +98,7 @@ struct MsgPipe : public KernelObject if (sendWaitingThreads.empty()) return; MsgPipeWaitingThread *thread = &sendWaitingThreads.front(); - if (nmp.freeSize >= thread->bufSize) + if ((u32) nmp.freeSize >= thread->bufSize) { // Put all the data to the buffer memcpy(buffer + (nmp.bufSize - nmp.freeSize), Memory::GetPointer(thread->bufAddr), thread->bufSize); @@ -126,7 +126,7 @@ struct MsgPipe : public KernelObject if (receiveWaitingThreads.empty()) return; MsgPipeWaitingThread *thread = &receiveWaitingThreads.front(); - if (nmp.bufSize - nmp.freeSize >= thread->bufSize) + if ((u32) nmp.bufSize - (u32) nmp.freeSize >= thread->bufSize) { // Get the needed data from the buffer Memory::Memcpy(thread->bufAddr, buffer, thread->bufSize); @@ -271,7 +271,7 @@ void __KernelSendMsgPipe(MsgPipe *m, u32 sendBufAddr, u32 sendSize, int waitMode } else { - if (sendSize <= m->nmp.freeSize) + if (sendSize <= (u32) m->nmp.freeSize) { memcpy(m->buffer + (m->nmp.bufSize - m->nmp.freeSize), Memory::GetPointer(sendBufAddr), sendSize); m->nmp.freeSize -= sendSize; @@ -445,7 +445,7 @@ void __KernelReceiveMsgPipe(MsgPipe *m, u32 receiveBufAddr, u32 receiveSize, int else { // Enough data in the buffer: copy just the needed amount of data - if (receiveSize <= m->nmp.bufSize - m->nmp.freeSize) + if (receiveSize <= (u32) m->nmp.bufSize - (u32) m->nmp.freeSize) { Memory::Memcpy(receiveBufAddr, m->buffer, receiveSize); m->nmp.freeSize += receiveSize; diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 446fe4a871..113868f9eb 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -845,7 +845,7 @@ void __KernelReSchedule(bool doCallbacks, const char *reason) thread->isProcessingCallbacks = doCallbacks; } __KernelReSchedule(reason); - if (doCallbacks && thread == currentThread) { + if (doCallbacks && thread != NULL && thread == currentThread) { if (thread->isRunning()) { thread->isProcessingCallbacks = false; } @@ -1833,8 +1833,12 @@ void __KernelCallAddress(Thread *thread, u32 entryPoint, Action *afterAction, bo } if (!called) { - DEBUG_LOG(HLE, "Making mipscall pending on thread"); - thread->pendingMipsCalls.push_back(callId); + if (thread) { + DEBUG_LOG(HLE, "Making mipscall pending on thread"); + thread->pendingMipsCalls.push_back(callId); + } else { + WARN_LOG(HLE, "Ignoring mispcall on NULL/deleted thread"); + } } } diff --git a/Core/HLE/sceRtc.cpp b/Core/HLE/sceRtc.cpp index 40df086d01..33f28ecb58 100644 --- a/Core/HLE/sceRtc.cpp +++ b/Core/HLE/sceRtc.cpp @@ -459,7 +459,7 @@ int sceRtcGetTime_t(u32 datePtr, u32 timePtr) ScePspDateTime pt; Memory::ReadStruct(datePtr, &pt); pt.year-=1969; - u64 result = __RtcPspTimeToTicks(pt)/1000000ULL; + u32 result = (u32) (__RtcPspTimeToTicks(pt)/1000000ULL); Memory::Write_U32(result, timePtr); } else diff --git a/Core/HW/SasAudio.cpp b/Core/HW/SasAudio.cpp index b4ad23d2ef..d8025e7196 100644 --- a/Core/HW/SasAudio.cpp +++ b/Core/HW/SasAudio.cpp @@ -215,7 +215,7 @@ void SasInstance::Mix(u32 outAddr) { // Figure out number of samples to read. int curSample = voice.samplePos / PSP_SAS_PITCH_BASE; int lastSample = (voice.samplePos + grainSize * voice.pitch) / PSP_SAS_PITCH_BASE; - u32 numSamples = lastSample - curSample; + int numSamples = lastSample - curSample; if (numSamples > grainSize * 4) { ERROR_LOG(SAS, "numSamples too large, clamping: %i vs %i", numSamples, grainSize * 4); numSamples = grainSize * 4; diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index a97b168d8b..b05f70ed8d 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -301,13 +301,13 @@ namespace MIPSAnalyst { if (addr >= furthestBranch) { - u32 target = GetSureBranchTarget(addr); - if (target != INVALIDTARGET && target < addr) + u32 sureTarget = GetSureBranchTarget(addr); + if (sureTarget != INVALIDTARGET && sureTarget < addr) { end = true; } - target = GetJumpTarget(addr); - if (target != INVALIDTARGET && target < addr && ((op&0xFC000000)==0x08000000)) + sureTarget = GetJumpTarget(addr); + if (sureTarget != INVALIDTARGET && sureTarget < addr && ((op&0xFC000000)==0x08000000)) { end = true; } diff --git a/Core/MIPS/MIPSIntVFPU.cpp b/Core/MIPS/MIPSIntVFPU.cpp index eddba0a942..f24dd2cc4e 100644 --- a/Core/MIPS/MIPSIntVFPU.cpp +++ b/Core/MIPS/MIPSIntVFPU.cpp @@ -1495,10 +1495,8 @@ namespace MIPSInt ApplySwizzleT(t, sz); int n = GetNumVectorElements(sz); for (int i = 0; i < n ; i++) { - int a=s[i] - t[i]; - if (a > 0) d[i]=1; - else if (a < 0) d[i]=-1; - else d[i]=0; + float a = s[i] - t[i]; + d[i] = (float) ((0.0 < a) - (a < 0.0)); } ApplyPrefixD(d, sz); WriteVector(d, sz, vd); diff --git a/GPU/GLES/DisplayListInterpreter.cpp b/GPU/GLES/DisplayListInterpreter.cpp index c7317112b9..c0688db195 100644 --- a/GPU/GLES/DisplayListInterpreter.cpp +++ b/GPU/GLES/DisplayListInterpreter.cpp @@ -587,7 +587,7 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) case GE_CMD_CALL: { u32 retval = dcontext.pc + 4; - if (stackptr == ARRAY_SIZE(stack)) { + if (stackptr == ARRAY_SIZE(stack) - 1) { ERROR_LOG(G3D, "CALL: Stack full!"); } else { stack[stackptr++] = retval; diff --git a/GPU/GLES/VertexDecoder.cpp b/GPU/GLES/VertexDecoder.cpp index 34bef88276..3a3ffe650c 100644 --- a/GPU/GLES/VertexDecoder.cpp +++ b/GPU/GLES/VertexDecoder.cpp @@ -234,7 +234,7 @@ void VertexDecoder::Step_Color5551Morph() const col[0] += w * (cdata & 0x1f) / 31.f; col[1] += w * ((cdata>>5) & 0x1f) / 31.f; col[2] += w * ((cdata>>10) & 0x1f) / 31.f; - col[3] += w * (cdata>>15) ? 1.0f : 0.0f; + col[3] += w * ((cdata>>15) ? 1.0f : 0.0f); } u8 *c = decoded_ + decFmt.c0off; for (int i = 0; i < 4; i++) { diff --git a/Windows/EmuThread.cpp b/Windows/EmuThread.cpp index 4815a26296..f6795df085 100644 --- a/Windows/EmuThread.cpp +++ b/Windows/EmuThread.cpp @@ -29,7 +29,8 @@ DWORD TheThread(LPVOID x); void EmuThread_Start(const char *filename) { // _dbg_clear_(); - _tcscpy(fileToStart, filename); + _tcsncpy(fileToStart, filename, sizeof(fileToStart) - 1); + fileToStart[sizeof(fileToStart) - 1] = 0; unsigned int i; emuThread = (HANDLE)_beginthreadex(0,0,(unsigned int (__stdcall *)(void *))TheThread,(LPVOID)0,0,&i); diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index ec3868b027..7e20d7c1cf 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -37,7 +37,7 @@ #endif BOOL g_bFullScreen = FALSE; -RECT rc = {0}; +RECT g_normalRC = {0}; namespace MainWindow { @@ -114,13 +114,13 @@ namespace MainWindow void SetZoom(float zoom) { if (zoom < 5) - g_Config.iWindowZoom = zoom; + g_Config.iWindowZoom = (int) zoom; RECT rc, rcOuter; - GetWindowRectAtZoom(zoom, rc, rcOuter); + GetWindowRectAtZoom((int) zoom, rc, rcOuter); MoveWindow(hwndMain, rcOuter.left, rcOuter.top, rcOuter.right - rcOuter.left, rcOuter.bottom - rcOuter.top, TRUE); MoveWindow(hwndDisplay, 0, 0, rc.right - rc.left, rc.bottom - rc.top, TRUE); - PSP_CoreParameter().pixelWidth = 480 * zoom; - PSP_CoreParameter().pixelHeight = 272 * zoom; + PSP_CoreParameter().pixelWidth = (int) (480 * zoom); + PSP_CoreParameter().pixelHeight = (int) (272 * zoom); GL_Resized(); } @@ -705,51 +705,50 @@ namespace MainWindow } void _ViewNormal(HWND hWnd) { - // put caption and border styles back - DWORD dwOldStyle = ::GetWindowLong(hWnd, GWL_STYLE); - DWORD dwNewStyle = dwOldStyle | WS_CAPTION | WS_THICKFRAME; - ::SetWindowLong(hWnd, GWL_STYLE, dwNewStyle); + // put caption and border styles back + DWORD dwOldStyle = ::GetWindowLong(hWnd, GWL_STYLE); + DWORD dwNewStyle = dwOldStyle | WS_CAPTION | WS_THICKFRAME; + ::SetWindowLong(hWnd, GWL_STYLE, dwNewStyle); - // put back the menu bar - ::SetMenu(hWnd, menu); + // put back the menu bar + ::SetMenu(hWnd, menu); - // resize to normal view - // NOTE: use SWP_FRAMECHANGED to force redraw non-client - const int x = rc.left; - const int y = rc.top; - const int cx = rc.right - rc.left; - const int cy = rc.bottom - rc.top; - ::SetWindowPos(hWnd, HWND_NOTOPMOST, x, y, cx, cy, SWP_FRAMECHANGED); + // resize to normal view + // NOTE: use SWP_FRAMECHANGED to force redraw non-client + const int x = g_normalRC.left; + const int y = g_normalRC.top; + const int cx = g_normalRC.right - g_normalRC.left; + const int cy = g_normalRC.bottom - g_normalRC.top; + ::SetWindowPos(hWnd, HWND_NOTOPMOST, x, y, cx, cy, SWP_FRAMECHANGED); - // reset full screen indicator - g_bFullScreen = FALSE; + // reset full screen indicator + g_bFullScreen = FALSE; } -void _ViewFullScreen(HWND hWnd) -{ - // keep in mind normal window rectangle - ::GetWindowRect(hWnd, &rc); + void _ViewFullScreen(HWND hWnd) + { + // keep in mind normal window rectangle + ::GetWindowRect(hWnd, &g_normalRC); - // remove caption and border styles - DWORD dwOldStyle = ::GetWindowLong(hWnd, GWL_STYLE); - DWORD dwNewStyle = dwOldStyle & ~(WS_CAPTION | WS_THICKFRAME); - ::SetWindowLong(hWnd, GWL_STYLE, dwNewStyle); + // remove caption and border styles + DWORD dwOldStyle = ::GetWindowLong(hWnd, GWL_STYLE); + DWORD dwNewStyle = dwOldStyle & ~(WS_CAPTION | WS_THICKFRAME); + ::SetWindowLong(hWnd, GWL_STYLE, dwNewStyle); - // remove the menu bar - ::SetMenu(hWnd, NULL); + // remove the menu bar + ::SetMenu(hWnd, NULL); - // resize to full screen view - // NOTE: use SWP_FRAMECHANGED to force redraw non-client - const int x = 0; - const int y = 0; - const int cx = ::GetSystemMetrics(SM_CXSCREEN); - const int cy = ::GetSystemMetrics(SM_CYSCREEN); - ::SetWindowPos(hWnd, HWND_TOPMOST, x, y, cx, cy, SWP_FRAMECHANGED); - - // set full screen indicator - g_bFullScreen = TRUE; -} + // resize to full screen view + // NOTE: use SWP_FRAMECHANGED to force redraw non-client + const int x = 0; + const int y = 0; + const int cx = ::GetSystemMetrics(SM_CXSCREEN); + const int cy = ::GetSystemMetrics(SM_CYSCREEN); + ::SetWindowPos(hWnd, HWND_TOPMOST, x, y, cx, cy, SWP_FRAMECHANGED); + // set full screen indicator + g_bFullScreen = TRUE; + } void SetPlaying(const char *text) {