Clean up, remove some unused features, some refactoring, bump WUPS version to 0.4

This commit is contained in:
Maschell 2021-03-16 17:31:20 +01:00
parent e68f56e411
commit 1fcd3b4b17
45 changed files with 73 additions and 3212 deletions

View File

@ -1,7 +0,0 @@
sudo: required
services:
- docker
script:
- docker run -it --rm -v ${PWD}:/project wiiulegacy/core:0.1 /bin/bash -c "(cd project && make clean && make)"

View File

@ -2,7 +2,7 @@ TOPDIR ?= $(CURDIR)
include $(TOPDIR)/share/wups_rules
export WUT_MAJOR := 0
export WUT_MINOR := 3
export WUT_MINOR := 4
export WUT_PATCH := 0
VERSION := $(WUT_MAJOR).$(WUT_MINOR).$(WUT_PATCH)
@ -16,7 +16,7 @@ VERSION := $(WUT_MAJOR).$(WUT_MINOR).$(WUT_PATCH)
#---------------------------------------------------------------------------------
TARGET := wups
#BUILD := build
SOURCES := libraries/libwups/ libraries/libwups/config
SOURCES := libraries/libwups/
DATA := data
INCLUDES := include

129
PLANS.MD
View File

@ -1,129 +0,0 @@
#Plans and ideas
# Goal
The goal is provide a mechanism to modifiy your Wii U experience in a modular way.
Currently each features has it's own application (TCPGecko, SwapDRC, HIDtoVPAD, SDCafiine) and you can only start one applicationa the same time.
This means, you can't mix any of these features. One way would be to create an own App for each feature combination (like geckiine) or create one app that has all features.
Both approaches have the same disadvantage, it's nearly impossible (and time consuming) to support everthing requested/possible.
The idea is now:
- Each feature will be deployed as an individual module/plugin
- These modules will be loaded with ONE generic loader
- And can be mixed in any way
- A GUI can (de)activate them without any new compiling
- Everything can be handled easily on the console itself
# Planned features
## Short-term goals
Possbile to create a plugin which:
* can override existing system function
* provide a hook function which will be called
* on each start of an application
* everytime a application will be closed
* on each frame
* can be combined with other plugins
With an simple, generic loader which:
* Loads the plugins from the SDCard
* Combines them and use them ALL at the same time.
General:
* Port some currently available tools.
## Mid-term goals
General:
- Port all common applications like TCPGecko etc.
Loader:
- Allow to patch the currently loaded RPX
- This would lead game binaries
More advanced plugin loader:
- Create configuration system:
- (de)activate certain plugin only in set applications.
- (de)activate plugins completly without removing them from the SDCard.
## Long-term goals
Even more advanced plugin loader:
- Downloading plugins directly on the console
- Updatin existing plugins
- Share configurations with other user
- Allow the plugin to have an own configuration window.
# Technical problems
To achieve this, serveral "problems" need to be resolved (feature need to be implemented).
This is just an short overview. Look at the issued for detailed information.
### plugin
- Create an stable interface the plugins will use.
- with hooks for
- application start
- application end
- each frame
- functions
- some way to configure them?
- Prodivde the plugin as a .elf?
- Keep the file ending?
- Compress/zip it?
- How to add meta information?
- Compatibility with
- Plugin loader
- Wii U FW
- Information about the plugin
- Author(s)
- Version
- Description
- Linking / building
- How to link the files
- Write a proper (base) makefile
- Is position independent code possible?
- Is it reliable?
- If not, how does elf relocation work?
## function patching
- (elf relocation)
- use the information from the plugin
- parse it
- HOW to store it?
- save the patching order
- add basic disable/enable mechanism
## general
- provided general hooking points
- How to store the plugins
- Where is enough, unused space
- keep tracking of the plugins
- simple gui?
- provide functions?
- like libfat, libiosu activated
- kernel copy function
- pass information into the plugins
- Running on which FW
- arguments?
- ???
# Similar projects
## function-patcher-example
Platform: Wii U
Notes: TODO
https://github.com/Maschell/function-patcher-example
## COSSubstrate
Platform: Wii U
Notes: TODO
https://github.com/QuarkTheAwesome/COSSubstrate
## brainslug-wii
Platform: Wii
Notes: TODO
https://github.com/Chadderz121/brainslug-wii
## substitute
Platform: IOS
Notes: TODO
https://github.com/comex/substitute

View File

@ -27,8 +27,8 @@
#define WUPS_H_
#include "wups/common.h"
#include "wups/meta.h"
#include "wups/function_patching.h"
#include "wups/hooks.h"
#include "wups/utils.h"
#endif /* WUPS_WUPS_H_ */

View File

@ -45,14 +45,6 @@ extern "C" {
extern const char wups_meta_ ## id [] WUPS_SECTION("meta"); \
const char wups_meta_ ## id [] = #id "=" value
#define WUPS_PLUGIN_NAME(x) WUPS_META(name, x); WUPS_META(wups, "0.2"); WUPS_META(buildtimestamp, __DATE__ " " __TIME__)
#define WUPS_PLUGIN_AUTHOR(x) WUPS_META(author, x)
#define WUPS_PLUGIN_VERSION(x) WUPS_META(version, x)
#define WUPS_PLUGIN_LICENSE(x) WUPS_META(license, x)
#define WUPS_PLUGIN_DESCRIPTION(x) WUPS_META(description, x)
#define WUPS_PLUGIN_ID(x) WUPS_META(id, x)
#define WUPS_PLUGIN_CONFIG_REVISION(x) WUPS_META(config_revision, #x)
#ifdef __cplusplus
}
#endif

View File

@ -1,30 +0,0 @@
/****************************************************************************
* Copyright (C) 2018 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 WUPS_CONFIG_HOOKS_DEF_H_
#define WUPS_CONFIG_HOOKS_DEF_H_
#include "hooks.h"
#include "config/WUPSConfig.h"
#define WUPS_GET_CONFIG() \
WUPSConfig* get_config();\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_GET_CONFIG,get_config); \
WUPSConfig* get_config()
#endif /* WUPS_CONFIG_HOOKS_DEF_H_ */

View File

@ -1,87 +0,0 @@
/****************************************************************************
* Copyright (C) 2018 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 _WUPS_CONFIG_H_
#define _WUPS_CONFIG_H_
#include <string>
#include <vector>
#include <wups/config/WUPSConfigCategory.h>
class WUPSConfig {
public:
WUPSConfig(std::string name) {
this->name = name;
}
~WUPSConfig() {
for (auto & element : categories) {
delete element;
}
}
/**
\return Returns the name of this WUPSConfig
**/
std::string getName(){
return this->name;
}
/**
\brief Creates a new WUPSCategory add its to this WUPSConfig.
The category will be added to the end of the list.
This class holds responsibility for deleting the created instance.
\param categoryName: The name of the category that will be created.
\return On success, the created and inserted category will be returned.
**/
WUPSConfigCategory * addCategory(std::string categoryName){
WUPSConfigCategory * curCat = new WUPSConfigCategory(categoryName);
categories.push_back(curCat);
return curCat;
}
/**
\brief Adds a given WUPSConfigCategory to this WUPSConfig.
The category will be added to the end of the list.
This class holds responsibility for deleting the created instance.
\param category: The category that will be added to this config.
\return On success, the inserted category will be returned.
On error NULL will be returned. In this case the caller still has the responsibility
for deleting the WUPSConfigCategory instance.
**/
WUPSConfigCategory * addCategory(WUPSConfigCategory * category){
categories.push_back(category);
return category;
}
/**
\return Returns a vector with all categories.
**/
std::vector<WUPSConfigCategory *> getCategories(){
return this->categories;
}
private:
std::string name;
std::vector<WUPSConfigCategory *> categories;
};
#endif

View File

@ -1,72 +0,0 @@
/****************************************************************************
* Copyright (C) 2018 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 _WUPS_CONFIG_CATEGORY_H_
#define _WUPS_CONFIG_CATEGORY_H_
#include <string>
#include <vector>
#include <wups/config/WUPSConfigItem.h>
class WUPSConfigCategory {
public:
WUPSConfigCategory(std::string name) {
this->name = name;
}
~WUPSConfigCategory() {
for (auto & element : items) {
delete element;
}
}
/**
\return Returns the name of this WUPSConfigCategory
**/
std::string getName(){
return this->name;
}
/**
\brief Adds a given WUPSConfigItem to this WUPSConfigCategory.
The item will be added to the end of the list.
This class holds responsibility for deleting the created instance.
\param item: The item that will be added to this config.
\return On success, the inserted item will be returned.
On error NULL will be returned. In this case the caller still has the responsibility
for deleting the WUPSConfigItem instance.
**/
WUPSConfigItem * addItem(WUPSConfigItem * item){
items.push_back(item);
return item;
}
/**
\return Returns a vector with all items.
**/
std::vector<WUPSConfigItem *> getItems(){
return this->items;
}
private:
std::string name;
std::vector<WUPSConfigItem *> items;
};
#endif

View File

@ -1,165 +0,0 @@
/****************************************************************************
* Copyright (C) 2018 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 _WUPS_CONFIG_ITEM_H_
#define _WUPS_CONFIG_ITEM_H_
#include <string>
#include <vector>
#include "../utils.h"
#define WUPS_CONFIG_BUTTON_NONE 0
#define WUPS_CONFIG_BUTTON_LEFT (1<<0)
#define WUPS_CONFIG_BUTTON_RIGHT (1<<1)
#define WUPS_CONFIG_BUTTON_UP (1<<2)
#define WUPS_CONFIG_BUTTON_DOWN (1<<3)
#define WUPS_CONFIG_BUTTON_A (1<<4)
#define WUPS_CONFIG_BUTTON_B (1<<5)
#define WUPS_CONFIG_BUTTON_ZL (1<<6)
#define WUPS_CONFIG_BUTTON_ZR (1<<7)
#define WUPS_CONFIG_BUTTON_L (1<<8)
#define WUPS_CONFIG_BUTTON_R (1<<9)
typedef int32_t WUPSConfigButtons;
class WUPSConfigItem {
public:
/**
Sets the display name of this WUPSConfigItem
This is the value which will be shown in the configuration menu.
**/
virtual void setDisplayName(std::string displayName) {
this->displayName = displayName;
}
/**
\return Returns the display name of this WUPSConfigItem
**/
virtual std::string getDisplayName() {
return this->displayName;
}
/**
Sets the config ID name of this WUPSConfigItem.
This config ID is used to persist the configuration values and needs
to be unique in the context of this WUPSConfig.
Items in different categories are NOT allowed to have the config ID.
**/
virtual void setConfigID(std::string configID) {
this->configID = configID;
}
/**
\return Returns the configID of this WUPSConfigItem.
**/
virtual std::string getConfigID() {
return this->configID;
}
/**
Returns a string that displays the current value.
This string is shown next to the display name when the cursor is NOT on this item
**/
virtual std::string getCurrentValueDisplay() = 0;
/**
Returns a string that displays the current value when selected.
This string is shown next to the display name when the cursor IS on this item
**/
virtual std::string getCurrentValueSelectedDisplay() = 0;
/**
Is called when the cursor enters or leaves the item.
When the cursor enters the item, "isSelected" will be true.
When the cursor leaves the item, "isSelected" will be false.
**/
virtual void onSelected(bool isSelected) = 0;
/**
Is called when a button is pressed while the cursor on this item.
See the WUPSConfigButtons enum for possible values.
**/
virtual void onButtonPressed(WUPSConfigButtons buttons) = 0;
/**
When the cursor is on this item, the configuration menu asks this item
if it's allowed to leave it.
If it returns true, the item can be leaved.
It it returns false, leaves is not allowed.
**/
virtual bool isMovementAllowed() = 0;
/**
Returns a string that represents the value of this item.
**/
virtual std::string persistValue() = 0;
/**
Loads a value for a given string that contains the persisted value.
\param persistedValue A valued that the result of the persistValue function
**/
virtual void loadValue(std::string persistedValue) = 0;
/**
Restores the default value
**/
virtual void restoreDefault() = 0;
/**
Call callback with with current value.
This function will be called whenever this item should call it's (optional) given
callback with the current value.
Returns true if a valid callback could be called
Returns false if no callback was called (e.g. callback was NULL)
**/
virtual bool callCallback() = 0;
/**
Will be called by the "config menu manager" if this configitem is currently displayed on the screen.
If this config item decides to draw onto the screen, it can use "lastVisibleOnScreen()" function to
get information about which screen(s) are available.
Check the Overlay API for more information on drawing on the screen.
**/
virtual void visibleOnScreen(wups_overlay_options_type_t screen){
this->displayScreen = screen;
}
WUPSConfigItem(std::string configID, std::string displayName){
this->configID = configID;
this->displayName = displayName;
}
virtual ~WUPSConfigItem(){
}
protected:
/**
If this config item decides to draw onto the screen, this function can be used
get information about which screen(s) are available for OS drawing.
Check the Overlay API for more information on drawing on the screen.
**/
wups_overlay_options_type_t lastVisibleOnScreen(){
return displayScreen;
}
private:
std::string displayName;
std::string configID;
wups_overlay_options_type_t displayScreen = WUPS_OVERLAY_NONE;
};
#endif

