Skip to content

Commit 811e032

Browse files
authored
Merge pull request VCCE#485 from ejaquay/sdcrefact
Beginings of SDC code clean up and refactor
2 parents 29446c7 + 7b08d3b commit 811e032

15 files changed

+833
-673
lines changed

becker/becker_cartridge.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
////////////////////////////////////////////////////////////////////////////////
22
// Copyright 2015 by Joseph Forgione
33
// This file is part of VCC (Virtual Color Computer).
4-
//
4+
//
55
// VCC (Virtual Color Computer) is free software: you can redistribute itand/or
66
// modify it under the terms of the GNU General Public License as published by
77
// the Free Software Foundation, either version 3 of the License, or (at your
88
// option) any later version.
9-
//
9+
//
1010
// VCC (Virtual Color Computer) is distributed in the hope that it will be
1111
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
1212
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
1313
// Public License for more details.
14-
//
14+
//
1515
// You should have received a copy of the GNU General Public License along with
1616
// VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
1717
////////////////////////////////////////////////////////////////////////////////
@@ -21,6 +21,7 @@
2121
#include <vcc/utils/configuration_serializer.h>
2222
#include "../CartridgeMenu.h"
2323

24+
// Contains Becker cart exports
2425

2526
becker_cartridge::becker_cartridge(std::unique_ptr<context_type> context, HINSTANCE module_instance)
2627
:
@@ -48,13 +49,16 @@ becker_cartridge::description_type becker_cartridge::description() const
4849

4950
void becker_cartridge::start()
5051
{
52+
53+
// Load becker config
5154
::vcc::utils::configuration_serializer serializer(context_->configuration_path());
5255

5356
gBecker.sethost(
5457
serializer.read(configuration_section_id_, "DWServerAddr", "127.0.0.1").c_str(),
5558
serializer.read(configuration_section_id_, "DWServerPort", "65504").c_str());
5659
gBecker.enable(true);
5760

61+
// Create dynamic menu
5862
build_menu();
5963
}
6064

@@ -80,7 +84,7 @@ unsigned char becker_cartridge::read_port(unsigned char port_id)
8084
{
8185
case 0x41: // read status
8286
return gBecker.read(port_id) != 0 ? 2 : 0;
83-
87+
8488
case 0x42: // read data
8589
return gBecker.read(port_id);
8690
}
@@ -122,6 +126,7 @@ becker_cartridge::string_type becker_cartridge::server_port() const
122126
return gBecker.server_port();
123127
}
124128

129+
// Save becker config
125130
void becker_cartridge::configure_server(string_type server_address, string_type server_port)
126131
{
127132
gBecker.sethost(server_address.c_str(), server_port.c_str());

becker/configuration_dialog.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ INT_PTR configuration_dialog::process_message(
123123
switch (LOWORD(wParam))
124124
{
125125
case IDOK:
126+
// Save config dialog data
126127
controller_.configure_server(
127128
::vcc::utils::get_dialog_item_text(hDlg, IDC_TCPHOST),
128129
::vcc::utils::get_dialog_item_text(hDlg, IDC_TCPPORT));

becker/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
static HINSTANCE gModuleInstance;
2424

25-
25+
// Becker dll main
2626
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
2727
{
2828
if (fdwReason == DLL_PROCESS_ATTACH)
@@ -33,7 +33,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
3333
return true;
3434
}
3535

36-
36+
// Establish Becker cart exports
3737
extern "C" __declspec(dllexport) CreatePakFactoryFunction GetPakFactory()
3838
{
3939
return [](

libcommon/include/vcc/utils/configuration_serializer.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,18 @@
1515
// You should have received a copy of the GNU General Public License along with
1616
// VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
1717
////////////////////////////////////////////////////////////////////////////////
18+
1819
#pragma once
1920
#include <vcc/core/detail/exports.h>
2021
#include <string>
2122

23+
// The configuration_serializer class reads or writes VCC settings kept in the
24+
// VCC initialization file (typically vcc.ini)
25+
//
26+
// In programming, a serializer is a mechanism or tool used to convert a complex
27+
// data structure or object into a format that can be easily stored, transmitted,
28+
// or reconstructed later. This class barely meets that definition. It might be
29+
// better named "settings_manager" or just "Settings".
2230

2331
namespace vcc::utils
2432
{

libcommon/include/vcc/utils/winapi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <Windows.h>
2121
#include <string>
2222

23+
// returns resource strings
2324

2425
namespace vcc::utils
2526
{

libcommon/src/utils/configuration_serializer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#include <vcc/utils/configuration_serializer.h>
1919
#include <Windows.h>
2020

21+
// The configuration_serializer class reads or writes VCC configuration data from
22+
// the VCC initialization store (typically vcc.ini)
2123

2224
namespace vcc::utils
2325
{

mpi/configuration_dialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void configuration_dialog::update_slot_details(slot_id_type slot)
155155
gSlotUiElementIds[slot].insert_button_id,
156156
WM_SETTEXT,
157157
0,
158-
reinterpret_cast<LPARAM>(mpi_.empty(slot) ? "..." : "X"));
158+
reinterpret_cast<LPARAM>(mpi_.empty(slot) ? ">" : "X"));
159159
}
160160

161161

mpi/mpi.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ BEGIN
7878
EDITTEXT IDC_MODINFO, 175,8,118,115, ES_MULTILINE|ES_READONLY|ES_WANTRETURN
7979

8080
LTEXT "Radio button selects startup slot.", IDC_STATIC, 10,128,105,10
81-
LTEXT "... Mount cartridge.", IDC_STATIC, 125,128,90,10
81+
LTEXT "> Mount cartridge.", IDC_STATIC, 125,128,90,10
8282
LTEXT "X Eject cartridge.", IDC_STATIC, 215,128,60,10
8383

8484
// CHECKBOX "Persistent ProgramPak Images",IDC_PERSIST_PAK, 15,165,110,10

sdc/sdc.h

Lines changed: 0 additions & 63 deletions
This file was deleted.

sdc/sdc.vcxproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,14 @@
9696
</Link>
9797
</ItemDefinitionGroup>
9898
<ItemGroup>
99-
<ClCompile Include="sdc.cpp" />
99+
<ClCompile Include="sdc_dllmain.cpp" />
100+
<ClCompile Include="sdc_cartridge.cpp" />
101+
<ClCompile Include="sdc_configuration.cpp" />
100102
</ItemGroup>
101103
<ItemGroup>
102-
<ClInclude Include="sdc.h" />
103104
<ClInclude Include="resource.h" />
105+
<ClInclude Include="sdc_cartridge.h" />
106+
<ClInclude Include="sdc_configuration.h" />
104107
</ItemGroup>
105108
<ItemGroup>
106109
<ResourceCompile Include="sdc.rc" />
@@ -113,4 +116,4 @@
113116
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
114117
<ImportGroup Label="ExtensionTargets">
115118
</ImportGroup>
116-
</Project>
119+
</Project>

0 commit comments

Comments
 (0)