Skip to content

Commit fa9ed56

Browse files
committed
add RES_load and RES_save
1 parent 6ac4e7c commit fa9ed56

7 files changed

+144
-53
lines changed

EGA

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,10 @@ You have to copy the 64-bit file into another place before loading.
290290
- Updated mcpp.exe and dfmsc.exe.
291291
- v.5.5.9 (2021.06.16)
292292
- Fixed loading resource.h macros.
293-
- v.5.6.0 (2021.XX.YY)
293+
- v.5.6.0 (2021.06.19)
294294
- Don't compress dfmsc.exe (for security).
295295
- Supported command line.
296+
- Added RES_load and RES_save functions to EGA language.
296297

297298
## Contact Us
298299

README.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,10 @@ Question 6. Are the 64-bit files supported?
281281
- Updated mcpp.exe and dfmsc.exe.
282282
- v.5.5.9 (2021.06.16)
283283
- Fixed loading resource.h macros.
284-
- v.5.6.0 (2021.XX.YY)
284+
- v.5.6.0 (2021.06.19)
285285
- Don't compress dfmsc.exe (for security).
286286
- Supported command line.
287+
- Added RES_load and RES_save functions to EGA language.
287288

288289
/////////////////////////////////////////////////////////////////////
289290
Katayama Hirofumi MZ (katahiromz) [A.N.T.]

READMEIT.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,10 @@ Domanda 6. I file a 64 bit sono supportati?
281281
- Updated mcpp.exe and dfmsc.exe.
282282
- v.5.5.9 (16.06.2021)
283283
- Fixed loading resource.h macros.
284-
- v.5.6.0 (2021.XX.YY)
284+
- v.5.6.0 (19.06.2021)
285285
- Don't compress dfmsc.exe (for security).
286286
- Supported command line.
287+
- Added RES_load and RES_save functions to EGA language.
287288

288289
/////////////////////////////////////////////////////////////////////
289290
// Katayama Hirofumi MZ (katahiromz) [A.N.T.]

READMEJP.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -623,9 +623,10 @@
623623
mcpp.exe と dfmsc.exe を更新。
624624
v.5.5.9 (2021.06.16)
625625
resource.hのマクロ読み込みを修正。
626-
v.5.6.0 (2021.XX.YY)
626+
v.5.6.0 (2021.06.19)
627627
dfmsc.exe を圧縮しない(安全のため)。
628628
コマンドラインをサポート。
629+
RES_loadとRES_save関数をEGA言語に追加。
629630

630631
/////////////////////////////////////////////////////
631632
// 片山博文MZ (katahiromz) [A.N.T.]

READMEKO.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,10 @@ Windows XP/2003/Vista/7/8.1/10 및 ReactOS에서 작동합니다.
281281
- Updated mcpp.exe and dfmsc.exe.
282282
- v.5.5.9 (2021.06.16)
283283
- Fixed loading resource.h macros.
284-
- v.5.6.0 (2021.XX.YY)
284+
- v.5.6.0 (2021.06.19)
285285
- Don't compress dfmsc.exe (for security).
286286
- Supported command line.
287+
- Added RES_load and RES_save functions to EGA language.
287288

288289
/////////////////////////////////////////////////////////////////////
289290
Katayama Hirofumi MZ (katahiromz) [A.N.T.]

src/RisohEditor.cpp

+133-47
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
BOOL g_bNoGuiMode = FALSE; // No-GUI mode
2626
LPWSTR g_pszLogFile = NULL;
27-
MStringW g_load_options;
28-
MStringW g_save_options;
2927