View File

@ -1,79 +0,0 @@
/****************************************************************************
* Copyright (C) 2018 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 _WUPS_CONFIG_ITEM_BOOLEAN_H_
#define _WUPS_CONFIG_ITEM_BOOLEAN_H_
#include <string>
#include <vector>
#include <wups/config/WUPSConfigItem.h>
class WUPSConfigItemBoolean;
typedef void (*BooleanValueChangedCallback)(WUPSConfigItemBoolean *, bool);
class WUPSConfigItemBoolean : public WUPSConfigItem {
public:
WUPSConfigItemBoolean(std::string configID, std::string displayName, bool defaultValue, BooleanValueChangedCallback callback);
virtual ~WUPSConfigItemBoolean();
/**
Sets the name with will be displayed as "true" value
\param name of the "true" value
**/
void setTrueValueName(std::string trueValName);
/**
Sets the name with will be displayed as "false" value
\param name of the "false" value
**/
void setFalseValueName(std::string falseValName);
/**
Toggles the value. When it was true, it now false, when it was false, it's now true.
Call the callback with the new value.
**/
virtual void toggleValue();
virtual std::string getCurrentValueDisplay();
virtual std::string getCurrentValueSelectedDisplay();
virtual void onSelected(bool isSelected);
virtual void onButtonPressed(WUPSConfigButtons buttons);
virtual bool isMovementAllowed();
virtual std::string persistValue();
virtual void loadValue(std::string persistedValue);
virtual void restoreDefault();
virtual bool callCallback();
private:
BooleanValueChangedCallback callback = NULL;
bool value;
bool defaultValue;
std::string trueValName = "on";
std::string falseValName = "off";
};
#endif

View File

@ -1,61 +0,0 @@
/****************************************************************************
* Copyright (C) 2018-2019 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 _WUPS_CONFIG_ITEM_INTEGER_RANGE_H_
#define _WUPS_CONFIG_ITEM_INTEGER_RANGE_H_
#include <string>
#include <vector>
#include <wups/config/WUPSConfigItem.h>
class WUPSConfigItemIntegerRange;
typedef void (*IntegerRangeValueChangedCallback)(WUPSConfigItemIntegerRange *, int32_t);
class WUPSConfigItemIntegerRange : public WUPSConfigItem {
public:
WUPSConfigItemIntegerRange(std::string configID, std::string displayName, int32_t defaultValue, int32_t minValue, int32_t maxValue, IntegerRangeValueChangedCallback callback);
virtual ~WUPSConfigItemIntegerRange();
virtual std::string getCurrentValueDisplay();
virtual std::string getCurrentValueSelectedDisplay();
virtual void onSelected(bool isSelected);
virtual void onButtonPressed(WUPSConfigButtons buttons);
virtual bool isMovementAllowed();
virtual std::string persistValue();
virtual void loadValue(std::string persistedValue);
virtual void restoreDefault();
virtual bool callCallback();
private:
IntegerRangeValueChangedCallback callback = NULL;
int32_t value;
int32_t defaultValue;
int32_t minValue;
int32_t maxValue;
};
#endif

View File

@ -1,60 +0,0 @@
/****************************************************************************
* Copyright (C) 2018 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 _WUPS_CONFIG_ITEM_MULTIPLE_VALUES_H_
#define _WUPS_CONFIG_ITEM_MULTIPLE_VALUES_H_
#include <string>
#include <vector>
#include <map>
#include <wups/config/WUPSConfigItem.h>
class WUPSConfigItemMultipleValues;
typedef void (*MultipleValuesChangedCallback)(WUPSConfigItemMultipleValues *, int32_t);
class WUPSConfigItemMultipleValues : public WUPSConfigItem {
public:
WUPSConfigItemMultipleValues(std::string configID, std::string displayName, int32_t defaultValue, std::map<int32_t,std::string> values_, MultipleValuesChangedCallback callback);
virtual ~WUPSConfigItemMultipleValues();
virtual std::string getCurrentValueDisplay();
virtual std::string getCurrentValueSelectedDisplay();
virtual void onSelected(bool isSelected);
virtual void onButtonPressed(WUPSConfigButtons buttons) ;
virtual bool isMovementAllowed();
virtual std::string persistValue();
virtual void loadValue(std::string persistedValue);
virtual void restoreDefault();
virtual bool callCallback();
private:
MultipleValuesChangedCallback callback = NULL;
int32_t defaultValue;
uint32_t valueIndex = 0;
std::map<int32_t,std::string> values;
};
#endif

View File

@ -19,7 +19,6 @@
#define WUPS_HOOKS_DEF_H_
#include "common.h"
#include "utils.h"
#ifdef __cplusplus
extern "C" {
@ -33,32 +32,24 @@ extern "C" {
}
typedef enum wups_loader_hook_type_t {
WUPS_LOADER_HOOK_INIT_OVERLAY, /* Only for internal usage */
WUPS_LOADER_HOOK_INIT_KERNEL, /* Only for internal usage */
WUPS_LOADER_HOOK_INIT_VID_MEM, /* Only for internal usage */
WUPS_LOADER_HOOK_INIT_WUT_MALLOC,
WUPS_LOADER_HOOK_FINI_WUT_MALLOC,
WUPS_LOADER_HOOK_INIT_WUT_DEVOPTAB,
WUPS_LOADER_HOOK_FINI_WUT_DEVOPTAB,
WUPS_LOADER_HOOK_INIT_WUT_NEWLIB,
WUPS_LOADER_HOOK_FINI_WUT_NEWLIB,
WUPS_LOADER_HOOK_INIT_WUT_STDCPP,
WUPS_LOADER_HOOK_FINI_WUT_STDCPP,
WUPS_LOADER_HOOK_INIT_WUT_DEVOPTAB,
WUPS_LOADER_HOOK_FINI_WUT_DEVOPTAB,
WUPS_LOADER_HOOK_INIT_PLUGIN, /* Called when exiting the plugin loader */
WUPS_LOADER_HOOK_DEINIT_PLUGIN, /* Called when re-entering the plugin loader */
WUPS_LOADER_HOOK_APPLICATION_START, /* Called when an application gets started */
WUPS_LOADER_HOOK_APPLICATION_STARTS, /* Called when an application gets started */
WUPS_LOADER_HOOK_FUNCTIONS_PATCHED, /* Called when the functions where patched */
WUPS_LOADER_HOOK_RELEASE_FOREGROUND, /* Called when an foreground is going to be released */
WUPS_LOADER_HOOK_ACQUIRED_FOREGROUND, /* Called when an foreground is acquired */
WUPS_LOADER_HOOK_APPLICATION_END, /* Called when an application ends */
WUPS_LOADER_HOOK_CONFIRM_RELEASE_FOREGROUND, /* */
WUPS_LOADER_HOOK_SAVES_DONE_READY_TO_RELEASE, /* */
WUPS_LOADER_HOOK_APPLICATION_REQUESTS_EXIT, /* Called when an application wants to exit */
WUPS_LOADER_HOOK_APPLICATION_ENDS, /* Called when an application ends */
WUPS_LOADER_HOOK_VSYNC, /* Called when an application calls GX2WaitForVsync (most times each frame) */
WUPS_LOADER_HOOK_GET_CONFIG, /* Called when the config-menu will be loaded */
WUPS_LOADER_HOOK_VID_DRC_DRAW, /* Called when the DRC was rendered */
WUPS_LOADER_HOOK_VID_TV_DRAW, /* Called when the TV was rendered */
WUPS_LOADER_HOOK_APPLET_START, /* Called when the an applet was started */
} wups_loader_hook_type_t;
typedef struct wups_loader_hook_t {
@ -66,38 +57,6 @@ typedef struct wups_loader_hook_t {
const void *target; /* Address of our own, new function */
} wups_loader_hook_t;
typedef struct wups_loader_vid_buffer_t {
const void * color_buffer_ptr;
const void * tv_texture_ptr;
const void * drc_texture_ptr;
const void * sampler_ptr;
} wups_loader_vid_buffer_t;
typedef struct wups_loader_app_started_args_t {
bool kernel_access;
} wups_loader_app_started_args_t;
#define WUPS_ALLOW_OVERLAY() \
void init_overlay(wups_loader_init_overlay_args_t);\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_OVERLAY,init_overlay); \
void init_overlay(wups_loader_init_overlay_args_t args){ \
WUPS_InitOverlay(args);\
}
#define WUPS_USE_VIDEO_MEMORY() \
void init_vid_mem(wups_loader_init_vid_mem_args_t);\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_VID_MEM,init_vid_mem); \
void init_vid_mem(wups_loader_init_vid_mem_args_t args){ \
WUPS_InitVidMem(args);\
}
#define WUPS_ALLOW_KERNEL() \
void init_kernel(wups_loader_init_kernel_args_t);\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_KERNEL,init_kernel); \
void init_kernel(wups_loader_init_kernel_args_t args){ \
WUPS_InitKernel(args);\
}
#define INITIALIZE_PLUGIN() \
void init_plugin(void);\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_PLUGIN,init_plugin); \
@ -108,10 +67,10 @@ typedef struct wups_loader_app_started_args_t {
WUPS_HOOK_EX(WUPS_LOADER_HOOK_DEINIT_PLUGIN,deinit_plugin); \
void deinit_plugin()
#define ON_APPLICATION_START(myargs) \
void on_app_starting(wups_loader_app_started_args_t);\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_APPLICATION_START,on_app_starting); \
void on_app_starting(wups_loader_app_started_args_t myargs)
#define ON_APPLICATION_START() \
void on_app_starting();\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_APPLICATION_STARTS,on_app_starting); \
void on_app_starting()
#define ON_FUNCTIONS_PATCHED() \
void on_functions_patched();\
@ -127,42 +86,22 @@ typedef struct wups_loader_app_started_args_t {
void on_acquired_foreground(void);\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_ACQUIRED_FOREGROUND,on_acquired_foreground); \
void on_acquired_foreground(void)
#define ON_APPLICATION_END() \
void on_app_ending(void);\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_APPLICATION_END,on_app_ending); \
void on_app_ending(void)
#define ON_CONFIRM_RELEASE_FOREGROUND() \
void on_confirm_release_foreground(void);\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_CONFIRM_RELEASE_FOREGROUND,on_confirm_release_foreground); \
void on_confirm_release_foreground(void)
#define ON_SAVES_DONE_READY_TO_RELEASE() \
void on_saves_done_ready_to_release(void);\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_SAVES_DONE_READY_TO_RELEASE,on_saves_done_ready_to_release); \
void on_saves_done_ready_to_release(void)
#define ON_APPLET_START() \
void on_applet_start(void);\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_APPLET_START,on_applet_start); \
void on_applet_start(void)
#define ON_APPLICATION_REQUESTS_EXIT() \
void on_app_requests_exit(void);\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_APPLICATION_REQUESTS_EXIT,on_app_requests_exit); \
void on_app_requests_exit(void)
#define ON_APPLICATION_ENDS() \
void on_app_ending(void);\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_APPLICATION_ENDS,on_app_ending); \
void on_app_ending(void)
#define ON_VYSNC() \
void on_vsync(void);\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_VSYNC,on_vsync); \
void on_vsync(void)
#define ON_DRC_TO_SCAN_BUFFER(myargs) \
void on_drc_to_scan_buf(wups_loader_vid_buffer_t);\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_VID_DRC_DRAW,on_drc_to_scan_buf); \
void on_drc_to_scan_buf(wups_loader_vid_buffer_t myargs)
#define ON_TV_TO_SCAN_BUFFER(myargs) \
void on_tv_to_scan_buf(wups_loader_vid_buffer_t);\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_VID_TV_DRAW,on_tv_to_scan_buf); \
void on_tv_to_scan_buf(wups_loader_vid_buffer_t myargs)
#define WUPS_USE_WUT_MALLOC() \
extern "C" void __init_wut_malloc(); \
void on_init_wut_malloc(){ \
@ -185,8 +124,8 @@ typedef struct wups_loader_app_started_args_t {
void on_fini_wut_devoptab(){ \
__fini_wut_devoptab(); \
}\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WUT_DEVOPTAB,on_fini_wut_devoptab);
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WUT_DEVOPTAB,on_fini_wut_devoptab);
#define WUPS_USE_WUT_NEWLIB() \
extern "C" void __init_wut_newlib(); \
void on_init_wut_newlib(){ \
@ -200,26 +139,17 @@ typedef struct wups_loader_app_started_args_t {
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WUT_NEWLIB,on_fini_wut_newlib);
#define WUPS_USE_WUT_STDCPP() \
extern "C" void __init_wut_stdcpp() __attribute__((weak)); \
extern "C" void __init_wut_stdcpp(); \
void on_init_wut_stdcpp(){ \
if (__init_wut_stdcpp) { \
__init_wut_stdcpp(); \
} \
}\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_WUT_STDCPP,on_init_wut_stdcpp); \
extern "C" void __fini_wut_stdcpp() __attribute__((weak)); \
extern "C" void __fini_wut_stdcpp(); \
void on_fini_wut_stdcpp(){ \
__fini_wut_stdcpp(); \
}\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WUT_STDCPP,on_fini_wut_stdcpp);
#define WUPS_USE_WUT_CRT() \
WUPS_USE_WUT_MALLOC() \
WUPS_USE_WUT_DEVOPTAB() \
WUPS_USE_WUT_NEWLIB() \
WUPS_USE_WUT_STDCPP()
#ifdef __cplusplus
}
#endif

