Merge remote-tracking branch 'origin/minor_fixes'

This commit is contained in:
Andrea Odetti 2020-06-30 14:03:28 +01:00
commit fd9b2184bf
8 changed files with 48 additions and 33 deletions

View file

@ -145,15 +145,15 @@ void LogPerfTimings(void)
UINT64 other = g_timeTotal - g_timeCpu - g_timeSpeaker - g_timeMB_NoTimer - g_timeVideoRefresh;
LogOutput("Perf breakdown:\n");
LogOutput(". CPU %% = %2f.2\n", (double)cpu / (double)g_timeTotal * 100.0);
LogOutput(". Video %% = %2f.2\n", (double)video / (double)g_timeTotal * 100.0);
LogOutput("... NTSC %% = %2f.2\n", (double)g_timeVideo / (double)g_timeTotal * 100.0);
LogOutput("... refresh %% = %2f.2\n", (double)g_timeVideoRefresh / (double)g_timeTotal * 100.0);
LogOutput(". Audio %% = %2f.2\n", (double)audio / (double)g_timeTotal * 100.0);
LogOutput("... Speaker %% = %2f.2\n", (double)spkr / (double)g_timeTotal * 100.0);
LogOutput("... MB %% = %2f.2\n", (double)mb / (double)g_timeTotal * 100.0);
LogOutput(". Other %% = %2f.2\n", (double)other / (double)g_timeTotal * 100.0);
LogOutput(". TOTAL %% = %2f.2\n", (double)(cpu+video+audio+other) / (double)g_timeTotal * 100.0);
LogOutput(". CPU %% = %6.2f\n", (double)cpu / (double)g_timeTotal * 100.0);
LogOutput(". Video %% = %6.2f\n", (double)video / (double)g_timeTotal * 100.0);
LogOutput("... NTSC %% = %6.2f\n", (double)g_timeVideo / (double)g_timeTotal * 100.0);
LogOutput("... refresh %% = %6.2f\n", (double)g_timeVideoRefresh / (double)g_timeTotal * 100.0);
LogOutput(". Audio %% = %6.2f\n", (double)audio / (double)g_timeTotal * 100.0);
LogOutput("... Speaker %% = %6.2f\n", (double)spkr / (double)g_timeTotal * 100.0);
LogOutput("... MB %% = %6.2f\n", (double)mb / (double)g_timeTotal * 100.0);
LogOutput(". Other %% = %6.2f\n", (double)other / (double)g_timeTotal * 100.0);
LogOutput(". TOTAL %% = %6.2f\n", (double)(cpu+video+audio+other) / (double)g_timeTotal * 100.0);
}
}
#endif

View file

@ -8843,11 +8843,7 @@ void DebugDestroy ()
}
// TODO: DataDisassembly_Clear()
DeleteObject( g_hConsoleBrushFG );
DeleteObject( g_hConsoleBrushBG );
DeleteDC( g_hConsoleFontDC );
DeleteObject( g_hConsoleFontBitmap );
ReleaseConsoleFontDC();
}

View file