3028
INT LogMessageBoxW(HWND hwnd, LPCWSTR text, LPCWSTR title, UINT uType)
3129
{
@@ -2172,6 +2170,8 @@ class MMainWnd : public MWindowBase
21722170
public:
21732171
MDropdownArrow m_arrow; // the language drop-down arrow
21742172
MStringW m_commands;
2173+
MStringW m_load_options;
2174+
MStringW m_save_options;
21752175

21762176
BOOL ParseCommandLine(HWND hwnd, INT argc, WCHAR **targv);
21772177

@@ -2351,6 +2351,11 @@ class MMainWnd : public MWindowBase
23512351
BOOL DoItemSearch(ITEM_SEARCH& search);
23522352
BOOL DoItemSearchBang(HWND hwnd, MItemSearchDlg *pDialog);
23532353

2354+
bool DoResLoad(const MStringW& filename, const MStringW& options = L"");
2355+
bool DoResSave(const MStringW& filename, const MStringW& options = L"");
2356+
2357+
EGA::arg_t DoEgaResLoad(const EGA::args_t& args);
2358+
EGA::arg_t DoEgaResSave(const EGA::args_t& args);
23542359
EGA::arg_t DoEgaResSearch(const EGA::args_t& args);
23552360
EGA::arg_t DoEgaResDelete(const EGA::args_t& args);
23562361
EGA::arg_t DoEgaResCloneByName(const EGA::args_t& args);
@@ -11474,55 +11479,14 @@ void MMainWnd::OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
1147411479
if (command.find(L"load:") == 0)
1147511480
{
1147611481
command = command.substr(5);
11477-
11478-
BOOL bAutoLoadNearbyResH = g_settings.bAutoLoadNearbyResH;
11479-
g_settings.bAutoLoadNearbyResH = g_load_options.find(L"(no-load-res-h)") != g_load_options.npos;
11480-
{
11481-
DoLoadFile(hwnd, command.c_str(), 0, TRUE);
11482-
}
11483-
g_settings.bAutoLoadNearbyResH = bAutoLoadNearbyResH;
11482+
DoResLoad(command, m_load_options);
1148411483
continue;
1148511484
}
1148611485

1148711486
if (command.find(L"save:") == 0)
1148811487
{
1148911488
command = command.substr(5);
11490-
BOOL bUseIDC_STATIC = g_settings.bUseIDC_STATIC;
11491-
BOOL bAskUpdateResH = g_settings.bAskUpdateResH;
11492-
BOOL bCompressByUPX = g_settings.bCompressByUPX;
11493-
BOOL bSepFilesByLang = g_settings.bSepFilesByLang;
11494-
BOOL bStoreToResFolder = g_settings.bStoreToResFolder;
11495-
BOOL bSelectableByMacro = g_settings.bSelectableByMacro;
11496-
BOOL bRedundantComments = g_settings.bRedundantComments;
11497-
BOOL bWrapManifest = g_settings.bWrapManifest;
11498-
BOOL bUseBeginEnd = g_settings.bUseBeginEnd;
11499-
BOOL bRCFileUTF16 = g_settings.bRCFileUTF16;
11500-
BOOL bBackup = g_settings.bBackup;
11501-
g_settings.bUseIDC_STATIC = g_save_options.find(L"(idc-static)") != g_save_options.npos;
11502-
g_settings.bAskUpdateResH = FALSE;
11503-
g_settings.bCompressByUPX = g_save_options.find(L"(compress)") != g_save_options.npos;
11504-
g_settings.bSepFilesByLang = g_save_options.find(L"(sep-lang)") != g_save_options.npos;
11505-
g_settings.bStoreToResFolder = g_save_options.find(L"(no-res-folder)") == g_save_options.npos;
11506-
g_settings.bSelectableByMacro = g_save_options.find(L"(lang-macro)") != g_save_options.npos;
11507-
g_settings.bRedundantComments = g_save_options.find(L"(less-comments)") == g_save_options.npos;
11508-
g_settings.bWrapManifest = g_save_options.find(L"(wrap-manifest)") != g_save_options.npos;
11509-
g_settings.bUseBeginEnd = g_save_options.find(L"(begin-end)") != g_save_options.npos;
11510-
g_settings.bRCFileUTF16 = g_save_options.find(L"(utf-16)") != g_save_options.npos;
11511-
g_settings.bBackup = g_save_options.find(L"(backup)") != g_save_options.npos;
11512-
{
11513-
DoSaveFile(hwnd, command.c_str());
11514-
}
11515-
g_settings.bUseIDC_STATIC = bUseIDC_STATIC;
11516-
g_settings.bAskUpdateResH = bAskUpdateResH;
11517-
g_settings.bCompressByUPX = bCompressByUPX;
11518-
g_settings.bSepFilesByLang = bSepFilesByLang;
11519-
g_settings.bStoreToResFolder = bStoreToResFolder;
11520-
g_settings.bSelectableByMacro = bSelectableByMacro;
11521-
g_settings.bRedundantComments = bRedundantComments;
11522-
g_settings.bWrapManifest = bWrapManifest;
11523-
g_settings.bUseBeginEnd = bUseBeginEnd;
11524-
g_settings.bRCFileUTF16 = bRCFileUTF16;
11525-
g_settings.bBackup = bBackup;
11489+
DoResSave(command, m_save_options);
1152611490
continue;
1152711491
}
1152811492
}
@@ -15927,6 +15891,76 @@ MStringW GetRisohTemplate(const MIdOrString& type, WORD wLang)
1592715891

