controller_patcher/config_parser.h
Maschell aa0ce59f87 Huge commit
Changelog:

Bugfixes:
- Fixes the still moving mouse in aim mode, when mouse is actually not
moving
- Fixed a bug at initializing the config_controller_list;
- Fixed the support for almost all mouses that uses the normal HID mouse
standard (boot mode).
- The emulated sticks are now supported correctly
- The stick now only produces valid values. Stick absusing not possible
anymore

New features:
- Added support for config files that can be read from an SD Card.
- Added support for more keyboard buttons
- Added support for gamepad button remapping
- Made the double used buttons on the GC Pad configuable
- The keyboard can now emulate the sticks correctly
- Keyboard buttons for the sticks can be set
- The mouse buttons can now be configured
- The mouse can be configured to emulate the left stick
- Added support for one more DPAD mode (CONTRPDM_Absolute_2Values)

Other:
- Removed the support for the PS2 Adapter and Saitek P2600, but they can
be added trough a config file.
- The engine now uses 16 hardcoded slots the devices can use.
- cleaned up the logging output
- Logging of the currently pressed buttons possible

and more little things I dont remember
2016-08-03 20:46:46 +02:00

76 lines
1.9 KiB
C++

/****************************************************************************
* Copyright (C) 2016 Maschell
*
* 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/>.
****************************************************************************/
#ifndef _ConfigParser_H_
#define _ConfigParser_H_
#include <string>
#include <vector>
#include <map>
#include <stdio.h>
#include <gctypes.h>
#include "controller_patcher.h"
#include "pad_const.h"
#include "utils/logger.h"
#include "cp_retain_vars.h"
enum PARSE_TYPE{
PARSE_CONTROLLER,
PARSE_GAMEPAD,
PARSE_MOUSE,
PARSE_KEYBOARD
};
class ConfigParser
{
public:
//!Constructor
ConfigParser(std::string configData);
//!Destructor
~ConfigParser();
PARSE_TYPE getType();
void setType(PARSE_TYPE newType);
u16 getSlot();
void setSlot(u16 newSlot);
bool parseIni();
private:
bool Init();
bool parseConfigString(std::string content);
int getSlotController(std::string identify);
int checkExistingController(int vid, int pid);
int getValueFromKeyValue(std::string value_pair,std::string expectedKey,std::string delimiter);
bool resetConfig();
void parseSingleLine(std::string line);
u16 slot_b;
PARSE_TYPE type_b;
std::string content;
std::vector<std::string> contentLines;
};
#endif