@ -83,8 +83,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
static LPBITMAPINFO g_pDebuggerMemFramebufferinfo = NULL;
static bgra_t* g_pDebuggerMemFramebits = NULL;
HDC g_hConsoleFontDC = NULL;
HBITMAP g_hConsoleFontBitmap = NULL;
static HDC g_hConsoleFontDC = NULL;
static HBITMAP g_hConsoleFontBitmap = NULL;
static LPBITMAPINFO g_hConsoleFontFramebufferinfo = NULL;
static bgra_t* g_hConsoleFontFramebits;
@ -95,8 +95,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
char g_cConsoleBrushBG_g;
char g_cConsoleBrushBG_b;
HBRUSH g_hConsoleBrushFG = NULL;
HBRUSH g_hConsoleBrushBG = NULL;
static HBRUSH g_hConsoleBrushFG = NULL;
static HBRUSH g_hConsoleBrushBG = NULL;
// NOTE: Keep in sync ConsoleColors_e g_anConsoleColor !
COLORREF g_anConsoleColor[ NUM_CONSOLE_COLORS ] =
@ -593,8 +593,11 @@ void ReleaseDebuggerMemDC(void)
g_hDebuggerMemBM = NULL;
DeleteDC(g_hDebuggerMemDC);
g_hDebuggerMemDC = NULL;
FrameReleaseDC();
DeleteObject(g_pDebuggerMemFramebufferinfo);
VirtualFree(g_pDebuggerMemFramebufferinfo, 0, MEM_RELEASE);
g_pDebuggerMemFramebufferinfo = NULL;
g_pDebuggerMemFramebits = NULL;
}
}
@ -650,6 +653,26 @@ HDC GetConsoleFontDC(void)
return g_hConsoleFontDC;
}
void ReleaseConsoleFontDC(void)
{
if (g_hConsoleFontDC)
{
DeleteDC( g_hConsoleFontDC );
g_hConsoleFontDC = NULL;
DeleteObject( g_hConsoleFontBitmap );
g_hConsoleFontBitmap = NULL;
VirtualFree(g_hConsoleFontFramebufferinfo, 0, MEM_RELEASE);
g_hConsoleFontFramebufferinfo = NULL;
g_hConsoleFontFramebits = NULL;
}
DeleteObject( g_hConsoleBrushFG );
g_hConsoleBrushFG = NULL;
DeleteObject( g_hConsoleBrushBG );
g_hConsoleBrushBG = NULL;
}
void StretchBltMemToFrameDC(void)
{

View file

@ -25,12 +25,6 @@
CONSOLE_FONT_BITMAP_HEIGHT = CONSOLE_FONT_HEIGHT * CONSOLE_FONT_NUM_ROWS, // 128 pixels
};
extern HBRUSH g_hConsoleBrushFG;
extern HBRUSH g_hConsoleBrushBG;
extern HDC g_hConsoleFontDC;
extern HBITMAP g_hConsoleFontBitmap;
enum
{
DISPLAY_HEIGHT = 384,

View file

@ -87,6 +87,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Mockingboard.h"
#include "SoundCore.h"
#include "YamlHelper.h"
#include "Riff.h"
#include "AY8910.h"
#include "SSI263Phonemes.h"
@ -1281,13 +1282,13 @@ static bool MB_DSInit()
FALSE, // bManualReset (FALSE = auto-reset)
FALSE, // bInitialState (FALSE = non-signaled)
NULL); // lpName
LogFileOutput("MB_DSInit: CreateEvent(), g_hSSI263Event[0]=0x%08X\n", (UINT32)g_hSSI263Event[0]);
LogFileOutput("MB_DSInit: CreateEvent(), g_hSSI263Event[0]=0x%08X\n", g_hSSI263Event[0]);
g_hSSI263Event[1] = CreateEvent(NULL, // lpEventAttributes
FALSE, // bManualReset (FALSE = auto-reset)
FALSE, // bInitialState (FALSE = non-signaled)
NULL); // lpName
LogFileOutput("MB_DSInit: CreateEvent(), g_hSSI263Event[1]=0x%08X\n", (UINT32)g_hSSI263Event[1]);
LogFileOutput("MB_DSInit: CreateEvent(), g_hSSI263Event[1]=0x%08X\n", g_hSSI263Event[1]);
if((g_hSSI263Event[0] == NULL) || (g_hSSI263Event[1] == NULL))
{
@ -1389,7 +1390,7 @@ static bool MB_DSInit()
NULL, // lpParameter
0, // dwCreationFlags : 0 = Run immediately
&dwThreadId); // lpThreadId
LogFileOutput("MB_DSInit: CreateThread(), g_hThread=0x%08X\n", (UINT32)g_hThread);
LogFileOutput("MB_DSInit: CreateThread(), g_hThread=0x%08X\n", g_hThread);
BOOL bRes2 = SetThreadPriority(g_hThread, THREAD_PRIORITY_TIME_CRITICAL);
LogFileOutput("MB_DSInit: SetThreadPriority(), bRes=%d\n", bRes2 ? 1 : 0);
@ -1990,7 +1991,7 @@ bool MB_UpdateCycles(ULONG uExecutedCycles)
if (pMB->bTimer1Active && bTimer1Irq)
{
UpdateIFR(pMB, 0, IxR_TIMER1);
bIrqOnLastOpcodeCycle = true;
bIrqOnLastOpcodeCycle = bTimer1IrqOnLastCycle;
MB_Update();

View file

@ -35,7 +35,7 @@ static DWORD dwDataOffset;
static DWORD g_dwTotalNumberOfBytesWritten = 0;
static unsigned int g_NumChannels = 2;
int RiffInitWriteFile(char* pszFile, unsigned int sample_rate, unsigned int NumChannels)
int RiffInitWriteFile(const char* pszFile, unsigned int sample_rate, unsigned int NumChannels)
{
g_hRiffFile = CreateFile(pszFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
@ -117,7 +117,7 @@ int RiffFinishWriteFile()
return CloseHandle(g_hRiffFile);
}
int RiffPutSamples(short* buf, unsigned int uSamples)
int RiffPutSamples(const short* buf, unsigned int uSamples)
{
if(g_hRiffFile == INVALID_HANDLE_VALUE)
return 1;

View file

@ -1,5 +1,5 @@
#pragma once
int RiffInitWriteFile(char* pszFile, unsigned int sample_rate, unsigned int NumChannels);
int RiffInitWriteFile(const char* pszFile, unsigned int sample_rate, unsigned int NumChannels);
int RiffFinishWriteFile();
int RiffPutSamples(short* buf, unsigned int uSamples);
int RiffPutSamples(const short* buf, unsigned int uSamples);

View file

@ -37,6 +37,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Speaker.h"
#include "Video.h" // VideoRedrawScreen()
#include "YamlHelper.h"
#include "Riff.h"
#include "Debugger/Debug.h" // For DWORD extbench