Format the code via clang-format

This commit is contained in:
Maschell 2022-02-05 14:28:08 +01:00
parent 7895e05264
commit 4a0e27624b
79 changed files with 1372 additions and 1302 deletions

67
.clang-format Normal file
View File

@ -0,0 +1,67 @@
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: false
ContinuationIndentWidth: 8
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Right
ReflowComments: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Never

25
.github/workflows/pr.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: CI-PR
on: [pull_request]
jobs:
clang-format:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: clang-format
run: |
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source ./include
build-binary:
runs-on: ubuntu-18.04
needs: clang-format
steps:
- uses: actions/checkout@v2
- name: build binary
run: |
docker build . -f Dockerfile.buildlocal -t builder
docker run --rm -v ${PWD}:/project builder make
- uses: actions/upload-artifact@master
with:
name: binary
path: "lib/*.a"

View File

@ -4,8 +4,16 @@ on:
branches: branches:
- master - master
jobs: jobs:
clang-format:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: clang-format
run: |
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source ./include
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: clang-format
steps: steps:
- uses: actions/checkout@master - uses: actions/checkout@master
- name: Get release version - name: Get release version

3
Dockerfile.buildlocal Normal file
View File

@ -0,0 +1,3 @@
FROM wiiuenv/devkitppc:20211229
WORKDIR project

View File