48
include/wups/meta.h Normal file
View File

@ -0,0 +1,48 @@
/* based on blsug.h
* by Alex Chadwick
*
* Copyright (C) 2014, Alex Chadwick
* Modified by Maschell, 2018
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef WUPS_META_DEF_H_
#define WUPS_META_DEF_H_
#include "common.h"
#include "hooks.h"
#ifdef __cplusplus
extern "C" {
#endif
#define WUPS_PLUGIN_NAME(x) WUPS_META(name, x); WUPS_META(wups, "0.4"); WUPS_USE_WUT_MALLOC() WUPS_USE_WUT_NEWLIB() WUPS_USE_WUT_STDCPP() WUPS_META(buildtimestamp, __DATE__ " " __TIME__);
#define WUPS_PLUGIN_AUTHOR(x) WUPS_META(author, x)
#define WUPS_PLUGIN_VERSION(x) WUPS_META(version, x)
#define WUPS_PLUGIN_LICENSE(x) WUPS_META(license, x)
#define WUPS_PLUGIN_DESCRIPTION(x) WUPS_META(description, x)
#define WUPS_PLUGIN_ID(x) WUPS_META(id, x)
#define WUPS_PLUGIN_CONFIG_REVISION(x) WUPS_META(config_revision, #x)
#ifdef __cplusplus
}
#endif
#endif /* WUPS_COMMON_DEF_H_ */

View File

@ -1,143 +0,0 @@
/****************************************************************************
* Copyright (C) 2018 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 WUPS_UTILS_DEF_H_
#define WUPS_UTILS_DEF_H_
#include "common.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum wups_overlay_options_type_t {
WUPS_OVERLAY_NONE,
WUPS_OVERLAY_DRC_ONLY, /* Tries to display only on gamepad screen */
WUPS_OVERLAY_TV_ONLY, /* Tries to display only on tv screen */
WUPS_OVERLAY_DRC_AND_TV, /* Tries to display on both screens. Prioritizes the TV screen if memory is low. */
WUPS_OVERLAY_DRC_AND_TV_WITH_DRC_PRIO /* Tries to display on both screens. But if memory is low, prioritize the DRC screen.*/
}
wups_overlay_options_type_t;
typedef void (*overlay_callback)(wups_overlay_options_type_t, void*);
typedef void (*OverlayOpenFunction)(wups_overlay_options_type_t screen, overlay_callback callback, void*);
typedef bool (*ConvertTextureFunction)(const uint8_t *img, int32_t imgSize, void * texture);
typedef void (*DrawTextureFunction)(void * texture, void* sampler, float x, float y, int32_t width, int32_t height, float alpha);
typedef struct wups_loader_init_overlay_args_t {
OverlayOpenFunction overlayfunction_ptr;
ConvertTextureFunction textureconvertfunction_ptr;
DrawTextureFunction drawtexturefunction_ptr;
} wups_loader_init_overlay_args_t;
typedef uint32_t (*KernelReadFunction)(const void *addr);
typedef void (*KernelWriteFunction)(void *addr, uint32_t value);
typedef void (*KernelCopyDataFunction)(uint32_t addr, uint32_t src, uint32_t len);
typedef struct wups_loader_init_kernel_args_t_ {
KernelReadFunction kern_read_ptr;
KernelWriteFunction kern_write_ptr;
KernelCopyDataFunction kern_copy_data_ptr;
} wups_loader_init_kernel_args_t;
typedef void* (*VideoMemoryAllocFunction)(uint32_t size, int32_t align);
typedef void (*VideoMemoryFreeFunction)(void *addr);
typedef struct wups_loader_init_vid_mem_args_t_ {
VideoMemoryAllocFunction vid_mem_alloc_ptr;
VideoMemoryFreeFunction vid_mem_free_ptr;
} wups_loader_init_vid_mem_args_t;
/*
Gets called by the framework
*/
/**
Sets the pointer for wrapping the fs functions.
If NULL pointers are provided, the original function will be called.
The whole point of replacing the fs functions is to inherit SD/USB access.
The argument of the ON_APPLICATION_START hook provides information on the state of SD or USB access.
**/
//void WUPS_InitFS(wups_loader_init_fs_args_t args);
/**
Sets the function pointer for opening the overlay.
If none or a NULL pointer is provided, calling "WUPS_OpenOverlay" has no effect.
**/
void WUPS_InitOverlay(wups_loader_init_overlay_args_t args);
/**
Sets the function pointers for kernel functions.
If none or NULL pointers is provided, calling the corresponding function has no effect.
**/
void WUPS_InitKernel(wups_loader_init_kernel_args_t args);
/**
Sets the function pointers for video mem functions.
If none or NULL pointers is provided, calling the corresponding function has no effect.
**/
void WUPS_InitVidMem(wups_loader_init_vid_mem_args_t args);
/*
Can be called by the user.
*/
void WUPS_Overlay_PrintTextOnScreen(wups_overlay_options_type_t screen, int x,int y, const char * msg, ...);
void WUPS_Overlay_OSScreenClear(wups_overlay_options_type_t screen);
void WUPS_Overlay_FlipBuffers(wups_overlay_options_type_t screen);
void WUPS_OpenOverlay(wups_overlay_options_type_t screen, overlay_callback callback, void* args);
// texture needs to be a GX2Texture
bool WUPS_ConvertImageToTexture(const uint8_t *img, int32_t imgSize, void * texture);
/**
Reads a 32bit value from a given address with kernel rights.
This function only has an effect if the plugin has the "WUPS_ALLOW_KERNEL" hook and the loader is NOT blocking the kernel access.
The argument of the ON_APPLICATION_START hook provides the information if the plugin has kernel access which should be checked before using/relying on this function.
**/
uint32_t WUPS_KernelRead(const void *addr);
/**
Write a 32bit value from a given address with kernel rights.
This function only has an effect if the plugin has the "WUPS_ALLOW_KERNEL" hook and the loader is NOT blocking the kernel access.
The argument of the ON_APPLICATION_START hook provides the information if the plugin has kernel access which should be checked before using/relying on this function.
**/
void WUPS_KernelWrite(void *addr, uint32_t value);
/**
Copies data from a source address to a destination address for a given lenght with kernel rights.
This function only has an effect if the plugin has the "WUPS_ALLOW_KERNEL" hook and the loader is NOT blocking the kernel access.
The argument of the ON_APPLICATION_START hook provides the information if the plugin has kernel access which should be checked before using/relying on this function.
**/
void WUPS_KernelCopyDataFunction(uint32_t addr, uint32_t src, uint32_t len);
void * WUPS_VideoMemAlloc(uint32_t size);
void * WUPS_VideoMemMemalign(uint32_t size, int32_t align);
void WUPS_VideoMemFree(void *addr);
void WUPS_DrawTexture(void * texture, void* sampler, float x, float y, int32_t width, int32_t height, float alpha);
#ifdef __cplusplus
}
#endif
#endif /* WUPS_WUPS_H_ */

View File

