1
0
Fork 0

Changes for 1 global capture directory

Support for capturing raw midi
Support for capturing raw opl


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1863
This commit is contained in:
Sjoerd van der Berg 2004-07-04 21:02:22 +00:00
parent ba9a2cc546
commit b1cebeed4e
3 changed files with 54 additions and 18 deletions

View file

@ -19,6 +19,8 @@
#ifndef _HARDWARE_H_
#define _HARDWARE_H_
#include <stdio.h>
class Section;
enum OPL_Mode {
OPL_none,OPL_cms,OPL_opl2,OPL_dualopl2,OPL_opl3
@ -27,6 +29,8 @@ enum OPL_Mode {
void OPL_Init(Section* sec,Bitu base,OPL_Mode mode,Bitu rate);
void CMS_Init(Section* sec,Bitu base,Bitu rate);
extern Bit8u adlib_commandreg;
FILE * OpenCaptureFile(const char * type,const char * ext);
#endif

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dosbox.cpp,v 1.70 2004-06-28 01:41:20 canadacow Exp $ */
/* $Id: dosbox.cpp,v 1.71 2004-07-04 20:59:38 harekiet Exp $ */
#include <stdlib.h>
#include <stdarg.h>
@ -50,7 +50,7 @@ void PAGING_Init(Section *);
void IO_Init(Section * );
void CALLBACK_Init(Section*);
void PROGRAMS_Init(Section*);
void CREDITS_Init(Section*);
void RENDER_Init(Section*);
void VGA_Init(Section*);
@ -190,6 +190,7 @@ void DOSBOX_Init(void) {
secprop=control->AddSection_prop("dosbox",&DOSBOX_RealInit);
secprop->Add_string("language","");
secprop->Add_string("machine","vga");
secprop->Add_string("captures","capture");
#if C_DEBUG
LOG_StartUp();
@ -198,6 +199,7 @@ void DOSBOX_Init(void) {
secprop->AddInitFunction(&IO_Init);
secprop->AddInitFunction(&PAGING_Init);
secprop->AddInitFunction(&MEM_Init);
secprop->AddInitFunction(&HARDWARE_Init);
secprop->Add_int("memsize",16);
secprop->AddInitFunction(&CALLBACK_Init);
secprop->AddInitFunction(&PIC_Init);
@ -210,16 +212,15 @@ void DOSBOX_Init(void) {
"language -- Select another language file.\n"
"memsize -- Amount of memory dosbox has in megabytes.\n"
"machine -- The type of machine tries to emulate:hercules,cga,tandy,vga.\n"
"captures -- Directory where things like wave,midi,screenshot get captured.\n"
);
secprop=control->AddSection_prop("render",&RENDER_Init);
secprop->Add_int("frameskip",0);
secprop->Add_string("snapdir","snaps");
secprop->Add_bool("aspect",false);
secprop->Add_string("scaler","normal2x");
MSG_Add("RENDER_CONFIGFILE_HELP",
"frameskip -- How many frames dosbox skips before drawing one.\n"
"snapdir -- Directory where screenshots get saved.\n"
"aspect -- Do aspect correction.\n"
"scaler -- Scaler used to enlarge/enhance low resolution modes.\n"
" Supported are none,normal2x,advmame2x\n"
@ -254,7 +255,6 @@ void DOSBOX_Init(void) {
secprop->Add_bool("nosound",false);
secprop->Add_int("rate",22050);
secprop->Add_int("blocksize",2048);
secprop->Add_string("wavedir","waves");
MSG_Add("MIXER_CONFIGFILE_HELP",
"nosound -- Enable silent mode, sound is still emulated though.\n"
@ -262,8 +262,6 @@ void DOSBOX_Init(void) {
" probably lower their sound quality.\n"
"blocksize -- Mixer block size, larger blocks might help sound stuttering\n"
" but sound will also be more lagged.\n"
"wavedir -- Directory where saved sound output goes when you use the\n"
" sound record key-combination, check README file.\n"
);
secprop=control->AddSection_prop("midi",&MIDI_Init);
@ -358,7 +356,6 @@ void DOSBOX_Init(void) {
);
// Mscdex
secprop->AddInitFunction(&MSCDEX_Init);
#if C_MODEM
secprop=control->AddSection_prop("modem",&MODEM_Init);
secprop->Add_bool("modem",true);
@ -369,6 +366,8 @@ void DOSBOX_Init(void) {
"modem -- Enable virtual modem emulation.\n"
"comport -- COM Port modem is connected to.\n"
"listenport -- TCP Port the momdem listens on for incoming connections.\n"
);
#endif
#if C_DIRECTSERIAL
secprop=control->AddSection_prop("directserial",&DIRECTSERIAL_Init);
secprop->Add_bool("directserial", true);
@ -379,10 +378,6 @@ void DOSBOX_Init(void) {
secprop->Add_int("bytesize", 8); // Could be 5 to 8
secprop->Add_int("stopbit", 1); // Could be 1 or 2
#endif
);
#endif
#if C_IPX
secprop=control->AddSection_prop("ipx",&IPX_Init);
secprop->Add_bool("ipx", true);
@ -390,14 +385,10 @@ void DOSBOX_Init(void) {
"ipx -- Enable ipx over UDP/IP emulation.\n"
);
#endif
secline=control->AddSection_line("autoexec",&AUTOEXEC_Init);
MSG_Add("AUTOEXEC_CONFIGFILE_HELP",
"Lines in this section will be run at startup.\n"
);
control->SetStartUp(&SHELL_Init);
}

View file

@ -20,14 +20,55 @@
This could do with a serious revision :)
*/
#include <dirent.h>
#include <string.h>
#include "dosbox.h"
#include "programs.h"
#include "hardware.h"
#include "setup.h"
#include "support.h"
static char * capturedir;
extern char * RunningProgram;
FILE * OpenCaptureFile(const char * type,const char * ext) {
Bitu last=0;
char file_name[CROSS_LEN];
char file_start[16];
DIR * dir;struct dirent * dir_ent;
/* Find a filename to open */
dir=opendir(capturedir);
if (!dir) {
LOG_MSG("Can't open dir %s for capturing %s",capturedir,type);
return 0;
}
strcpy(file_start,RunningProgram);
strcat(file_start,"_");
while ((dir_ent=readdir(dir))) {
char tempname[CROSS_LEN];
strcpy(tempname,dir_ent->d_name);
char * test=strstr(tempname,ext);
if (!test || strlen(test)!=strlen(ext)) continue;
*test=0;
if (strncasecmp(tempname,file_start,strlen(file_start))!=0) continue;
Bitu num=atoi(&tempname[strlen(file_start)]);
if (num>=last) last=num+1;
}
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) {
LOG_MSG("Capturing %s to %s",type,file_name);
} else {
LOG_MSG("Failed to open %s for capturing %s",file_name,type);
}
return handle;
}
void HARDWARE_Init(Section * sec) {
Section_prop * section=static_cast<Section_prop *>(sec);
capturedir=(char *)section->Get_string("captures");
}