1592815892
static MMainWnd *s_pMainWnd = NULL;
1592915893

15894+
bool MMainWnd::DoResLoad(const MStringW& filename, const MStringW& options)
15895+
{
15896+
bool bOK;
15897+
BOOL bNoGuiMode = g_bNoGuiMode;
15898+
g_bNoGuiMode = TRUE;
15899+
BOOL bAutoLoadNearbyResH = g_settings.bAutoLoadNearbyResH;
15900+
g_settings.bAutoLoadNearbyResH = options.find(L"(no-load-res-h)") != options.npos;
15901+
{
15902+
bOK = !!DoLoadFile(m_hwnd, filename.c_str(), 0, TRUE);
15903+
}
15904+
g_settings.bAutoLoadNearbyResH = bAutoLoadNearbyResH;
15905+
g_bNoGuiMode = bNoGuiMode;
15906+
return bOK;
15907+
}
15908+
15909+
bool MMainWnd::DoResSave(const MStringW& filename, const MStringW& options)
15910+
{
15911+
bool bOK;
15912+
BOOL bNoGuiMode = g_bNoGuiMode;
15913+
g_bNoGuiMode = TRUE;
15914+
BOOL bUseIDC_STATIC = g_settings.bUseIDC_STATIC;
15915+
BOOL bAskUpdateResH = g_settings.bAskUpdateResH;
15916+
BOOL bCompressByUPX = g_settings.bCompressByUPX;
15917+
BOOL bSepFilesByLang = g_settings.bSepFilesByLang;
15918+
BOOL bStoreToResFolder = g_settings.bStoreToResFolder;
15919+
BOOL bSelectableByMacro = g_settings.bSelectableByMacro;
15920+
BOOL bRedundantComments = g_settings.bRedundantComments;
15921+
BOOL bWrapManifest = g_settings.bWrapManifest;
15922+
BOOL bUseBeginEnd = g_settings.bUseBeginEnd;
15923+
BOOL bRCFileUTF16 = g_settings.bRCFileUTF16;
15924+
BOOL bBackup = g_settings.bBackup;
15925+
g_settings.bUseIDC_STATIC = options.find(L"(idc-static)") != options.npos;
15926+
g_settings.bAskUpdateResH = FALSE;
15927+
g_settings.bCompressByUPX = options.find(L"(compress)") != options.npos;
15928+
g_settings.bSepFilesByLang = options.find(L"(sep-lang)") != options.npos;
15929+
g_settings.bStoreToResFolder = options.find(L"(no-res-folder)") == options.npos;
15930+
g_settings.bSelectableByMacro = options.find(L"(lang-macro)") != options.npos;
15931+
g_settings.bRedundantComments = options.find(L"(less-comments)") == options.npos;
15932+
g_settings.bWrapManifest = options.find(L"(wrap-manifest)") != options.npos;
15933+
g_settings.bUseBeginEnd = options.find(L"(begin-end)") != options.npos;
15934+
g_settings.bRCFileUTF16 = options.find(L"(utf-16)") != options.npos;
15935+
g_settings.bBackup = options.find(L"(backup)") != options.npos;
15936+
{
15937+
bOK = !!DoSaveFile(m_hwnd, filename.c_str());
15938+
}
15939+
g_settings.bUseIDC_STATIC = bUseIDC_STATIC;
15940+
g_settings.bAskUpdateResH = bAskUpdateResH;
15941+
g_settings.bCompressByUPX = bCompressByUPX;
15942+
g_settings.bSepFilesByLang = bSepFilesByLang;
15943+
g_settings.bStoreToResFolder = bStoreToResFolder;
15944+
g_settings.bSelectableByMacro = bSelectableByMacro;
15945+
g_settings.bRedundantComments = bRedundantComments;
15946+
g_settings.bWrapManifest = bWrapManifest;
15947+
g_settings.bUseBeginEnd = bUseBeginEnd;
15948+
g_settings.bRCFileUTF16 = bRCFileUTF16;
15949+
g_settings.bBackup = bBackup;
15950+
g_bNoGuiMode = bNoGuiMode;
15951+
return bOK;
15952+
}
15953+
15954+
EGA::arg_t EGA_FN EGA_RES_load(const EGA::args_t& args)
15955+
{
15956+
return s_pMainWnd->DoEgaResLoad(args);
15957+
}
15958+
15959+
EGA::arg_t EGA_FN EGA_RES_save(const EGA::args_t& args)
15960+
{
15961+
return s_pMainWnd->DoEgaResSave(args);
15962+
}
15963+
1593015964
EGA::arg_t EGA_FN EGA_RES_search(const EGA::args_t& args)
1593115965
{
1593215966
return s_pMainWnd->DoEgaResSearch(args);
@@ -16003,6 +16037,56 @@ EGA::arg_t EGA_set_id_or_str(const MIdOrString& id)
1600316037
}
1600416038
}
1600516039