@ -1,102 +0,0 @@
/****************************************************************************
* Copyright (C) 2018 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/>.
****************************************************************************/
#include <wups/config/WUPSConfigItemBoolean.h>
#include <vector>
WUPSConfigItemBoolean::WUPSConfigItemBoolean(std::string configID, std::string displayName, bool defaultValue, BooleanValueChangedCallback callback) : WUPSConfigItem(configID,displayName) {
this->defaultValue = defaultValue;
this->value = defaultValue;
this->callback = callback;
}
WUPSConfigItemBoolean::~WUPSConfigItemBoolean() {
}
void WUPSConfigItemBoolean::setTrueValueName(std::string trueValName) {
this->trueValName = trueValName;
}
void WUPSConfigItemBoolean::setFalseValueName(std::string falseValName) {
this->falseValName = falseValName;
}
std::string WUPSConfigItemBoolean::getCurrentValueDisplay() {
if(value) {
return " " + trueValName;
} else {
return " " + falseValName;
}
}
std::string WUPSConfigItemBoolean::getCurrentValueSelectedDisplay() {
if(value) {
return " " + trueValName + " >";
} else {
return "< " + falseValName;
}
}
void WUPSConfigItemBoolean::onSelected(bool isSelected) {
}
void WUPSConfigItemBoolean::onButtonPressed(WUPSConfigButtons buttons) {
if(buttons & WUPS_CONFIG_BUTTON_A) {
toggleValue();
}else if(buttons & WUPS_CONFIG_BUTTON_LEFT && !value){
toggleValue();
}else if((buttons & WUPS_CONFIG_BUTTON_RIGHT) && value){
toggleValue();
}
}
bool WUPSConfigItemBoolean::isMovementAllowed() {
return true;
}
std::string WUPSConfigItemBoolean::persistValue() {
if(value) {
return "1";
}
return "0";
}
void WUPSConfigItemBoolean::loadValue(std::string persistedValue) {
bool newValue = false;
if(persistedValue.compare("1") == 0) {
newValue = true;
}
value = newValue;
}
void WUPSConfigItemBoolean::toggleValue() {
value = !value;
}
void WUPSConfigItemBoolean::restoreDefault() {
this->value = this->defaultValue;
}
bool WUPSConfigItemBoolean::callCallback(){
if(callback != NULL) {
callback(this, this->value);
return true;
}
return false;
}

View File

@ -1,100 +0,0 @@
/****************************************************************************
* Copyright (C) 2019 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/>.
****************************************************************************/
#include <wups/config/WUPSConfigItemIntegerRange.h>
#include <vector>
WUPSConfigItemIntegerRange::WUPSConfigItemIntegerRange(std::string configID, std::string displayName, int32_t defaultValue, int32_t _minValue, int32_t _maxValue, IntegerRangeValueChangedCallback callback) : WUPSConfigItem(configID,displayName) {
this->defaultValue = defaultValue;
this->value = defaultValue;
this->minValue = _minValue;
this->maxValue = _maxValue;
this->callback = callback;
}
WUPSConfigItemIntegerRange::~WUPSConfigItemIntegerRange() {
}
std::string WUPSConfigItemIntegerRange::getCurrentValueDisplay() {
return " " + std::to_string(this->value);
}
std::string WUPSConfigItemIntegerRange::getCurrentValueSelectedDisplay() {
if(value == this->minValue) {
return " " + std::to_string(this->value) + " >";
} else if(value == this->maxValue){
return "< " + std::to_string(this->value);
}
return "< " + std::to_string(this->value) + " >";
}
void WUPSConfigItemIntegerRange::onSelected(bool isSelected) {
}
void WUPSConfigItemIntegerRange::onButtonPressed(WUPSConfigButtons buttons) {
if(buttons & WUPS_CONFIG_BUTTON_LEFT){
this->value--;
}else if((buttons & WUPS_CONFIG_BUTTON_RIGHT)){
this->value++;
}else if((buttons & WUPS_CONFIG_BUTTON_L)){
this->value = this->value - 50;
}else if((buttons & WUPS_CONFIG_BUTTON_R)){
this->value = this->value + 50;
}
if(this->value < this->minValue){
this->value = this->minValue;
}else if(this->value > this->maxValue){
this->value = this->maxValue;
}
}
bool WUPSConfigItemIntegerRange::isMovementAllowed() {
return true;
}
std::string WUPSConfigItemIntegerRange::persistValue() {
return std::to_string(this->value);
}
void WUPSConfigItemIntegerRange::loadValue(std::string persistedValue) {
// Note: std::stoi would throw an exception on error. atoi leads to an undefined behavior, but we
// check if the result is in range anyway.
int32_t newValue = atoi(persistedValue.c_str());
if(newValue < this->minValue){
newValue = this->minValue;
}else if(newValue > this->maxValue){
newValue = this->maxValue;
}
this->value = newValue;
}
void WUPSConfigItemIntegerRange::restoreDefault() {
this->value = this->defaultValue;
}
bool WUPSConfigItemIntegerRange::callCallback(){
if(callback != NULL) {
callback(this, this->value);
return true;
}
return false;
}

View File

@ -1,147 +0,0 @@
/****************************************************************************
* Copyright (C) 2018 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/>.
****************************************************************************/
#include <string>
#include <vector>
#include <wups/config/WUPSConfigItemMultipleValues.h>
#include <stdlib.h> /* atoi */
WUPSConfigItemMultipleValues::WUPSConfigItemMultipleValues(std::string configID, std::string displayName, int32_t defaultValue, std::map<int32_t,std::string> values_, MultipleValuesChangedCallback callback) : WUPSConfigItem(configID,displayName) {
if(values_.size() == 0) {
this->values[defaultValue] = "<ERROR>";
} else {
this->values = values_;
}
if (values.count(defaultValue) > 0) {
this->defaultValue = defaultValue;
valueIndex = 0;
for (auto& kv : values) {
if(defaultValue == kv.first) {
break;
}
valueIndex++;
}
} else {
for (auto& kv : values) {
this->defaultValue = kv.first;
break;
}
valueIndex = 0;
}
this->callback = callback;
}
WUPSConfigItemMultipleValues::~WUPSConfigItemMultipleValues() {
}
std::string WUPSConfigItemMultipleValues::getCurrentValueDisplay() {
uint32_t index = 0;
for (auto& kv : values) {
if(index == valueIndex) {
return " " + kv.second;
}
index++;
}
return "";
}
std::string WUPSConfigItemMultipleValues::getCurrentValueSelectedDisplay() {
if(values.size() == 0) {
return "<ERROR>";
}
uint32_t index_max = values.size() -1;
uint32_t index = 0;
for (auto& kv : values) {
if(index == valueIndex) {
std::string s;
if(valueIndex != 0) {
s.append("< ");
} else {
s.append(" ");
}
s.append(kv.second);
if(valueIndex != index_max) {
s.append(" >");
}
return s;
}
index++;
}
return "<ERROR>";
}
void WUPSConfigItemMultipleValues::onSelected(bool isSelected) {
// not needed.
}
void WUPSConfigItemMultipleValues::onButtonPressed(WUPSConfigButtons buttons) {
if(buttons & WUPS_CONFIG_BUTTON_LEFT) {
if(valueIndex != 0){
valueIndex--;
}
}
if(buttons & WUPS_CONFIG_BUTTON_RIGHT && values.size() > 0) {
valueIndex++;
if(valueIndex > values.size()-1) {
valueIndex = values.size()-1;
}
}
}
bool WUPSConfigItemMultipleValues::isMovementAllowed() {
return true;
}
std::string WUPSConfigItemMultipleValues::persistValue() {
return std::to_string(this->valueIndex);
}
void WUPSConfigItemMultipleValues::loadValue(std::string persistedValue) {
// Note: std::stoi would throw an exception on error. atoi leads to an undefined behavior, but we
// check if the result is in range anyway.
uint32_t newValueIndex = atoi(persistedValue.c_str());
if(newValueIndex >= 0 && (newValueIndex +1) <= this->values.size()) {
valueIndex = newValueIndex;
}else{
valueIndex = 0;
}
}
void WUPSConfigItemMultipleValues::restoreDefault() {
this->valueIndex = 0;
}
bool WUPSConfigItemMultipleValues::callCallback() {
if(callback == NULL) {
return false;
}
uint32_t index = 0;
for (auto& kv : values) {
if(index == valueIndex) {
callback(this, kv.first);
return true;
}
index++;
}
return false;
}

View File

@ -1,37 +0,0 @@
#include <wups.h>
#ifdef __cplusplus
extern "C" {
#endif
static KernelReadFunction kern_read_ptr __attribute__((section(".data"))) = NULL;
static KernelWriteFunction kern_write_ptr __attribute__((section(".data"))) = NULL;
static KernelCopyDataFunction kern_copy_data_ptr __attribute__((section(".data"))) = NULL;
void WUPS_InitKernel(wups_loader_init_kernel_args_t args) {
kern_read_ptr = args.kern_read_ptr;
kern_write_ptr = args.kern_write_ptr;
kern_copy_data_ptr = args.kern_copy_data_ptr;
}
uint32_t WUPS_KernelRead(const void *addr) {
if(kern_read_ptr != NULL) {
return kern_read_ptr(addr);
}
return 0;
}
void WUPS_KernelWrite(void *addr, uint32_t value) {
if(kern_write_ptr != NULL) {
kern_write_ptr(addr, value);
}
}
void WUPS_KernelCopyDataFunction(uint32_t addr, uint32_t src, uint32_t len) {
if(kern_copy_data_ptr != NULL) {
kern_copy_data_ptr(addr, src, len);
}
}
#ifdef __cplusplus
}
#endif

View File

@ -1,34 +0,0 @@
#include <wups.h>
#ifdef __cplusplus
extern "C" {
#endif
static VideoMemoryAllocFunction vid_mem_alloc_ptr __attribute__((section(".data"))) = NULL;
static VideoMemoryFreeFunction vid_mem_free_ptr __attribute__((section(".data"))) = NULL;
void WUPS_InitVidMem(wups_loader_init_vid_mem_args_t args) {
vid_mem_alloc_ptr = args.vid_mem_alloc_ptr;
vid_mem_free_ptr = args.vid_mem_free_ptr;
}
void * WUPS_VideoMemMemalign(uint32_t size, int32_t align) {
if(vid_mem_alloc_ptr != NULL) {
return vid_mem_alloc_ptr(size, align);
}
return 0;
}
void * WUPS_VideoMemAlloc(uint32_t size) {
return WUPS_VideoMemMemalign(size, 4);
}
void WUPS_VideoMemFree(void *addr) {
if(vid_mem_free_ptr != NULL) {
vid_mem_free_ptr(addr);
}
}
#ifdef __cplusplus
}
#endif

View File

