Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Cassette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This file is part of VCC (Virtual Color Computer).
#include "coco3.h"
#include "config.h"
#include <vcc/util/DialogOps.h>
#include <vcc/util/fileutil.h>
#include "Cassette.h"
#include "stdio.h"
#include <vcc/util/logger.h>
Expand Down Expand Up @@ -450,9 +451,7 @@ void CloseTapeFile()
unsigned int LoadTape()
{
FileDialog dlg;
char IniFilePath[MAX_PATH];
GetIniFilePath(IniFilePath);
GetPrivateProfileString("DefaultPaths","CassPath","",CassPath,MAX_PATH,IniFilePath);
Setting().read("DefaultPaths","CassPath","",CassPath,MAX_PATH);
dlg.setInitialDir(CassPath);
dlg.setFilter("Cassette Files (.cas,.wav)\0*.cas;*.wav\0\0");
dlg.setTitle("Insert Tape Image");
Expand All @@ -465,8 +464,10 @@ unsigned int LoadTape()
}
}
dlg.getdir(CassPath);
if (strcmp(CassPath, "") != 0)
WritePrivateProfileString("DefaultPaths","CassPath",CassPath,IniFilePath);
if (strcmp(CassPath, "") != 0) {
VCC::Util::FixDirSlashes(CassPath);
Setting().write("DefaultPaths","CassPath",CassPath);
}
// turn off fast load for wav files
if (FileType == WAV) TapeFastLoad = false;
TapeWritten = false;
Expand Down
38 changes: 20 additions & 18 deletions CommandLine.cpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
/*
Copyright E J Jaquay 2020
This file is part of VCC (Virtual Color Computer).
VCC (Virtual Color Computer) is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.

VCC (Virtual Color Computer) is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
*/

//-------------------------------------------------------------------
//#define USE_LOGGING
//======================================================================
// This file is part of VCC (Virtual Color Computer).
// Vcc is Copyright 2015 by Joseph Forgione
//
// VCC (Virtual Color Computer) is free software, you can redistribute
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// VCC (Virtual Color Computer) is distributed in the hope that it will
// be useful, but WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with VCC (Virtual Color Computer). If not, see
// <http://www.gnu.org/licenses/>.
//======================================================================
//
// Command line arguments and options to VCC
// E J Jaquay 2020
//
// Since VCC is a windows application traditional Unix command arguments (argc,argV)
// are not availiable. However the third argument to WinMain() does provide the
Expand Down
50 changes: 28 additions & 22 deletions CommandLine.h
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
#ifndef __COMMANDLINE_H__
#define __COMMANDLINE_H__
/*
//#define USE_LOGGING
//======================================================================
// This file is part of VCC (Virtual Color Computer).
// Vcc is Copyright 2015 by Joseph Forgione
//
// VCC (Virtual Color Computer) is free software, you can redistribute
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// VCC (Virtual Color Computer) is distributed in the hope that it will
// be useful, but WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with VCC (Virtual Color Computer). If not, see
// <http://www.gnu.org/licenses/>.
//======================================================================

//----------------------------------------------------------------------
// Command line arguments and options to VCC
// E J Jaquay 2020
//----------------------------------------------------------------------

#pragma once

Copyright 2015 by E J Jaquay
This file is part of VCC (Virtual Color Computer).

VCC (Virtual Color Computer) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

VCC (Virtual Color Computer) is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
*/

// Declare global variables defined by GetCmdLineArgs
constexpr auto CL_MAX_PATH = 256u;
constexpr auto CL_MAX_PASTE = 256u;