16040+
EGA::arg_t MMainWnd::DoEgaResLoad(const EGA::args_t& args)
16041+
{
16042+
using namespace EGA;
16043+
arg_t arg0, arg1;
16044+
16045+
if (args.size() >= 1)
16046+
arg0 = EGA_eval_arg(args[0], true);
16047+
if (args.size() >= 2)
16048+
arg1 = EGA_eval_arg(args[1], false);
16049+
16050+
bool ret;
16051+
MAnsiToWide str0(CP_UTF8, EGA_get_str(arg0));
16052+
if (args.size() >= 2)
16053+
{
16054+
MAnsiToWide str1(CP_UTF8, EGA_get_str(arg1));
16055+
ret = DoResLoad(str0.c_str(), str1.c_str());
16056+
}
16057+
else
16058+
{
16059+
ret = DoResLoad(str0.c_str(), L"");
16060+
}
16061+
16062+
return make_arg<AstInt>(ret);
16063+
}
16064+
16065+
EGA::arg_t MMainWnd::DoEgaResSave(const EGA::args_t& args)
16066+
{
16067+
using namespace EGA;
16068+
arg_t arg0, arg1;
16069+
16070+
if (args.size() >= 1)
16071+
arg0 = EGA_eval_arg(args[0], true);
16072+
if (args.size() >= 2)
16073+
arg1 = EGA_eval_arg(args[1], false);
16074+
16075+
bool ret;
16076+
MAnsiToWide str0(CP_UTF8, EGA_get_str(arg0));
16077+
if (args.size() >= 2)
16078+
{
16079+
MAnsiToWide str1(CP_UTF8, EGA_get_str(arg1));
16080+
ret = DoResSave(str0.c_str(), str1.c_str());
16081+
}
16082+
else
16083+
{
16084+
ret = DoResSave(str0.c_str(), L"");
16085+
}
16086+
16087+
return make_arg<AstInt>(ret);
16088+
}
16089+
1600616090
EGA::arg_t MMainWnd::DoEgaResSearch(const EGA::args_t& args)
1600716091
{
1600816092
using namespace EGA;
@@ -16391,6 +16475,8 @@ void EGA_extension(void)
1639116475
EGA_add_fn("RES_get_binary", 0, 3, EGA_RES_get_binary, "RES_get_binary([type[, name[, lang]]])");
1639216476
EGA_add_fn("RES_set_binary", 4, 4, EGA_RES_set_binary, "RES_set_binary(type, name, lang, bin)");
1639316477
EGA_add_fn("RES_const", 1, 1, EGA_RES_const, "RES_const(name)");
16478+
EGA_add_fn("RES_load", 1, 2, EGA_RES_load, "RES_load(filename[, options])");
16479+
EGA_add_fn("RES_save", 1, 2, EGA_RES_save, "RES_save(filename[, options])");
1639416480
EGA_add_fn("RES_search", 0, 3, EGA_RES_search, "RES_search([type[, name[, lang]]])");
1639516481
EGA_add_fn("RES_select", 0, 3, EGA_RES_select, "RES_select([type[, name[, lang]]])");
1639616482
EGA_add_fn("RES_unload_resh", 0, 0, EGA_RES_unload_resh, "EGA_RES_unload_resh()");
@@ -16444,7 +16530,7 @@ BOOL MMainWnd::ParseCommandLine(HWND hwnd, INT argc, WCHAR **targv)
1644416530
lstrcmpiW(arg, L"--load-options") == 0)
1644516531
{
1644616532
arg = targv[++iarg];
16447-
g_load_options = arg;
16533+
m_load_options = arg;
1644816534
continue;
1644916535
}
1645016536

@@ -16461,7 +16547,7 @@ BOOL MMainWnd::ParseCommandLine(HWND hwnd, INT argc, WCHAR **targv)
1646116547
lstrcmpiW(arg, L"--save-options") == 0)
1646216548
{
1646316549
arg = targv[++iarg];
16464-
g_save_options = arg;
16550+
m_save_options = arg;
1646516551
continue;
1646616552
}
1646716553

0 commit comments

Comments
 (0)