mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-03 08:40:59 +00:00
- Made ResourceManager accessible from _vm
- Replaced c_version by its corresponding ScummVM equivalent command svn-id: r38775
This commit is contained in:
parent
85fe96b72d
commit
fcf5e87de6
@ -27,6 +27,7 @@
|
||||
|
||||
#include "sci/sci.h"
|
||||
#include "sci/console.h"
|
||||
#include "sci/include/sciresource.h"
|
||||
#include "sci/include/versions.h"
|
||||
|
||||
namespace Sci {
|
||||
@ -35,6 +36,7 @@ Console::Console(SciEngine *vm) : GUI::Debugger() {
|
||||
_vm = vm;
|
||||
|
||||
DCmd_Register("version", WRAP_METHOD(Console, cmdGetVersion));
|
||||
DCmd_Register("man", WRAP_METHOD(Console, cmdMan));
|
||||
}
|
||||
|
||||
Console::~Console() {
|
||||
@ -42,9 +44,52 @@ Console::~Console() {
|
||||
|
||||
bool Console::cmdGetVersion(int argc, const char **argv) {
|
||||
int ver = _vm->getVersion();
|
||||
DebugPrintf("SCI version: %d.%03d.%03d\n", SCI_VERSION_MAJOR(ver), SCI_VERSION_MINOR(ver), SCI_VERSION_PATCHLEVEL(ver));
|
||||
|
||||
DebugPrintf("Resource file version: %s\n", sci_version_types[_vm->getResMgr()->sci_version]);
|
||||
|
||||
DebugPrintf("Emulated interpreter version: %d.%03d.%03d\n",
|
||||
SCI_VERSION_MAJOR(ver), SCI_VERSION_MINOR(ver), SCI_VERSION_PATCHLEVEL(ver));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Console::cmdMan(int argc, const char **argv) {
|
||||
#if 0
|
||||
int section = 0;
|
||||
unsigned int i;
|
||||
char *name = cmd_params[0].str;
|
||||
char *c = strchr(name, '.');
|
||||
cmd_mm_entry_t *entry = 0;
|
||||
|
||||
if (c) {
|
||||
*c = 0;
|
||||
section = atoi(c + 1);
|
||||
}
|
||||
|
||||
if (section < 0 || section >= CMD_MM_ENTRIES) {
|
||||
DebugPrintf("Invalid section %d\n", section);
|
||||
return true;
|
||||
}
|
||||
|
||||
DebugPrintf("section:%d\n", section);
|
||||
if (section)
|
||||
entry = cmd_mm_find(name, section - 1);
|
||||
else
|
||||
for (i = 0; i < CMD_MM_ENTRIES && !section; i++) {
|
||||
if ((entry = cmd_mm_find(name, i)))
|
||||
section = i + 1;
|
||||
}
|
||||
|
||||
if (!entry) {
|
||||
DebugPrintf("No manual entry\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
DebugPrintf("-- %s: %s.%d\n", cmd_mm[section - 1].name, name, section);
|
||||
cmd_mm[section - 1].print(entry, 1);
|
||||
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace Sci
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
|
||||
private:
|
||||
bool cmdGetVersion(int argc, const char **argv);
|
||||
bool cmdMan(int argc, const char **argv);
|
||||
|
||||
private:
|
||||
SciEngine *_vm;
|
||||
|
@ -37,7 +37,6 @@ EngineState *con_gamestate = NULL;
|
||||
|
||||
// console commands
|
||||
|
||||
static int c_version(EngineState *s); // displays the package and version number
|
||||
static int c_list(EngineState *s); // lists various types of things
|
||||
static int c_man(EngineState *s); // 'manual page'
|
||||
static int c_set(EngineState *s); // sets an int variable
|
||||
@ -171,7 +170,6 @@ void con_init() {
|
||||
atexit(_cmd_exit);
|
||||
|
||||
// Hook up some commands
|
||||
con_hook_command(&c_version, "version", "", "Displays the version number");
|
||||
con_hook_command(&c_list, "list", "s*", "Lists various things (try 'list')");
|
||||
con_hook_command(&c_man, "man", "s", "Gives a short description of something");
|
||||
con_hook_command(&c_print, "print", "s", "Prints an int variable");
|
||||
@ -690,19 +688,6 @@ static int get_resource_number(char *resid) {
|
||||
return res;
|
||||
}
|
||||
|
||||
static int c_version(EngineState * s) {
|
||||
if (NULL == s) {
|
||||
sciprintf("console.c: c_version: NULL passed for parameter s\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
sciprintf("Resource file version: %s\n", sci_version_types[s->resmgr->sci_version]);
|
||||
sciprintf("Emulated interpreter version: %d.%03d.%03d\n", SCI_VERSION_MAJOR(s->version),
|
||||
SCI_VERSION_MINOR(s->version), SCI_VERSION_PATCHLEVEL(s->version));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int c_list_words(EngineState *s) {
|
||||
word_t **words;
|
||||
int words_nr;
|
||||
|
@ -200,7 +200,6 @@ Common::Error SciEngine::go() {
|
||||
} */
|
||||
|
||||
// FIXME/TODO: Move some of the stuff below to init()
|
||||
ResourceManager *resmgr;
|
||||
|
||||
init_console(); /* So we can get any output */
|
||||
|
||||
@ -217,25 +216,25 @@ Common::Error SciEngine::go() {
|
||||
char resource_dir[MAXPATHLEN+1] = "";
|
||||
getcwd(resource_dir, MAXPATHLEN); // Store resource directory
|
||||
|
||||
resmgr = new ResourceManager(res_version, 256 * 1024);
|
||||
_resmgr = new ResourceManager(res_version, 256 * 1024);
|
||||
|
||||
if (!resmgr) {
|
||||
if (!_resmgr) {
|
||||
printf("No resources found in '%s'.\nAborting...\n",
|
||||
resource_dir);
|
||||
return Common::kNoGameDataFoundError;
|
||||
}
|
||||
|
||||
script_adjust_opcode_formats(resmgr->sci_version);
|
||||
script_adjust_opcode_formats(_resmgr->sci_version);
|
||||
|
||||
#if 0
|
||||
printf("Mapping instruments to General Midi\n");
|
||||
|
||||
map_MIDI_instruments(resmgr);
|
||||
map_MIDI_instruments(_resmgr);
|
||||
#endif
|
||||
|
||||
EngineState* gamestate = (EngineState *) sci_malloc(sizeof(EngineState));
|
||||
memset(gamestate, 0, sizeof(EngineState));
|
||||
gamestate->resmgr = resmgr;
|
||||
gamestate->resmgr = _resmgr;
|
||||
gamestate->gfx_state = NULL;
|
||||
|
||||
if (init_gamestate(gamestate, version))
|
||||
@ -262,7 +261,7 @@ Common::Error SciEngine::go() {
|
||||
|
||||
gfx_state_t gfx_state;
|
||||
gfx_state.driver = &gfx_driver_scummvm;
|
||||
gfx_state.version = resmgr->sci_version;
|
||||
gfx_state.version = _resmgr->sci_version;
|
||||
gamestate->gfx_state = &gfx_state;
|
||||
|
||||
// Default config:
|
||||
@ -288,7 +287,7 @@ Common::Error SciEngine::go() {
|
||||
}
|
||||
// Default config ends
|
||||
|
||||
if (gfxop_init_default(&gfx_state, &gfx_options, resmgr)) {
|
||||
if (gfxop_init_default(&gfx_state, &gfx_options, _resmgr)) {
|
||||
fprintf(stderr, "Graphics initialization failed. Aborting...\n");
|
||||
return Common::kUnknownError;
|
||||
}
|
||||
@ -316,7 +315,7 @@ Common::Error SciEngine::go() {
|
||||
free(gamestate->work_dir);
|
||||
free(gamestate);
|
||||
|
||||
delete resmgr;
|
||||
delete _resmgr;
|
||||
|
||||
close_console_file();
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "engines/advancedDetector.h"
|
||||
|
||||
#include "sci/console.h"
|
||||
#include "sci/include/sciresource.h"
|
||||
|
||||
namespace Sci {
|
||||
|
||||
@ -84,12 +85,13 @@ public:
|
||||
Common::Language getLanguage() const;
|
||||
Common::Platform getPlatform() const;
|
||||
uint32 getFlags() const;
|
||||
|
||||
ResourceManager *getResMgr() { return _resmgr; }
|
||||
Common::String getSavegameName(int nr) const;
|
||||
|
||||
private:
|
||||
const SciGameDescription *_gameDescription;
|
||||
Console *_console;
|
||||
ResourceManager *_resmgr;
|
||||
};
|
||||
|
||||
} // End of namespace Sci
|
||||
|
Loading…
x
Reference in New Issue
Block a user