// Variables defined by GetCmdLineArgs
struct CmdLineArguments {
char QLoadFile[CL_MAX_PATH];
char IniFile[CL_MAX_PATH];
Expand All @@ -42,4 +49,3 @@ int GetCmdLineArgs(const char * lpCmdLine);
#define CL_ERR_UNKOPT 1 // Unknown option found
#define CL_ERR_XTRARG 2 // Too many arguments

#endif
52 changes: 32 additions & 20 deletions Vcc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
#include "CommandLine.h"
#include <vcc/util/logger.h>
#include <vcc/util/limits.h>
#include <vcc/util/settings.h>
#include "memdump.h"

#include "MemoryMap.h"
Expand All @@ -81,7 +82,7 @@
#include "IDisplayDebug.h"
#endif

using namespace VCC;
using namespace ::VCC; // namespace is everything VCC

static HANDLE hout=nullptr;

Expand Down Expand Up @@ -134,6 +135,8 @@ bool IsShiftKeyDown();

CartridgeMenu CartMenu;

static bool gHasFocus {};

//static CRITICAL_SECTION FrameRender;
/*--------------------------------------------------------------------------*/
int APIENTRY WinMain(_In_ HINSTANCE hInstance,
Expand Down Expand Up @@ -210,8 +213,10 @@ int APIENTRY WinMain(_In_ HINSTANCE hInstance,

while (BinaryRunning)
{
if (FlagEmuStop==TH_WAITING) //Need to stop the EMU thread for screen mode change
{ //As it holds the Secondary screen buffer open while running
//Need to stop the EMU thread for screen mode change
//As it holds the Secondary screen buffer open while running
if (FlagEmuStop==TH_WAITING)
{
FullScreenToggle();
FlagEmuStop=TH_RUNNING;
}
Expand Down Expand Up @@ -255,7 +260,6 @@ int APIENTRY WinMain(_In_ HINSTANCE hInstance,
CloseScreen();
timeEndPeriod(1);
UnloadDll();
WriteIniFile(); //Save Any changes to ini File
return Msg.wParam;
}

Expand Down Expand Up @@ -439,15 +443,20 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_SETCURSOR:
// Hide mouse cursor
if ((EmuState.MousePointer != 1) && (LOWORD(lParam) == HTCLIENT)) {
SetCursor(nullptr);
if (gHasFocus) SetCursor(nullptr);
return TRUE;
}
break;

case WM_SETFOCUS:
gHasFocus = true;
break;

case WM_KILLFOCUS:
// Force keys up if main widow keyboard focus is lost. Otherwise
// down keys will cause issues with OS-9 on return
raise_saved_keys();
gHasFocus = false;
break;

case WM_CLOSE:
Expand Down Expand Up @@ -914,31 +923,36 @@ unsigned char SetAutoStart(unsigned char Tmp)
// LoadIniFile allows user to browse for an ini file and reloads the config from it.
void LoadIniFile()
{
FlushSettings(); // Make sure all current settings are flused to store

char curini[MAX_PATH]="";
GetIniFilePath(curini);

FileDialog dlg;
dlg.setFilter("INI\0*.ini\0\0");
dlg.setDefExt("ini");
dlg.setInitialDir(AppDirectory() );
dlg.setTitle(TEXT("Load Vcc Config File") );
dlg.setFlags(OFN_FILEMUSTEXIST);

// Send current ini file path to dialog
char curini[MAX_PATH]="";
GetIniFilePath(curini);
dlg.setpath(curini);

if ( dlg.show() ) {
WriteIniFile(); // Flush current profile
SetIniFilePath(dlg.path()); // Set new ini file path
ReadIniFile(); // Load it
UpdateConfig();
EmuState.ResetPending = 2;
SetIniFilePath(dlg.path()); // Set new settings path
ReadIniFile(); // Load settings
UpdateConfig(); // Apply critical CPU and Video settings
EmuState.ResetPending = 2; // Force reset
}
return;
}

// SaveConfig copies the current ini file to a choosen ini file.
void SaveConfig() {

FlushSettings();

char curini[MAX_PATH]="";
GetIniFilePath(curini);

FileDialog dlg;
dlg.setFilter("INI\0*.ini\0\0");
dlg.setDefExt("ini");
Expand All @@ -947,13 +961,10 @@ void SaveConfig() {
dlg.setFlags(OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT);

// Send current ini file path to dialog
char curini[MAX_PATH]="";
GetIniFilePath(curini);
dlg.setpath(curini);

if ( dlg.show(1) ) {
SetIniFilePath(dlg.path()); // Set new ini file path
WriteIniFile(); // Flush current profile
// If ini file has changed
if (_stricmp(curini,dlg.path()) != 0) {
// Copy current ini to new ini
Expand Down Expand Up @@ -1010,8 +1021,9 @@ unsigned __stdcall EmuLoop(HANDLE hEvent)
break;

case 2: //Hard Reset
UpdateConfig();
DoCls(&EmuState);
ReadIniFile(); // FIXME ReadIniFile should apply changes
UpdateConfig(); // Applies only video and Cpu changes
DoCls(&EmuState); // Clear the screen
DoHardReset(&EmuState);
break;

Expand All @@ -1020,7 +1032,7 @@ unsigned __stdcall EmuLoop(HANDLE hEvent)
break;

case 4:
UpdateConfig();
UpdateConfig(); // Apply video and cpy changes
DoCls(&EmuState);
break;

Expand Down
65 changes: 29 additions & 36 deletions Vcc.h
Original file line number Diff line number Diff line change
@@ -1,40 +1,33 @@
#ifndef __VCC_H__
#define __VCC_H__
//======================================================================
// This file is part of VCC (Virtual Color Computer).
// Vcc is Copyright 2015 by Joseph Forgione
//
// VCC (Virtual Color Computer) is free software, you can redistribute
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// VCC (Virtual Color Computer) is distributed in the hope that it will
// be useful, but WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with VCC (Virtual Color Computer). If not, see
// <http://www.gnu.org/licenses/>.
//======================================================================

/*
Copyright 2015 by Joseph Forgione
This file is part of VCC (Virtual Color Computer).
// Vcc.h callable functions exposed to the rest of vcc core

VCC (Virtual Color Computer) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
#pragma once

VCC (Virtual Color Computer) is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
void SetCPUMultiplyerFlag (unsigned char); //tcc1014registers.cpp
void SetTurboMode(unsigned char); //tcc1014registers.cpp
unsigned char SetCPUMultiplyer(unsigned char); //tcc1014registers.cpp, config.cpp
unsigned char SetRamSize(unsigned char); //config.cpp
unsigned char SetSpeedThrottle(unsigned char); //config.cpp, keyboard.cpp
unsigned char SetFrameSkip(unsigned char); //config.cpp
unsigned char SetCpuType( unsigned char); //config.cpp
unsigned char SetAutoStart(unsigned char); //config.cpp
void DoReboot(); //config.cpp

You should have received a copy of the GNU General Public License
along with VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
*/

// define this to make the main config dialog modal
// vs. modeless where you can interact with the main window
// while the config dialog is open
//#define CONFIG_DIALOG_MODAL

void SetCPUMultiplyerFlag (unsigned char);
void SetTurboMode(unsigned char);
unsigned char SetCPUMultiplyer(unsigned char );
unsigned char SetRamSize(unsigned char);
unsigned char SetSpeedThrottle(unsigned char);
unsigned char SetFrameSkip(unsigned char);
unsigned char SetCpuType( unsigned char);
unsigned char SetAutoStart(unsigned char);
void SetPaletteType();
void DoReboot();
void DoHardReset(SystemState *);
void LoadPack (int);

#endif
Loading