mirror of https://github.com/zeldaret/tp.git
Removed JUtility.h and added './tp format'
This commit is contained in:
parent
fa19d7a32e
commit
bf12ea7a11
|
|
@ -2,7 +2,7 @@
|
|||
#define J2DGRAFCONTEXT_H
|
||||
|
||||
#include "JSystem/JGeometry.h"
|
||||
#include "JSystem/JUtility.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include "dolphin/mtx/mtx.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
#ifndef JUTILITY_H
|
||||
#define JUTILITY_H
|
||||
|
||||
#include "dolphin/gx/GXTexture.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
namespace JUtility {
|
||||
|
||||
struct TColor : _GXColor {
|
||||
TColor() { set(-1); }
|
||||
|
||||
TColor(u32 raw) { *(u32*)&r = raw; }
|
||||
|
||||
void set(u32 col) { *(u32*)&r = col; }
|
||||
void set(u8 oR, u8 oG, u8 oB, u8 oA) {
|
||||
r = oR;
|
||||
g = oG;
|
||||
b = oB;
|
||||
a = oA;
|
||||
}
|
||||
|
||||
u32 toUInt32() const { return *(u32*)&r; }
|
||||
|
||||
operator u32() const { return toUInt32(); }
|
||||
void operator=(const TColor& rhs) { ((_GXColor*)this)->operator=(rhs); }
|
||||
};
|
||||
|
||||
} // namespace JUtility
|
||||
|
||||
#endif /* JUTILITY_H */
|
||||
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
#include "JSystem/JGadget/linklist.h"
|
||||
#include "JSystem/JKernel/JKRDisposer.h"
|
||||
#include "JSystem/JUtility.h"
|
||||
#include "JSystem/JUtility/JUTFont.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
class JUTConsole : public JKRDisposer {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#define JUTFADER_H
|
||||
|
||||
#include "JSystem/JGeometry.h"
|
||||
#include "JSystem/JUtility.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
class JUTFader {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef JUTFONT_H
|
||||
#define JUTFONT_H
|
||||
|
||||
#include "JSystem/JUtility.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include "dolphin/gx/GX.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -5,39 +5,29 @@
|
|||
#include "dolphin/types.h"
|
||||
|
||||
namespace JUtility {
|
||||
class TColor {
|
||||
public:
|
||||
struct TColor : public GXColor {
|
||||
TColor(u8 r, u8 g, u8 b, u8 a) { set(r, g, b, a); }
|
||||
TColor() { set(0xffffffff); }
|
||||
TColor(u32 u32Color) { set(u32Color); }
|
||||
TColor(_GXColor gxColor) { set(gxColor); }
|
||||
|
||||
TColor(const TColor& other) { *this = other; }
|
||||
// TColor(const TColor& other) { set(other.toUInt32()); }
|
||||
TColor& operator=(const TColor& other) {
|
||||
mColor = other.mColor;
|
||||
((GXColor*)this)->operator=(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator u32() { return toUInt32(); }
|
||||
u32 toUInt32() { return *(u32*)&mColor; }
|
||||
operator u32() const { return toUInt32(); }
|
||||
u32 toUInt32() const { return *(u32*)&r; }
|
||||
|
||||
void set(u8 cR, u8 cG, u8 cB, u8 cA) {
|
||||
mColor.r = cR;
|
||||
mColor.g = cG;
|
||||
mColor.b = cB;
|
||||
mColor.a = cA;
|
||||
r = cR;
|
||||
g = cG;
|
||||
b = cB;
|
||||
a = cA;
|
||||
}
|
||||
|
||||
void set(u32 u32Color) { *(u32*)&mColor = u32Color; }
|
||||
void set(_GXColor gxColor) { mColor = gxColor; }
|
||||
|
||||
u8 R() const { return mColor.r; }
|
||||
u8 G() const { return mColor.g; }
|
||||
u8 B() const { return mColor.b; }
|
||||
u8 A() const { return mColor.a; }
|
||||
|
||||
private:
|
||||
_GXColor mColor;
|
||||
void set(u32 u32Color) { *(u32*)&r = u32Color; }
|
||||
void set(GXColor gxColor) { *(GXColor*)&r = gxColor; }
|
||||
};
|
||||
} // namespace JUtility
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#define D_METER_D_METER_HIO_H
|
||||
|
||||
#include "JSystem/JKernel/JKRArchive.h"
|
||||
#include "JSystem/JUtility.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include "SSystem/SComponent/c_Xyz.h"
|
||||
#include "SSystem/SComponent/c_sXyz.h"
|
||||
#include "dolphin/types.h"
|
||||
|
|
|
|||
|
|
@ -3,19 +3,12 @@
|
|||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
struct _GXColor {
|
||||
void operator=(const _GXColor& rhs) {
|
||||
r = rhs.r;
|
||||
g = rhs.g;
|
||||
b = rhs.b;
|
||||
a = rhs.a;
|
||||
}
|
||||
|
||||
typedef struct _GXColor {
|
||||
u8 r;
|
||||
u8 g;
|
||||
u8 b;
|
||||
u8 a;
|
||||
};
|
||||
} GXColor;
|
||||
|
||||
struct _GXColorS10 {
|
||||
s16 r;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef F_AP_F_AP_GAME_H
|
||||
#define F_AP_F_AP_GAME_H
|
||||
|
||||
#include "JSystem/JUtility.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
void fapGm_After();
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ void JUTDirectPrint::drawString_f(u16 position_x, u16 position_y, char const* fo
|
|||
/* 802E4798-802E47C8 2DF0D8 0030+00 0/0 2/2 0/0 .text
|
||||
* setCharColor__14JUTDirectPrintFQ28JUtility6TColor */
|
||||
void JUTDirectPrint::setCharColor(JUtility::TColor color) {
|
||||
setCharColor(color.R(), color.G(), color.B());
|
||||
setCharColor(color.r, color.g, color.b);
|
||||
}
|
||||
|
||||
/* 802E47C8-802E495C 2DF108 0194+00 2/2 0/0 0/0 .text setCharColor__14JUTDirectPrintFUcUcUc */
|
||||
|
|
|
|||
55
tools/tp.py
55
tools/tp.py
|
|
@ -343,6 +343,31 @@ def remove_unused_asm():
|
|||
text.stylize("bold green")
|
||||
CONSOLE.print(text)
|
||||
|
||||
@tp.command(name="format")
|
||||
@click.option('--debug/--no-debug')
|
||||
@click.option('--thread-count', '-j', 'thread_count', help="This option is passed forward to all 'make' commands.", default=4)
|
||||
@click.option('--game-path', default=DEFAULT_GAME_PATH, required=True)
|
||||
@click.option('--build-path', default=DEFAULT_BUILD_PATH, required=True)
|
||||
def format(debug, thread_count, game_path, build_path):
|
||||
""" Format all .cpp/.h files using clang-format """
|
||||
|
||||
if debug:
|
||||
LOG.setLevel(logging.DEBUG)
|
||||
|
||||
text = Text("--- Clang-Format")
|
||||
text.stylize("bold magenta")
|
||||
CONSOLE.print(text)
|
||||
|
||||
if clang_format(thread_count):
|
||||
text = Text(" OK")
|
||||
text.stylize("bold green")
|
||||
CONSOLE.print(text)
|
||||
else:
|
||||
text = Text(" ERR")
|
||||
text.stylize("bold red")
|
||||
CONSOLE.print(text)
|
||||
sys.exit(1)
|
||||
|
||||
@tp.command(name="pull-request")
|
||||
@click.option('--debug/--no-debug')
|
||||
@click.option('--thread-count', '-j', 'thread_count', help="This option is passed forward to all 'make' commands.", default=4)
|
||||
|
|
@ -360,6 +385,21 @@ def pull_request(debug, thread_count, game_path, build_path):
|
|||
|
||||
remove_unused_asm()
|
||||
|
||||
#
|
||||
text = Text("--- Clang-Format")
|
||||
text.stylize("bold magenta")
|
||||
CONSOLE.print(text)
|
||||
|
||||
if clang_format(thread_count):
|
||||
text = Text(" OK")
|
||||
text.stylize("bold green")
|
||||
CONSOLE.print(text)
|
||||
else:
|
||||
text = Text(" ERR")
|
||||
text.stylize("bold red")
|
||||
CONSOLE.print(text)
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
text = Text("--- Full Rebuild")
|
||||
text.stylize("bold magenta")
|
||||
|
|
@ -392,21 +432,6 @@ def pull_request(debug, thread_count, game_path, build_path):
|
|||
CONSOLE.print(text)
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
text = Text("--- Clang-Format")
|
||||
text.stylize("bold magenta")
|
||||
CONSOLE.print(text)
|
||||
|
||||
if clang_format(thread_count):
|
||||
text = Text(" OK")
|
||||
text.stylize("bold green")
|
||||
CONSOLE.print(text)
|
||||
else:
|
||||
text = Text(" ERR")
|
||||
text.stylize("bold red")
|
||||
CONSOLE.print(text)
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
text = Text("--- Calculate Progress")
|
||||
text.stylize("bold magenta")
|
||||
|
|
|
|||
Loading…
Reference in New Issue