Merge branch 'master' into ZSMv1
This commit is contained in:
commit
40d67d7bb5
757 changed files with 4340 additions and 359 deletions
64
src/main.cpp
64
src/main.cpp
|
|
@ -141,20 +141,37 @@ TAParamResult pVersion(String) {
|
|||
printf("- libsndfile by Erik de Castro Lopo and rest of libsndfile team (LGPLv2.1)\n");
|
||||
printf("- SDL2 by Sam Lantinga (zlib license)\n");
|
||||
printf("- zlib by Jean-loup Gailly and Mark Adler (zlib license)\n");
|
||||
printf("- RtMidi by Gary P. Scavone (RtMidi license)\n");
|
||||
printf("- backward-cpp by Google (MIT)\n");
|
||||
printf("- Dear ImGui by Omar Cornut (MIT)\n");
|
||||
printf("- Portable File Dialogs by Sam Hocevar (WTFPL)\n");
|
||||
printf("- Native File Dialog (modified version) by Frogtoss Games (zlib license)\n");
|
||||
printf("- FFTW by Matteo Frigo and Steven G. Johnson (GPLv2)\n");
|
||||
printf("- Nuked-OPM by Nuke.YKT (LGPLv2.1)\n");
|
||||
printf("- Nuked-OPN2 by Nuke.YKT (LGPLv2.1)\n");
|
||||
printf("- Nuked-OPL3 by Nuke.YKT (LGPLv2.1)\n");
|
||||
printf("- Nuked-OPLL by Nuke.YKT (GPLv2)\n");
|
||||
printf("- Nuked-PSG (modified version) by Nuke.YKT (GPLv2)\n");
|
||||
printf("- ymfm by Aaron Giles (BSD 3-clause)\n");
|
||||
printf("- adpcm by superctr (public domain)\n");
|
||||
printf("- MAME SN76496 emulation core by Nicola Salmoria (BSD 3-clause)\n");
|
||||
printf("- MAME AY-3-8910 emulation core by Couriersud (BSD 3-clause)\n");
|
||||
printf("- MAME SAA1099 emulation core by Juergen Buchmueller and Manuel Abadia (BSD 3-clause)\n");
|
||||
printf("- SAASound (BSD 3-clause)\n");
|
||||
printf("- MAME Namco WSG by Nicola Salmoria and Aaron Giles (BSD 3-clause)\n");
|
||||
printf("- MAME RF5C68 core by Olivier Galibert and Aaron Giles (BSD 3-clause)\n");
|
||||
printf("- MAME MSM6258 core by Barry Rodewald (BSD 3-clause)\n");
|
||||
printf("- MAME YMZ280B core by Aaron Giles (BSD 3-clause)\n");
|
||||
printf("- QSound core by superctr (BSD 3-clause)\n");
|
||||
printf("- VICE VIC-20 by Rami Rasanen and viznut (GPLv2)\n");
|
||||
printf("- VERA core by Frank van den Hoef (BSD 2-clause)\n");
|
||||
printf("- SAASound by Dave Hooper and Simon Owen (BSD 3-clause)\n");
|
||||
printf("- SameBoy by Lior Halphon (MIT)\n");
|
||||
printf("- Mednafen PCE by Mednafen Team (GPLv2)\n");
|
||||
printf("- Mednafen PCE and WonderSwan by Mednafen Team (GPLv2)\n");
|
||||
printf("- puNES by FHorse (GPLv2)\n");
|
||||
printf("- NSFPlay by Brad Smith and Brezza (unknown open-source license)\n");
|
||||
printf("- reSID by Dag Lem (GPLv2)\n");
|
||||
printf("- Stella by Stella Team (GPLv2)\n");
|
||||
printf("- vgsound_emu by cam900 (BSD 3-clause)\n");
|
||||
printf("- vgsound_emu (first version) by cam900 (BSD 3-clause)\n");
|
||||
return TA_PARAM_QUIT;
|
||||
}
|
||||
|
||||
|
|
@ -249,6 +266,17 @@ void initParams() {
|
|||
params.push_back(TAParam("W","warranty",false,pWarranty,"","view warranty disclaimer."));
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void reportError(String what) {
|
||||
logE("%s",what);
|
||||
MessageBox(NULL,what.c_str(),"Furnace",MB_OK|MB_ICONERROR);
|
||||
}
|
||||
#else
|
||||
void reportError(String what) {
|
||||
logE("%s",what);
|
||||
}
|
||||
#endif
|
||||
|
||||
// TODO: CoInitializeEx on Windows?
|
||||
// TODO: add crash log
|
||||
int main(int argc, char** argv) {
|
||||
|
|
@ -290,7 +318,7 @@ int main(int argc, char** argv) {
|
|||
val=argv[i+1];
|
||||
i++;
|
||||
} else {
|
||||
logE("incomplete param %s.",arg.c_str());
|
||||
reportError(fmt::sprintf("incomplete param %s.",arg.c_str()));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -344,53 +372,54 @@ int main(int argc, char** argv) {
|
|||
logI("loading module...");
|
||||
FILE* f=ps_fopen(fileName.c_str(),"rb");
|
||||
if (f==NULL) {
|
||||
perror("error");
|
||||
reportError(fmt::sprintf("couldn't open file! (%s)",strerror(errno)));
|
||||
return 1;
|
||||
}
|
||||
if (fseek(f,0,SEEK_END)<0) {
|
||||
perror("size error");
|
||||
reportError(fmt::sprintf("couldn't open file! (couldn't get file size: %s)",strerror(errno)));
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
ssize_t len=ftell(f);
|
||||
if (len==(SIZE_MAX>>1)) {
|
||||
perror("could not get file length");
|
||||
reportError(fmt::sprintf("couldn't open file! (couldn't get file length: %s)",strerror(errno)));
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
if (len<1) {
|
||||
if (len==0) {
|
||||
printf("that file is empty!\n");
|
||||
reportError("that file is empty!");
|
||||
} else {
|
||||
perror("tell error");
|
||||
reportError(fmt::sprintf("couldn't open file! (tell error: %s)",strerror(errno)));
|
||||
}
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
unsigned char* file=new unsigned char[len];
|
||||
if (fseek(f,0,SEEK_SET)<0) {
|
||||
perror("size error");
|
||||
reportError(fmt::sprintf("couldn't open file! (size error: %s)",strerror(errno)));
|
||||
fclose(f);
|
||||
delete[] file;
|
||||
return 1;
|
||||
}
|
||||
if (fread(file,1,(size_t)len,f)!=(size_t)len) {
|
||||
perror("read error");
|
||||
reportError(fmt::sprintf("couldn't open file! (read error: %s)",strerror(errno)));
|
||||
fclose(f);
|
||||
delete[] file;
|
||||
return 1;
|
||||
}
|
||||
fclose(f);
|
||||
if (!e.load(file,(size_t)len)) {
|
||||
logE("could not open file!");
|
||||
reportError(fmt::sprintf("could not open file! (%s)",e.getLastError()));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (!e.init()) {
|
||||
logE("could not initialize engine!");
|
||||
if (consoleMode) {
|
||||
reportError("could not initialize engine!");
|
||||
return 1;
|
||||
} else {
|
||||
logE("could not initialize engine!");
|
||||
displayEngineFailError=true;
|
||||
}
|
||||
}
|
||||
|
|
@ -403,12 +432,12 @@ int main(int argc, char** argv) {
|
|||
fwrite(w->getFinalBuf(),1,w->size(),f);
|
||||
fclose(f);
|
||||
} else {
|
||||
logE("could not open file! %s",strerror(errno));
|
||||
reportError(fmt::sprintf("could not open file! (%s)",e.getLastError()));
|
||||
}
|
||||
w->finish();
|
||||
delete w;
|
||||
} else {
|
||||
logE("could not write VGM!");
|
||||
reportError("could not write VGM!");
|
||||
}
|
||||
}
|
||||
if (outName!="") {
|
||||
|
|
@ -443,7 +472,10 @@ int main(int argc, char** argv) {
|
|||
|
||||
#ifdef HAVE_GUI
|
||||
g.bindEngine(&e);
|
||||
if (!g.init()) return 1;
|
||||
if (!g.init()) {
|
||||
reportError("error while starting GUI!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (displayEngineFailError) {
|
||||
logE("displaying engine fail error.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue