~ubuntu-branches/ubuntu/lucid/fceux/lucid

« back to all changes in this revision

Viewing changes to fceu/src/fceulua.h

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2009-12-14 08:05:17 UTC
  • Revision ID: james.westby@ubuntu.com-20091214080517-abi5tj8avthfan7c
Tags: upstream-2.1.2+repack
ImportĀ upstreamĀ versionĀ 2.1.2+repack

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifdef _S9XLUA_H
 
2
 
 
3
enum LuaCallID
 
4
{
 
5
        LUACALL_BEFOREEMULATION,
 
6
        LUACALL_AFTEREMULATION,
 
7
        LUACALL_BEFOREEXIT,
 
8
        LUACALL_BEFORESAVE,
 
9
        LUACALL_AFTERLOAD,
 
10
 
 
11
        LUACALL_COUNT
 
12
};
 
13
extern void CallRegisteredLuaFunctions(LuaCallID calltype);
 
14
 
 
15
enum LuaMemHookType
 
16
{
 
17
        LUAMEMHOOK_WRITE,
 
18
        LUAMEMHOOK_READ,
 
19
        LUAMEMHOOK_EXEC,
 
20
        LUAMEMHOOK_WRITE_SUB,
 
21
        LUAMEMHOOK_READ_SUB,
 
22
        LUAMEMHOOK_EXEC_SUB,
 
23
 
 
24
        LUAMEMHOOK_COUNT
 
25
};
 
26
void CallRegisteredLuaMemHook(unsigned int address, int size, unsigned int value, LuaMemHookType hookType);
 
27
 
 
28
struct LuaSaveData
 
29
{
 
30
        LuaSaveData() { recordList = 0; }
 
31
        ~LuaSaveData() { ClearRecords(); }
 
32
 
 
33
        struct Record
 
34
        {
 
35
                unsigned int key; // crc32
 
36
                unsigned int size; // size of data
 
37
                unsigned char* data;
 
38
                Record* next;
 
39
        };
 
40
 
 
41
        Record* recordList;
 
42
 
 
43
        void SaveRecord(struct lua_State* L, unsigned int key); // saves Lua stack into a record and pops it
 
44
        void LoadRecord(struct lua_State* L, unsigned int key, unsigned int itemsToLoad) const; // pushes a record's data onto the Lua stack
 
45
        void SaveRecordPartial(struct lua_State* L, unsigned int key, int idx); // saves part of the Lua stack (at the given index) into a record and does NOT pop anything
 
46
 
 
47
        void ExportRecords(void* file) const; // writes all records to an already-open file
 
48
        void ImportRecords(void* file); // reads records from an already-open file
 
49
        void ClearRecords(); // deletes all record data
 
50
 
 
51
private:
 
52
        // disallowed, it's dangerous to call this
 
53
        // (because the memory the destructor deletes isn't refcounted and shouldn't need to be copied)
 
54
        // so pass LuaSaveDatas by reference and this should never get called
 
55
        LuaSaveData(const LuaSaveData& copy) {}
 
56
};
 
57
 
 
58
#define LUA_DATARECORDKEY 42
 
59
 
 
60
void CallRegisteredLuaSaveFunctions(int savestateNumber, LuaSaveData& saveData);
 
61
void CallRegisteredLuaLoadFunctions(int savestateNumber, const LuaSaveData& saveData);
 
62
 
 
63
// Just forward function declarations 
 
64
 
 
65
void FCEU_LuaFrameBoundary();
 
66
int FCEU_LoadLuaCode(const char *filename);
 
67
void FCEU_ReloadLuaCode();
 
68
void FCEU_LuaStop();
 
69
int FCEU_LuaRunning();
 
70
 
 
71
uint8 FCEU_LuaReadJoypad(int,uint8); // HACK - Function needs controller input
 
72
int FCEU_LuaSpeed();
 
73
int FCEU_LuaFrameskip();
 
74
int FCEU_LuaRerecordCountSkip();
 
75
 
 
76
void FCEU_LuaGui(uint8 *XBuf);
 
77
void FCEU_LuaUpdatePalette();
 
78
 
 
79
struct lua_State* FCEU_GetLuaState();
 
80
char* FCEU_GetLuaScriptName();
 
81
 
 
82
// And some interesting REVERSE declarations!
 
83
char *FCEU_GetFreezeFilename(int slot);
 
84
 
 
85
 
 
86
#endif