SCI32: Partially implement kCD
This commit is contained in:
parent
051eae4639
commit
0a4a2567a3
5 changed files with 58 additions and 20 deletions
|
@ -610,6 +610,8 @@ reg_t kSave(EngineState *s, int argc, reg_t *argv);
|
||||||
reg_t kAutoSave(EngineState *s, int argc, reg_t *argv);
|
reg_t kAutoSave(EngineState *s, int argc, reg_t *argv);
|
||||||
reg_t kList(EngineState *s, int argc, reg_t *argv);
|
reg_t kList(EngineState *s, int argc, reg_t *argv);
|
||||||
reg_t kCD(EngineState *s, int argc, reg_t *argv);
|
reg_t kCD(EngineState *s, int argc, reg_t *argv);
|
||||||
|
reg_t kCheckCD(EngineState *s, int argc, reg_t *argv);
|
||||||
|
reg_t kGetSavedCD(EngineState *s, int argc, reg_t *argv);
|
||||||
reg_t kAddPicAt(EngineState *s, int argc, reg_t *argv);
|
reg_t kAddPicAt(EngineState *s, int argc, reg_t *argv);
|
||||||
reg_t kAddBefore(EngineState *s, int argc, reg_t *argv);
|
reg_t kAddBefore(EngineState *s, int argc, reg_t *argv);
|
||||||
reg_t kMoveToFront(EngineState *s, int argc, reg_t *argv);
|
reg_t kMoveToFront(EngineState *s, int argc, reg_t *argv);
|
||||||
|
|
|
@ -395,6 +395,13 @@ static const SciKernelMapSubEntry kBitmap_subops[] = {
|
||||||
SCI_SUBOPENTRY_TERMINATOR
|
SCI_SUBOPENTRY_TERMINATOR
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// version, subId, function-mapping, signature, workarounds
|
||||||
|
static const SciKernelMapSubEntry kCD_subops[] = {
|
||||||
|
{ SIG_SINCE_SCI21MID, 0, MAP_CALL(CheckCD), "(i)", NULL },
|
||||||
|
{ SIG_SINCE_SCI21MID, 1, MAP_CALL(GetSavedCD), "", NULL },
|
||||||
|
SCI_SUBOPENTRY_TERMINATOR
|
||||||
|
};
|
||||||
|
|
||||||
// version, subId, function-mapping, signature, workarounds
|
// version, subId, function-mapping, signature, workarounds
|
||||||
static const SciKernelMapSubEntry kList_subops[] = {
|
static const SciKernelMapSubEntry kList_subops[] = {
|
||||||
{ SIG_SINCE_SCI21, 0, MAP_CALL(NewList), "", NULL },
|
{ SIG_SINCE_SCI21, 0, MAP_CALL(NewList), "", NULL },
|
||||||
|
@ -871,7 +878,7 @@ static SciKernelMapEntry s_kernelMap[] = {
|
||||||
{ MAP_DUMMY(PointSize), SIG_EVERYWHERE, "(.*)", NULL, NULL },
|
{ MAP_DUMMY(PointSize), SIG_EVERYWHERE, "(.*)", NULL, NULL },
|
||||||
|
|
||||||
// SCI2.1 Kernel Functions
|
// SCI2.1 Kernel Functions
|
||||||
{ MAP_CALL(CD), SIG_EVERYWHERE, "(.*)", NULL, NULL },
|
{ MAP_CALL(CD), SIG_SINCE_SCI21MID, SIGFOR_ALL, "(.*)", kCD_subops, NULL },
|
||||||
{ MAP_CALL(IsOnMe), SIG_EVERYWHERE, "iioi", NULL, NULL },
|
{ MAP_CALL(IsOnMe), SIG_EVERYWHERE, "iioi", NULL, NULL },
|
||||||
{ MAP_CALL(List), SIG_SINCE_SCI21, SIGFOR_ALL, "(.*)", kList_subops, NULL },
|
{ MAP_CALL(List), SIG_SINCE_SCI21, SIGFOR_ALL, "(.*)", kList_subops, NULL },
|
||||||
{ MAP_CALL(MulDiv), SIG_EVERYWHERE, "iii", NULL, NULL },
|
{ MAP_CALL(MulDiv), SIG_EVERYWHERE, "iii", NULL, NULL },
|
||||||
|
|
|
@ -40,6 +40,9 @@
|
||||||
#include "sci/engine/savegame.h"
|
#include "sci/engine/savegame.h"
|
||||||
#include "sci/sound/audio.h"
|
#include "sci/sound/audio.h"
|
||||||
#include "sci/console.h"
|
#include "sci/console.h"
|
||||||
|
#ifdef ENABLE_SCI32
|
||||||
|
#include "sci/resource.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Sci {
|
namespace Sci {
|
||||||
|
|
||||||
|
@ -196,26 +199,25 @@ reg_t kValidPath(EngineState *s, int argc, reg_t *argv) {
|
||||||
#ifdef ENABLE_SCI32
|
#ifdef ENABLE_SCI32
|
||||||
|
|
||||||
reg_t kCD(EngineState *s, int argc, reg_t *argv) {
|
reg_t kCD(EngineState *s, int argc, reg_t *argv) {
|
||||||
// TODO: Stub
|
if (!s)
|
||||||
switch (argv[0].toUint16()) {
|
return make_reg(0, getSciVersion());
|
||||||
case 0:
|
error("not supposed to call this");
|
||||||
if (argc == 1) {
|
}
|
||||||
// Check if a disc is in the drive
|
|
||||||
return TRUE_REG;
|
reg_t kCheckCD(EngineState *s, int argc, reg_t *argv) {
|
||||||
} else {
|
const int16 cdNo = argc > 0 ? argv[0].toSint16() : 0;
|
||||||
// Check if the specified disc is in the drive
|
|
||||||
// and return the current disc number. We just
|
if (cdNo) {
|
||||||
// return the requested disc number.
|
g_sci->getResMan()->findDisc(cdNo);
|
||||||
return argv[1];
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
// Return the current CD number
|
|
||||||
return make_reg(0, 1);
|
|
||||||
default:
|
|
||||||
warning("CD(%d)", argv[0].toUint16());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL_REG;
|
return make_reg(0, g_sci->getResMan()->getCurrentDiscNo());
|
||||||
|
}
|
||||||
|
|
||||||
|
reg_t kGetSavedCD(EngineState *s, int argc, reg_t *argv) {
|
||||||
|
// TODO: This is wrong, CD number needs to be available prior to
|
||||||
|
// the save game being loaded
|
||||||
|
return make_reg(0, g_sci->getResMan()->getCurrentDiscNo());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -859,6 +859,13 @@ void ResourceManager::addResourcesFromChunk(uint16 id) {
|
||||||
scanNewSources();
|
scanNewSources();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResourceManager::findDisc(const int16 discNo) {
|
||||||
|
// Since all resources are expected to be copied from the original discs
|
||||||
|
// into a single game directory, this call just records the number of the CD
|
||||||
|
// that the game has requested
|
||||||
|
_currentDiscNo = discNo;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ResourceManager::freeResourceSources() {
|
void ResourceManager::freeResourceSources() {
|
||||||
|
@ -878,7 +885,9 @@ void ResourceManager::init() {
|
||||||
_LRU.clear();
|
_LRU.clear();
|
||||||
_resMap.clear();
|
_resMap.clear();
|
||||||
_audioMapSCI1 = NULL;
|
_audioMapSCI1 = NULL;
|
||||||
|
#ifdef ENABLE_SCI32
|
||||||
|
_currentDiscNo = 1;
|
||||||
|
#endif
|
||||||
// FIXME: put this in an Init() function, so that we can error out if detection fails completely
|
// FIXME: put this in an Init() function, so that we can error out if detection fails completely
|
||||||
|
|
||||||
_mapVersion = detectMapVersion();
|
_mapVersion = detectMapVersion();
|
||||||
|
|
|
@ -397,6 +397,24 @@ public:
|
||||||
* resource manager.
|
* resource manager.
|
||||||
*/
|
*/
|
||||||
void addResourcesFromChunk(uint16 id);
|
void addResourcesFromChunk(uint16 id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the currently active disc number.
|
||||||
|
*/
|
||||||
|
void findDisc(const int16 discNo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the currently active disc number.
|
||||||
|
*/
|
||||||
|
int16 getCurrentDiscNo() const { return _currentDiscNo; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The currently active disc number.
|
||||||
|
*/
|
||||||
|
int16 _currentDiscNo;
|
||||||
|
|
||||||
|
public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool detectHires();
|
bool detectHires();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue