From 689cceafb5bcabf4c1b1277ac075963a06c4842e Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Tue, 5 Apr 2005 11:10:08 +0000 Subject: [PATCH] new configuration system. Apply patch 1156149 from moe Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2171 --- src/hardware/hardware.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/hardware/hardware.cpp b/src/hardware/hardware.cpp index 9bfe32e6..9b013c1e 100644 --- a/src/hardware/hardware.cpp +++ b/src/hardware/hardware.cpp @@ -42,6 +42,7 @@ FILE * OpenCaptureFile(const char * type,const char * ext) { return 0; } strcpy(file_start,RunningProgram); + lowcase(file_start); strcat(file_start,"_"); while ((dir_ent=readdir(dir))) { char tempname[CROSS_LEN]; @@ -55,7 +56,6 @@ FILE * OpenCaptureFile(const char * type,const char * ext) { } closedir(dir); sprintf(file_name,"%s%c%s%03d%s",capturedir,CROSS_FILESPLIT,file_start,last,ext); - lowcase(file_name); /* Open the actual file */ FILE * handle=fopen(file_name,"wb"); if (handle) { @@ -66,9 +66,22 @@ FILE * OpenCaptureFile(const char * type,const char * ext) { return handle; } +class HARDWARE:public Module_base{ +public: + HARDWARE(Section* configuration):Module_base(configuration){ + Section_prop * section = static_cast(configuration); + capturedir = (char *)section->Get_string("captures"); + } + ~HARDWARE(){ } +}; -void HARDWARE_Init(Section * sec) { - Section_prop * section=static_cast(sec); - capturedir=(char *)section->Get_string("captures"); +static HARDWARE* test; + +void HARDWARE_Destroy(Section * sec) { + delete test; } +void HARDWARE_Init(Section * sec) { + test = new HARDWARE(sec); + sec->AddDestroyFunction(&HARDWARE_Destroy,true); +}