@ -1,22 +1,16 @@
[![Publish Docker Image](https://github.com/wiiu-env/libgui/actions/workflows/push_image.yml/badge.svg)](https://github.com/wiiu-env/libgui/actions/workflows/push_image.yml)
# libgui # libgui
[![Build Status](https://travis-ci.org/Maschell/libgui.svg?branch=wut)](https://travis-ci.org/Maschell/libgui/tree/wut) [![Build Status](https://travis-ci.org/Maschell/libgui.svg?branch=wut)](https://travis-ci.org/Maschell/libgui/tree/wut)
# build
```
pacman -Syu ppc-portlibs
pacman -Syu ppc-glm ppc-libmad
```
## Usage ## Usage
Following steps are required for initialization: Following steps are required for initialization:
```C ```C
memoryInitialize(); // Initialize memory management libgui_memoryInitialize(); // Initialize memory management
//DO GUI STUFF HERE! //DO GUI STUFF HERE!
memoryRelease(); libgui_memoryRelease();
``` ```
Link the application with: Link the application with:
@ -39,6 +33,20 @@ To be able to use libgui, you need to install the following dependencies:
- [wut](https://github.com/devkitPro/wut/) - [wut](https://github.com/devkitPro/wut/)
- Install the required portlibs via `(dkp-)pacman -Syu ppc-zlib ppc-libmad ppc-libogg ppc-libgd ppc-freetype ppc-libjpeg-turbo ppc-libpng ppc-libvorbisidec ppc-glm ppc-bzip2` - Install the required portlibs via `(dkp-)pacman -Syu ppc-zlib ppc-libmad ppc-libogg ppc-libgd ppc-freetype ppc-libjpeg-turbo ppc-libpng ppc-libvorbisidec ppc-glm ppc-bzip2`
## Use this lib in Dockerfiles.
A prebuilt version of this lib can found on dockerhub. To use it for your projects, add this to your Dockerfile.
```
[...]
COPY --from=wiiuenv/libgui:[tag] /artifacts $DEVKITPRO
[...]
```
Replace [tag] with a tag you want to use, a list of tags can be found [here](https://hub.docker.com/r/wiiuenv/libgui/tags).
It's highly recommended to pin the version to the **latest date** instead of using `latest`.
## Format the code via docker
`docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source ./include -i`
# Credits # Credits
- Orignally based on https://github.com/dborth/libwiigui - Orignally based on https://github.com/dborth/libwiigui
- Wii U port / modification / new functions / sound / much more by dimok. - Wii U port / modification / new functions / sound / much more by dimok.

View File

@ -22,16 +22,16 @@
#pragma once #pragma once
#include <string>
#include <ft2build.h> #include <ft2build.h>
#include <string>
#include FT_FREETYPE_H #include FT_FREETYPE_H
#include FT_BITMAP_H #include FT_BITMAP_H
#include <malloc.h> #include <malloc.h>
#include <string.h>
#include <wchar.h>
#include <map> #include <map>
#include <mutex> #include <mutex>
#include <string.h>
#include <wchar.h>
#include <gui/gx2_ext.h> #include <gui/gx2_ext.h>
@ -72,7 +72,7 @@ typedef struct ftgxDataOffset_ {
typedef struct ftgxCharData_ ftgxCharData; typedef struct ftgxCharData_ ftgxCharData;
typedef struct ftgxDataOffset_ ftgxDataOffset; typedef struct ftgxDataOffset_ ftgxDataOffset;
#define _TEXT(t) L ## t /**< Unicode helper macro. */ #define _TEXT(t) L##t /**< Unicode helper macro. */
#define FTGX_NULL 0x0000 #define FTGX_NULL 0x0000
#define FTGX_JUSTIFY_LEFT 0x0001 #define FTGX_JUSTIFY_LEFT 0x0001
@ -94,9 +94,8 @@ typedef struct ftgxDataOffset_ ftgxDataOffset;
#define FTGX_STYLE_MASK 0xf000 #define FTGX_STYLE_MASK 0xf000
/**< Constant color value used only to sanitize Doxygen documentation. */ /**< Constant color value used only to sanitize Doxygen documentation. */
static const GX2ColorF32 ftgxWhite = (GX2ColorF32) { static const GX2ColorF32 ftgxWhite = (GX2ColorF32){
1.0f, 1.0f, 1.0f, 1.0f 1.0f, 1.0f, 1.0f, 1.0f};
};
//! forward declaration //! forward declaration

View File

@ -30,13 +30,13 @@
#include <gui/GuiImageAsync.h> #include <gui/GuiImageAsync.h>
#include <gui/GuiImageData.h> #include <gui/GuiImageData.h>
#include <gui/GuiParticleImage.h> #include <gui/GuiParticleImage.h>
#include <gui/GuiScrollbar.h>
#include <gui/GuiSelectBox.h> #include <gui/GuiSelectBox.h>
#include <gui/GuiSound.h> #include <gui/GuiSound.h>
#include <gui/GuiSwitch.h> #include <gui/GuiSwitch.h>
#include <gui/GuiText.h> #include <gui/GuiText.h>
#include <gui/GuiToggle.h> #include <gui/GuiToggle.h>
#include <gui/GuiTrigger.h> #include <gui/GuiTrigger.h>
#include <gui/GuiScrollbar.h>
#include <gui/VPadController.h> #include <gui/VPadController.h>
#include <gui/WPadController.h> #include <gui/WPadController.h>

View File

@ -17,11 +17,11 @@
#ifndef GUI_BUTTON_H_ #ifndef GUI_BUTTON_H_
#define GUI_BUTTON_H_ #define GUI_BUTTON_H_
#include <gui/GuiElement.h>
#include <gui/GuiText.h>
#include <gui/GuiController.h> #include <gui/GuiController.h>
#include <gui/GuiElement.h>
#include <gui/GuiImage.h> #include <gui/GuiImage.h>
#include <gui/GuiSound.h> #include <gui/GuiSound.h>
#include <gui/GuiText.h>
#include <gui/GuiTrigger.h> #include <gui/GuiTrigger.h>
#include <gui/gx2_ext.h> #include <gui/gx2_ext.h>
@ -110,6 +110,7 @@ public:
sigslot::signal3<GuiButton *, const GuiController *, GuiTrigger *> clicked; sigslot::signal3<GuiButton *, const GuiController *, GuiTrigger *> clicked;
sigslot::signal3<GuiButton *, const GuiController *, GuiTrigger *> held; sigslot::signal3<GuiButton *, const GuiController *, GuiTrigger *> held;
sigslot::signal3<GuiButton *, const GuiController *, GuiTrigger *> released; sigslot::signal3<GuiButton *, const GuiController *, GuiTrigger *> released;
protected: protected:
static const int32_t iMaxGuiTriggers = 10; static const int32_t iMaxGuiTriggers = 10;

View File

@ -17,9 +17,9 @@
#ifndef GUI_CHECKBOX_H_ #ifndef GUI_CHECKBOX_H_
#define GUI_CHECKBOX_H_ #define GUI_CHECKBOX_H_
#include <gui/GuiToggle.h>
#include <gui/GuiImage.h> #include <gui/GuiImage.h>
#include <gui/GuiImageData.h> #include <gui/GuiImageData.h>
#include <gui/GuiToggle.h>
//!A simple CheckBox //!A simple CheckBox
class GuiCheckBox : public GuiToggle { class GuiCheckBox : public GuiToggle {

View File

@ -17,8 +17,8 @@
#ifndef GUI_CONTROLLER_H_ #ifndef GUI_CONTROLLER_H_
#define GUI_CONTROLLER_H_ #define GUI_CONTROLLER_H_
#include <string.h>
#include <gui/GuiTrigger.h> #include <gui/GuiTrigger.h>
#include <string.h>
class GuiController { class GuiController {
public: public:
@ -68,7 +68,6 @@ public:
int32_t chanIdx; int32_t chanIdx;
PadData data; PadData data;
PadData lastData; PadData lastData;
}; };
#endif #endif

View File

@ -17,10 +17,10 @@
#ifndef GUI_DRAG_LISTENER_H_ #ifndef GUI_DRAG_LISTENER_H_
#define GUI_DRAG_LISTENER_H_ #define GUI_DRAG_LISTENER_H_
#include <gui/GuiElement.h>
#include <gui/GuiController.h>
#include <gui/GuiTrigger.h>
#include <gui/GuiButton.h> #include <gui/GuiButton.h>
#include <gui/GuiController.h>
#include <gui/GuiElement.h>
#include <gui/GuiTrigger.h>
class GuiDragListener : public GuiElement { class GuiDragListener : public GuiElement {
public: public:
@ -44,6 +44,7 @@ public:
void update(GuiController *c); void update(GuiController *c);
sigslot::signal5<GuiDragListener *, const GuiController *, GuiTrigger *, int32_t, int32_t> dragged; sigslot::signal5<GuiDragListener *, const GuiController *, GuiTrigger *, int32_t, int32_t> dragged;
protected: protected:
static const int32_t iMaxGuiTriggers = 10; static const int32_t iMaxGuiTriggers = 10;

View File

@ -21,18 +21,18 @@
#include <vector> #include <vector>
#include <malloc.h> #include <malloc.h>
#include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <wchar.h> #include <wchar.h>
#include <math.h>
#include <gui/gx2_ext.h> #include <gui/gx2_ext.h>
#include <gui/sigslot.h>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/matrix_transform.hpp>
#include <gui/sigslot.h>
enum { enum {
@ -471,10 +471,7 @@ public:
//!\param y Y coordinate //!\param y Y coordinate
//!\return true if contained within, false otherwise //!\return true if contained within, false otherwise
virtual bool isInside(float x, float y) { virtual bool isInside(float x, float y) {
return (x > (this->getCenterX() - getScaleX() * getWidth() * 0.5f) return (x > (this->getCenterX() - getScaleX() * getWidth() * 0.5f) && x < (this->getCenterX() + getScaleX() * getWidth() * 0.5f) && y > (this->getCenterY() - getScaleY() * getHeight() * 0.5f) && y < (this->getCenterY() + getScaleY() * getHeight() * 0.5f));
&& x < (this->getCenterX() + getScaleX() * getWidth() * 0.5f)
&& y > (this->getCenterY() - getScaleY() * getHeight() * 0.5f)
&& y < (this->getCenterY() + getScaleY() * getHeight() * 0.5f));
} }
//!Sets the element's position //!Sets the element's position
@ -574,6 +571,7 @@ public:
sigslot::signal2<GuiElement *, bool> visibleChanged; sigslot::signal2<GuiElement *, bool> visibleChanged;
sigslot::signal3<GuiElement *, int32_t, int32_t> stateChanged; sigslot::signal3<GuiElement *, int32_t, int32_t> stateChanged;
sigslot::signal1<GuiElement *> effectFinished; sigslot::signal1<GuiElement *> effectFinished;
protected: protected:
bool rumble; //!< Wiimote rumble (on/off) - set to on when this element requests a rumble event bool rumble; //!< Wiimote rumble (on/off) - set to on when this element requests a rumble event
bool visible; //!< Visibility of the element. If false, Draw() is skipped bool visible; //!< Visibility of the element. If false, Draw() is skipped

View File

@ -17,10 +17,10 @@
#ifndef GUI_FRAME_H_ #ifndef GUI_FRAME_H_
#define GUI_FRAME_H_ #define GUI_FRAME_H_
#include <vector>
#include <mutex>
#include <gui/GuiElement.h> #include <gui/GuiElement.h>
#include <gui/sigslot.h> #include <gui/sigslot.h>
#include <mutex>
#include <vector>
//!Allows GuiElements to be grouped together into a "window" //!Allows GuiElements to be grouped together into a "window"
class GuiFrame : public GuiElement { class GuiFrame : public GuiElement {
@ -116,6 +116,7 @@ public:
//! Signals //! Signals
//! On Closing //! On Closing
sigslot::signal1<GuiFrame *> closing; sigslot::signal1<GuiFrame *> closing;
protected: protected:
bool dim; //! Enable/disable dim of a window only bool dim; //! Enable/disable dim of a window only
GuiFrame *parent; //!< Parent Window GuiFrame *parent; //!< Parent Window

View File

@ -17,10 +17,10 @@
#ifndef GUI_IMAGE_H_ #ifndef GUI_IMAGE_H_
#define GUI_IMAGE_H_ #define GUI_IMAGE_H_
#include <gui/video/shaders/Shader.h>
#include <gui/GuiElement.h> #include <gui/GuiElement.h>
#include <gui/GuiImageData.h> #include <gui/GuiImageData.h>
#include <gui/gx2_ext.h> #include <gui/gx2_ext.h>
#include <gui/video/shaders/Shader.h>
//!Display, manage, and manipulate images in the GUI //!Display, manage, and manipulate images in the GUI
class GuiImage : public GuiElement { class GuiImage : public GuiElement {

View File

@ -17,10 +17,10 @@
#ifndef _GUIIMAGEASYNC_H_ #ifndef _GUIIMAGEASYNC_H_
#define _GUIIMAGEASYNC_H_ #define _GUIIMAGEASYNC_H_
#include <mutex>
#include <vector>
#include <gui/GuiImage.h> #include <gui/GuiImage.h>
#include <gui/system/CThread.h> #include <gui/system/CThread.h>
#include <mutex>
#include <vector>
class GuiImageAsync : public GuiImage { class GuiImageAsync : public GuiImage {
public: public:

View File

@ -51,15 +51,21 @@ public:
//!Gets the image width //!Gets the image width
//!\return image width //!\return image width
int32_t getWidth() const { int32_t getWidth() const {
if (texture) { return texture->surface.width; } if (texture) {
else { return 0; } return texture->surface.width;
} else {
return 0;
}
}; };
//!Gets the image height //!Gets the image height
//!\return image height //!\return image height
int32_t getHeight() const { int32_t getHeight() const {
if (texture) { return texture->surface.height; } if (texture) {
else { return 0; } return texture->surface.height;
} else {
return 0;
}
}; };
//! release memory of the image data //! release memory of the image data

View File

@ -24,8 +24,8 @@
#ifndef GUI_SCROLLBAR_HPP_ #ifndef GUI_SCROLLBAR_HPP_
#define GUI_SCROLLBAR_HPP_ #define GUI_SCROLLBAR_HPP_
#include <gui/GuiElement.h>
#include <gui/GuiButton.h> #include <gui/GuiButton.h>
#include <gui/GuiElement.h>
class GuiScrollbar : public GuiElement, public sigslot::has_slots<> { class GuiScrollbar : public GuiElement, public sigslot::has_slots<> {
public: public:

View File

@ -134,7 +134,6 @@ protected:
std::map<GuiButton *, std::string> buttonToValue; std::map<GuiButton *, std::string> buttonToValue;
std::vector<SelectBoxValueButton> valueButtons; std::vector<SelectBoxValueButton> valueButtons;
}; };
#endif #endif

View File

@ -17,9 +17,9 @@
#ifndef GUI_SWTICH_H_ #ifndef GUI_SWTICH_H_
#define GUI_SWTICH_H_ #define GUI_SWTICH_H_
#include <gui/GuiToggle.h>
#include <gui/GuiImage.h> #include <gui/GuiImage.h>
#include <gui/GuiImageData.h> #include <gui/GuiImageData.h>
#include <gui/GuiToggle.h>
//!A simple switch //!A simple switch
class GuiSwitch : public GuiToggle { class GuiSwitch : public GuiToggle {
@ -40,7 +40,6 @@ public:
void setImageHighlighted(GuiImage *img); void setImageHighlighted(GuiImage *img);
protected: protected:
GuiImage *backgroundImg = NULL; GuiImage *backgroundImg = NULL;
GuiImage *onImg = NULL; GuiImage *onImg = NULL;
GuiImage *offImg = NULL; GuiImage *offImg = NULL;

View File

@ -167,6 +167,7 @@ public:
SCROLL_HORIZONTAL, SCROLL_HORIZONTAL,
SCROLL_NONE SCROLL_NONE
}; };
protected: protected:
static FreeTypeGX *presentFont; static FreeTypeGX *presentFont;
static int32_t presetSSAA; static int32_t presetSSAA;

View File

@ -40,7 +40,6 @@ public:
void setChecked() { void setChecked() {
setValue(true); setValue(true);
} }
void setUnchecked() { void setUnchecked() {
@ -56,7 +55,6 @@ public:
void OnToggleClick(GuiButton *button, const GuiController *controller, GuiTrigger *trigger); void OnToggleClick(GuiButton *button, const GuiController *controller, GuiTrigger *trigger);
protected: protected:
bool selected; bool selected;
bool bChanged; bool bChanged;

View File

@ -40,8 +40,7 @@ static const uint32_t attribute_dest_comp_selector[20] = {
GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_X001, GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_X001, GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_X001, GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_X001,
GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW,
GX2_COMP_SEL_XY01, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZ1,
GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW};
};
static const uint32_t texture_comp_selector[54] = { static const uint32_t texture_comp_selector[54] = {
GX2_COMP_SEL_NONE, GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_X001, GX2_COMP_SEL_NONE, GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_X001,
@ -52,8 +51,7 @@ static const uint32_t texture_comp_selector[54] = {
GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_NONE, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_NONE, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW,
GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_X001, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_X001,
GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_XYZ1,
GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01 GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01};
};
static inline void GX2InitDepthBuffer(GX2DepthBuffer *depthBuffer, GX2SurfaceDim dim, uint32_t width, uint32_t height, uint32_t depth, GX2SurfaceFormat format, GX2AAMode aa) { static inline void GX2InitDepthBuffer(GX2DepthBuffer *depthBuffer, GX2SurfaceDim dim, uint32_t width, uint32_t height, uint32_t depth, GX2SurfaceFormat format, GX2AAMode aa) {
depthBuffer->surface.dim = dim; depthBuffer->surface.dim = dim;
@ -63,8 +61,7 @@ static inline void GX2InitDepthBuffer(GX2DepthBuffer *depthBuffer, GX2SurfaceDim
depthBuffer->surface.mipLevels = 1; depthBuffer->surface.mipLevels = 1;
depthBuffer->surface.format = format; depthBuffer->surface.format = format;
depthBuffer->surface.aa = aa; depthBuffer->surface.aa = aa;
depthBuffer->surface.use = (GX2SurfaceUse) (((format == GX2_SURFACE_FORMAT_UNORM_R24_X8) || (format == GX2_SURFACE_FORMAT_FLOAT_D24_S8)) ? depthBuffer->surface.use = (GX2SurfaceUse) (((format == GX2_SURFACE_FORMAT_UNORM_R24_X8) || (format == GX2_SURFACE_FORMAT_FLOAT_D24_S8)) ? GX2_SURFACE_USE_DEPTH_BUFFER : (GX2_SURFACE_USE_DEPTH_BUFFER | GX2_SURFACE_USE_TEXTURE));
GX2_SURFACE_USE_DEPTH_BUFFER : (GX2_SURFACE_USE_DEPTH_BUFFER | GX2_SURFACE_USE_TEXTURE));
depthBuffer->surface.tileMode = GX2_TILE_MODE_DEFAULT; depthBuffer->surface.tileMode = GX2_TILE_MODE_DEFAULT;
depthBuffer->surface.swizzle = 0; depthBuffer->surface.swizzle = 0;
depthBuffer->viewMip = 0; depthBuffer->viewMip = 0;
@ -162,4 +159,3 @@ static inline void GX2InitTexture(GX2Texture *tex, uint32_t width, uint32_t heig
#endif #endif
#endif #endif

View File

@ -21,6 +21,7 @@
extern "C" { extern "C" {
#endif #endif
#include <cstdint>
#include <malloc.h> #include <malloc.h>
void libgui_memoryInitialize(void); void libgui_memoryInitialize(void);

View File

@ -77,17 +77,17 @@
#ifndef SIGSLOT_H__ #ifndef SIGSLOT_H__
#define SIGSLOT_H__ #define SIGSLOT_H__
#include <set>
#include <list> #include <list>
#include <set>
#define _SIGSLOT_SINGLE_THREADED #define _SIGSLOT_SINGLE_THREADED
#ifndef SIGSLOT_DEFAULT_MT_POLICY #ifndef SIGSLOT_DEFAULT_MT_POLICY
# ifdef _SIGSLOT_SINGLE_THREADED #ifdef _SIGSLOT_SINGLE_THREADED
# define SIGSLOT_DEFAULT_MT_POLICY single_threaded #define SIGSLOT_DEFAULT_MT_POLICY single_threaded
# else #else
# define SIGSLOT_DEFAULT_MT_POLICY multi_threaded_local #define SIGSLOT_DEFAULT_MT_POLICY multi_threaded_local
# endif #endif
#endif #endif
@ -119,13 +119,13 @@ namespace sigslot {
multi_threaded_global() { multi_threaded_global() {
static bool isinitialised = false; static bool isinitialised = false;
if(!isinitialised) { if (!isinitialised) {
InitializeCriticalSection(get_critsec()); InitializeCriticalSection(get_critsec());
isinitialised = true; isinitialised = true;
} }
} }
multi_threaded_global(const multi_threaded_global&) { multi_threaded_global(const multi_threaded_global &) {
; ;
} }
@ -142,7 +142,7 @@ namespace sigslot {
} }
private: private:
CRITICAL_SECTION* get_critsec() { CRITICAL_SECTION *get_critsec() {
static CRITICAL_SECTION g_critsec; static CRITICAL_SECTION g_critsec;
return &g_critsec; return &g_critsec;
} }
@ -154,7 +154,7 @@ namespace sigslot {
InitializeCriticalSection(&m_critsec); InitializeCriticalSection(&m_critsec);
} }
multi_threaded_local(const multi_threaded_local&) { multi_threaded_local(const multi_threaded_local &) {
InitializeCriticalSection(&m_critsec); InitializeCriticalSection(&m_critsec);
} }
@ -183,7 +183,7 @@ namespace sigslot {
pthread_mutex_init(get_mutex(), NULL); pthread_mutex_init(get_mutex(), NULL);
} }
multi_threaded_global(const multi_threaded_global&) { multi_threaded_global(const multi_threaded_global &) {
; ;
} }
@ -200,7 +200,7 @@ namespace sigslot {
} }
private: private:
pthread_mutex_t* get_mutex() { pthread_mutex_t *get_mutex() {
static pthread_mutex_t g_mutex; static pthread_mutex_t g_mutex;
return &g_mutex; return &g_mutex;
} }
@ -212,7 +212,7 @@ namespace sigslot {
pthread_mutex_init(&m_mutex, NULL); pthread_mutex_init(&m_mutex, NULL);
} }
multi_threaded_local(const multi_threaded_local&) { multi_threaded_local(const multi_threaded_local &) {
pthread_mutex_init(&m_mutex, NULL); pthread_mutex_init(&m_mutex, NULL);
} }
@ -241,7 +241,7 @@ namespace sigslot {
; ;
} }
multi_threaded_global(const multi_threaded_global&) { multi_threaded_global(const multi_threaded_global &) {
; ;
} }
@ -264,7 +264,7 @@ namespace sigslot {
; ;
} }
multi_threaded_local(const multi_threaded_local&) { multi_threaded_local(const multi_threaded_local &) {
; ;
} }
@ -394,10 +394,12 @@ namespace sigslot {
arg5_type) = 0; arg5_type) = 0;
virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type, virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, mt_policy> *clone() = 0; arg5_type, mt_policy> *
clone() = 0;
virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type, virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, mt_policy> *duplicate(has_slots<mt_policy> *pnewdest) = 0; arg5_type, mt_policy> *
duplicate(has_slots<mt_policy> *pnewdest) = 0;
}; };
template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
@ -414,10 +416,12 @@ namespace sigslot {
arg6_type) = 0; arg6_type) = 0;
virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type, virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, mt_policy> *clone() = 0; arg5_type, arg6_type, mt_policy> *
clone() = 0;
virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type, virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, mt_policy> *duplicate(has_slots<mt_policy> *pnewdest) = 0; arg5_type, arg6_type, mt_policy> *
duplicate(has_slots<mt_policy> *pnewdest) = 0;
}; };
template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
@ -434,10 +438,12 @@ namespace sigslot {
arg6_type, arg7_type) = 0; arg6_type, arg7_type) = 0;
virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type, virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, arg7_type, mt_policy> *clone() = 0; arg5_type, arg6_type, arg7_type, mt_policy> *
clone() = 0;
virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type, virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, arg7_type, mt_policy> *duplicate(has_slots<mt_policy> *pnewdest) = 0; arg5_type, arg6_type, arg7_type, mt_policy> *
duplicate(has_slots<mt_policy> *pnewdest) = 0;
}; };
template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
@ -454,10 +460,12 @@ namespace sigslot {
arg6_type, arg7_type, arg8_type) = 0; arg6_type, arg7_type, arg8_type) = 0;
virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type, virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> *clone() = 0; arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> *
clone() = 0;
virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type, virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> *duplicate(has_slots<mt_policy> *pnewdest) = 0; arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> *
duplicate(has_slots<mt_policy> *pnewdest) = 0;
}; };
template<class mt_policy> template<class mt_policy>
@ -939,7 +947,8 @@ namespace sigslot {
class _signal_base4 : public _signal_base<mt_policy> { class _signal_base4 : public _signal_base<mt_policy> {
public: public:
typedef std::list<_connection_base4<arg1_type, arg2_type, arg3_type, typedef std::list<_connection_base4<arg1_type, arg2_type, arg3_type,
arg4_type, mt_policy> *> connections_list; arg4_type, mt_policy> *>
connections_list;
typedef typename connections_list::const_iterator const_iterator; typedef typename connections_list::const_iterator const_iterator;
typedef typename connections_list::iterator iterator; typedef typename connections_list::iterator iterator;
@ -1043,7 +1052,8 @@ namespace sigslot {
class _signal_base5 : public _signal_base<mt_policy> { class _signal_base5 : public _signal_base<mt_policy> {
public: public:
typedef std::list<_connection_base5<arg1_type, arg2_type, arg3_type, typedef std::list<_connection_base5<arg1_type, arg2_type, arg3_type,
arg4_type, arg5_type, mt_policy> *> connections_list; arg4_type, arg5_type, mt_policy> *>
connections_list;
typedef typename connections_list::const_iterator const_iterator; typedef typename connections_list::const_iterator const_iterator;
typedef typename connections_list::iterator iterator; typedef typename connections_list::iterator iterator;
@ -1148,7 +1158,8 @@ namespace sigslot {
class _signal_base6 : public _signal_base<mt_policy> { class _signal_base6 : public _signal_base<mt_policy> {
public: public:
typedef std::list<_connection_base6<arg1_type, arg2_type, arg3_type, typedef std::list<_connection_base6<arg1_type, arg2_type, arg3_type,
arg4_type, arg5_type, arg6_type, mt_policy> *> connections_list; arg4_type, arg5_type, arg6_type, mt_policy> *>
connections_list;
typedef typename connections_list::const_iterator const_iterator; typedef typename connections_list::const_iterator const_iterator;
typedef typename connections_list::iterator iterator; typedef typename connections_list::iterator iterator;
@ -1253,7 +1264,8 @@ namespace sigslot {
class _signal_base7 : public _signal_base<mt_policy> { class _signal_base7 : public _signal_base<mt_policy> {
public: public:
typedef std::list<_connection_base7<arg1_type, arg2_type, arg3_type, typedef std::list<_connection_base7<arg1_type, arg2_type, arg3_type,
arg4_type, arg5_type, arg6_type, arg7_type, mt_policy> *> connections_list; arg4_type, arg5_type, arg6_type, arg7_type, mt_policy> *>
connections_list;
typedef typename connections_list::const_iterator const_iterator; typedef typename connections_list::const_iterator const_iterator;
typedef typename connections_list::iterator iterator; typedef typename connections_list::iterator iterator;
@ -1496,7 +1508,7 @@ namespace sigslot {
private: private:
dest_type *m_pobject; dest_type *m_pobject;
void (dest_type::* m_pmemfun)(); void (dest_type::*m_pmemfun)();
}; };
template<class dest_type, class arg1_type, class mt_policy> template<class dest_type, class arg1_type, class mt_policy>
@ -1535,7 +1547,7 @@ namespace sigslot {
private: private:
dest_type *m_pobject; dest_type *m_pobject;
void (dest_type::* m_pmemfun)(arg1_type); void (dest_type::*m_pmemfun)(arg1_type);
}; };
template<class dest_type, class arg1_type, class arg2_type, class mt_policy> template<class dest_type, class arg1_type, class arg2_type, class mt_policy>
@ -1576,7 +1588,7 @@ namespace sigslot {
private: private:
dest_type *m_pobject; dest_type *m_pobject;
void (dest_type::* m_pmemfun)(arg1_type, arg2_type); void (dest_type::*m_pmemfun)(arg1_type, arg2_type);
}; };
template<class dest_type, class arg1_type, class arg2_type, class arg3_type, class mt_policy> template<class dest_type, class arg1_type, class arg2_type, class arg3_type, class mt_policy>
@ -1617,7 +1629,7 @@ namespace sigslot {
private: private:
dest_type *m_pobject; dest_type *m_pobject;
void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type); void (dest_type::*m_pmemfun)(arg1_type, arg2_type, arg3_type);
}; };
template<class dest_type, class arg1_type, class arg2_type, class arg3_type, template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
@ -1660,7 +1672,7 @@ namespace sigslot {
private: private:
dest_type *m_pobject; dest_type *m_pobject;
void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, void (dest_type::*m_pmemfun)(arg1_type, arg2_type, arg3_type,
arg4_type); arg4_type);
}; };
@ -1685,13 +1697,15 @@ namespace sigslot {
} }
virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type, virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, mt_policy> *clone() { arg5_type, mt_policy> *
clone() {
return new _connection5<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, return new _connection5<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, mt_policy>(*this); arg5_type, mt_policy>(*this);
} }
virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type, virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, mt_policy> *duplicate(has_slots<mt_policy> *pnewdest) { arg5_type, mt_policy> *
duplicate(has_slots<mt_policy> *pnewdest) {
return new _connection5<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, return new _connection5<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, mt_policy>((dest_type *) pnewdest, m_pmemfun); arg5_type, mt_policy>((dest_type *) pnewdest, m_pmemfun);
} }
@ -1708,7 +1722,7 @@ namespace sigslot {
private: private:
dest_type *m_pobject; dest_type *m_pobject;
void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, void (dest_type::*m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type); arg5_type);
}; };
@ -1733,13 +1747,15 @@ namespace sigslot {
} }
virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type, virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, mt_policy> *clone() { arg5_type, arg6_type, mt_policy> *
clone() {
return new _connection6<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, return new _connection6<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, mt_policy>(*this); arg5_type, arg6_type, mt_policy>(*this);
} }
virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type, virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, mt_policy> *duplicate(has_slots<mt_policy> *pnewdest) { arg5_type, arg6_type, mt_policy> *
duplicate(has_slots<mt_policy> *pnewdest) {
return new _connection6<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, return new _connection6<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, mt_policy>((dest_type *) pnewdest, m_pmemfun); arg5_type, arg6_type, mt_policy>((dest_type *) pnewdest, m_pmemfun);
} }
@ -1756,7 +1772,7 @@ namespace sigslot {
private: private:
dest_type *m_pobject; dest_type *m_pobject;
void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, void (dest_type::*m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type); arg5_type, arg6_type);
}; };
@ -1781,13 +1797,15 @@ namespace sigslot {
} }
virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type, virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, arg7_type, mt_policy> *clone() { arg5_type, arg6_type, arg7_type, mt_policy> *
clone() {
return new _connection7<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, return new _connection7<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, arg7_type, mt_policy>(*this); arg5_type, arg6_type, arg7_type, mt_policy>(*this);
} }
virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type, virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, arg7_type, mt_policy> *duplicate(has_slots<mt_policy> *pnewdest) { arg5_type, arg6_type, arg7_type, mt_policy> *
duplicate(has_slots<mt_policy> *pnewdest) {
return new _connection7<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, return new _connection7<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, arg7_type, mt_policy>((dest_type *) pnewdest, m_pmemfun); arg5_type, arg6_type, arg7_type, mt_policy>((dest_type *) pnewdest, m_pmemfun);
} }
@ -1804,7 +1822,7 @@ namespace sigslot {
private: private:
dest_type *m_pobject; dest_type *m_pobject;
void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, void (dest_type::*m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, arg7_type); arg5_type, arg6_type, arg7_type);
}; };
@ -1831,13 +1849,15 @@ namespace sigslot {
} }
virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type, virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> *clone() { arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> *
clone() {
return new _connection8<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, return new _connection8<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>(*this); arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>(*this);
} }
virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type, virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> *duplicate(has_slots<mt_policy> *pnewdest) { arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> *
duplicate(has_slots<mt_policy> *pnewdest) {
return new _connection8<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, return new _connection8<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>((dest_type *) pnewdest, m_pmemfun); arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>((dest_type *) pnewdest, m_pmemfun);
} }
@ -1854,7 +1874,7 @@ namespace sigslot {
private: private:
dest_type *m_pobject; dest_type *m_pobject;
void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, void (dest_type::*m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
arg5_type, arg6_type, arg7_type, arg8_type); arg5_type, arg6_type, arg7_type, arg8_type);
}; };
@ -1996,8 +2016,7 @@ namespace sigslot {
void connect(desttype *pclass, void (desttype::*pmemfun)(arg1_type, void connect(desttype *pclass, void (desttype::*pmemfun)(arg1_type,
arg2_type)) { arg2_type)) {
lock_block<mt_policy> lock(this); lock_block<mt_policy> lock(this);
_connection2<desttype, arg1_type, arg2_type, mt_policy> *conn = new _connection2<desttype, arg1_type, arg2_type, mt_policy> *conn = new _connection2<desttype, arg1_type, arg2_type, mt_policy>(pclass, pmemfun);
_connection2<desttype, arg1_type, arg2_type, mt_policy>(pclass, pmemfun);
this->m_connected_slots.push_back(conn); this->m_connected_slots.push_back(conn);
pclass->signal_connect(this); pclass->signal_connect(this);
} }

View File

@ -26,8 +26,9 @@
#ifndef BUFFER_CIRCLE_HPP_ #ifndef BUFFER_CIRCLE_HPP_
#define BUFFER_CIRCLE_HPP_ #define BUFFER_CIRCLE_HPP_
#include <vector> #include <cstddef>
#include <stdint.h> #include <stdint.h>
#include <vector>
class BufferCircle { class BufferCircle {
public: public:
@ -67,8 +68,11 @@ public:
//!> Get a buffer at a position //!> Get a buffer at a position
uint8_t *GetBuffer(int32_t pos) { uint8_t *GetBuffer(int32_t pos) {
if (!Valid(pos)) { return NULL; } if (!Valid(pos)) {
else { return SoundBuffer[pos]; } return NULL;
} else {
return SoundBuffer[pos];
}
}; };
//!> Get current buffer size //!> Get current buffer size
@ -78,8 +82,11 @@ public:
//!> Get buffer size at position //!> Get buffer size at position
uint32_t GetBufferSize(int32_t pos) { uint32_t GetBufferSize(int32_t pos) {
if (!Valid(pos)) { return 0; } if (!Valid(pos)) {
else { return BufferSize[pos]; } return 0;
} else {
return BufferSize[pos];
}
}; };
//!> Is current buffer ready //!> Is current buffer ready
@ -89,8 +96,11 @@ public:
//!> Is a buffer at a position ready //!> Is a buffer at a position ready
bool IsBufferReady(int32_t pos) { bool IsBufferReady(int32_t pos) {
if (!Valid(pos)) { return false; } if (!Valid(pos)) {
else { return BufferReady[pos]; } return false;
} else {
return BufferReady[pos];
}
}; };
//!> Set a buffer at a position to a ready state //!> Set a buffer at a position to a ready state
@ -110,8 +120,11 @@ public:
} }
inline uint16_t Prev() { inline uint16_t Prev() {
if (Size() == 0) { return 0; } if (Size() == 0) {
else { return ((int32_t) which - 1 < 0) ? Size() - 1 : which - 1; } return 0;
} else {
return ((int32_t) which - 1 < 0) ? Size() - 1 : which - 1;
}
} }
protected: protected:

View File

@ -26,9 +26,9 @@
#ifndef SOUND_DECODER_HPP #ifndef SOUND_DECODER_HPP
#define SOUND_DECODER_HPP #define SOUND_DECODER_HPP
#include <string>
#include <mutex>
#include <gui/sounds/BufferCircle.hpp> #include <gui/sounds/BufferCircle.hpp>
#include <mutex>
#include <string>
class CFile; class CFile;
@ -133,6 +133,7 @@ public:
SOUND_OGG, SOUND_OGG,
SOUND_WAV SOUND_WAV
}; };
protected: protected:
void Init(); void Init();

View File

@ -28,9 +28,9 @@
#include <vector> #include <vector>
#include <gui/system/CThread.h>
#include <gui/sounds/SoundDecoder.hpp> #include <gui/sounds/SoundDecoder.hpp>
#include <gui/sounds/Voice.h> #include <gui/sounds/Voice.h>
#include <gui/system/CThread.h>
#include <sndcore2/voice.h> #include <sndcore2/voice.h>
#define MAX_DECODERS 16 // can be increased up to 96 #define MAX_DECODERS 16 // can be increased up to 96
@ -70,6 +70,7 @@ public:
bool IsDecoding() { bool IsDecoding() {
return Decoding; return Decoding;
}; };
protected: protected:
SoundHandler(); SoundHandler();

View File

@ -17,12 +17,11 @@
#ifndef _AXSOUND_H_ #ifndef _AXSOUND_H_
#define _AXSOUND_H_ #define _AXSOUND_H_
#include <sndcore2/voice.h>
#include <sndcore2/core.h> #include <sndcore2/core.h>
#include <sndcore2/voice.h>
class Voice { class Voice {
public: public:
enum VoicePriorities { enum VoicePriorities {
PRIO_MIN = 1, PRIO_MIN = 1,
PRIO_MAX = 31 PRIO_MAX = 31

View File

@ -17,9 +17,9 @@
#ifndef CTHREAD_H_ #ifndef CTHREAD_H_
#define CTHREAD_H_ #define CTHREAD_H_
#include <coreinit/thread.h>
#include <malloc.h> #include <malloc.h>
#include <unistd.h> #include <unistd.h>
#include <coreinit/thread.h>
class CThread { class CThread {
public: public:
@ -140,6 +140,7 @@ public:
eAttributeDetach = 0x08, eAttributeDetach = 0x08,
eAttributePinnedAff = 0x10 eAttributePinnedAff = 0x10
}; };
private: private:
static int32_t threadCallback(int32_t argc, const char **argv) { static int32_t threadCallback(int32_t argc, const char **argv) {
//! After call to start() continue with the internal function //! After call to start() continue with the internal function

View File

@ -17,16 +17,16 @@
#ifndef __CVIDEO_H_ #ifndef __CVIDEO_H_
#define __CVIDEO_H_ #define __CVIDEO_H_
#include <gx2/sampler.h>
#include <gx2/draw.h>
#include <gx2/registers.h>
#include <gx2/context.h>
#include <gx2/clear.h>
#include <gx2/swap.h>
#include <gx2/state.h>
#include <gx2/event.h>
#include <gx2/display.h>
#include <gui/gx2_ext.h> #include <gui/gx2_ext.h>
#include <gx2/clear.h>
#include <gx2/context.h>
#include <gx2/display.h>
#include <gx2/draw.h>
#include <gx2/event.h>
#include <gx2/registers.h>
#include <gx2/sampler.h>
#include <gx2/state.h>
#include <gx2/swap.h>
#include <gui/video/shaders/Shader.h> #include <gui/video/shaders/Shader.h>

View File

@ -19,8 +19,8 @@
#include <string> #include <string>
#include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h>
class CursorDrawer { class CursorDrawer {

View File

@ -17,9 +17,9 @@
#ifndef __COLOR_SHADER_H_ #ifndef __COLOR_SHADER_H_
#define __COLOR_SHADER_H_ #define __COLOR_SHADER_H_
#include <gui/video/shaders/VertexShader.h>
#include <gui/video/shaders/PixelShader.h>
#include <gui/video/shaders/FetchShader.h> #include <gui/video/shaders/FetchShader.h>
#include <gui/video/shaders/PixelShader.h>
#include <gui/video/shaders/VertexShader.h>
class ColorShader : public Shader { class ColorShader : public Shader {
private: private:
@ -44,6 +44,7 @@ private:
uint32_t colorLocation; uint32_t colorLocation;
uint32_t colorIntensityLocation; uint32_t colorIntensityLocation;
uint32_t positionLocation; uint32_t positionLocation;
public: public:
static const uint32_t cuColorVtxsSize = 4 * cuColorAttrSize; static const uint32_t cuColorVtxsSize = 4 * cuColorAttrSize;

View File

@ -17,9 +17,9 @@
#ifndef __FXAA_SHADER_H_ #ifndef __FXAA_SHADER_H_
#define __FXAA_SHADER_H_ #define __FXAA_SHADER_H_
#include <gui/video/shaders/VertexShader.h>
#include <gui/video/shaders/PixelShader.h>
#include <gui/video/shaders/FetchShader.h> #include <gui/video/shaders/FetchShader.h>
#include <gui/video/shaders/PixelShader.h>
#include <gui/video/shaders/VertexShader.h>
class FXAAShader : public Shader { class FXAAShader : public Shader {
public: public:

View File

@ -19,11 +19,11 @@
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/matrix_transform.hpp>
#include <gx2/shaders.h>
#include <gx2/mem.h>
#include <gx2/enum.h>
#include <gx2/registers.h>
#include <gx2/draw.h> #include <gx2/draw.h>
#include <gx2/enum.h>
#include <gx2/mem.h>
#include <gx2/registers.h>
#include <gx2/shaders.h>
#include <malloc.h> #include <malloc.h>
class Shader { class Shader {

View File

@ -17,9 +17,9 @@
#ifndef SHADER_3D_H_ #ifndef SHADER_3D_H_
#define SHADER_3D_H_ #define SHADER_3D_H_
#include <gui/video/shaders/VertexShader.h>
#include <gui/video/shaders/PixelShader.h>
#include <gui/video/shaders/FetchShader.h> #include <gui/video/shaders/FetchShader.h>
#include <gui/video/shaders/PixelShader.h>
#include <gui/video/shaders/VertexShader.h>
class Shader3D : public Shader { class Shader3D : public Shader {
private: private:
@ -50,6 +50,7 @@ private:
uint32_t fadeDistanceLocation; uint32_t fadeDistanceLocation;
uint32_t fadeOutLocation; uint32_t fadeOutLocation;
uint32_t samplerLocation; uint32_t samplerLocation;
public: public:
static Shader3D *instance() { static Shader3D *instance() {
if (!shaderInstance) { if (!shaderInstance) {

View File

@ -17,9 +17,9 @@
#ifndef SHADER_FRACTAL_COLOR_H_ #ifndef SHADER_FRACTAL_COLOR_H_
#define SHADER_FRACTAL_COLOR_H_ #define SHADER_FRACTAL_COLOR_H_
#include <gui/video/shaders/VertexShader.h>
#include <gui/video/shaders/PixelShader.h>
#include <gui/video/shaders/FetchShader.h> #include <gui/video/shaders/FetchShader.h>
#include <gui/video/shaders/PixelShader.h>
#include <gui/video/shaders/VertexShader.h>
class ShaderFractalColor : public Shader { class ShaderFractalColor : public Shader {
private: private:
@ -53,6 +53,7 @@ private:
uint32_t colorIntensityLocation; uint32_t colorIntensityLocation;
uint32_t fadeOutLocation; uint32_t fadeOutLocation;
uint32_t fractalLocation; uint32_t fractalLocation;
public: public:
static ShaderFractalColor *instance() { static ShaderFractalColor *instance() {
if (!shaderInstance) { if (!shaderInstance) {

View File

@ -17,9 +17,9 @@
#ifndef __TEXTURE_2D_SHADER_H_ #ifndef __TEXTURE_2D_SHADER_H_
#define __TEXTURE_2D_SHADER_H_ #define __TEXTURE_2D_SHADER_H_
#include <gui/video/shaders/VertexShader.h>
#include <gui/video/shaders/PixelShader.h>
#include <gui/video/shaders/FetchShader.h> #include <gui/video/shaders/FetchShader.h>
#include <gui/video/shaders/PixelShader.h>
#include <gui/video/shaders/VertexShader.h>
class Texture2DShader : public Shader { class Texture2DShader : public Shader {
@ -49,6 +49,7 @@ private:
uint32_t samplerLocation; uint32_t samplerLocation;
uint32_t positionLocation; uint32_t positionLocation;
uint32_t texCoordLocation; uint32_t texCoordLocation;
public: public:
static Texture2DShader *instance() { static Texture2DShader *instance() {
if (!shaderInstance) { if (!shaderInstance) {

View File

@ -17,9 +17,9 @@
#ifndef VERTEX_SHADER_H #ifndef VERTEX_SHADER_H
#define VERTEX_SHADER_H #define VERTEX_SHADER_H
#include <string.h>
#include <gui/video/shaders/Shader.h>
#include <gui/gx2_ext.h> #include <gui/gx2_ext.h>
#include <gui/video/shaders/Shader.h>
#include <string.h>
class VertexShader : public Shader { class VertexShader : public Shader {
public: public:

View File

@ -1,9 +1,9 @@
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>
#include <fs/CFile.hpp> #include <fs/CFile.hpp>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
CFile::CFile() { CFile::CFile() {
iFd = -1; iFd = -1;
@ -178,5 +178,3 @@ int32_t CFile::fwrite(const char *format, ...) {
return result; return result;
} }

View File

@ -1,10 +1,10 @@
#ifndef CFILE_HPP_ #ifndef CFILE_HPP_
#define CFILE_HPP_ #define CFILE_HPP_
#include <stdio.h>
#include <string>
#include <string.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <unistd.h> #include <unistd.h>
#include <wut_types.h> #include <wut_types.h>

View File

@ -76,7 +76,7 @@ wchar_t *FreeTypeGX::charToWideChar(const char *strChar) {
if (!strChar) { return NULL; } if (!strChar) { return NULL; }
size_t len = strlen(strChar) + 1; size_t len = strlen(strChar) + 1;
wchar_t *strWChar = new(std::nothrow) wchar_t[len]; wchar_t *strWChar = new (std::nothrow) wchar_t[len];
if (!strWChar) { return NULL; } if (!strWChar) { return NULL; }
size_t bt = mbstowcs(strWChar, strChar, len); size_t bt = mbstowcs(strWChar, strChar, len);
@ -112,7 +112,7 @@ char *FreeTypeGX::wideCharToUTF8(const wchar_t *strChar) {
} }
} }
char *pOut = new(std::nothrow) char[len]; char *pOut = new (std::nothrow) char[len];
if (!pOut) { if (!pOut) {
return NULL; return NULL;
} }
@ -317,7 +317,9 @@ int16_t FreeTypeGX::getStyleOffsetWidth(uint16_t width, uint16_t format) {
return 0; return 0;
} else if (format & FTGX_JUSTIFY_CENTER) { } else if (format & FTGX_JUSTIFY_CENTER) {
return -(width >> 1); return -(width >> 1);
} else if (format & FTGX_JUSTIFY_RIGHT) { return -width; } } else if (format & FTGX_JUSTIFY_RIGHT) {
return -width;
}
return 0; return 0;
} }

View File

@ -1,7 +1,7 @@
#include "utils/utils.h"
#include <gui/GridBackground.h> #include <gui/GridBackground.h>
#include <gui/video/CVideo.h> #include <gui/video/CVideo.h>
#include <gui/video/shaders/Shader3D.h> #include <gui/video/shaders/Shader3D.h>
#include "utils/utils.h"
static const float bgRepeat = 1000.0f; static const float bgRepeat = 1000.0f;
static const float bgTexRotate = 39.0f; static const float bgTexRotate = 39.0f;
@ -49,10 +49,8 @@ GridBackground::GridBackground(GuiImageData *img)
const float cosRot = cosf(DegToRad(bgTexRotate)); const float cosRot = cosf(DegToRad(bgTexRotate));
const float sinRot = sinf(DegToRad(bgTexRotate)); const float sinRot = sinf(DegToRad(bgTexRotate));
glm::mat2 texRotateMtx({ glm::mat2 texRotateMtx({cosRot, -sinRot,
cosRot, -sinRot, sinRot, cosRot});
sinRot, cosRot
});
for (int32_t i = 0; i < 4; i++) { for (int32_t i = 0; i < 4; i++) {
texCoordVec[i] = texRotateMtx * texCoordVec[i]; texCoordVec[i] = texRotateMtx * texCoordVec[i];

View File

@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <gui/GuiButton.h> #include <gui/GuiButton.h>
#include <gui/GuiTrigger.h>
#include <gui/GuiController.h> #include <gui/GuiController.h>
#include <gui/GuiTrigger.h>
/** /**
* Constructor for the GuiButton class. * Constructor for the GuiButton class.
@ -223,8 +223,7 @@ void GuiButton::update(GuiController *c) {
int32_t isClicked = trigger[i]->clicked(c); int32_t isClicked = trigger[i]->clicked(c);
if (!clickedTrigger && (isClicked != GuiTrigger::CLICKED_NONE) if (!clickedTrigger && (isClicked != GuiTrigger::CLICKED_NONE) && (trigger[i]->isClickEverywhere() || (isStateSet(STATE_SELECTED | STATE_OVER, c->chanIdx) && trigger[i]->isSelectionClickEverywhere()) || this->isInside(c->data.x, c->data.y))) {
&& (trigger[i]->isClickEverywhere() || (isStateSet(STATE_SELECTED | STATE_OVER, c->chanIdx) && trigger[i]->isSelectionClickEverywhere()) || this->isInside(c->data.x, c->data.y))) {
if (soundClick) { if (soundClick) {
soundClick->Play(); soundClick->Play();
} }
@ -253,8 +252,7 @@ void GuiButton::update(GuiController *c) {
if (holdable) { if (holdable) {
bool isHeld = trigger[i]->held(c); bool isHeld = trigger[i]->held(c);
if ((!heldTrigger || heldTrigger == trigger[i]) && isHeld if ((!heldTrigger || heldTrigger == trigger[i]) && isHeld && (trigger[i]->isHoldEverywhere() || (isStateSet(STATE_SELECTED | STATE_OVER, c->chanIdx) && trigger[i]->isSelectionClickEverywhere()) || this->isInside(c->data.x, c->data.y))) {
&& (trigger[i]->isHoldEverywhere() || (isStateSet(STATE_SELECTED | STATE_OVER, c->chanIdx) && trigger[i]->isSelectionClickEverywhere()) || this->isInside(c->data.x, c->data.y))) {
heldTrigger = trigger[i]; heldTrigger = trigger[i];
if (!isStateSet(STATE_HELD, c->chanIdx)) { if (!isStateSet(STATE_HELD, c->chanIdx)) {

View File

@ -31,7 +31,6 @@ GuiCheckBox::GuiCheckBox(GuiImage *background, bool checked, float width, float
* Destructor for the GuiCheckBox class. * Destructor for the GuiCheckBox class.
*/ */
GuiCheckBox::~GuiCheckBox() { GuiCheckBox::~GuiCheckBox() {
} }
void GuiCheckBox::setImageBackground(GuiImage *img) { void GuiCheckBox::setImageBackground(GuiImage *img) {

View File

@ -15,8 +15,8 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <gui/GuiDragListener.h>
#include <gui/GuiController.h> #include <gui/GuiController.h>
#include <gui/GuiDragListener.h>
/** /**
* Constructor for the GuiDragListener class. * Constructor for the GuiDragListener class.

View File

@ -280,8 +280,7 @@ void GuiElement::updateEffects() {
} else if (effects & EFFECT_SCALE) { } else if (effects & EFFECT_SCALE) {
scaleDyn += effectAmount * 0.01f; scaleDyn += effectAmount * 0.01f;
if ((effectAmount < 0 && scaleDyn <= (effectTarget * 0.01f)) if ((effectAmount < 0 && scaleDyn <= (effectTarget * 0.01f)) || (effectAmount > 0 && scaleDyn >= (effectTarget * 0.01f))) {
|| (effectAmount > 0 && scaleDyn >= (effectTarget * 0.01f))) {
scaleDyn = effectTarget * 0.01f; scaleDyn = effectTarget * 0.01f;
effects = 0; // shut off effect effects = 0; // shut off effect
effectFinished(this); effectFinished(this);

View File

@ -14,11 +14,11 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include "utils/utils.h"
#include <gui/GuiImage.h> #include <gui/GuiImage.h>
#include <gui/video/CVideo.h> #include <gui/video/CVideo.h>
#include <gui/video/shaders/Texture2DShader.h>
#include <gui/video/shaders/ColorShader.h> #include <gui/video/shaders/ColorShader.h>
#include "utils/utils.h" #include <gui/video/shaders/Texture2DShader.h>
static const float fPiDiv180 = ((float) M_PI / 180.0f); static const float fPiDiv180 = ((float) M_PI / 180.0f);
@ -108,9 +108,8 @@ void GuiImage::setImageData(GuiImageData *img) {
GX2Color GuiImage::getPixel(int32_t x, int32_t y) { GX2Color GuiImage::getPixel(int32_t x, int32_t y) {
if (!imageData || this->getWidth() <= 0 || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight()) { if (!imageData || this->getWidth() <= 0 || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight()) {
return (GX2Color) { return (GX2Color){
0, 0, 0, 0 0, 0, 0, 0};
};
} }
uint32_t pitch = imageData->getTexture()->surface.pitch; uint32_t pitch = imageData->getTexture()->surface.pitch;
@ -211,38 +210,38 @@ void GuiImage::draw(CVideo *pVideo) {
//! angle of the object //! angle of the object
imageAngle = DegToRad(getAngle()); imageAngle = DegToRad(getAngle());
// if(image && tileHorizontal > 0 && tileVertical > 0) // if(image && tileHorizontal > 0 && tileVertical > 0)
// { // {
// for(int32_t n=0; n<tileVertical; n++) // for(int32_t n=0; n<tileVertical; n++)
// for(int32_t i=0; i<tileHorizontal; i++) // for(int32_t i=0; i<tileHorizontal; i++)
// { // {
// if(bUnCut) // if(bUnCut)
// Menu_DrawImg(image, width, height, format, currLeft+width*i, currTop+width*n, currZ, imageangle, currScaleX, currScaleY, currAlpha); // Menu_DrawImg(image, width, height, format, currLeft+width*i, currTop+width*n, currZ, imageangle, currScaleX, currScaleY, currAlpha);
// else // else
// Menu_DrawImgCut(image, width, height, format, currLeft+width*i, currTop+width*n, currZ, imageangle, currScaleX, currScaleY, currAlpha, cutBoundsRect.x1(), cutBoundsRect.x2(), cutBoundsRect.y1(), cutBoundsRect.y2()); // Menu_DrawImgCut(image, width, height, format, currLeft+width*i, currTop+width*n, currZ, imageangle, currScaleX, currScaleY, currAlpha, cutBoundsRect.x1(), cutBoundsRect.x2(), cutBoundsRect.y1(), cutBoundsRect.y2());
// } // }
// } // }
// else if(image && tileHorizontal > 0) // else if(image && tileHorizontal > 0)
// { // {
// for(int32_t i=0; i<tileHorizontal; i++) // for(int32_t i=0; i<tileHorizontal; i++)
// { // {
// int32_t widthTile = (imageangle == 90 || imageangle == 270) ? height : width; // int32_t widthTile = (imageangle == 90 || imageangle == 270) ? height : width;
// if(bUnCut) // if(bUnCut)
// Menu_DrawImg(image, width, height, format, currLeft+widthTile*i, currTop, currZ, imageangle, currScaleX, currScaleY, currAlpha); // Menu_DrawImg(image, width, height, format, currLeft+widthTile*i, currTop, currZ, imageangle, currScaleX, currScaleY, currAlpha);
// else // else
// Menu_DrawImgCut(image, width, height, format, currLeft+widthTile*i, currTop, currZ, imageangle, currScaleX, currScaleY, currAlpha, cutBoundsRect.x1(), cutBoundsRect.x2(), cutBoundsRect.y1(), cutBoundsRect.y2()); // Menu_DrawImgCut(image, width, height, format, currLeft+widthTile*i, currTop, currZ, imageangle, currScaleX, currScaleY, currAlpha, cutBoundsRect.x1(), cutBoundsRect.x2(), cutBoundsRect.y1(), cutBoundsRect.y2());
// } // }
// } // }
// else if(image && tileVertical > 0) // else if(image && tileVertical > 0)
// { // {
// for(int32_t i=0; i<tileVertical; i++) // for(int32_t i=0; i<tileVertical; i++)
// { // {
// if(bUnCut) // if(bUnCut)
// Menu_DrawImg(image, width, height, format, currLeft, currTop+height*i, currZ, imageangle, currScaleX, currScaleY, currAlpha); // Menu_DrawImg(image, width, height, format, currLeft, currTop+height*i, currZ, imageangle, currScaleX, currScaleY, currAlpha);
// else // else
// Menu_DrawImgCut(image, width, height, format, currLeft, currTop+height*i, currZ, imageangle, currScaleX, currScaleY, currAlpha, cutBoundsRect.x1(), cutBoundsRect.x2(), cutBoundsRect.y1(), cutBoundsRect.y2()); // Menu_DrawImgCut(image, width, height, format, currLeft, currTop+height*i, currZ, imageangle, currScaleX, currScaleY, currAlpha, cutBoundsRect.x1(), cutBoundsRect.x2(), cutBoundsRect.y1(), cutBoundsRect.y2());
// } // }
// } // }
if (colorVtxsDirty && colorVtxs) { if (colorVtxsDirty && colorVtxs) {
//! flush color vertex only on main GX2 thread //! flush color vertex only on main GX2 thread
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, colorVtxs, colorCount * ColorShader::cuColorAttrSize); GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, colorVtxs, colorCount * ColorShader::cuColorAttrSize);

View File

@ -14,9 +14,9 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <unistd.h>
#include <gui/GuiImageAsync.h>
#include "../fs/CFile.hpp" #include "../fs/CFile.hpp"
#include <gui/GuiImageAsync.h>
#include <unistd.h>
std::vector<GuiImageAsync *> GuiImageAsync::imageQueue; std::vector<GuiImageAsync *> GuiImageAsync::imageQueue;
CThread *GuiImageAsync::pThread = NULL; CThread *GuiImageAsync::pThread = NULL;

View File

@ -14,11 +14,11 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <malloc.h>
#include <string.h>
#include <stdint.h>
#include <gui/GuiImageData.h> #include <gui/GuiImageData.h>
#include <gui/memory.h> #include <gui/memory.h>
#include <malloc.h>
#include <stdint.h>
#include <string.h>
/** /**
* Constructor for the GuiImageData class. * Constructor for the GuiImageData class.

View File

@ -14,10 +14,10 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include "utils/utils.h"
#include <gui/GuiParticleImage.h> #include <gui/GuiParticleImage.h>
#include <gui/video/CVideo.h> #include <gui/video/CVideo.h>
#include <gui/video/shaders/ColorShader.h> #include <gui/video/shaders/ColorShader.h>
#include "utils/utils.h"
#define CIRCLE_VERTEX_COUNT 36 #define CIRCLE_VERTEX_COUNT 36

View File

@ -21,8 +21,8 @@
* 3. This notice may not be removed or altered from any source * 3. This notice may not be removed or altered from any source
* distribution. * distribution.
***************************************************************************/ ***************************************************************************/
#include <gui/GuiScrollbar.h>
#include "utils/utils.h" #include "utils/utils.h"
#include <gui/GuiScrollbar.h>
GuiScrollbar::GuiScrollbar(int32_t h) GuiScrollbar::GuiScrollbar(int32_t h)
: touchTrigger(GuiTrigger::CHANNEL_1, GuiTrigger::VPAD_TOUCH), wpadTouchTrigger(GuiTrigger::CHANNEL_2 | GuiTrigger::CHANNEL_3 | GuiTrigger::CHANNEL_4 | GuiTrigger::CHANNEL_5, GuiTrigger::BUTTON_A) { : touchTrigger(GuiTrigger::CHANNEL_1, GuiTrigger::VPAD_TOUCH), wpadTouchTrigger(GuiTrigger::CHANNEL_2 | GuiTrigger::CHANNEL_3 | GuiTrigger::CHANNEL_4 | GuiTrigger::CHANNEL_5, GuiTrigger::BUTTON_A) {
@ -219,4 +219,3 @@ void GuiScrollbar::update(GuiController *t) {
++ScrollState; ++ScrollState;
} }

View File

@ -14,13 +14,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <vector>
#include <string> #include <string>
#include <vector>
#include <gui/GuiSelectBox.h>
#include <gui/GuiImage.h> #include <gui/GuiImage.h>
#include <gui/GuiTrigger.h>
#include <gui/GuiImageData.h> #include <gui/GuiImageData.h>
#include <gui/GuiSelectBox.h>
#include <gui/GuiTrigger.h>
/** /**
* Constructor for the GuiCheckBox class. * Constructor for the GuiCheckBox class.

View File

@ -14,11 +14,11 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <string.h>
#include <string>
#include <stdio.h>
#include <gui/GuiSound.h> #include <gui/GuiSound.h>
#include <gui/sounds/SoundHandler.hpp> #include <gui/sounds/SoundHandler.hpp>
#include <stdio.h>
#include <string.h>
#include <string>
GuiSound::GuiSound(const char *filepath) { GuiSound::GuiSound(const char *filepath) {
voice = -1; voice = -1;
@ -102,8 +102,6 @@ void GuiSound::Play() {
if (v) { if (v) {
v->setState(Voice::STATE_START); v->setState(Voice::STATE_START);
} }
} }
void GuiSound::Stop() { void GuiSound::Stop() {

View File

@ -14,9 +14,9 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <gui/GuiSwitch.h>
#include <gui/GuiImage.h> #include <gui/GuiImage.h>
#include <gui/GuiImageData.h> #include <gui/GuiImageData.h>
#include <gui/GuiSwitch.h>
/** /**
* Constructor for the GuiSwitch class. * Constructor for the GuiSwitch class.
@ -31,7 +31,6 @@ GuiSwitch::GuiSwitch(GuiImage *background, bool checked, float w, float h)
* Destructor for the GuiSwitch class. * Destructor for the GuiSwitch class.
*/ */
GuiSwitch::~GuiSwitch() { GuiSwitch::~GuiSwitch() {
} }
void GuiSwitch::setImageBackground(GuiImage *img) { void GuiSwitch::setImageBackground(GuiImage *img) {

View File

@ -14,8 +14,8 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <gui/GuiText.h>
#include <gui/FreeTypeGX.h> #include <gui/FreeTypeGX.h>
#include <gui/GuiText.h>
#include <gui/video/CVideo.h> #include <gui/video/CVideo.h>
FreeTypeGX *GuiText::presentFont = NULL; FreeTypeGX *GuiText::presentFont = NULL;
@ -23,9 +23,8 @@ int32_t GuiText::presetSSAA = 2;
int32_t GuiText::presetSize = 28; int32_t GuiText::presetSize = 28;
int32_t GuiText::presetMaxWidth = 0xFFFF; int32_t GuiText::presetMaxWidth = 0xFFFF;
int32_t GuiText::presetAlignment = ALIGN_CENTER | ALIGN_MIDDLE; int32_t GuiText::presetAlignment = ALIGN_CENTER | ALIGN_MIDDLE;
GX2ColorF32 GuiText::presetColor = (GX2ColorF32) { GX2ColorF32 GuiText::presetColor = (GX2ColorF32){
1.0f, 1.0f, 1.0f, 1.0f 1.0f, 1.0f, 1.0f, 1.0f};
};
#define TEXT_SCROLL_DELAY 6 #define TEXT_SCROLL_DELAY 6
#define TEXT_SCROLL_INITIAL_DELAY 10 #define TEXT_SCROLL_INITIAL_DELAY 10
@ -108,7 +107,7 @@ GuiText::GuiText(const wchar_t *t, int32_t s, const glm::vec4 &c) {
if (t) { if (t) {
textMutex.lock(); textMutex.lock();
text = new(std::nothrow) wchar_t[wcslen(t) + 1]; text = new (std::nothrow) wchar_t[wcslen(t) + 1];
if (!text) { if (!text) {
textMutex.unlock(); textMutex.unlock();
return; return;
@ -190,7 +189,7 @@ void GuiText::setTextf(const char *format, ...) {
} }
int32_t max_len = strlen(format) + 8192; int32_t max_len = strlen(format) + 8192;
char *tmp = new(std::nothrow) char[max_len]; char *tmp = new (std::nothrow) char[max_len];
va_list va; va_list va;
va_start(va, format); va_start(va, format);
if ((vsnprintf(tmp, max_len, format, va) >= 0) && tmp) { if ((vsnprintf(tmp, max_len, format, va) >= 0) && tmp) {
@ -217,7 +216,7 @@ void GuiText::setText(const wchar_t *t) {
textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY; textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY;
if (t) { if (t) {
text = new(std::nothrow) wchar_t[wcslen(t) + 1]; text = new (std::nothrow) wchar_t[wcslen(t) + 1];
if (!text) { if (!text) {
textMutex.unlock(); textMutex.unlock();
return; return;
@ -242,9 +241,8 @@ void GuiText::clearDynamicText() {
void GuiText::setPresets(int32_t sz, const glm::vec4 &c, int32_t w, int32_t a) { void GuiText::setPresets(int32_t sz, const glm::vec4 &c, int32_t w, int32_t a) {
presetSize = sz; presetSize = sz;
presetColor = (GX2ColorF32) { presetColor = (GX2ColorF32){
(float) c.r / 255.0f, (float) c.g / 255.0f, (float) c.b / 255.0f, (float) c.a / 255.0f (float) c.r / 255.0f, (float) c.g / 255.0f, (float) c.b / 255.0f, (float) c.a / 255.0f};
};
presetMaxWidth = w; presetMaxWidth = w;
presetAlignment = a; presetAlignment = a;
} }
@ -365,7 +363,7 @@ void GuiText::makeDottedText() {
textDyn.resize(pos + 1); textDyn.resize(pos + 1);
int32_t i = 0, currentWidth = 0; int32_t i = 0, currentWidth = 0;
textDyn[pos] = new(std::nothrow) wchar_t[maxWidth]; textDyn[pos] = new (std::nothrow) wchar_t[maxWidth];
if (!textDyn[pos]) { if (!textDyn[pos]) {
textDyn.resize(pos); textDyn.resize(pos);
textMutex.unlock(); textMutex.unlock();
@ -397,7 +395,7 @@ void GuiText::scrollText(uint32_t frameCount) {
int32_t i = 0, currentWidth = 0; int32_t i = 0, currentWidth = 0;
textDyn.resize(pos + 1); textDyn.resize(pos + 1);
textDyn[pos] = new(std::nothrow) wchar_t[maxWidth]; textDyn[pos] = new (std::nothrow) wchar_t[maxWidth];
if (!textDyn[pos]) { if (!textDyn[pos]) {
textDyn.resize(pos); textDyn.resize(pos);
textMutex.unlock(); textMutex.unlock();
@ -439,7 +437,7 @@ void GuiText::scrollText(uint32_t frameCount) {
int32_t pos = textDyn.size() - 1; int32_t pos = textDyn.size() - 1;
if (!textDyn[pos]) { if (!textDyn[pos]) {
textDyn[pos] = new(std::nothrow) wchar_t[maxWidth]; textDyn[pos] = new (std::nothrow) wchar_t[maxWidth];
} }
if (!textDyn[pos]) { if (!textDyn[pos]) {
@ -491,7 +489,7 @@ void GuiText::wrapText() {
while (text[ch] && linenum < linestodraw) { while (text[ch] && linenum < linestodraw) {
if (linenum >= (int32_t) textDyn.size()) { if (linenum >= (int32_t) textDyn.size()) {
textDyn.resize(linenum + 1); textDyn.resize(linenum + 1);
textDyn[linenum] = new(std::nothrow) wchar_t[maxWidth]; textDyn[linenum] = new (std::nothrow) wchar_t[maxWidth];
if (!textDyn[linenum]) { if (!textDyn[linenum]) {
textDyn.resize(linenum); textDyn.resize(linenum);
break; break;

View File

@ -48,4 +48,3 @@ void GuiToggle::OnToggleClick(GuiButton *button, const GuiController *controller
void GuiToggle::update(GuiController *c) { void GuiToggle::update(GuiController *c) {
GuiButton::update(c); GuiButton::update(c);
} }

View File

@ -14,8 +14,8 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <gui/GuiElement.h>
#include <gui/GuiController.h> #include <gui/GuiController.h>
#include <gui/GuiElement.h>
#include <gui/GuiTrigger.h> #include <gui/GuiTrigger.h>
/** /**
@ -141,4 +141,3 @@ bool GuiTrigger::released(const GuiController *controller) const {
return bResult; return bResult;
} }

View File

@ -23,9 +23,9 @@
* *
* for WiiXplorer 2010 * for WiiXplorer 2010
***************************************************************************/ ***************************************************************************/
#include <gui/sounds/BufferCircle.hpp>
#include <malloc.h> #include <malloc.h>
#include <utils/utils.h> #include <utils/utils.h>
#include <gui/sounds/BufferCircle.hpp>
BufferCircle::BufferCircle() { BufferCircle::BufferCircle() {
which = 0; which = 0;

View File

@ -23,16 +23,16 @@
* *
* for WiiXplorer 2010 * for WiiXplorer 2010
***************************************************************************/ ***************************************************************************/
#include <string> #include "fs/CFile.hpp"
#include <string.h> #include <coreinit/thread.h>
#include <coreinit/time.h>
#include <gui/sounds/Mp3Decoder.hpp>
#include <limits.h> #include <limits.h>
#include <unistd.h>
#include <malloc.h> #include <malloc.h>
#include <math.h> #include <math.h>
#include <coreinit/time.h> #include <string.h>
#include <coreinit/thread.h> #include <string>
#include <gui/sounds/Mp3Decoder.hpp> #include <unistd.h>
#include "fs/CFile.hpp"
Mp3Decoder::Mp3Decoder(const char *filepath) Mp3Decoder::Mp3Decoder(const char *filepath)
: SoundDecoder(filepath) { : SoundDecoder(filepath) {

View File

@ -23,12 +23,12 @@
* *
* for WiiXplorer 2010 * for WiiXplorer 2010
***************************************************************************/ ***************************************************************************/
#include <unistd.h>
#include <malloc.h>
#include <coreinit/time.h>
#include <coreinit/thread.h>
#include <gui/sounds/OggDecoder.hpp>
#include "fs/CFile.hpp" #include "fs/CFile.hpp"
#include <coreinit/thread.h>
#include <coreinit/time.h>
#include <gui/sounds/OggDecoder.hpp>
#include <malloc.h>
#include <unistd.h>
static int ogg_read(void *punt, int bytes, int blocks, int *f) { static int ogg_read(void *punt, int bytes, int blocks, int *f) {
return ((CFile *) f)->read((uint8_t *) punt, bytes * blocks); return ((CFile *) f)->read((uint8_t *) punt, bytes * blocks);
@ -48,11 +48,10 @@ static long ogg_tell(int *f) {
} }
static ov_callbacks callbacks = { static ov_callbacks callbacks = {
(size_t (*)(void *, size_t, size_t, void *)) ogg_read, (size_t(*)(void *, size_t, size_t, void *)) ogg_read,
(int (*)(void *, ogg_int64_t, int)) ogg_seek, (int (*)(void *, ogg_int64_t, int)) ogg_seek,
(int (*)(void *)) ogg_close, (int (*)(void *)) ogg_close,
(long (*)(void *)) ogg_tell (long (*)(void *)) ogg_tell};
};
OggDecoder::OggDecoder(const char *filepath) OggDecoder::OggDecoder(const char *filepath)
: SoundDecoder(filepath) { : SoundDecoder(filepath) {

View File

@ -15,14 +15,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include "fs/CFile.hpp"
#include <coreinit/cache.h>
#include <coreinit/thread.h>
#include <coreinit/time.h>
#include <gui/sounds/SoundDecoder.hpp>
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <coreinit/time.h>
#include <coreinit/thread.h>
#include <coreinit/cache.h>
#include <gui/sounds/SoundDecoder.hpp>
#include "fs/CFile.hpp"
static const uint32_t FixedPointShift = 15; static const uint32_t FixedPointShift = 15;
static const uint32_t FixedPointScale = 1 << FixedPointShift; static const uint32_t FixedPointScale = 1 << FixedPointShift;
@ -99,10 +99,7 @@ int32_t SoundDecoder::Read(uint8_t *buffer, int32_t buffer_size, int32_t pos) {
} }
void SoundDecoder::EnableUpsample(void) { void SoundDecoder::EnableUpsample(void) {
if ((ResampleBuffer == NULL) if ((ResampleBuffer == NULL) && IsStereo() && Is16Bit() && SampleRate != 32000 && SampleRate != 48000) {
&& IsStereo() && Is16Bit()
&& SampleRate != 32000
&& SampleRate != 48000) {
ResampleBuffer = (uint8_t *) memalign(32, SoundBlockSize); ResampleBuffer = (uint8_t *) memalign(32, SoundBlockSize);
ResampleRatio = (FixedPointScale * SampleRate) / 48000; ResampleRatio = (FixedPointScale * SampleRate) / 48000;
SoundBlockSize = (SoundBlockSize * ResampleRatio) / FixedPointScale; SoundBlockSize = (SoundBlockSize * ResampleRatio) / FixedPointScale;
@ -141,9 +138,7 @@ void SoundDecoder::Decode() {
// check if we are not at the pre-last buffer (last buffer is playing) // check if we are not at the pre-last buffer (last buffer is playing)
uint16_t whichPlaying = SoundBuffer.Which(); uint16_t whichPlaying = SoundBuffer.Which();
if (((whichPlaying == 0) && (whichLoad == SoundBuffer.Size() - 2)) if (((whichPlaying == 0) && (whichLoad == SoundBuffer.Size() - 2)) || ((whichPlaying == 1) && (whichLoad == SoundBuffer.Size() - 1)) || (whichLoad == (whichPlaying - 2))) {
|| ((whichPlaying == 1) && (whichLoad == SoundBuffer.Size() - 1))
|| (whichLoad == (whichPlaying - 2))) {
return; return;
} }
@ -214,4 +209,3 @@ void SoundDecoder::Decode() {
Decoding = false; Decoding = false;
} }

View File

@ -23,14 +23,14 @@
* *
* for WiiXplorer 2010 * for WiiXplorer 2010
***************************************************************************/ ***************************************************************************/
#include <unistd.h>
#include <malloc.h>
#include <fs/CFile.hpp> #include <fs/CFile.hpp>
#include <gui/sounds/SoundHandler.hpp>
#include <gui/sounds/WavDecoder.hpp>
#include <gui/sounds/Mp3Decoder.hpp> #include <gui/sounds/Mp3Decoder.hpp>
#include <gui/sounds/OggDecoder.hpp> #include <gui/sounds/OggDecoder.hpp>
#include <gui/sounds/SoundHandler.hpp>
#include <gui/sounds/WavDecoder.hpp>
#include <malloc.h>
#include <sndcore2/core.h> #include <sndcore2/core.h>
#include <unistd.h>
SoundHandler *SoundHandler::handlerInstance = NULL; SoundHandler *SoundHandler::handlerInstance = NULL;

View File

@ -23,10 +23,10 @@
* *
* for WiiXplorer 2010 * for WiiXplorer 2010
***************************************************************************/ ***************************************************************************/
#include <string.h>
#include <gui/sounds/WavDecoder.hpp>
#include "fs/CFile.hpp" #include "fs/CFile.hpp"
#include "utils/utils.h" #include "utils/utils.h"
#include <gui/sounds/WavDecoder.hpp>
#include <string.h>
WavDecoder::WavDecoder(const char *filepath) WavDecoder::WavDecoder(const char *filepath)
: SoundDecoder(filepath) { : SoundDecoder(filepath) {

View File

@ -14,12 +14,12 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include "memory.h"
#include <coreinit/memexpheap.h>
#include <coreinit/memfrmheap.h>
#include <coreinit/memheap.h>
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#include <coreinit/memheap.h>
#include <coreinit/memfrmheap.h>
#include <coreinit/memexpheap.h>
#include "memory.h"
#define MEMORY_ARENA_1 0 #define MEMORY_ARENA_1 0
#define MEMORY_ARENA_2 1 #define MEMORY_ARENA_2 1

View File

@ -9,21 +9,22 @@ extern "C" {
#define LIMIT(x, min, max) \ #define LIMIT(x, min, max) \
({ \ ({ \
typeof( x ) _x = x; \ typeof(x) _x = x; \
typeof( min ) _min = min; \ typeof(min) _min = min; \
typeof( max ) _max = max; \ typeof(max) _max = max; \
( ( ( _x ) < ( _min ) ) ? ( _min ) : ( ( _x ) > ( _max ) ) ? ( _max) : ( _x ) ); \ (((_x) < (_min)) ? (_min) : ((_x) > (_max)) ? (_max) \
}) : (_x)); \
})
#define DegToRad(a) ( (a) * 0.01745329252f ) #define DegToRad(a) ((a) *0.01745329252f)
#define RadToDeg(a) ( (a) * 57.29577951f ) #define RadToDeg(a) ((a) *57.29577951f)
#define ALIGN4(x) (((x) + 3) & ~3) #define ALIGN4(x) (((x) + 3) & ~3)
#define ALIGN32(x) (((x) + 31) & ~31) #define ALIGN32(x) (((x) + 31) & ~31)
#define le16(i) ((((uint16_t) ((i) & 0xFF)) << 8) | ((uint16_t) (((i) & 0xFF00) >> 8))) #define le16(i) ((((uint16_t) ((i) &0xFF)) << 8) | ((uint16_t) (((i) &0xFF00) >> 8)))
#define le32(i) ((((uint32_t)le16((i) & 0xFFFF)) << 16) | ((uint32_t)le16(((i) & 0xFFFF0000) >> 16))) #define le32(i) ((((uint32_t) le16((i) &0xFFFF)) << 16) | ((uint32_t) le16(((i) &0xFFFF0000) >> 16)))
#define le64(i) ((((uint64_t)le32((i) & 0xFFFFFFFFLL)) << 32) | ((uint64_t)le32(((i) & 0xFFFFFFFF00000000LL) >> 32))) #define le64(i) ((((uint64_t) le32((i) &0xFFFFFFFFLL)) << 32) | ((uint64_t) le32(((i) &0xFFFFFFFF00000000LL) >> 32)))
//Needs to have log_init() called beforehand. //Needs to have log_init() called beforehand.
void dumpHex(const void *data, size_t size); void dumpHex(const void *data, size_t size);

View File

@ -14,16 +14,17 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <malloc.h> #include "utils/utils.h"
#include <string.h> #include <cstdint>
#include <gui/video/CVideo.h>
#include <gui/memory.h> #include <gui/memory.h>
#include <gui/video/shaders/Texture2DShader.h> #include <gui/video/CVideo.h>
#include <gui/video/shaders/ColorShader.h> #include <gui/video/shaders/ColorShader.h>
#include <gui/video/shaders/FXAAShader.h>
#include <gui/video/shaders/Shader3D.h> #include <gui/video/shaders/Shader3D.h>
#include <gui/video/shaders/ShaderFractalColor.h> #include <gui/video/shaders/ShaderFractalColor.h>
#include <gui/video/shaders/FXAAShader.h> #include <gui/video/shaders/Texture2DShader.h>
#include "utils/utils.h" #include <malloc.h>
#include <string.h>
CVideo::CVideo(int32_t forceTvScanMode, int32_t forceDrcScanMode) { CVideo::CVideo(int32_t forceTvScanMode, int32_t forceDrcScanMode) {
tvEnabled = false; tvEnabled = false;

View File

@ -18,12 +18,12 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <gui/video/CursorDrawer.h>
#include <gui/video/shaders/ColorShader.h> #include <gui/video/shaders/ColorShader.h>
#include <gui/video/shaders/FXAAShader.h> #include <gui/video/shaders/FXAAShader.h>
#include <gui/video/shaders/Shader3D.h> #include <gui/video/shaders/Shader3D.h>
#include <gui/video/shaders/ShaderFractalColor.h> #include <gui/video/shaders/ShaderFractalColor.h>
#include <gui/video/shaders/Texture2DShader.h> #include <gui/video/shaders/Texture2DShader.h>
#include <gui/video/CursorDrawer.h>
CursorDrawer *CursorDrawer::instance = NULL; CursorDrawer *CursorDrawer::instance = NULL;
@ -48,7 +48,6 @@ void CursorDrawer::init_colorVtxs() {
if (!this->colorVtxs) { if (!this->colorVtxs) {
this->colorVtxs = (uint8_t *) memalign(0x40, sizeof(uint8_t) * 16); this->colorVtxs = (uint8_t *) memalign(0x40, sizeof(uint8_t) * 16);
if (this->colorVtxs == NULL) { return; } if (this->colorVtxs == NULL) { return; }
} }
memset(this->colorVtxs, 0xFF, 16 * sizeof(uint8_t)); memset(this->colorVtxs, 0xFF, 16 * sizeof(uint8_t));

View File

@ -14,9 +14,9 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <gui/video/shaders/ColorShader.h>
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#include <gui/video/shaders/ColorShader.h>
static const uint32_t cpVertexShaderProgram[] = { static const uint32_t cpVertexShaderProgram[] = {
0x00000000, 0x00008009, 0x20000000, 0x000078a0, 0x00000000, 0x00008009, 0x20000000, 0x000078a0,
@ -51,8 +51,7 @@ static const uint32_t cpVertexShaderProgram[] = {
0x02c49f80, 0x80000060, 0x02e08f01, 0xfe0c620f, 0x02c49f80, 0x80000060, 0x02e08f01, 0xfe0c620f,
0x02c01f80, 0x7f00622f, 0xfe242000, 0x10000000, 0x02c01f80, 0x7f00622f, 0xfe242000, 0x10000000,
0xfe20a080, 0x10000020, 0xf2178647, 0x49c0e9fb, 0xfe20a080, 0x10000020, 0xf2178647, 0x49c0e9fb,
0xfbbdb2ab, 0x768ac733 0xfbbdb2ab, 0x768ac733};
};
static const uint32_t cpVertexShaderRegs[] = { static const uint32_t cpVertexShaderRegs[] = {
0x00000103, 0x00000000, 0x00000000, 0x00000001, 0x00000103, 0x00000000, 0x00000000, 0x00000001,
@ -67,8 +66,7 @@ static const uint32_t cpVertexShaderRegs[] = {
0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff,
0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff,
0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff,
0x000000ff, 0x00000000, 0x0000000e, 0x00000010 0x000000ff, 0x00000000, 0x0000000e, 0x00000010};
};
static const uint32_t cpPixelShaderProgram[] = { static const uint32_t cpPixelShaderProgram[] = {
0x20000000, 0x00000ca0, 0x00000000, 0x88062094, 0x20000000, 0x00000ca0, 0x00000000, 0x88062094,
@ -89,8 +87,7 @@ static const uint32_t cpPixelShaderProgram[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00002000, 0x90000000, 0x0004a000, 0x90000020, 0x00002000, 0x90000000, 0x0004a000, 0x90000020,
0x00082001, 0x90000040, 0x000ca081, 0x90000060, 0x00082001, 0x90000040, 0x000ca081, 0x90000060,
0xbb7dd898, 0x9746c59c, 0xc69b00e7, 0x03c36218 0xbb7dd898, 0x9746c59c, 0xc69b00e7, 0x03c36218};
};
static const uint32_t cpPixelShaderRegs[] = { static const uint32_t cpPixelShaderRegs[] = {
0x00000001, 0x00000002, 0x14000001, 0x00000000, 0x00000001, 0x00000002, 0x14000001, 0x00000000,
0x00000001, 0x00000100, 0x00000000, 0x00000000, 0x00000001, 0x00000100, 0x00000000, 0x00000000,
@ -102,8 +99,7 @@ static const uint32_t cpPixelShaderRegs[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x0000000f, 0x00000001, 0x00000010, 0x00000000, 0x0000000f, 0x00000001, 0x00000010,
0x00000000 0x00000000};
};
ColorShader *ColorShader::shaderInstance = NULL; ColorShader *ColorShader::shaderInstance = NULL;
@ -113,9 +109,8 @@ ColorShader::ColorShader()
pixelShader.setProgram(cpPixelShaderProgram, sizeof(cpPixelShaderProgram), cpPixelShaderRegs, sizeof(cpPixelShaderRegs)); pixelShader.setProgram(cpPixelShaderProgram, sizeof(cpPixelShaderProgram), cpPixelShaderRegs, sizeof(cpPixelShaderRegs));
colorIntensityLocation = 0; colorIntensityLocation = 0;
pixelShader.addUniformVar((GX2UniformVar) { pixelShader.addUniformVar((GX2UniformVar){
"unf_color_intensity", GX2_SHADER_VAR_TYPE_FLOAT4, 1, colorIntensityLocation, -1 "unf_color_intensity", GX2_SHADER_VAR_TYPE_FLOAT4, 1, colorIntensityLocation, -1});
});
//! create vertex shader //! create vertex shader
vertexShader.setProgram(cpVertexShaderProgram, sizeof(cpVertexShaderProgram), cpVertexShaderRegs, sizeof(cpVertexShaderRegs)); vertexShader.setProgram(cpVertexShaderProgram, sizeof(cpVertexShaderProgram), cpVertexShaderRegs, sizeof(cpVertexShaderRegs));
@ -123,24 +118,19 @@ ColorShader::ColorShader()
angleLocation = 0; angleLocation = 0;
offsetLocation = 4; offsetLocation = 4;
scaleLocation = 8; scaleLocation = 8;
vertexShader.addUniformVar((GX2UniformVar) { vertexShader.addUniformVar((GX2UniformVar){
"unf_angle", GX2_SHADER_VAR_TYPE_FLOAT, 1, angleLocation, -1 "unf_angle", GX2_SHADER_VAR_TYPE_FLOAT, 1, angleLocation, -1});
}); vertexShader.addUniformVar((GX2UniformVar){
vertexShader.addUniformVar((GX2UniformVar) { "unf_offset", GX2_SHADER_VAR_TYPE_FLOAT3, 1, offsetLocation, -1});
"unf_offset", GX2_SHADER_VAR_TYPE_FLOAT3, 1, offsetLocation, -1 vertexShader.addUniformVar((GX2UniformVar){
}); "unf_scale", GX2_SHADER_VAR_TYPE_FLOAT3, 1, scaleLocation, -1});
vertexShader.addUniformVar((GX2UniformVar) {
"unf_scale", GX2_SHADER_VAR_TYPE_FLOAT3, 1, scaleLocation, -1
});
colorLocation = 1; colorLocation = 1;
positionLocation = 0; positionLocation = 0;
vertexShader.addAttribVar((GX2AttribVar) { vertexShader.addAttribVar((GX2AttribVar){
"attr_color", GX2_SHADER_VAR_TYPE_FLOAT4, 0, colorLocation "attr_color", GX2_SHADER_VAR_TYPE_FLOAT4, 0, colorLocation});
}); vertexShader.addAttribVar((GX2AttribVar){
vertexShader.addAttribVar((GX2AttribVar) { "attr_position", GX2_SHADER_VAR_TYPE_FLOAT3, 0, positionLocation});
"attr_position", GX2_SHADER_VAR_TYPE_FLOAT3, 0, positionLocation
});
//! setup attribute streams //! setup attribute streams
GX2InitAttribStream(vertexShader.getAttributeBuffer(0), positionLocation, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32_32); GX2InitAttribStream(vertexShader.getAttributeBuffer(0), positionLocation, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32_32);

View File

@ -14,9 +14,9 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <gui/video/shaders/FXAAShader.h>
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#include <gui/video/shaders/FXAAShader.h>
static const uint32_t cpVertexShaderProgram[] = { static const uint32_t cpVertexShaderProgram[] = {
0x00000000, 0x00008009, 0x20000000, 0x000004a0, 0x00000000, 0x00008009, 0x20000000, 0x000004a0,
@ -36,8 +36,7 @@ static const uint32_t cpVertexShaderProgram[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xfd001f80, 0x900c2060, 0x0000803f, 0x00000000, 0xfd001f80, 0x900c2060, 0x0000803f, 0x00000000,
0xc1a229f5, 0xd0eddc33, 0x426618fd, 0x8509cfe7 0xc1a229f5, 0xd0eddc33, 0x426618fd, 0x8509cfe7};
};
static const uint32_t cpVertexShaderRegs[] = { static const uint32_t cpVertexShaderRegs[] = {
0x00000102, 0x00000000, 0x00000000, 0x00000001, 0x00000102, 0x00000000, 0x00000000, 0x00000001,
@ -52,8 +51,7 @@ static const uint32_t cpVertexShaderRegs[] = {
0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff,
0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff,
0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff,
0x000000ff, 0x00000000, 0x0000000e, 0x00000010 0x000000ff, 0x00000000, 0x0000000e, 0x00000010};
};
static const uint32_t cpPixelShaderProgram[] = { static const uint32_t cpPixelShaderProgram[] = {
0x20000000, 0x00003ca0, 0xa0000000, 0x000c8080, 0x20000000, 0x00003ca0, 0xa0000000, 0x000c8080,
@ -145,8 +143,7 @@ static const uint32_t cpPixelShaderProgram[] = {
0x10000400, 0x04101df0, 0x00008010, 0xecdfea0d, 0x10000400, 0x04101df0, 0x00008010, 0xecdfea0d,
0x10000500, 0x05101df0, 0x00000011, 0xecdfea0d, 0x10000500, 0x05101df0, 0x00000011, 0xecdfea0d,
0x10000100, 0x01101df0, 0x00008010, 0xecdfea0d, 0x10000100, 0x01101df0, 0x00008010, 0xecdfea0d,
0xfe2e963a, 0x0269a9a3, 0x38f88096, 0x400cf48b 0xfe2e963a, 0x0269a9a3, 0x38f88096, 0x400cf48b};
};
static const uint32_t cpPixelShaderRegs[] = { static const uint32_t cpPixelShaderRegs[] = {
0x00000007, 0x00000002, 0x04000101, 0x00000000, 0x00000007, 0x00000002, 0x04000101, 0x00000000,
0x00000001, 0x00000100, 0x00000000, 0x00000000, 0x00000001, 0x00000100, 0x00000000, 0x00000000,
@ -158,8 +155,7 @@ static const uint32_t cpPixelShaderRegs[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x0000000f, 0x00000001, 0x00000010, 0x00000000, 0x0000000f, 0x00000001, 0x00000010,
0x00000000 0x00000000};
};
FXAAShader *FXAAShader::shaderInstance = NULL; FXAAShader *FXAAShader::shaderInstance = NULL;
@ -169,26 +165,22 @@ FXAAShader::FXAAShader()
pixelShader.setProgram(cpPixelShaderProgram, sizeof(cpPixelShaderProgram), cpPixelShaderRegs, sizeof(cpPixelShaderRegs)); pixelShader.setProgram(cpPixelShaderProgram, sizeof(cpPixelShaderProgram), cpPixelShaderRegs, sizeof(cpPixelShaderRegs));
resolutionLocation = 0; resolutionLocation = 0;
pixelShader.addUniformVar((GX2UniformVar) { pixelShader.addUniformVar((GX2UniformVar){
"unf_resolution", GX2_SHADER_VAR_TYPE_FLOAT2, 1, resolutionLocation, -1 "unf_resolution", GX2_SHADER_VAR_TYPE_FLOAT2, 1, resolutionLocation, -1});
});
samplerLocation = 0; samplerLocation = 0;
pixelShader.addSamplerVar((GX2SamplerVar) { pixelShader.addSamplerVar((GX2SamplerVar){
"sampl_texture", GX2_SAMPLER_VAR_TYPE_SAMPLER_2D, samplerLocation "sampl_texture", GX2_SAMPLER_VAR_TYPE_SAMPLER_2D, samplerLocation});
});
//! create vertex shader //! create vertex shader
vertexShader.setProgram(cpVertexShaderProgram, sizeof(cpVertexShaderProgram), cpVertexShaderRegs, sizeof(cpVertexShaderRegs)); vertexShader.setProgram(cpVertexShaderProgram, sizeof(cpVertexShaderProgram), cpVertexShaderRegs, sizeof(cpVertexShaderRegs));
positionLocation = 0; positionLocation = 0;
texCoordLocation = 1; texCoordLocation = 1;
vertexShader.addAttribVar((GX2AttribVar) { vertexShader.addAttribVar((GX2AttribVar){
"attr_position", GX2_SHADER_VAR_TYPE_FLOAT3, 0, positionLocation "attr_position", GX2_SHADER_VAR_TYPE_FLOAT3, 0, positionLocation});
}); vertexShader.addAttribVar((GX2AttribVar){
vertexShader.addAttribVar((GX2AttribVar) { "attr_texture_coord", GX2_SHADER_VAR_TYPE_FLOAT2, 0, texCoordLocation});
"attr_texture_coord", GX2_SHADER_VAR_TYPE_FLOAT2, 0, texCoordLocation
});
//! setup attribute streams //! setup attribute streams
GX2InitAttribStream(vertexShader.getAttributeBuffer(0), positionLocation, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32_32); GX2InitAttribStream(vertexShader.getAttributeBuffer(0), positionLocation, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32_32);

View File

@ -14,9 +14,9 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <gui/video/shaders/Shader3D.h>
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#include <gui/video/shaders/Shader3D.h>
static const uint32_t cpVertexShaderProgram[] = { static const uint32_t cpVertexShaderProgram[] = {
0x00000000, 0x00008009, 0x20000000, 0x0000e4a1, 0x00000000, 0x00008009, 0x20000000, 0x0000e4a1,
@ -108,8 +108,7 @@ static const uint32_t cpVertexShaderProgram[] = {
0x07c09f80, 0x7e048200, 0x07e00f00, 0xfe008220, 0x07c09f80, 0x7e048200, 0x07e00f00, 0xfe008220,
0x07cc1f01, 0x7e086a4f, 0x07c09f81, 0x7f0c8240, 0x07cc1f01, 0x7e086a4f, 0x07c09f81, 0x7f0c8240,
0x07c08f80, 0xfe088260, 0x2c34800d, 0xe3b4f15e, 0x07c08f80, 0xfe088260, 0x2c34800d, 0xe3b4f15e,
0x7642ed30, 0x7408600d 0x7642ed30, 0x7408600d};
};
static const uint32_t cpVertexShaderRegs[] = { static const uint32_t cpVertexShaderRegs[] = {
0x00000108, 0x00000000, 0x00000002, 0x00000001, 0x00000108, 0x00000000, 0x00000002, 0x00000001,
@ -124,8 +123,7 @@ static const uint32_t cpVertexShaderRegs[] = {
0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff,
0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff,
0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff,
0x000000ff, 0x00000000, 0x0000000e, 0x00000010 0x000000ff, 0x00000000, 0x0000000e, 0x00000010};
};
static const uint32_t cPixelShaderProgram[] = { static const uint32_t cPixelShaderProgram[] = {
0x20000000, 0x000008a4, 0x03000000, 0x01004085, 0x20000000, 0x000008a4, 0x03000000, 0x01004085,
@ -169,8 +167,7 @@ static const uint32_t cPixelShaderProgram[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x10000100, 0x01100df0, 0x00008010, 0xecdfea0d, 0x10000100, 0x01100df0, 0x00008010, 0xecdfea0d,
0x99720984, 0x041cab0d, 0xa28a9ccd, 0x95d199a5 0x99720984, 0x041cab0d, 0xa28a9ccd, 0x95d199a5};
};
static const uint32_t cPixelShaderRegs[] = { static const uint32_t cPixelShaderRegs[] = {
0x00000102, 0x00000002, 0x14000002, 0x00000000, 0x00000102, 0x00000002, 0x14000002, 0x00000000,
0x00000002, 0x00000100, 0x00000101, 0x00000000, 0x00000002, 0x00000100, 0x00000101, 0x00000000,
@ -182,8 +179,7 @@ static const uint32_t cPixelShaderRegs[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x0000000f, 0x00000001, 0x00000010, 0x00000000, 0x0000000f, 0x00000001, 0x00000010,
0x00000000 0x00000000};
};
Shader3D *Shader3D::shaderInstance = NULL; Shader3D *Shader3D::shaderInstance = NULL;
@ -195,44 +191,35 @@ Shader3D::Shader3D()
colorIntensityLocation = 0; colorIntensityLocation = 0;
fadeDistanceLocation = 4; fadeDistanceLocation = 4;
fadeOutLocation = 8; fadeOutLocation = 8;
pixelShader.addUniformVar((GX2UniformVar) { pixelShader.addUniformVar((GX2UniformVar){
"unf_color_intensity", GX2_SHADER_VAR_TYPE_FLOAT4, 1, colorIntensityLocation, -1 "unf_color_intensity", GX2_SHADER_VAR_TYPE_FLOAT4, 1, colorIntensityLocation, -1});
}); pixelShader.addUniformVar((GX2UniformVar){
pixelShader.addUniformVar((GX2UniformVar) { "unf_fade_distance", GX2_SHADER_VAR_TYPE_FLOAT, 1, fadeDistanceLocation, -1});
"unf_fade_distance", GX2_SHADER_VAR_TYPE_FLOAT, 1, fadeDistanceLocation, -1 pixelShader.addUniformVar((GX2UniformVar){
}); "unf_fade_out_alpha", GX2_SHADER_VAR_TYPE_FLOAT4, 1, fadeOutLocation, -1});
pixelShader.addUniformVar((GX2UniformVar) {
"unf_fade_out_alpha", GX2_SHADER_VAR_TYPE_FLOAT4, 1, fadeOutLocation, -1
});
samplerLocation = 0; samplerLocation = 0;
pixelShader.addSamplerVar((GX2SamplerVar) { pixelShader.addSamplerVar((GX2SamplerVar){
"sampl_texture", GX2_SAMPLER_VAR_TYPE_SAMPLER_2D, samplerLocation "sampl_texture", GX2_SAMPLER_VAR_TYPE_SAMPLER_2D, samplerLocation});
});
//! create vertex shader //! create vertex shader
vertexShader.setProgram(cpVertexShaderProgram, sizeof(cpVertexShaderProgram), cpVertexShaderRegs, sizeof(cpVertexShaderRegs)); vertexShader.setProgram(cpVertexShaderProgram, sizeof(cpVertexShaderProgram), cpVertexShaderRegs, sizeof(cpVertexShaderRegs));
modelMatrixLocation = 0; modelMatrixLocation = 0;
projectionMatrixLocation = 16; projectionMatrixLocation = 16;
viewMatrixLocation = 32; viewMatrixLocation = 32;
vertexShader.addUniformVar((GX2UniformVar) { vertexShader.addUniformVar((GX2UniformVar){
"modelMatrix", GX2_SHADER_VAR_TYPE_FLOAT4X4, 1, modelMatrixLocation, -1 "modelMatrix", GX2_SHADER_VAR_TYPE_FLOAT4X4, 1, modelMatrixLocation, -1});
}); vertexShader.addUniformVar((GX2UniformVar){
vertexShader.addUniformVar((GX2UniformVar) { "viewMatrix", GX2_SHADER_VAR_TYPE_FLOAT4X4, 1, projectionMatrixLocation, -1});
"viewMatrix", GX2_SHADER_VAR_TYPE_FLOAT4X4, 1, projectionMatrixLocation, -1 vertexShader.addUniformVar((GX2UniformVar){
}); "projectionMatrix", GX2_SHADER_VAR_TYPE_FLOAT4X4, 1, viewMatrixLocation, -1});
vertexShader.addUniformVar((GX2UniformVar) {
"projectionMatrix", GX2_SHADER_VAR_TYPE_FLOAT4X4, 1, viewMatrixLocation, -1
});
positionLocation = 0; positionLocation = 0;
texCoordLocation = 1; texCoordLocation = 1;
vertexShader.addAttribVar((GX2AttribVar) { vertexShader.addAttribVar((GX2AttribVar){
"attr_position", GX2_SHADER_VAR_TYPE_FLOAT4, 0, positionLocation "attr_position", GX2_SHADER_VAR_TYPE_FLOAT4, 0, positionLocation});
}); vertexShader.addAttribVar((GX2AttribVar){
vertexShader.addAttribVar((GX2AttribVar) { "attr_texture_coord", GX2_SHADER_VAR_TYPE_FLOAT2, 0, texCoordLocation});
"attr_texture_coord", GX2_SHADER_VAR_TYPE_FLOAT2, 0, texCoordLocation
});
//! setup attribute streams //! setup attribute streams
GX2InitAttribStream(vertexShader.getAttributeBuffer(0), positionLocation, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32_32); GX2InitAttribStream(vertexShader.getAttributeBuffer(0), positionLocation, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32_32);

View File

@ -14,9 +14,9 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <gui/video/shaders/ShaderFractalColor.h>
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#include <gui/video/shaders/ShaderFractalColor.h>
static const uint32_t cpVertexShaderProgram[] = { static const uint32_t cpVertexShaderProgram[] = {
0x00000000, 0x00008009, 0x20000000, 0x0000eca1, 0x00000000, 0x00008009, 0x20000000, 0x0000eca1,
@ -106,8 +106,7 @@ static const uint32_t cpVertexShaderProgram[] = {
0x02c41f01, 0x06086a4f, 0x02c49f01, 0x060c6a6f, 0x02c41f01, 0x06086a4f, 0x02c49f01, 0x060c6a6f,
0x02e00f80, 0xfe000220, 0x02c08f00, 0xfe040200, 0x02e00f80, 0xfe000220, 0x02c08f00, 0xfe040200,
0x02e08f01, 0xfe0c0240, 0x02c01f80, 0xfe080260, 0x02e08f01, 0xfe0c0240, 0x02c01f80, 0xfe080260,
0x8aa480ad, 0x2bfc5ca6, 0xb5e05b5b, 0xd48dc71c 0x8aa480ad, 0x2bfc5ca6, 0xb5e05b5b, 0xd48dc71c};
};
static const uint32_t cpVertexShaderRegs[] = { static const uint32_t cpVertexShaderRegs[] = {
0x00000108, 0x00000000, 0x00000004, 0x00000001, 0x00000108, 0x00000000, 0x00000004, 0x00000001,
@ -122,8 +121,7 @@ static const uint32_t cpVertexShaderRegs[] = {
0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff,
0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff,
0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff,
0x000000ff, 0x00000000, 0x0000000e, 0x00000010 0x000000ff, 0x00000000, 0x0000000e, 0x00000010};
};
static const uint32_t cpPixelShaderProgram[] = { static const uint32_t cpPixelShaderProgram[] = {
0x20000000, 0x000008a4, 0x04000000, 0x01004085, 0x20000000, 0x000008a4, 0x04000000, 0x01004085,
@ -262,8 +260,7 @@ static const uint32_t cpPixelShaderProgram[] = {
0x01c49f80, 0x90000020, 0x0000803f, 0x00000000, 0x01c49f80, 0x90000020, 0x0000803f, 0x00000000,
0x7fcc9f80, 0xf880630f, 0xfe20a081, 0x80000000, 0x7fcc9f80, 0xf880630f, 0xfe20a081, 0x80000000,
0x01cc1f80, 0x90000060, 0xc21e82a7, 0x62ccc547, 0x01cc1f80, 0x90000060, 0xc21e82a7, 0x62ccc547,
0x1708607c, 0x73ea57a6 0x1708607c, 0x73ea57a6};
};
static const uint32_t cpPixelShaderRegs[] = { static const uint32_t cpPixelShaderRegs[] = {
0x00000106, 0x00000002, 0x14000003, 0x00000000, 0x00000106, 0x00000002, 0x14000003, 0x00000000,
0x00000003, 0x00000100, 0x00000101, 0x00000102, 0x00000003, 0x00000100, 0x00000101, 0x00000102,
@ -275,8 +272,7 @@ static const uint32_t cpPixelShaderRegs[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x0000000f, 0x00000001, 0x00000010, 0x00000000, 0x0000000f, 0x00000001, 0x00000010,
0x00000000 0x00000000};
};
ShaderFractalColor *ShaderFractalColor::shaderInstance = NULL; ShaderFractalColor *ShaderFractalColor::shaderInstance = NULL;
@ -289,46 +285,36 @@ ShaderFractalColor::ShaderFractalColor()
colorIntensityLocation = 4; colorIntensityLocation = 4;
fadeOutLocation = 8; fadeOutLocation = 8;
fractalLocation = 12; fractalLocation = 12;
pixelShader.addUniformVar((GX2UniformVar) { pixelShader.addUniformVar((GX2UniformVar){
"unf_blur_border", GX2_SHADER_VAR_TYPE_FLOAT, 1, blurLocation, -1 "unf_blur_border", GX2_SHADER_VAR_TYPE_FLOAT, 1, blurLocation, -1});
}); pixelShader.addUniformVar((GX2UniformVar){
pixelShader.addUniformVar((GX2UniformVar) { "unf_color_intensity", GX2_SHADER_VAR_TYPE_FLOAT4, 1, colorIntensityLocation, -1});
"unf_color_intensity", GX2_SHADER_VAR_TYPE_FLOAT4, 1, colorIntensityLocation, -1 pixelShader.addUniformVar((GX2UniformVar){
}); "unf_fade_out_alpha", GX2_SHADER_VAR_TYPE_FLOAT4, 1, fadeOutLocation, -1});
pixelShader.addUniformVar((GX2UniformVar) { pixelShader.addUniformVar((GX2UniformVar){
"unf_fade_out_alpha", GX2_SHADER_VAR_TYPE_FLOAT4, 1, fadeOutLocation, -1 "unf_fract_alpha", GX2_SHADER_VAR_TYPE_INT, 1, fractalLocation, -1});
});
pixelShader.addUniformVar((GX2UniformVar) {
"unf_fract_alpha", GX2_SHADER_VAR_TYPE_INT, 1, fractalLocation, -1
});
//! create vertex shader //! create vertex shader
vertexShader.setProgram(cpVertexShaderProgram, sizeof(cpVertexShaderProgram), cpVertexShaderRegs, sizeof(cpVertexShaderRegs)); vertexShader.setProgram(cpVertexShaderProgram, sizeof(cpVertexShaderProgram), cpVertexShaderRegs, sizeof(cpVertexShaderRegs));
modelMatrixLocation = 0; modelMatrixLocation = 0;
projectionMatrixLocation = 16; projectionMatrixLocation = 16;
viewMatrixLocation = 32; viewMatrixLocation = 32;
vertexShader.addUniformVar((GX2UniformVar) { vertexShader.addUniformVar((GX2UniformVar){
"modelMatrix", GX2_SHADER_VAR_TYPE_FLOAT4X4, 1, modelMatrixLocation, -1 "modelMatrix", GX2_SHADER_VAR_TYPE_FLOAT4X4, 1, modelMatrixLocation, -1});
}); vertexShader.addUniformVar((GX2UniformVar){
vertexShader.addUniformVar((GX2UniformVar) { "projectionMatrix", GX2_SHADER_VAR_TYPE_FLOAT4X4, 1, projectionMatrixLocation, -1});
"projectionMatrix", GX2_SHADER_VAR_TYPE_FLOAT4X4, 1, projectionMatrixLocation, -1 vertexShader.addUniformVar((GX2UniformVar){
}); "viewMatrix", GX2_SHADER_VAR_TYPE_FLOAT4X4, 1, viewMatrixLocation, -1});
vertexShader.addUniformVar((GX2UniformVar) {
"viewMatrix", GX2_SHADER_VAR_TYPE_FLOAT4X4, 1, viewMatrixLocation, -1
});
positionLocation = 0; positionLocation = 0;
colorLocation = 1; colorLocation = 1;
texCoordLocation = 2; texCoordLocation = 2;
vertexShader.addAttribVar((GX2AttribVar) { vertexShader.addAttribVar((GX2AttribVar){
"attr_colors", GX2_SHADER_VAR_TYPE_FLOAT4, 0, colorLocation "attr_colors", GX2_SHADER_VAR_TYPE_FLOAT4, 0, colorLocation});
}); vertexShader.addAttribVar((GX2AttribVar){
vertexShader.addAttribVar((GX2AttribVar) { "attr_position", GX2_SHADER_VAR_TYPE_FLOAT3, 0, positionLocation});
"attr_position", GX2_SHADER_VAR_TYPE_FLOAT3, 0, positionLocation vertexShader.addAttribVar((GX2AttribVar){
}); "attr_texture_coord", GX2_SHADER_VAR_TYPE_FLOAT2, 0, texCoordLocation});
vertexShader.addAttribVar((GX2AttribVar) {
"attr_texture_coord", GX2_SHADER_VAR_TYPE_FLOAT2, 0, texCoordLocation
});
//! setup attribute streams //! setup attribute streams
GX2InitAttribStream(vertexShader.getAttributeBuffer(0), positionLocation, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32_32); GX2InitAttribStream(vertexShader.getAttributeBuffer(0), positionLocation, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32_32);

View File

@ -14,9 +14,9 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <gui/video/shaders/Texture2DShader.h>
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#include <gui/video/shaders/Texture2DShader.h>
static const uint32_t cpVertexShaderProgram[] = { static const uint32_t cpVertexShaderProgram[] = {
0x00000000, 0x00008009, 0x20000000, 0x000080a0, 0x00000000, 0x00008009, 0x20000000, 0x000080a0,
@ -52,8 +52,7 @@ static const uint32_t cpVertexShaderProgram[] = {
0x02c11f80, 0x80000040, 0x01e08f00, 0xfe04624f, 0x02c11f80, 0x80000040, 0x01e08f00, 0xfe04624f,
0x01c01f81, 0x7f08626f, 0xfe2c2000, 0x10004000, 0x01c01f81, 0x7f08626f, 0xfe2c2000, 0x10004000,
0xfe28a080, 0x10004020, 0xeb825790, 0xb6f711be, 0xfe28a080, 0x10004020, 0xeb825790, 0xb6f711be,
0x7c0e2df2, 0x81173cfa 0x7c0e2df2, 0x81173cfa};
};
static const uint32_t cpVertexShaderRegs[] = { static const uint32_t cpVertexShaderRegs[] = {
0x00000103, 0x00000000, 0x00000000, 0x00000001, 0x00000103, 0x00000000, 0x00000000, 0x00000001,
@ -68,8 +67,7 @@ static const uint32_t cpVertexShaderRegs[] = {
0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff,
0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff,
0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff,
0x000000ff, 0x00000000, 0x0000000e, 0x00000010 0x000000ff, 0x00000000, 0x0000000e, 0x00000010};
};
static const uint32_t cPixelShaderProgram[] = { static const uint32_t cPixelShaderProgram[] = {
0x20000000, 0x00000ca4, 0x0b000000, 0x00000085, 0x20000000, 0x00000ca4, 0x0b000000, 0x00000085,
@ -176,8 +174,7 @@ static const uint32_t cPixelShaderProgram[] = {
0x10000400, 0x04100df0, 0x00008010, 0xecdfea0d, 0x10000400, 0x04100df0, 0x00008010, 0xecdfea0d,
0x10000300, 0x06100df0, 0x00008010, 0xecdfea0d, 0x10000300, 0x06100df0, 0x00008010, 0xecdfea0d,
0x10000000, 0x00100df0, 0x00008010, 0xecdfea0d, 0x10000000, 0x00100df0, 0x00008010, 0xecdfea0d,
0xc8581837, 0x22740275, 0x281eddcc, 0xfa8b9b65 0xc8581837, 0x22740275, 0x281eddcc, 0xfa8b9b65};
};
static const uint32_t cPixelShaderRegs[] = { static const uint32_t cPixelShaderRegs[] = {
0x00000109, 0x00000002, 0x14000001, 0x00000000, 0x00000109, 0x00000002, 0x14000001, 0x00000000,
0x00000001, 0x00000100, 0x00000000, 0x00000000, 0x00000001, 0x00000100, 0x00000000, 0x00000000,
@ -189,8 +186,7 @@ static const uint32_t cPixelShaderRegs[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x0000000f, 0x00000001, 0x00000010, 0x00000000, 0x0000000f, 0x00000001, 0x00000010,
0x00000000 0x00000000};
};
Texture2DShader *Texture2DShader::shaderInstance = NULL; Texture2DShader *Texture2DShader::shaderInstance = NULL;
@ -201,17 +197,14 @@ Texture2DShader::Texture2DShader()
blurLocation = 0; blurLocation = 0;
colorIntensityLocation = 4; colorIntensityLocation = 4;
pixelShader.addUniformVar((GX2UniformVar) { pixelShader.addUniformVar((GX2UniformVar){
"unf_blur_texture_direction", GX2_SHADER_VAR_TYPE_FLOAT3, 1, blurLocation, -1 "unf_blur_texture_direction", GX2_SHADER_VAR_TYPE_FLOAT3, 1, blurLocation, -1});
}); pixelShader.addUniformVar((GX2UniformVar){
pixelShader.addUniformVar((GX2UniformVar) { "unf_color_intensity", GX2_SHADER_VAR_TYPE_FLOAT4, 1, colorIntensityLocation, -1});
"unf_color_intensity", GX2_SHADER_VAR_TYPE_FLOAT4, 1, colorIntensityLocation, -1
});
samplerLocation = 0; samplerLocation = 0;
pixelShader.addSamplerVar((GX2SamplerVar) { pixelShader.addSamplerVar((GX2SamplerVar){
"sampl_texture", GX2_SAMPLER_VAR_TYPE_SAMPLER_2D, samplerLocation "sampl_texture", GX2_SAMPLER_VAR_TYPE_SAMPLER_2D, samplerLocation});
});
//! create vertex shader //! create vertex shader
vertexShader.setProgram(cpVertexShaderProgram, sizeof(cpVertexShaderProgram), cpVertexShaderRegs, sizeof(cpVertexShaderRegs)); vertexShader.setProgram(cpVertexShaderProgram, sizeof(cpVertexShaderProgram), cpVertexShaderRegs, sizeof(cpVertexShaderRegs));
@ -219,24 +212,19 @@ Texture2DShader::Texture2DShader()
angleLocation = 0; angleLocation = 0;
offsetLocation = 4; offsetLocation = 4;
scaleLocation = 8; scaleLocation = 8;
vertexShader.addUniformVar((GX2UniformVar) { vertexShader.addUniformVar((GX2UniformVar){
"unf_angle", GX2_SHADER_VAR_TYPE_FLOAT, 1, angleLocation, -1 "unf_angle", GX2_SHADER_VAR_TYPE_FLOAT, 1, angleLocation, -1});
}); vertexShader.addUniformVar((GX2UniformVar){
vertexShader.addUniformVar((GX2UniformVar) { "unf_offset", GX2_SHADER_VAR_TYPE_FLOAT3, 1, offsetLocation, -1});
"unf_offset", GX2_SHADER_VAR_TYPE_FLOAT3, 1, offsetLocation, -1 vertexShader.addUniformVar((GX2UniformVar){
}); "unf_scale", GX2_SHADER_VAR_TYPE_FLOAT3, 1, scaleLocation, -1});
vertexShader.addUniformVar((GX2UniformVar) {
"unf_scale", GX2_SHADER_VAR_TYPE_FLOAT3, 1, scaleLocation, -1
});
positionLocation = 0; positionLocation = 0;
texCoordLocation = 1; texCoordLocation = 1;
vertexShader.addAttribVar((GX2AttribVar) { vertexShader.addAttribVar((GX2AttribVar){
"attr_position", GX2_SHADER_VAR_TYPE_FLOAT3, 0, positionLocation "attr_position", GX2_SHADER_VAR_TYPE_FLOAT3, 0, positionLocation});
}); vertexShader.addAttribVar((GX2AttribVar){
vertexShader.addAttribVar((GX2AttribVar) { "attr_texture_coord", GX2_SHADER_VAR_TYPE_FLOAT2, 0, texCoordLocation});
"attr_texture_coord", GX2_SHADER_VAR_TYPE_FLOAT2, 0, texCoordLocation
});
//! setup attribute streams //! setup attribute streams
GX2InitAttribStream(vertexShader.getAttributeBuffer(0), positionLocation, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32_32); GX2InitAttribStream(vertexShader.getAttributeBuffer(0), positionLocation, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32_32);