@ -1,107 +0,0 @@
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <dirent.h>
#include <wups.h>
#ifdef __cplusplus
extern "C" {
#endif
void OSScreenInit(void);
void OSScreenShutdown(void);
uint32_t OSScreenGetBufferSizeEx(uint32_t bufferNum);
void OSScreenSetBufferEx(uint32_t bufferNum, void * addr);
void OSScreenClearBufferEx(uint32_t bufferNum, uint32_t temp);
void OSScreenFlipBuffersEx(uint32_t bufferNum);
void OSScreenPutFontEx(uint32_t bufferNum, uint32_t posX, uint32_t posY, const char * buffer);
void OSScreenEnableEx(uint32_t bufferNum, int32_t enable);
void OSScreenPutPixelEx(uint32_t bufferNum, uint32_t posX, uint32_t posY, uint32_t color);
static OverlayOpenFunction overlayfunction_ptr __attribute__((section(".data"))) = NULL;
static ConvertTextureFunction textureconvertfunction_ptr __attribute__((section(".data"))) = NULL;
static DrawTextureFunction drawtexturefunction_ptr __attribute__((section(".data"))) = NULL;
void WUPS_InitOverlay(wups_loader_init_overlay_args_t args) {
overlayfunction_ptr = args.overlayfunction_ptr;
textureconvertfunction_ptr = args.textureconvertfunction_ptr;
drawtexturefunction_ptr = args.drawtexturefunction_ptr;
}
void WUPS_Overlay_PrintTextOnScreen(wups_overlay_options_type_t screen, int x,int y, const char * msg, ...) {
if(screen == WUPS_OVERLAY_NONE) {
return;
}
char * tmp = NULL;
va_list va;
va_start(va, msg);
if((vasprintf(&tmp, msg, va) >= 0) && tmp) {
if(screen != WUPS_OVERLAY_DRC_ONLY) { // Draw TV if it's not DRC exclusive.
OSScreenPutFontEx(0, x, y, tmp);
}
if(screen != WUPS_OVERLAY_TV_ONLY) { // Draw DRC if it's not TV exclusive.
OSScreenPutFontEx(1, x, y, tmp);
}
}
va_end(va);
if(tmp) {
free(tmp);
}
}
void WUPS_Overlay_OSScreenClear(wups_overlay_options_type_t screen) {
if(screen == WUPS_OVERLAY_NONE) {
return;
}
if(screen != WUPS_OVERLAY_DRC_ONLY) { // Clear TV if it's not DRC exclusive.
OSScreenClearBufferEx(0, 0);
}
if(screen != WUPS_OVERLAY_TV_ONLY) { // Clear DRC if it's not TV exclusive.
OSScreenClearBufferEx(1, 0);
}
}
void WUPS_Overlay_FlipBuffers(wups_overlay_options_type_t screen) {
if(screen == WUPS_OVERLAY_NONE) {
return;
}
if(screen != WUPS_OVERLAY_DRC_ONLY) { // Flip TV buffer if it's not DRC exclusive.
OSScreenFlipBuffersEx(0);
}
if(screen != WUPS_OVERLAY_TV_ONLY) { // Flip DRC buffer if it's not TV exclusive.
OSScreenFlipBuffersEx(1);
}
}
void WUPS_OpenOverlay(wups_overlay_options_type_t screen, overlay_callback callback, void* arg) {
if(overlayfunction_ptr != NULL) {
overlayfunction_ptr(screen, callback, arg);
}
}
bool WUPS_ConvertImageToTexture(const uint8_t *img, int32_t imgSize, void * texture) {
if(textureconvertfunction_ptr != NULL) {
return textureconvertfunction_ptr(img, imgSize, texture);
}
return false;
}
void WUPS_DrawTexture(void * texture, void * sampler, float x, float y, int32_t width, int32_t height, float alpha = 1.0f) {
if(drawtexturefunction_ptr != NULL) {
drawtexturefunction_ptr(texture, sampler, x, y, width, height, alpha);
}
}
#ifdef __cplusplus
}
#endif

View File

