2012-06-29 16:49:59 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Copyright (C) 2012 FIX94
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
****************************************************************************/
|
2012-04-10 19:12:38 +02:00
|
|
|
#ifndef _PLUGIN_HPP_
|
|
|
|
#define _PLUGIN_HPP_
|
|
|
|
|
|
|
|
#include <fstream>
|
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
2012-05-06 14:03:43 +02:00
|
|
|
#include <vector>
|
2012-04-10 19:12:38 +02:00
|
|
|
|
|
|
|
#include "config/config.hpp"
|
2012-04-12 00:01:41 +02:00
|
|
|
#include "loader/disc.h"
|
2012-04-10 19:12:38 +02:00
|
|
|
|
2012-06-29 16:49:59 +02:00
|
|
|
using namespace std;
|
|
|
|
|
2012-06-09 13:06:47 +02:00
|
|
|
#define TAG_GAME_ID "{gameid}"
|
|
|
|
#define TAG_LOC "{loc}"
|
|
|
|
#define TAG_CONSOLE "{console}"
|
2012-04-10 19:12:38 +02:00
|
|
|
|
2012-11-04 20:22:02 +01:00
|
|
|
#define PLUGIN_INI_DEF "PLUGIN"
|
2012-10-01 21:55:55 +02:00
|
|
|
#define PLUGIN_DEV "{device}"
|
|
|
|
#define PLUGIN_PATH "{path}"
|
|
|
|
#define PLUGIN_NAME "{name}"
|
|
|
|
#define PLUGIN_LDR "{loader}"
|
|
|
|
|
2012-05-01 15:30:16 +02:00
|
|
|
struct PluginOptions
|
|
|
|
{
|
|
|
|
u32 magicWord;
|
2012-10-01 21:55:55 +02:00
|
|
|
u32 caseColor;
|
2012-05-01 15:30:16 +02:00
|
|
|
string DolName;
|
|
|
|
string coverFolder;
|
2012-06-08 21:29:23 +02:00
|
|
|
string consoleCoverID;
|
2012-10-01 21:55:55 +02:00
|
|
|
string BannerSound;
|
|
|
|
u32 BannerSoundSize;
|
|
|
|
vector<string> Args;
|
2012-05-11 20:46:43 +02:00
|
|
|
wstringEx DisplayName;
|
2012-05-01 15:30:16 +02:00
|
|
|
};
|
|
|
|
|
2012-04-10 19:12:38 +02:00
|
|
|
class Plugin
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool AddPlugin(Config &plugin);
|
2012-11-18 14:40:26 +01:00
|
|
|
u8 *GetBannerSound(u32 magic);
|
2012-04-10 19:12:38 +02:00
|
|
|
u32 GetBannerSoundSize();
|
2012-11-18 14:40:26 +01:00
|
|
|
const char *GetDolName(u32 magic);
|
|
|
|
const char *GetCoverFolderName(u32 magic);
|
2012-10-04 16:35:08 +02:00
|
|
|
string GenerateCoverLink(dir_discHdr gameHeader, const string& constURL, Config &Checksums);
|
2012-05-05 22:07:54 +02:00
|
|
|
wstringEx GetPluginName(u8 pos);
|
|
|
|
u32 getPluginMagic(u8 pos);
|
|
|
|
bool PluginExist(u8 pos);
|
|
|
|
void SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode = 0);
|
2012-10-13 00:25:22 +02:00
|
|
|
const vector<bool> &GetEnabledPlugins(Config &cfg);
|
2012-10-04 16:35:08 +02:00
|
|
|
vector<string> CreateArgs(const string& device, const string& path,
|
|
|
|
const string& title, const string& loader, u32 magic);
|
|
|
|
void init(const string& m_pluginsDir);
|
2012-04-10 19:12:38 +02:00
|
|
|
void Cleanup();
|
|
|
|
void EndAdd();
|
2012-10-13 00:25:22 +02:00
|
|
|
vector<dir_discHdr> ParseScummvmINI(Config &ini, const char *Device, u32 MagicWord);
|
2012-04-10 19:12:38 +02:00
|
|
|
private:
|
2012-05-04 20:05:41 +02:00
|
|
|
s8 GetPluginPosition(u32 magic);
|
2012-05-06 14:03:43 +02:00
|
|
|
vector<PluginOptions> Plugins;
|
2012-10-04 16:35:08 +02:00
|
|
|
vector<bool> enabledPlugins;
|
2012-11-01 17:39:42 +01:00
|
|
|
char PluginMagicWord[9];
|
2012-05-04 20:05:41 +02:00
|
|
|
s8 Plugin_Pos;
|
2012-04-10 19:12:38 +02:00
|
|
|
string pluginsDir;
|
|
|
|
bool adding;
|
|
|
|
};
|
2012-11-04 15:13:42 +01:00
|
|
|
|
|
|
|
extern Plugin m_plugin;
|
|
|
|
|
2012-04-10 19:12:38 +02:00
|
|
|
#endif
|