@ -1,7 +0,0 @@
ASFLAGS := -mregnames
# -T: use the linker script specified
# -wrap: wrap function
# -q: Leave relocation sections and contents in fully linked executables
LDFLAGS += -T $(WUPSDIR)/wups.ld -Wl,-q

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,12 +0,0 @@
CC=gcc
CFLAGS=-c -Wall
LDFLAGS=
SOURCES:= $(wildcard source/*.c)
OBJ_FILES = $(patsubst source/%.c,obj/%.o,$(SOURCES))
EXECUTABLE=UdpDebugReader
$(EXECUTABLE): $(OBJ_FILES)
$(CC) $(LDFLAGS) -o $@ $^
obj/%.o: source/%.c
mkdir obj; $(CC) $(CFLAGS) -c -o $@ $<

View File

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="UdpDebugReader" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Release">
<Option output="UdpDebugReader" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectLinkerOptionsRelation="0" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
</Compiler>
<Linker>
<Add library="source/winsock/libwsock32.a" />
</Linker>
<Unit filename="source/Input.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="source/Input.h" />
<Unit filename="source/main.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="source/network.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="source/network.h" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>

View File

@ -1,424 +0,0 @@
# depslib dependency file v1.0
1279792267 source:c:\dokumente und einstellungen\dima\desktop\UdpDebugReader\source\network.c
<stdio.h>
<sys/types.h>
<stdlib.h>
<string.h>
<unistd.h>
<conio.h>
<conio.h>
<fcntl.h>
"network.h"
1452177726 "
1279792340 source:c:\dokumente und einstellungen\dima\desktop\UdpDebugReader\source\main.c
<stdio.h>
<stdlib.h>
<unistd.h>
"network.h"
1279798227 source:/home/dima/Desktop/UdpDebugReader/source/main.c
<stdio.h>
<stdlib.h>
<unistd.h>
"Input.h"
"network.h"
1279798084 /home/dima/Desktop/UdpDebugReader/source/network.h
"winsock/winsock.h"
<sys/types.h>
<sys/socket.h>
<netinet/in.h>
1279798084 n.h>
1279797916 source:/home/dima/Desktop/UdpDebugReader/source/network.c
<stdio.h>
<sys/types.h>
<stdlib.h>
<string.h>
<unistd.h>
<fcntl.h>
"network.h"
1279798221 /home/dima/Desktop/UdpDebugReader/source/Input.h
<conio.h>
<termios.h>
1445718391 >
1279798252 source:/home/dima/Desktop/UdpDebugReader/source/Input.c
<stdio.h>
<stdlib.h>
<string.h>
"Input.h"
<termios.h>
1198764450 /home/dima/Desktop/UdpDebugReader/source/winsock/winsock.h
<windows.h>
<mswsock.h>
1279798227 source:d:\UdpDebugReader\source\main.c
<stdio.h>
<stdlib.h>
<unistd.h>
"Input.h"
"network.h"
1279799401 d:\UdpDebugReader\source\input.h
<conio.h>
<termios.h>
1279799400 d:\UdpDebugReader\source\network.h
"winsock/winsock.h"
<sys/types.h>
<sys/socket.h>
<netinet/in.h>
<fcntl.h>
1452177726
1198768050 d:\UdpDebugReader\source\winsock\winsock.h
<windows.h>
<mswsock.h>
1279799399 source:d:\UdpDebugReader\source\network.c
<stdio.h>
<sys/types.h>
<stdlib.h>
<string.h>
<unistd.h>
"network.h"
1279798252 source:d:\UdpDebugReader\source\input.c
<stdio.h>
<stdlib.h>
<string.h>
"Input.h"
<termios.h>
1291665385 source:d:\code\windowstools\UdpDebugReader\source\network.c
<stdio.h>
<sys/types.h>
<stdlib.h>
<string.h>
<unistd.h>
"network.h"
1291665388 d:\code\windowstools\UdpDebugReader\source\network.h
"winsock/winsock.h"
<sys/types.h>
<sys/socket.h>
<netinet/in.h>
<fcntl.h>
1198764450 d:\code\windowstools\UdpDebugReader\source\winsock\winsock.h
<windows.h>
<mswsock.h>
1291665361 source:d:\code\windowstools\UdpDebugReader\source\input.c
<stdio.h>
<stdlib.h>
<string.h>
"Input.h"
<termios.h>
1291665378 d:\code\windowstools\UdpDebugReader\source\input.h
<conio.h>
<termios.h>
1293478462 source:d:\code\windowstools\UdpDebugReader\source\main.c
<stdio.h>
<stdlib.h>
<unistd.h>
"Input.h"
"network.h"
1325182250 source:/media/truecrypt1/code/LocalTrunk/Tools/UdpDebugReader/source/Input.c
<stdio.h>
<stdlib.h>
<string.h>
"Input.h"
<termios.h>
<stdio.h>
<stdlib.h>
<string.h>
"Input.h"
<termios.h>
1325182250 /media/truecrypt1/code/LocalTrunk/Tools/UdpDebugReader/source/Input.h
<conio.h>
<termios.h>
<conio.h>
<termios.h>
1334304767 source:/media/truecrypt1/code/LocalTrunk/Tools/UdpDebugReader/source/main.c
<stdio.h>
<stdlib.h>
<unistd.h>
"Input.h"
"network.h"
<stdio.h>
<stdlib.h>
<unistd.h>
"Input.h"
"network.h"
1334304019 /media/truecrypt1/code/LocalTrunk/Tools/UdpDebugReader/source/network.h
"winsock/winsock.h"
<sys/types.h>
<sys/socket.h>
<netinet/in.h>
<fcntl.h>
"winsock/winsock.h"
<sys/types.h>
<sys/socket.h>
<netinet/in.h>
<fcntl.h>
1325182250 /media/truecrypt1/code/LocalTrunk/Tools/UdpDebugReader/source/winsock/winsock.h
<windows.h>
<mswsock.h>
<windows.h>
<mswsock.h>
1334308770 source:/media/truecrypt1/code/LocalTrunk/Tools/UdpDebugReader/source/network.c
<stdio.h>
<sys/types.h>
<stdlib.h>
<string.h>
<unistd.h>
"network.h"
<stdio.h>
<sys/types.h>
<stdlib.h>
<string.h>
<unistd.h>
"network.h"
1334910814 source:d:\code\localtrunk\tools\UdpDebugReader\source\main.c
<stdio.h>
<stdlib.h>
<unistd.h>
"Input.h"
"network.h"
1334909941 d:\code\localtrunk\tools\UdpDebugReader\source\input.h
<conio.h>
<termios.h>
1334910353 d:\code\localtrunk\tools\UdpDebugReader\source\network.h
"winsock/winsock.h"
<sys/types.h>
<sys/socket.h>
<netinet/in.h>
<fcntl.h>
1325182250 d:\code\localtrunk\tools\UdpDebugReader\source\winsock\winsock.h
<windows.h>
<mswsock.h>
1334910629 source:d:\code\localtrunk\tools\UdpDebugReader\source\network.c
<stdio.h>
<sys/types.h>
<stdlib.h>
<string.h>
<unistd.h>
"network.h"
1334909938 source:d:\code\localtrunk\tools\UdpDebugReader\source\input.c
<stdio.h>
<stdlib.h>
<string.h>
"Input.h"
<termios.h>
1334909938 source:/media/truecrypt1/test/UdpDebugReader/source/Input.c
<stdio.h>
<stdlib.h>
<string.h>
"Input.h"
<termios.h>
1334909941 /media/truecrypt1/test/UdpDebugReader/source/Input.h
<conio.h>
<termios.h>
1334910431 source:/media/truecrypt1/test/UdpDebugReader/source/main.c
<stdio.h>
<stdlib.h>
<unistd.h>
"Input.h"
"network.h"
1334910353 /media/truecrypt1/test/UdpDebugReader/source/network.h
"winsock/winsock.h"
<sys/types.h>
<sys/socket.h>
<netinet/in.h>
<fcntl.h>
1325182250 /media/truecrypt1/test/UdpDebugReader/source/winsock/winsock.h
<windows.h>
<mswsock.h>
1334910629 source:/media/truecrypt1/test/UdpDebugReader/source/network.c
<stdio.h>
<sys/types.h>
<stdlib.h>
<string.h>
<unistd.h>
"network.h"
1445714791 source:d:\code\UdpDebugReader\source\input.c
<stdio.h>
<stdlib.h>
<string.h>
"Input.h"
<termios.h>
1445714791 d:\code\UdpDebugReader\source\input.h
<conio.h>
<termios.h>
1452177726 source:d:\code\UdpDebugReader\source\main.c
<stdio.h>
<stdlib.h>
<unistd.h>
"Input.h"
"network.h"
1452177726 d:\code\UdpDebugReader\source\network.h
"winsock/winsock.h"
<sys/types.h>
<sys/socket.h>
<netinet/in.h>
<fcntl.h>
1445714791 d:\code\UdpDebugReader\source\winsock\winsock.h
<windows.h>
<mswsock.h>
1452177726 source:d:\code\UdpDebugReader\source\network.c
<stdio.h>
<sys/types.h>
<stdlib.h>
<string.h>
<unistd.h>
"network.h"
1445714791 source:d:\loadiine_code\loadiine_gx2\udpdebugreader\source\input.c
<stdio.h>
<stdlib.h>
<string.h>
"Input.h"
<termios.h>
1445714791 d:\loadiine_code\loadiine_gx2\udpdebugreader\source\input.h
<conio.h>
<termios.h>
1455123313 source:d:\loadiine_code\loadiine_gx2\udpdebugreader\source\network.c
<stdio.h>
<sys/types.h>
<stdlib.h>
<string.h>
<unistd.h>
"network.h"
1452177726 d:\loadiine_code\loadiine_gx2\udpdebugreader\source\network.h
"winsock/winsock.h"
<sys/types.h>
<sys/socket.h>
<netinet/in.h>
<fcntl.h>
1445714791 d:\loadiine_code\loadiine_gx2\udpdebugreader\source\winsock\winsock.h
<windows.h>
<mswsock.h>
1455123353 source:d:\loadiine_code\loadiine_gx2\udpdebugreader\source\main.c
<stdio.h>
<stdlib.h>
<string.h>
<unistd.h>
"Input.h"
"network.h"
1445718391 source:/media/harddisk1/loadiine_code/loadiine_gx2/UdpDebugReader/source/Input.c
<stdio.h>
<stdlib.h>
<string.h>
"Input.h"
<termios.h>
1445718391 /media/harddisk1/loadiine_code/loadiine_gx2/UdpDebugReader/source/Input.h
<conio.h>
<termios.h>
1455123087 source:/media/harddisk1/loadiine_code/loadiine_gx2/UdpDebugReader/source/main.c
<stdio.h>
<stdlib.h>
<string.h>
<unistd.h>
"Input.h"
"network.h"
1452177726 /media/harddisk1/loadiine_code/loadiine_gx2/UdpDebugReader/source/network.h
"winsock/winsock.h"
<sys/types.h>
<sys/socket.h>
<netinet/in.h>
<fcntl.h>
1445718391 /media/harddisk1/loadiine_code/loadiine_gx2/UdpDebugReader/source/winsock/winsock.h
<windows.h>
<mswsock.h>
1452177726 source:/media/harddisk1/loadiine_code/loadiine_gx2/UdpDebugReader/source/network.c
<stdio.h>
<sys/types.h>
<stdlib.h>
<string.h>
<unistd.h>
"network.h"
1445718391 source:/media/harddisk1/loadiine_code/loadiine_gx2/UdpDebugReader/source/Input.c
<stdio.h>
<stdlib.h>
<string.h>
"Input.h"
<termios.h>
1445718391 /media/harddisk1/loadiine_code/loadiine_gx2/UdpDebugReader/source/Input.h
<conio.h>
<termios.h>
1455123353 source:/media/harddisk1/loadiine_code/loadiine_gx2/UdpDebugReader/source/main.c
<stdio.h>
<stdlib.h>
<string.h>
<unistd.h>
"Input.h"
"network.h"
1452177726 /media/harddisk1/loadiine_code/loadiine_gx2/UdpDebugReader/source/network.h
"winsock/winsock.h"
<sys/types.h>
<sys/socket.h>
<netinet/in.h>
<fcntl.h>
1445718391 /media/harddisk1/loadiine_code/loadiine_gx2/UdpDebugReader/source/winsock/winsock.h
<windows.h>
<mswsock.h>
1455123550 source:/media/harddisk1/loadiine_code/loadiine_gx2/UdpDebugReader/source/network.c
<stdio.h>
<sys/types.h>
<stdlib.h>
<string.h>
<unistd.h>
"network.h"

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Release" />
<File name="source\Input.c" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1719" topLine="32" />
</Cursor>
</File>
<File name="source\Input.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="source\network.c" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2010" topLine="46" />
</Cursor>
</File>
<File name="source\network.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="source\main.c" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="765" topLine="41" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View File

@ -1,288 +0,0 @@
#******************************************************************************
# Base configuration for doxygen, generated by DoxyBlocks.
# You may change these defaults to suit your purposes.
#******************************************************************************
# Doxyfile 1.7.3
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = UdpDebugReader
PROJECT_NUMBER =
PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY =
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
EXTENSION_MAPPING =
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
TYPEDEF_HIDES_STRUCT = NO
SYMBOL_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = NO
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_MEMBERS_CTORS_1ST = NO
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
STRICT_PROTO_MATCHING = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = NO
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE = "D:\code\UdpDebugReader\doxygen\doxygen.log"
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = \
"..\source\network.h" \
"..\source\Input.h" \
"..\source\Input.c" \
"..\source\main.c" \
"..\source\network.c"
INPUT_ENCODING = UTF-8
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = YES
HTML_ALIGN_MEMBERS = YES
HTML_DYNAMIC_SECTIONS = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
GENERATE_HTMLHELP = NO
CHM_FILE = "../UdpDebugReader.chm"
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE = org.doxygen.Project
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = YES
USE_INLINE_TREES = NO
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
USE_MATHJAX = NO
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
SEARCHENGINE = YES
SERVER_BASED_SEARCH = NO
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = WXUNUSED()=
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
DOT_NUM_THREADS = 0
DOT_FONTNAME = Helvetica
DOT_FONTSIZE = 10
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = YES
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MSCFILE_DIRS =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES

View File

@ -1,118 +0,0 @@
/****************************************************************************
* Copyright (C) 2010-2012
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Input.h"
FILE * logFile = NULL;
char CheckInput()
{
if(!kbhit())
return 0;
char inputChar = getch();
if(inputChar == 'f')
{
if(logFile)
{
printf("\n\nStopped logging.\n\n");
fclose(logFile);
logFile = NULL;
}
else
{
logFile = fopen("GeckoLog.txt", "wb");
if(logFile)
printf("\n\nStarted logging to GeckoLog.txt.\n\n");
else
printf("\n\nCan't create GeckoLog.txt.\n\n");
}
}
else if(inputChar == 'c')
{
system(CLEAR);
}
return inputChar;
}
#ifndef WIN32
#include <termios.h>
int kbhit(void)
{
struct termios term, oterm;
int fd = 0;
int c = 0;
tcgetattr(fd, &oterm);
memcpy(&term, &oterm, sizeof(term));
term.c_lflag = term.c_lflag & (!ICANON);
term.c_cc[VMIN] = 0;
term.c_cc[VTIME] = 1;
tcsetattr(fd, TCSANOW, &term);
c = getchar();
tcsetattr(fd, TCSANOW, &oterm);
if (c != -1)
ungetc(c, stdin);
return ((c != -1) ? 1 : 0);
}
int getch()
{
static int ch = -1, fd = 0;
struct termios neu, alt;
fd = fileno(stdin);
tcgetattr(fd, &alt);
neu = alt;
neu.c_lflag &= ~(ICANON|ECHO);
tcsetattr(fd, TCSANOW, &neu);
ch = getchar();
tcsetattr(fd, TCSANOW, &alt);
return ch;
}
#endif //WIN32

View File

@ -1,48 +0,0 @@
/****************************************************************************
* Copyright (C) 2010-2012
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef ___INPUT_H_
#define ___INPUT_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef WIN32
#include <conio.h>
#define CLEAR "cls"
#else
#include <termios.h>
#define CLEAR "clear"
int kbhit(void);
int getch();
#endif
extern FILE * logFile;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,81 +0,0 @@
/****************************************************************************
* Copyright (C) 2010-2012
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*****************************************************d**********************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "Input.h"
#include "network.h"
int main(int argc, char *argv[])
{
char inputChar = 0;
if(NetInit() < 0)
{
printf("Can't open socket.\n");
usleep(999999);
usleep(999999);
return 0;
}
if(Bind() < 0)
{
printf("Can't bind socket.\n");
usleep(999999);
usleep(999999);
return 0;
}
printf("UdpDebugReader by Dimok\n");
printf("q = quit\n");
printf("f = start/stop writing log to file\n");
printf("c = clear console\n");
int ret;
char data[RECEIVE_BLOCK_SIZE+1];
memset(data, 0, sizeof(data));
while(inputChar != 'q')
{
inputChar = CheckInput();
ret = NetRead(data, RECEIVE_BLOCK_SIZE);
if(ret > 0)
{
data[ret] = '\0';
printf("%s", data);
if(logFile)
fwrite(data, 1, ret, logFile);
}
}
if(logFile)
fclose(logFile);
CloseSocket();
return 0;
}

View File

@ -1,107 +0,0 @@
/****************************************************************************
* Copyright (C) 2010-2012
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "network.h" // Include Winsock Library
static int sock_id = -1;
static struct sockaddr_in servaddr;
int Bind()
{
memset(&servaddr,0,sizeof(servaddr));
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(LISTEN_PORT);
servaddr.sin_family = AF_INET;
if (bind(sock_id, (struct sockaddr*)&servaddr, sizeof(servaddr)) < 0)
{
close(sock_id);
return -1;
}
return 0;
}
void CloseSocket()
{
if(sock_id < 0)
return;
close(sock_id);
sock_id = -1;
}
int NetInit()
{
if(sock_id >= 0)
return sock_id;
#ifdef WIN32
WSADATA wsaData;
// Initialize Winsock
if (WSAStartup(MAKEWORD(2,2), &wsaData) == SOCKET_ERROR)
return -1;
#endif
//Get a socket
if((sock_id = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP)) == -1)
return -1;
#ifdef WIN32
u_long mode = 1;
ioctlsocket(sock_id, FIONBIO, &mode);
#else
int flags = fcntl(sock_id, F_GETFL, 0);
fcntl(sock_id, F_SETFL, flags | O_NONBLOCK);
#endif
return sock_id;
}
int NetRead(void *buffer, unsigned int buf_len)
{
if(sock_id < 0)
return sock_id;
fd_set fdsRead;
FD_ZERO(&fdsRead);
FD_SET(sock_id, &fdsRead);
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 10000;
if(select(sock_id + 1, &fdsRead, NULL, NULL, &tv) != 1) {
return 0;
}
int len = sizeof(servaddr);
return recvfrom(sock_id,buffer, buf_len, 0,(struct sockaddr *)&servaddr, &len);
}

View File

@ -1,52 +0,0 @@
/****************************************************************************
* Copyright (C) 2010-2012
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef __NETWORK_H_
#define __NETWORK_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef WIN32
#include "winsock/winsock.h" // Include Winsock Library
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <fcntl.h>
#endif
#define RECEIVE_BLOCK_SIZE 4096
#define LISTEN_PORT 4405
int NetInit();
int Bind();
void CloseSocket();
int NetRead(void *buffer, unsigned int buf_len);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,536 +0,0 @@
/*
Definitions for winsock 1.1
Portions Copyright (c) 1980, 1983, 1988, 1993
The Regents of the University of California. All rights reserved.
Portions Copyright (c) 1993 by Digital Equipment Corporation.
*/
#ifndef _WINSOCK_H
#define _WINSOCK_H
#if __GNUC__ >=3
#pragma GCC system_header
#endif
#define _GNU_H_WINDOWS32_SOCKETS
#include <windows.h>
#ifdef __cplusplus
extern "C" {
#endif
#if !defined ( _BSDTYPES_DEFINED )
/* also defined in gmon.h and in cygwin's sys/types */
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
#define _BSDTYPES_DEFINED
#endif /* !defined _BSDTYPES_DEFINED */
typedef u_int SOCKET;
#ifndef FD_SETSIZE
#define FD_SETSIZE 64
#endif
/* shutdown() how types */
#define SD_RECEIVE 0x00
#define SD_SEND 0x01
#define SD_BOTH 0x02
#ifndef _SYS_TYPES_FD_SET
/* fd_set may have be defined by the newlib <sys/types.h>
* if __USE_W32_SOCKETS not defined.
*/
#ifdef fd_set
#undef fd_set
#endif
typedef struct fd_set {
u_int fd_count;
SOCKET fd_array[FD_SETSIZE];
} fd_set;
int PASCAL __WSAFDIsSet(SOCKET,fd_set*);
#ifndef FD_CLR
#define FD_CLR(fd,set) do { u_int __i;\
for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\
if (((fd_set *)(set))->fd_array[__i] == (fd)) {\
while (__i < ((fd_set *)(set))->fd_count-1) {\
((fd_set*)(set))->fd_array[__i] = ((fd_set*)(set))->fd_array[__i+1];\
__i++;\
}\
((fd_set*)(set))->fd_count--;\
break;\
}\
}\
} while (0)
#endif
#ifndef FD_SET
#define FD_SET(fd, set) do { \
if (((fd_set *)(set))->fd_count < FD_SETSIZE) \
((fd_set *)(set))->fd_array[((fd_set *)(set))->fd_count++]=(fd);\
}while (0)
#endif
#ifndef FD_ZERO
#define FD_ZERO(set) (((fd_set *)(set))->fd_count=0)
#endif
#ifndef FD_ISSET
#define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set *)(set))
#endif
#elif !defined(USE_SYS_TYPES_FD_SET)
#warning "fd_set and associated macros have been defined in sys/types. \
This can cause runtime problems with W32 sockets"
#endif /* ndef _SYS_TYPES_FD_SET */
#if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
#ifndef _TIMEVAL_DEFINED /* also in sys/time.h */
#define _TIMEVAL_DEFINED
struct timeval {
long tv_sec;
long tv_usec;
};
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
#define timercmp(tvp, uvp, cmp) \
(((tvp)->tv_sec != (uvp)->tv_sec) ? \
((tvp)->tv_sec cmp (uvp)->tv_sec) : \
((tvp)->tv_usec cmp (uvp)->tv_usec))
#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
#endif /* _TIMEVAL_DEFINED */
struct hostent {
char *h_name;
char **h_aliases;
short h_addrtype;
short h_length;
char **h_addr_list;
#define h_addr h_addr_list[0]
};
struct linger {
u_short l_onoff;
u_short l_linger;
};
#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
#define IOCPARM_MASK 0x7f
#define IOC_VOID 0x20000000
#define IOC_OUT 0x40000000
#define IOC_IN 0x80000000
#define IOC_INOUT (IOC_IN|IOC_OUT)
#if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
#define _IO(x,y) (IOC_VOID|((x)<<8)|(y))
#define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
#define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
#define FIONBIO _IOW('f', 126, u_long)
#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
#define FIONREAD _IOR('f', 127, u_long)
#define FIOASYNC _IOW('f', 125, u_long)
#define SIOCSHIWAT _IOW('s', 0, u_long)
#define SIOCGHIWAT _IOR('s', 1, u_long)
#define SIOCSLOWAT _IOW('s', 2, u_long)
#define SIOCGLOWAT _IOR('s', 3, u_long)
#define SIOCATMARK _IOR('s', 7, u_long)
#if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
struct netent {
char * n_name;
char **n_aliases;
short n_addrtype;
u_long n_net;
};
struct servent {
char *s_name;
char **s_aliases;
short s_port;
char *s_proto;
};
struct protoent {
char *p_name;
char **p_aliases;
short p_proto;
};
#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
#define IPPROTO_IP 0
#define IPPROTO_ICMP 1
#define IPPROTO_IGMP 2
#define IPPROTO_GGP 3
#define IPPROTO_TCP 6
#define IPPROTO_PUP 12
#define IPPROTO_UDP 17
#define IPPROTO_IDP 22
#define IPPROTO_ND 77
#define IPPROTO_RAW 255
#define IPPROTO_MAX 256
#define IPPORT_ECHO 7
#define IPPORT_DISCARD 9
#define IPPORT_SYSTAT 11
#define IPPORT_DAYTIME 13
#define IPPORT_NETSTAT 15
#define IPPORT_FTP 21
#define IPPORT_TELNET 23
#define IPPORT_SMTP 25
#define IPPORT_TIMESERVER 37
#define IPPORT_NAMESERVER 42
#define IPPORT_WHOIS 43
#define IPPORT_MTP 57
#define IPPORT_TFTP 69
#define IPPORT_RJE 77
#define IPPORT_FINGER 79
#define IPPORT_TTYLINK 87
#define IPPORT_SUPDUP 95
#define IPPORT_EXECSERVER 512
#define IPPORT_LOGINSERVER 513
#define IPPORT_CMDSERVER 514
#define IPPORT_EFSSERVER 520
#define IPPORT_BIFFUDP 512
#define IPPORT_WHOSERVER 513
#define IPPORT_ROUTESERVER 520
#define IPPORT_RESERVED 1024
#define IMPLINK_IP 155
#define IMPLINK_LOWEXPER 156
#define IMPLINK_HIGHEXPER 158
struct in_addr {
union {
struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
struct { u_short s_w1,s_w2; } S_un_w;
u_long S_addr;
} S_un;
#define s_addr S_un.S_addr
#define s_host S_un.S_un_b.s_b2
#define s_net S_un.S_un_b.s_b1
#define s_imp S_un.S_un_w.s_w2
#define s_impno S_un.S_un_b.s_b4
#define s_lh S_un.S_un_b.s_b3
};
#define IN_CLASSA(i) (((long)(i)&0x80000000) == 0)
#define IN_CLASSA_NET 0xff000000
#define IN_CLASSA_NSHIFT 24
#define IN_CLASSA_HOST 0x00ffffff
#define IN_CLASSA_MAX 128
#define IN_CLASSB(i) (((long)(i)&0xc0000000)==0x80000000)
#define IN_CLASSB_NET 0xffff0000
#define IN_CLASSB_NSHIFT 16
#define IN_CLASSB_HOST 0x0000ffff
#define IN_CLASSB_MAX 65536
#define IN_CLASSC(i) (((long)(i)&0xe0000000)==0xc0000000)
#define IN_CLASSC_NET 0xffffff00
#define IN_CLASSC_NSHIFT 8
#define IN_CLASSC_HOST 0xff
#define INADDR_ANY (u_long)0
#define INADDR_LOOPBACK 0x7f000001
#define INADDR_BROADCAST (u_long)0xffffffff
#define INADDR_NONE 0xffffffff
struct sockaddr_in {
short sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
#define WSADESCRIPTION_LEN 256
#define WSASYS_STATUS_LEN 128
typedef struct WSAData {
WORD wVersion;
WORD wHighVersion;
char szDescription[WSADESCRIPTION_LEN+1];
char szSystemStatus[WSASYS_STATUS_LEN+1];
unsigned short iMaxSockets;
unsigned short iMaxUdpDg;
char * lpVendorInfo;
} WSADATA;
typedef WSADATA *LPWSADATA;
#if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
#define IP_OPTIONS 1
#define SO_DEBUG 1
#define SO_ACCEPTCONN 2
#define SO_REUSEADDR 4
#define SO_KEEPALIVE 8
#define SO_DONTROUTE 16
#define SO_BROADCAST 32
#define SO_USELOOPBACK 64
#define SO_LINGER 128
#define SO_OOBINLINE 256
#define SO_DONTLINGER (u_int)(~SO_LINGER)
#define SO_SNDBUF 0x1001
#define SO_RCVBUF 0x1002
#define SO_SNDLOWAT 0x1003
#define SO_RCVLOWAT 0x1004
#define SO_SNDTIMEO 0x1005
#define SO_RCVTIMEO 0x1006
#define SO_ERROR 0x1007
#define SO_TYPE 0x1008
#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
/*
* Note that the next 5 IP defines are specific to WinSock 1.1 (wsock32.dll).
* They will cause errors or unexpected results if used with the
* (gs)etsockopts exported from the WinSock 2 lib, ws2_32.dll. Refer ws2tcpip.h.
*/
#define IP_MULTICAST_IF 2
#define IP_MULTICAST_TTL 3
#define IP_MULTICAST_LOOP 4
#define IP_ADD_MEMBERSHIP 5
#define IP_DROP_MEMBERSHIP 6
#define IP_DEFAULT_MULTICAST_TTL 1
#define IP_DEFAULT_MULTICAST_LOOP 1
#define IP_MAX_MEMBERSHIPS 20
struct ip_mreq {
struct in_addr imr_multiaddr;
struct in_addr imr_interface;
};
#define INVALID_SOCKET (SOCKET)(~0)
#define SOCKET_ERROR (-1)
#define SOCK_STREAM 1
#define SOCK_DGRAM 2
#define SOCK_RAW 3
#define SOCK_RDM 4
#define SOCK_SEQPACKET 5
#define TCP_NODELAY 0x0001
#define AF_UNSPEC 0
#define AF_UNIX 1
#define AF_INET 2
#define AF_IMPLINK 3
#define AF_PUP 4
#define AF_CHAOS 5
#define AF_IPX 6
#define AF_NS 6
#define AF_ISO 7
#define AF_OSI AF_ISO
#define AF_ECMA 8
#define AF_DATAKIT 9
#define AF_CCITT 10
#define AF_SNA 11
#define AF_DECnet 12
#define AF_DLI 13
#define AF_LAT 14
#define AF_HYLINK 15
#define AF_APPLETALK 16
#define AF_NETBIOS 17
#define AF_VOICEVIEW 18
#define AF_FIREFOX 19
#define AF_UNKNOWN1 20
#define AF_BAN 21
#define AF_ATM 22
#define AF_INET6 23
#if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
#define AF_MAX 24
struct sockaddr {
u_short sa_family;
char sa_data[14];
};
#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
struct sockproto {
u_short sp_family;
u_short sp_protocol;
};
#define PF_UNSPEC AF_UNSPEC
#define PF_UNIX AF_UNIX
#define PF_INET AF_INET
#define PF_IMPLINK AF_IMPLINK
#define PF_PUP AF_PUP
#define PF_CHAOS AF_CHAOS
#define PF_NS AF_NS
#define PF_IPX AF_IPX
#define PF_ISO AF_ISO
#define PF_OSI AF_OSI
#define PF_ECMA AF_ECMA
#define PF_DATAKIT AF_DATAKIT
#define PF_CCITT AF_CCITT
#define PF_SNA AF_SNA
#define PF_DECnet AF_DECnet
#define PF_DLI AF_DLI
#define PF_LAT AF_LAT
#define PF_HYLINK AF_HYLINK
#define PF_APPLETALK AF_APPLETALK
#define PF_VOICEVIEW AF_VOICEVIEW
#define PF_FIREFOX AF_FIREFOX
#define PF_UNKNOWN1 AF_UNKNOWN1
#define PF_BAN AF_BAN
#define PF_ATM AF_ATM
#define PF_INET6 AF_INET6
#define PF_MAX AF_MAX
#define SOL_SOCKET 0xffff
#define SOMAXCONN 5
#if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
#define MSG_OOB 1
#define MSG_PEEK 2
#define MSG_DONTROUTE 4
#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
#define MSG_MAXIOVLEN 16
#define MSG_PARTIAL 0x8000
#define MAXGETHOSTSTRUCT 1024
#define FD_READ 1
#define FD_WRITE 2
#define FD_OOB 4
#define FD_ACCEPT 8
#define FD_CONNECT 16
#define FD_CLOSE 32
#ifndef WSABASEERR
#define WSABASEERR 10000
#define WSAEINTR (WSABASEERR+4)
#define WSAEBADF (WSABASEERR+9)
#define WSAEACCES (WSABASEERR+13)
#define WSAEFAULT (WSABASEERR+14)
#define WSAEINVAL (WSABASEERR+22)
#define WSAEMFILE (WSABASEERR+24)
#define WSAEWOULDBLOCK (WSABASEERR+35)
#define WSAEINPROGRESS (WSABASEERR+36)
#define WSAEALREADY (WSABASEERR+37)
#define WSAENOTSOCK (WSABASEERR+38)
#define WSAEDESTADDRREQ (WSABASEERR+39)
#define WSAEMSGSIZE (WSABASEERR+40)
#define WSAEPROTOTYPE (WSABASEERR+41)
#define WSAENOPROTOOPT (WSABASEERR+42)
#define WSAEPROTONOSUPPORT (WSABASEERR+43)
#define WSAESOCKTNOSUPPORT (WSABASEERR+44)
#define WSAEOPNOTSUPP (WSABASEERR+45)
#define WSAEPFNOSUPPORT (WSABASEERR+46)
#define WSAEAFNOSUPPORT (WSABASEERR+47)
#define WSAEADDRINUSE (WSABASEERR+48)
#define WSAEADDRNOTAVAIL (WSABASEERR+49)
#define WSAENETDOWN (WSABASEERR+50)
#define WSAENETUNREACH (WSABASEERR+51)
#define WSAENETRESET (WSABASEERR+52)
#define WSAECONNABORTED (WSABASEERR+53)
#define WSAECONNRESET (WSABASEERR+54)
#define WSAENOBUFS (WSABASEERR+55)
#define WSAEISCONN (WSABASEERR+56)
#define WSAENOTCONN (WSABASEERR+57)
#define WSAESHUTDOWN (WSABASEERR+58)
#define WSAETOOMANYREFS (WSABASEERR+59)
#define WSAETIMEDOUT (WSABASEERR+60)
#define WSAECONNREFUSED (WSABASEERR+61)
#define WSAELOOP (WSABASEERR+62)
#define WSAENAMETOOLONG (WSABASEERR+63)
#define WSAEHOSTDOWN (WSABASEERR+64)
#define WSAEHOSTUNREACH (WSABASEERR+65)
#define WSAENOTEMPTY (WSABASEERR+66)
#define WSAEPROCLIM (WSABASEERR+67)
#define WSAEUSERS (WSABASEERR+68)
#define WSAEDQUOT (WSABASEERR+69)
#define WSAESTALE (WSABASEERR+70)
#define WSAEREMOTE (WSABASEERR+71)
#define WSAEDISCON (WSABASEERR+101)
#define WSASYSNOTREADY (WSABASEERR+91)
#define WSAVERNOTSUPPORTED (WSABASEERR+92)
#define WSANOTINITIALISED (WSABASEERR+93)
#define WSAHOST_NOT_FOUND (WSABASEERR+1001)
#define WSATRY_AGAIN (WSABASEERR+1002)
#define WSANO_RECOVERY (WSABASEERR+1003)
#define WSANO_DATA (WSABASEERR+1004)
#endif /* !WSABASEERR */
#define WSANO_ADDRESS WSANO_DATA
#if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
#define h_errno WSAGetLastError()
#define HOST_NOT_FOUND WSAHOST_NOT_FOUND
#define TRY_AGAIN WSATRY_AGAIN
#define NO_RECOVERY WSANO_RECOVERY
#define NO_DATA WSANO_DATA
#define NO_ADDRESS WSANO_ADDRESS
#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
SOCKET PASCAL accept(SOCKET,struct sockaddr*,int*);
int PASCAL bind(SOCKET,const struct sockaddr*,int);
int PASCAL closesocket(SOCKET);
int PASCAL connect(SOCKET,const struct sockaddr*,int);
int PASCAL ioctlsocket(SOCKET,long,u_long *);
int PASCAL getpeername(SOCKET,struct sockaddr*,int*);
int PASCAL getsockname(SOCKET,struct sockaddr*,int*);
int PASCAL getsockopt(SOCKET,int,int,char*,int*);
unsigned long PASCAL inet_addr(const char*);
DECLARE_STDCALL_P(char *) inet_ntoa(struct in_addr);
int PASCAL listen(SOCKET,int);
int PASCAL recv(SOCKET,char*,int,int);
int PASCAL recvfrom(SOCKET,char*,int,int,struct sockaddr*,int*);
int PASCAL send(SOCKET,const char*,int,int);
int PASCAL sendto(SOCKET,const char*,int,int,const struct sockaddr*,int);
int PASCAL setsockopt(SOCKET,int,int,const char*,int);
int PASCAL shutdown(SOCKET,int);
SOCKET PASCAL socket(int,int,int);
DECLARE_STDCALL_P(struct hostent *) gethostbyaddr(const char*,int,int);
DECLARE_STDCALL_P(struct hostent *) gethostbyname(const char*);
DECLARE_STDCALL_P(struct servent *) getservbyport(int,const char*);
DECLARE_STDCALL_P(struct servent *) getservbyname(const char*,const char*);
DECLARE_STDCALL_P(struct protoent *) getprotobynumber(int);
DECLARE_STDCALL_P(struct protoent *) getprotobyname(const char*);
int PASCAL WSAStartup(WORD,LPWSADATA);
int PASCAL WSACleanup(void);
void PASCAL WSASetLastError(int);
int PASCAL WSAGetLastError(void);
BOOL PASCAL WSAIsBlocking(void);
int PASCAL WSAUnhookBlockingHook(void);
FARPROC PASCAL WSASetBlockingHook(FARPROC);
int PASCAL WSACancelBlockingCall(void);
HANDLE PASCAL WSAAsyncGetServByName(HWND,u_int,const char*,const char*,char*,int);
HANDLE PASCAL WSAAsyncGetServByPort(HWND,u_int,int,const char*,char*,int);
HANDLE PASCAL WSAAsyncGetProtoByName(HWND,u_int,const char*,char*,int);
HANDLE PASCAL WSAAsyncGetProtoByNumber(HWND,u_int,int,char*,int);
HANDLE PASCAL WSAAsyncGetHostByName(HWND,u_int,const char*,char*,int);
HANDLE PASCAL WSAAsyncGetHostByAddr(HWND,u_int,const char*,int,int,char*,int);
int PASCAL WSACancelAsyncRequest(HANDLE);
int PASCAL WSAAsyncSelect(SOCKET,HWND,u_int,long);
#if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
u_long PASCAL htonl(u_long);
u_long PASCAL ntohl(u_long);
u_short PASCAL htons(u_short);
u_short PASCAL ntohs(u_short);
int PASCAL select(int nfds,fd_set*,fd_set*,fd_set*,const struct timeval*);
int PASCAL gethostname(char*,int);
#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
#define WSAMAKEASYNCREPLY(b,e) MAKELONG(b,e)
#define WSAMAKESELECTREPLY(e,error) MAKELONG(e,error)
#define WSAGETASYNCBUFLEN(l) LOWORD(l)
#define WSAGETASYNCERROR(l) HIWORD(l)
#define WSAGETSELECTEVENT(l) LOWORD(l)
#define WSAGETSELECTERROR(l) HIWORD(l)
typedef struct sockaddr SOCKADDR;
typedef struct sockaddr *PSOCKADDR;
typedef struct sockaddr *LPSOCKADDR;
typedef struct sockaddr_in SOCKADDR_IN;
typedef struct sockaddr_in *PSOCKADDR_IN;
typedef struct sockaddr_in *LPSOCKADDR_IN;
typedef struct linger LINGER;
typedef struct linger *PLINGER;
typedef struct linger *LPLINGER;
typedef struct in_addr IN_ADDR;
typedef struct in_addr *PIN_ADDR;
typedef struct in_addr *LPIN_ADDR;
typedef struct fd_set FD_SET;
typedef struct fd_set *PFD_SET;
typedef struct fd_set *LPFD_SET;
typedef struct hostent HOSTENT;
typedef struct hostent *PHOSTENT;
typedef struct hostent *LPHOSTENT;
typedef struct servent SERVENT;
typedef struct servent *PSERVENT;
typedef struct servent *LPSERVENT;
typedef struct protoent PROTOENT;
typedef struct protoent *PPROTOENT;
typedef struct protoent *LPPROTOENT;
typedef struct timeval TIMEVAL;
typedef struct timeval *PTIMEVAL;
typedef struct timeval *LPTIMEVAL;
#ifdef __cplusplus
}
#endif
/*
* Recent MSDN docs indicate that the MS-specific extensions exported from
* mswsock.dll (AcceptEx, TransmitFile. WSARecEx and GetAcceptExSockaddrs) are
* declared in mswsock.h. These extensions are not supported on W9x or WinCE.
* However, code using WinSock 1.1 API may expect the declarations and
* associated defines to be in this header. Thus we include mswsock.h here.
*
* When linking against the WinSock 1.1 lib, wsock32.dll, the mswsock functions
* are automatically routed to mswsock.dll (on platforms with support).
* The WinSock 2 lib, ws2_32.dll, does not contain any references to
* the mswsock extensions.
*/
#include <mswsock.h>
#endif

Binary file not shown.